agent_ui: Make file mention chips clickable to open files#46751
Merged
bennetbo merged 2 commits intozed-industries:mainfrom Mar 3, 2026
Merged
agent_ui: Make file mention chips clickable to open files#46751bennetbo merged 2 commits intozed-industries:mainfrom
bennetbo merged 2 commits intozed-industries:mainfrom
Conversation
|
We require contributors to sign our Contributor License Agreement, and we don't have @soyllamas on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'. |
Contributor
Author
|
@cla-bot check |
|
The cla-bot has been summoned, and re-checked this pull request! |
bennetbo
reviewed
Feb 2, 2026
Member
bennetbo
left a comment
There was a problem hiding this comment.
Looks mostly good to me. Please fix the conflicts with main. I wanted to, but GitHub won't let me push to your branch
90f073a to
dbcbb69
Compare
Member
|
@soyllamas Looks good, I cannot push to your branch. Please merge main and then we can merge. |
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
Author
|
@bennetbo rebased my changes. Encountered a few conflicts that are now resolved ✅ |
tahayvr
pushed a commit
to tahayvr/zed
that referenced
this pull request
Mar 4, 2026
…ries#46751) ### Summary Makes file mention chips in the AI chat input clickable to open the referenced files. Previously, chips like `@README.md` were purely visual indicators with no interaction. ### Changes - **Clickable mention chips**: Users can now click on file mentions in the chat input to open those files in the editor - **Support for all mention types**: - Files → Opens in editor - Files with line numbers → Opens and scrolls to line - Directories → Reveals in project panel - Threads → Navigates to thread - Rules → Opens rules library - URLs → Opens in browser - **Handles files outside workspace**: Falls back to `open_abs_path()` for files not in the current workspace ### Implementation Threads `MentionUri` and `WeakEntity<Workspace>` through the crease rendering pipeline: 1. Updated `insert_crease_for_mention()` to accept mention URI and workspace references 2. Added click handler to `MentionCrease` component using `.when()` for conditional attachment 3. Implemented file opening helpers that mirror the existing `thread_view.rs::open_link()` logic ### Demo https://github.com/user-attachments/assets/21b2afb7-7a86-4a0a-aba1-e24bb1b650c2 ### Testing Manually tested: - [x] Clicking `@README.md` opens file - [x] Clicking file with line numbers navigates correctly - [x] Clicking directory reveals in project panel - [x] Files outside workspace open via absolute path ### Files Changed - `crates/agent_ui/src/mention_set.rs` - Thread URI/workspace through pipeline - `crates/agent_ui/src/ui/mention_crease.rs` - Add click handler and file opening logic - `crates/agent_ui/src/acp/message_editor.rs` - Update call sites ### Review feedback addressed - Replaced `.when()` + `unwrap()` with `.when_some()` + `Option::zip()` (`0e36efb4eb`) - De-duplicated `open_file` and `open_file_at_line` into a single function with `Option<RangeInclusive<u32>>` (`dbcbb69a4b`) - Rebased onto latest `main` and resolved conflicts Also update item 2 under Implementation from: _Added click handler to MentionCrease component using `.when()` for conditional attachment_ to: _Added click handler to MentionCrease component using `.when_some()` with `Option::zip()` for conditional attachment_ ### Release Notes: - agent: File mention chips in the chat input are now clickable and will open the referenced files in the editor. Closes zed-industries#46746 --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
wzulfikar
pushed a commit
to wzulfikar/zed
that referenced
this pull request
Mar 4, 2026
…ries#46751) ### Summary Makes file mention chips in the AI chat input clickable to open the referenced files. Previously, chips like `@README.md` were purely visual indicators with no interaction. ### Changes - **Clickable mention chips**: Users can now click on file mentions in the chat input to open those files in the editor - **Support for all mention types**: - Files → Opens in editor - Files with line numbers → Opens and scrolls to line - Directories → Reveals in project panel - Threads → Navigates to thread - Rules → Opens rules library - URLs → Opens in browser - **Handles files outside workspace**: Falls back to `open_abs_path()` for files not in the current workspace ### Implementation Threads `MentionUri` and `WeakEntity<Workspace>` through the crease rendering pipeline: 1. Updated `insert_crease_for_mention()` to accept mention URI and workspace references 2. Added click handler to `MentionCrease` component using `.when()` for conditional attachment 3. Implemented file opening helpers that mirror the existing `thread_view.rs::open_link()` logic ### Demo https://github.com/user-attachments/assets/21b2afb7-7a86-4a0a-aba1-e24bb1b650c2 ### Testing Manually tested: - [x] Clicking `@README.md` opens file - [x] Clicking file with line numbers navigates correctly - [x] Clicking directory reveals in project panel - [x] Files outside workspace open via absolute path ### Files Changed - `crates/agent_ui/src/mention_set.rs` - Thread URI/workspace through pipeline - `crates/agent_ui/src/ui/mention_crease.rs` - Add click handler and file opening logic - `crates/agent_ui/src/acp/message_editor.rs` - Update call sites ### Review feedback addressed - Replaced `.when()` + `unwrap()` with `.when_some()` + `Option::zip()` (`0e36efb4eb`) - De-duplicated `open_file` and `open_file_at_line` into a single function with `Option<RangeInclusive<u32>>` (`dbcbb69a4b`) - Rebased onto latest `main` and resolved conflicts Also update item 2 under Implementation from: _Added click handler to MentionCrease component using `.when()` for conditional attachment_ to: _Added click handler to MentionCrease component using `.when_some()` with `Option::zip()` for conditional attachment_ ### Release Notes: - agent: File mention chips in the chat input are now clickable and will open the referenced files in the editor. Closes zed-industries#46746 --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
Makes file mention chips in the AI chat input clickable to open the referenced files. Previously, chips like
@README.mdwere purely visual indicators with no interaction.Changes
open_abs_path()for files not in the current workspaceImplementation
Threads
MentionUriandWeakEntity<Workspace>through the crease rendering pipeline:insert_crease_for_mention()to accept mention URI and workspace referencesMentionCreasecomponent using.when()for conditional attachmentthread_view.rs::open_link()logicDemo
Open.file.from.reference.mp4
Testing
Manually tested:
@README.mdopens fileFiles Changed
crates/agent_ui/src/mention_set.rs- Thread URI/workspace through pipelinecrates/agent_ui/src/ui/mention_crease.rs- Add click handler and file opening logiccrates/agent_ui/src/acp/message_editor.rs- Update call sitesReview feedback addressed
.when()+unwrap()with.when_some()+Option::zip()(0e36efb4eb)open_fileandopen_file_at_lineinto a single function withOption<RangeInclusive<u32>>(dbcbb69a4b)mainand resolved conflictsAlso update item 2 under Implementation from:
Added click handler to MentionCrease component using
.when()for conditional attachmentto:
Added click handler to MentionCrease component using
.when_some()withOption::zip()for conditional attachmentRelease Notes:
Closes #46746