lsp_button: Fix long LSP version label (#46359)

If the LSP version label ends up being super long, we now truncate it
and add a tooltip so you can see the whole thing. This avoids the
submenu width from being extremely big:

<img width="500" height="310" alt="Screenshot 2026-01-08 at 9  10@2x"
src="https://github.com/user-attachments/assets/4729b3f8-000d-4bb5-8908-dc243a2d6e7b"
/>

Release Notes:

- Fixed a visual bug where long LSP version labels would increase the
LSP submenu width too much.
This commit is contained in:
Danilo Leal 2026-01-08 09:18:51 -03:00 committed by GitHub
parent f053aeb4dd
commit 1fa9dd6284
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -489,8 +489,10 @@ impl LanguageServerState {
let metadata_label = metadata_label.clone();
move |_, _| {
h_flex()
.id("metadata-container")
.ml_neg_1()
.gap_1()
.max_w_56()
.child(
Icon::new(IconName::Circle)
.color(status_color)
@ -511,8 +513,10 @@ impl LanguageServerState {
.child(
Label::new(metadata)
.size(LabelSize::Small)
.color(Color::Muted),
.color(Color::Muted)
.truncate(),
)
.tooltip(Tooltip::text(metadata.clone()))
})
.into_any_element()
}