diff options
author | Aleksey Kladov <[email protected]> | 2018-08-22 08:18:58 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-08-22 08:53:48 +0100 |
commit | 9909875bfe89d2b901c35c0667bed018338b44e1 (patch) | |
tree | cf33277e282f951c323d71236be0044cdb689739 /code/src | |
parent | ecc9df5f009deb8e8bbd8e52db9afbe41f8f880c (diff) |
parent module request
Diffstat (limited to 'code/src')
-rw-r--r-- | code/src/extension.ts | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/code/src/extension.ts b/code/src/extension.ts index 084a9d769..fb6841fa0 100644 --- a/code/src/extension.ts +++ b/code/src/extension.ts | |||
@@ -51,6 +51,22 @@ export function activate(context: vscode.ExtensionContext) { | |||
51 | return new vscode.Selection(anchor, active) | 51 | return new vscode.Selection(anchor, active) |
52 | }) | 52 | }) |
53 | }) | 53 | }) |
54 | registerCommand('libsyntax-rust.parentModule', async () => { | ||
55 | let editor = vscode.window.activeTextEditor | ||
56 | if (editor == null || editor.document.languageId != "rust") return | ||
57 | let request: lc.TextDocumentIdentifier = { | ||
58 | uri: editor.document.uri.toString() | ||
59 | } | ||
60 | let response = await client.sendRequest<lc.TextDocumentIdentifier>("m/parentModule", request) | ||
61 | let loc: lc.Location = response[0] | ||
62 | if (loc == null) return | ||
63 | let uri = client.protocol2CodeConverter.asUri(loc.uri) | ||
64 | let range = client.protocol2CodeConverter.asRange(loc.range) | ||
65 | |||
66 | let doc = await vscode.workspace.openTextDocument(uri) | ||
67 | let e = await vscode.window.showTextDocument(doc) | ||
68 | e.revealRange(range, vscode.TextEditorRevealType.InCenter) | ||
69 | }) | ||
54 | 70 | ||
55 | dispose(vscode.workspace.registerTextDocumentContentProvider( | 71 | dispose(vscode.workspace.registerTextDocumentContentProvider( |
56 | 'libsyntax-rust', | 72 | 'libsyntax-rust', |