mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-08-23 11:54:25 +00:00
Provide navigations to parent modules
This commit is contained in:
parent
aaa0771719
commit
59c755227d
4 changed files with 58 additions and 19 deletions
|
@ -189,12 +189,14 @@ export function parentModule(ctx: Ctx): Cmd {
|
|||
const client = ctx.client;
|
||||
if (!editor || !client) return;
|
||||
if (!(isRustDocument(editor.document) || isCargoTomlDocument(editor.document))) return;
|
||||
|
||||
const locations = await client.sendRequest(ra.parentModule, {
|
||||
textDocument: ctx.client.code2ProtocolConverter.asTextDocumentIdentifier(editor.document),
|
||||
position: client.code2ProtocolConverter.asPosition(
|
||||
editor.selection.active,
|
||||
),
|
||||
});
|
||||
if (!locations) return;
|
||||
|
||||
if (locations.length === 1) {
|
||||
const loc = locations[0];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue