diff options
Diffstat (limited to 'editors/code/src/commands/index.ts')
-rw-r--r-- | editors/code/src/commands/index.ts | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/editors/code/src/commands/index.ts b/editors/code/src/commands/index.ts index 9a1697dcb..dc075aa82 100644 --- a/editors/code/src/commands/index.ts +++ b/editors/code/src/commands/index.ts | |||
@@ -39,6 +39,18 @@ function applySourceChange(ctx: Ctx): Cmd { | |||
39 | }; | 39 | }; |
40 | } | 40 | } |
41 | 41 | ||
42 | function selectAndApplySourceChange(ctx: Ctx): Cmd { | ||
43 | return async (changes: sourceChange.SourceChange[]) => { | ||
44 | if (changes.length === 1) { | ||
45 | await sourceChange.applySourceChange(ctx, changes[0]); | ||
46 | } else if (changes.length > 0) { | ||
47 | const selectedChange = await vscode.window.showQuickPick(changes); | ||
48 | if (!selectedChange) return; | ||
49 | await sourceChange.applySourceChange(ctx, selectedChange); | ||
50 | } | ||
51 | }; | ||
52 | } | ||
53 | |||
42 | function reload(ctx: Ctx): Cmd { | 54 | function reload(ctx: Ctx): Cmd { |
43 | return async () => { | 55 | return async () => { |
44 | vscode.window.showInformationMessage('Reloading rust-analyzer...'); | 56 | vscode.window.showInformationMessage('Reloading rust-analyzer...'); |
@@ -59,5 +71,6 @@ export { | |||
59 | runSingle, | 71 | runSingle, |
60 | showReferences, | 72 | showReferences, |
61 | applySourceChange, | 73 | applySourceChange, |
74 | selectAndApplySourceChange, | ||
62 | reload | 75 | reload |
63 | }; | 76 | }; |