project panel: Update file icon when editing filename (#12078)
d1y
and
Kirill Bulatov
created
Before:

After:

Release Notes:
- Update file icons during editing in project panel
---------
Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
Change summary
crates/project_panel/src/project_panel.rs | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
Detailed changes
@@ -1685,7 +1685,13 @@ impl ProjectPanel {
let filename_text_color =
entry_git_aware_label_color(details.git_status, details.is_ignored, is_selected);
let file_name = details.filename.clone();
- let icon = details.icon.clone();
+ let mut icon = details.icon.clone();
+ if show_editor && details.kind.is_file() {
+ let filename = self.filename_editor.read(cx).text(cx);
+ if filename.len() > 2 {
+ icon = FileIcons::get_icon(Path::new(&filename), cx);
+ }
+ }
let depth = details.depth;
div()
.id(entry_id.to_proto() as usize)