feat(app): make file paths in chat clickable by imsoul11 · Pull Request #47528 · anomalyco/opencode · GitHub
Skip to content

feat(app): make file paths in chat clickable - #47528

Open
imsoul11 wants to merge 2 commits into
anomalyco:devfrom
imsoul11:clickable-file-paths
Open

feat(app): make file paths in chat clickable#47528
imsoul11 wants to merge 2 commits into
anomalyco:devfrom
imsoul11:clickable-file-paths

Conversation

@imsoul11

@imsoul11 imsoul11 commented Sep 5, 2026

Copy link
Copy Markdown

Issue for this PR

Addresses #37891

Type of change

  • New feature

What does this PR do?

In assistant messages, file paths in inline code (e.g. packages/app/src/app.tsx:301) are highlighted but clicking them does nothing, so they end up copy-pasted. This makes them clickable: clicking opens the file in the existing review panel and highlights the referenced line when the path ends in :line.

Kept the scope small and contained to the web/desktop renderer:

  • a delegated click handler on path-kind inline code in the markdown component (same pattern as the existing copy-button handler there)
  • an optional onOpenFile callback on the session data context, implemented in the session page using the same openReviewFile flow the file tree already uses
  • a small parser for path, path:line, and path:line:col (handles Windows drive paths)
  • pointer cursor + hover underline, only when the callback is present

URLs, fenced code blocks, and the TUI are untouched.

How did you verify your code works?

  • unit tests for the parser (10 cases: Windows paths, :line:col, invalid line numbers, URLs, whitespace)
  • bun test in packages/session-ui: 93 pass; typecheck clean in session-ui and app
  • manually in the desktop dev app: clicking a backticked path opens the review panel at the referenced line; plain-text paths and other code spans behave exactly as before

Opening as draft per the contributing guide since this is a UI feature — happy to reshape the approach after design review.

Screenshots / recordings

Attaching in a follow-up comment (recording of click → review panel opening at the line).

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions

github-actions Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

@imsoul11
imsoul11 marked this pull request as ready for review September 6, 2026 06:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant