aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-06-25 04:22:50 +0000
committerBlaž Hrastnik2021-06-25 04:22:50 +0000
commitf2d8ce3415fa2dcc6be283415c42219fd399adb2 (patch)
treebcddc71e83bf422a9a4848a16daf138c73c5afb8
parent503ca112ae57ebdf3ea323baf8940346204b46d2 (diff)
Use a deadline when eagerly processing notifications
-rw-r--r--helix-term/src/application.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/helix-term/src/application.rs b/helix-term/src/application.rs
index f33a5831..aea0d89f 100644
--- a/helix-term/src/application.rs
+++ b/helix-term/src/application.rs
@@ -159,9 +159,16 @@ impl Application {
}
Some((id, call)) = self.editor.language_servers.incoming.next() => {
self.handle_language_server_message(call, id).await;
+
// 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() {
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();
}