Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
diagnostics: Close diagnosticsless buffers on refresh (#42503)
Lukas Wirth231d1b1d58f8
diff --git a/crates/diagnostics/src/diagnostics.rs b/crates/diagnostics/src/diagnostics.rsindex 2e729cbdf42..344ce652969 100644--- a/crates/diagnostics/src/diagnostics.rs+++ b/crates/diagnostics/src/diagnostics.rs@@ -182,7 +182,6 @@ impl ProjectDiagnosticsEditor {project::Event::DiskBasedDiagnosticsFinished { language_server_id } => {log::debug!("disk based diagnostics finished for server {language_server_id}");this.close_diagnosticless_buffers(- window,cx,this.editor.focus_handle(cx).contains_focused(window, cx)|| this.focus_handle.contains_focused(window, cx),@@ -247,10 +246,10 @@ impl ProjectDiagnosticsEditor {window.focus(&this.focus_handle);}}- EditorEvent::Blurred => this.close_diagnosticless_buffers(window, cx, false),- EditorEvent::Saved => this.close_diagnosticless_buffers(window, cx, true),+ EditorEvent::Blurred => this.close_diagnosticless_buffers(cx, false),+ EditorEvent::Saved => this.close_diagnosticless_buffers(cx, true),EditorEvent::SelectionsChanged { .. } => {- this.close_diagnosticless_buffers(window, cx, true)+ this.close_diagnosticless_buffers(cx, true)}_ => {}}@@ -298,12 +297,7 @@ impl ProjectDiagnosticsEditor {/// - have no diagnostics anymore/// - are saved (not dirty)/// - and, if `retain_selections` is true, do not have selections within them- fn close_diagnosticless_buffers(- &mut self,- _window: &mut Window,- cx: &mut Context<Self>,- retain_selections: bool,- ) {+ fn close_diagnosticless_buffers(&mut self, cx: &mut Context<Self>, retain_selections: bool) {let snapshot = self.editor.update(cx, |editor, cx| editor.display_snapshot(cx));@@ -447,7 +441,7 @@ impl ProjectDiagnosticsEditor {fn focus_out(&mut self, _: FocusOutEvent, window: &mut Window, cx: &mut Context<Self>) {if !self.focus_handle.is_focused(window) && !self.editor.focus_handle(cx).is_focused(window){- self.close_diagnosticless_buffers(window, cx, false);+ self.close_diagnosticless_buffers(cx, false);}}@@ -461,8 +455,7 @@ impl ProjectDiagnosticsEditor {});}});- self.multibuffer- .update(cx, |multibuffer, cx| multibuffer.clear(cx));+ self.close_diagnosticless_buffers(cx, false);self.project.update(cx, |project, cx| {self.paths_to_update = project.diagnostic_summaries(false, cx)