WSL: (WSL 2) VSCode does not automatically start in Remote WSL mode when opened from Bash command line
-
Your Windows build number: Microsoft Windows [Version 10.0.18917.1000]
-
What you’re doing and what’s happening: When evoking
code <dir>in WSL 2, VSCode opens and doesn’t connect to the Remote WSL server automatically. The program runs within the current terminal context and VSCode closes when the command line version is interrupted.
Powershell:
wsl --set-version Ubuntu 2
WSL bash:
~/code/js$ code .
[main 2019-06-14T05:34:33.398Z] update#setState idle
[main 2019-06-14T05:35:03.409Z] update#setState checking for updates
[main 2019-06-14T05:35:03.451Z] update#setState idle
- What’s wrong / what should be happening instead: The behavior of WSL 1 (which works with this normally):
WSL Bash:
~/code/js$ code .
~/code/js$
code <dir> command is evoked, pauses for a moment, and then returns to command line, while VSCode opens and automatically boots up the Remote WSL server within that folder.
(The rest of the parts were not applicable) If more information is needed, just ask! Thank you WSL team for the work you do. This is my only issue with WSL 2 so far!
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 5
- Comments: 26 (4 by maintainers)
With your default distro set to WSL2, VS Code will open in there and work but not using
code .you have to use “Remote-WSL: New Window” from the command pallet. Once you do this, VS Code will open a new instance running remotely inside WSL2That’s not the nuclear option. 😉
@therealkenc Actually, this seems to fix things. VSCode opens with Remote WSL booting up normally when the version of my Ubuntu install is WSL 1 instead of WSL 2.