diff --git a/Extension/src/LanguageServer/client.ts b/Extension/src/LanguageServer/client.ts index 306c93276..44255921e 100644 --- a/Extension/src/LanguageServer/client.ts +++ b/Extension/src/LanguageServer/client.ts @@ -59,7 +59,7 @@ import * as configs from './configurations'; import { CopilotCompletionContextFeatures, CopilotCompletionContextProvider } from './copilotCompletionContextProvider'; import { DataBinding } from './dataBinding'; import { cachedEditorConfigSettings, getEditorConfigSettings } from './editorConfig'; -import { CppSourceStr, clients, configPrefix, updateLanguageConfigurations, usesCrashHandler, watchForCrashes } from './extension'; +import { CppSourceStr, clients, configPrefix, initializeIntervalTimer, updateLanguageConfigurations, usesCrashHandler, watchForCrashes } from './extension'; import { LocalizeStringParams, getLocaleId, getLocalizedString } from './localization'; import { PersistentFolderState, PersistentState, PersistentWorkspaceState } from './persistentState'; import { RequestCancelled, ServerCancelled, createProtocolFilter } from './protocolFilter'; @@ -1365,6 +1365,8 @@ export class DefaultClient implements Client { // Listen for messages from the language server. this.registerNotifications(); + initializeIntervalTimer(); + // If a file is already open when we activate, sometimes we don't get any notifications about visible // or active text editors, visible ranges, or text selection. As a workaround, we trigger // onDidChangeVisibleTextEditors here. diff --git a/Extension/src/LanguageServer/extension.ts b/Extension/src/LanguageServer/extension.ts index cce843cc6..216d15615 100644 --- a/Extension/src/LanguageServer/extension.ts +++ b/Extension/src/LanguageServer/extension.ts @@ -191,8 +191,6 @@ export async function activate(): Promise { vcpkgDbPromise = initVcpkgDatabase(); - void clients.ActiveClient.ready.then(() => intervalTimer = global.setInterval(onInterval, 2500)); - await registerCommands(true); vscode.tasks.onDidStartTask(() => getActiveClient().PauseCodeAnalysis()); @@ -366,6 +364,10 @@ function onInterval(): void { clients.ActiveClient.onInterval(); } +export function initializeIntervalTimer(): void { + intervalTimer = global.setInterval(onInterval, 2500); +} + /** * registered commands */