diff --git a/crates/project/src/task_inventory.rs b/crates/project/src/task_inventory.rs index 070a4d19aa..d67ad7f1ea 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(),