diff --git a/crates/client/src/client.rs b/crates/client/src/client.rs index 62d2c6fb31..59110f73c6 100644 --- a/crates/client/src/client.rs +++ b/crates/client/src/client.rs @@ -631,6 +631,9 @@ impl Client { } else { log::info!("unhandled message {}", type_name); } + + // Don't starve the main thread when receiving lots of messages at once. + smol::future::yield_now().await; } } }) diff --git a/crates/project/src/project.rs b/crates/project/src/project.rs index 430c6875d0..2f84f702be 100644 --- a/crates/project/src/project.rs +++ b/crates/project/src/project.rs @@ -1278,6 +1278,9 @@ impl Project { this.update(&mut cx, |this, cx| { this.on_lsp_event(server_id, event, &language, cx) }); + + // Don't starve the main thread when lots of events arrive all at once. + smol::future::yield_now().await; } Some(()) }