Don't starve UI thread when rapidly receiving LSP messages

Nathan Sobo and Antonio Scandurra created

Co-Authored-By: Antonio Scandurra <me@as-cii.com>

Change summary

crates/lsp/src/lsp.rs | 3 +++
1 file changed, 3 insertions(+)

Detailed changes

crates/lsp/src/lsp.rs 🔗

@@ -201,6 +201,9 @@ impl LanguageServer {
                             std::str::from_utf8(&buffer)?
                         ));
                     }
+
+                    // Don't starve the main thread when receiving lots of messages at once.
+                    smol::future::yield_now().await;
                 }
             }
             .log_err()