editor: Fix completion menu intrinsic width measurement - #2571
Merged
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
Contributor
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 |
Co-authored-by: Codex <codex@openai.com>
huacnlee
approved these changes
Jul 30, 2026
huacnlee
enabled auto-merge (squash)
July 30, 2026 12:42
dwander
added a commit
to dwander/gpui-component
that referenced
this pull request
Aug 10, 2026
충돌: crates/ui/src/virtual_list.rs 업스트림(longbridge#2571)이 교차축 content_size 대입을 sizes_changed 분기 밖으로 옮겼다. 업스트림은 매 레이아웃 패스마다 측정하므로 맞는 코드지만, 우리 포크는 item_sizes 변경 시에만 측정한다(0f89a73). 그대로 병합하면 측정을 건너뛴 모든 패스에서 longest_item_size 가 0이라 그리드 폭이 0으로 덮어써진다 — 컴파일은 통과하므로 빌드만으로는 드러나지 않는다. 썸네일 그리드(v_virtual_list)와 필름스트립 (h_virtual_list)이 바로 이 경로를 쓴다. 해결: - 측정을 건너뛰면 캐시된 교차축 크기를 건드리지 않도록 Option 으로 감쌌다. - 업스트림 신규 with_item_to_measure_index(자동완성 메뉴 폭 수정용, list.rs 에서 실제 사용 중)를 존중하도록 ItemSizeLayout 에 measured_item_ix 를 추가해 측정 인덱스가 바뀌면 재측정한다. - measure_item 은 인라인 유지 — &self 헬퍼는 self.base 가변 대여와 충돌한다(E0502). 앱 실행으로 그리드 렌더 폭 정상 확인. 포크 패치 8개는 모두 온전하다.
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.