Overview
VS Code provides comprehensive debugging capabilities for its own development. You can debug the main process, extension host, renderer process, and more using the pre-configured launch configurations.All launch configurations are defined in
.vscode/launch.json at the root of the repository.Quick Start
Debug Configurations
Main Configurations
- VS Code (Full)
- VS Code (Hot Reload)
- Launch VS Code Internal
- Main Process
Configuration:
VS CodeType: Compound (multiple processes)Launches VS Code with debuggers attached to:- Main Process
- Renderer Process
- Extension Host
- Shared Process
F5 or select from debug dropdownEnvironment Variables:VSCODE_EXTHOST_WILL_SEND_SOCKET=nullVSCODE_SKIP_PRELAUNCH=1VSCODE_DEV_DEBUG_OBSERVABLES=1
~/.vscode-oss-devProcess-Specific Debugging
Extension Host
Port: 5870Attach to the extension host process where extensions run.Launch Config:
Attach to Extension HostUse Case: Debug extension execution, API calls, language featuresShared Process
Port: 5879Attach to the shared process that handles background tasks.Launch Config:
Attach to Shared ProcessUse Case: Debug services shared across windowsSearch Process
Port: 5876Attach to the search process for debugging file searching.Launch Config:
Attach to Search ProcessUse Case: Debug search functionality, ripgrep integrationPty Host Process
Port: 5877Attach to the pseudoterminal host process.Launch Config:
Attach to Pty Host ProcessUse Case: Debug terminal functionality, shell integrationDebugging Specific Components
Built-in Extensions
- Extension Tests
- Language Features
- Custom Extension
Run and debug extension tests:Available extension test configurations:
- API Tests (single folder)
- API Tests (workspace)
- Git Tests
- Markdown Tests
- TypeScript Tests
- Emmet Tests
Unit Tests
- All Unit Tests
- Current File Tests
- Manual Test Run
Configuration: Runtime: Electron binary from
Debug Unit TestsType: CompoundRuns all unit tests with debugger attached:.build/electron/Environment:MOCHA_COLORS=true
Web Development
- VS Code Web (Chrome)
- VS Code Server
- Manual Launch
Configuration: The pre-launch task starts the web server automatically.
VS Code Web (Chrome)Launch VS Code in Chrome for web development:Advanced Debugging Techniques
Debugging with Source Maps
VS Code is compiled TypeScript with source maps:Set Breakpoints
Set breakpoints directly in TypeScript source files in
src/.
The debugger will map them to the compiled JavaScript.Debugging Observables
To debug observables, install the extension
ms-vscode.debug-value-editor.Debugging Native Modules
For debugging native Node modules:Remote Debugging
Debug VS Code running on a remote machine:Debugging Tips
Use Compound Configurations
Use Compound Configurations
The “VS Code” compound configuration attaches to all processes at once, giving you complete debugging coverage:
Developer Tools
Developer Tools
Access Chrome DevTools in the running instance:
- Command Palette:
Developer: Toggle Developer Tools - Keyboard:
Cmd/Ctrl + Shift + I
- Inspecting DOM elements
- Viewing console logs
- Network requests
- Performance profiling
Logging
Logging
Enable detailed logging:Logs are saved to:
- macOS:
~/Library/Application Support/Code - OSS/logs - Linux:
~/.config/Code - OSS/logs - Windows:
%APPDATA%\Code - OSS\logs
Disable Extensions
Disable Extensions
Disable extensions to isolate issues:Or selectively disable:
Clean User Data
Clean User Data
Start with fresh user data:
Debug Console
Debug Console
Use the Debug Console for REPL during debugging:
- Evaluate expressions
- Call functions
- Inspect variables
Debugging Smoke Tests
Run smoke tests with debugging:Troubleshooting
Debugger Won't Attach
Debugger Won't Attach
- Ensure watch mode is running:
npm run watch - Check that Electron is downloaded:
npm run electron - Increase timeout in launch.json
- Try running
./scripts/code.shfirst
Breakpoints Not Hit
Breakpoints Not Hit
- Verify source maps are generated (check
out/directory) - Ensure
outFilesin launch.json is correct - Check that breakpoint is in executed code path
- Try setting
"pauseForSourceMap": true
Can't See Variables
Can't See Variables
- Enable source map support
- Check variable scope (may be optimized away)
- Try running in non-minified build
Performance Issues
Performance Issues
Debug builds are slower. For performance testing:
- Build with production settings
- Disable source maps temporarily
- Use the Performance Profiler instead of debugger
Next Steps
Running Tests
Learn how to run and write tests
Development Workflow
Understand the development process
Building from Source
Review build instructions
Chrome DevTools
Learn Chrome DevTools features