diff --git a/src/vs/workbench/services/configuration/node/configuration.ts b/src/vs/workbench/services/configuration/node/configuration.ts index 8c8a73494064470ee65a61dd19672fa6c21e551e..3a91b6124be7311b44776103099961b6a3be5595 100644 --- a/src/vs/workbench/services/configuration/node/configuration.ts +++ b/src/vs/workbench/services/configuration/node/configuration.ts @@ -96,8 +96,7 @@ export class WorkspaceConfiguration extends Disposable { const defaultConfig = new WorkspaceConfigurationModelParser(this._workspaceConfigPath.fsPath); defaultConfig.parse(JSON.stringify({ folders: [] } as IStoredWorkspace, null, '\t')); if (this._workspaceConfigurationWatcher) { - this.stopListeningToWatcher(); - this._workspaceConfigurationWatcher.dispose(); + this.disposeConfigurationWatcher(); } this._workspaceConfigurationWatcher = new ConfigWatcher(this._workspaceConfigPath.fsPath, { changeBufferDelay: 300, @@ -158,8 +157,15 @@ export class WorkspaceConfiguration extends Disposable { this._cache = this._workspaceConfigurationModelParser.settingsModel.merge(this._workspaceConfigurationModelParser.launchModel); } + private disposeConfigurationWatcher(): void { + this.stopListeningToWatcher(); + if (this._workspaceConfigurationWatcher) { + this._workspaceConfigurationWatcher.dispose(); + } + } + dispose(): void { - dispose(this._workspaceConfigurationWatcherDisposables); + this.disposeConfigurationWatcher(); super.dispose(); } }