Skip to content

Conversation

@hannesrudolph
Copy link
Collaborator

@hannesrudolph hannesrudolph commented Oct 30, 2025

This PR improves how edits are displayed in the main chat view:

Before After
image image
image image
image image

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.

  • Behavior:
    • Improves diff appearance in chat view by using unified diffs and displaying inline diff stats.
    • Adds DiffView component for rendering diffs with line numbers and highlights.
    • Updates ChatRowContent to handle new diff stats and display them.
  • Utilities:
    • Adds computeDiffStats, sanitizeUnifiedDiff, and convertNewFileToUnifiedDiff functions in stats.ts for diff processing.
    • Implements parseUnifiedDiff in parseUnifiedDiff.ts to parse unified diff strings.
  • UI Components:
    • Updates CodeAccordian to display diff stats and use DiffView for diff rendering.
    • Modifies BatchDiffApproval and ChatRow to incorporate new diff handling.
  • Testing:
    • Adds ChatRow.diff-actions.spec.tsx to test diff stats display in ChatRowContent.

This description was created by Ellipsis for 3adfd46. You can customize this summary. It will automatically update as commits are pushed.

Copilot AI review requested due to automatic review settings October 30, 2025 16:03
@dosubot dosubot bot added the size:XL This PR changes 500-999 lines, ignoring generated files. label Oct 30, 2025
@roomote
Copy link
Contributor

roomote bot commented Oct 30, 2025

Rooviewer Clock   See task on Roo Cloud

All previously flagged issues have been resolved. No new issues found in the latest commits.

Issues to Fix

  • Incorrect line counting for new files (ChatRow.tsx:472-481): The special case for newFileCreated counts all lines in the unified diff format (including headers like --- /dev/null, +++ filename, @@ ...), resulting in inflated counts. The computeDiffStats function already correctly handles unified diffs - remove the special case and use it consistently.
  • Hardcoded white color breaks light theme (DiffView.tsx:230): The +/- indicators use hardcoded #ffffff which will be invisible against light backgrounds. Use a theme-aware color variable instead.
  • Redundant no-op replacements in stripCData (diffUtils.ts:59-63): The case-insensitive replacements on lines 59 and 62 already remove both HTML-encoded and raw CDATA markers, making the subsequent case-sensitive replacements on lines 60 and 63 no-ops. Remove lines 60 and 63 to eliminate the CodeQL warning.

Previous reviews

Mention @roomote to ask your PR Fixer agent to address the feedback.

@dosubot dosubot bot added the UI/UX UI/UX related or focused label Oct 30, 2025
Copy link
Contributor

Copilot AI left a 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.

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Oct 30, 2025
Copy link
Contributor

@roomote roomote bot left a 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.

@hannesrudolph
Copy link
Collaborator Author

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.

Copy link
Contributor

@roomote roomote bot left a 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.

@hannesrudolph
Copy link
Collaborator Author

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.

Copy link
Contributor

@roomote roomote bot left a 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.

@hannesrudolph
Copy link
Collaborator Author

hannesrudolph commented Oct 30, 2025

fix(webview-ui): Correct new-file diff line counting by ignoring trailing newline in unified diff; added a unit test to cover this behavior.
Key changes:

  • webview-ui/src/utils/diffUtils.ts (convertNewFileToUnifiedDiff)
  • webview-ui/src/components/chat/tests/ChatRow.diff-actions.spec.tsx
  • All webview-ui tests pass locally (vitest). Ready for re-review.

@dosubot dosubot bot added the size:XXL This PR changes 1000+ lines, ignoring generated files. label Nov 6, 2025
@daniel-lxs daniel-lxs moved this from PR [Needs Prelim Review] to PR [Needs Review] in Roo Code Roadmap Nov 6, 2025
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Nov 6, 2025
@mrubens mrubens merged commit 0fd7023 into main Nov 6, 2025
18 checks passed
@mrubens mrubens deleted the feat/diff-view-chatview branch November 6, 2025 21:18
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Nov 6, 2025
@github-project-automation github-project-automation bot moved this from PR [Needs Review] to Done in Roo Code Roadmap Nov 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer PR - Needs Review size:XXL This PR changes 1000+ lines, ignoring generated files. UI/UX UI/UX related or focused

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants