Show file open error view instead of the modal (#36764)
Closes https://github.com/zed-industries/zed/issues/36672 Before: either <img width="966" height="642" alt="image" src="https://github.com/user-attachments/assets/7263ea3c-3d48-4f4d-be9e-16b24ca6f60b" /> (when opening from the project panel) or <img width="959" height="1019" alt="image" src="https://github.com/user-attachments/assets/834041d4-f4d6-46db-b333-803169ec4803" /> (for the rest of the cases) After: <img width="2032" height="1167" alt="Screenshot 2025-08-22 at 19 34 10" src="https://github.com/user-attachments/assets/1aa4530b-69f6-4c3a-8ea1-d4035dbb28da" /> (the unified error view) Release Notes: - Improved unsupported file opening in Zed --------- Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
This commit is contained in:
parent
eb0f9ddcdc
commit
42ae3301d0
11 changed files with 316 additions and 45 deletions
|
@ -1,6 +1,7 @@
|
|||
use crate::{
|
||||
CollaboratorId, DelayedDebouncedEditAction, FollowableViewRegistry, ItemNavHistory,
|
||||
SerializableItemRegistry, ToolbarItemLocation, ViewId, Workspace, WorkspaceId,
|
||||
invalid_buffer_view::InvalidBufferView,
|
||||
pane::{self, Pane},
|
||||
persistence::model::ItemId,
|
||||
searchable::SearchableItemHandle,
|
||||
|
@ -22,6 +23,7 @@ use std::{
|
|||
any::{Any, TypeId},
|
||||
cell::RefCell,
|
||||
ops::Range,
|
||||
path::PathBuf,
|
||||
rc::Rc,
|
||||
sync::Arc,
|
||||
time::Duration,
|
||||
|
@ -1161,6 +1163,22 @@ pub trait ProjectItem: Item {
|
|||
) -> Self
|
||||
where
|
||||
Self: Sized;
|
||||
|
||||
/// A fallback handler, which will be called after [`project::ProjectItem::try_open`] fails,
|
||||
/// with the error from that failure as an argument.
|
||||
/// Allows to open an item that can gracefully display and handle errors.
|
||||
fn for_broken_project_item(
|
||||
_abs_path: PathBuf,
|
||||
_is_local: bool,
|
||||
_e: &anyhow::Error,
|
||||
_window: &mut Window,
|
||||
_cx: &mut App,
|
||||
) -> Option<InvalidBufferView>
|
||||
where
|
||||
Self: Sized,
|
||||
{
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue