aboutsummaryrefslogtreecommitdiff
path: root/editors
diff options
context:
space:
mode:
Diffstat (limited to 'editors')
-rw-r--r--editors/code/src/commands/index.ts4
-rw-r--r--editors/code/src/source_change.ts12
2 files changed, 13 insertions, 3 deletions
diff --git a/editors/code/src/commands/index.ts b/editors/code/src/commands/index.ts
index 9a1697dcb..0ff708b1f 100644
--- a/editors/code/src/commands/index.ts
+++ b/editors/code/src/commands/index.ts
@@ -34,8 +34,8 @@ 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) => { 37 return async (change: sourceChange.SourceChange, alternativeChanges: sourceChange.SourceChange[] | undefined) => {
38 sourceChange.applySourceChange(ctx, change); 38 sourceChange.applySourceChange(ctx, change, alternativeChanges);
39 }; 39 };
40} 40}
41 41
diff --git a/editors/code/src/source_change.ts b/editors/code/src/source_change.ts
index a336269ba..b19d325d5 100644
--- a/editors/code/src/source_change.ts
+++ b/editors/code/src/source_change.ts
@@ -9,7 +9,7 @@ export interface SourceChange {
9 cursorPosition?: lc.TextDocumentPositionParams; 9 cursorPosition?: lc.TextDocumentPositionParams;
10} 10}
11 11
12export async function applySourceChange(ctx: Ctx, change: SourceChange) { 12async function applySelectedSourceChange(ctx: Ctx, change: SourceChange) {
13 const client = ctx.client; 13 const client = ctx.client;
14 if (!client) return; 14 if (!client) return;
15 15
@@ -55,3 +55,13 @@ export async function applySourceChange(ctx: Ctx, change: SourceChange) {
55 ); 55 );
56 } 56 }
57} 57}
58
59export async function applySourceChange(ctx: Ctx, change: SourceChange, alternativeChanges: SourceChange[] | undefined) {
60 if (alternativeChanges !== undefined && alternativeChanges.length > 0) {
61 const selectedChange = await vscode.window.showQuickPick([change, ...alternativeChanges]);
62 if (!selectedChange) return;
63 await applySelectedSourceChange(ctx, selectedChange);
64 } else {
65 await applySelectedSourceChange(ctx, change);
66 }
67}