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:
parent
c9008fb8c1
commit
ec4c6744d6
7 changed files with 78 additions and 17 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue