summaryrefslogtreecommitdiff
path: root/extension
diff options
context:
space:
mode:
authorNate Sesti <sestinj@gmail.com>2023-07-11 00:51:42 -0700
committerNate Sesti <sestinj@gmail.com>2023-07-11 00:51:42 -0700
commit50adabaef68917a65b123dbf6026c410b8c5a006 (patch)
tree02ef6127fbdbd03bdbdad842bd08ae3e47c2e10d /extension
parentcec0a7df727255b61d5edb4208d286dc17e81096 (diff)
downloadsncontinue-50adabaef68917a65b123dbf6026c410b8c5a006.tar.gz
sncontinue-50adabaef68917a65b123dbf6026c410b8c5a006.tar.bz2
sncontinue-50adabaef68917a65b123dbf6026c410b8c5a006.zip
don't allow /edit in diff editor, save diff editor
Diffstat (limited to 'extension')
-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) {