Skip to content

fix(gui): open the selected file in the header open-in-app actions - #62056

Open
ElonYangDev wants to merge 1 commit into
anomalyco:devfrom
ElonYangDev:fix-open-app
Open

ElonYangDev wants to merge 1 commit into
anomalyco:devfrom
ElonYangDev:fix-open-app

Conversation

@ElonYangDev

@ElonYangDev ElonYangDev commented Nov 5, 2026 •

Copy link
Copy Markdown

Issue for this PR

Closes #61678, #62040

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

The header's "Open in app" button and the menu's "Copy path" always targeted the workspace root, so they opened and copied the folder instead of the file being viewed. The Windows and Linux Sublime Text entries named the app's display name, which the host can never resolve as a PATH command: the entry opened the file's default app on Windows and rejected on Linux.

  • The header button and its menu target the pane's selected file tab, resolved to an absolute path, and fall back to the worktree folder while no file tab is open.
  • Picking the file manager with a file tab selected now reveals the file in its folder instead of opening it in the default app; the worktree target still opens the folder.
  • The Windows and Linux Sublime Text entries call the launcher's command subl, like their other entries; macOS keeps the display name, which is the correct form there.

No feature flag: behavior fix on an existing surface.

How did you verify your code works?

  • Added a e2e regression in packages/app/e2e/regression/session-header.spec.ts for the panel open-in-app control: with no file tab open, "Copy path" yields the worktree path and the file manager opens the worktree folder; with a file tab open, the file manager records the file as revealed (not opened), "Copy path" yields the full file path, and the selected app (VS Code) opens the file; closing the tab restores the worktree target. This case fails on the pre-change behavior (worktree target and no reveal recording).
  • bun run typecheck and bun test in packages/gui-plugins are green (1086 tests), including the open-in-app launch/check machine tests.
  • bun run lint:changed at the repo root is green for the changed files.
  • Verified the header's Open in actions manually in the Windows desktop app while a file tab was selected; the reveal path is the same code on all three platforms and is asserted through the revealed output in the e2e fixture.

Screenshots / recordings

PR.62056-video.mp4

Visual

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 240 72" width="240" height="72">
  <style>
    .file { animation: drop 2.6s cubic-bezier(.6, 0, .4, 1) infinite; }
    .trail { stroke-dasharray: .1 5; stroke-linecap: round; animation: flow 2.6s linear infinite; }
    @keyframes drop {
      0%, 14% { transform: translate(0, 0); }
      48%, 76% { transform: translate(100px, 38.5px); }
      100% { transform: translate(0, 0); }
    }
    @keyframes flow { to { stroke-dashoffset: -35.7; } }
  </style>
  <g fill="currentColor">
    <rect x="10" y="8" width="112" height="18" rx="5" opacity=".12"/>
    <rect x="16" y="12" width="60" height="10" rx="2" opacity=".55"/>
    <rect x="82" y="12" width="34" height="10" rx="2" opacity=".25"/>
    <rect x="110" y="44" width="120" height="22" rx="5" opacity=".22"/>
    <circle cx="118" cy="49" r="1.8" opacity=".6"/>
    <rect x="125" y="48" width="30" height="2" rx="1" opacity=".4"/>
  </g>
  <path class="trail" d="M44 26 C44 40 130 34 130 44" fill="none" stroke="currentColor" stroke-width="2" opacity=".5"/>
  <g class="file">
    <rect x="24" y="12.5" width="12" height="9" rx="1.5" fill="currentColor" opacity=".8"/>
    <rect x="27" y="16" width="6" height="1.2" fill="currentColor" opacity=".25"/>
  </g>
</svg>

Checklist

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

Added by the opencode bot (AI-generated).

Fixes #62040
Fixes #55858

@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label Nov 5, 2026

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The header half works. The new e2e test fails on the base, where the file manager is never told to reveal the file, and passes with this change, along with the other location tests in session-header.spec.ts. The gui-plugins unit tests and tsc -b pass. The header change reuses the existing openPath(..., reveal) and the menu's reveal prop, and finds the selected tab the same way renderer.tsx does, so Copy path now follows the selected file and falls back to the worktree.

Public API: unchanged.

One caveat on the Sublime change, which I could not run on Windows or Linux: on Windows the installer does not put subl.exe on PATH by default. In that case where subl still fails and the OS default handler opens, as before. That is not a regression, but the fix only helps users who have added Sublime to PATH.

Fixes #55858

@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Nov 5, 2026
@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

The header's Open in app button and the menu's Copy path always targeted
the workspace root, so they opened and copied the folder instead of the
file being viewed. Picking the file manager while a file tab was selected
launched the file itself, so the system opened it with its default app -
a file manager is not a default app. The Windows and Linux Sublime Text
entries named the app's display name, which the host can never resolve
as a PATH command: the entry opened the file's default app on Windows
and rejected on Linux.

The header now targets the pane's selected file tab, resolved to an
absolute path, and falls back to the worktree while no file tab is open.
Picking the file manager opens the file manager on the target: it
reveals a file (its folder, with the file selected) and opens the
worktree as a directory, never involving a default app. Picking any
other entry opens the target in that app; on Windows an app not on the
PATH falls back to the system default as before, and macOS lists only
installed apps. Sublime Text names the launcher's command (subl) on
Windows and Linux, where it resolves; macOS keeps the display name,
which its app lookup expects.

Fixes anomalyco#61678.
@ElonYangDev

Copy link
Copy Markdown
Author

I noticed that #62174 changed the position of the “Open in” button and caused a conflict. I have rebased onto dev to resolve the conflict caused by the new commits.

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new push only rebases the change onto a newer dev. The fix itself is the same, and the new e2e test, the existing Open in e2e test, the gui-plugins file tests and tsc -b all still pass at the new head. My earlier review had no open points, and I have nothing new to add.

Public API: unchanged.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant