Fix completion menu intrinsic width measurement#2571
Open
wabzqem wants to merge 1 commit into
Open
Conversation
huacnlee
requested changes
Jul 15, 2026
huacnlee
left a comment
Member
There was a problem hiding this comment.
This change is definitely wrong; it's not the right way to solve the problem.
wabzqem
force-pushed
the
fix/completion-menu-width
branch
from
July 15, 2026 09:34
277395e to
8c948b0
Compare
Author
|
Apologies, I should have looked deeper than that. I've pushed a (hopefully better) fix that keeps the existing min/max popup constraints and passes the selected flattened row index through to |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Completion menus already select their longest label/detail row with
ListState::set_item_to_measure_index, but that representative row was not reachingVirtualList's cross-axis measurement.VirtualListalways measured flattened item0, 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
ListStatetoVirtualListand 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
How to Test
rust-analyzerand trigger a completion list with short items; confirm the popup remains compact.cargo check -p gpui-componentandcargo test -p gpui-component.Checklist
cargo runfor story tests related to the changes.