From 8edee9b2a8680bc5db074e76eec7a400ca92caf1 Mon Sep 17 00:00:00 2001 From: Julia Date: Fri, 16 Sep 2022 16:48:43 -0400 Subject: [PATCH] Async-ify head text loading --- crates/project/src/worktree.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/crates/project/src/worktree.rs b/crates/project/src/worktree.rs index 2ff3e6fe04..79e2ed9da9 100644 --- a/crates/project/src/worktree.rs +++ b/crates/project/src/worktree.rs @@ -573,7 +573,13 @@ impl LocalWorktree { let fs = self.fs.clone(); cx.spawn(|this, mut cx| async move { let text = fs.load(&abs_path).await?; - let head_text = fs.load_head_text(&abs_path).await; + + let head_text = { + let fs = fs.clone(); + let abs_path = abs_path.clone(); + let task = async move { fs.load_head_text(&abs_path).await }; + cx.background().spawn(task).await + }; // Eagerly populate the snapshot with an updated entry for the loaded file let entry = this