aboutsummaryrefslogtreecommitdiff
path: root/editors/code
diff options
context:
space:
mode:
Diffstat (limited to 'editors/code')
-rw-r--r--editors/code/package.json4
-rw-r--r--editors/code/src/commands/analyzer_status.ts12
-rw-r--r--editors/code/src/commands/index.ts2
-rw-r--r--editors/code/src/extension.ts1
4 files changed, 19 insertions, 0 deletions
diff --git a/editors/code/package.json b/editors/code/package.json
index 9433bd3d2..3e07032c7 100644
--- a/editors/code/package.json
+++ b/editors/code/package.json
@@ -94,6 +94,10 @@
94 { 94 {
95 "command": "ra-lsp.run", 95 "command": "ra-lsp.run",
96 "title": "Rust Run" 96 "title": "Rust Run"
97 },
98 {
99 "command": "ra-lsp.analyzerStatus",
100 "title": "Status of rust-analyzer (debug)"
97 } 101 }
98 ], 102 ],
99 "keybindings": [ 103 "keybindings": [
diff --git a/editors/code/src/commands/analyzer_status.ts b/editors/code/src/commands/analyzer_status.ts
new file mode 100644
index 000000000..5c56b9c4c
--- /dev/null
+++ b/editors/code/src/commands/analyzer_status.ts
@@ -0,0 +1,12 @@
1import * as vscode from 'vscode';
2import { Server } from '../server';
3
4// Shows status of rust-analyzer (for debugging)
5export async function handle() {
6 const status = await Server.client.sendRequest<string>(
7 'ra/analyzerStatus',
8 null
9 );
10 const doc = await vscode.workspace.openTextDocument({ content: status });
11 await vscode.window.showTextDocument(doc, vscode.ViewColumn.Two);
12}
diff --git a/editors/code/src/commands/index.ts b/editors/code/src/commands/index.ts
index 33e2b34a2..f36c4b040 100644
--- a/editors/code/src/commands/index.ts
+++ b/editors/code/src/commands/index.ts
@@ -1,3 +1,4 @@
1import * as analyzerStatus from './analyzer_status';
1import * as applySourceChange from './apply_source_change'; 2import * as applySourceChange from './apply_source_change';
2import * as extendSelection from './extend_selection'; 3import * as extendSelection from './extend_selection';
3import * as joinLines from './join_lines'; 4import * as joinLines from './join_lines';
@@ -8,6 +9,7 @@ import * as runnables from './runnables';
8import * as syntaxTree from './syntaxTree'; 9import * as syntaxTree from './syntaxTree';
9 10
10export { 11export {
12 analyzerStatus,
11 applySourceChange, 13 applySourceChange,
12 extendSelection, 14 extendSelection,
13 joinLines, 15 joinLines,
diff --git a/editors/code/src/extension.ts b/editors/code/src/extension.ts
index 0098c9454..288a852aa 100644
--- a/editors/code/src/extension.ts
+++ b/editors/code/src/extension.ts
@@ -45,6 +45,7 @@ export function activate(context: vscode.ExtensionContext) {
45 } 45 }
46 46
47 // Commands are requests from vscode to the language server 47 // Commands are requests from vscode to the language server
48 registerCommand('ra-lsp.analyzerStatus', commands.analyzerStatus.handle);
48 registerCommand('ra-lsp.syntaxTree', commands.syntaxTree.handle); 49 registerCommand('ra-lsp.syntaxTree', commands.syntaxTree.handle);
49 registerCommand('ra-lsp.extendSelection', commands.extendSelection.handle); 50 registerCommand('ra-lsp.extendSelection', commands.extendSelection.handle);
50 registerCommand('ra-lsp.matchingBrace', commands.matchingBrace.handle); 51 registerCommand('ra-lsp.matchingBrace', commands.matchingBrace.handle);