summaryrefslogtreecommitdiff
path: root/extension/src
diff options
context:
space:
mode:
authorNate Sesti <sestinj@gmail.com>2023-07-06 21:44:01 -0700
committerNate Sesti <sestinj@gmail.com>2023-07-06 21:44:01 -0700
commit9fc831e7587cce99c8a6f2e56905c25068c8cab6 (patch)
tree5e8a9d9fcf0d23686dd4cfa629352e2ae56e48e1 /extension/src
parent48d4e0918bcc1e27fc427df4379e0f580d09c1f2 (diff)
downloadsncontinue-9fc831e7587cce99c8a6f2e56905c25068c8cab6.tar.gz
sncontinue-9fc831e7587cce99c8a6f2e56905c25068c8cab6.tar.bz2
sncontinue-9fc831e7587cce99c8a6f2e56905c25068c8cab6.zip
fix: :bug: stop streaming on rejection
Diffstat (limited to 'extension/src')
-rw-r--r--extension/src/diffs.ts16
1 files changed, 14 insertions, 2 deletions
diff --git a/extension/src/diffs.ts b/extension/src/diffs.ts
index 4fce744c..52a54046 100644
--- a/extension/src/diffs.ts
+++ b/extension/src/diffs.ts
@@ -38,7 +38,12 @@ class DiffManager {
originalFilepath: string,
newFilepath: string,
newContent: string
- ): vscode.TextEditor {
+ ): vscode.TextEditor | undefined {
+ // If the file doesn't yet exist, don't open the diff editor
+ if (!fs.existsSync(newFilepath)) {
+ return undefined;
+ }
+
const rightUri = vscode.Uri.parse(newFilepath);
const leftUri = vscode.Uri.file(originalFilepath);
const title = "Continue Diff";
@@ -73,6 +78,12 @@ class DiffManager {
originalFilepath,
newFilepath,
};
+ this.diffs.set(newFilepath, diffInfo);
+ }
+
+ // Open the editor if it hasn't been opened yet
+ const diffInfo = this.diffs.get(newFilepath);
+ if (diffInfo && !diffInfo?.editor) {
diffInfo.editor = this.openDiffEditor(
originalFilepath,
newFilepath,
@@ -80,6 +91,7 @@ class DiffManager {
);
this.diffs.set(newFilepath, diffInfo);
}
+
return newFilepath;
}
@@ -89,7 +101,7 @@ class DiffManager {
vscode.window.showTextDocument(diffInfo.editor.document);
vscode.commands.executeCommand("workbench.action.closeActiveEditor");
}
- this.diffs.delete(diffInfo.newFilepath);
+ // this.diffs.delete(diffInfo.newFilepath);
fs.unlinkSync(diffInfo.newFilepath);
}