Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

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

Danilo Lealf439ee0d55c1
diff --git a/crates/assistant2/src/context_picker/directory_context_picker.rs b/crates/assistant2/src/context_picker/directory_context_picker.rs
index b37a7f38eb7..29d07c2e694 100644
--- a/crates/assistant2/src/context_picker/directory_context_picker.rs
+++ b/crates/assistant2/src/context_picker/directory_context_picker.rs
@@ -304,7 +304,16 @@ impl PickerDelegate for DirectoryContextPickerDelegate {
.toggle_state(selected)
.child(h_flex().gap_2().child(Label::new(directory_name)))
.when(added, |el| {
- el.end_slot(Label::new("Added").size(LabelSize::XSmall))
+ 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)),
+ )
}),
)
}
diff --git a/crates/assistant2/src/context_picker/fetch_context_picker.rs b/crates/assistant2/src/context_picker/fetch_context_picker.rs
index 5bdb02ba6b1..24bee6ea2f1 100644
--- a/crates/assistant2/src/context_picker/fetch_context_picker.rs
+++ b/crates/assistant2/src/context_picker/fetch_context_picker.rs
@@ -243,9 +243,16 @@ impl PickerDelegate for FetchContextPickerDelegate {
.toggle_state(selected)
.child(Label::new(self.url.clone()))
.when(added, |child| {
- child
- .disabled(true)
- .end_slot(Label::new("Added").size(LabelSize::XSmall))
+ child.disabled(true).end_slot(
+ h_flex()
+ .gap_1()
+ .child(
+ Icon::new(IconName::Check)
+ .size(IconSize::Small)
+ .color(Color::Success),
+ )
+ .child(Label::new("Added").size(LabelSize::Small)),
+ )
}),
)
}
diff --git a/crates/assistant2/src/context_picker/file_context_picker.rs b/crates/assistant2/src/context_picker/file_context_picker.rs
index 741515b3c89..5e132468d0a 100644
--- a/crates/assistant2/src/context_picker/file_context_picker.rs
+++ b/crates/assistant2/src/context_picker/file_context_picker.rs
@@ -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))
}
}),
)
diff --git a/crates/assistant2/src/context_picker/thread_context_picker.rs b/crates/assistant2/src/context_picker/thread_context_picker.rs
index 1fedafc0a8c..1d86e6612da 100644
--- a/crates/assistant2/src/context_picker/thread_context_picker.rs
+++ b/crates/assistant2/src/context_picker/thread_context_picker.rs
@@ -209,7 +209,16 @@ impl PickerDelegate for ThreadContextPickerDelegate {
.toggle_state(selected)
.child(Label::new(thread.summary.clone()))
.when(added, |el| {
- el.end_slot(Label::new("Added").size(LabelSize::XSmall))
+ 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)),
+ )
}),
)
}