This writeup assumes you are using Ubuntu for WSL2 on an x64 machine.
- Download the Visual Studio Code package, typically found here: https://code.visualstudio.com/sha/download?build=stable&os=linux-deb-x64
- Update
aptand install the package:sudo apt update && sudo apt install /path/to/code_1.102.3-1753759567_amd64.deb - During installation it should prompt you to install the apt repository and signing key to enable auto-updating using the system's package manager. This is recommended.
- Type
codeto start.
Two things I've noticed so far:
- The window will be drawn tiny if using a high resolution monitor. Use the Electron (Chromium) startup parameter
--force-device-scale-factor=1.xto fix this. - Before startup you will be prompted to install Code for Windows instead. I haven't yet found a reason to needlessly do remote development via SSH over doing it locally inside WSL2. Use the
DONT_PROMPT_WSL_INSTALL=1environment variable to fix this.
Using the above, my ~/bash_aliases includes this:
alias code='DONT_PROMPT_WSL_INSTALL=1 code --force-device-scale-factor=1.75'