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.

Make the "View Panel" focus the assistant panel (#27504)

Richard Feldman82b0881dcbfa
diff --git a/crates/assistant2/src/active_thread.rs b/crates/assistant2/src/active_thread.rs
index 8e66ea40460..df8a709ed9d 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::<AssistantPanel>(
+ window, cx,
+ );
+ });
+ }
})
.log_err();
});