Skip to content

Open tool-call files in the files panel, and in the default editor - #164

Open
katulevskiy wants to merge 4 commits into
mirror/upstream-mainfrom
mirror/upstream-pr/522
Open

katulevskiy wants to merge 4 commits into
mirror/upstream-mainfrom
mirror/upstream-pr/522

Conversation

@katulevskiy

Copy link
Copy Markdown
Owner

Upstream mirror

Source: zeronsh#522
Original author: @katulevskiy
Original revision: 6ca536b04f5f0ed47c768c54ca350e9941943542

This PR is an isolated Contribution Manager pilot mirror. Its reviews, checks and merge state are separate from upstream. An empty [skip ci] commit suppresses automatic bulk CI; the code tree matches the imported upstream revision.


When you expand a tool group, Read/Write/Edit/Patch rows show a file badge, but clicking the row only expands it to reveal the path. The files panel can already open workspace files (Markdown file links use it), so this PR connects the badge to it, and adds a way to hand the open file to your own editor.

Tool-call file badges open the file in the files panel (transcript.rs)

  • The badge calls the transcript's existing workspace-link handler, the same route Markdown file links take, so it gets the same active-session and workspace-containment checks in Shell::activate_session_link / open_workspace_file_link. There is no new event or shell plumbing.
  • The badge is its own click target and stops propagation, so opening a file doesn't also toggle the row's accordion. Clicking the rest of the header still expands the output or diff.
  • Whether a badge is clickable comes from LinkUi::file_link, so it resolves against the same ordered roots as Markdown links (the chat's checkout, its parent's, this device's projects), and an absolute path outside all of them opens read-only like an outside Markdown link. Paths the handler can't open keep an inert badge instead of looking clickable and doing nothing.

"Open in default editor" in the file viewer toolbar (files/preview.rs)

  • A new breadcrumb-toolbar button next to "Reveal file in tree" (ARROW_UP_RIGHT icon) calls gpui's open_with_system: xdg-open on Linux, open on macOS, ShellExecute on Windows.
  • It only appears for workspaces on this device (FilesRequestContext::target_device_id.is_none()). A remote space's files live on another machine, where the local default app can't reach them. The path is the chat's cwd joined with the workspace-relative path, which matches the root the engine's resolve_target uses for chat targets.

Verified locally:

  • cargo test --locked -p zeron-ui --lib -- --test-threads=1: 1356 passed, 2 of them new:
    • tool_file_badge_opens_linkable_files_without_toggling_the_chip clicks the badge and checks that the link handler gets the path and the accordion doesn't toggle; clicking elsewhere on the row still toggles it; a path the handler can't open gets no clickable badge. With the stop_propagation line removed, the test fails as expected.
    • default_editor_opens_only_files_on_this_device checks that local workspaces get an absolute path and remote or unresolved ones get none.
  • cargo check --locked -p zeron is clean. Clippy adds no new warnings over main (tool_chip already had too many arguments), and the diff is rustfmt-clean.

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

katulevskiy and others added 3 commits September 28, 2026 22:20
Clicking the file badge on a Read/Write/Edit/Patch tool row now opens
that file in the right-hand files panel, instead of only expanding the
row to show its path. The badge goes through the transcript's existing
workspace-link handler, the same route Markdown file links take, so it
resolves against the same roots (the chat's checkout, its parent's, and
this device's projects) and opens outside absolute paths read-only.

The badge stops propagation, so clicking it does not also toggle the
row's accordion; the rest of the header still expands the output or
diff. Paths the link handler cannot open keep an inert badge rather
than looking clickable and doing nothing.
Add an "Open in default editor" button to the file viewer's breadcrumb
toolbar, next to "Reveal file in tree". It hands the file to the
platform's default application (xdg-open, open, ShellExecute) via
gpui's open_with_system.

The button only appears for workspaces on this device: a remote
space's files live on another machine, where the local default app
cannot reach them.
@contribution-manager-katulevskiy contribution-manager-katulevskiy Bot added the review:needs-triage Managed by Contribution Manager label Oct 6, 2026
@contribution-manager-katulevskiy

contribution-manager-katulevskiy Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Contribution Manager

needs triage · medium risk · untriaged

Open review workspace · Revision a80ecb59

Next actions:

  • Direction decision needed
  • Scope, risk, and platform triage needed
  • Independent code review needed
  • Required check: core-tests (missing)

This summary is maintained by the review app. Decisions and test evidence are recorded in the workspace; the app does not merge PRs.

@contribution-manager-katulevskiy contribution-manager-katulevskiy Bot added cm:inbox Contribution Manager: waiting for triage and removed review:needs-triage Managed by Contribution Manager labels Oct 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cm:inbox Contribution Manager: waiting for triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant