aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src/commands
diff options
context:
space:
mode:
authorKirill Bulatov <[email protected]>2020-01-11 22:40:36 +0000
committerKirill Bulatov <[email protected]>2020-01-15 18:17:17 +0000
commit78a21253b494e573885ac8336bff6e93b401046f (patch)
tree3ec31f8481f9a930b0b3afb6cc0ce4c97cf648f2 /editors/code/src/commands
parent73dc8b6f06b49f4728a50e83781c361e9a8b3100 (diff)
Apply the api design suggestions
Diffstat (limited to 'editors/code/src/commands')
-rw-r--r--editors/code/src/commands/index.ts17
1 files changed, 15 insertions, 2 deletions
diff --git a/editors/code/src/commands/index.ts b/editors/code/src/commands/index.ts
index 0ff708b1f..dc075aa82 100644
--- a/editors/code/src/commands/index.ts
+++ b/editors/code/src/commands/index.ts
@@ -34,8 +34,20 @@ function showReferences(ctx: Ctx): Cmd {
34} 34}
35 35
36function applySourceChange(ctx: Ctx): Cmd { 36function applySourceChange(ctx: Ctx): Cmd {
37 return async (change: sourceChange.SourceChange, alternativeChanges: sourceChange.SourceChange[] | undefined) => { 37 return async (change: sourceChange.SourceChange) => {
38 sourceChange.applySourceChange(ctx, change, alternativeChanges); 38 sourceChange.applySourceChange(ctx, change);
39 };
40}
41
42function 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 }
39 }; 51 };
40} 52}
41 53
@@ -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};