about summary refs log tree commit diff
path: root/editors/code/src
diff options
context:
space:
mode:
authorAleksey Kladov <aleksey.kladov@gmail.com>2019-01-23 00:15:03 +0300
committerAleksey Kladov <aleksey.kladov@gmail.com>2019-01-23 01:24:53 +0300
commit0ba7e2eaebf335dbc31b5d6dbc9c354737c7fe54 (patch)
tree9adf247619c28ed5e7cdeee118897231d8f2320c /editors/code/src
parente08df3219d7a06b1e38c632e7f13967fb540769b (diff)
downloadrust-0ba7e2eaebf335dbc31b5d6dbc9c354737c7fe54.tar.gz
rust-0ba7e2eaebf335dbc31b5d6dbc9c354737c7fe54.zip
ad status command
Diffstat (limited to 'editors/code/src')
-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
3 files changed, 15 insertions, 0 deletions
diff --git a/editors/code/src/commands/analyzer_status.ts b/editors/code/src/commands/analyzer_status.ts
new file mode 100644
index 00000000000..5c56b9c4cd5
--- /dev/null
+++ b/editors/code/src/commands/analyzer_status.ts
@@ -0,0 +1,12 @@
+import * as vscode from 'vscode';
+import { Server } from '../server';
+
+// Shows status of rust-analyzer (for debugging)
+export async function handle() {
+    const status = await Server.client.sendRequest<string>(
+        'ra/analyzerStatus',
+        null
+    );
+    const doc = await vscode.workspace.openTextDocument({ content: status });
+    await vscode.window.showTextDocument(doc, vscode.ViewColumn.Two);
+}
diff --git a/editors/code/src/commands/index.ts b/editors/code/src/commands/index.ts
index 33e2b34a28c..f36c4b040f5 100644
--- a/editors/code/src/commands/index.ts
+++ b/editors/code/src/commands/index.ts
@@ -1,3 +1,4 @@
+import * as analyzerStatus from './analyzer_status';
 import * as applySourceChange from './apply_source_change';
 import * as extendSelection from './extend_selection';
 import * as joinLines from './join_lines';
@@ -8,6 +9,7 @@ import * as runnables from './runnables';
 import * as syntaxTree from './syntaxTree';
 
 export {
+    analyzerStatus,
     applySourceChange,
     extendSelection,
     joinLines,
diff --git a/editors/code/src/extension.ts b/editors/code/src/extension.ts
index 0098c94547a..288a852aa3f 100644
--- a/editors/code/src/extension.ts
+++ b/editors/code/src/extension.ts
@@ -45,6 +45,7 @@ export function activate(context: vscode.ExtensionContext) {
     }
 
     // Commands are requests from vscode to the language server
+    registerCommand('ra-lsp.analyzerStatus', commands.analyzerStatus.handle);
     registerCommand('ra-lsp.syntaxTree', commands.syntaxTree.handle);
     registerCommand('ra-lsp.extendSelection', commands.extendSelection.handle);
     registerCommand('ra-lsp.matchingBrace', commands.matchingBrace.handle);