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.

project panel: Update file icon when editing filename (#12078)

d1y14436a75b10d
diff --git a/crates/project_panel/src/project_panel.rs b/crates/project_panel/src/project_panel.rs
index 541a3ea8d8b..24fbee34f46 100644
--- a/crates/project_panel/src/project_panel.rs
+++ b/crates/project_panel/src/project_panel.rs
@@ -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)