diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-11-10 17:53:10 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2020-11-10 17:53:10 +0000 |
commit | 5c06e820fa02b47a1550576f2a7071ff94fb0c64 (patch) | |
tree | 580d90bd250ffcd4b1c66570e5601761e58d1057 /editors/code/src/commands.ts | |
parent | ada5a88f8fd0a79af7ad6e0411acc1cce9ef32d5 (diff) | |
parent | 7d2eb000b078143e9fa6225d00ef52fc7c606fdf (diff) |
Merge #6521
6521: Switch to upstream protocol for resolving code action r=matklad a=matklad
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.
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'editors/code/src/commands.ts')
-rw-r--r-- | editors/code/src/commands.ts | 11 |
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 | ||
397 | export function applyActionGroup(_ctx: Ctx): Cmd { | 397 | export 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 | ||
443 | export function resolveCodeAction(ctx: Ctx): Cmd { | 443 | export 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 | } |