From 3825ce523e43a36e855c5fb8e45214d247dc67fc Mon Sep 17 00:00:00 2001 From: Bennet Fenner Date: Thu, 30 Oct 2025 17:03:12 +0100 Subject: [PATCH] agent_ui: Fix `agent: Chat with follow` not working (#41581) Release Notes: - Fixed an issue where `agent: Chat with follow` was not working anymore Co-authored-by: Ben Brandt --- crates/agent_ui/src/acp/message_editor.rs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/crates/agent_ui/src/acp/message_editor.rs b/crates/agent_ui/src/acp/message_editor.rs index 5fe591caca5b88b97351884593a8b1550d8a1d11..35bde2c84d5e9aa5d14ec92dc0579b9fcd849904 100644 --- a/crates/agent_ui/src/acp/message_editor.rs +++ b/crates/agent_ui/src/acp/message_editor.rs @@ -1,4 +1,5 @@ use crate::{ + ChatWithFollow, acp::completion_provider::{ContextPickerCompletionProvider, SlashCommandCompletion}, context_picker::{ContextPickerAction, fetch_context_picker::fetch_url_content}, }; @@ -49,7 +50,7 @@ use text::OffsetRangeExt; use theme::ThemeSettings; use ui::{ButtonLike, TintColor, Toggleable, prelude::*}; use util::{ResultExt, debug_panic, rel_path::RelPath}; -use workspace::{Workspace, notifications::NotifyResultExt as _}; +use workspace::{CollaboratorId, Workspace, notifications::NotifyResultExt as _}; use zed_actions::agent::Chat; pub struct MessageEditor { @@ -813,6 +814,21 @@ impl MessageEditor { self.send(cx); } + fn chat_with_follow( + &mut self, + _: &ChatWithFollow, + window: &mut Window, + cx: &mut Context, + ) { + self.workspace + .update(cx, |this, cx| { + this.follow(CollaboratorId::Agent, window, cx) + }) + .log_err(); + + self.send(cx); + } + fn cancel(&mut self, _: &editor::actions::Cancel, _: &mut Window, cx: &mut Context) { cx.emit(MessageEditorEvent::Cancel) } @@ -1276,6 +1292,7 @@ impl Render for MessageEditor { div() .key_context("MessageEditor") .on_action(cx.listener(Self::chat)) + .on_action(cx.listener(Self::chat_with_follow)) .on_action(cx.listener(Self::cancel)) .capture_action(cx.listener(Self::paste)) .flex_1()