From 822cd7ae8c817286e0fd4560f2b84413694442f3 Mon Sep 17 00:00:00 2001 From: Don Jayamanne Date: Thu, 15 Mar 2018 09:48:25 -0700 Subject: [PATCH] Fixes issue that display incorrect interpreter briefly before updating it to the right value (#1054) * :bug: fire change event only when changes are detected * :memo: change log * :hammer: fix typos * Fixes #981 --- news/2 Fixes/981.md | 1 + src/client/common/configSettings.ts | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) create mode 100644 news/2 Fixes/981.md diff --git a/news/2 Fixes/981.md b/news/2 Fixes/981.md new file mode 100644 index 000000000000..8621551fbbd4 --- /dev/null +++ b/news/2 Fixes/981.md @@ -0,0 +1 @@ +Fixes issue that display incorrect interpreter briefly before updating it to the right value. diff --git a/src/client/common/configSettings.ts b/src/client/common/configSettings.ts index 9da482ded147..d4a16e776b0c 100644 --- a/src/client/common/configSettings.ts +++ b/src/client/common/configSettings.ts @@ -53,6 +53,10 @@ export class PythonSettings extends EventEmitter implements IPythonSettings { this.workspaceRoot = workspaceFolder ? workspaceFolder : vscode.Uri.file(__dirname); this.disposables.push(vscode.workspace.onDidChangeConfiguration(() => { this.initializeSettings(); + + // If workspace config changes, then we could have a cascading effect of on change events. + // Let's defer the change notification. + setTimeout(() => this.emit('change'), 1); })); this.initializeSettings(); @@ -292,10 +296,6 @@ export class PythonSettings extends EventEmitter implements IPythonSettings { launchArgs: [], activateEnvironment: true }; - - // If workspace config changes, then we could have a cascading effect of on change events. - // Let's defer the change notification. - setTimeout(() => this.emit('change'), 1); } public get pythonPath(): string {