Repository navigation
fix: prioritize filenames in cmd+p quick open - #12679
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughQuick Open and tab-bar entry rows now split file paths into filename and directory components and wrap each row in a shared cursor-positioned tooltip that displays the full path. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 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.
Actionable comments posted: 1
🧹 Nitpick comments (1)
tests/e2e/quick-open-file-paths.spec.ts (1)
31-37: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAssert rendered truncation, not only DOM text.
toContainText()andtextContent()read the complete DOM text even when CSS truncates the directory. The test can pass if the directory is not truncated or if the filename becomes shrinkable. Constrain the dialog or viewport, then assert that the filename remains visible and the directory element has rendered overflow.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: f22c96ad-9886-42d9-a4fa-182a808daf66
📒 Files selected for processing (2)
src/renderer/src/components/QuickOpen.tsxtests/e2e/quick-open-file-paths.spec.ts
|
@swieder227 Follow-up on the tooltip feedback: Quick Open now puts the native HTML Commit: e5b5dff Updated visual proof with the longer nested path and filename-first row: The native tooltip itself is OS-rendered and is not included in Chromium screenshots; the Electron E2E asserts the exact |
|
Follow-up: the cmd+p result now uses Orca’s existing lightweight tooltip primitive and positions the full path above the row.\n\nFresh Electron proof:\n\n |
1e0d488 to
14e54e6
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. |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 6480f981-eab0-4c81-af5e-db17a0f5ed4b
📒 Files selected for processing (7)
src/renderer/src/components/QuickOpen.tsxsrc/renderer/src/components/file-path-cursor-tooltip.test.tssrc/renderer/src/components/file-path-cursor-tooltip.tsxsrc/renderer/src/components/tab-bar/TabBarCreateEntryRow.test.tsxsrc/renderer/src/components/tab-bar/TabBarCreateEntryRow.tsxsrc/renderer/src/components/ui/command.tsxtests/e2e/quick-open-file-paths.spec.ts
🚧 Files skipped from review as they are similar to previous changes (3)
- src/renderer/src/components/QuickOpen.tsx
- src/renderer/src/components/ui/command.tsx
- tests/e2e/quick-open-file-paths.spec.ts
| React.useLayoutEffect(() => { | ||
| const rect = triggerRef.current?.getBoundingClientRect() | ||
| const pointer = pointerRef.current | ||
| if (!open || !rect || !pointer) { | ||
| return | ||
| } | ||
| const next = cursorTooltipOffsets(pointer, rect) | ||
| setOffset((current) => | ||
| current.align === next.align && current.side === next.side ? current : next | ||
| ) | ||
| }, [open]) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Recalculate offsets after result-row reflows.
Line 65 reruns this effect only when open changes. If streamed results move an already open row, Radix positions from the new trigger rect with offsets from the old rect. The tooltip then moves away from the stationary cursor.
Run this measurement on each relevant render while the tooltip is open. Add a component-level test that reflows the trigger after opening the tooltip.
Proposed fix
- }, [open])
+ })📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| React.useLayoutEffect(() => { | |
| const rect = triggerRef.current?.getBoundingClientRect() | |
| const pointer = pointerRef.current | |
| if (!open || !rect || !pointer) { | |
| return | |
| } | |
| const next = cursorTooltipOffsets(pointer, rect) | |
| setOffset((current) => | |
| current.align === next.align && current.side === next.side ? current : next | |
| ) | |
| }, [open]) | |
| React.useLayoutEffect(() => { | |
| const rect = triggerRef.current?.getBoundingClientRect() | |
| const pointer = pointerRef.current | |
| if (!open || !rect || !pointer) { | |
| return | |
| } | |
| const next = cursorTooltipOffsets(pointer, rect) | |
| setOffset((current) => | |
| current.align === next.align && current.side === next.side ? current : next | |
| ) | |
| }) |
Co-authored-by: Orca <[email protected]>
* fix: show full paths in quick open results * refactor: use native file path tooltips * fix: position file path tooltips * refactor: share the cursor path tooltip with quick open Co-authored-by: Orca <[email protected]> * fix: let path tooltips run wider before wrapping Co-authored-by: Orca <[email protected]> --------- Co-authored-by: Orca <[email protected]>


Summary
FilePathCursorTooltipso both surfaces stay identical.Follows #12670 (merged), which shipped the same treatment for the new-tab
+dropdown. Rebased on top of it.Visual proof
Before — the three top hits are all called
ExpoTwoWayAudio…; the filename is truncated away and the shared directory prefix is what survives, so you cannot tell them apart.After — the filename leads and the directory truncates, with the full path in a tooltip anchored under the cursor.
Shared component
src/renderer/src/components/file-path-cursor-tooltip.tsxnow owns what #12670 had inlined in the tab bar:splitTrailingSegment— splits on the last separator and keeps the separator attached to the directory, so/foorendersfoo+/and Windows paths keep their backslashes. Quick Open previously split onlastIndexOf('/')only, so it mishandled backslash paths and dropped the trailing separator.cursorTooltipOffsets— restates a cursor position as RadixalignOffset/sideOffsetfrom the trigger's bottom-left corner, 18px below the pointer.FilePathCursorTooltip— the trigger wiring, re-measuring on open because results stream in and move rows during the open delay.The tooltip caps at
min(90vw, 800px)so a full path usually lands on one line instead of wrapping. Verified it cannot run off screen: at a 1680px viewport with the cursor at 95% across the row it clamps to the right edge, and at a 600px viewport it caps to 540px and wraps — on screen in every case, because Radix shifts it back inside the viewport.TabBarCreateEntryRow.tsxdrops ~80 lines and now calls the shared component, so the two surfaces cannot drift.One non-obvious thing
In Quick Open the tooltip trigger is an inner
div, not theCommandItem. cmdk sets its ownonPointerMoveafter spreading incoming props (cmdk/dist/index.mjs,Item), so any handler passed toCommandItemis silently dropped — including the one Radix needs to open the tooltip. Putting the trigger one level in keeps cmdk's pointer-selection working (events still bubble) while letting Radix see the move.This also let me revert the
refpassthrough this PR previously added toui/command.tsx: with the trigger inside the item,CommandItemno longer needs to forward a ref, so the sharedcommand.tsxprimitive is untouched.Testing
pnpm exec playwright test tests/e2e/quick-open-file-paths.spec.ts tests/e2e/tab-create-entry-file-paths.spec.ts … --repeat-each=3— 6/6 passed. Both specs, so the extraction is verified against the surface fix: prioritize filenames in new-tab file results #12670 already shipped.pnpm exec vitest run … src/renderer/src/components/tab-bar/ file-path-cursor-tooltip.test.ts— 271 passed.pnpm run typecheck:web,oxlint— clean.dx=0.0, dy=18.0from the cursor.Placement is asserted in unit tests against
cursorTooltipOffsets; the E2E asserts the tooltip really opens with the whole path. Asserting pixels through the running app measures it mid-reflow and is flaky — that lesson came from #12670.Security
No new IPC payloads, filesystem permissions, subprocesses, network sinks, secrets, or dependencies. The tooltip renders a path the row already received.
Readiness
ui/command.tsxis back to its original form. No mobile surface touched.Known limits (same as #12670)
aria-activedescendant, so keyboard users get no tooltip. The full path remains in the option's accessible name.