diff options
author | Veetaha <[email protected]> | 2020-02-24 22:56:19 +0000 |
---|---|---|
committer | Veetaha <[email protected]> | 2020-02-24 22:56:19 +0000 |
commit | d6a96a90f417d48e6391d2233abf752988c04f1a (patch) | |
tree | d8dae6d98958f093f44d5d8b32642b0d3ad5c0cd /editors/code/src | |
parent | 8c6581dcc3db0e79a075d22ab930cb58a31dfe3c (diff) |
vscode: migrate parent_module to rust-analyzer-api.ts
Diffstat (limited to 'editors/code/src')
-rw-r--r-- | editors/code/src/commands/parent_module.ts | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/editors/code/src/commands/parent_module.ts b/editors/code/src/commands/parent_module.ts index bf40b4021..8f78ddd71 100644 --- a/editors/code/src/commands/parent_module.ts +++ b/editors/code/src/commands/parent_module.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import * as vscode from 'vscode'; | 1 | import * as vscode from 'vscode'; |
2 | import * as lc from 'vscode-languageclient'; | 2 | import * as ra from '../rust-analyzer-api'; |
3 | 3 | ||
4 | import { Ctx, Cmd } from '../ctx'; | 4 | import { Ctx, Cmd } from '../ctx'; |
5 | 5 | ||
@@ -9,16 +9,12 @@ export function parentModule(ctx: Ctx): Cmd { | |||
9 | const client = ctx.client; | 9 | const client = ctx.client; |
10 | if (!editor || !client) return; | 10 | if (!editor || !client) return; |
11 | 11 | ||
12 | const request: lc.TextDocumentPositionParams = { | 12 | const response = await client.sendRequest(ra.parentModule, { |
13 | textDocument: { uri: editor.document.uri.toString() }, | 13 | textDocument: { uri: editor.document.uri.toString() }, |
14 | position: client.code2ProtocolConverter.asPosition( | 14 | position: client.code2ProtocolConverter.asPosition( |
15 | editor.selection.active, | 15 | editor.selection.active, |
16 | ), | 16 | ), |
17 | }; | 17 | }); |
18 | const response = await client.sendRequest<lc.Location[]>( | ||
19 | 'rust-analyzer/parentModule', | ||
20 | request, | ||
21 | ); | ||
22 | const loc = response[0]; | 18 | const loc = response[0]; |
23 | if (loc == null) return; | 19 | if (loc == null) return; |
24 | 20 | ||