Skip to content

Commit 6368b40

Browse files
committed
Work around synchrnonisation issue
1 parent 087af54 commit 6368b40

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

editors/code/src/main.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,17 @@ let ctx!: Ctx;
1111
export async function activate(context: vscode.ExtensionContext) {
1212
ctx = new Ctx(context);
1313

14+
// Note: we try to start the server before we register various commands, so
15+
// that it registers its `onDidChangeDocument` handler before us.
16+
//
17+
// This a horribly, horribly wrong way to deal with this problem.
18+
try {
19+
await ctx.restartServer();
20+
} catch (e) {
21+
vscode.window.showErrorMessage(e.message);
22+
}
23+
24+
1425
// Commands which invokes manually via command pallet, shortcut, etc.
1526
ctx.registerCommand('analyzerStatus', commands.analyzerStatus);
1627
ctx.registerCommand('collectGarbage', commands.collectGarbage);
@@ -33,12 +44,6 @@ export async function activate(context: vscode.ExtensionContext) {
3344
activateStatusDisplay(ctx);
3445
activateHighlighting(ctx);
3546
activateInlayHints(ctx);
36-
// Start the language server, finally!
37-
try {
38-
await ctx.restartServer();
39-
} catch (e) {
40-
vscode.window.showErrorMessage(e.message);
41-
}
4247
}
4348

4449
export async function deactivate() {

0 commit comments

Comments
 (0)