WIP: Command to open docs under cursor

This commit is contained in:
Zac Pullar-Strecker 2020-08-30 20:02:29 +12:00
parent e95e666b10
commit bfda0d2583
9 changed files with 176 additions and 4 deletions

View file

@ -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;
}