Skip to content

Commit 9b33938

Browse files
authored
Fix startup bug (#2065)
1 parent a096ec9 commit 9b33938

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Extension/src/LanguageServer/client.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,8 @@ class DefaultClient implements Client {
247247
ui = getUI();
248248
ui.bind(this);
249249

250-
this.runBlockingTask(languageClient.onReady()).then(() => {
250+
// requests/notifications are deferred until this.languageClient is set.
251+
this.runBlockingTask(languageClient.onReady().then(() => {
251252
this.configuration = new configs.CppProperties(this.RootUri);
252253
this.configuration.ConfigurationsChanged((e) => this.onConfigurationsChanged(e));
253254
this.configuration.SelectionChanged((e) => this.onSelectedConfigurationChanged(e));
@@ -260,7 +261,6 @@ class DefaultClient implements Client {
260261
this.configuration.CompilerDefaults = compilerDefaults;
261262
});
262263

263-
// Once this is set, we don't defer any more callbacks.
264264
this.languageClient = languageClient;
265265
this.settingsTracker = getTracker(this.RootUri);
266266
telemetry.logLanguageServerEvent("NonDefaultInitialCppSettings", this.settingsTracker.getUserModifiedSettings());
@@ -275,7 +275,7 @@ class DefaultClient implements Client {
275275
failureMessageShown = true;
276276
vscode.window.showErrorMessage("Unable to start the C/C++ language server. IntelliSense features will be disabled. Error: " + String(err));
277277
}
278-
});
278+
}));
279279
} catch (err) {
280280
this.isSupported = false; // Running on an OS we don't support yet.
281281
if (!failureMessageShown) {

0 commit comments

Comments
 (0)