agent_ui: Serialize copied selection mentions as links#54031
Merged
NeelChotai merged 9 commits intozed-industries:mainfrom Apr 23, 2026
Merged
agent_ui: Serialize copied selection mentions as links#54031NeelChotai merged 9 commits intozed-industries:mainfrom
NeelChotai merged 9 commits intozed-industries:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes copying/cutting text from the Agent panel message editor so that folded “selection” mentions are serialized to their mention links (e.g. [@…](...)) instead of the literal placeholder text, allowing paste into a new thread to reconstruct mentions.
Changes:
- Added
copy/cutaction interception inMessageEditorto serialize selected mention creases as mention links when writing to the clipboard. - Added
MentionSet::mention_uri_for_creaseto look up a mention URI given a crease id. - Added tests covering copy/cut serialization behavior for selection mentions and paste round-tripping.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| crates/agent_ui/src/message_editor.rs | Intercepts copy/cut, adds serialized_copy_text mention-aware serialization, and adds tests for copy/cut + paste behavior. |
| crates/agent_ui/src/mention_set.rs | Exposes crease-id → mention-URI lookup used during serialization. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Member
|
Nice! Thank you for the contribution. |
NeelChotai
approved these changes
Apr 23, 2026
The WHATWG URL parser normalizes `\` to `/` inside `file://` URLs, so `MentionUri::parse` must convert them back on Windows so the resulting `PathBuf` matches how worktrees store absolute paths (native separators).
Merged
via the queue into
zed-industries:main
with commit Apr 23, 2026
4733ae4
54 of 58 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #53981
Selection mentions inserted from the agent panel are stored as folded placeholder text in the message editor. That meant a normal copy would put the literal
selectiontoken on the clipboard, and pasting into a new thread would lose the original mention context.This teaches
MessageEditorto serialize selected folded mentions as their mention links before writing to the clipboard. The surrounding text stays intact, and the existing paste path can rebuild the mentions in a fresh thread.Release Notes:
selection.