Skip to main content

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

1

Open VS Code

Open the VS Code repository in VS Code:
2

Start Watch Mode

Ensure code is being compiled:
3

Launch Debugger

Press F5 or select the “VS Code” configuration from the Run and Debug view.
4

Wait for Launch

A new VS Code window will open with the debugger attached to all processes.
If launching times out, run ./scripts/code.sh first to set up Electron, or increase the timeout values in launch.json.

Debug Configurations

Main Configurations

Configuration: VS CodeType: Compound (multiple processes)Launches VS Code with debuggers attached to:
  • Main Process
  • Renderer Process
  • Extension Host
  • Shared Process
Usage: Press F5 or select from debug dropdownEnvironment Variables:
  • VSCODE_EXTHOST_WILL_SEND_SOCKET=null
  • VSCODE_SKIP_PRELAUNCH=1
  • VSCODE_DEV_DEBUG_OBSERVABLES=1
User Data: ~/.vscode-oss-dev

Process-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 features

Shared Process

Port: 5879Attach to the shared process that handles background tasks.Launch Config: Attach to Shared ProcessUse Case: Debug services shared across windows

Search Process

Port: 5876Attach to the search process for debugging file searching.Launch Config: Attach to Search ProcessUse Case: Debug search functionality, ripgrep integration

Pty Host Process

Port: 5877Attach to the pseudoterminal host process.Launch Config: Attach to Pty Host ProcessUse Case: Debug terminal functionality, shell integration

Debugging Specific Components

Built-in Extensions

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

Configuration: Debug Unit TestsType: CompoundRuns all unit tests with debugger attached:
Runtime: Electron binary from .build/electron/Environment:
  • MOCHA_COLORS=true

Web Development

Configuration: VS Code Web (Chrome)Launch VS Code in Chrome for web development:
The pre-launch task starts the web server automatically.

Advanced Debugging Techniques

Debugging with Source Maps

VS Code is compiled TypeScript with source maps:
1

Source Map Configuration

Source maps are configured in launch.json:
2

Set Breakpoints

Set breakpoints directly in TypeScript source files in src/. The debugger will map them to the compiled JavaScript.
3

View Original Source

When paused at a breakpoint, the debugger shows the original TypeScript source.

Debugging Observables

To debug observables, install the extension ms-vscode.debug-value-editor.
Enable observable debugging:
This allows you to inspect observable values in the debugger.

Debugging Native Modules

For debugging native Node modules:

Remote Debugging

Debug VS Code running on a remote machine:
1

Start VS Code with Debug Port

On the remote machine:
2

Forward Port

Forward the debug port via SSH:
3

Attach Debugger

Create a launch configuration:

Debugging Tips

The “VS Code” compound configuration attaches to all processes at once, giving you complete debugging coverage:
Access Chrome DevTools in the running instance:
  • Command Palette: Developer: Toggle Developer Tools
  • Keyboard: Cmd/Ctrl + Shift + I
DevTools are useful for:
  • Inspecting DOM elements
  • Viewing console logs
  • Network requests
  • Performance profiling
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 to isolate issues:
Or selectively disable:
Start with fresh user data:
Use the Debug Console for REPL during debugging:
  • Evaluate expressions
  • Call functions
  • Inspect variables
Example:

Debugging Smoke Tests

Run smoke tests with debugging:
Launch configuration:

Troubleshooting

  1. Ensure watch mode is running: npm run watch
  2. Check that Electron is downloaded: npm run electron
  3. Increase timeout in launch.json
  4. Try running ./scripts/code.sh first
  1. Verify source maps are generated (check out/ directory)
  2. Ensure outFiles in launch.json is correct
  3. Check that breakpoint is in executed code path
  4. Try setting "pauseForSourceMap": true
  1. Enable source map support
  2. Check variable scope (may be optimized away)
  3. Try running in non-minified build
Debug builds are slower. For performance testing:
  1. Build with production settings
  2. Disable source maps temporarily
  3. 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