Fix diagnostics randomized tests (#21775)

These were silently passing after the delay in updating diagnostics was
added.

Co-Authored-By: Max <max@zed.dev>

cc @someonetoignore

Release Notes:

- N/A

---------

Co-authored-by: Max <max@zed.dev>
This commit is contained in:
Conrad Irwin 2024-12-09 21:56:43 -07:00 committed by GitHub
parent 8a85d6ef96
commit a35ef5b79f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 66 additions and 61 deletions

View file

@ -1013,7 +1013,7 @@ impl LspStore {
) {
match event {
BufferStoreEvent::BufferAdded(buffer) => {
self.register_buffer(buffer, cx).log_err();
self.on_buffer_added(buffer, cx).log_err();
}
BufferStoreEvent::BufferChangedFilePath { buffer, old_file } => {
if let Some(old_file) = File::from_dyn(old_file.as_ref()) {
@ -1120,7 +1120,7 @@ impl LspStore {
}
}
fn register_buffer(
fn on_buffer_added(
&mut self,
buffer: &Model<Buffer>,
cx: &mut ModelContext<Self>,
@ -2913,6 +2913,15 @@ impl LspStore {
}
}
pub fn diagnostic_summary(&self, include_ignored: bool, cx: &AppContext) -> DiagnosticSummary {
let mut summary = DiagnosticSummary::default();
for (_, _, path_summary) in self.diagnostic_summaries(include_ignored, cx) {
summary.error_count += path_summary.error_count;
summary.warning_count += path_summary.warning_count;
}
summary
}
pub fn diagnostic_summaries<'a>(
&'a self,
include_ignored: bool,