diff options
author | Nate Sesti <sestinj@gmail.com> | 2023-07-04 22:55:53 -0700 |
---|---|---|
committer | Nate Sesti <sestinj@gmail.com> | 2023-07-04 22:55:53 -0700 |
commit | bf34e1d6a01214a6977a2932b4ee2b413d524957 (patch) | |
tree | 13f9a93147fc76c8bb02737b70632396543979ba /extension/src/diffs.ts | |
parent | c2743058a79e8e998b9e9a9e2fa4c79f53e52af3 (diff) | |
download | sncontinue-bf34e1d6a01214a6977a2932b4ee2b413d524957.tar.gz sncontinue-bf34e1d6a01214a6977a2932b4ee2b413d524957.tar.bz2 sncontinue-bf34e1d6a01214a6977a2932b4ee2b413d524957.zip |
small fixes to side-by-side diff
Diffstat (limited to 'extension/src/diffs.ts')
-rw-r--r-- | extension/src/diffs.ts | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/extension/src/diffs.ts b/extension/src/diffs.ts index 4bd072cf..19ec80ab 100644 --- a/extension/src/diffs.ts +++ b/extension/src/diffs.ts @@ -55,7 +55,7 @@ class DiffManager { fs.writeFileSync(newFilepath, newContent); // Open the diff editor if this is a new diff - if (!this.diffs.has(originalFilepath)) { + if (!this.diffs.has(newFilepath)) { const diffInfo: DiffInfo = { originalFilepath, newFilepath, @@ -65,7 +65,7 @@ class DiffManager { newFilepath, newContent ); - this.diffs.set(originalFilepath, diffInfo); + this.diffs.set(newFilepath, diffInfo); } return newFilepath; } @@ -76,13 +76,13 @@ class DiffManager { vscode.window.showTextDocument(diffInfo.editor.document); vscode.commands.executeCommand("workbench.action.closeActiveEditor"); } - this.diffs.delete(diffInfo.originalFilepath); + this.diffs.delete(diffInfo.newFilepath); fs.unlinkSync(diffInfo.newFilepath); } - acceptDiff(originalFilepath: string) { + acceptDiff(newFilepath: string) { // Get the diff info, copy new file to original, then delete from record and close the corresponding editor - const diffInfo = this.diffs.get(originalFilepath); + const diffInfo = this.diffs.get(newFilepath); if (!diffInfo) { return; } @@ -93,8 +93,8 @@ class DiffManager { this.cleanUpDiff(diffInfo); } - rejectDiff(originalFilepath: string) { - const diffInfo = this.diffs.get(originalFilepath); + rejectDiff(newFilepath: string) { + const diffInfo = this.diffs.get(newFilepath); if (!diffInfo) { return; } @@ -105,10 +105,10 @@ class DiffManager { export const diffManager = new DiffManager(); -export async function acceptDiffCommand(originalFilepath: string) { - diffManager.acceptDiff(originalFilepath); +export async function acceptDiffCommand(newFilepath: string) { + diffManager.acceptDiff(newFilepath); } -export async function rejectDiffCommand(originalFilepath: string) { - diffManager.rejectDiff(originalFilepath); +export async function rejectDiffCommand(newFilepath: string) { + diffManager.rejectDiff(newFilepath); } |