How to setup Windows Subsystem Linux (WSL 2) with VSCodium on Windows 10

5.1k views Asked by At

So I am using Ubuntu Linux terminal(also have Debian) in windows 10. according to this site:

https://medium.com/nerd-for-tech/how-to-setup-windows-subsystem-linux-with-visual-studio-code-on-windows-10-b06fdbe9b30b

you need Remote - WSL extention to connect with VScode, I am using VSCodium. So my question is can I install Remote - WSL extention on VSCodium. Or are there any alternatives to configure it without this extension.I saw on VSCodium market and there is no Remote - WSL.

My purpose is with Ubuntu or Debian terminal to create folders and files such html,css,js. I can do all this by entering in desktop environment :

cd /mnt/c/Users/<username>/Desktop

and also can use this commands:

    pwd
    cd 
    cd ..
    clear
    cd /
    cd ~
    mkdir 
    touch 
    mv 

My problem is that I can not open created folder or any app(including VSCodium), for example open existing folder using this command:

open . or open index.html

this commands are not working.can you help with that? how can I open created folder,file or app using terminal. Is there any extension to connect VSCodium to my WSL2 and do all commands above?

2

There are 2 answers

2
Brian Ortiz On

You cannot legally use any of the MS "Remote" extensions as they are closed source and cannot legally be installed on anything other than Microsoft Visual Studio Code, as per the license.

AFAIK there is no open source alternative yet.

0
Paul Norman On

Lack of a well supported remote extension within VSCodium is very inconvenient. I wanted to develop some Go code (other languages may have different requirements). There are currently a few options that I tried:

1. Leave the code in Windows

WSL mounts the Windows drives, so your editor running in Windows can change the local files and Linux will pick the changes up.

Pros:

  • Still editing files locally
  • Intellisense will work as long as all tooling is installed on Windows (for me, Go tools also had to be installed in Windows in addition to WSL)

Cons:

  • No file watcher support (inotify doesn't work) = manual recompilation
  • Slower builds / file access / Docker access

2. Mess with the extension itself

With a few tweaks it's pretty simple to get the VSCode extension running, see: https://github.com/VSCodium/vscodium/issues/1265

Pros:

  • Works as well as in VSCode
  • Can store files fully within Linux to get proper file watching support

Cons:

  • Breaks with any updates (extension / IDE - nothing I tried prevented this despite others having success)
  • Intellisense didn't work for me in Go at all (despite tools being installed in both Linux and Windows)

3. Launch Codium from within WSL (WSLg)

This is what I have ended up using because not being able to see errors in my IDE was too annoying (this is most likely a Go thing though and was no issue for JS when tested).

  • Launch WSL
  • Install VS Codium on WSL
    • wget -qO - https://gitlab.com/paulcarroty/vscodium-deb-rpm-repo/raw/master/pub.gpg | gpg --dearmor | sudo dd of=/usr/share/keyrings/vscodium-archive-keyring.gpg
    • echo 'deb [ signed-by=/usr/share/keyrings/vscodium-archive-keyring.gpg ] https://download.vscodium.com/debs vscodium main' | sudo tee /etc/apt/sources.list.d/vscodium.list
    • sudo apt update && sudo apt install codium
  • Remove the WSL warning nag
    • echo -e >> ~/.bashrc "\nexport GDK_SCALE=2\nalias codium='DONT_PROMPT_WSL_INSTALL=1 codium'"
    • source ~/.bashrc
  • Set Fractional Scaling Support (in Windows) - https://github.com/microsoft/wslg/issues/23
    • Create File: %UserProfile%\.wslgconfig
    • Add:
[system-distro-env]
WESTON_RDP_DEBUG_DESKTOP_SCALING_FACTOR=100
  • Zoom out twice in VSCodium (Ctrl-)

Then in Windows, create a shortcut and in the target field add:

C:\Windows\System32\wsl.exe bash -c "export GDK_SCALE=2 && DONT_PROMPT_WSL_INSTALL=1 codium"

This will launch the WSL version directly.

Pros:

  • Can store files fully within Linux to get proper file watching support
  • IDE intellisense works (even in Go)

Cons:

  • It's a bit slower than native Windows
  • Fractional scaling of WSLg apps is not yet supported, so the standard 150% Windows scaling for 4k screens won't work and you need to adjust font sizes and put up with an oversized / undersized menu bar.