From 80d55fd3d82e26e78382d1575af5f679200c3010 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Thu, 7 Apr 2022 08:30:42 -0600 Subject: [PATCH] Don't starve UI thread when rapidly receiving LSP messages Co-Authored-By: Antonio Scandurra --- crates/lsp/src/lsp.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/crates/lsp/src/lsp.rs b/crates/lsp/src/lsp.rs index f5fc98640d..c0b21eeeda 100644 --- a/crates/lsp/src/lsp.rs +++ b/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()