From bfda0d25834250a3adbcd0d26953a1cdc6662e7f Mon Sep 17 00:00:00 2001 From: Zac Pullar-Strecker Date: Sun, 30 Aug 2020 20:02:29 +1200 Subject: WIP: Command to open docs under cursor --- editors/code/src/commands.ts | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'editors/code/src/commands.ts') diff --git a/editors/code/src/commands.ts b/editors/code/src/commands.ts index 1a90f1b7d..b22cd450b 100644 --- a/editors/code/src/commands.ts +++ b/editors/code/src/commands.ts @@ -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; } -- cgit v1.2.3 From 974518fde7975b839ed4ccd4c5ce1d48cd6db3c7 Mon Sep 17 00:00:00 2001 From: Zac Pullar-Strecker Date: Tue, 1 Sep 2020 20:26:10 +1200 Subject: Code reorganisation and field support --- editors/code/src/commands.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'editors/code/src/commands.ts') diff --git a/editors/code/src/commands.ts b/editors/code/src/commands.ts index b22cd450b..24c2e196d 100644 --- a/editors/code/src/commands.ts +++ b/editors/code/src/commands.ts @@ -421,12 +421,10 @@ 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 }; @@ -435,7 +433,9 @@ export function openDocs(ctx: Ctx): Cmd { const doclink = await client.sendRequest(ra.openDocs, { position, textDocument }); - vscode.commands.executeCommand("vscode.open", vscode.Uri.parse(doclink.remote)); + if (doclink != null) { + vscode.commands.executeCommand("vscode.open", vscode.Uri.parse(doclink)); + } }; } -- cgit v1.2.3 From c648884397bfdb779c447fa31964dc1fce94bd95 Mon Sep 17 00:00:00 2001 From: Zac Pullar-Strecker Date: Thu, 3 Sep 2020 19:55:24 +1200 Subject: Differentiate method/tymethod by determining 'defaultness' Currently a method only has defaultness if it is a provided trait method, but this will change when specialisation is available and may need to become a concept known to hir. I opted to go for a 'fewest changes' approach given specialisation is still under development. --- editors/code/src/commands.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'editors/code/src/commands.ts') diff --git a/editors/code/src/commands.ts b/editors/code/src/commands.ts index 24c2e196d..1445e41d3 100644 --- a/editors/code/src/commands.ts +++ b/editors/code/src/commands.ts @@ -425,7 +425,7 @@ export function openDocs(ctx: Ctx): Cmd { const client = ctx.client; const editor = vscode.window.activeTextEditor; if (!editor || !client) { - return + return; }; const position = editor.selection.active; -- cgit v1.2.3