assistant2: Show file icons for context entries (#22928)

https://github.com/user-attachments/assets/d3d6f5f1-23ec-449b-a762-9869b9d4b5a5


Release Notes:

- N/A

---------

Co-authored-by: Nathan <nathan@zed.dev>
Co-authored-by: Michael <michael@zed.dev>
This commit is contained in:
Agus Zubiaga 2025-01-10 00:01:42 -03:00 committed by GitHub
parent c9008fb8c1
commit ec4c6744d6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 78 additions and 17 deletions

View file

@ -2,6 +2,7 @@ use std::path::Path;
use std::sync::atomic::AtomicBool;
use std::sync::Arc;
use file_icons::FileIcons;
use fuzzy::PathMatch;
use gpui::{AppContext, DismissEvent, FocusHandle, FocusableView, Task, View, WeakModel, WeakView};
use picker::{Picker, PickerDelegate};
@ -281,6 +282,10 @@ impl PickerDelegate for FileContextPickerDelegate {
.will_include_file_path(&path_match.path, cx)
});
let file_icon = FileIcons::get_icon(&path_match.path.clone(), cx)
.map(Icon::from_path)
.unwrap_or_else(|| Icon::new(IconName::File));
Some(
ListItem::new(ix)
.inset(true)
@ -288,6 +293,7 @@ impl PickerDelegate for FileContextPickerDelegate {
.child(
h_flex()
.gap_2()
.child(file_icon.size(IconSize::Small))
.child(Label::new(file_name))
.children(directory.map(|directory| {
Label::new(directory)