From 82b0881dcbfa81fd769ed892bda33fdc415ae7c6 Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Wed, 26 Mar 2025 11:26:49 -0400 Subject: [PATCH] Make the "View Panel" focus the assistant panel (#27504) Release Notes: - N/A --- crates/assistant2/src/active_thread.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/crates/assistant2/src/active_thread.rs b/crates/assistant2/src/active_thread.rs index 8e66ea404606ba5c6aaaf209c7f3f2aca7d547b1..df8a709ed9d0d80125b2d7a2500bd6cefe5c6e98 100644 --- a/crates/assistant2/src/active_thread.rs +++ b/crates/assistant2/src/active_thread.rs @@ -5,6 +5,7 @@ use crate::thread::{ use crate::thread_store::ThreadStore; use crate::tool_use::{PendingToolUseStatus, ToolUse, ToolUseStatus}; use crate::ui::{ContextPill, ToolReadyPopUp, ToolReadyPopupEvent}; +use crate::AssistantPanel; use assistant_settings::AssistantSettings; use collections::HashMap; @@ -550,11 +551,22 @@ impl ActiveThread { let handle = window.window_handle(); cx.activate(true); // Switch back to the Zed application + let workspace_handle = this.workspace.clone(); + // If there are multiple Zed windows, activate the correct one. cx.defer(move |cx| { handle .update(cx, |_view, window, _cx| { window.activate_window(); + + if let Some(workspace) = workspace_handle.upgrade() + { + workspace.update(_cx, |workspace, cx| { + workspace.focus_panel::( + window, cx, + ); + }); + } }) .log_err(); });