assistant2: Add check icon for included context (#22774)

Quick follow-up to: https://github.com/zed-industries/zed/pull/22712 —
just to make it more visually easier to understand.

<img width="800" alt="Screenshot 2025-01-07 at 11 48 06 AM"
src="https://github.com/user-attachments/assets/92f0523b-eb85-4929-a825-2e1e524b3ad7"
/>

Release Notes:

- N/A
This commit is contained in:
Danilo Leal 2025-01-07 13:03:05 -03:00 committed by GitHub
parent 44c492b3c0
commit f439ee0d55
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 51 additions and 10 deletions

View file

@ -322,14 +322,30 @@ impl PickerDelegate for FileContextPickerDelegate {
})),
)
.when_some(added, |el, added| match added {
IncludedFile::Direct(_) => {
el.end_slot(Label::new("Added").size(LabelSize::XSmall))
}
IncludedFile::Direct(_) => el.end_slot(
h_flex()
.gap_1()
.child(
Icon::new(IconName::Check)
.size(IconSize::Small)
.color(Color::Success),
)
.child(Label::new("Added").size(LabelSize::Small)),
),
IncludedFile::InDirectory(dir_name) => {
let dir_name = dir_name.to_string_lossy().into_owned();
el.end_slot(Label::new("Included").size(LabelSize::XSmall))
.tooltip(move |cx| Tooltip::text(format!("in {dir_name}"), cx))
el.end_slot(
h_flex()
.gap_1()
.child(
Icon::new(IconName::Check)
.size(IconSize::Small)
.color(Color::Success),
)
.child(Label::new("Included").size(LabelSize::Small)),
)
.tooltip(move |cx| Tooltip::text(format!("in {dir_name}"), cx))
}
}),
)