* fix(code-insight): stabilize Show Usages popup sizing and placement
The popup used a fixed 680px width and 14-row limit. Restoring a saved
size also prevented it from adapting to incoming results. Follow the
IntelliJ popup sizing and placement flow while limiting the filename
column to 25% of the popup width to leave space for code.
Sizing and columns:
- Restore both saved dimensions while waiting for results. Once results
arrive, cap the natural width at the saved width and calculate the
height from content. Only preview mode also uses the saved height.
- Measure filenames, line numbers and code with the actual fonts, with
a 500px natural width limit per column. Fit short filenames to their
content and ellipsize long names at 25% of the row width. Reserve 5ch
for line numbers and at least 8em for code, which fills the remaining
space.
- Include the filename cap, code minimum width, header, controls, borders
and gaps in the natural popup width. Do not widen the popup for text
that the filename column will clip.
- Cache maximum natural widths during streaming and filtering. After a
manual resize, keep updating filename measurements but stop resizing
the popup automatically until it is reopened or preview is toggled.
- Show up to 30 rows normally or 20 with preview. Leave half a row when
the list scrolls, and let the list fill the available height.
- Preserve the 360x160 minimum size and existing storage keys. Fit the
viewport when it is smaller, and save the actual size on close.
Placement and preview:
- Open below the caret. When it is outside the visible editor, use a
point one third across and halfway down the visible editing area.
- Add optional fitToScreen placement to Popup. Keep the fitted position
when content shrinks, and move only when necessary to stay visible.
Reset placement when the anchor changes or preview rebuilds the popup.
- Reuse the shared split panels with a default 60/40 list/preview split,
persisted proportions, mouse dragging and keyboard adjustment. Set the
preview minimum to five actual editor lines and update it after font
or editor geometry changes.
- Preserve the preview's pixel height while manually resizing the outer
popup. Wait for the splitter's final measurement before restoring it.
- Add onResizeStart on the first pointer movement. Clicking the resize
handle alone does not lock preview height. Toggling preview clears
saved dimensions, measurements, manual size and drag position, and
cancels pending resize callbacks.
- Add a translated accessible label to the preview divider and preserve
its keyboard controls alongside usage-list navigation.
Verification:
- 17 Playwright layout and demo tests passed in local Google Chrome,
covering both themes, the 25% cap, narrow windows, filtering, saved
dimensions, position stability, preview, keyboard controls and resize.
Both filename-cap regression cases failed before the fix and passed
afterward.
- Wait for fonts and entry animations before dragging the one-pixel
divider or measuring dimensions. Account for popup growth when the
search caption changes while checking the filename cap.
- 49 Popup and Show Usages unit tests passed on the final version.
- pnpm typecheck and pnpm build passed, including Safari 15.4 checks.
Changed-file oxlint, oxfmt and git diff --check passed.
- An earlier full test run had 20,483 passed, 65 skipped and two existing
translation-check failures in color-preview/varColors.ts and
vcs/rebase.tsx. Earlier full lint and knip checks passed. Full format
checking failed on an existing untracked .workbuddy memory file.
- Before/after screenshots for both themes and narrow windows, plus
interaction recordings, are retained in temporary verification folders.
Tests used browser fixtures; the native Tauri webview was not tested
because no Tauri MCP bridge was available.
* fix(code-insight): restore focus across preview toggle, avoid width ratchet, and clean up cancelled resizes
---------
Co-authored-by: l0ng-ai <[email protected]>