feat: add clickable file paths to agent tool outputs and inline code#13465
Merged
feat: add clickable file paths to agent tool outputs and inline code#13465
Conversation
Make file paths in agent tool outputs (Edit, Write, Read, Glob, Grep, MultiEdit, NotebookEdit) and inline code blocks interactive. Clicking opens the file; a dropdown menu offers "Reveal in Finder" and "Open in Editor" (VS Code, Cursor, Zed) integration. - Add ClickableFilePath component with editor dropdown - Detect absolute file paths in inline code blocks - Add i18n keys for file operations across all locales - Add unit tests for ClickableFilePath and CodeBlock detection Co-Authored-By: Claude Opus 4.6 <[email protected]> Signed-off-by: suyao <[email protected]>
EurFelux
reviewed
Mar 14, 2026
Collaborator
EurFelux
left a comment
There was a problem hiding this comment.
Nice feature! The clickable file paths across all agent tool outputs are a solid developer workflow improvement. The implementation is clean and well-tested. A few observations:
Key items:
- Code duplication —
getEditorIconand theopenInEditorURL construction pattern are duplicated fromOpenExternalAppButton.tsx. Consider extracting into a shared utility. - GrepTool regex —
/^(\/[^:]+)(:.*)?$/is quite permissive and could match non-path lines. A tighter pattern would reduce false positives. - NotebookEditTool fallback — Minor inconsistency in the ternary fallback vs other tools in this PR.
- Accessibility — The clickable
<span>could benefit from keyboard navigation support (tabIndex,onKeyDown).
Overall, this looks good! The conservative inline code path regex is a sensible tradeoff, and the test coverage is appreciated.
src/renderer/src/pages/home/Messages/Tools/MessageAgentTools/ClickableFilePath.tsx
Outdated
Show resolved
Hide resolved
src/renderer/src/pages/home/Messages/Tools/MessageAgentTools/GrepTool.tsx
Outdated
Show resolved
Hide resolved
src/renderer/src/pages/home/Messages/Tools/MessageAgentTools/NotebookEditTool.tsx
Outdated
Show resolved
Hide resolved
src/renderer/src/pages/home/Messages/Tools/MessageAgentTools/ClickableFilePath.tsx
Outdated
Show resolved
Hide resolved
Collaborator
- Extract getEditorIcon and buildEditorUrl into shared editorUtils - Reuse shared utility in both ClickableFilePath and OpenExternalAppButton - Tighten GrepTool regex to reduce false positives on non-path lines - Fix NotebookEditTool redundant fallback to use undefined explicitly - Add keyboard accessibility (role="link", tabIndex, Enter/Space) - Make dropdown trigger more visible (larger font, hover background) - Add keyboard accessibility tests Co-Authored-By: Claude Opus 4.6 <[email protected]> Signed-off-by: suyao <[email protected]>
EurFelux
approved these changes
Mar 15, 2026
| /** | ||
| * Build the protocol URL to open a file/folder in an external editor. | ||
| * @see https://code.visualstudio.com/docs/configure/command-line#_opening-vs-code-with-urls | ||
| * @see https://github.com/microsoft/vscode/issues/141548#issuecomment-1102200617 |
Collaborator
There was a problem hiding this comment.
not working for zed. but still ok
EurFelux
approved these changes
Mar 16, 2026
…format Signed-off-by: suyao <[email protected]>
kangfenmao
approved these changes
Mar 16, 2026
Collaborator
kangfenmao
left a comment
There was a problem hiding this comment.
LGTM! Clean implementation with good code reuse patterns.
Highlights:
ClickableFilePathcomponent is well-structured with propermemo,useCallback,useMemoeditorUtils.tsxextraction eliminates duplication withOpenExternalAppButton- Good accessibility support (
role="link",tabIndex, keyboard handlers) - Solid test coverage for both the component and CodeBlock path detection
- GrepTool regex verified to work correctly via backtracking
Minor nits (non-blocking):
getEditorIconineditorUtils.tsxhas nodefaultbranch — consider a fallback icon for future editorswindow.open(buildEditorUrl(...))inClickableFilePathlacks error handling if the editor is not installed (same pattern as existingOpenExternalAppButton, so not a regression)
…Path Signed-off-by: suyao <[email protected]>
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.

What this PR does
Before this PR:
File paths displayed in agent tool outputs (Edit, Write, Read, Glob, Grep, MultiEdit, NotebookEdit) and inline code blocks were plain, non-interactive text.
After this PR:
File paths are clickable — clicking opens the file directly. An ellipsis dropdown menu provides additional actions: "Reveal in Finder" and "Open in Editor" (VS Code, Cursor, Zed).
Why we need it and why it was done in this way
Clickable file paths improve developer workflow by allowing quick navigation to files referenced in agent tool outputs without manual copy-paste.
The following tradeoffs were made:
ClickableFilePathcomponent is used across all agent tools for consistency./^\/[\w.-]+(?:\/[\w.-]+)+$/) to avoid false positives on non-path inline code. This means some edge-case paths (e.g., with spaces or@) won't be detected in inline code, but tool-output paths are always clickable since they come from structured input.The following alternatives were considered:
Breaking changes
None.
Special notes for your reviewer
ClickableFilePathcomponent reuses existinguseExternalAppshook andwindow.api.fileIPC APIs.open_file,open_file_error,file_not_found, andreveal_in_finderacross all locale files.'Finder'string on macOS was replaced witht()for proper i18n compliance.openPath/showInFoldernow return Promises to avoid TypeError on.catch().Checklist
/gh-pr-review,gh pr diff, or GitHub UI) before requesting review from othersRelease note