aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src/commands.ts
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-11-10 17:20:01 +0000
committerAleksey Kladov <[email protected]>2020-11-10 17:48:46 +0000
commit7d2eb000b078143e9fa6225d00ef52fc7c606fdf (patch)
tree580d90bd250ffcd4b1c66570e5601761e58d1057 /editors/code/src/commands.ts
parentada5a88f8fd0a79af7ad6e0411acc1cce9ef32d5 (diff)
Switch to upstream protocol for resolving code action
Note that we have to maintain custom implementation on the client side: I don't see how to marry bulitin resolve support with groups and snippets.
Diffstat (limited to 'editors/code/src/commands.ts')
-rw-r--r--editors/code/src/commands.ts11
1 files changed, 6 insertions, 5 deletions
diff --git a/editors/code/src/commands.ts b/editors/code/src/commands.ts
index 22509e874..cf34622c3 100644
--- a/editors/code/src/commands.ts
+++ b/editors/code/src/commands.ts
@@ -395,7 +395,7 @@ export function showReferences(ctx: Ctx): Cmd {
395} 395}
396 396
397export function applyActionGroup(_ctx: Ctx): Cmd { 397export function applyActionGroup(_ctx: Ctx): Cmd {
398 return async (actions: { label: string; arguments: ra.ResolveCodeActionParams }[]) => { 398 return async (actions: { label: string; arguments: lc.CodeAction }[]) => {
399 const selectedAction = await vscode.window.showQuickPick(actions); 399 const selectedAction = await vscode.window.showQuickPick(actions);
400 if (!selectedAction) return; 400 if (!selectedAction) return;
401 vscode.commands.executeCommand( 401 vscode.commands.executeCommand(
@@ -442,12 +442,13 @@ export function openDocs(ctx: Ctx): Cmd {
442 442
443export function resolveCodeAction(ctx: Ctx): Cmd { 443export function resolveCodeAction(ctx: Ctx): Cmd {
444 const client = ctx.client; 444 const client = ctx.client;
445 return async (params: ra.ResolveCodeActionParams) => { 445 return async (params: lc.CodeAction) => {
446 const item: lc.WorkspaceEdit = await client.sendRequest(ra.resolveCodeAction, params); 446 params.command = undefined;
447 if (!item) { 447 const item = await client.sendRequest(lc.CodeActionResolveRequest.type, params);
448 if (!item.edit) {
448 return; 449 return;
449 } 450 }
450 const edit = client.protocol2CodeConverter.asWorkspaceEdit(item); 451 const edit = client.protocol2CodeConverter.asWorkspaceEdit(item.edit);
451 await applySnippetWorkspaceEdit(edit); 452 await applySnippetWorkspaceEdit(edit);
452 }; 453 };
453} 454}