Skip to content

Commit

Permalink
Merge pull request #765 from zed-industries/yield-lsp
Browse files Browse the repository at this point in the history
Don't starve UI thread when rapidly receiving LSP messages
  • Loading branch information
as-cii authored Apr 7, 2022
2 parents 7a151ff + 80d55fd commit 0b8eed6
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions crates/lsp/src/lsp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 0b8eed6

Please sign in to comment.