summaryrefslogtreecommitdiff
path: root/extension
diff options
context:
space:
mode:
authorNate Sesti <sestinj@gmail.com>2023-07-18 19:05:35 -0700
committerNate Sesti <sestinj@gmail.com>2023-07-18 19:05:35 -0700
commite268ea8463e2c9c86468756ee1c42d9b16d2c18f (patch)
tree63908d18b6880bb497c2f50f0eede645ba137684 /extension
parentb2dba8d5a4a8852fcea8bcd724e2f17d1d909a6e (diff)
downloadsncontinue-e268ea8463e2c9c86468756ee1c42d9b16d2c18f.tar.gz
sncontinue-e268ea8463e2c9c86468756ee1c42d9b16d2c18f.tar.bz2
sncontinue-e268ea8463e2c9c86468756ee1c42d9b16d2c18f.zip
fix "can't edit twice" bug
Diffstat (limited to 'extension')
-rw-r--r--extension/src/diffs.ts13
1 files changed, 11 insertions, 2 deletions
diff --git a/extension/src/diffs.ts b/extension/src/diffs.ts
index 1e63c5f6..1130a06a 100644
--- a/extension/src/diffs.ts
+++ b/extension/src/diffs.ts
@@ -38,6 +38,15 @@ class DiffManager {
constructor() {
this.setupDirectory();
+
+ // Listen for file closes, and if it's a diff file, clean up
+ vscode.workspace.onDidCloseTextDocument((document) => {
+ const newFilepath = document.uri.fsPath;
+ const diffInfo = this.diffs.get(newFilepath);
+ if (diffInfo) {
+ this.cleanUpDiff(diffInfo, false);
+ }
+ });
}
private escapeFilepath(filepath: string): string {
@@ -160,9 +169,9 @@ class DiffManager {
return newFilepath;
}
- cleanUpDiff(diffInfo: DiffInfo) {
+ cleanUpDiff(diffInfo: DiffInfo, hideEditor: boolean = true) {
// Close the editor, remove the record, delete the file
- if (diffInfo.editor) {
+ if (hideEditor && diffInfo.editor) {
vscode.window.showTextDocument(diffInfo.editor.document);
vscode.commands.executeCommand("workbench.action.closeActiveEditor");
}