mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-27 05:23:24 +00:00
Work around synchrnonisation issue
This commit is contained in:
parent
087af54069
commit
6368b40dd9
1 changed files with 11 additions and 6 deletions
|
@ -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() {
|
||||||
|
|
Loading…
Reference in a new issue