Script Valley
Developer Environment Setup (WSL, Terminal, VS Code)
VS Code Setup and WSL2 IntegrationLesson 5.1

How to install VS Code and connect it to WSL2

VS Code download, Remote Development extension pack, WSL extension, code . command, Remote Explorer, WSL2 server installation, remote indicator

VS Code and WSL2 Integration

VS Code remote WSL connection diagram

VS Code runs as a Windows app but can connect to your WSL2 environment so that all file access, terminal commands, and extensions run on the Linux side. This is the correct way to edit WSL2 projects.

Install VS Code

Download VS Code from code.visualstudio.com and install it on Windows. During install, check Add to PATH so the code command works in terminals.

Install the WSL extension

Open VS Code, press Ctrl+Shift+X, search for WSL (publisher: Microsoft), and install it. This is part of the Remote Development extension pack.

Open a WSL2 project in VS Code

# Inside your WSL2 terminal:
cd ~/projects/my-app
code .

VS Code opens on Windows and installs a small VS Code Server inside WSL2. You will see WSL: Ubuntu in the bottom-left green status bar — this confirms you are editing inside Linux.

Alternatively use the command palette

Press Ctrl+Shift+P, type WSL: Connect to WSL, and select your distro. All terminal sessions you open inside this VS Code window are WSL2 terminals, not Windows PowerShell.

Up next

How to configure VS Code settings and keybindings

Sign in to track progress