Skip to content

feat(diff-panel): add per-file collapse toggle in diff panel#1125

Open
huxcrux wants to merge 6 commits intopingdotgg:mainfrom
huxcrux:feature/diff-panel-collapse-chevron-up
Open

feat(diff-panel): add per-file collapse toggle in diff panel#1125
huxcrux wants to merge 6 commits intopingdotgg:mainfrom
huxcrux:feature/diff-panel-collapse-chevron-up

Conversation

@huxcrux
Copy link
Copy Markdown
Contributor

@huxcrux huxcrux commented Mar 15, 2026

What Changed

Adds a per-file collapse toggle in the diff panel. Each file still starts expanded by default, but users can now collapse an individual file body from the existing diff header and expand it again inline.

The change keeps the current diff rendering flow intact, preserves click-to-open behavior for file headers, and auto-expands a targeted file when the UI deep-links to a specific diff file in the diff panel.

Fixes: #1122

Why

Large diffs in the diff panel are harder to scan when every file stays open at once. This adds a minimal control to reduce visual noise without introducing a broader diff panel redesign or changing the existing diff data flow.

UI Changes

Before:
image

After:
image
image

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • I included a video for animation/interaction changes

Note

Add per-file collapse toggle to the diff panel

  • Each file header in the diff panel now shows a chevron toggle button that collapses or expands the file's diff body, hiding content via the diff-file-collapsed CSS class.
  • Collapse state is managed with a Set of file keys via helpers in diffPanelCollapse.ts; selecting a file auto-expands it if collapsed and defers scroll until after expansion.
  • Header clicks still open the file in the editor unless the click target is the collapse toggle (data-diff-collapse-toggle).
  • Collapse state resets when the patch changes.

Macroscope summarized 6c91a7f.


Note

Low Risk
Primarily UI-state and styling changes localized to diff rendering; risk is limited to potential regressions in scrolling or header click handling.

Overview
Adds a per-file collapse/expand toggle in DiffPanel, hiding a file’s diff body via a new diff-file-collapsed CSS rule while keeping the header visible.

Introduces diffPanelCollapse.ts helpers to key files, toggle/reset collapse state, and auto-expand a deep-linked diffFilePath; selection scrolling is deferred until after any required expansion, and header click-to-open now ignores clicks on the collapse control. Includes unit tests for the collapse helpers.

Written by Cursor Bugbot for commit 6c91a7f. This will update automatically on new commits. Configure here.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 15, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: d7932b10-505c-4b53-abf2-0312ff34ffc8

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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 and usage tips.

@github-actions github-actions bot added size:L 100-499 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list. labels Mar 15, 2026
@huxcrux huxcrux mentioned this pull request Mar 15, 2026
3 tasks
@binbandit
Copy link
Copy Markdown
Contributor

Nice one!

@EverythingSuckz
Copy link
Copy Markdown

bump

@huxcrux huxcrux force-pushed the feature/diff-panel-collapse-chevron-up branch from 3cf4a31 to 25d9f15 Compare March 24, 2026 17:38
Copy link
Copy Markdown
Contributor

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

There are 2 total unresolved issues (including 1 from previous review).

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

@huxcrux huxcrux marked this pull request as draft March 24, 2026 22:03
@huxcrux huxcrux marked this pull request as ready for review March 24, 2026 22:03
@shivamhwp
Copy link
Copy Markdown
Collaborator

noice

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

Labels

size:L 100-499 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Add collapsible diff

4 participants