From f1921c8df543153881fabfadff1d76c158ca886c Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Wed, 23 Feb 2022 18:22:51 -0800 Subject: [PATCH] Open buffers from definitions request in random collab test Don't try to open buffers from the weak worktrees directly, as this is expected to fail if the host drops the buffer for that worktree. --- crates/server/src/rpc.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/crates/server/src/rpc.rs b/crates/server/src/rpc.rs index 39d43e7ea7..593ad32bcd 100644 --- a/crates/server/src/rpc.rs +++ b/crates/server/src/rpc.rs @@ -4880,7 +4880,8 @@ mod tests { project .worktrees(&cx) .filter(|worktree| { - worktree.read(cx).entries(false).any(|e| e.is_file()) + let worktree = worktree.read(cx); + !worktree.is_weak() && worktree.entries(false).any(|e| e.is_file()) }) .choose(&mut *rng.lock()) }) { @@ -5033,13 +5034,14 @@ mod tests { project.definition(&buffer, offset, cx) }); let definitions = cx.background().spawn(async move { - definitions.await.expect("definitions request failed"); + definitions.await.expect("definitions request failed") }); if rng.lock().gen_bool(0.3) { log::info!("Guest {}: detaching definitions request", guest_id); definitions.detach(); } else { - definitions.await; + self.buffers + .extend(definitions.await.into_iter().map(|loc| loc.buffer)); } } 50..=55 => {