Skip to content

feat(desktop): add toggle to hide unchanged regions in diff viewer#845

Merged
Kitenite merged 3 commits into
mainfrom
more-changes-changes
Jan 20, 2026
Merged

feat(desktop): add toggle to hide unchanged regions in diff viewer#845
Kitenite merged 3 commits into
mainfrom
more-changes-changes

Conversation

@Kitenite
Copy link
Copy Markdown
Collaborator

@Kitenite Kitenite commented Jan 20, 2026

Summary

  • Add a fold icon toggle button in the diff viewer toolbar to collapse unchanged code regions
  • Uses Monaco's hideUnchangedRegions option to focus on actual changes
  • Setting is persisted in the changes store across sessions

Test plan

  • Open a file in diff view mode
  • Click the fold icon button next to the side-by-side/inline toggle
  • Verify unchanged regions are collapsed with expand handles
  • Toggle off and verify all lines are shown again
  • Verify the setting persists after switching files/tabs

Summary by CodeRabbit

Release Notes

  • New Features
    • Added ability to toggle visibility of unchanged regions in the diff viewer
    • Users can now hide unchanged lines to focus on actual changes, improving readability of large diffs
    • New toggle button added to the file viewer toolbar with visual state indication
    • Easily switch between viewing all lines and displaying only changed lines to streamline code review workflow

✏️ Tip: You can customize this high-level summary in your review settings.

Add a fold icon button in the diff viewer toolbar that toggles Monaco's
hideUnchangedRegions option. This collapses unchanged code sections to
help focus on actual changes. The setting is persisted in the changes store.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jan 20, 2026

Warning

Rate limit exceeded

@Kitenite has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 2 minutes and 28 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 7f98688 and a02f52b.

⛔ Files ignored due to path filters (1)
  • bun.lock is excluded by !**/*.lock
📒 Files selected for processing (1)
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/FileViewerPane/components/FileViewerToolbar/FileViewerToolbar.tsx
📝 Walkthrough

Walkthrough

This pull request implements a feature to hide unchanged regions in diff views. It introduces a new hideUnchangedRegions boolean flag to the changes store with a toggle action, threads it through FileViewerPane to FileViewerContent and FileViewerToolbar, adds a fold-icon toggle button in the toolbar UI, and configures Monaco editor to respect this setting in the DiffViewer component.

Changes

Cohort / File(s) Summary
State Management
apps/desktop/src/renderer/stores/changes/store.ts
Added hideUnchangedRegions boolean flag to state with initial value false, implemented toggleHideUnchangedRegions action, and included flag in state persistence config.
Toolbar UI Component
apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/FileViewerPane/components/FileViewerToolbar/FileViewerToolbar.tsx
Added hideUnchangedRegions prop and onToggleHideUnchangedRegions callback to interface; imported TbFold icon; added new toggle button with conditional styling and tooltip text reflecting the hide/show state.
View Composition Layer
apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/FileViewerPane/components/FileViewerContent/FileViewerContent.tsx
Introduced hideUnchangedRegions prop to component interface and passed it through to DiffViewer component.
Container Component
apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/FileViewerPane/FileViewerPane.tsx
Read hideUnchangedRegions and toggleHideUnchangedRegions from store; threaded hideUnchangedRegions to FileViewerContent and onToggleHideUnchangedRegions callback to FileViewerToolbar.
Core Diff Component
apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/ChangesContent/components/DiffViewer/DiffViewer.tsx
Added hideUnchangedRegions optional prop to DiffViewerProps; incorporated it into DiffEditor instance key for remounting; passed flag to Monaco editor options to control unchanged region visibility.

Sequence Diagram

sequenceDiagram
    participant User
    participant FileViewerToolbar
    participant ChangesStore
    participant FileViewerPane
    participant FileViewerContent
    participant DiffViewer
    participant MonacoEditor

    User->>FileViewerToolbar: Clicks fold toggle button
    FileViewerToolbar->>ChangesStore: onToggleHideUnchangedRegions()
    ChangesStore->>ChangesStore: toggleHideUnchangedRegions() updates state
    ChangesStore-->>FileViewerPane: state.hideUnchangedRegions updated
    FileViewerPane->>FileViewerContent: passes hideUnchangedRegions prop
    FileViewerPane->>FileViewerToolbar: passes updated hideUnchangedRegions
    FileViewerToolbar-->>User: updates button styling/tooltip
    FileViewerContent->>DiffViewer: passes hideUnchangedRegions prop
    DiffViewer->>MonacoEditor: configures hideUnchangedRegions option
    MonacoEditor-->>User: hides/shows unchanged regions
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 A fold here, a fold there,
Diff regions hidden with care,
With Monaco's might and a toggle so tight,
The unchanged lines vanish from sight!

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main feature addition: a toggle to hide unchanged regions in the diff viewer, which aligns perfectly with the changeset.
Description check ✅ Passed The description follows the required template structure with clear Summary and Test plan sections, though Type of Change is not explicitly checked and some optional sections are omitted.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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.

Add background and shadow styling to clearly distinguish the active
toggle option from inactive ones in the Raw/Diff/Rendered toggle group.
@Kitenite Kitenite merged commit 26af3a1 into main Jan 20, 2026
6 checks passed
@Kitenite Kitenite deleted the more-changes-changes branch January 20, 2026 05:44
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jan 20, 2026

🚀 Preview Deployment

🔗 Preview Links

Service Status Link
Neon Database (Neon) View Branch
Fly.io Electric (Fly.io) View App
Vercel API (Vercel) Open Preview
Vercel Web (Vercel) Open Preview
Vercel Marketing (Vercel) Open Preview
Vercel Admin (Vercel) Open Preview
Vercel Docs (Vercel) Open Preview

Preview updates automatically with new commits

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.

1 participant