diff --git a/package.json b/package.json index d662980..3fea02f 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "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.", - "version": "1.5.6", + "version": "1.5.7", "icon": "icon.png", "engines": { "vscode": "^1.84.0" diff --git a/src/ClaudeDev.ts b/src/ClaudeDev.ts index 0c6cf10..052001a 100644 --- a/src/ClaudeDev.ts +++ b/src/ClaudeDev.ts @@ -815,11 +815,9 @@ export class ClaudeDev { vscode.commands.executeCommand( "vscode.diff", - fileExists - ? vscode.Uri.file(absolutePath) - : vscode.Uri.parse(`claude-dev-diff:${path.basename(absolutePath)}`).with({ - query: Buffer.from("").toString("base64"), - }), + vscode.Uri.parse(`claude-dev-diff:${path.basename(absolutePath)}`).with({ + query: Buffer.from(originalContent).toString("base64"), + }), vscode.Uri.file(tempFilePath), `${path.basename(absolutePath)}: ${fileExists ? "Original ↔ Claude's Changes" : "New File"} (Editable)` ) diff --git a/src/extension.ts b/src/extension.ts index cd6d848..700a86e 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -94,7 +94,7 @@ export function activate(context: vscode.ExtensionContext) { ) /* - We use the text document content provider API to show an empty text doc for diff view for new files by creating a virtual document for the new content. + We use the text document content provider API to show the left side for diff view by creating a virtual document for the original content. This makes it readonly so users know to edit the right side if they want to keep their changes. - This API allows you to create readonly documents in VSCode from arbitrary sources, and works by claiming an uri-scheme for which your provider then returns text contents. The scheme must be provided when registering a provider and cannot change afterwards. - Note how the provider doesn't create uris for virtual documents - its role is to provide contents given such an uri. In return, content providers are wired into the open document logic so that providers are always considered.