diff options
Diffstat (limited to 'editors/code/src/main.ts')
-rw-r--r-- | editors/code/src/main.ts | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/editors/code/src/main.ts b/editors/code/src/main.ts index 7ad5e6934..4a3e1ab7c 100644 --- a/editors/code/src/main.ts +++ b/editors/code/src/main.ts | |||
@@ -13,6 +13,8 @@ let ctx!: Ctx; | |||
13 | 13 | ||
14 | export async function activate(context: vscode.ExtensionContext) { | 14 | export async function activate(context: vscode.ExtensionContext) { |
15 | ctx = new Ctx(context); | 15 | ctx = new Ctx(context); |
16 | |||
17 | // Commands which invokes manually via command pallet, shortcut, etc. | ||
16 | ctx.registerCommand('analyzerStatus', commands.analyzerStatus); | 18 | ctx.registerCommand('analyzerStatus', commands.analyzerStatus); |
17 | ctx.registerCommand('collectGarbage', commands.collectGarbage); | 19 | ctx.registerCommand('collectGarbage', commands.collectGarbage); |
18 | ctx.registerCommand('matchingBrace', commands.matchingBrace); | 20 | ctx.registerCommand('matchingBrace', commands.matchingBrace); |
@@ -21,28 +23,15 @@ export async function activate(context: vscode.ExtensionContext) { | |||
21 | ctx.registerCommand('syntaxTree', commands.syntaxTree); | 23 | ctx.registerCommand('syntaxTree', commands.syntaxTree); |
22 | ctx.registerCommand('expandMacro', commands.expandMacro); | 24 | ctx.registerCommand('expandMacro', commands.expandMacro); |
23 | ctx.registerCommand('run', commands.run); | 25 | ctx.registerCommand('run', commands.run); |
24 | ctx.registerCommand('runSingle', commands.runSingle); // Internal action for lenses | 26 | |
27 | // Internal commands which are invoked by the server. | ||
28 | ctx.registerCommand('runSingle', commands.runSingle); | ||
29 | ctx.registerCommand('showReferences', commands.showReferences); | ||
25 | 30 | ||
26 | function disposeOnDeactivation(disposable: vscode.Disposable) { | 31 | function disposeOnDeactivation(disposable: vscode.Disposable) { |
27 | context.subscriptions.push(disposable); | 32 | context.subscriptions.push(disposable); |
28 | } | 33 | } |
29 | 34 | ||
30 | function registerCommand(name: string, f: any) { | ||
31 | disposeOnDeactivation(vscode.commands.registerCommand(name, f)); | ||
32 | } | ||
33 | |||
34 | registerCommand( | ||
35 | 'rust-analyzer.showReferences', | ||
36 | (uri: string, position: lc.Position, locations: lc.Location[]) => { | ||
37 | vscode.commands.executeCommand( | ||
38 | 'editor.action.showReferences', | ||
39 | vscode.Uri.parse(uri), | ||
40 | Server.client.protocol2CodeConverter.asPosition(position), | ||
41 | locations.map(Server.client.protocol2CodeConverter.asLocation), | ||
42 | ); | ||
43 | }, | ||
44 | ); | ||
45 | |||
46 | if (Server.config.enableEnhancedTyping) { | 35 | if (Server.config.enableEnhancedTyping) { |
47 | ctx.overrideCommand('type', commands.onEnter); | 36 | ctx.overrideCommand('type', commands.onEnter); |
48 | } | 37 | } |