Developing with VS Code on WSL 2

Developing with VS Code on WSL 2

ยท

2 min read

VS Code ๐Ÿคฏ

VS Code seems to be the 1 size fit all code editor. VS Code offers really seamless integration to develop on a remote connection such as the WSL 2 with the simple installation of an extension.

Develop in WSL 2 on VS Code

If you don't have it already, install VS Code from the official site.

https://code.visualstudio.com/download

(You can also download the insiders build if you like living on the bleeding edge)

While installing VS Code, make sure to check the Add to Path option.

VS Code add to path

All you need to do is install the Remote - WSL Extension

image.png

Start a WSL 2 remote session Press Ctrl + Shift + P and type in new wsl window to open up a new WSL 2 window and select the option

image.png

A new WSL 2 window should open up from the directory you were using. VS Code WSL 2 window

It is advised to use VS Code from the Linux file system instead of the windows'. To do this just use the Open Folder option from the File menu.

Just traverse to ~ or $HOME directory and then add the projects to the Linux file system and use them from there.

Open projects from Linux directory

Upon opening any projects in WSL window, you will see the WSL 2.0 connection on the bottom-left as well as the title bar.

Project on WSL 2.png

๐ŸŽ‰๐ŸŽ‰๐ŸŽ‰ That was it, now you can work on any project with VS Code inside WSL.

Feel free to reach out to me on Twitter @cryptus_neoxys and connect with me on LinkedIn.


Refs & Resources

Microsoft Docs

If you loved the article and would like to support me, you can buy me a coffee.

ย