-
Notifications
You must be signed in to change notification settings - Fork 2.8k
feat(chat): Improve diff appearance in main chat view #8932
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
All previously flagged issues have been resolved. No new issues found in the latest commits. Issues to Fix
Mention @roomote to ask your PR Fixer agent to address the feedback. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a new DiffView component to render unified diffs with VSCode-style formatting, and enhances the UI to display diff statistics (+/- line counts) for file operations. The changes improve the visual presentation of code changes across the application.
- Adds a DiffView component for rendering unified diffs with side-by-side line numbers
- Implements diff stats computation and display for file edit operations
- Converts SEARCH/REPLACE and new file formats to unified diff format
Reviewed Changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| webview-ui/src/components/common/DiffView.tsx | New component to render unified diffs with VSCode styling |
| webview-ui/src/components/common/CodeAccordian.tsx | Adds diff stats display and integrates DiffView for diff language |
| webview-ui/src/components/chat/ChatRow.tsx | Computes diff stats and converts various diff formats to unified diff |
| webview-ui/src/components/chat/BatchDiffApproval.tsx | Adds diff stats computation and SEARCH/REPLACE conversion |
| webview-ui/src/components/chat/tests/ChatRow.diff-actions.spec.tsx | New test file for diff stats functionality |
| webview-ui/src/components/chat/ChatView.tsx | Comment clarification update |
| webview-ui/package.json | Adds diff library dependencies |
| pnpm-lock.yaml | Lockfile updates for new dependencies |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One issue has been resolved, but the hardcoded white color issue remains. Please address the remaining issue before approval.
|
Addressed remaining review item: replaced hardcoded #ffffff with theme foreground for +/- indicators in DiffView.tsx. All CI checks are green on the latest run. The github-advanced-security entry posted a blank comment and CodeQL is passing; there are no actionable security findings attached to this PR right now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One issue has been resolved (hardcoded white color), but there is still one outstanding issue to address: incorrect line counting for new files in ChatRow.tsx.
|
Resolved the CodeQL warning shown in your screenshot. Updated stripCData() to: (1) convert HTML-encoded CDATA markers to raw, then (2) strip raw markers. This removes the no-op replacement flagged by CodeQL. Changes around lines 58-64. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review complete. One issue found that needs to be addressed before approval.
|
fix(webview-ui): Correct new-file diff line counting by ignoring trailing newline in unified diff; added a unit test to cover this behavior.
|
This PR improves how edits are displayed in the main chat view:
Scope: UI-only presentation improvements for diffs and counters; no changes to tool behavior.
Important
Enhances chat view diff display with unified diffs, inline stats, and new rendering components.
DiffViewcomponent for rendering diffs with line numbers and highlights.ChatRowContentto handle new diff stats and display them.computeDiffStats,sanitizeUnifiedDiff, andconvertNewFileToUnifiedDifffunctions instats.tsfor diff processing.parseUnifiedDiffinparseUnifiedDiff.tsto parse unified diff strings.CodeAccordianto display diff stats and useDiffViewfor diff rendering.BatchDiffApprovalandChatRowto incorporate new diff handling.ChatRow.diff-actions.spec.tsxto test diff stats display inChatRowContent.This description was created by
for 3adfd46. You can customize this summary. It will automatically update as commits are pushed.