aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src/commands.ts
diff options
context:
space:
mode:
authorMikhail Rakhmanov <[email protected]>2020-06-02 21:21:48 +0100
committerMikhail Rakhmanov <[email protected]>2020-06-02 22:10:53 +0100
commit57cd936c5262c3b43626618be42d7a72f71c3539 (patch)
treea21852bb596fea5d1d355b3ad70f1f8e985ef3bd /editors/code/src/commands.ts
parent61e8f392191037acefddc5793e814f93d01b114a (diff)
Preliminary implementation of lazy CodeAssits
Diffstat (limited to 'editors/code/src/commands.ts')
-rw-r--r--editors/code/src/commands.ts19
1 files changed, 17 insertions, 2 deletions
diff --git a/editors/code/src/commands.ts b/editors/code/src/commands.ts
index 534d2a984..3e9c3aa0e 100644
--- a/editors/code/src/commands.ts
+++ b/editors/code/src/commands.ts
@@ -343,10 +343,25 @@ export function showReferences(ctx: Ctx): Cmd {
343} 343}
344 344
345export function applyActionGroup(_ctx: Ctx): Cmd { 345export function applyActionGroup(_ctx: Ctx): Cmd {
346 return async (actions: { label: string; edit: vscode.WorkspaceEdit }[]) => { 346 return async (actions: { label: string; arguments: ra.ResolveCodeActionParams }[]) => {
347 const selectedAction = await vscode.window.showQuickPick(actions); 347 const selectedAction = await vscode.window.showQuickPick(actions);
348 if (!selectedAction) return; 348 if (!selectedAction) return;
349 await applySnippetWorkspaceEdit(selectedAction.edit); 349 vscode.commands.executeCommand(
350 'rust-analyzer.resolveCodeAction',
351 selectedAction.arguments,
352 );
353 };
354}
355
356export function resolveCodeAction(ctx: Ctx): Cmd {
357 const client = ctx.client;
358 return async (params: ra.ResolveCodeActionParams) => {
359 const item: lc.WorkspaceEdit = await client.sendRequest(ra.resolveCodeAction, params);
360 if (!item) {
361 return;
362 }
363 const edit = client.protocol2CodeConverter.asWorkspaceEdit(item);
364 await applySnippetWorkspaceEdit(edit);
350 }; 365 };
351} 366}
352 367