Table of Contents
This practical guide explains how to set up vs code with wsl 2 on windows 10/11 with clear steps and useful context. It also covers common requirements, potential problems, and the details that can help you get better results.
The following article will discuss WSL and how you can set up VS Code on Windows for a seamless workflow.
Why Use Visual Studio Code with WSL 2?
VS Code is a powerful integrated development environment (IDE) created by Microsoft that supports all kinds of programming languages. Developers prefer to use Visual Studio Code because it works on almost any 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 to develop applications on the Windows platform and run those applications on the Linux kernel is an incredibly handy feature and offers amazing benefits.
When integrating 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 using the built-in terminal in VS Code with WSL 2.
How to Integrate WSL 2 with Visual Studio Code
Although the Windows Subsystem for Linux provides a dedicated Linux kernel so you can run your applications, you cannot directly edit the code through its terminal. Fortunately, you can ease the 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 make sure VS Code is set up correctly on your Windows PC. Installing VS Code is simple and straightforward, but if you're unsure, you can check out TipsMake.com's beginner's guide to setting up Visual Studio Code on a Windows PC:
1. Go to the following link and download the Windows installer.
2. When the download is complete, run the setup.
3. Click Next until you see the Select Additional Tasks step and make sure the Add to PATH option is selected.

4. Complete the installation wizard.
If you have VS Code installed, you need to make sure you can use the terminal to open a folder in VS Code:
- Launch VS Code from the Desktop or Start menu.
- Select Ctrl + Shift + P to open the Command Palette.
- In the search box, type shell command and look for the option Shell Command: Install "code" command in shell PATH.
- Select the option if you can see it. This will allow you to open a folder in Visual Studio Code from the command line.
If the option does not appear, then the VS Code profile is enabled on your PC.
How to Configure vs Code with WSL 2
Once you've made sure VS Code is set up properly on your Windows PC, you can safely connect VS Code to Windows Subsystem for Linux 2:
1. You can move on to the next step if you already have WSL 2 configured on your system. If not, download Ubuntu from the Microsoft Store to get started.
2. Launch the Start menu, search for Visual Studio Code and select the best match.
3. From the side menu pane, click the Extensions icon or use the keyboard shortcut Ctrl + Shift + X to view installed extensions.
4. In the Search Extensions in Marketplace field, search for WSL, select the best match and click Install.

5. Once the extension is installed, launch your WSL 2 distribution (in the case of Ubuntu) via the Start menu. You can also open it via the new Windows Terminal.
6. Navigate to the project folder in WSL 2 with the cd command and then enter the following command to open the folder in VS Code:
code .
7. VS Code now opens your source code in a Windows environment but allows you to debug and test your application in a Linux environment.
If you are a developer who is not completely satisfied with Linux but still need to use it for work, the article really recommends getting familiar with WSL 2. It's an amazing tool that will get better and better. in the coming years.
Conclusion
Understanding VS Code makes it easier to compare options, avoid common mistakes, and apply the information in this guide more effectively. Review the relevant requirements before making changes or choosing a solution.
FAQ
How do you set up vs code with wsl 2 on windows 10/11?
Follow the steps in this guide in order, confirm the required settings or tools, and verify the result before making additional changes.
Is it safe to set up vs code with wsl 2 on windows 10/11?
It is generally safe when you follow the recommended instructions, use trusted tools, and avoid changing settings you do not understand.
What should you do if the process does not work?
Recheck the requirements, restart the device or application when appropriate, and review each step for missed settings or compatibility issues.
Reader Comments 0
Sign in with email or Google to join the discussion.