Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Make ZED_WORKTREE_ROOT always point to a directory or is not set (#23150)
Andrew Borg (Kashin)9f3dbd6fa347
diff --git a/crates/project/src/task_inventory.rs b/crates/project/src/task_inventory.rsindex 070a4d19aa4..d67ad7f1eaf 100644--- a/crates/project/src/task_inventory.rs+++ b/crates/project/src/task_inventory.rs@@ -489,7 +489,7 @@ impl ContextProvider for BasicContextProvider {if !selected_text.trim().is_empty() {task_variables.insert(VariableName::SelectedText, selected_text);}- let worktree_abs_path =+ let worktree_root_dir =buffer.file().map(|file| file.worktree_id(cx))@@ -497,9 +497,9 @@ impl ContextProvider for BasicContextProvider {self.worktree_store.read(cx).worktree_for_id(worktree_id, cx)- .map(|worktree| worktree.read(cx).abs_path())+ .map(|worktree| worktree.read(cx).root_dir())});- if let Some(worktree_path) = worktree_abs_path {+ if let Some(Some(worktree_path)) = worktree_root_dir {task_variables.insert(VariableName::WorktreeRoot,worktree_path.to_string_lossy().to_string(),