Repository navigation
fix: combine URI flags to prevent Electron argument filtering on Windows - #308150
Merged
Dmitriy Vasyura (dmitrivMS) merged 7 commits intoMay 28, 2026
Merged
Dmitriy Vasyura (dmitrivMS) merged 7 commits into
Dmitriy Vasyura (dmitrivMS) merged 7 commits into
Conversation
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
Contributor
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: Benjamin Pasero (@bpasero)Matched files:
|
This was referenced Apr 27, 2026
Resolve conflict in src/vs/code/node/cli.ts. Extract combineUriFlags into src/vs/code/node/cliArgs.ts, shorten the comment, drop the Set in favor of a direct compare, and add unit tests.
Collaborator
|
Did some cleanup, added tests. |
Collaborator
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses a Windows-specific VS Code CLI issue where Electron/Chromium filters standalone URL-like argv tokens (containing ://), causing --folder-uri / --file-uri invocations to fail depending on argument ordering. The fix rewrites these options into --flag=value form before spawning the Electron process so the URI is no longer a standalone argv entry.
Changes:
- Add
combineUriFlags(args)helper to join--folder-uri <value>/--file-uri <value>into--flag=value. - Apply the rewrite on Windows in
src/vs/code/node/cli.tsright before spawningprocess.execPath. - Add unit tests for the argument rewrite helper.
Show a summary per file
| File | Description |
|---|---|
| src/vs/code/test/node/cliArgs.test.ts | Adds unit tests covering --folder-uri/--file-uri rewriting behavior. |
| src/vs/code/node/cliArgs.ts | Introduces combineUriFlags helper that joins URI flags with their values. |
| src/vs/code/node/cli.ts | Uses combineUriFlags on Windows when spawning the Electron process to avoid Chromium filtering. |
Copilot's findings
- Files reviewed: 3/3 changed files
- Comments generated: 1
Dmitriy Vasyura (dmitrivMS)
enabled auto-merge (squash)
May 27, 2026 23:55
Dmitriy Vasyura (dmitrivMS)
approved these changes
May 27, 2026
Dmitriy Vasyura (dmitrivMS)
requested review from
Robo (deepak1556)
and removed request for
Robo (deepak1556)
May 28, 2026 00:34
roblourens
approved these changes
May 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #209072
Summary
://(treated as URLs). This causes--folder-uriand--file-urito fail silently when the URI value is not the last argument.cli.ts, combine--folder-uriand--file-uriflags with their values using=syntax (e.g.,--folder-uri=vscode-remote://...), so Chromium treats them as--prefixed flags rather than standalone URL arguments.Test plan
code --folder-uri vscode-remote://ssh-remote+host@workspace --new-window— should open the remote workspacecode --folder-uri vscode-remote://ssh-remote+host@workspace --wait --new-window— should open and waitcode --file-uri vscode-remote://ssh-remote+host@/path/file.txt --new-window— should open the remote file--folder-uristill works as the last argument (existing behavior preserved)