assistant: Adjust slash command picker (#25920)
Mostly just fine-tuning its positioning. Other changes are mainly using the Label's `buffer_font` method instead of using a div for that. Release Notes: - N/A
This commit is contained in:
parent
06bcc42652
commit
e0060b92cc
1 changed files with 17 additions and 11 deletions
|
@ -207,24 +207,31 @@ impl PickerDelegate for SlashCommandDelegate {
|
||||||
.child(
|
.child(
|
||||||
h_flex()
|
h_flex()
|
||||||
.gap_1p5()
|
.gap_1p5()
|
||||||
.child(Icon::new(info.icon).size(IconSize::XSmall))
|
.child(
|
||||||
.child(div().font_buffer(cx).child({
|
Icon::new(info.icon)
|
||||||
|
.size(IconSize::XSmall)
|
||||||
|
.color(Color::Muted),
|
||||||
|
)
|
||||||
|
.child({
|
||||||
let mut label = format!("{}", info.name);
|
let mut label = format!("{}", info.name);
|
||||||
if let Some(args) = info.args.as_ref().filter(|_| selected)
|
if let Some(args) = info.args.as_ref().filter(|_| selected)
|
||||||
{
|
{
|
||||||
label.push_str(&args);
|
label.push_str(&args);
|
||||||
}
|
}
|
||||||
Label::new(label).single_line().size(LabelSize::Small)
|
Label::new(label)
|
||||||
}))
|
.single_line()
|
||||||
|
.size(LabelSize::Small)
|
||||||
|
.buffer_font(cx)
|
||||||
|
})
|
||||||
.children(info.args.clone().filter(|_| !selected).map(
|
.children(info.args.clone().filter(|_| !selected).map(
|
||||||
|args| {
|
|args| {
|
||||||
div()
|
div()
|
||||||
.font_buffer(cx)
|
|
||||||
.child(
|
.child(
|
||||||
Label::new(args)
|
Label::new(args)
|
||||||
.single_line()
|
.single_line()
|
||||||
.size(LabelSize::Small)
|
.size(LabelSize::Small)
|
||||||
.color(Color::Muted),
|
.color(Color::Muted)
|
||||||
|
.buffer_font(cx),
|
||||||
)
|
)
|
||||||
.visible_on_hover(format!(
|
.visible_on_hover(format!(
|
||||||
"command-entry-label-{ix}"
|
"command-entry-label-{ix}"
|
||||||
|
@ -294,10 +301,9 @@ where
|
||||||
.gap_1p5()
|
.gap_1p5()
|
||||||
.child(Icon::new(IconName::Plus).size(IconSize::XSmall))
|
.child(Icon::new(IconName::Plus).size(IconSize::XSmall))
|
||||||
.child(
|
.child(
|
||||||
div().font_buffer(cx).child(
|
|
||||||
Label::new("create-your-command")
|
Label::new("create-your-command")
|
||||||
.size(LabelSize::Small),
|
.size(LabelSize::Small)
|
||||||
),
|
.buffer_font(cx),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.child(
|
.child(
|
||||||
|
@ -341,7 +347,7 @@ where
|
||||||
.anchor(gpui::Corner::BottomLeft)
|
.anchor(gpui::Corner::BottomLeft)
|
||||||
.offset(gpui::Point {
|
.offset(gpui::Point {
|
||||||
x: px(0.0),
|
x: px(0.0),
|
||||||
y: px(-16.0),
|
y: px(-2.0),
|
||||||
})
|
})
|
||||||
.when_some(handle, |this, handle| this.with_handle(handle))
|
.when_some(handle, |this, handle| this.with_handle(handle))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue