summaryrefslogtreecommitdiff
path: root/extension/src
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
commit4b215f5fa19ebd0a4e49dec1e7b2bc3f376ddd15 (patch)
treea497019ee78094a2f000ff5c1a84f19e8bb87f82 /extension/src
parentbb02a83bf2f41ac2e14582aa16f8dfbe1e2ec915 (diff)
downloadsncontinue-4b215f5fa19ebd0a4e49dec1e7b2bc3f376ddd15.tar.gz
sncontinue-4b215f5fa19ebd0a4e49dec1e7b2bc3f376ddd15.tar.bz2
sncontinue-4b215f5fa19ebd0a4e49dec1e7b2bc3f376ddd15.zip
don't allow /edit in diff editor, save diff editor
Diffstat (limited to 'extension/src')
-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) {