Problem Description
The x repo code <id> command currently uses the vscode://file/... URI scheme to open VS Code, which causes the following issues:
- Replaces the active VS Code window: Instead of opening the project in a new window, it replaces the content of the currently active VS Code window.
- Shows a confirmation dialog: The URI scheme trigger pops up a confirmation dialog.
- Interrupts running tasks: Long-running tasks such as
claude-code running in the VS Code integrated terminal may be interrupted unexpectedly.
Related Code
Call Chain
x repo code <id>
→ ___x_cmd_repo_code() # mod/repo/lib/main:114-126
→ ___x_cmd code "$x_" # line 125
→ ___x_cmd_code___main() # mod/code/lib/main:5-15
→ ___x_cmd_code___open() # mod/code/lib/main:17-23
→ x open "vscode://file/$x_" # line 22
Core Problem Code
___x_cmd_code___open(){
local x_
___x_cmd_abspath_ "$1"
[ -n "$x_" ] || return
code:info "x open vscode://file/$x_"
x open "vscode://file/$x_" # ← The problem
}
The current implementation uses the vscode://file/... URI scheme protocol to open VS Code. On macOS, x open eventually invokes the system's open command, which hands the URI off to VS Code. VS Code's default behavior is to replace the content of the current window with the given path and may pop up a confirmation dialog.
Proposed Solution
In ___x_cmd_repo_code, replace ___x_cmd code "$x_" with ___x_cmd_cmds code "$x_" so VS Code is opened via the code CLI binary directly, bypassing the vscode:// URI handler. The code CLI opens a new VS Code window for the given path, which avoids window replacement, the confirmation dialog, and interruption of long-running terminal tasks (e.g. claude-code).
Modified Code
mod/repo/lib/main:114-126:
___x_cmd_repo_code(){
case "${1-}" in
-h|--help) ___x_cmd help -m repo code "$@" ; return 0 ;;
esac
local id="$1"
local x_
___x_cmd_repo_resolve_ "$id"
[ -d "$x_" ] || ___x_cmd_repo_update "$id"
___x_cmd_cmds code "$x_" # ← was: ___x_cmd code "$x_"
}
Why this works
___x_cmd_cmds code "$x_" resolves and invokes the code CLI binary directly (PATH lookup). The CLI tells VS Code to open a new window rooted at $x_, instead of having the OS dispatch the URI and replace the active window.
- This is the same code path already used by
___x_cmd_code___bin() (mod/code/lib/main:25-29), which prefers ___x_cmd_cmds code "$@" whenever the code binary is on PATH. By calling it directly we skip the URI dispatch entirely.
- No new confirmation dialog, no window takeover, and no interference with long-running terminal tasks like
claude-code.
Scope note
The user-facing entrypoint x code <path> still goes through ___x_cmd_code___main → ___x_cmd_code___open and uses the URI scheme. Aligning x code <path> with the same CLI-based behavior is a separate change (e.g. having ___x_cmd_code___main prefer ___x_cmd_code___bin when the CLI is available). The single-line change above is the minimal, targeted fix for x repo code <id>.
Problem Description
The
x repo code <id>command currently uses thevscode://file/...URI scheme to open VS Code, which causes the following issues:claude-coderunning in the VS Code integrated terminal may be interrupted unexpectedly.Related Code
Call Chain
Core Problem Code
The current implementation uses the
vscode://file/...URI scheme protocol to open VS Code. On macOS,x openeventually invokes the system'sopencommand, which hands the URI off to VS Code. VS Code's default behavior is to replace the content of the current window with the given path and may pop up a confirmation dialog.Proposed Solution
In
___x_cmd_repo_code, replace___x_cmd code "$x_"with___x_cmd_cmds code "$x_"so VS Code is opened via thecodeCLI binary directly, bypassing thevscode://URI handler. ThecodeCLI opens a new VS Code window for the given path, which avoids window replacement, the confirmation dialog, and interruption of long-running terminal tasks (e.g.claude-code).Modified Code
mod/repo/lib/main:114-126:Why this works
___x_cmd_cmds code "$x_"resolves and invokes thecodeCLI binary directly (PATH lookup). The CLI tells VS Code to open a new window rooted at$x_, instead of having the OS dispatch the URI and replace the active window.___x_cmd_code___bin()(mod/code/lib/main:25-29), which prefers___x_cmd_cmds code "$@"whenever thecodebinary is onPATH. By calling it directly we skip the URI dispatch entirely.claude-code.Scope note
The user-facing entrypoint
x code <path>still goes through___x_cmd_code___main→___x_cmd_code___openand uses the URI scheme. Aligningx code <path>with the same CLI-based behavior is a separate change (e.g. having___x_cmd_code___mainprefer___x_cmd_code___binwhen the CLI is available). The single-line change above is the minimal, targeted fix forx repo code <id>.