Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
agent_ui: Fix `agent: Chat with follow` not working (#41581)
Bennet Fenner3825ce523e43
diff --git a/crates/agent_ui/src/acp/message_editor.rs b/crates/agent_ui/src/acp/message_editor.rsindex 5fe591caca5..35bde2c84d5 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>,+ ) {+ 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<Self>) {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()