From 021b3da6721df7eaad2eb87024d2b0da28d60ade Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 25 May 2020 11:10:31 +0200 Subject: Flatten simple commands --- editors/code/src/commands/parent_module.ts | 29 ----------------------------- 1 file changed, 29 deletions(-) delete mode 100644 editors/code/src/commands/parent_module.ts (limited to 'editors/code/src/commands/parent_module.ts') diff --git a/editors/code/src/commands/parent_module.ts b/editors/code/src/commands/parent_module.ts deleted file mode 100644 index 8f78ddd71..000000000 --- a/editors/code/src/commands/parent_module.ts +++ /dev/null @@ -1,29 +0,0 @@ -import * as vscode from 'vscode'; -import * as ra from '../rust-analyzer-api'; - -import { Ctx, Cmd } from '../ctx'; - -export function parentModule(ctx: Ctx): Cmd { - return async () => { - const editor = ctx.activeRustEditor; - const client = ctx.client; - if (!editor || !client) return; - - const response = await client.sendRequest(ra.parentModule, { - textDocument: { uri: editor.document.uri.toString() }, - position: client.code2ProtocolConverter.asPosition( - editor.selection.active, - ), - }); - const loc = response[0]; - if (loc == null) return; - - const uri = client.protocol2CodeConverter.asUri(loc.uri); - const range = client.protocol2CodeConverter.asRange(loc.range); - - const doc = await vscode.workspace.openTextDocument(uri); - const e = await vscode.window.showTextDocument(doc); - e.selection = new vscode.Selection(range.start, range.start); - e.revealRange(range, vscode.TextEditorRevealType.InCenter); - }; -} -- cgit v1.2.3