From 040046ed2ac4b5051a9005f63d0aad6603bb9711 Mon Sep 17 00:00:00 2001 From: Conrad Irwin Date: Wed, 16 Apr 2025 13:49:40 -0600 Subject: [PATCH] Show all warnings (#28899) Release Notes: - (preview only) Fixes a bug where some warnings were not rendered correctly in the Diagnostics view --- crates/diagnostics/src/diagnostics.rs | 3 +-- crates/diagnostics/src/items.rs | 7 ++++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/crates/diagnostics/src/diagnostics.rs b/crates/diagnostics/src/diagnostics.rs index a9618ce1e8..bfe5ecbe63 100644 --- a/crates/diagnostics/src/diagnostics.rs +++ b/crates/diagnostics/src/diagnostics.rs @@ -46,7 +46,7 @@ use workspace::{ actions!(diagnostics, [Deploy, ToggleWarnings]); -struct IncludeWarnings(bool); +pub(crate) struct IncludeWarnings(bool); impl Global for IncludeWarnings {} pub fn init(cx: &mut App) { @@ -379,7 +379,6 @@ impl ProjectDiagnosticsEditor { Point::zero()..buffer_snapshot.max_point(), false, ) - .filter(|d| !(d.diagnostic.is_primary && d.diagnostic.is_unnecessary)) .collect::>(); let unchanged = this.update(cx, |this, _| { if this.diagnostics.get(&buffer_id).is_some_and(|existing| { diff --git a/crates/diagnostics/src/items.rs b/crates/diagnostics/src/items.rs index 781e20fb64..adf2c8e300 100644 --- a/crates/diagnostics/src/items.rs +++ b/crates/diagnostics/src/items.rs @@ -9,7 +9,7 @@ use language::Diagnostic; use ui::{Button, ButtonLike, Color, Icon, IconName, Label, Tooltip, h_flex, prelude::*}; use workspace::{StatusItemView, ToolbarItemEvent, Workspace, item::ItemHandle}; -use crate::{Deploy, ProjectDiagnosticsEditor}; +use crate::{Deploy, IncludeWarnings, ProjectDiagnosticsEditor}; pub struct DiagnosticIndicator { summary: project::DiagnosticSummary, @@ -94,6 +94,11 @@ impl Render for DiagnosticIndicator { }) .on_click(cx.listener(|this, _, window, cx| { if let Some(workspace) = this.workspace.upgrade() { + if this.summary.error_count == 0 && this.summary.warning_count > 0 { + cx.update_global(|show_warnings: &mut IncludeWarnings, _| { + show_warnings.0 = true + }); + } workspace.update(cx, |workspace, cx| { ProjectDiagnosticsEditor::deploy( workspace,