Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

editor: Fix flaky navigation test (#17087)

Thorsten Ball376828e92f6a
diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs
index 07fd3764320..ff866bf1174 100644
--- a/crates/editor/src/editor.rs
+++ b/crates/editor/src/editor.rs
@@ -9111,18 +9111,16 @@ impl Editor {
cx: &mut ViewContext<Self>,
) -> Task<Result<Navigated>> {
let definition = self.go_to_definition_of_kind(GotoDefinitionKind::Symbol, false, cx);
- let references = self.find_all_references(&FindAllReferences, cx);
- cx.background_executor().spawn(async move {
+ cx.spawn(|editor, mut cx| async move {
if definition.await? == Navigated::Yes {
return Ok(Navigated::Yes);
}
- if let Some(references) = references {
- if references.await? == Navigated::Yes {
- return Ok(Navigated::Yes);
- }
+ match editor.update(&mut cx, |editor, cx| {
+ editor.find_all_references(&FindAllReferences, cx)
+ })? {
+ Some(references) => references.await,
+ None => Ok(Navigated::No),
}
-
- Ok(Navigated::No)
})
}