Open apgrucza opened 1 year ago
(comment copied from #1029)
I had a poke around myself in internal/boxcli/integrate.go
and made these observations:
code
command actually runs a shell script from VS Code Server rather than the Windows VS Code executable. This is because VS Code has modified PATH
to include an entry like /home/XXXX/.vscode-server/bin/XXXX/bin/remote-cli
.code
shell script runs JavaScript code which fails to start a new VS Code process because the parent VS Code process has been terminated.If HOME
is set, the Windows executable can be run instead, and environment variables do get passed through. So I'm not sure if this is the best way, but the below changes to integrate.go
do work as a proof-of-concept under WSL:
cmnd := exec.Command(os.Getenv("VSCODE_CWD")+"/bin/code", message.ConfigDir)
cmnd.Env = append(cmnd.Env, envVars...)
cmnd.Env = append(cmnd.Env, "HOME="+os.Getenv("HOME")) // Prevent error: mkdir: cannot create directory ‘/.vscode-server’: Permission denied
cmnd.Env = append(cmnd.Env, "ELECTRON_RUN_AS_NODE=") // Prevent error: Remote Extension host terminated unexpectedly 3 times within the last 5 minutes.
any updates on this? or a workaround
Current Behavior (bug) The "Reopen in Devbox shell environment" command does not work in a VS Code WSL window. The VS Code window closes without a new one being opened. There is no error message stating that WSL is not supported. (The error message added in #1277 only appears when in a normal VS Code window, not a WSL one).
Expected Behavior (fix) After the VS Code window closes, a new VS Code window should open that is set up with the project's Devbox environment.
Additional context Output of
devbox version -v
: