mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 05:15:04 +00:00
Simplify startup
This commit is contained in:
parent
dcdbbddd16
commit
d24e612106
5 changed files with 25 additions and 33 deletions
|
@ -11,6 +11,17 @@ let ctx: Ctx | undefined;
|
|||
export async function activate(context: vscode.ExtensionContext) {
|
||||
ctx = new Ctx(context);
|
||||
|
||||
// Note: we try to start the server before we activate type hints so that it
|
||||
// registers its `onDidChangeDocument` handler before us.
|
||||
//
|
||||
// This a horribly, horribly wrong way to deal with this problem.
|
||||
try {
|
||||
await ctx.startServer();
|
||||
} catch (e) {
|
||||
vscode.window.showErrorMessage(e.message);
|
||||
}
|
||||
|
||||
// Commands which invokes manually via command palette, shortcut, etc.
|
||||
ctx.registerCommand('reload', (ctx) => {
|
||||
return async () => {
|
||||
vscode.window.showInformationMessage('Reloading rust-analyzer...');
|
||||
|
@ -28,7 +39,6 @@ export async function activate(context: vscode.ExtensionContext) {
|
|||
}
|
||||
})
|
||||
|
||||
// Commands which invokes manually via command palette, shortcut, etc.
|
||||
ctx.registerCommand('analyzerStatus', commands.analyzerStatus);
|
||||
ctx.registerCommand('collectGarbage', commands.collectGarbage);
|
||||
ctx.registerCommand('matchingBrace', commands.matchingBrace);
|
||||
|
@ -49,15 +59,6 @@ export async function activate(context: vscode.ExtensionContext) {
|
|||
activateStatusDisplay(ctx);
|
||||
|
||||
activateHighlighting(ctx);
|
||||
// Note: we try to start the server before we activate type hints so that it
|
||||
// registers its `onDidChangeDocument` handler before us.
|
||||
//
|
||||
// This a horribly, horribly wrong way to deal with this problem.
|
||||
try {
|
||||
await ctx.startServer();
|
||||
} catch (e) {
|
||||
vscode.window.showErrorMessage(e.message);
|
||||
}
|
||||
activateInlayHints(ctx);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue