ZIm/crates/zed/src
Max Brunsfeld c24c4063e3 Make LspAdapter::process_diagnostics synchronous (#2829)
When editing rust code, the project diagnostics view sometimes fails to
update, so that you have to close the view and re-open it to see the
correct state.

This PR fixes one possible cause of that problem. There was an async
step in between *receiving* diagnostics from the language server and
updating the diagnostics, due to an async call to
`LspAdapter::process_diagnostics`. This could cause the following
sequence of events to happen:

1. Rust-analyzer sends us new diagnostics for a file `a.rs`
2. We call `process_diagnostics` with those diagnostics
3. Rust-analyzer sends us a `WorkDoneProgress` message, indicating that
the "flycheck" (aka `cargo check`) process has completed
4. We update the project diagnostics view due to this message.
5. The `process_diagnostics` call for `a.rs` completes
6. 💥 We have the new diagnostics for `a.rs`, but do not update the
project diagnostics view again.

This PR fixes this bug by simply making `process_diagnostics`
synchronous. There is no I/O or expensive computation happening in that
method. If we need to make it asynchronous in the future, we need to
introduce a queue that ensures that `publishDiagnostics` and
`workDoneProgress` messages are processed serially.

Release Notes:

- Fixed a bug where the project diagnostics view would sometimes fail to
update properly when using Rust-analyzer.
2023-08-08 12:34:28 -07:00
..
languages Make LspAdapter::process_diagnostics synchronous (#2829) 2023-08-08 12:34:28 -07:00
assets.rs Add basic sound handling infrastructure 2023-06-30 16:10:49 -07:00
languages.rs Add tree-sitter-glsl 2023-07-23 22:22:11 -07:00
main.rs catchup with main 2023-07-26 09:50:38 -04:00
menus.rs Add key binding to close all docks 2023-07-21 02:44:44 -04:00
only_instance.rs Avoid checking for duplicate instance when local DB is disabled 2023-07-07 14:20:39 -04:00
test.rs Remove AppState from workspace actions 2022-05-19 14:37:26 -07:00
zed.rs Avoid panic by accessing view handle by global in wrong window 2023-07-27 16:32:20 -07:00