diff options
author | Nate Sesti <sestinj@gmail.com> | 2023-08-27 01:43:54 -0700 |
---|---|---|
committer | Nate Sesti <sestinj@gmail.com> | 2023-08-27 01:43:54 -0700 |
commit | 4428acdd6f372c3724a908fafb1c793e0eae4096 (patch) | |
tree | 73a80a7d1dc59df013dea017d0bd9e8aef35cb3e /extension/src/diffs.ts | |
parent | 307e9f301e32d372158cb96925903fab857eb45f (diff) | |
download | sncontinue-4428acdd6f372c3724a908fafb1c793e0eae4096.tar.gz sncontinue-4428acdd6f372c3724a908fafb1c793e0eae4096.tar.bz2 sncontinue-4428acdd6f372c3724a908fafb1c793e0eae4096.zip |
fix: :bug: additional fixes to ssh /edit
Diffstat (limited to 'extension/src/diffs.ts')
-rw-r--r-- | extension/src/diffs.ts | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/extension/src/diffs.ts b/extension/src/diffs.ts index f28203e6..f8b311f7 100644 --- a/extension/src/diffs.ts +++ b/extension/src/diffs.ts @@ -28,6 +28,7 @@ async function writeFile(path: string, contents: string) { ); } +// THIS IS LOCAL export const DIFF_DIRECTORY = path .join(os.homedir(), ".continue", "diffs") .replace(/^C:/, "c:"); @@ -43,7 +44,11 @@ class DiffManager { private async setupDirectory() { // Make sure the diff directory exists - await vscode.workspace.fs.createDirectory(uriFromFilePath(DIFF_DIRECTORY)); + if (!fs.existsSync(DIFF_DIRECTORY)) { + fs.mkdirSync(DIFF_DIRECTORY, { + recursive: true, + }); + } } constructor() { @@ -96,7 +101,7 @@ class DiffManager { const editor = vscode.window.activeTextEditor; if (!editor) { - throw new Error("No active text editor found for Continue Diff"); + return; } // Change the vscode setting to allow codeLens in diff editor @@ -187,8 +192,13 @@ class DiffManager { cleanUpDiff(diffInfo: DiffInfo, hideEditor: boolean = true) { // Close the editor, remove the record, delete the file if (hideEditor && diffInfo.editor) { - vscode.window.showTextDocument(diffInfo.editor.document); - vscode.commands.executeCommand("workbench.action.closeActiveEditor"); + try { + vscode.window.showTextDocument(diffInfo.editor.document); + vscode.commands.executeCommand("workbench.action.closeActiveEditor"); + } catch { + } finally { + vscode.commands.executeCommand("workbench.action.closeActiveEditor"); + } } this.diffs.delete(diffInfo.newFilepath); fs.unlinkSync(diffInfo.newFilepath); |