Skip to main content

Overview

The Electron Main Process (src/vs/code/electron-main/) is the entry point for VS Code’s desktop application. It manages application lifecycle, creates windows, handles native OS integration, and coordinates between multiple renderer processes.

Architecture

Main Process Entry Point

Located in: src/vs/code/electron-main/main.ts

CodeApplication Class

Located in: src/vs/code/electron-main/app.ts

Process Architecture

VS Code uses multiple Electron processes:

Window Management

Located in: src/vs/platform/windows/electron-main/windows.ts

IPC Communication

The main process communicates with renderer processes via IPC:
In renderer process:

Native Integration

Lifecycle Management

Security

VS Code uses Electron’s security best practices:
Preload script provides safe API bridge:

Auto-Update

Protocol Handlers

Key Takeaways

  • The main process is the application entry point and lifecycle manager
  • CodeApplication orchestrates services and window creation
  • IPC enables communication between main and renderer processes
  • Native integration provides OS-specific functionality (menus, dialogs, tray)
  • Security is enforced through sandboxing and context isolation
  • The multi-process architecture isolates concerns and improves stability

Next Steps

Architecture Overview

Return to architecture overview

Workbench Layer

Review the workbench structure