input: Allow configuring the completion popover max width (#2369)
## Summary
The LSP completion popover width is currently capped at a hardcoded
`MAX_MENU_WIDTH` of 320 px, and there's no public API to override it
from outside the crate. That's fine for most identifiers, but it
truncates longer LSP labels — e.g. database table identifiers like
`tbl_verification_tracking` that show up in completions for editors
hosting SQL/MongoDB/etc. clients.
This PR keeps the default at **320 px** (no visual change for existing
callers) and adds a way to widen the popover per editor:
- Renames the hardcoded `MAX_MENU_WIDTH` to `DEFAULT_MAX_MENU_WIDTH`
(still `pub(crate)`).
- Stores `max_width: Pixels` on `CompletionMenu` and threads it through
`CompletionMenu::new`, the items column, the documentation panel, and
the side-by-side vs vertical layout overflow check.
- Adds two public methods on `InputState`:
- `completion_menu_max_width(width: Pixels) -> Self` — builder.
- `set_completion_menu_max_width(width, window, cx)` — runtime setter
that also forwards into an already-open popover.
Usage:
```rust
InputState::new(window, cx)
.code_editor("sql")
.completion_menu_max_width(px(480.))
```
## AI Assistance
🤖 The patch was drafted by Claude and reviewed/tested by a human; it
follows the existing builder-method pattern used for `placeholder`,
`searchable`, `folding`, etc.
## Test plan
- [x] `cargo check -p gpui-component`
- [x] `cargo clippy -p gpui-component -- -D warnings`
- [x] `rustfmt` on the three touched files
- [ ] Manual: open an editor with long completion labels, verify the
popover caps at the configured width and still shrinks to fit when near
the right viewport edge.
- [ ] Manual: confirm default behavior (no builder call) is unchanged at
320 px.
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-authored-by: Jason Lee <huacnlee@gmail.com> S
Sergei Rublev committed
58a6dec83e25e45156c28bdf7ac9adbd93b85465
Parent: bc3f229
Committed by GitHub <noreply@github.com>
on 8/10/2026, 10:48:18 AM