Skip to content

fix: combine URI flags to prevent Electron argument filtering on Windows#308150

Open
maruthang wants to merge 1 commit intomicrosoft:mainfrom
maruthang:fix/issue-209072-folder-uri-windows
Open

fix: combine URI flags to prevent Electron argument filtering on Windows#308150
maruthang wants to merge 1 commit intomicrosoft:mainfrom
maruthang:fix/issue-209072-folder-uri-windows

Conversation

@maruthang
Copy link
Copy Markdown
Contributor

@maruthang maruthang commented Apr 7, 2026

Fixes #209072

Summary

  • On Windows, Electron/Chromium's security layer filters out standalone command-line arguments that contain :// (treated as URLs). This causes --folder-uri and --file-uri to fail silently when the URI value is not the last argument.
  • Before spawning the Electron process in cli.ts, combine --folder-uri and --file-uri flags with their values using = syntax (e.g., --folder-uri=vscode-remote://...), so Chromium treats them as -- prefixed flags rather than standalone URL arguments.
  • This approach follows the suggestion from @deepak1556 in the issue comments to encode/transform the URI argument.

Test plan

  • On Windows, run code --folder-uri vscode-remote://ssh-remote+host@workspace --new-window — should open the remote workspace
  • On Windows, run code --folder-uri vscode-remote://ssh-remote+host@workspace --wait --new-window — should open and wait
  • On Windows, run code --file-uri vscode-remote://ssh-remote+host@/path/file.txt --new-window — should open the remote file
  • Verify --folder-uri still works as the last argument (existing behavior preserved)
  • Verify non-URI arguments are unaffected

On Windows, Electron/Chromium's security layer filters out standalone
command-line arguments that look like URLs (containing "://"). This
causes --folder-uri and --file-uri to fail silently when the URI value
is not the last argument.

Combine --folder-uri and --file-uri with their values using "=" syntax
before spawning the Electron process, so Chromium treats them as flags
rather than standalone URL arguments.

Fixes microsoft#209072
@vs-code-engineering
Copy link
Copy Markdown
Contributor

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

@bpasero

Matched files:

  • src/vs/code/node/cli.ts

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CLI on Windows: --folder-uri option only works as the last argument and when the --wait option is not present

2 participants