Fix different kinds values used for worktree_id (#17523)

This commit is contained in:
Kirill Bulatov 2024-09-07 00:51:09 -04:00 committed by GitHub
parent 47aec5e64d
commit 8985fd87c2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 136 additions and 127 deletions

View file

@ -579,15 +579,16 @@ impl ContextProvider for BasicContextProvider {
if !selected_text.trim().is_empty() {
task_variables.insert(VariableName::SelectedText, selected_text);
}
let worktree_abs_path = buffer
.file()
.map(|file| WorktreeId::from_usize(file.worktree_id()))
.and_then(|worktree_id| {
self.project
.read(cx)
.worktree_for_id(worktree_id, cx)
.map(|worktree| worktree.read(cx).abs_path())
});
let worktree_abs_path =
buffer
.file()
.map(|file| file.worktree_id(cx))
.and_then(|worktree_id| {
self.project
.read(cx)
.worktree_for_id(worktree_id, cx)
.map(|worktree| worktree.read(cx).abs_path())
});
if let Some(worktree_path) = worktree_abs_path {
task_variables.insert(
VariableName::WorktreeRoot,