Add a divider below "Usage" in the Edit Prediction menu (#30284)

As it felt untidy without it.

Release Notes:

- N/A
This commit is contained in:
Danilo Leal 2025-05-08 14:19:51 -03:00 committed by GitHub
parent dc01aef0cf
commit 7fb52ddf32
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -423,36 +423,39 @@ impl InlineCompletionButton {
if let Some(usage) = usage { if let Some(usage) = usage {
menu = menu.header("Usage"); menu = menu.header("Usage");
menu = menu.custom_entry( menu = menu
move |_window, cx| { .custom_entry(
let used_percentage = match usage.limit { move |_window, cx| {
UsageLimit::Limited(limit) => { let used_percentage = match usage.limit {
Some((usage.amount as f32 / limit as f32) * 100.) UsageLimit::Limited(limit) => {
} Some((usage.amount as f32 / limit as f32) * 100.)
UsageLimit::Unlimited => None, }
}; UsageLimit::Unlimited => None,
};
h_flex() h_flex()
.flex_1() .flex_1()
.gap_1p5() .gap_1p5()
.children( .children(
used_percentage used_percentage.map(|percent| {
.map(|percent| ProgressBar::new("usage", percent, 100., cx)), ProgressBar::new("usage", percent, 100., cx)
) }),
.child( )
Label::new(match usage.limit { .child(
UsageLimit::Limited(limit) => { Label::new(match usage.limit {
format!("{} / {limit}", usage.amount) UsageLimit::Limited(limit) => {
} format!("{} / {limit}", usage.amount)
UsageLimit::Unlimited => format!("{} / ∞", usage.amount), }
}) UsageLimit::Unlimited => format!("{} / ∞", usage.amount),
.size(LabelSize::Small) })
.color(Color::Muted), .size(LabelSize::Small)
) .color(Color::Muted),
.into_any_element() )
}, .into_any_element()
move |_, cx| cx.open_url(&zed_urls::account_url(cx)), },
); move |_, cx| cx.open_url(&zed_urls::account_url(cx)),
)
.separator();
} }
} }