Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
agent: Improve discoverability of the quote selection action (#40897)
Danilo Leala24601903aa1
diff --git a/assets/keymaps/default-linux.json b/assets/keymaps/default-linux.jsonindex 7774d4b3960..dd599acfe6f 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.jsonindex 33282d2df58..a3cc5e6c6bc 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.jsonindex 44ee25dcce0..3507bfd2f0b 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.jsonindex 2e27158e116..4d2d13a90d9 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.jsonindex 1d723bd75bb..97abc7dd819 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.rsindex 7c31500c937..cc0d212a86f 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.rsindex 2d28d954507..408aecccfa7 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<Workspace>,) {diff --git a/crates/editor/src/mouse_context_menu.rs b/crates/editor/src/mouse_context_menu.rsindex cef691dec48..7c83113f783 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, Subscriuse 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.rsindex e9bfb6d92a7..2baf4f708c2 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<Menu> {use zed_actions::Quit;@@ -214,6 +214,8 @@ pub fn app_menus(cx: &mut App) -> Vec<Menu> {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.rsindex 521405edc29..13a2837efb3 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.mdindex ed439252b4d..4e7e7904cf5 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.@@ -148,7 +148,7 @@ Usage: `/terminal [<number>]`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`