Repository navigation
fix(gui): open the selected file in the header open-in-app actions - #62056
ElonYangDev wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
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
|
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.
826930d to
b3227ab
Compare
|
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. |
There was a problem hiding this comment.
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.
Issue for this PR
Closes #61678, #62040
Type of change
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.
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?
packages/app/e2e/regression/session-header.spec.tsfor 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 typecheckandbun testinpackages/gui-pluginsare green (1086 tests), including the open-in-app launch/check machine tests.bun run lint:changedat the repo root is green for the changed files.revealedoutput in the e2e fixture.Screenshots / recordings
PR.62056-video.mp4
Visual
Checklist
Added by the opencode bot (AI-generated).
Fixes #62040
Fixes #55858