Avoid panic when language server is dropped before being initialized in tests
Co-authored-by: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
parent
45b6a9df36
commit
3dee656490
3 changed files with 16 additions and 7 deletions
|
@ -289,10 +289,13 @@ impl LanguageRegistry {
|
|||
let servers_tx = servers_tx.clone();
|
||||
cx.background()
|
||||
.spawn(async move {
|
||||
fake_server
|
||||
.receive_notification::<lsp::notification::Initialized>()
|
||||
.await;
|
||||
servers_tx.unbounded_send(fake_server).ok();
|
||||
if fake_server
|
||||
.try_receive_notification::<lsp::notification::Initialized>()
|
||||
.await
|
||||
.is_some()
|
||||
{
|
||||
servers_tx.unbounded_send(fake_server).ok();
|
||||
}
|
||||
})
|
||||
.detach();
|
||||
Ok(server)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue