Use a deadline when eagerly processing notifications
This commit is contained in:
parent
503ca112ae
commit
f2d8ce3415
1 changed files with 7 additions and 0 deletions
|
@ -159,9 +159,16 @@ impl Application {
|
||||||
}
|
}
|
||||||
Some((id, call)) = self.editor.language_servers.incoming.next() => {
|
Some((id, call)) = self.editor.language_servers.incoming.next() => {
|
||||||
self.handle_language_server_message(call, id).await;
|
self.handle_language_server_message(call, id).await;
|
||||||
|
|
||||||
// eagerly process any other available notifications/calls
|
// eagerly process any other available notifications/calls
|
||||||
|
let now = std::time::Instant::now();
|
||||||
|
let deadline = std::time::Duration::from_millis(10);
|
||||||
while let Some(Some((id, call))) = self.editor.language_servers.incoming.next().now_or_never() {
|
while let Some(Some((id, call))) = self.editor.language_servers.incoming.next().now_or_never() {
|
||||||
self.handle_language_server_message(call, id).await;
|
self.handle_language_server_message(call, id).await;
|
||||||
|
|
||||||
|
if now.elapsed() > deadline { // use a deadline so we don't block too long
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
self.render();
|
self.render();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue