Skip to content

Commit e6a98c3

Browse files
committed
Remove debounce timeout from change event dispatching in workspace and open editors providers
1 parent 6e9ce0e commit e6a98c3

2 files changed

Lines changed: 4 additions & 26 deletions

File tree

packages/vscode/src/context/providers/open-editors/open-editors-provider.ts

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ export class OpenEditorsProvider
3030
private _config_change_handler: vscode.Disposable
3131
private _workspace_provider: WorkspaceProvider
3232
private _use_compact_token_count: boolean = false
33-
private _change_event_dispatch_timeout: NodeJS.Timeout | null = null
3433

3534
public set_use_compact_token_count(use_compact: boolean): void {
3635
if (this._use_compact_token_count != use_compact) {
@@ -85,15 +84,8 @@ export class OpenEditorsProvider
8584
}
8685

8786
private _dispatch_change_events(): void {
88-
if (this._change_event_dispatch_timeout) {
89-
clearTimeout(this._change_event_dispatch_timeout)
90-
}
91-
92-
this._change_event_dispatch_timeout = setTimeout(() => {
93-
this._on_did_change_checked_files.fire()
94-
this.refresh()
95-
this._change_event_dispatch_timeout = null
96-
}, 500)
87+
this._on_did_change_checked_files.fire()
88+
this.refresh()
9789
}
9890

9991
private _is_file_in_any_workspace(file_path: string): boolean {
@@ -167,9 +159,6 @@ export class OpenEditorsProvider
167159
this._tab_change_handler.dispose()
168160
this._config_change_handler.dispose()
169161
this._on_did_change_checked_files.dispose()
170-
if (this._change_event_dispatch_timeout) {
171-
clearTimeout(this._change_event_dispatch_timeout)
172-
}
173162
}
174163

175164
refresh(): void {

packages/vscode/src/context/providers/workspace/workspace-provider.ts

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ export class WorkspaceProvider
6565
private _file_workspace_map: Map<string, string> = new Map()
6666
public gitignore_initialization: Promise<void>
6767
public ranges_initialization: Promise<void>
68-
private _change_event_dispatch_timeout: NodeJS.Timeout | null = null
6968
public use_compact_token_count: boolean = false
7069

7170
public set_use_compact_token_count(use_compact: boolean): void {
@@ -185,15 +184,8 @@ export class WorkspaceProvider
185184
}
186185

187186
private _dispatch_change_events(): void {
188-
if (this._change_event_dispatch_timeout) {
189-
clearTimeout(this._change_event_dispatch_timeout)
190-
}
191-
192-
this._change_event_dispatch_timeout = setTimeout(() => {
193-
this._on_did_change_checked_files.fire()
194-
this.refresh()
195-
this._change_event_dispatch_timeout = null
196-
}, 500)
187+
this._on_did_change_checked_files.fire()
188+
this.refresh()
197189
}
198190

199191
private _uncheck_ignored_files(): void {
@@ -232,9 +224,6 @@ export class WorkspaceProvider
232224
if (this._refresh_timeout) {
233225
clearTimeout(this._refresh_timeout)
234226
}
235-
if (this._change_event_dispatch_timeout) {
236-
clearTimeout(this._change_event_dispatch_timeout)
237-
}
238227

239228
this._token_calculator.dispose()
240229
}

0 commit comments

Comments
 (0)