Skip to content

fix: show complete diff previews - #17

Merged
chryzxc merged 3 commits into
mainfrom
agent/fix-diff-preview-issue-12
Jul 28, 2026
Merged

fix: show complete diff previews#17
chryzxc merged 3 commits into
mainfrom
agent/fix-diff-preview-issue-12

Conversation

@chryzxc

@chryzxc chryzxc commented Jul 28, 2026

Copy link
Copy Markdown
Owner

Summary

  • remove the fixed 40-line diff preview truncation
  • preserve complete multi-hunk diffs with scrollable expanded previews
  • reset line numbering for each hunk
  • add regression coverage for the issue

Validation

  • npm run verify
  • diff-preview regression tests
  • TypeScript typecheck

Closes #12.

Summary by CodeRabbit

  • Bug Fixes
    • Diff previews now display all available patch content, including later hunks, without truncating the preview.
    • Line numbers reset correctly for each diff hunk.
    • Duplicate hunk headers are no longer shown in diff excerpts.
    • Added regression coverage to help prevent these rendering issues from returning.

@chryzxc
chryzxc merged commit e2f8b56 into main Jul 28, 2026
1 check passed
@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 63d02ebc-8280-4ae0-9ab1-061c3170082f

📥 Commits

Reviewing files that changed from the base of the PR and between 0b6fa54 and 95a5de9.

📒 Files selected for processing (3)
  • tests/regression/diff-preview-block-grouping-regression.test.mjs
  • webview/shared/src/chat/components/ActivityDiffExcerpt.tsx
  • webview/shared/src/chat/components/activity-steps/DiffPreviewStep.tsx

📝 Walkthrough

Walkthrough

Diff preview parsing now retains complete patches instead of truncating after 40 lines. Excerpt rendering recognizes additional hunk headers, resets line numbering per hunk, avoids duplicate headers, and adds regression tests for both behaviors.

Changes

Diff preview rendering

Layer / File(s) Summary
Complete diff excerpt construction
webview/shared/src/chat/components/activity-steps/DiffPreviewStep.tsx
The parser selects the first filtered hunk header, preserves all diff lines, and calculates addition/deletion counts from the full patch.
Multi-hunk line numbering
webview/shared/src/chat/components/ActivityDiffExcerpt.tsx
Line numbering resets for each embedded hunk header, which is marked as a header row; duplicated initial headers are skipped.
Regression coverage
tests/regression/diff-preview-block-grouping-regression.test.mjs
Tests verify complete patch retention and hunk-based line counter resets.

Estimated code review effort: 2 (Simple) | ~15 minutes

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch agent/fix-diff-preview-issue-12

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: expanded diff preview is capped at 40 lines and omits actual changes

1 participant