Repository navigation
Highlight the open file in the Source Control sidebar - #5667
Conversation
Pending (uncommitted) rows had no persistent indicator for the file currently open in the editor: a plain single click cleared the bulk selection and only opened the diff, leaving no visual cue for which row was active. Derive the active editor file for the worktree from the store and mark its Source Control row as the current row (full bg-accent + data-current), outranking the lighter bulk-selection tint. Matching is area-aware so a partially staged file lights up only the row that is actually open, and the highlight clears when the visible tab is not an editor. Extract the row-key mapping into source-control-active-open-file-keys.ts and cover it with unit tests plus render tests for the highlight wiring.
|
Ready to review this PR? Stage has broken it down into 4 individual chapters for you: Chapters generated by Stage for commit cfd354e on Jun 18, 2026 7:06pm UTC. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughA new module 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ 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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 97db179d-9e62-421f-8182-31a2c667e894
📒 Files selected for processing (4)
src/renderer/src/components/right-sidebar/SourceControl.open-file-highlight.test.tsxsrc/renderer/src/components/right-sidebar/SourceControl.tsxsrc/renderer/src/components/right-sidebar/source-control-active-open-file-keys.test.tssrc/renderer/src/components/right-sidebar/source-control-active-open-file-keys.ts
…ile-highlight.test.tsx Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
brennanb2025
left a comment
There was a problem hiding this comment.
Thanks! I reviewed this and made a small follow-up to cover edge cases before merge:
- Prevent branch/commit compare tabs from marking pending rows as current.
- Make ordinary editor tabs prefer visible working-tree rows, with staged-only fallback.
- Keep the current row at the full accent state on hover.
- Added regression coverage for staged-only, collapsed-section, compare-tab, and non-editor cases.
Validated with lint, typecheck, targeted tests, Electron UI checks, and a two-reviewer code-review loop.
* upstream/main: (220 commits) Show and Filter Automation-Created Workspaces (stablyai#5697) Fix premature project header truncation Send review notes to any running agent of a worktree (stablyai#5654) Fix workspace sidebar appearance setting (stablyai#5725) Highlight the open file in the Source Control sidebar (stablyai#5667) release: v1.4.80-rc.1 Fix premature Codex completion notifications (stablyai#5682) Improve Codex startup prompt reliability (stablyai#5686) Keep hibernated agent completions visible (stablyai#5689) Move Prompt Cache Timer setting to Agents pane, simplify expired state (stablyai#5691) release: v1.4.80-rc.0 Skip GitHub CLI preflight checks if no GitHub projects exist fix: restore font family keyboard navigation in settings Update README downloads badge fix(landing): make GitHub CLI setup nudge dismissible and provider-aware (stablyai#5688) Fix nested workspace card indentation (stablyai#5684) Fix flaky e2e tests (stablyai#5680) Replace plus icon with play button on quick command entry (stablyai#5674) Use managed Pi and OMP extensions (stablyai#5681) Narrow computer-use e2e trigger (stablyai#5685) ... # Conflicts: # mobile/src/terminal/TerminalWebView.tsx # mobile/src/terminal/terminal-webview-text-zoom.test.ts
* upstream/main: (78 commits) Show and Filter Automation-Created Workspaces (stablyai#5697) Fix premature project header truncation Send review notes to any running agent of a worktree (stablyai#5654) Fix workspace sidebar appearance setting (stablyai#5725) Highlight the open file in the Source Control sidebar (stablyai#5667) release: v1.4.80-rc.1 Fix premature Codex completion notifications (stablyai#5682) Improve Codex startup prompt reliability (stablyai#5686) Keep hibernated agent completions visible (stablyai#5689) Move Prompt Cache Timer setting to Agents pane, simplify expired state (stablyai#5691) release: v1.4.80-rc.0 Skip GitHub CLI preflight checks if no GitHub projects exist fix: restore font family keyboard navigation in settings Update README downloads badge fix(landing): make GitHub CLI setup nudge dismissible and provider-aware (stablyai#5688) Fix nested workspace card indentation (stablyai#5684) Fix flaky e2e tests (stablyai#5680) Replace plus icon with play button on quick command entry (stablyai#5674) Use managed Pi and OMP extensions (stablyai#5681) Narrow computer-use e2e trigger (stablyai#5685) ... # Conflicts: # mobile/app/h/[hostId]/session/[worktreeId].tsx # mobile/src/terminal/TerminalWebView.tsx # mobile/src/terminal/terminal-webview-html.ts
* upstream/main: (220 commits) Show and Filter Automation-Created Workspaces (stablyai#5697) Fix premature project header truncation Send review notes to any running agent of a worktree (stablyai#5654) Fix workspace sidebar appearance setting (stablyai#5725) Highlight the open file in the Source Control sidebar (stablyai#5667) release: v1.4.80-rc.1 Fix premature Codex completion notifications (stablyai#5682) Improve Codex startup prompt reliability (stablyai#5686) Keep hibernated agent completions visible (stablyai#5689) Move Prompt Cache Timer setting to Agents pane, simplify expired state (stablyai#5691) release: v1.4.80-rc.0 Skip GitHub CLI preflight checks if no GitHub projects exist fix: restore font family keyboard navigation in settings Update README downloads badge fix(landing): make GitHub CLI setup nudge dismissible and provider-aware (stablyai#5688) Fix nested workspace card indentation (stablyai#5684) Fix flaky e2e tests (stablyai#5680) Replace plus icon with play button on quick command entry (stablyai#5674) Use managed Pi and OMP extensions (stablyai#5681) Narrow computer-use e2e trigger (stablyai#5685) ... # Conflicts: # src/renderer/src/i18n/locales/en.json # src/renderer/src/i18n/locales/es.json # src/renderer/src/i18n/locales/ja.json # src/renderer/src/i18n/locales/ko.json # src/renderer/src/i18n/locales/zh.json
* upstream/main: (341 commits) Show and Filter Automation-Created Workspaces (stablyai#5697) Fix premature project header truncation Send review notes to any running agent of a worktree (stablyai#5654) Fix workspace sidebar appearance setting (stablyai#5725) Highlight the open file in the Source Control sidebar (stablyai#5667) release: v1.4.80-rc.1 Fix premature Codex completion notifications (stablyai#5682) Improve Codex startup prompt reliability (stablyai#5686) Keep hibernated agent completions visible (stablyai#5689) Move Prompt Cache Timer setting to Agents pane, simplify expired state (stablyai#5691) release: v1.4.80-rc.0 Skip GitHub CLI preflight checks if no GitHub projects exist fix: restore font family keyboard navigation in settings Update README downloads badge fix(landing): make GitHub CLI setup nudge dismissible and provider-aware (stablyai#5688) Fix nested workspace card indentation (stablyai#5684) Fix flaky e2e tests (stablyai#5680) Replace plus icon with play button on quick command entry (stablyai#5674) Use managed Pi and OMP extensions (stablyai#5681) Narrow computer-use e2e trigger (stablyai#5685) ... # Conflicts: # src/main/text-generation/commit-message-text-generation.test.ts # src/main/text-generation/commit-message-text-generation.ts
* Highlight the open file in the Source Control sidebar Pending (uncommitted) rows had no persistent indicator for the file currently open in the editor: a plain single click cleared the bulk selection and only opened the diff, leaving no visual cue for which row was active. Derive the active editor file for the worktree from the store and mark its Source Control row as the current row (full bg-accent + data-current), outranking the lighter bulk-selection tint. Matching is area-aware so a partially staged file lights up only the row that is actually open, and the highlight clears when the visible tab is not an editor. Extract the row-key mapping into source-control-active-open-file-keys.ts and cover it with unit tests plus render tests for the highlight wiring. * Update src/renderer/src/components/right-sidebar/SourceControl.open-file-highlight.test.tsx Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Refine source control open-file highlighting --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: brennanb2025 <[email protected]>
Summary
Selecting a pending (uncommitted) file in the right-hand Source Control sidebar gave no persistent visual cue for which file was open in the editor. A plain single click cleared the bulk selection and only opened the diff, so no row stayed highlighted.
This adds a "current row" highlight to the open file's Source Control row:
activeFileIdByWorktree+openFiles) and its row is marked with the fullbg-accent+data-current="true"treatment per the styleguide's "List rows: hover, selected, current" convention, outranking the lighter bulk-selection tint (bg-accent/60).Scope is limited to pending/uncommitted rows (
UncommittedEntryRow), covering both the tree and flat list views.Screenshots
UI change (no screen recording captured in this headless environment — please attach one before merge):
Testing
pnpm lint(every sub-step run individually and green:oxlint,lint:switch-exhaustiveness,check-styled-scrollbars,verify:localization-catalog,verify:localization-coverage)pnpm typecheck(all 3 projects clean)pnpm test— ran the affected suites: right-sidebar + editor store (725 passing), plus the new unit + render tests (19 passing). Full monorepo run andpnpm buildwere not executed in this environment.pnpm buildAI Review Report
Reviewed by the AI agent for correctness and reuse risks:
${diffSource}::${relativePath}) instead of a fresh object, so the panel only re-renders when the active file actually changes.${area}::${path}row keys match exactly between the tree builder, the flat list, and the new mapping; logic extracted intosource-control-active-open-file-keys.tsand unit-tested (staged-only, working-tree, untracked, edit-tab, null/malformed).cn()ternary to avoidbg-accentvsbg-accent/60conflict.Security Audit
Low risk. No input handling, command execution, path handling, authentication, secrets, dependency changes, or IPC are involved. The change reads existing in-memory renderer store state (active editor tab + git status entries) and applies a presentational CSS class plus a
data-currentattribute. No user-controlled value is interpolated into anything executable; the only string interpolation builds DOM class names and a comparison key. No follow-up needed.Notes
BranchEntryRow) intentionally keep their existing behavior — this PR is scoped to pending files as requested. Adding the same highlight there would be a small follow-up.