summaryrefslogtreecommitdiff
path: root/extension/src/diffs.ts
diff options
context:
space:
mode:
authorNate Sesti <33237525+sestinj@users.noreply.github.com>2023-07-11 15:14:53 -0700
committerGitHub <noreply@github.com>2023-07-11 15:14:53 -0700
commit9adfb8bf5b9f44be82488e37bc32cbd9a8817b53 (patch)
tree8399d02483267ec024034a923475bd6eaf397154 /extension/src/diffs.ts
parent3f9e7a1fa59c4f684aef544436062f8825d77b31 (diff)
parent9846f4769ff33a346d76e26ad730d19770fe7e02 (diff)
downloadsncontinue-9adfb8bf5b9f44be82488e37bc32cbd9a8817b53.tar.gz
sncontinue-9adfb8bf5b9f44be82488e37bc32cbd9a8817b53.tar.bz2
sncontinue-9adfb8bf5b9f44be82488e37bc32cbd9a8817b53.zip
Merge pull request #237 from continuedev/bug-squashing
Bug squashing
Diffstat (limited to 'extension/src/diffs.ts')
-rw-r--r--extension/src/diffs.ts24
1 files changed, 18 insertions, 6 deletions
diff --git a/extension/src/diffs.ts b/extension/src/diffs.ts
index b9ef8384..3ea6b4f8 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) {
@@ -157,7 +164,12 @@ class DiffManager {
// Stop the step at step_index in case it is still streaming
ideProtocolClient.deleteAtIndex(diffInfo.step_index);
- this.cleanUpDiff(diffInfo);
+ vscode.workspace.textDocuments
+ .find((doc) => doc.uri.fsPath === newFilepath)
+ ?.save()
+ .then(() => {
+ this.cleanUpDiff(diffInfo);
+ });
}
}