Add basic ico support (#40822)

Closes https://github.com/zed-industries/zed/discussions/40763

<img width="867" height="1088" alt="Screenshot 2025-10-21 at 23 14 47"
src="https://github.com/user-attachments/assets/d691fb2a-afc6-4445-a335-054ef164e0d3"
/>

Also improves error handling on image open failure:

<img width="864" height="1083" alt="Screenshot 2025-10-21 at 23 14 30"
src="https://github.com/user-attachments/assets/d5388b61-995f-441b-b375-ad5136d1533b"
/>


Release Notes:

- Added basic ico support, improved unsupported image handling
This commit is contained in:
Kirill Bulatov
2025-10-22 12:07:32 +03:00
committed by GitHub
parent 8ceb2f2c61
commit bc0bace81f
13 changed files with 166 additions and 17 deletions
+16
View File
@@ -1,6 +1,8 @@
mod image_info;
mod image_viewer_settings;
use std::path::Path;
use anyhow::Context as _;
use editor::{EditorSettings, items::entry_git_aware_label_color};
use file_icons::FileIcons;
@@ -18,6 +20,7 @@ use ui::prelude::*;
use util::paths::PathExt;
use workspace::{
ItemId, ItemSettings, Pane, ToolbarItemLocation, Workspace, WorkspaceId, delete_unloaded_items,
invalid_item_view::InvalidItemView,
item::{BreadcrumbText, Item, ProjectItem, SerializableItem, TabContentParams},
};
@@ -389,6 +392,19 @@ impl ProjectItem for ImageView {
{
Self::new(item, project, window, cx)
}
fn for_broken_project_item(
abs_path: &Path,
is_local: bool,
e: &anyhow::Error,
window: &mut Window,
cx: &mut App,
) -> Option<InvalidItemView>
where
Self: Sized,
{
Some(InvalidItemView::new(abs_path, is_local, e, window, cx))
}
}
pub fn init(cx: &mut App) {