summaryrefslogtreecommitdiff
path: root/extension/src/diffs.ts
diff options
context:
space:
mode:
Diffstat (limited to 'extension/src/diffs.ts')
-rw-r--r--extension/src/diffs.ts17
1 files changed, 12 insertions, 5 deletions
diff --git a/extension/src/diffs.ts b/extension/src/diffs.ts
index b9ef8384..1dc292e1 100644
--- a/extension/src/diffs.ts
+++ b/extension/src/diffs.ts
@@ -132,11 +132,18 @@ class DiffManager {
console.log("No corresponding diffInfo found for newFilepath");
return;
}
- fs.writeFileSync(
- diffInfo.originalFilepath,
- fs.readFileSync(diffInfo.newFilepath)
- );
- this.cleanUpDiff(diffInfo);
+
+ // Save the right-side file, then copy over to original
+ vscode.workspace.textDocuments
+ .find((doc) => doc.uri.fsPath === newFilepath)
+ ?.save()
+ .then(() => {
+ fs.writeFileSync(
+ diffInfo.originalFilepath,
+ fs.readFileSync(diffInfo.newFilepath)
+ );
+ this.cleanUpDiff(diffInfo);
+ });
}
rejectDiff(newFilepath?: string) {