ide vscode

This guide explains how to connect to WSL (Windows Subsystem for Linux) using Visual Studio Code (VSCode).

Environment

  • Windows 10 64-bit
  • Visual Studio Code 1.87.2

Prerequisites

  • Visual Studio Code is already installed.

Setup Flow

  1. Install WSL and Ubuntu
  2. Install the WSL Extension for VSCode
  3. Open a Remote Window

1. Install WSL and Ubuntu

For instructions on installing WSL and Ubuntu, please refer to this guide.

2. Install the WSL Extension for VSCode

Open Visual Studio Code and click on the Extensions icon.
Open Extensions Button

In the search bar, type “wsl”, and install the extension named “WSL” from the results.
WSL Extension

3. Open a Remote Window

Click the Remote Window icon in the bottom-left corner of VSCode.
Remote Window Button

A list of options will appear at the top of VSCode. Click “Connect to WSL”.
Remote Connection Option

You will now be connected to the default WSL distribution, which is Ubuntu.

To open a folder on the Windows side while connected to WSL, click the “Open Folder” button.
Open Folder Button

Windows folders are mounted under the /mnt/ directory in Ubuntu on WSL.
For example, if the folder you want to open is on the C drive, it will be under /mnt/c/.
Example:
Folder Path Input Bar

After entering the folder path, click “OK” to open the folder.