diff options
| -rw-r--r-- | extension/package-lock.json | 4 | ||||
| -rw-r--r-- | extension/package.json | 2 | ||||
| -rw-r--r-- | extension/src/diffs.ts | 16 | 
3 files changed, 17 insertions, 5 deletions
diff --git a/extension/package-lock.json b/extension/package-lock.json index 915c228e..7b1ad703 100644 --- a/extension/package-lock.json +++ b/extension/package-lock.json @@ -1,12 +1,12 @@  {    "name": "continue", -  "version": "0.0.116", +  "version": "0.0.118",    "lockfileVersion": 2,    "requires": true,    "packages": {      "": {        "name": "continue", -      "version": "0.0.116", +      "version": "0.0.118",        "license": "Apache-2.0",        "dependencies": {          "@electron/rebuild": "^3.2.10", diff --git a/extension/package.json b/extension/package.json index 79681f6b..548cdcd6 100644 --- a/extension/package.json +++ b/extension/package.json @@ -14,7 +14,7 @@    "displayName": "Continue",    "pricing": "Free",    "description": "The open-source coding autopilot", -  "version": "0.0.116", +  "version": "0.0.118",    "publisher": "Continue",    "engines": {      "vscode": "^1.67.0" 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);    }  | 
