This page describes the VS Code repository (code-oss-dev) at a structural level: its source directory layout, multi-process runtime architecture, and the major subsystems that make up the product. It is the starting point for navigating the codebase.
For startup sequence specifics, see Application Startup and Process Architecture. For the build system, see Build System and CI/CD. For the Monaco editor internals, see Core Editor (Monaco). For the extension system, see Extension System. For the workbench shell and layout, see Workbench Shell.
The repository root is organized into a small number of top-level directories:
| Directory | Purpose |
|---|---|
src/vs/ | All product TypeScript source |
extensions/ | Built-in extensions bundled with the product |
remote/ | Remote Extension Host package (vscode-reh) |
remote/web/ | Web-only remote package (vscode-web) |
build/ | Gulp-based build toolchain and CI scripts |
test/ | Unit, browser, and smoke tests |
Three separate package.json files define distinct dependency sets for the three shipping targets:
| Manifest | Package Name | Target |
|---|---|---|
package.json | code-oss-dev | Full Electron desktop — includes native modules, electron devDep |
remote/package.json | vscode-reh | Remote Extension Host — Node-only, no Electron |
remote/web/package.json | vscode-web | Browser — no native dependencies |
The codebase is divided into strict layers inside src/vs/. A build-time checker (enforced via custom ESLint rules) ensures that lower layers cannot import from higher layers.
Source Layer Hierarchy
| Layer | Path | Key contents |
|---|---|---|
base | src/vs/base/ | Event emitters src/vs/base/common/event.ts46-48 DOM utilities src/vs/base/browser/dom.ts30-42 and VSBuffer src/vs/base/common/buffer.ts1-10 |
editor | src/vs/editor/ | TextModel, ViewModel, CodeEditorWidget, language features, Monaco public API. |
platform | src/vs/platform/ | Injectable services: IFileService src/vs/platform/files/common/fileService.ts39 IConfigurationService src/vs/platform/configuration/common/configurationService.ts31 and ILogService src/vs/platform/log/common/log.ts10 |
workbench | src/vs/workbench/ | Shell layout, editor groups src/vs/workbench/browser/parts/editor/editorParts.ts50 extension host API bridge, and feature contributions src/vs/workbench/workbench.common.main.ts8-145 |
code | src/vs/code/ | Electron main process entry src/vs/code/electron-main/main.ts18 CLI runner src/vs/code/node/cli.ts43 and web bootstrap src/vs/workbench/browser/web.main.ts14 |
sessions | src/vs/sessions/ | Dedicated workbench experience for agentic workflows and AI sessions src/vs/workbench/workbench.common.main.ts14-20 |
Sources: src/vs/workbench/workbench.common.main.ts8-145 src/vs/workbench/workbench.desktop.main.ts15-103 src/vs/workbench/browser/web.main.ts14-22 src/vs/sessions/sessions.common.main.ts1-10
In the Electron (desktop) configuration, VS Code runs as several cooperating OS processes. In the browser configuration, there is no native main process and extension hosts run as web workers.
Desktop Process Architecture
Sources: src/vs/code/electron-main/main.ts18-40 src/vs/workbench/browser/web.main.ts14-22 src/vs/code/node/cli.ts43-60
The Main process is the entry point for the Electron application. It manages the lifecycle of all other processes and handles native OS integration.
EnvironmentMainService src/vs/code/electron-main/main.ts18The renderer is the UI process. On desktop, it is an Electron renderer window; on the web, it runs directly in the browser tab via web.main.ts.
| Entry Point | File | Target |
|---|---|---|
| Desktop workbench | src/vs/workbench/workbench.desktop.main.ts | Electron renderer src/vs/workbench/workbench.desktop.main.ts22 |
| Web workbench | src/vs/workbench/workbench.web.main.ts | Browser src/vs/workbench/workbench.web.main.ts30 |
| Web bootstrap | src/vs/workbench/browser/web.main.ts | Workbench instantiation src/vs/workbench/browser/web.main.ts14 |
The renderer initializes a ServiceCollection src/vs/workbench/browser/web.main.ts9 and uses the IInstantiationService to manage complex dependency graphs.
The CLI entry point handles commands like --install-extension or --version. It may delegate to the running Main process or start a CliMain instance src/vs/code/node/cliProcessMain.ts81
tunnel, serve-web, and agent src/vs/platform/environment/node/argv.ts48chat with modes like ask, edit, and agent src/vs/platform/environment/node/argv.ts51-63Sources: src/vs/code/node/cli.ts43-60 src/vs/platform/environment/node/argv.ts50-103 src/vs/code/node/cliProcessMain.ts81-87
The renderer and extension host communicate through a typed proxy system (IRPCProtocol).
Extension Host RPC Architecture
MainThreadChatAgents2).ExtHostChatAgents2).Sources: src/vs/workbench/workbench.common.main.ts10-42 src/vs/workbench/api/browser/extensionHost.contribution.ts1-10
| Subsystem | Primary Path | Wiki |
|---|---|---|
| Monaco Editor | src/vs/editor/ | Core Editor (Monaco) |
| Extension System | src/vs/workbench/api/ | Extension System |
| Workbench Shell | src/vs/workbench/browser/ | Workbench Shell |
| Integrated Terminal | src/vs/workbench/contrib/terminal/ | Integrated Terminal |
| Debugger | src/vs/workbench/contrib/debug/ | Debugger |
| AI / Chat | src/vs/workbench/contrib/chat/ | AI and Chat Features |
| Agentic Sessions | src/vs/sessions/ | Agentic Sessions Window |
Sources: src/vs/workbench/workbench.common.main.ts8-145 src/vs/workbench/workbench.desktop.main.ts112-147 src/vs/sessions/sessions.common.main.ts1-20
The product's identity and default behavior are governed by product.json. This file specifies the application name, marketplace URLs, and built-in extensions.
Key properties:
applicationName: Internal identifier (e.g., code-oss) product.json4builtInExtensions: Extensions bundled with the distribution product.json38-87defaultChatAgent: Configuration for the default AI assistant (GitHub Copilot), including extensionId and provider details product.json88-149onboardingThemes: Themes presented to the user during the first-run experience product.json197-206Sources: product.json1-206 src/vs/base/common/product.ts67-206
Refresh this wiki
This wiki was recently refreshed. Please wait 6 days to refresh again.