Skip to content

Commit 2e5757f

Browse files
committed
Remove some debouncing
1 parent 3ad46fb commit 2e5757f

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

packages/cursorless-engine/src/scopeProviders/ScopeRangeWatcher.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,18 @@ import { ScopeRangeProvider } from "./ScopeRangeProvider";
2020
*/
2121
export class ScopeRangeWatcher {
2222
private disposables: Disposable[] = [];
23-
private debouncer = new Debouncer(() => this.onChange());
23+
private debouncer = new Debouncer(() => this.onChange);
2424
private listeners: (() => void)[] = [];
2525

2626
constructor(
2727
languageDefinitions: LanguageDefinitions,
2828
private scopeRangeProvider: ScopeRangeProvider,
2929
) {
30+
this.onChange = this.onChange.bind(this);
31+
this.onDidChangeScopeRanges = this.onDidChangeScopeRanges.bind(this);
32+
this.onDidChangeIterationScopeRanges =
33+
this.onDidChangeIterationScopeRanges.bind(this);
34+
3035
this.disposables.push(
3136
// An Event which fires when the array of visible editors has changed.
3237
ide().onDidChangeVisibleTextEditors(this.debouncer.run),
@@ -39,13 +44,9 @@ export class ScopeRangeWatcher {
3944
// dirty-state changes.
4045
ide().onDidChangeTextDocument(this.debouncer.run),
4146
ide().onDidChangeTextEditorVisibleRanges(this.debouncer.run),
42-
languageDefinitions.onDidChangeDefinition(this.debouncer.run),
47+
languageDefinitions.onDidChangeDefinition(this.onChange),
4348
this.debouncer,
4449
);
45-
46-
this.onDidChangeScopeRanges = this.onDidChangeScopeRanges.bind(this);
47-
this.onDidChangeIterationScopeRanges =
48-
this.onDidChangeIterationScopeRanges.bind(this);
4950
}
5051

5152
/**

packages/cursorless-engine/src/scopeProviders/ScopeSupportWatcher.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,17 @@ import { ScopeSupportChecker } from "./ScopeSupportChecker";
1919
*/
2020
export class ScopeSupportWatcher {
2121
private disposables: Disposable[] = [];
22-
private debouncer = new Debouncer(() => this.onChange());
22+
private debouncer = new Debouncer(() => this.onChange);
2323
private listeners: ScopeSupportEventCallback[] = [];
2424

2525
constructor(
2626
languageDefinitions: LanguageDefinitions,
2727
private scopeSupportChecker: ScopeSupportChecker,
2828
private scopeInfoProvider: ScopeInfoProvider,
2929
) {
30+
this.onChange = this.onChange.bind(this);
31+
this.onDidChangeScopeSupport = this.onDidChangeScopeSupport.bind(this);
32+
3033
this.disposables.push(
3134
// An event that fires when a text document opens
3235
ide().onDidOpenTextDocument(this.debouncer.run),
@@ -39,11 +42,9 @@ export class ScopeSupportWatcher {
3942
// dirty-state changes.
4043
ide().onDidChangeTextDocument(this.debouncer.run),
4144
languageDefinitions.onDidChangeDefinition(this.debouncer.run),
42-
this.scopeInfoProvider.onDidChangeScopeInfo(() => this.onChange()),
45+
this.scopeInfoProvider.onDidChangeScopeInfo(this.onChange),
4346
this.debouncer,
4447
);
45-
46-
this.onDidChangeScopeSupport = this.onDidChangeScopeSupport.bind(this);
4748
}
4849

4950
/**

0 commit comments

Comments
 (0)