SIGN IN SIGN UP

editor: Fix completion menu intrinsic width measurement (#2571)

## Description

Completion menus already select their longest label/detail row with
`ListState::set_item_to_measure_index`, but that representative row was
not reaching `VirtualList`'s cross-axis measurement. `VirtualList`
always measured flattened item `0`, which is commonly an empty
section-header entry, so the popover collapsed to its 120px minimum.

This change passes the selected row's flattened index through
`ListState` to `VirtualList` and uses that item when inferring content
width. The existing completion popover constraints remain unchanged:
short lists stay compact, longer lists expand to content, and width
remains capped by the existing 320px/available-space maximum.

## Screenshot

| Before                       | After                       |
| ---------------------------- | --------------------------- |
| <img width="518" height="312" alt="Screenshot 2026-07-15 at 5 12
26 pm"
src="https://github.com/user-attachments/assets/a037f58a-4b1f-4cf7-ad75-330b99b22d6e"
/> | <img width="726" height="326" alt="Screenshot 2026-07-15 at 5 14
10 pm"
src="https://github.com/user-attachments/assets/9cfd24b0-d63d-4250-a4da-303c7cc25a47"
/> |

## How to Test

1. Use an LSP server such as `rust-analyzer` and trigger a completion
list with short items; confirm the popup remains compact.
2. Trigger a list containing longer labels/details; confirm the popup
expands beyond 120px.
3. Confirm very long items remain capped at the existing maximum and
documentation stays adjacent to the actual completion width.
4. Run `cargo check -p gpui-component` and `cargo test -p
gpui-component`.

## Checklist

- [x] I have read the [CONTRIBUTING](../CONTRIBUTING.md) document and
followed the guidelines.
- [x] Reviewed the changes in this PR and confirmed AI generated code
(If any) is accurate.
- [x] Passed `cargo run` for story tests related to the changes.

---------

Co-authored-by: Richard Nelson <rnelson@atlassian.com>
Co-authored-by: Jason Lee <huacnlee@gmail.com>
Co-authored-by: Codex <codex@openai.com>
R
Richard Nelson committed
88f102d13654fe25aa2fede076274b6b751a3704
Parent: be3c841
Committed by GitHub <noreply@github.com> on 7/30/2026, 12:46:05 PM