Skip to content

fix: prioritize filenames in cmd+p quick open - #12679

Merged
nwparker merged 5 commits into
mainfrom
neil/quick-open-file-path-tooltip
Aug 6, 2026
Merged

nwparker merged 5 commits into
mainfrom
neil/quick-open-file-path-tooltip

Conversation

@nwparker

@nwparker nwparker commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Prioritize the actual filename in cmd+p Quick Open results, truncating the parent directory instead.
  • Show the complete path in the same system-style, cursor-anchored tooltip that fix: prioritize filenames in new-tab file results #12670 introduced for the new-tab dropdown.
  • Extract that tooltip into a shared FilePathCursorTooltip so 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.

before

After — the filename leads and the directory truncates, with the full path in a tooltip anchored under the cursor.

after

Shared component

src/renderer/src/components/file-path-cursor-tooltip.tsx now owns what #12670 had inlined in the tab bar:

  • splitTrailingSegment — splits on the last separator and keeps the separator attached to the directory, so /foo renders foo + / and Windows paths keep their backslashes. Quick Open previously split on lastIndexOf('/') only, so it mishandled backslash paths and dropped the trailing separator.
  • cursorTooltipOffsets — restates a cursor position as Radix alignOffset/sideOffset from 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.tsx drops ~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 the CommandItem. cmdk sets its own onPointerMove after spreading incoming props (cmdk/dist/index.mjs, Item), so any handler passed to CommandItem is 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 ref passthrough this PR previously added to ui/command.tsx: with the trigger inside the item, CommandItem no longer needs to forward a ref, so the shared command.tsx primitive 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.
  • Verified interactively in a dev build over CDP: tooltip lands at dx=0.0, dy=18.0 from 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

  • SSH/remote: presentation-only renderer change; no transport, reconnect, relay, or provider behavior touched.
  • Crash/retry/growth: no new async loop, retry, cache, listener, timer, or retained collection. Pointer position is a ref, so hovering does not re-render per move.
  • Cross-platform: separators are preserved from the input path rather than inferred; Windows backslash paths covered by unit test.
  • Backward compatibility: no persisted state, route, RPC contract, or serialized data changed. ui/command.tsx is back to its original form. No mobile surface touched.

Known limits (same as #12670)

  • Once open, the tooltip stays anchored to the row, so scrolling the list drags it with the row while the cursor stays put.
  • Pointer-only: cmdk drives selection via aria-activedescendant, so keyboard users get no tooltip. The full path remains in the option's accessible name.

@coderabbitai

coderabbitai Bot commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 85c64128-50ef-4243-a7a6-44e7e2055152

📥 Commits

Reviewing files that changed from the base of the PR and between 14e54e6 and 27c1e2c.

📒 Files selected for processing (1)
  • src/renderer/src/components/file-path-cursor-tooltip.tsx

📝 Walkthrough

Walkthrough

Quick 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. CommandItem forwards refs to its underlying command item. Tests cover offset calculation, cross-platform path splitting, Quick Open search behavior, filename prioritization, hover remounts, and full-path tooltip display.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 44.44% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the main change: keeping filenames visible in cmd+p Quick Open results.
Description check ✅ Passed The description covers the change, visual proof, testing, security, platform behavior, risks, and known limits, although some template headings differ.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
tests/e2e/quick-open-file-paths.spec.ts (1)

31-37: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Assert rendered truncation, not only DOM text.

toContainText() and textContent() 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

📥 Commits

Reviewing files that changed from the base of the PR and between 0f9caf5 and 4309cc9.

📒 Files selected for processing (2)
  • src/renderer/src/components/QuickOpen.tsx
  • tests/e2e/quick-open-file-paths.spec.ts

@nwparker

nwparker commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

@swieder227 Follow-up on the tooltip feedback: Quick Open now puts the native HTML title tooltip directly on the focused CommandItem, so the full path uses the normal system/browser tooltip without Radix overlay chrome.

Commit: e5b5dff

Updated visual proof with the longer nested path and filename-first row:

orca-quick-open-native-title-final.png

The native tooltip itself is OS-rendered and is not included in Chromium screenshots; the Electron E2E asserts the exact title value.

@nwparker

nwparker commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor Author

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\nQuick Open file path tooltip\n\nCommit: 1e0d488

@nwparker
nwparker force-pushed the neil/quick-open-file-path-tooltip branch from 1e0d488 to 14e54e6 Compare August 6, 2026 09:47
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between ead6b8e and 14e54e6.

📒 Files selected for processing (7)
  • src/renderer/src/components/QuickOpen.tsx
  • src/renderer/src/components/file-path-cursor-tooltip.test.ts
  • src/renderer/src/components/file-path-cursor-tooltip.tsx
  • src/renderer/src/components/tab-bar/TabBarCreateEntryRow.test.tsx
  • src/renderer/src/components/tab-bar/TabBarCreateEntryRow.tsx
  • src/renderer/src/components/ui/command.tsx
  • tests/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

Comment on lines +55 to +65
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])

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 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.

Suggested change
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
)
})

@nwparker
nwparker merged commit f713739 into main Aug 6, 2026
46 checks passed
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
* 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]>
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