diff options
-rw-r--r-- | editors/code/src/main.ts | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/editors/code/src/main.ts b/editors/code/src/main.ts index 5ceab8b44..ed26c887b 100644 --- a/editors/code/src/main.ts +++ b/editors/code/src/main.ts | |||
@@ -19,6 +19,16 @@ let ctx: Ctx | undefined; | |||
19 | const RUST_PROJECT_CONTEXT_NAME = "inRustProject"; | 19 | const RUST_PROJECT_CONTEXT_NAME = "inRustProject"; |
20 | 20 | ||
21 | export async function activate(context: vscode.ExtensionContext) { | 21 | export async function activate(context: vscode.ExtensionContext) { |
22 | // For some reason vscode not always shows pop-up error notifications | ||
23 | // when an extension fails to activate, so we do it explicitly by ourselves. | ||
24 | // FIXME: remove this bit of code once vscode fixes this issue: https://github.com/microsoft/vscode/issues/101242 | ||
25 | await tryActivate(context).catch(err => { | ||
26 | void vscode.window.showErrorMessage(`Cannot activate rust-analyzer: ${err.message}`); | ||
27 | throw err; | ||
28 | }); | ||
29 | } | ||
30 | |||
31 | async function tryActivate(context: vscode.ExtensionContext) { | ||
22 | // Register a "dumb" onEnter command for the case where server fails to | 32 | // Register a "dumb" onEnter command for the case where server fails to |
23 | // start. | 33 | // start. |
24 | // | 34 | // |
@@ -58,9 +68,7 @@ export async function activate(context: vscode.ExtensionContext) { | |||
58 | 68 | ||
59 | const workspaceFolder = vscode.workspace.workspaceFolders?.[0]; | 69 | const workspaceFolder = vscode.workspace.workspaceFolders?.[0]; |
60 | if (workspaceFolder === undefined) { | 70 | if (workspaceFolder === undefined) { |
61 | const err = "Cannot activate rust-analyzer when no folder is opened"; | 71 | throw new Error("no folder is opened"); |
62 | void vscode.window.showErrorMessage(err); | ||
63 | throw new Error(err); | ||
64 | } | 72 | } |
65 | 73 | ||
66 | // Note: we try to start the server before we activate type hints so that it | 74 | // Note: we try to start the server before we activate type hints so that it |