Skip to content

Commit 14c737c

Browse files
authored
Ensure configuration changes are debounced correctly (#4037)
1 parent 5090acc commit 14c737c

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

‎src/client/common/configSettings.ts‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ import {
2424
IUnitTestSettings,
2525
IWorkspaceSymbolSettings
2626
} from './types';
27+
import { debounce } from './utils/decorators';
2728
import { SystemVariables } from './variables/systemVariables';
2829

2930
// tslint:disable:no-require-imports no-var-requires
3031
const untildify = require('untildify');
31-
const _debounce = require('lodash/debounce') as typeof import('lodash/debounce');
3232

3333
export class PythonSettings extends EventEmitter implements IPythonSettings {
3434
private static pythonSettings: Map<string, PythonSettings> = new Map<string, PythonSettings>();
@@ -377,7 +377,7 @@ export class PythonSettings extends EventEmitter implements IPythonSettings {
377377

378378
// If workspace config changes, then we could have a cascading effect of on change events.
379379
// Let's defer the change notification.
380-
_debounce(() => this.emit('change'), 1);
380+
this.debounceChangeNotification();
381381
};
382382
this.disposables.push(this.InterpreterAutoSelectionService.onDidChangeAutoSelectedInterpreter(onDidChange.bind(this)));
383383
this.disposables.push(this.workspace.onDidChangeConfiguration((event: ConfigurationChangeEvent) => {
@@ -391,6 +391,10 @@ export class PythonSettings extends EventEmitter implements IPythonSettings {
391391
this.update(initialConfig);
392392
}
393393
}
394+
@debounce(1)
395+
protected debounceChangeNotification() {
396+
this.emit('change');
397+
}
394398
}
395399

396400
function getAbsolutePath(pathToCheck: string, rootDir: string): string {

0 commit comments

Comments
 (0)