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
commit125a4980f3b9e2b27ca10c75f5914cd0559ff828 (patch)
tree78895c399d3357c91b1975398e067e0c7fe9f2f5 /extension/src/diffs.ts
parent3dc307bc9add75fba1f66c51218f0c32637e21fe (diff)
parent64e9877d2929f36aa2af94708620d3f2247ebebb (diff)
downloadsncontinue-125a4980f3b9e2b27ca10c75f5914cd0559ff828.tar.gz
sncontinue-125a4980f3b9e2b27ca10c75f5914cd0559ff828.tar.bz2
sncontinue-125a4980f3b9e2b27ca10c75f5914cd0559ff828.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);
+ });
}
}