Repository navigation
refactor(renderer): share path head elision - #19938
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (6)
💤 Files with no reviewable changes (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe change adds Priority: ⬇️ Low 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
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.
✅ No new issues found.
Reviewed changes
A renderer-only refactor that extracts the New Workspace picker's head-elision into a shared helper so the stacked Cmd+J layout PR can reuse it, and in doing so fixes a highlight-on-elide gap.
- Shared helper —
splitPathHeadForElisionreplaces the inlinesplitDetailForElision, adds Windows separator support viaisWindowsAbsolutePathLike, and keeps the two-segment tail. - Highlight survival — matched single-char ranges are re-based into the elided tail and rendered through
MatchedText, instead of being dropped when a path elides. - Callers migrated —
ProjectOptionDetailconsumes the shared helper; the old function and its tests are removed with no dangling references. - Coverage — exact-equality tests for POSIX/Windows paths, backslash-in-segment, shallow/deep paths, and matched-segment tail extension.
I traced the range math the description flags: after the findLast adjustment tailStart is always <= the earliest match (and so <= every range start), which makes range.start - tailStart non-negative; the segment-spans-tail and match-sits-in-head cases are pinned by toEqual/toBeNull assertions rather than loose checks.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

ELI5
Move the existing “keep the useful end of a long path visible” behavior into one reusable renderer helper.
What Changed
Why
The Cmd+J layout work needs the same path treatment as New Workspace. Keeping that behavior in one helper avoids duplicating path parsing and keeps cross-platform handling consistent.
Linked Issue
N/A — no linked issue was provided.
Visual Proof
N/A — this is an extraction/refactor with no intentional layout change in the New Workspace picker.
Testing
Validated with:
pnpm tc:webpnpm run check:code-quality:changed(run on the complete two-commit stack; 0 new findings)Platform coverage: automated cases include POSIX and Windows paths. The renderer-only change does not alter execution, SSH, or remote wire behavior.
AI Disclosure
Review
Please review the range math around matches that extend the preserved tail.
Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Notes
This is PR 1 of 2. The Cmd+J layout PR is stacked on this branch and should merge second.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (targeted tests,pnpm tc:web, commit hooks, and changed-code quality passed; full suite/build left to CI)