Repository navigation
Conversation
|
Important Review skippedWe couldn't safely recover the incremental review. No full review was started, and the last reviewed checkpoint was preserved. Retry later, or explicitly request a full review by commenting You can disable this status message by setting the Use the checkbox below for a quick retry:
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds the optional 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Comment |
Greptile SummaryThis PR adds an opt-in setting ("Collapse Unchanged Regions") to the General → Editor settings panel that applies Monaco's
Confidence Score: 5/5Safe to merge. The change is well-scoped: a new optional boolean in settings, a small Monaco options utility with explicit tests, and an extracted UI component following existing patterns. The always-emit-the-key design (returning enabled: false rather than omitting the field) correctly handles the Monaco option-lifecycle edge case. Legacy settings with undefined flow through the same guard (=== true). The new field is optional in the type and has a false default so no migration is needed. No auth, IPC, path handling, or dependency changes are introduced. Files Needing Attention: No files require special attention.
|
| Filename | Overview |
|---|---|
| src/renderer/src/components/editor/diff-editor-hide-unchanged-options.ts | New utility that maps the setting boolean to Monaco's hideUnchangedRegions option; always emits the key (never omits it) to handle toggle-off correctly. |
| src/renderer/src/components/editor/diff-editor-hide-unchanged-options.test.ts | Tests cover all three input cases (true, false, undefined) and pin the always-emit-the-key behavior. |
| src/renderer/src/components/editor/DiffViewer.tsx | Spreads buildDiffEditorHideUnchangedOptions into the Monaco options object, consistent with the existing diffWordWrap pattern. |
| src/renderer/src/components/settings/CollapseUnchangedRegionsSetting.tsx | Extracted UI component following the one-setting-per-file pattern; correctly handles undefined (falsy) for the Off default state. |
| src/renderer/src/components/settings/GeneralEditorSettingsSection.tsx | Inserts CollapseUnchangedRegionsSetting between EditorWordWrapSetting and the Diff Word Wrap control; stays within the 400-line limit via extraction. |
| src/shared/types.ts | Adds optional diffCollapseUnchangedRegions?: boolean to GlobalSettings for backward compatibility with existing profiles. |
| src/shared/constants.ts | Adds diffCollapseUnchangedRegions: false to getDefaultSettings; new profiles default to off. |
| src/renderer/src/i18n/locales/en.json | Adds collapseUnchangedTitle and collapseUnchangedDescription using descriptive camelCase keys, consistent with sibling settings in the same namespace. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[User toggles setting in\nGeneral → Editor] --> B[updateSettings diffCollapseUnchangedRegions]
B --> C[GlobalSettings store updated]
C --> D[DiffViewer re-renders\nsettings?.diffCollapseUnchangedRegions]
D --> E[buildDiffEditorHideUnchangedOptions]
E -->|true| F[hideUnchangedRegions: enabled true]
E -->|false / undefined| G[hideUnchangedRegions: enabled false\nalways emitted — never omitted]
F --> H[Monaco DiffEditor.updateOptions]
G --> H
H -->|enabled: true| I[Unchanged regions collapse\ninto expandable bands]
H -->|enabled: false| J[Full file rendered\ndefault behavior]
K[DiffSectionBody.tsx\nView All Changes] -->|unconditional| L[hideUnchangedRegions: enabled true\nnot affected by this setting]
Reviews (2): Last reviewed commit: "feat(editor): add opt-in collapsed uncha..." | Re-trigger Greptile
ff8e205 to
bbffe72
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
bbffe72 to
e8a96bb
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
e8a96bb to
ccb0dcf
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
ccb0dcf to
6e80059
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
6e80059 to
c777b51
Compare
06f4695 to
f11c89c
Compare
f11c89c to
84d7fd7
Compare
CI result on
|
84d7fd7 to
8809559
Compare
d828009 to
dc3f03e
Compare
The combined "View All Changes" diff already collapses unchanged lines into expandable bands (DiffSectionBody sets Monaco's hideUnchangedRegions), but a single-file diff opened from Source Control renders the whole file. Reviewing one changed line in a long file means scrolling past everything else. Adds a General > Editor setting, default off, that applies the same Monaco option to the single-file diff viewer. Off keeps today's full-file rendering. The option is always emitted rather than omitted when off: Monaco retains the last applied value across an options update, so dropping the key would strand an open diff in collapsed mode after the setting is turned back off. Co-Authored-By: Claude Opus 5 <[email protected]>
dc3f03e to
7dfe6b1
Compare





What: Opt-in collapse of unchanged regions in single-file diffs, matching what "View All Changes" already does.
Risk: One boolean setting, default off — no behavior change without explicit user action. Greptile: 5/5 "Safe to merge".
State: Rebased on
maintoday (0 behind, 0 conflicts); all review-bot threads resolved.ELI5
Today, opening a single file's diff shows every line of the file even if only one line changed, so reviewing a small edit in a long file means a lot of scrolling. This adds an optional Settings > General > Editor switch, "Collapse Unchanged Regions" (off by default), that hides untouched stretches behind expandable "hidden lines" bands — the same way the existing View All Changes view already behaves. Nothing changes unless you turn it on.
Summary
The combined "View All Changes" diff already collapses runs of unchanged lines into expandable bands —
DiffSectionBody.tsxsets Monaco'shideUnchangedRegions: { enabled: true }. A single-file diff opened by clicking one file in Source Control does not, so it renders the whole file. Reviewing a one-line change in a long file means scrolling past everything that did not change.This adds a General → Editor setting, default off, that applies the same Monaco option to the single-file diff viewer. Off preserves today's full-file rendering for everyone who has not opted in.
One detail worth noting: the option is always emitted rather than omitted when the setting is off. Monaco retains the last applied value across an options update, so dropping the key would strand an already-open diff in collapsed mode after the user turns the setting back off.
buildDiffEditorHideUnchangedOptionstherefore returns an explicit{ enabled: false }, and a test pins that.Screenshots
No new chrome. The setting is one segmented Off/On control in General → Editor, sitting directly above the existing "Diff Word Wrap" control and matching its shape. When enabled, single-file diffs render exactly as the existing View All Changes diff already does — unchanged runs become clickable "N hidden lines" bands.
Testing
pnpm lintpnpm typecheckpnpm test(939 settings/editor/shared tests pass)pnpm build— not run locally; relies on CIdiff-editor-hide-unchanged-options.test.tscovers on, off, and the legacy-undefinedcase, including the always-emit-the-key behavior described above.AI Review Report
Reviewed with Claude Code. Risks checked: Monaco option lifecycle across settings changes and model swaps, settings persistence and defaulting for existing profiles, and consistency with the combined diff surface.
diffCollapseUnchangedRegions?: boolean) and every read goes through=== true, so profiles written before this change behave exactly as they do today without a migration.hideUnchangedRegions. This PR deliberately does not put that surface behind the setting: it is a summary view where collapsing is the point, and changing it would be a behavior regression for existing users.GeneralEditorSettingsSection.tsx, which pushed it to 437 lines against the repo's 400 ceiling. Rather than add amax-linesdisable (whichAGENTS.mdforbids outright), it is extracted into its ownCollapseUnchangedRegionsSetting.tsx, matching the one-setting-per-file pattern already used byCompareAgainstUpstreamSettingand others.Cross-platform: no platform-dependent code. This is a single Monaco editor option plus a settings boolean — no shortcuts, labels, paths, shell behavior, or Electron platform APIs are touched.
Security Audit
Minimal surface. No IPC, command execution, path handling, auth, secrets, or dependency changes. The only new persisted value is a boolean flowing through the existing settings store, consumed as a Monaco rendering option. No user input reaches any new sink. No follow-up needed.
Notes
Independent of #11866 and #11867 — no shared files, applies cleanly on its own.
Worth flagging for maintainers: the discoverability gap here is real. A user looking for "show me only the changed lines" would reasonably expect that from the per-file diff and may not find that View All Changes already does it. If you would rather this default on for parity with the combined view, that is a one-line change to
constants.ts— I defaulted it off to avoid changing behavior for existing users without opt-in.🤖 Generated with Claude Code