From deec21336233f8ada7f9124db222dd89795b59dd Mon Sep 17 00:00:00 2001 From: Ramya Achutha Rao Date: Wed, 14 Feb 2018 15:00:50 -0800 Subject: [PATCH] Revert "Fix #41571" as it breaks tests This reverts commit 00262fb3900881a65fe30b2771ba8e58cf4a9b09. --- .../services/configuration/node/configuration.ts | 6 ++---- .../test/node/configurationService.test.ts | 13 ------------- 2 files changed, 2 insertions(+), 17 deletions(-) diff --git a/src/vs/workbench/services/configuration/node/configuration.ts b/src/vs/workbench/services/configuration/node/configuration.ts index 8c8a7349406..897e2c0faac 100644 --- a/src/vs/workbench/services/configuration/node/configuration.ts +++ b/src/vs/workbench/services/configuration/node/configuration.ts @@ -92,13 +92,10 @@ export class WorkspaceConfiguration extends Disposable { this._workspaceConfigPath = workspaceConfigPath; + this.stopListeningToWatcher(); return new TPromise((c, e) => { 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._workspaceConfigurationWatcher = new ConfigWatcher(this._workspaceConfigPath.fsPath, { changeBufferDelay: 300, onError: error => errors.onUnexpectedError(error), @@ -147,6 +144,7 @@ export class WorkspaceConfiguration extends Disposable { } private listenToWatcher() { + this._workspaceConfigurationWatcherDisposables.push(this._workspaceConfigurationWatcher); this._workspaceConfigurationWatcher.onDidUpdateConfiguration(() => this._onDidUpdateConfiguration.fire(), this, this._workspaceConfigurationWatcherDisposables); } diff --git a/src/vs/workbench/services/configuration/test/node/configurationService.test.ts b/src/vs/workbench/services/configuration/test/node/configurationService.test.ts index bf72634738b..c7ca291a460 100644 --- a/src/vs/workbench/services/configuration/test/node/configurationService.test.ts +++ b/src/vs/workbench/services/configuration/test/node/configurationService.test.ts @@ -274,19 +274,6 @@ suite('WorkspaceContextService - Workspace', () => { }); }); - test('remove folders and add them back by writing into the file', done => { - const folders = testObject.getWorkspace().folders; - return testObject.removeFolders([folders[0].uri]) - .then(() => { - testObject.onDidChangeWorkspaceFolders(actual => { - assert.deepEqual(actual.added.map(r => r.uri.toString()), [folders[0].uri.toString()]); - done(); - }); - const workspace = { folders: [{ path: folders[0].uri.fsPath }, { path: folders[1].uri.fsPath }] }; - fs.writeFileSync(testObject.getWorkspace().configuration.fsPath, JSON.stringify(workspace, null, '\t')); - }); - }); - test('update folders (remove last and add to end)', () => { const target = sinon.spy(); testObject.onDidChangeWorkspaceFolders(target); -- GitLab