Remove summaries that don't contain any errors or warnings

When opening a buffer, some language servers might start reporting
diagnostics. When closing a buffer, they might report that no diagnostics
are present for that buffer. Previously, we would keep an empty summary entry
which would cause us to open a buffer in the project diagnostics view, only to
drop it because it contained no diagnostics. However, the act of opening it
caused the language server to asynchronously report non-empty diagnostics.
We would therefore handle this as an update, but the previous closing of the
buffer would cause the language server to report empty diagnostics again. This
would cause the project diagnostics view to thrash infinitely between these two
states, pegging the CPU and constantly refreshing the UI.

With this commit we won't maintain empty summary entries for files that contain
no diagnostics, which fixes the above issue.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Antonio Scandurra 2022-04-19 15:30:46 +02:00
parent 1cd23df4d8
commit ef784cf21e
5 changed files with 43 additions and 29 deletions

View file

@ -453,8 +453,6 @@ message DiagnosticSummary {
string path = 1;
uint32 error_count = 2;
uint32 warning_count = 3;
uint32 info_count = 4;
uint32 hint_count = 5;
}
message UpdateLanguageServer {