How to set up VS Code with WSL 2 on Windows 10/11
Microsoft's Visual Studio Code is very popular and loved by the developer community. Windows Subsystem for Linux is powerful, but if you integrate Visual Studio Code on your Windows PC with WSL's kernel, you can do a lot in less time and in a better way.
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'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 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.
You should read it
- How to download and install Code Block on Windows 10
- What is Low-Code? And how does it work?
- Steps to initially set up a new SSD on Windows 10
- 6 best code editor apps for Mac
- What is QR code?
- The classic cheat codes, almost every 8x 9x player knows by heart
- Synthesis of useful commands to code the Arduino
- How to Program a Philips Universal Remote
- How to Set Up RCA Controls Without a Code Search Button
- Instructions for fixing device Usb error not recognized Code 43
- What is dress code? Things you need to know
- How to fix error code 43 for NVIDIA or Intel GPUs on Windows
Maybe you are interested
GitHub Copilot is now available for free in VS Code
Latest Sword Master Story Code and How to Enter Code
Latest Roblox Clicker Simulator Codes 12/2024
Ninja Team Code: Ninja Village 3D latest and how to redeem code
Full Giftcode Blue Lock Rivals Roblox latest and how to redeem code
Latest Anime Squad Simulator Codes and How to Enter Codes