Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Ensure configuration changes are debounced correctly
  • Loading branch information
DonJayamanne committed Jan 17, 2019
commit 700bd014a6c0032a88710ad6898b9acc8d58515e
8 changes: 6 additions & 2 deletions src/client/common/configSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, PythonSettings> = new Map<string, PythonSettings>();
Expand Down Expand Up @@ -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) => {
Expand All @@ -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 {
Expand Down