Skip to content

Commit ed6bf7f

Browse files
authored
diagnostics: Fix losing focus when activating from diagnostics view (#25517)
Closes #25509 Changes: - If active item is already diagnostics, don't try to focus it again. Instead of not focusing, should it just not activate instead? Something like: if !workspace .active_item(cx) .map(|item| item.item_id() == existing.item_id()) .unwrap_or(false) { workspace.activate_item(&existing, true, true, window, cx); } Release Notes: - N/A
1 parent f14d667 commit ed6bf7f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

crates/diagnostics/src/diagnostics.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,10 @@ impl ProjectDiagnosticsEditor {
311311
cx: &mut Context<Workspace>,
312312
) {
313313
if let Some(existing) = workspace.item_of_type::<ProjectDiagnosticsEditor>(cx) {
314-
workspace.activate_item(&existing, true, true, window, cx);
314+
let is_active = workspace
315+
.active_item(cx)
316+
.is_some_and(|item| item.item_id() == existing.item_id());
317+
workspace.activate_item(&existing, true, !is_active, window, cx);
315318
} else {
316319
let workspace_handle = cx.entity().downgrade();
317320

0 commit comments

Comments
 (0)