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.

Diagnostics small fixes (#28817)

Conrad Irwin5d3718df2d21
diff --git a/crates/diagnostics/src/diagnostics.rs b/crates/diagnostics/src/diagnostics.rs
index 4f43db0a5c8..a9618ce1e8c 100644
--- a/crates/diagnostics/src/diagnostics.rs
+++ b/crates/diagnostics/src/diagnostics.rs
@@ -209,6 +209,7 @@ impl ProjectDiagnosticsEditor {
.detach();
cx.observe_global_in::<IncludeWarnings>(window, |this, window, cx| {
this.include_warnings = cx.global::<IncludeWarnings>().0;
+ this.diagnostics.clear();
this.update_all_excerpts(window, cx);
})
.detach();
@@ -300,11 +301,8 @@ impl ProjectDiagnosticsEditor {
}
}
- fn toggle_warnings(&mut self, _: &ToggleWarnings, window: &mut Window, cx: &mut Context<Self>) {
- self.include_warnings = !self.include_warnings;
- cx.set_global(IncludeWarnings(self.include_warnings));
- self.update_all_excerpts(window, cx);
- cx.notify();
+ fn toggle_warnings(&mut self, _: &ToggleWarnings, _: &mut Window, cx: &mut Context<Self>) {
+ cx.set_global(IncludeWarnings(!self.include_warnings));
}
fn focus_in(&mut self, window: &mut Window, cx: &mut Context<Self>) {
@@ -482,7 +480,10 @@ impl ProjectDiagnosticsEditor {
editor.change_selections(Some(Autoscroll::fit()), window, cx, |s| {
s.select_anchor_ranges([range_to_select]);
})
- })
+ });
+ if this.focus_handle.is_focused(window) {
+ this.editor.read(cx).focus_handle(cx).focus(window);
+ }
}
}