Fix documentation labels obscuring other content in completion menu (#4167)
Marshall Bowers
created
This PF fixes an issue where the documentation labels in the completion
menu could end up completing obscuring the primary content.
#### Before
<img width="691" alt="Screenshot 2024-01-19 at 1 42 19 PM"
src="https://github.com/zed-industries/zed/assets/1486634/187f2978-08be-4f5e-ba93-91ed09cd6e87">
#### After
<img width="704" alt="Screenshot 2024-01-19 at 1 39 45 PM"
src="https://github.com/zed-industries/zed/assets/1486634/e5929c04-bace-4336-b878-4ada5660d235">
Since this involved changes to the `ListItem`, I also made sure to test
the other problematic case that was fixed in #3845 to make sure we
didn't regress there:
<img width="665" alt="Screenshot 2024-01-19 at 1 39 11 PM"
src="https://github.com/zed-industries/zed/assets/1486634/14b72d44-b6a6-4aef-a708-37fb60b8875a">
I also tried to capture these cases in the `ListItem` stories to make it
easier to test all of them at once:
<img width="1141" alt="Screenshot 2024-01-19 at 1 40 03 PM"
src="https://github.com/zed-industries/zed/assets/1486634/333886ff-e394-4cba-89db-98352481c7f6">
Release Notes:
- Fixed an issue where documentation labels could obscure other content
in the editor completion menu
([#2419](https://github.com/zed-industries/community/issues/2419)).
@@ -222,17 +222,19 @@ impl RenderOnce for ListItem {
}))
.child(
h_flex()
- // HACK: We need to set *any* width value here in order for this container to size correctly.- // Without this the `h_flex` will overflow the parent `inner_list_item`.- .w_px()- .flex_1()
+ .flex_grow()
+ .flex_shrink_0()
+ .flex_basis(relative(0.25))
.gap_1()
+ .overflow_hidden()
.children(self.start_slot)
.children(self.children),
)
.when_some(self.end_slot, |this, end_slot| {
this.justify_between().child(
h_flex()
+ .flex_shrink()
+ .overflow_hidden()
.when(self.end_hover_slot.is_some(), |this| {
this.visible()
.group_hover("list_item", |this| this.invisible())