Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Show an underlying reason on file opening (#44664)
Kirill Bulatov717d898692f3
diff --git a/crates/project/src/buffer_store.rs b/crates/project/src/buffer_store.rsindex c38b898f5d7..aea2482c83e 100644--- a/crates/project/src/buffer_store.rs+++ b/crates/project/src/buffer_store.rs@@ -24,7 +24,7 @@ use rpc::{use std::{io, sync::Arc, time::Instant};use text::{BufferId, ReplicaId};-use util::{ResultExt as _, TryFutureExt, debug_panic, maybe, paths::PathStyle, rel_path::RelPath};+use util::{ResultExt as _, TryFutureExt, debug_panic, maybe, rel_path::RelPath};use worktree::{File, PathChange, ProjectEntryId, Worktree, WorktreeId};/// A set of open buffers.@@ -620,21 +620,7 @@ impl LocalBufferStore {let load_file = worktree.update(cx, |worktree, cx| worktree.load_file(path.as_ref(), cx));cx.spawn(async move |this, cx| {let path = path.clone();- let single_file_path = cx.update(|cx| {- if worktree.read(cx).is_single_file() {- Some(worktree.read(cx).abs_path())- } else {- None- }- })?;- let path_string = single_file_path- .as_ref()- .map(|path| path.to_string_lossy())- .unwrap_or_else(|| path.display(PathStyle::local()));- let buffer = match load_file- .await- .with_context(|| format!("Opening path \"{path_string}\""))- {+ let buffer = match load_file.await {Ok(loaded) => {let reservation = cx.reserve_entity::<Buffer>()?;let buffer_id = BufferId::from(reservation.entity_id().as_non_zero_u64());diff --git a/crates/worktree/src/worktree.rs b/crates/worktree/src/worktree.rsindex ca7fda9d716..d6e75e20fc4 100644--- a/crates/worktree/src/worktree.rs+++ b/crates/worktree/src/worktree.rs@@ -97,6 +97,7 @@ pub enum CreatedEntry {Excluded { abs_path: PathBuf },}+#[derive(Debug)]pub struct LoadedFile {pub file: Arc<File>,pub text: String,