From 0ba7e2eaebf335dbc31b5d6dbc9c354737c7fe54 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 23 Jan 2019 00:15:03 +0300 Subject: ad status command --- editors/code/src/commands/analyzer_status.ts | 12 ++++++++++++ editors/code/src/commands/index.ts | 2 ++ editors/code/src/extension.ts | 1 + 3 files changed, 15 insertions(+) create mode 100644 editors/code/src/commands/analyzer_status.ts (limited to 'editors/code/src') 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 @@ +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( + '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 33e2b34a2..f36c4b040 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 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) { } // 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); -- cgit v1.2.3