diff options
Diffstat (limited to 'editors/code/src/main.ts')
-rw-r--r-- | editors/code/src/main.ts | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/editors/code/src/main.ts b/editors/code/src/main.ts index 7b3bb6302..ecf53cf77 100644 --- a/editors/code/src/main.ts +++ b/editors/code/src/main.ts | |||
@@ -12,6 +12,26 @@ import { log } from './util'; | |||
12 | let ctx: Ctx | undefined; | 12 | let ctx: Ctx | undefined; |
13 | 13 | ||
14 | export async function activate(context: vscode.ExtensionContext) { | 14 | export async function activate(context: vscode.ExtensionContext) { |
15 | // Register a "dumb" onEnter command for the case where server fails to | ||
16 | // start. | ||
17 | // | ||
18 | // FIXME: refactor command registration code such that commands are | ||
19 | // **always** registered, even if the server does not start. Use API like | ||
20 | // this perhaps? | ||
21 | // | ||
22 | // ```TypeScript | ||
23 | // registerCommand( | ||
24 | // factory: (Ctx) => ((Ctx) => any), | ||
25 | // fallback: () => any = () => vscode.window.showErrorMessage( | ||
26 | // "rust-analyzer is not available" | ||
27 | // ), | ||
28 | // ) | ||
29 | const defaultOnEnter = vscode.commands.registerCommand( | ||
30 | 'rust-analyzer.onEnter', | ||
31 | () => vscode.commands.executeCommand('default:type', { text: '\n' }), | ||
32 | ); | ||
33 | context.subscriptions.push(defaultOnEnter); | ||
34 | |||
15 | const config = new Config(context); | 35 | const config = new Config(context); |
16 | 36 | ||
17 | const serverPath = await ensureServerBinary(config.serverSource); | 37 | const serverPath = await ensureServerBinary(config.serverSource); |
@@ -54,7 +74,10 @@ export async function activate(context: vscode.ExtensionContext) { | |||
54 | ctx.registerCommand('syntaxTree', commands.syntaxTree); | 74 | ctx.registerCommand('syntaxTree', commands.syntaxTree); |
55 | ctx.registerCommand('expandMacro', commands.expandMacro); | 75 | ctx.registerCommand('expandMacro', commands.expandMacro); |
56 | ctx.registerCommand('run', commands.run); | 76 | ctx.registerCommand('run', commands.run); |
77 | |||
78 | defaultOnEnter.dispose(); | ||
57 | ctx.registerCommand('onEnter', commands.onEnter); | 79 | ctx.registerCommand('onEnter', commands.onEnter); |
80 | |||
58 | ctx.registerCommand('ssr', commands.ssr); | 81 | ctx.registerCommand('ssr', commands.ssr); |
59 | ctx.registerCommand('serverVersion', commands.serverVersion); | 82 | ctx.registerCommand('serverVersion', commands.serverVersion); |
60 | 83 | ||
@@ -66,7 +89,9 @@ export async function activate(context: vscode.ExtensionContext) { | |||
66 | 89 | ||
67 | activateStatusDisplay(ctx); | 90 | activateStatusDisplay(ctx); |
68 | 91 | ||
69 | activateHighlighting(ctx); | 92 | if (!ctx.config.highlightingSemanticTokens) { |
93 | activateHighlighting(ctx); | ||
94 | } | ||
70 | activateInlayHints(ctx); | 95 | activateInlayHints(ctx); |
71 | } | 96 | } |
72 | 97 | ||