Introduce a WorktreeId struct, fix incorrect use of remote worktrees' handle id

This commit is contained in:
Max Brunsfeld 2022-01-03 19:03:48 -08:00 committed by Antonio Scandurra
parent 7f8e76e0f1
commit a4027aacb5
6 changed files with 112 additions and 68 deletions

View file

@ -619,10 +619,10 @@ impl Workspace {
cx: &mut ViewContext<Self>,
) -> Task<Result<ProjectPath>> {
let entry = self.worktree_for_abs_path(abs_path, cx);
cx.spawn(|_, _| async move {
cx.spawn(|_, cx| async move {
let (worktree, path) = entry.await?;
Ok(ProjectPath {
worktree_id: worktree.id(),
worktree_id: worktree.read_with(&cx, |t, _| t.id()),
path: path.into(),
})
})
@ -1264,7 +1264,7 @@ impl WorkspaceHandle for ViewHandle<Workspace> {
.worktrees(cx)
.iter()
.flat_map(|worktree| {
let worktree_id = worktree.id();
let worktree_id = worktree.read(cx).id();
worktree.read(cx).files(true, 0).map(move |f| ProjectPath {
worktree_id,
path: f.path.clone(),