zed/crates/project
Antonio Scandurra 8ef6b1d8a9 Don't emit event when LSP reports consecutive empty diagnostics
This is related to #849: in that pull request we avoided *storing*
empty diagnostics, but we'd still report an event when receiving
consecutive empty diagnostics. So if the project diagnostics editor
was open, it could happen that opening a buffer would cause the
language server to report zero diagnostics. We would therefore close
the buffer because there were no diagnostics, but doing so would cause
the LSP to report another event with zero diagnostics. This would repeat
forever, causing Zed to use a lot of CPU and the UI not to refresh properly.

With this commit we will simply avoid emitting a `DiagnosticsUpdated` event
altogether if no diagnostics were present before *and* the LSP is reporting
a `PublishDiagnostics` event with no diagnostics in it.
2022-04-20 15:02:38 +02:00
..
src Don't emit event when LSP reports consecutive empty diagnostics 2022-04-20 15:02:38 +02:00
Cargo.toml