From dd47efec04a402246b516f0418178d278cee9a2f Mon Sep 17 00:00:00 2001 From: andrepimenta Date: Mon, 1 Dec 2025 15:09:20 +0000 Subject: [PATCH] Implement unified diff visualization for Edit, MultiEdit, and Write tools MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add LCS-based diff algorithm with intelligent line matching - Show proper line numbers from actual file positions - Display color-coded additions (green), removals (red), and context lines - Include summary statistics (+X lines added, -Y lines removed) - Simplify tool use previews, show detailed diffs in tool results - Parse tool result content to extract line numbers - Update styling with monospace font and VS Code git colors 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- src/extension.ts | 11 +- src/script.ts | 437 ++++++++++++++++++++++++----------------------- src/ui-styles.ts | 35 +++- 3 files changed, 261 insertions(+), 222 deletions(-) diff --git a/src/extension.ts b/src/extension.ts index 6e11e5b..5328d51 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -759,13 +759,14 @@ class ClaudeChatProvider { const isError = content.is_error || false; - // Find the last tool use to get the tool name + // Find the last tool use to get the tool name and input const lastToolUse = this._currentConversation[this._currentConversation.length - 1] const toolName = lastToolUse?.data?.toolName; + const rawInput = lastToolUse?.data?.rawInput; - // Don't send tool result for Read and Edit tools unless there's an error - if ((toolName === 'Read' || toolName === 'Edit' || toolName === 'TodoWrite' || toolName === 'MultiEdit') && !isError) { + // Don't send tool result for Read and TodoWrite tools unless there's an error + if ((toolName === 'Read' || toolName === 'TodoWrite') && !isError) { // Still send to UI to hide loading state, but mark it as hidden this._sendAndSaveMessage({ type: 'toolResult', @@ -774,6 +775,7 @@ class ClaudeChatProvider { isError: isError, toolUseId: content.tool_use_id, toolName: toolName, + rawInput: rawInput, hidden: true } }); @@ -785,7 +787,8 @@ class ClaudeChatProvider { content: resultContent, isError: isError, toolUseId: content.tool_use_id, - toolName: toolName + toolName: toolName, + rawInput: rawInput } }); } diff --git a/src/script.ts b/src/script.ts index 871f6ab..c7b2e45 100644 --- a/src/script.ts +++ b/src/script.ts @@ -225,17 +225,85 @@ const getScript = (isTelemetryEnabled: boolean) => `