Skip to content

Commit 6b8b999

Browse files
authored
Fix interval timer not firing. (#13469)
1 parent 1b7efea commit 6b8b999

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

Diff for: Extension/src/LanguageServer/client.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ import * as configs from './configurations';
5959
import { CopilotCompletionContextFeatures, CopilotCompletionContextProvider } from './copilotCompletionContextProvider';
6060
import { DataBinding } from './dataBinding';
6161
import { cachedEditorConfigSettings, getEditorConfigSettings } from './editorConfig';
62-
import { CppSourceStr, clients, configPrefix, updateLanguageConfigurations, usesCrashHandler, watchForCrashes } from './extension';
62+
import { CppSourceStr, clients, configPrefix, initializeIntervalTimer, updateLanguageConfigurations, usesCrashHandler, watchForCrashes } from './extension';
6363
import { LocalizeStringParams, getLocaleId, getLocalizedString } from './localization';
6464
import { PersistentFolderState, PersistentState, PersistentWorkspaceState } from './persistentState';
6565
import { RequestCancelled, ServerCancelled, createProtocolFilter } from './protocolFilter';
@@ -1365,6 +1365,8 @@ export class DefaultClient implements Client {
13651365
// Listen for messages from the language server.
13661366
this.registerNotifications();
13671367

1368+
initializeIntervalTimer();
1369+
13681370
// If a file is already open when we activate, sometimes we don't get any notifications about visible
13691371
// or active text editors, visible ranges, or text selection. As a workaround, we trigger
13701372
// onDidChangeVisibleTextEditors here.

Diff for: Extension/src/LanguageServer/extension.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,6 @@ export async function activate(): Promise<void> {
191191

192192
vcpkgDbPromise = initVcpkgDatabase();
193193

194-
void clients.ActiveClient.ready.then(() => intervalTimer = global.setInterval(onInterval, 2500));
195-
196194
await registerCommands(true);
197195

198196
vscode.tasks.onDidStartTask(() => getActiveClient().PauseCodeAnalysis());
@@ -366,6 +364,10 @@ function onInterval(): void {
366364
clients.ActiveClient.onInterval();
367365
}
368366

367+
export function initializeIntervalTimer(): void {
368+
intervalTimer = global.setInterval(onInterval, 2500);
369+
}
370+
369371
/**
370372
* registered commands
371373
*/

0 commit comments

Comments
 (0)