Overview
The Workbench Layer (src/vs/workbench/) implements the complete VS Code application UI. It orchestrates the editor, panels, sidebars, and all user-facing features into a cohesive IDE experience.
Directory Structure
Workbench Parts
The workbench is divided into physical UI parts:Layout Structure
Layout Structure
Workbench Main Class
Located in:src/vs/workbench/browser/workbench.ts
Layout Service
IWorkbenchLayoutService - Layout Management
IWorkbenchLayoutService - Layout Management
Located in: Available parts:
src/vs/workbench/services/layout/browser/layoutService.tsParts.TITLEBAR_PART- Title barParts.ACTIVITYBAR_PART- Activity barParts.SIDEBAR_PART- Primary sidebarParts.EDITOR_PART- Editor areaParts.PANEL_PART- Bottom/side panelParts.AUXILIARYBAR_PART- Secondary sidebarParts.STATUSBAR_PART- Status bar
Editor Management
IEditorGroupsService - Multi-Editor Management
IEditorGroupsService - Multi-Editor Management
Located in:
src/vs/workbench/services/editor/common/editorGroupsService.tsEditorPart - Editor Area Implementation
EditorPart - Editor Area Implementation
Located in:
src/vs/workbench/browser/parts/editor/editorPart.tsContribution Model
The workbench uses a contribution-based architecture where features register themselves:Workbench Contributions
Workbench Contributions
Located in: Lifecycle phases:
src/vs/workbench/common/contributions.tsLifecyclePhase.Starting- Very early, before window opensLifecyclePhase.Ready- Window is ready, services availableLifecyclePhase.Restored- Workbench state restoredLifecyclePhase.Eventually- After everything else
Viewlets and Views
Viewlet Contributions - Sidebar Panels
Viewlet Contributions - Sidebar Panels
Views - Panels Within Viewlets
Views - Panels Within Viewlets
Feature Contributions
Thecontrib/ directory contains major features:
- Files
- Search
- Terminal
Located in:
src/vs/workbench/contrib/files/File explorer, file operations, and file management.Debug Contribution
Debug Contribution
Located in:
src/vs/workbench/contrib/debug/SCM (Source Control) Contribution
SCM (Source Control) Contribution
Located in:
src/vs/workbench/contrib/scm/Extension API Implementation
Theapi/ directory implements the VS Code Extension API:
Main Thread vs Extension Host
Main Thread vs Extension Host
Commands and Actions
Command Registration
Command Registration
Menu Contributions
Menu Contributions
Lifecycle Management
Key Takeaways
- The workbench orchestrates all UI parts (editor, sidebar, panel, etc.)
- Features register as contributions and are loaded at specific lifecycle phases
- Editor management supports multiple editor groups in a grid layout
- Views and viewlets provide extensible UI containers
- The Extension API bridges the main thread and extension host process
- Commands and menus are registered in central registries
Next Steps
Electron Main Process
Learn about the Electron main process
Editor Layer
Review the editor implementation