mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
WIP: Command to open docs under cursor
This commit is contained in:
parent
e95e666b10
commit
bfda0d2583
9 changed files with 176 additions and 4 deletions
|
@ -419,10 +419,31 @@ export function gotoLocation(ctx: Ctx): Cmd {
|
|||
};
|
||||
}
|
||||
|
||||
export function openDocs(ctx: Ctx): Cmd {
|
||||
return async () => {
|
||||
console.log("running openDocs");
|
||||
|
||||
const client = ctx.client;
|
||||
const editor = vscode.window.activeTextEditor;
|
||||
if (!editor || !client) {
|
||||
console.log("not yet ready");
|
||||
return
|
||||
};
|
||||
|
||||
const position = editor.selection.active;
|
||||
const textDocument = { uri: editor.document.uri.toString() };
|
||||
|
||||
const doclink = await client.sendRequest(ra.openDocs, { position, textDocument });
|
||||
|
||||
vscode.commands.executeCommand("vscode.open", vscode.Uri.parse(doclink.remote));
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
export function resolveCodeAction(ctx: Ctx): Cmd {
|
||||
const client = ctx.client;
|
||||
return async (params: ra.ResolveCodeActionParams) => {
|
||||
const item: lc.WorkspaceEdit = await client.sendRequest(ra.resolveCodeAction, params);
|
||||
return async () => {
|
||||
const item: lc.WorkspaceEdit = await client.sendRequest(ra.resolveCodeAction, null);
|
||||
if (!item) {
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue