diff options
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', |