Exclude gitignored files' diagnostics from project panel and its indicator.

The diagnostics are collected and available still, since that might become a settings/UI toggle later.
Also, buffer diagnostics are still updated for gitignored files.
This commit is contained in:
Kirill Bulatov 2023-11-30 15:38:54 +02:00
parent 7b76db4b50
commit 69bfd47cf9
5 changed files with 118 additions and 29 deletions

View file

@ -126,7 +126,7 @@ impl View for ProjectDiagnosticsEditor {
json!({
"project": json!({
"language_servers": project.language_server_statuses().collect::<Vec<_>>(),
"summary": project.diagnostic_summary(cx),
"summary": project.diagnostic_summary(false, cx),
}),
"summary": self.summary,
"paths_to_update": self.paths_to_update.iter().map(|(server_id, paths)|
@ -195,7 +195,7 @@ impl ProjectDiagnosticsEditor {
});
let project = project_handle.read(cx);
let summary = project.diagnostic_summary(cx);
let summary = project.diagnostic_summary(false, cx);
let mut this = Self {
project: project_handle,
summary,
@ -241,7 +241,7 @@ impl ProjectDiagnosticsEditor {
let mut new_summaries: HashMap<LanguageServerId, HashSet<ProjectPath>> = self
.project
.read(cx)
.diagnostic_summaries(cx)
.diagnostic_summaries(false, cx)
.fold(HashMap::default(), |mut summaries, (path, server_id, _)| {
summaries.entry(server_id).or_default().insert(path);
summaries
@ -320,7 +320,7 @@ impl ProjectDiagnosticsEditor {
.context("rechecking diagnostics for paths")?;
this.update(&mut cx, |this, cx| {
this.summary = this.project.read(cx).diagnostic_summary(cx);
this.summary = this.project.read(cx).diagnostic_summary(false, cx);
cx.emit(Event::TitleChanged);
})?;
anyhow::Ok(())

View file

@ -34,19 +34,19 @@ impl DiagnosticIndicator {
}
project::Event::DiskBasedDiagnosticsFinished { language_server_id }
| project::Event::LanguageServerRemoved(language_server_id) => {
this.summary = project.read(cx).diagnostic_summary(cx);
this.summary = project.read(cx).diagnostic_summary(false, cx);
this.in_progress_checks.remove(language_server_id);
cx.notify();
}
project::Event::DiagnosticsUpdated { .. } => {
this.summary = project.read(cx).diagnostic_summary(cx);
this.summary = project.read(cx).diagnostic_summary(false, cx);
cx.notify();
}
_ => {}
})
.detach();
Self {
summary: project.read(cx).diagnostic_summary(cx),
summary: project.read(cx).diagnostic_summary(false, cx),
in_progress_checks: project
.read(cx)
.language_servers_running_disk_based_diagnostics()