Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Fix panic when diagnostics first opens (#28935)

Conrad Irwinad25cd09b6e2
diff --git a/crates/diagnostics/src/diagnostics.rs b/crates/diagnostics/src/diagnostics.rs
index bfe5ecbe63a..fc4dcba3c3f 100644
--- a/crates/diagnostics/src/diagnostics.rs
+++ b/crates/diagnostics/src/diagnostics.rs
@@ -46,6 +46,7 @@ use workspace::{
actions!(diagnostics, [Deploy, ToggleWarnings]);
+#[derive(Default)]
pub(crate) struct IncludeWarnings(bool);
impl Global for IncludeWarnings {}
diff --git a/crates/diagnostics/src/items.rs b/crates/diagnostics/src/items.rs
index adf2c8e300d..26a6c75357c 100644
--- a/crates/diagnostics/src/items.rs
+++ b/crates/diagnostics/src/items.rs
@@ -95,9 +95,9 @@ 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
- });
+ cx.update_default_global(
+ |show_warnings: &mut IncludeWarnings, _| show_warnings.0 = true,
+ );
}
workspace.update(cx, |workspace, cx| {
ProjectDiagnosticsEditor::deploy(