Skip to content

Commit

Permalink
ZED_WORKTREE_ROOT now always points to a workspace root directory
Browse files Browse the repository at this point in the history
  • Loading branch information
aborg-dev committed Jan 27, 2025
1 parent c66f611 commit f703e60
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions crates/project/src/task_inventory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -489,17 +489,17 @@ 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))
.and_then(|worktree_id| {
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(),
Expand Down

0 comments on commit f703e60

Please sign in to comment.