diff --git a/assets/keymaps/default-linux.json b/assets/keymaps/default-linux.json index f5bdb372bbf6c43ced788710a590a22e8bbecfd4..0e88b9e26fb306c25e556ede572fb688214cdf3e 100644 --- a/assets/keymaps/default-linux.json +++ b/assets/keymaps/default-linux.json @@ -274,6 +274,7 @@ "context": "MessageEditor > Editor", "bindings": { "enter": "agent::Chat", + "ctrl-enter": "agent::ChatWithFollow", "ctrl-i": "agent::ToggleProfileSelector", "shift-ctrl-r": "agent::OpenAgentDiff" } diff --git a/assets/keymaps/default-macos.json b/assets/keymaps/default-macos.json index 5ace9710492aa3511ee3e87cc14987c6f96cd185..0193657434e6358ee45e2cd23adca7a1fd9c7f35 100644 --- a/assets/keymaps/default-macos.json +++ b/assets/keymaps/default-macos.json @@ -311,6 +311,7 @@ "use_key_equivalents": true, "bindings": { "enter": "agent::Chat", + "cmd-enter": "agent::ChatWithFollow", "cmd-i": "agent::ToggleProfileSelector", "shift-ctrl-r": "agent::OpenAgentDiff" } diff --git a/crates/agent/src/agent.rs b/crates/agent/src/agent.rs index f0e4365baec7b63de9eefd2f9ce2cef02e5d361c..bd7f0eddddca58ac0d89a32322ba631839534b90 100644 --- a/crates/agent/src/agent.rs +++ b/crates/agent/src/agent.rs @@ -69,6 +69,7 @@ actions!( AddContextServer, RemoveSelectedThread, Chat, + ChatWithFollow, CycleNextInlineAssist, CyclePreviousInlineAssist, FocusUp, diff --git a/crates/agent/src/message_editor.rs b/crates/agent/src/message_editor.rs index 8662b2bf373b13e4d3e605ec6ef4e0f7b27e2bfa..c4306baedf502a72a2cc2700130910bd70b4fcc6 100644 --- a/crates/agent/src/message_editor.rs +++ b/crates/agent/src/message_editor.rs @@ -49,8 +49,9 @@ use crate::profile_selector::ProfileSelector; use crate::thread::{MessageCrease, Thread, TokenUsageRatio}; use crate::thread_store::{TextThreadStore, ThreadStore}; use crate::{ - ActiveThread, AgentDiffPane, Chat, ExpandMessageEditor, Follow, NewThread, OpenAgentDiff, - RemoveAllContext, ToggleContextPicker, ToggleProfileSelector, register_agent_preview, + ActiveThread, AgentDiffPane, Chat, ChatWithFollow, ExpandMessageEditor, Follow, NewThread, + OpenAgentDiff, RemoveAllContext, ToggleContextPicker, ToggleProfileSelector, + register_agent_preview, }; #[derive(RegisterComponent)] @@ -302,6 +303,21 @@ impl MessageEditor { cx.notify(); } + 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.chat(&Chat, window, cx); + } + fn is_editor_empty(&self, cx: &App) -> bool { self.editor.read(cx).text(cx).trim().is_empty() } @@ -562,6 +578,7 @@ impl MessageEditor { v_flex() .key_context("MessageEditor") .on_action(cx.listener(Self::chat)) + .on_action(cx.listener(Self::chat_with_follow)) .on_action(cx.listener(|this, _: &ToggleProfileSelector, window, cx| { this.profile_selector .read(cx)