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 | 2b8f7b079bf6335b53c0d08f1c639bb316d5fc4c (patch) | |
tree | ebdc79edd0f19e3d039d682bcddc08612df93d47 /extension/src/diffs.ts | |
parent | 8f93431f346d72a790b16a00d577c8f3d8c761b3 (diff) | |
download | sncontinue-2b8f7b079bf6335b53c0d08f1c639bb316d5fc4c.tar.gz sncontinue-2b8f7b079bf6335b53c0d08f1c639bb316d5fc4c.tar.bz2 sncontinue-2b8f7b079bf6335b53c0d08f1c639bb316d5fc4c.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); } |