Implement unified diff visualization for Edit, MultiEdit, and Write tools

- 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 <noreply@anthropic.com>
This commit is contained in:
andrepimenta
2025-12-01 15:09:20 +00:00
parent d891070d9e
commit dd47efec04
3 changed files with 261 additions and 222 deletions

View File

@@ -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
}
});
}