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

Before:


![before](https://github.com/zed-industries/zed/assets/45585937/1590586d-9d42-4d44-85fc-8e79499408b3)

After:


![after](https://github.com/zed-industries/zed/assets/45585937/c0fd1b2a-1ecf-4403-b74a-25c3c700f00d)

Release Notes:

- Update file icons during editing in project panel

---------

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
This commit is contained in:
d1y 2024-05-21 23:34:01 +08:00 committed by GitHub
parent 7b6f8c279d
commit 14436a75b1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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)