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.

editor: Show file icon in breadcrumbs when tab bar is hidden (#56267)

Aleksei Gusev6e129aa5df66
diff --git a/crates/editor/src/items.rs b/crates/editor/src/items.rs
index 8704cff66ba..f61546e289a 100644
--- a/crates/editor/src/items.rs
+++ b/crates/editor/src/items.rs
@@ -53,7 +53,7 @@ use workspace::{
},
};
use workspace::{
- Pane, WorkspaceSettings,
+ Pane, TabBarSettings, WorkspaceSettings,
item::{FollowEvent, ProjectItemKind},
searchable::SearchOptions,
};
@@ -1064,6 +1064,20 @@ impl Item for Editor {
}
}
+ fn breadcrumb_prefix(
+ &self,
+ _window: &mut Window,
+ cx: &mut Context<Self>,
+ ) -> Option<gpui::AnyElement> {
+ (!TabBarSettings::get_global(cx).show && ItemSettings::get_global(cx).file_icons)
+ .then(|| {
+ path_for_buffer(&self.buffer, 0, true, cx)
+ .and_then(|path| FileIcons::get_icon(Path::new(&*path), cx))
+ })
+ .flatten()
+ .map(|icon_path| Icon::from_path(icon_path).into_any_element())
+ }
+
fn added_to_workspace(
&mut self,
workspace: &mut Workspace,