Work around synchrnonisation issue

This commit is contained in:
Aleksey Kladov 2019-12-31 18:38:22 +01:00
parent 087af54069
commit 6368b40dd9

View file

@ -11,6 +11,17 @@ let ctx!: Ctx;
export async function activate(context: vscode.ExtensionContext) { export async function activate(context: vscode.ExtensionContext) {
ctx = new Ctx(context); 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. // Commands which invokes manually via command pallet, shortcut, etc.
ctx.registerCommand('analyzerStatus', commands.analyzerStatus); ctx.registerCommand('analyzerStatus', commands.analyzerStatus);
ctx.registerCommand('collectGarbage', commands.collectGarbage); ctx.registerCommand('collectGarbage', commands.collectGarbage);
@ -33,12 +44,6 @@ export async function activate(context: vscode.ExtensionContext) {
activateStatusDisplay(ctx); activateStatusDisplay(ctx);
activateHighlighting(ctx); activateHighlighting(ctx);
activateInlayHints(ctx); activateInlayHints(ctx);
// Start the language server, finally!
try {
await ctx.restartServer();
} catch (e) {
vscode.window.showErrorMessage(e.message);
}
} }
export async function deactivate() { export async function deactivate() {