WIP: Command to open docs under cursor
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user