aboutsummaryrefslogtreecommitdiff
path: root/helix-term
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-06-22 04:47:57 +0000
committerBlaž Hrastnik2021-06-22 04:47:57 +0000
commit2f321b9335fe566a8e0af4f792d4c3b62d585ba5 (patch)
treeba4ed45e8b5f5c2cfc0ecafe72fb1ffed8257e7d /helix-term
parent6dddd5cd1d3598564a0495bfb866df6479896043 (diff)
lsp: Eagerly process notifications/server calls to avoid re-rendering
Diffstat (limited to 'helix-term')
-rw-r--r--helix-term/src/application.rs12
1 files changed, 7 insertions, 5 deletions
diff --git a/helix-term/src/application.rs b/helix-term/src/application.rs
index f06ccff2..7c954c1e 100644
--- a/helix-term/src/application.rs
+++ b/helix-term/src/application.rs
@@ -152,14 +152,19 @@ impl Application {
break;
}
- use futures_util::StreamExt;
+ use futures_util::{FutureExt, StreamExt};
tokio::select! {
event = reader.next() => {
self.handle_terminal_events(event)
}
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
+ while let Some(Some((id, call))) = self.editor.language_servers.incoming.next().now_or_never() {
+ self.handle_language_server_message(call, id).await;
+ }
+ self.render();
}
Some(callback) = &mut self.callbacks.next() => {
self.handle_language_server_callback(callback)
@@ -294,7 +299,6 @@ impl Application {
doc.set_diagnostics(diagnostics);
// TODO: we want to process all the events in queue, then render. publishDiagnostic tends to send a whole bunch of events
- self.render();
}
}
Notification::ShowMessage(params) => {
@@ -330,7 +334,6 @@ impl Application {
self.editor.clear_status();
// we want to render to clear any leftover spinners or messages
- self.render();
return;
}
}
@@ -378,7 +381,6 @@ impl Application {
if self.config.lsp.display_messages {
self.editor.set_status(status);
}
- self.render();
}
_ => unreachable!(),
}