提交 8be19782 编写于 作者: J Johannes Rieken

debt - configuration service is no longer an event emitter but has the onDidChange event *only*

上级 d483315e
......@@ -31,7 +31,7 @@ import {IEditorWorkerService} from 'vs/editor/common/services/editorWorkerServic
import {LanguagesRegistry} from 'vs/editor/common/services/languagesRegistry';
import {ILanguageExtensionPoint, IValidLanguageExtensionPoint, IModeLookupResult, IModeService} from 'vs/editor/common/services/modeService';
import {IModelService} from 'vs/editor/common/services/modelService';
import {IConfigurationService, IConfigurationServiceEvent, ConfigurationServiceEventTypes} from 'vs/platform/configuration/common/configuration';
import {IConfigurationService} from 'vs/platform/configuration/common/configuration';
interface IModeConfigurationMap { [modeId: string]: any; }
......@@ -503,7 +503,7 @@ export class MainThreadModeServiceImpl extends ModeServiceImpl {
});
this._configurationService.addListener(ConfigurationServiceEventTypes.UPDATED, (e: IConfigurationServiceEvent) => this.onConfigurationChange(e.config));
this._configurationService.onDidUpdateConfiguration(e => this.onConfigurationChange(e.config));
}
public onReady(): TPromise<boolean> {
......
......@@ -25,7 +25,7 @@ import {IModeService} from 'vs/editor/common/services/modeService';
import {IModelService} from 'vs/editor/common/services/modelService';
import {IResourceService} from 'vs/editor/common/services/resourceService';
import * as platform from 'vs/base/common/platform';
import {IConfigurationService, ConfigurationServiceEventTypes, IConfigurationServiceEvent} from 'vs/platform/configuration/common/configuration';
import {IConfigurationService} from 'vs/platform/configuration/common/configuration';
import {DEFAULT_INDENTATION} from 'vs/editor/common/config/defaultConfig';
import {IMessageService} from 'vs/platform/message/common/message';
......@@ -284,8 +284,8 @@ export class ModelServiceImpl implements IModelService {
this._messageService.show(Severity.Info, nls.localize('indentAutoMigrate', "Please update your settings: `editor.detectIndentation` replaces `editor.tabSize`: \"auto\" or `editor.insertSpaces`: \"auto\""));
}
};
this._configurationServiceSubscription = this._configurationService.addListener2(ConfigurationServiceEventTypes.UPDATED, (e: IConfigurationServiceEvent) => {
this._configurationServiceSubscription = this._configurationService.onDidUpdateConfiguration(e => {
readConfig(e.config);
});
readConfig(this._configurationService.getConfiguration());
......
......@@ -4,13 +4,12 @@
*--------------------------------------------------------------------------------------------*/
import {createDecorator, ServiceIdentifier} from 'vs/platform/instantiation/common/instantiation';
import {IEventEmitter} from 'vs/base/common/eventEmitter';
import Event from 'vs/base/common/event';
import {TPromise} from 'vs/base/common/winjs.base';
export const IConfigurationService = createDecorator<IConfigurationService>('configurationService');
export interface IConfigurationService extends IEventEmitter {
export interface IConfigurationService {
serviceId: ServiceIdentifier<any>;
/**
......@@ -33,25 +32,10 @@ export interface IConfigurationService extends IEventEmitter {
/**
* Event that fires when the configuration changes.
*/
onDidUpdateConfiguration: Event<{ config: any }>;
}
export class ConfigurationServiceEventTypes {
/**
* This event happens after configuration is updated either programmatically
* or through a file change. It will include a IConfigurationServiceEvent
* object that includes the new config and which section was updated
* or null if entire config was updated.
*
* Subscribers can use the provided updated configuration
* rather than re-pulling for updates
*/
public static UPDATED = 'update';
onDidUpdateConfiguration: Event<IConfigurationServiceEvent>;
}
export interface IConfigurationServiceEvent {
section?: string;
config: any;
}
......
......@@ -6,7 +6,6 @@
import paths = require('vs/base/common/paths');
import {TPromise} from 'vs/base/common/winjs.base';
import {EventEmitter} from 'vs/base/common/eventEmitter';
import objects = require('vs/base/common/objects');
import errors = require('vs/base/common/errors');
import uri from 'vs/base/common/uri';
......@@ -14,13 +13,13 @@ import model = require('./model');
import {RunOnceScheduler} from 'vs/base/common/async';
import {IDisposable, cAll} from 'vs/base/common/lifecycle';
import collections = require('vs/base/common/collections');
import {IConfigurationService, ConfigurationServiceEventTypes} from './configuration';
import {IConfigurationService, IConfigurationServiceEvent} from './configuration';
import {IEventService} from 'vs/platform/event/common/event';
import {IWorkspaceContextService} from 'vs/platform/workspace/common/workspace';
import {EventType, FileChangeType, FileChangesEvent} from 'vs/platform/files/common/files';
import {IConfigurationRegistry, Extensions} from './configurationRegistry';
import {Registry} from 'vs/platform/platform';
import Event, {fromEventEmitter} from 'vs/base/common/event';
import Event, {Emitter} from 'vs/base/common/event';
// ---- service abstract implementation
......@@ -41,13 +40,13 @@ interface ILoadConfigResult {
parseErrors?: string[];
}
export abstract class ConfigurationService extends EventEmitter implements IConfigurationService, IDisposable {
export abstract class ConfigurationService implements IConfigurationService, IDisposable {
public serviceId = IConfigurationService;
private static RELOAD_CONFIGURATION_DELAY = 50;
public onDidUpdateConfiguration: Event<{ config: any }>;
private _onDidUpdateConfiguration = new Emitter<IConfigurationServiceEvent>();
protected contextService: IWorkspaceContextService;
protected eventService: IEventService;
......@@ -61,7 +60,6 @@ export abstract class ConfigurationService extends EventEmitter implements IConf
private reloadConfigurationScheduler: RunOnceScheduler;
constructor(contextService: IWorkspaceContextService, eventService: IEventService, workspaceSettingsRootFolder: string = '.vscode') {
super();
this.contextService = contextService;
this.eventService = eventService;
......@@ -72,11 +70,13 @@ export abstract class ConfigurationService extends EventEmitter implements IConf
config: {}
};
this.onDidUpdateConfiguration = fromEventEmitter(this, ConfigurationServiceEventTypes.UPDATED);
this.registerListeners();
}
get onDidUpdateConfiguration(): Event<IConfigurationServiceEvent> {
return this._onDidUpdateConfiguration.event;
}
protected registerListeners(): void {
let unbind = this.eventService.addListener(EventType.FILE_CHANGES, (events) => this.handleFileEvents(events));
let subscription = Registry.as<IConfigurationRegistry>(Extensions.Configuration).onDidRegisterConfiguration(() => this.onDidRegisterConfiguration());
......@@ -204,13 +204,13 @@ export abstract class ConfigurationService extends EventEmitter implements IConf
this.cachedConfig.config = objects.mixin(objects.clone(model.getDefaultValues()), this.cachedConfig.config, true /* overwrite */);
// emit this as update to listeners
this.emit(ConfigurationServiceEventTypes.UPDATED, { config: this.cachedConfig.config });
this._onDidUpdateConfiguration.fire({ config: this.cachedConfig.config });
}
protected handleConfigurationChange(): void {
if (!this.reloadConfigurationScheduler) {
this.reloadConfigurationScheduler = new RunOnceScheduler(() => {
this.doLoadConfiguration().then((config) => this.emit(ConfigurationServiceEventTypes.UPDATED, { config: config })).done(null, errors.onUnexpectedError);
this.doLoadConfiguration().then((config) => this._onDidUpdateConfiguration.fire({ config: config })).done(null, errors.onUnexpectedError);
}, ConfigurationService.RELOAD_CONFIGURATION_DELAY);
}
......@@ -261,9 +261,7 @@ export abstract class ConfigurationService extends EventEmitter implements IConf
if (this.reloadConfigurationScheduler) {
this.reloadConfigurationScheduler.dispose();
}
this.callOnDispose = cAll(this.callOnDispose);
super.dispose();
this._onDidUpdateConfiguration.dispose();
}
}
......@@ -21,7 +21,7 @@ import {IWorkspaceContextService} from 'vs/workbench/services/workspace/common/c
import {IFilesConfiguration} from 'vs/platform/files/common/files';
import {Position} from 'vs/platform/editor/common/editor';
import {IStorageService} from 'vs/platform/storage/common/storage';
import {IConfigurationService, IConfigurationServiceEvent, ConfigurationServiceEventTypes} from 'vs/platform/configuration/common/configuration';
import {IConfigurationService} from 'vs/platform/configuration/common/configuration';
import {IEventService} from 'vs/platform/event/common/event';
import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation';
import {IMessageService} from 'vs/platform/message/common/message';
......@@ -56,7 +56,7 @@ export abstract class BaseTextEditor extends BaseEditor {
super(id, telemetryService);
this.toUnbind.push(this._eventService.addListener(WorkbenchEventType.WORKBENCH_OPTIONS_CHANGED, (e) => this.onOptionsChanged(e)));
this.toUnbind.push(this.configurationService.addListener(ConfigurationServiceEventTypes.UPDATED, (e: IConfigurationServiceEvent) => this.applyConfiguration(e.config)));
this.toUnbind.push(this.configurationService.onDidUpdateConfiguration(e => this.applyConfiguration(e.config)).dispose);
this.toUnbind.push(_themeService.onDidThemeChange(_ => this.onThemeChanged()).dispose);
}
......
......@@ -4,6 +4,7 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import {IDisposable} from 'vs/base/common/lifecycle';
import {TPromise} from 'vs/base/common/winjs.base';
import {EditorModel, IEncodingSupport} from 'vs/workbench/common/editor';
import {StringEditorModel} from 'vs/workbench/common/editor/stringEditorModel';
......@@ -11,14 +12,14 @@ import URI from 'vs/base/common/uri';
import {IModelContentChangedEvent, EventType, EndOfLinePreference} from 'vs/editor/common/editorCommon';
import {EventType as WorkbenchEventType, UntitledEditorEvent, ResourceEvent} from 'vs/workbench/common/events';
import {IFilesConfiguration} from 'vs/platform/files/common/files';
import {IConfigurationService, IConfigurationServiceEvent, ConfigurationServiceEventTypes} from 'vs/platform/configuration/common/configuration';
import {IConfigurationService} from 'vs/platform/configuration/common/configuration';
import {IEventService} from 'vs/platform/event/common/event';
import {IModeService} from 'vs/editor/common/services/modeService';
import {IModelService} from 'vs/editor/common/services/modelService';
export class UntitledEditorModel extends StringEditorModel implements IEncodingSupport {
private textModelChangeListener: () => void;
private configurationChangeListenerUnbind: () => void;
private configurationChangeListener: IDisposable;
private dirty: boolean;
private configuredEncoding: string;
......@@ -44,7 +45,7 @@ export class UntitledEditorModel extends StringEditorModel implements IEncodingS
private registerListeners(): void {
// Config Changes
this.configurationChangeListenerUnbind = this.configurationService.addListener(ConfigurationServiceEventTypes.UPDATED, (e: IConfigurationServiceEvent) => this.onConfigurationChange(e.config));
this.configurationChangeListener = this.configurationService.onDidUpdateConfiguration(e => this.onConfigurationChange(e.config));
}
private onConfigurationChange(configuration: IFilesConfiguration): void {
......@@ -121,9 +122,9 @@ export class UntitledEditorModel extends StringEditorModel implements IEncodingS
this.textModelChangeListener = null;
}
if (this.configurationChangeListenerUnbind) {
this.configurationChangeListenerUnbind();
this.configurationChangeListenerUnbind = null;
if (this.configurationChangeListener) {
this.configurationChangeListener.dispose();
this.configurationChangeListener = null;
}
this.eventService.emit(WorkbenchEventType.UNTITLED_FILE_DELETED, new UntitledEditorEvent(this.resource));
......
......@@ -21,7 +21,7 @@ import {IKeybindingService} from 'vs/platform/keybinding/common/keybindingServic
import {IWorkspaceContextService}from 'vs/workbench/services/workspace/common/contextService';
import {IWindowService}from 'vs/workbench/services/window/electron-browser/windowService';
import {IWindowConfiguration} from 'vs/workbench/electron-browser/window';
import {IConfigurationService, IConfigurationServiceEvent, ConfigurationServiceEventTypes} from 'vs/platform/configuration/common/configuration';
import {IConfigurationService} from 'vs/platform/configuration/common/configuration';
import win = require('vs/workbench/electron-browser/window');
......@@ -118,7 +118,7 @@ export class ElectronIntegration {
// Configuration changes
let previousConfiguredZoomLevel: number;
this.configurationService.addListener(ConfigurationServiceEventTypes.UPDATED, (e: IConfigurationServiceEvent) => {
this.configurationService.onDidUpdateConfiguration(e => {
let windowConfig: IWindowConfiguration = e.config;
let newZoomLevel = 0;
......
......@@ -11,7 +11,7 @@ import dom = require('vs/base/browser/dom');
import { IAction } from 'vs/base/common/actions';
import { BaseActionItem } from 'vs/base/browser/ui/actionbar/actionbar';
import { IDebugService, State } from 'vs/workbench/parts/debug/common/debug';
import { IConfigurationService, ConfigurationServiceEventTypes } from 'vs/platform/configuration/common/configuration';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
export class SelectConfigActionItem extends BaseActionItem {
......@@ -39,7 +39,7 @@ export class SelectConfigActionItem extends BaseActionItem {
this.toDispose.push(this.debugService.onDidChangeState(state => {
this.select.disabled = state !== State.Inactive;
}));
this.toDispose.push(configurationService.addListener2(ConfigurationServiceEventTypes.UPDATED, e => {
this.toDispose.push(configurationService.onDidUpdateConfiguration(e => {
this.setOptions().done(null, errors.onUnexpectedError);
}));
}
......
......@@ -19,7 +19,7 @@ import {IFilesConfiguration, IFileOperationResult, FileOperationResult, AutoSave
import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation';
import {ILifecycleService} from 'vs/platform/lifecycle/common/lifecycle';
import {IEventService} from 'vs/platform/event/common/event';
import {IConfigurationService, IConfigurationServiceEvent, ConfigurationServiceEventTypes} from 'vs/platform/configuration/common/configuration';
import {IConfigurationService} from 'vs/platform/configuration/common/configuration';
import {ITelemetryService} from 'vs/platform/telemetry/common/telemetry';
/**
......@@ -80,7 +80,7 @@ export abstract class TextFileService implements ITextFileService {
this.lifecycleService.onShutdown(this.dispose, this);
// Configuration changes
this.listenerToUnbind.push(this.configurationService.addListener(ConfigurationServiceEventTypes.UPDATED, (e: IConfigurationServiceEvent) => this.onConfigurationChange(e.config)));
this.listenerToUnbind.push(this.configurationService.onDidUpdateConfiguration(e => this.onConfigurationChange(e.config)).dispose);
// Editor focus change
window.addEventListener('blur', () => this.onEditorFocusChange(), true);
......
......@@ -31,7 +31,7 @@ import {IWorkbenchEditorService} from 'vs/workbench/services/editor/common/edito
import {IPartService} from 'vs/workbench/services/part/common/partService';
import {IWorkspace} from 'vs/platform/workspace/common/workspace';
import {IStorageService} from 'vs/platform/storage/common/storage';
import {IConfigurationService, IConfigurationServiceEvent, ConfigurationServiceEventTypes} from 'vs/platform/configuration/common/configuration';
import {IConfigurationService} from 'vs/platform/configuration/common/configuration';
import {IEventService} from 'vs/platform/event/common/event';
import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation';
import {IProgressService} from 'vs/platform/progress/common/progress';
......@@ -145,7 +145,7 @@ export class ExplorerView extends CollapsibleViewletView {
this.toDispose.push(this.eventService.addListener2(WorkbenchEventType.EDITOR_INPUT_CHANGING, (e: EditorEvent) => this.onEditorInputChanging(e)));
// Also handle configuration updates
this.toDispose.push(this.configurationService.addListener2(ConfigurationServiceEventTypes.UPDATED, (e: IConfigurationServiceEvent) => this.onConfigurationUpdated(e.config, true)));
this.toDispose.push(this.configurationService.onDidUpdateConfiguration(e => this.onConfigurationUpdated(e.config, true)));
});
}
......
......@@ -22,7 +22,7 @@ import {CloseAllWorkingFilesAction, SaveAllAction} from 'vs/workbench/parts/file
import {WorkingFileEntry} from 'vs/workbench/parts/files/common/workingFilesModel';
import {WorkingFilesDragAndDrop, WorkingFilesSorter, WorkingFilesController, WorkingFilesDataSource, WorkingFilesRenderer, WorkingFilesAccessibilityProvider, WorkingFilesActionProvider} from 'vs/workbench/parts/files/browser/views/workingFilesViewer';
import {IWorkbenchEditorService} from 'vs/workbench/services/editor/common/editorService';
import {IConfigurationService, IConfigurationServiceEvent, ConfigurationServiceEventTypes} from 'vs/platform/configuration/common/configuration';
import {IConfigurationService} from 'vs/platform/configuration/common/configuration';
import {IEditorInput} from 'vs/platform/editor/common/editor';
import {IEventService} from 'vs/platform/event/common/event';
import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation';
......@@ -141,7 +141,7 @@ export class WorkingFilesView extends AdaptiveCollapsibleViewletView {
this.toDispose.push(this.eventService.addListener2(WorkbenchEventType.EDITOR_INPUT_CHANGED, (e: EditorEvent) => this.onEditorInputChanged(e)));
// Also handle configuration updates
this.toDispose.push(this.configurationService.addListener2(ConfigurationServiceEventTypes.UPDATED, (e: IConfigurationServiceEvent) => this.onConfigurationUpdated(e.config)));
this.toDispose.push(this.configurationService.onDidUpdateConfiguration(e => this.onConfigurationUpdated(e.config)));
}
private onTextFileDirty(e: LocalFileChangeEvent): void {
......
......@@ -5,6 +5,7 @@
'use strict';
import {IDisposable, dispose} from 'vs/base/common/lifecycle';
import {IWorkbenchContribution} from 'vs/workbench/common/contributions';
import {ICodeEditorService} from 'vs/editor/common/services/codeEditorService';
import {TextFileChangeEvent, EventType} from 'vs/workbench/parts/files/common/files';
......@@ -12,13 +13,13 @@ import {IFilesConfiguration} from 'vs/platform/files/common/files';
import {IPosition, IEditorSelection, IModel} from 'vs/editor/common/editorCommon';
import {Selection} from 'vs/editor/common/core/selection';
import {trimTrailingWhitespace} from 'vs/editor/common/commands/trimTrailingWhitespaceCommand';
import {IConfigurationService, IConfigurationServiceEvent, ConfigurationServiceEventTypes} from 'vs/platform/configuration/common/configuration';
import {IConfigurationService} from 'vs/platform/configuration/common/configuration';
import {IEventService} from 'vs/platform/event/common/event';
// The save participant can change a model before its saved to support various scenarios like trimming trailing whitespace
export class SaveParticipant implements IWorkbenchContribution {
private trimTrailingWhitespace: boolean;
private toUnbind: { (): void; }[];
private toUnbind: IDisposable[];
constructor(
@IConfigurationService private configurationService: IConfigurationService,
......@@ -33,8 +34,8 @@ export class SaveParticipant implements IWorkbenchContribution {
}
private registerListeners(): void {
this.toUnbind.push(this.eventService.addListener(EventType.FILE_SAVING, (e: TextFileChangeEvent) => this.onTextFileSaving(e)));
this.toUnbind.push(this.configurationService.addListener(ConfigurationServiceEventTypes.UPDATED, (e: IConfigurationServiceEvent) => this.onConfigurationChange(e.config)));
this.toUnbind.push(this.eventService.addListener2(EventType.FILE_SAVING, (e: TextFileChangeEvent) => this.onTextFileSaving(e)));
this.toUnbind.push(this.configurationService.onDidUpdateConfiguration(e => this.onConfigurationChange(e.config)));
}
private onConfigurationChange(configuration: IFilesConfiguration): void {
......@@ -93,8 +94,6 @@ export class SaveParticipant implements IWorkbenchContribution {
}
public dispose(): void {
while (this.toUnbind.length) {
this.toUnbind.pop()();
}
this.toUnbind = dispose(this.toUnbind);
}
}
\ No newline at end of file
......@@ -26,7 +26,7 @@ import async = require('vs/base/common/async');
import severity from 'vs/base/common/severity';
import {IOutputService} from 'vs/workbench/parts/output/common/output';
import {IWorkbenchEditorService} from 'vs/workbench/services/editor/common/editorService';
import {IConfigurationService, ConfigurationServiceEventTypes} from 'vs/platform/configuration/common/configuration';
import {IConfigurationService} from 'vs/platform/configuration/common/configuration';
import {IEventService} from 'vs/platform/event/common/event';
import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation';
import {IMessageService, CloseAction} from 'vs/platform/message/common/message';
......@@ -276,7 +276,7 @@ export class AutoFetcher implements git.IAutoFetcher, lifecycle.IDisposable
this.timeout = AutoFetcher.MIN_TIMEOUT;
this.toDispose = [];
this.toDispose.push(this.configurationService.addListener2(ConfigurationServiceEventTypes.UPDATED, e => this.onConfiguration(e.config.git)));
this.toDispose.push(this.configurationService.onDidUpdateConfiguration(e => this.onConfiguration(e.config.git)));
this.onConfiguration(configurationService.getConfiguration<git.IGitConfiguration>('git'));
}
......
......@@ -17,7 +17,7 @@ import {MarkdownEditorInput} from 'vs/workbench/parts/markdown/common/markdownEd
import {EditorEvent, EventType as WorkbenchEventType} from 'vs/workbench/common/events';
import {IWorkbenchEditorService} from 'vs/workbench/services/editor/common/editorService';
import {IWorkspaceContextService} from 'vs/workbench/services/workspace/common/contextService';
import {IConfigurationService, IConfigurationServiceEvent, ConfigurationServiceEventTypes} from 'vs/platform/configuration/common/configuration';
import {IConfigurationService, IConfigurationServiceEvent} from 'vs/platform/configuration/common/configuration';
import {IModelService} from 'vs/editor/common/services/modelService';
import {IEventService} from 'vs/platform/event/common/event';
import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation';
......@@ -37,7 +37,7 @@ export class MarkdownFileTracker implements IWorkbenchContribution {
private static RELOAD_MARKDOWN_DELAY = 300; // delay before reloading markdown preview after user typing
private fileChangeListener: () => void;
private configFileChangeListener: () => void;
private configFileChangeListener: IDisposable;
private themeChangeListener: IDisposable;
private editorInputChangeListener: () => void;
private markdownConfigurationThumbprint: string;
......@@ -65,7 +65,7 @@ export class MarkdownFileTracker implements IWorkbenchContribution {
private registerListeners(): void {
this.fileChangeListener = this.eventService.addListener(FileEventType.FILE_CHANGES, (e: FileChangesEvent) => this.onFileChanges(e));
this.configFileChangeListener = this.configurationService.addListener(ConfigurationServiceEventTypes.UPDATED, (e: IConfigurationServiceEvent) => this.onConfigFileChange(e));
this.configFileChangeListener = this.configurationService.onDidUpdateConfiguration(e => this.onConfigFileChange(e));
// reload markdown editors when their resources change
this.editorInputChangeListener = this.eventService.addListener(WorkbenchEventType.EDITOR_INPUT_CHANGED, (e: EditorEvent) => this.onEditorInputChanged(e));
......@@ -195,7 +195,7 @@ export class MarkdownFileTracker implements IWorkbenchContribution {
}
if (this.configFileChangeListener) {
this.configFileChangeListener();
this.configFileChangeListener.dispose();
this.configFileChangeListener = null;
}
......
......@@ -48,7 +48,7 @@ import {IWorkbenchEditorService} from 'vs/workbench/services/editor/common/edito
import {IViewletService} from 'vs/workbench/services/viewlet/common/viewletService';
import {Range} from 'vs/editor/common/core/range';
import {IStorageService} from 'vs/platform/storage/common/storage';
import {IConfigurationService, IConfigurationServiceEvent, ConfigurationServiceEventTypes} from 'vs/platform/configuration/common/configuration';
import {IConfigurationService} from 'vs/platform/configuration/common/configuration';
import {IContextViewService} from 'vs/platform/contextview/browser/contextView';
import {IEventService} from 'vs/platform/event/common/event';
import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation';
......@@ -684,7 +684,7 @@ export class SearchViewlet extends Viewlet {
this.toUnbind.push(this.eventService.addListener(FileEventType.FILE_CHANGES, (e) => this.onFilesChanged(e)));
this.toUnbind.push(this.eventService.addListener(WorkbenchEventType.UNTITLED_FILE_DELETED, (e) => this.onUntitledFileDeleted(e)));
this.toUnbind.push(this.configurationService.addListener(ConfigurationServiceEventTypes.UPDATED, (e: IConfigurationServiceEvent) => this.onConfigurationUpdated(e.config)));
this.toUnbind.push(this.configurationService.onDidUpdateConfiguration(e => this.onConfigurationUpdated(e.config)).dispose);
}
private onConfigurationUpdated(configuration: any): void {
......
......@@ -35,7 +35,7 @@ import { IEditor } from 'vs/platform/editor/common/editor';
import { IMessageService } from 'vs/platform/message/common/message';
import { IMarkerService, MarkerStatistics } from 'vs/platform/markers/common/markers';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IConfigurationService, ConfigurationServiceEventTypes } from 'vs/platform/configuration/common/configuration';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IFileService, FileChangesEvent, FileChangeType, EventType as FileEventType } from 'vs/platform/files/common/files';
import { IExtensionService } from 'vs/platform/extensions/common/extensions';
......@@ -594,7 +594,7 @@ class TaskService extends EventEmitter implements ITaskService {
this.taskSystemListeners = [];
this.clearTaskSystemPromise = false;
this.outputChannel = this.outputService.getChannel(TaskService.OutputChannelId);
this.configurationService.addListener(ConfigurationServiceEventTypes.UPDATED, () => {
this.configurationService.onDidUpdateConfiguration(() => {
this.emit(TaskServiceEvents.ConfigChanged);
if (this._taskSystem && this._taskSystem.isActiveSync()) {
this.clearTaskSystemPromise = true;
......
......@@ -6,6 +6,7 @@
import nls = require('vs/nls');
import {TPromise} from 'vs/base/common/winjs.base';
import {IDisposable} from 'vs/base/common/lifecycle';
import paths = require('vs/base/common/paths');
import encoding = require('vs/base/node/encoding');
import errors = require('vs/base/common/errors');
......@@ -14,7 +15,7 @@ import uri from 'vs/base/common/uri';
import timer = require('vs/base/common/timer');
import {IFileService, IFilesConfiguration, IResolveFileOptions, IFileStat, IContent, IImportResult, IResolveContentOptions, IUpdateContentOptions} from 'vs/platform/files/common/files';
import {FileService as NodeFileService, IFileServiceOptions, IEncodingOverride} from 'vs/workbench/services/files/node/fileService';
import {IConfigurationService, IConfigurationServiceEvent, ConfigurationServiceEventTypes} from 'vs/platform/configuration/common/configuration';
import {IConfigurationService} from 'vs/platform/configuration/common/configuration';
import {IEventService} from 'vs/platform/event/common/event';
import {IWorkspaceContextService} from 'vs/platform/workspace/common/workspace';
import {Action} from 'vs/base/common/actions';
......@@ -31,7 +32,7 @@ export class FileService implements IFileService {
private raw: IFileService;
private configurationChangeListenerUnbind: () => void;
private configurationChangeListenerUnbind: IDisposable;
constructor(
private configurationService: IConfigurationService,
......@@ -91,7 +92,7 @@ export class FileService implements IFileService {
private registerListeners(): void {
// Config Changes
this.configurationChangeListenerUnbind = this.configurationService.addListener(ConfigurationServiceEventTypes.UPDATED, (e: IConfigurationServiceEvent) => this.onConfigurationChange(e.config));
this.configurationChangeListenerUnbind = this.configurationService.onDidUpdateConfiguration(e => this.onConfigurationChange(e.config));
}
private onConfigurationChange(configuration: IFilesConfiguration): void {
......@@ -219,7 +220,7 @@ export class FileService implements IFileService {
// Listeners
if (this.configurationChangeListenerUnbind) {
this.configurationChangeListenerUnbind();
this.configurationChangeListenerUnbind.dispose();
this.configurationChangeListenerUnbind = null;
}
......
......@@ -14,7 +14,7 @@ import lifecycle = require('vs/base/common/lifecycle');
import timer = require('vs/base/common/timer');
import platform = require('vs/platform/platform');
import async = require('vs/base/common/async');
import {IConfigurationService, IConfigurationServiceEvent, ConfigurationServiceEventTypes} from 'vs/platform/configuration/common/configuration';
import {IConfigurationService} from 'vs/platform/configuration/common/configuration';
import {BaseRequestService} from 'vs/platform/request/common/baseRequestService';
import rawHttpService = require('vs/workbench/services/request/node/rawHttpService');
import {ITelemetryService} from 'vs/platform/telemetry/common/telemetry';
......@@ -41,11 +41,11 @@ export class RequestService extends BaseRequestService {
this.callOnDispose = [];
// proxy setting updating
this.callOnDispose.push(configurationService.addListener(ConfigurationServiceEventTypes.UPDATED, (e: IConfigurationServiceEvent) => {
this.callOnDispose.push(configurationService.onDidUpdateConfiguration(e => {
this.rawHttpServicePromise.then((rawHttpService) => {
rawHttpService.configure(e.config.http && e.config.http.proxy, e.config.http.proxyStrictSSL);
});
}));
}).dispose);
}
private _rawHttpServicePromise: TPromise<IRawHttpService>;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册