Skip to content

desktop: "Open in app" header button opens/copies workspace dir instead of active file; Sublime Text unresolvable on Windows #61678

Open

Description

@mohamad1014

Summary

Desktop "Open in app" header button always opens/copies the workspace directory instead of the active file, and on Windows the Sublime Text entry can't be resolved (openWith: "Sublime Text" fails where, so it falls back to the OS default handler).

Environment

  • opencode version: 2.2.5 (desktop app, bundled CLI opencode-cli.exe reports 2.2.5)
  • OS: Windows_NT 10.0.26200 (win32 x64)
  • Terminal: n/a (desktop app)
  • Shell: C:\WINDOWS\system32\cmd.exe
  • Install/channel: latest, installed via ai.opencode.desktop under %LOCALAPPDATA%\Programs
  • Active plugins: none in ~/.config/opencode/opencode.jsonc

Reproduction

  1. Open any project in the OpenCode desktop app and open a file tab (e.g. board.md).
  2. Click the "Open in" split button at the top right (currently showing the Sublime Text icon).
  3. Observe: the workspace directory (c:\projects\OpenCode) opens in Sublime, not board.md.
  4. Open the same button's dropdown and choose "Copy path": the clipboard gets the directory, not the file.

Expected Behavior

The header "Open in app" button (and its "Copy path" menu item) should target the active file tab's absolute path, falling back to the workspace root only when no file tab is active. "Open in Sublime Text" on Windows should launch subl with the file path.

Actual Behavior

Both actions use screen.file.root (the session directory). Additionally, the Windows app list maps sublime-text to openWith: "Sublime Text"; DesktopFiles.resolveAppPath runs where "Sublime Text", which fails, so FilesOpenPath falls back to shell.openPath (OS default handler) instead of Sublime.

Root cause (from the bundled app.asar, source gui-plugins/src/file/open-in-app.tsx):

  • OpenInAppButton uses path: () => props.screen.file.root, and screen.file.root is session.directory. Both openPath and copyPath default to input.path().
  • WINDOWS_OPEN_APPS uses openWith: "Sublime Text" (display name) instead of the subl CLI, unlike the macOS list which correctly uses app bundle names for open -a.

Additional Context

  • File-level open works correctly elsewhere: the file viewer toolbar uses resolveOpenInAppPath(root, path) and the file tree context menu passes the right-clicked row's path.
  • Verified against the installed bundle at %LOCALAPPDATA%\Programs\ai.opencode.desktop\resources\app.asar (renderer asset open-in-app-*.js).
  • Suggested fix: in OpenInAppButton, prefer the active file tab (ctx.layout.stored(session) + layout.state("file:" + id, session) === "active", path via fileTabPath(screen.file, id)), falling back to screen.file.root; and use openWith: "subl" on Windows/Linux.
  • Reproducible consistently. Workaround: right-click the file in the file tree → "Open in" → Sublime Text.

Activity

  1. opencodejr commented on Nov 4, 2026

    @opencodejr
    Contributor

    Thanks for the detailed report and the root-cause analysis. I couldn't reproduce this end to end. It needs OpenCode Desktop on Windows with Sublime Text installed, and my sandbox can't provide that.

    The current dev code (8568952) still matches what you describe:

    A maintainer with a Windows desktop setup will need to confirm. Until then, your workaround still works: right-click the file in the file tree and use Open in.

  2. added a commit that references this issue on Nov 6, 2026
    b3227ab
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions