Skip to content

fix(web): open remote files correctly in VS Code editors - #10824

Open
KyleKincer wants to merge 1 commit into
pingdotgg:mainfrom
KyleKincer:KYK/fix-remote-vscode-file-path
Open

fix(web): open remote files correctly in VS Code editors#10824
KyleKincer wants to merge 1 commit into
pingdotgg:mainfrom
KyleKincer:KYK/fix-remote-vscode-file-path

Conversation

@KyleKincer

@KyleKincer KyleKincer commented Sep 8, 2026

Copy link
Copy Markdown

What Changed

Opening a remote file from the file preview could connect over SSH and leave an empty VS Code window with ENOTDIR. FilePreviewPanel intentionally passed the selected file's absolute path to OpenInPicker as openInCwd; the URL builder treated every target as a folder.

Rename the picker input to openInPath and require an explicit file/folder kind. File links get a :1 suffix, while project and worktree links keep their folder behavior. The shared fix covers VS Code, Cursor, VS Code Insiders, and VSCodium.

Why

VS Code's remote protocol handler uses a trailing line number to distinguish a file from a folder. The caller already knows which it is, so this needs no filesystem request, extension guessing, project-root restriction, or server protocol change. Local editor launches keep their existing behavior.

Validation:

  • 36 focused tests pass across remoteOpen.test.ts, ChatHeader.test.ts, and ElectronShell.test.ts. Coverage includes all supported remote editor schemes, extensionless files, Windows paths, URL encoding, folders with extensions, and desktop URL forwarding.
  • Web and contracts typechecks pass. Targeted lint passes with two existing warnings on untouched lines; formatting passes.
  • The new file-URL regression failed before the fix. In the real client, the old preview action produced ENOTDIR, and the corrected URL opened the fixture's contents over SSH.

UI Changes

Captured the file-preview button's output in an isolated T3 web environment and replayed it through VS Code's URL handler because the embedded test browser did not launch the custom scheme. Both runs used the same harmless fixture and SSH host. No layout changes.

Before: SSH connected, empty editor After: remote file contents
Before After

Short recording of the remote file opening

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • I included a video for animation/interaction changes

Model: GPT-6. Harness: Codex.

Summary by CodeRabbit

  • Bug Fixes
    • Improved opening files and folders from chat and file previews in remote editors.
    • File paths containing spaces or special characters now open correctly.
    • Remote editor links now open files at the intended location, while folders remain recognized as folders.
    • Added support for additional editor schemes, including VS Code, VS Code Insiders, and VSCodium.
    • Improved handling of Windows paths and remote SSH editor URLs.

FilePreviewPanel passes a selected file to the shared picker. Preserve file or folder intent and add the line suffix VS Code and its forks require for remote file URLs.
@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Sep 8, 2026
@macroscopeapp

macroscopeapp Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at cb4bd66

Macroscope's review found this PR approvable — This is a small, localized fix that distinguishes remote files from folders by adding the VS Code-compatible line suffix while preserving existing folder and local editor behavior. The affected URL-building and forwarding paths have focused regression coverage, with no product-default or static-analysis configuration changes.

You can add or adjust custom eligibility rules. Learn more.

@coderabbitai

coderabbitai Bot commented Sep 8, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 6bb43968-143b-4bff-b62f-7393f72b7e97

📥 Commits

Reviewing files that changed from the base of the PR and between 0fe4c99 and cb4bd66.

📒 Files selected for processing (6)
  • apps/desktop/src/electron/ElectronShell.test.ts
  • apps/web/src/components/chat/ChatHeader.tsx
  • apps/web/src/components/chat/OpenInPicker.tsx
  • apps/web/src/components/files/FilePreviewPanel.tsx
  • apps/web/src/remoteOpen.test.ts
  • packages/contracts/src/editor.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The change distinguishes file and folder paths when opening remote editors. File URLs receive a :1 suffix, while folder URLs do not. OpenInPicker and its call sites now pass the path type. Tests cover encoding, editor schemes, Windows paths, and folder names with extensions.

Changes

Remote editor path handling

Layer / File(s) Summary
URL path-kind contract and encoding
packages/contracts/src/editor.ts, apps/web/src/remoteOpen.test.ts, apps/desktop/src/electron/ElectronShell.test.ts
buildRemoteOpenUrl requires pathKind and appends :1 for files. Tests cover encoded paths, editor schemes, Windows paths, folder extensions, unsupported editors, and desktop URL opening.
OpenInPicker path wiring
apps/web/src/components/chat/OpenInPicker.tsx, apps/web/src/components/chat/ChatHeader.tsx, apps/web/src/components/files/FilePreviewPanel.tsx
OpenInPicker uses openInPath and pathKind for remote URLs, local execution, keyboard shortcuts, dependencies, and button state. Chat passes folders, and file previews pass files.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to cb4bd

Remote file previews now open as files through supported VS Code-based remote editor URLs, while project and worktree launches retain folder behavior. No concrete current-head merge-blocking risk remains.

Suggested reviewers: juliusmarminge, t3dotgg

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 6 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: correcting remote file opening in VS Code editors.
Description check ✅ Passed The description is complete and relevant. It explains the change, the reason, UI impact, validation results, screenshots, recording, and checklist completion.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

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

Labels

size:M 30-99 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant