zed/crates/zed
Max Brunsfeld 7ae5ee699f
Debounce code action and document highlight requests (#2905)
Lately, I've been finding Rust-analyzer unusably slow when editing large
files (like `editor_tests.rs`, or `integration_tests.rs`). When I
profile the Rust-analyzer process, I see that it sometimes saturates up
to 10 cores processing a queue of code actions requests.

Additionally, sometimes when collaborating on large files like these, we
see long delays in propagating buffer operations. I'm still not sure why
this is happening, but whenever I look at the server logs in Datadog, I
see that there are remote `CodeActions` and `DocumentHighlights`
messages being processed that take upwards of 30 seconds. I think what
may be happening is that many such requests are resolving at once, and
the responses are taking up too much of the host's bandwidth.

I think that both of these problems are caused by us sending way too
many code action and document highlight requests to rust-analyzer. This
PR adds a simple debounce between changing selections and making these
requests.

From my local testing, this debounce makes Rust-analyzer *much* more
responsive when moving the cursor around a large file like
`editor_tests.rs`.
2023-08-29 09:30:36 -07:00
..
resources Remove potential osascript hijacking 2023-08-18 17:40:08 -07:00
src Debounce code action and document highlight requests (#2905) 2023-08-29 09:30:36 -07:00
build.rs Eliminate assets crate 2023-06-06 11:46:46 -07:00
Cargo.toml Add feature flags handling to the client, rewrite staff mode to a trait extension style 2023-08-25 17:00:53 -07:00
RELEASE_CHANNEL Store current release channel name in a file in the zed crate 2022-10-26 16:19:19 -07:00