mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-13 05:38:46 +00:00
vscode: migrate parent_module to rust-analyzer-api.ts
This commit is contained in:
parent
8c6581dcc3
commit
d6a96a90f4
1 changed files with 3 additions and 7 deletions
|
@ -1,5 +1,5 @@
|
|||
import * as vscode from 'vscode';
|
||||
import * as lc from 'vscode-languageclient';
|
||||
import * as ra from '../rust-analyzer-api';
|
||||
|
||||
import { Ctx, Cmd } from '../ctx';
|
||||
|
||||
|
@ -9,16 +9,12 @@ export function parentModule(ctx: Ctx): Cmd {
|
|||
const client = ctx.client;
|
||||
if (!editor || !client) return;
|
||||
|
||||
const request: lc.TextDocumentPositionParams = {
|
||||
const response = await client.sendRequest(ra.parentModule, {
|
||||
textDocument: { uri: editor.document.uri.toString() },
|
||||
position: client.code2ProtocolConverter.asPosition(
|
||||
editor.selection.active,
|
||||
),
|
||||
};
|
||||
const response = await client.sendRequest<lc.Location[]>(
|
||||
'rust-analyzer/parentModule',
|
||||
request,
|
||||
);
|
||||
});
|
||||
const loc = response[0];
|
||||
if (loc == null) return;
|
||||
|
||||
|
|
Loading…
Reference in a new issue