about summary refs log tree commit diff
path: root/editors/code/src
diff options
context:
space:
mode:
authorAleksey Kladov <aleksey.kladov@gmail.com>2019-12-31 18:38:22 +0100
committerAleksey Kladov <aleksey.kladov@gmail.com>2019-12-31 18:38:22 +0100
commit6368b40dd98b208da3758d4d1eed34cf276e3b09 (patch)
tree3efa5daf54fe08cd1b310fa42c2ef469503fcedd /editors/code/src
parent087af54069d34eef5197e04d64ac322d9ee98085 (diff)
downloadrust-6368b40dd98b208da3758d4d1eed34cf276e3b09.tar.gz
rust-6368b40dd98b208da3758d4d1eed34cf276e3b09.zip
Work around synchrnonisation issue
Diffstat (limited to 'editors/code/src')
-rw-r--r--editors/code/src/main.ts17
1 files changed, 11 insertions, 6 deletions
diff --git a/editors/code/src/main.ts b/editors/code/src/main.ts
index 22450060b4a..51dedd5efc7 100644
--- a/editors/code/src/main.ts
+++ b/editors/code/src/main.ts
@@ -11,6 +11,17 @@ let ctx!: Ctx;
 export async function activate(context: vscode.ExtensionContext) {
     ctx = new Ctx(context);
 
+    // Note: we try to start the server before we register various commands, so
+    // that it registers its `onDidChangeDocument` handler before us.
+    //
+    // This a horribly, horribly wrong way to deal with this problem.
+    try {
+        await ctx.restartServer();
+    } catch (e) {
+        vscode.window.showErrorMessage(e.message);
+    }
+
+
     // Commands which invokes manually via command pallet, shortcut, etc.
     ctx.registerCommand('analyzerStatus', commands.analyzerStatus);
     ctx.registerCommand('collectGarbage', commands.collectGarbage);
@@ -33,12 +44,6 @@ export async function activate(context: vscode.ExtensionContext) {
     activateStatusDisplay(ctx);
     activateHighlighting(ctx);
     activateInlayHints(ctx);
-    // Start the language server, finally!
-    try {
-        await ctx.restartServer();
-    } catch (e) {
-        vscode.window.showErrorMessage(e.message);
-    }
 }
 
 export async function deactivate() {