How to Set Up VS Code with WSL 2 on Windows 10 and 11

Microsoft’s Visual Studio code is very popular and loved by the developer community. The Windows Subsystem for Linux is powerful, but if you integrate Visual Studio Code on your Windows PC to WSL’s kernel, you could do much more in less time and better ways.

Read on as we discuss the WSL and how you can set up VS Code on Windows for a seamless workflow.

4

What Makes WSL 2 So Special?

The Windows Subsystem for Linux (WSL) is a valuable feature that allows Windows users to run Linux distributions like Ubuntu and Kali without setting up a virtual machine or dual-boot.

With WSL, Windows users can directly use Linux command-line tools, applications, and utilities without extra installation steps. The most recent version of WSL, WSL 2, provides greater stability and a dedicated Linux kernel.

A display of Visual Studio Code logo on a laptop

As a developer, you can utilize WSL to develop cross-platform applications without needing dedicated hardware or leaving the Windows ecosystem. Here are some of the essential benefits of using WSL 2.

Why Use Visual Studio Code with WSL 2

VS Code is a robust integrated development environment (IDE) created by Microsoft that supports all sorts of programming languages. Developers prefer using Visual Studio Code because it works on virtually every platform, including macOS, Linux, and Windows. It also has a large community dedicated to building great extensions that make development easier.

As a developer, the ability to use Visual Studio Code for app development on a Windows platform while also running those apps on a Linux kernel is an incredibly advantageous and almost unbelievable feature.

windows logo and linux tux

When you integrate VS Code into the Windows Subsystem for Linux, you can use its specialized Linux kernel to enhance cross-platform compatibility. You can further streamline your workflow by utilizing the integrated terminal within VS Code with WSL 2.

How to Integrate WSL 2 with Visual Studio Code

While the Windows Subsystem for Linux provides a dedicated Linux kernel in which you can run your apps, you can’t directly edit code through its terminal. Fortunately, you can ease your workflow by configuring Visual Studio Code to integrate with your WSL 2 Linux distribution.

How to Install Visual Studio Code

As a prerequisite, you must first ensure VS Code is set up correctly on your Windows PC. Installing VS Code is straightforward and simple, but if you’re unsure, you can check out ourbeginner’s guide to setting up Visual Studio Codeon your Windows PC:

If you’ve already installed VS Code, you need to make sure you can use the terminal to open a directory in VS Code:

Open code in VS Code running 2077 theme

If the option did not appear, then the VS Code configuration is already enabled on your PC.

How to Configure VS Code with WSL 2

Once you’ve ensured VS Code is properly set up on your Windows PC, you can safely connect VS Code to Windows Subsystem for Linux 2:

WSL 2 is Incredible for Developers

If you’re a developer that is not completely satisfied with Linux but still needs to use it for work, we highly recommend getting familiar with WSL 2. It’s an incredible tool that will get better in the years to come.

Installed Windows Subsystem for Linux but don’t know what else to do? Here are seven tips to have a great WSL experience.

Set Up MS VSC

Quality apps that don’t cost anything.

This small feature makes a massive difference.

Your phone is a better editor than you give it credit for.

Turn these settings on, and your iPhone will be so much better than before.

Sometimes the smallest cleaning habit makes the biggest mess.

Technology Explained

PC & Mobile