diff --git a/assets/keymaps/default-linux.json b/assets/keymaps/default-linux.json index 7774d4b3960de44455104c41b82d1c8243d3b78b..dd599acfe6fb5df175ca794d48a3407f4aebb9e1 100644 --- a/assets/keymaps/default-linux.json +++ b/assets/keymaps/default-linux.json @@ -139,7 +139,7 @@ "find": "buffer_search::Deploy", "ctrl-f": "buffer_search::Deploy", "ctrl-h": "buffer_search::DeployReplace", - "ctrl->": "agent::QuoteSelection", + "ctrl->": "agent::AddSelectionToThread", "ctrl-<": "assistant::InsertIntoEditor", "ctrl-alt-e": "editor::SelectEnclosingSymbol", "ctrl-shift-backspace": "editor::GoToPreviousChange", @@ -243,7 +243,7 @@ "ctrl-shift-i": "agent::ToggleOptionsMenu", "ctrl-alt-shift-n": "agent::ToggleNewThreadMenu", "shift-alt-escape": "agent::ExpandMessageEditor", - "ctrl->": "agent::QuoteSelection", + "ctrl->": "agent::AddSelectionToThread", "ctrl-alt-e": "agent::RemoveAllContext", "ctrl-shift-e": "project_panel::ToggleFocus", "ctrl-shift-enter": "agent::ContinueThread", diff --git a/assets/keymaps/default-macos.json b/assets/keymaps/default-macos.json index 33282d2df58f6a95e257d726cd6466f4e3560e7c..a3cc5e6c6bce709c0ddc7b4a8437847dbdce9ed9 100644 --- a/assets/keymaps/default-macos.json +++ b/assets/keymaps/default-macos.json @@ -163,7 +163,7 @@ "cmd-alt-f": "buffer_search::DeployReplace", "cmd-alt-l": ["buffer_search::Deploy", { "selection_search_enabled": true }], "cmd-e": ["buffer_search::Deploy", { "focus": false }], - "cmd->": "agent::QuoteSelection", + "cmd->": "agent::AddSelectionToThread", "cmd-<": "assistant::InsertIntoEditor", "cmd-alt-e": "editor::SelectEnclosingSymbol", "alt-enter": "editor::OpenSelectionsInMultibuffer" @@ -282,7 +282,7 @@ "cmd-shift-i": "agent::ToggleOptionsMenu", "cmd-alt-shift-n": "agent::ToggleNewThreadMenu", "shift-alt-escape": "agent::ExpandMessageEditor", - "cmd->": "agent::QuoteSelection", + "cmd->": "agent::AddSelectionToThread", "cmd-alt-e": "agent::RemoveAllContext", "cmd-shift-e": "project_panel::ToggleFocus", "cmd-ctrl-b": "agent::ToggleBurnMode", diff --git a/assets/keymaps/default-windows.json b/assets/keymaps/default-windows.json index 44ee25dcce0296aa318b1940619c8020da87fac0..3507bfd2f0b6e10147fad728228fae55d99c9157 100644 --- a/assets/keymaps/default-windows.json +++ b/assets/keymaps/default-windows.json @@ -134,7 +134,7 @@ "ctrl-k z": "editor::ToggleSoftWrap", "ctrl-f": "buffer_search::Deploy", "ctrl-h": "buffer_search::DeployReplace", - "ctrl-shift-.": "agent::QuoteSelection", + "ctrl-shift-.": "agent::AddSelectionToThread", "ctrl-shift-,": "assistant::InsertIntoEditor", "shift-alt-e": "editor::SelectEnclosingSymbol", "ctrl-shift-backspace": "editor::GoToPreviousChange", @@ -244,7 +244,7 @@ "ctrl-shift-i": "agent::ToggleOptionsMenu", // "ctrl-shift-alt-n": "agent::ToggleNewThreadMenu", "shift-alt-escape": "agent::ExpandMessageEditor", - "ctrl-shift-.": "agent::QuoteSelection", + "ctrl-shift-.": "agent::AddSelectionToThread", "shift-alt-e": "agent::RemoveAllContext", "ctrl-shift-e": "project_panel::ToggleFocus", "ctrl-shift-enter": "agent::ContinueThread", diff --git a/assets/keymaps/linux/cursor.json b/assets/keymaps/linux/cursor.json index 2e27158e1167f0840cadfb0d86dc06614f6076c6..4d2d13a90d96c31f72b1bb0ccc74608f81004eda 100644 --- a/assets/keymaps/linux/cursor.json +++ b/assets/keymaps/linux/cursor.json @@ -17,8 +17,8 @@ "bindings": { "ctrl-i": "agent::ToggleFocus", "ctrl-shift-i": "agent::ToggleFocus", - "ctrl-shift-l": "agent::QuoteSelection", // In cursor uses "Ask" mode - "ctrl-l": "agent::QuoteSelection", // In cursor uses "Agent" mode + "ctrl-shift-l": "agent::AddSelectionToThread", // In cursor uses "Ask" mode + "ctrl-l": "agent::AddSelectionToThread", // In cursor uses "Agent" mode "ctrl-k": "assistant::InlineAssist", "ctrl-shift-k": "assistant::InsertIntoEditor" } diff --git a/assets/keymaps/macos/cursor.json b/assets/keymaps/macos/cursor.json index 1d723bd75bb788aa1ea63335f9fa555cb50d2df0..97abc7dd819485850107eca6762fc1ed60ec0515 100644 --- a/assets/keymaps/macos/cursor.json +++ b/assets/keymaps/macos/cursor.json @@ -17,8 +17,8 @@ "bindings": { "cmd-i": "agent::ToggleFocus", "cmd-shift-i": "agent::ToggleFocus", - "cmd-shift-l": "agent::QuoteSelection", // In cursor uses "Ask" mode - "cmd-l": "agent::QuoteSelection", // In cursor uses "Agent" mode + "cmd-shift-l": "agent::AddSelectionToThread", // In cursor uses "Ask" mode + "cmd-l": "agent::AddSelectionToThread", // In cursor uses "Agent" mode "cmd-k": "assistant::InlineAssist", "cmd-shift-k": "assistant::InsertIntoEditor" } diff --git a/crates/agent_ui/src/agent_ui.rs b/crates/agent_ui/src/agent_ui.rs index 7c31500c937a6513c932c66560cf8754cbafbf1c..cc0d212a86f5db3b0d5cf8ad4b0457689512f33c 100644 --- a/crates/agent_ui/src/agent_ui.rs +++ b/crates/agent_ui/src/agent_ui.rs @@ -130,12 +130,6 @@ actions!( ] ); -#[derive(Clone, Copy, Debug, PartialEq, Eq, Action)] -#[action(namespace = agent)] -#[action(deprecated_aliases = ["assistant::QuoteSelection"])] -/// Quotes the current selection in the agent panel's message editor. -pub struct QuoteSelection; - /// Creates a new conversation thread, optionally based on an existing thread. #[derive(Default, Clone, PartialEq, Deserialize, JsonSchema, Action)] #[action(namespace = agent)] diff --git a/crates/agent_ui/src/text_thread_editor.rs b/crates/agent_ui/src/text_thread_editor.rs index 2d28d95450726554787f6a9cb211e852ceaccddf..408aecccfa7fa71aaf15e4c085ad31dce8a1d922 100644 --- a/crates/agent_ui/src/text_thread_editor.rs +++ b/crates/agent_ui/src/text_thread_editor.rs @@ -1,5 +1,4 @@ use crate::{ - QuoteSelection, language_model_selector::{LanguageModelSelector, language_model_selector}, ui::BurnModeTooltip, }; @@ -72,7 +71,7 @@ use workspace::{ pane, searchable::{SearchEvent, SearchableItem}, }; -use zed_actions::agent::ToggleModelSelector; +use zed_actions::agent::{AddSelectionToThread, ToggleModelSelector}; use crate::{slash_command::SlashCommandCompletionProvider, slash_command_picker}; use assistant_context::{ @@ -1450,7 +1449,7 @@ impl TextThreadEditor { pub fn quote_selection( workspace: &mut Workspace, - _: &QuoteSelection, + _: &AddSelectionToThread, window: &mut Window, cx: &mut Context, ) { diff --git a/crates/editor/src/mouse_context_menu.rs b/crates/editor/src/mouse_context_menu.rs index cef691dec483c8a9ae978499689db69b14c5dffe..7c83113f7837565efc59889e74bf397b392c516b 100644 --- a/crates/editor/src/mouse_context_menu.rs +++ b/crates/editor/src/mouse_context_menu.rs @@ -11,6 +11,7 @@ use gpui::{Context, DismissEvent, Entity, Focusable as _, Pixels, Point, Subscri use std::ops::Range; use text::PointUtf16; use workspace::OpenInTerminal; +use zed_actions::agent::AddSelectionToThread; #[derive(Debug)] pub enum MenuPosition { @@ -233,6 +234,7 @@ pub fn deploy_context_menu( quick_launch: false, }), ) + .action("Add to Agent Thread", Box::new(AddSelectionToThread)) .separator() .action("Cut", Box::new(Cut)) .action("Copy", Box::new(Copy)) diff --git a/crates/zed/src/zed/app_menus.rs b/crates/zed/src/zed/app_menus.rs index e9bfb6d92a710177308dbd87b0fdc1129343a6a4..2baf4f708c29a7bec11e8aa26a1897a20a75e3c9 100644 --- a/crates/zed/src/zed/app_menus.rs +++ b/crates/zed/src/zed/app_menus.rs @@ -2,7 +2,7 @@ use collab_ui::collab_panel; use gpui::{App, Menu, MenuItem, OsAction}; use release_channel::ReleaseChannel; use terminal_view::terminal_panel; -use zed_actions::{ToggleFocus as ToggleDebugPanel, dev}; +use zed_actions::{ToggleFocus as ToggleDebugPanel, agent::AddSelectionToThread, dev}; pub fn app_menus(cx: &mut App) -> Vec { use zed_actions::Quit; @@ -214,6 +214,8 @@ pub fn app_menus(cx: &mut App) -> Vec { MenuItem::action("Move Line Up", editor::actions::MoveLineUp), MenuItem::action("Move Line Down", editor::actions::MoveLineDown), MenuItem::action("Duplicate Selection", editor::actions::DuplicateLineDown), + MenuItem::separator(), + MenuItem::action("Add to Agent Thread", AddSelectionToThread), ], }, Menu { diff --git a/crates/zed_actions/src/lib.rs b/crates/zed_actions/src/lib.rs index 521405edc29845f6d459b3924355a5d8ea4a1bf8..13a2837efb3240a400151b3bcd5342d8300f8730 100644 --- a/crates/zed_actions/src/lib.rs +++ b/crates/zed_actions/src/lib.rs @@ -306,7 +306,10 @@ pub mod agent { #[action(deprecated_aliases = ["assistant::ToggleModelSelector", "assistant2::ToggleModelSelector"])] ToggleModelSelector, /// Triggers re-authentication on Gemini - ReauthenticateAgent + ReauthenticateAgent, + /// Add the current selection as context for threads in the agent panel. + #[action(deprecated_aliases = ["assistant::QuoteSelection", "agent::QuoteSelection"])] + AddSelectionToThread, ] ); } diff --git a/docs/src/ai/text-threads.md b/docs/src/ai/text-threads.md index ed439252b4d1612ea1b20269c6286e2b94685ac2..4e7e7904cf53e1e7e141b29c777a6f53796177cf 100644 --- a/docs/src/ai/text-threads.md +++ b/docs/src/ai/text-threads.md @@ -16,7 +16,7 @@ To begin, type a message in a `You` block. As you type, the remaining tokens count for the selected model is updated. -Inserting text from an editor is as simple as highlighting the text and running `agent: quote selection` ({#kb agent::QuoteSelection}); Zed will wrap it in a fenced code block if it is code. +Inserting text from an editor is as simple as highlighting the text and running `agent: add selection to thread` ({#kb agent::AddSelectionToThread}); Zed will wrap it in a fenced code block if it is code. ![Quoting a selection](https://zed.dev/img/assistant/quoting-a-selection.png) @@ -148,7 +148,7 @@ Usage: `/terminal []` The `/selection` command inserts the selected text in the editor into the context. This is useful for referencing specific parts of your code. -This is equivalent to the `agent: quote selection` command ({#kb agent::QuoteSelection}). +This is equivalent to the `agent: add selection to thread` command ({#kb agent::AddSelectionToThread}). Usage: `/selection`