Browse Source

Ignore errors for trying to ensure in memory doc is open

Saoud Rizwan 1 year ago
parent
commit
22474f8cb9
2 changed files with 10 additions and 3 deletions
  1. 1 1
      package.json
  2. 9 2
      src/ClaudeDev.ts

+ 1 - 1
package.json

@@ -2,7 +2,7 @@
   "name": "claude-dev",
   "name": "claude-dev",
   "displayName": "Claude Dev",
   "displayName": "Claude Dev",
   "description": "Autonomous coding agent right in your IDE, capable of creating/editing files, executing commands, and more with your permission every step of the way.",
   "description": "Autonomous coding agent right in your IDE, capable of creating/editing files, executing commands, and more with your permission every step of the way.",
-  "version": "1.5.23",
+  "version": "1.5.24",
   "icon": "icon.png",
   "icon": "icon.png",
   "engines": {
   "engines": {
     "vscode": "^1.84.0"
     "vscode": "^1.84.0"

+ 9 - 2
src/ClaudeDev.ts

@@ -864,7 +864,9 @@ export class ClaudeDev {
 			const { response, text, images } = userResponse
 			const { response, text, images } = userResponse
 
 
 			if (response !== "yesButtonTapped") {
 			if (response !== "yesButtonTapped") {
-				await vscode.window.showTextDocument(inMemoryDocument.uri, { preview: true, preserveFocus: false })
+				try {
+					await vscode.window.showTextDocument(inMemoryDocument.uri, { preview: true, preserveFocus: false })
+				} catch {}
 				await vscode.commands.executeCommand("workbench.action.revertAndCloseActiveEditor")
 				await vscode.commands.executeCommand("workbench.action.revertAndCloseActiveEditor")
 				await this.closeDiffViews()
 				await this.closeDiffViews()
 				if (response === "messageResponse") {
 				if (response === "messageResponse") {
@@ -882,7 +884,12 @@ export class ClaudeDev {
 			await fs.writeFile(absolutePath, editedContent)
 			await fs.writeFile(absolutePath, editedContent)
 
 
 			// Close the in-memory doc
 			// Close the in-memory doc
-			await vscode.window.showTextDocument(inMemoryDocument.uri, { preview: true, preserveFocus: false })
+			try {
+				await vscode.window.showTextDocument(inMemoryDocument.uri, { preview: true, preserveFocus: false })
+			} catch (error) {
+				console.log(`Could not open editor for ${absolutePath}: ${error}`)
+			}
+
 			await vscode.commands.executeCommand("workbench.action.revertAndCloseActiveEditor")
 			await vscode.commands.executeCommand("workbench.action.revertAndCloseActiveEditor")
 			await this.closeDiffViews()
 			await this.closeDiffViews()