diff --git a/src/client/common/configSettings.ts b/src/client/common/configSettings.ts index 3a9865aa8427..e776599d3718 100644 --- a/src/client/common/configSettings.ts +++ b/src/client/common/configSettings.ts @@ -24,11 +24,11 @@ import { IUnitTestSettings, IWorkspaceSymbolSettings } from './types'; +import { debounce } from './utils/decorators'; import { SystemVariables } from './variables/systemVariables'; // tslint:disable:no-require-imports no-var-requires const untildify = require('untildify'); -const _debounce = require('lodash/debounce') as typeof import('lodash/debounce'); export class PythonSettings extends EventEmitter implements IPythonSettings { private static pythonSettings: Map = new Map(); @@ -377,7 +377,7 @@ export class PythonSettings extends EventEmitter implements IPythonSettings { // If workspace config changes, then we could have a cascading effect of on change events. // Let's defer the change notification. - _debounce(() => this.emit('change'), 1); + this.debounceChangeNotification(); }; this.disposables.push(this.InterpreterAutoSelectionService.onDidChangeAutoSelectedInterpreter(onDidChange.bind(this))); this.disposables.push(this.workspace.onDidChangeConfiguration((event: ConfigurationChangeEvent) => { @@ -391,6 +391,10 @@ export class PythonSettings extends EventEmitter implements IPythonSettings { this.update(initialConfig); } } + @debounce(1) + protected debounceChangeNotification() { + this.emit('change'); + } } function getAbsolutePath(pathToCheck: string, rootDir: string): string {