diff --git a/crates/diagnostics/src/diagnostics.rs b/crates/diagnostics/src/diagnostics.rs index 3b495b414cc6f1ef7add654cee369e9780eccaf9..2aa062af91d41023ac25a2c29857bd1c2f06d219 100644 --- a/crates/diagnostics/src/diagnostics.rs +++ b/crates/diagnostics/src/diagnostics.rs @@ -389,8 +389,14 @@ impl ProjectDiagnosticsEditor { self.path_states.remove(path_ix); } - if self.editor.is_focused(cx) && self.path_states.is_empty() { - cx.focus_self(); + if self.path_states.is_empty() { + if self.editor.is_focused(cx) { + cx.focus_self(); + } + } else { + if cx.handle().is_focused(cx) { + cx.focus(&self.editor); + } } cx.notify(); }