From a24601903aa1e75e89527c8f455557717a330b07 Mon Sep 17 00:00:00 2001
From: Danilo Leal <67129314+danilo-leal@users.noreply.github.com>
Date: Wed, 22 Oct 2025 12:56:11 -0300
Subject: [PATCH] agent: Improve discoverability of the quote selection action
(#40897)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
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.
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.
---
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(-)
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