Debugging Like a Pro
VS Code's built-in debugger works across Node.js, Python, Go, Rust, C++ and more. This lesson covers the full debugging workflow: breakpoints, stepping, watch expressions, and launch configs.
1The Debug View
Press Ctrl+Shift+D to open the Run & Debug view. From here you can create a launch.json, start/stop debugging sessions, and inspect the Call Stack, Variables, Watch, and Breakpoints panels.
2Breakpoints
Click the gutter (left of line numbers) to add a breakpoint. Right-click for advanced options:
- Conditional breakpoint — only breaks when an expression is true
- Hit count breakpoint — breaks after N hits
- Logpoint — logs a message without stopping (great for production-like debugging)
3Stepping Controls
F5 Continue / Start F10 Step over F11 Step into Shift+F11 Step out Shift+F5 Stop Ctrl+Shift+F5 Restart
4The Debug Console & REPL
While paused, use the Debug Console as a live REPL. Evaluate expressions, call functions, and mutate variables on the fly. This is much faster than adding print statements and re-running.
5launch.json Configuration
A launch.json file in .vscode/ defines named debug configurations. You can have multiple — one for the dev server, one for unit tests, one for a specific script:
{ "configurations": [{ "type": "node", "request": "launch", "name": "Dev Server", "runtimeExecutable": "npm", "runtimeArgs": ["run","dev"] }] }