editor: Fix flaky navigation test (#17087)
This test was flaky because both tasks were started at the same time and the first one that would win, would navigate the editor. Now the order is fixed, because the second task is only spawned after the first one. Release Notes: - N/A --------- Co-authored-by: Kirill <kirill@zed.dev>
This commit is contained in:
parent
70018a167a
commit
376828e92f
1 changed files with 6 additions and 8 deletions
|
@ -9111,18 +9111,16 @@ impl Editor {
|
||||||
cx: &mut ViewContext<Self>,
|
cx: &mut ViewContext<Self>,
|
||||||
) -> Task<Result<Navigated>> {
|
) -> Task<Result<Navigated>> {
|
||||||
let definition = self.go_to_definition_of_kind(GotoDefinitionKind::Symbol, false, cx);
|
let definition = self.go_to_definition_of_kind(GotoDefinitionKind::Symbol, false, cx);
|
||||||
let references = self.find_all_references(&FindAllReferences, cx);
|
cx.spawn(|editor, mut cx| async move {
|
||||||
cx.background_executor().spawn(async move {
|
|
||||||
if definition.await? == Navigated::Yes {
|
if definition.await? == Navigated::Yes {
|
||||||
return Ok(Navigated::Yes);
|
return Ok(Navigated::Yes);
|
||||||
}
|
}
|
||||||
if let Some(references) = references {
|
match editor.update(&mut cx, |editor, cx| {
|
||||||
if references.await? == Navigated::Yes {
|
editor.find_all_references(&FindAllReferences, cx)
|
||||||
return Ok(Navigated::Yes);
|
})? {
|
||||||
}
|
Some(references) => references.await,
|
||||||
|
None => Ok(Navigated::No),
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(Navigated::No)
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue