diff options
Diffstat (limited to 'editors/code')
-rw-r--r-- | editors/code/package.json | 4 | ||||
-rw-r--r-- | editors/code/src/commands/analyzer_status.ts | 12 | ||||
-rw-r--r-- | editors/code/src/commands/index.ts | 2 | ||||
-rw-r--r-- | editors/code/src/extension.ts | 1 |
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 @@ | |||
1 | import * as vscode from 'vscode'; | ||
2 | import { Server } from '../server'; | ||
3 | |||
4 | // Shows status of rust-analyzer (for debugging) | ||
5 | export 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 @@ | |||
1 | import * as analyzerStatus from './analyzer_status'; | ||
1 | import * as applySourceChange from './apply_source_change'; | 2 | import * as applySourceChange from './apply_source_change'; |
2 | import * as extendSelection from './extend_selection'; | 3 | import * as extendSelection from './extend_selection'; |
3 | import * as joinLines from './join_lines'; | 4 | import * as joinLines from './join_lines'; |
@@ -8,6 +9,7 @@ import * as runnables from './runnables'; | |||
8 | import * as syntaxTree from './syntaxTree'; | 9 | import * as syntaxTree from './syntaxTree'; |
9 | 10 | ||
10 | export { | 11 | export { |
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); |