diff options
author | Blaž Hrastnik | 2021-06-25 04:22:50 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2021-06-25 04:22:50 +0000 |
commit | f2d8ce3415fa2dcc6be283415c42219fd399adb2 (patch) | |
tree | bcddc71e83bf422a9a4848a16daf138c73c5afb8 /helix-term | |
parent | 503ca112ae57ebdf3ea323baf8940346204b46d2 (diff) |
Use a deadline when eagerly processing notifications
Diffstat (limited to 'helix-term')
-rw-r--r-- | helix-term/src/application.rs | 7 |
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(); } |