agent: Improve discoverability of the quote selection action (#40897)

Danilo Leal created

This PR renames the `agent::QuoteSelection` to
`agent::AddSelectionToThread` _and_ adds it as a menu item in both the
right-click context menu within regular buffers as well as the
"Selection" app menu.

We've received feedback in the past about how hard to discover this
feature is, and after watching [the Syntax podcast
crew](https://www.youtube.com/watch?v=bRK3PeVFfVE) recently struggle
with doing soβ€”and then naturally looking for it in the context menu and
not finding itβ€”it felt like time to push a change. I think the rename +
the availability in these places could help bringing it to surface more.

The same action can be done in Cursor through the `cmd-l` keybinding,
but in Zed, that triggers `editor::SelectLine`, which I don't want to
override by default. However, if you're using Cursor's keymap, then
`cmd-l` does trigger this action, as expected.

<img width="500" height="1812" alt="Screenshot 2025-10-22 at 12β€― 01@2x"
src="https://github.com/user-attachments/assets/dfc2c41c-8d0a-4a1a-8ea1-1bd5d1aa1171"
/>


Release Notes:

- agent: Improves discoverability of the previously called "quote
selection" actionβ€”which allows to add a text selection in a buffer as
context within the agent panelβ€”by renaming it to "add selection to
thread" and making it available from the right-click editor context menu
as well as the "Selection" app menu.

Change summary

assets/keymaps/default-linux.json         | 4 ++--
assets/keymaps/default-macos.json         | 4 ++--
assets/keymaps/default-windows.json       | 4 ++--
assets/keymaps/linux/cursor.json          | 4 ++--
assets/keymaps/macos/cursor.json          | 4 ++--
crates/agent_ui/src/agent_ui.rs           | 6 ------
crates/agent_ui/src/text_thread_editor.rs | 5 ++---
crates/editor/src/mouse_context_menu.rs   | 2 ++
crates/zed/src/zed/app_menus.rs           | 4 +++-
crates/zed_actions/src/lib.rs             | 5 ++++-
docs/src/ai/text-threads.md               | 4 ++--
11 files changed, 23 insertions(+), 23 deletions(-)

Detailed changes

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",

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",

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",

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"
     }

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"
     }

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)]

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>,
     ) {

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))

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 {

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,
         ]
     );
 }

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 [<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`