diff options
Diffstat (limited to 'editors/code/src/main.ts')
-rw-r--r-- | editors/code/src/main.ts | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/editors/code/src/main.ts b/editors/code/src/main.ts index 40701e4f5..ee6e712a4 100644 --- a/editors/code/src/main.ts +++ b/editors/code/src/main.ts | |||
@@ -42,7 +42,12 @@ export async function activate(context: vscode.ExtensionContext) { | |||
42 | const state = new PersistentState(context.globalState); | 42 | const state = new PersistentState(context.globalState); |
43 | const serverPath = await bootstrap(config, state); | 43 | const serverPath = await bootstrap(config, state); |
44 | 44 | ||
45 | const workspaceFolder = vscode.workspace.workspaceFolders?.[0] ?? null; | 45 | const workspaceFolder = vscode.workspace.workspaceFolders?.[0]; |
46 | if (workspaceFolder === undefined) { | ||
47 | const err = "Cannot activate rust-analyzer when no folder is opened"; | ||
48 | void vscode.window.showErrorMessage(err); | ||
49 | throw new Error(err); | ||
50 | } | ||
46 | 51 | ||
47 | // Note: we try to start the server before we activate type hints so that it | 52 | // Note: we try to start the server before we activate type hints so that it |
48 | // registers its `onDidChangeDocument` handler before us. | 53 | // registers its `onDidChangeDocument` handler before us. |