What is the Workbench?
The workbench (src/vs/workbench/) is responsible for:
- Lifecycle management - Starting up, restoring state, and shutting down the application
- Layout management - Organizing and positioning UI parts
- Service instantiation - Creating and managing singleton services
- Contribution loading - Loading and activating workbench contributions
- Event coordination - Managing global events across the application
The workbench follows a layered architecture where the platform layer provides core services, and the workbench layer builds the UI on top of it.
Workbench Architecture
The workbench is structured into several key layers:Core Workbench Class
Workbench Parts
The workbench is divided into distinct parts, each responsible for a specific area of the UI:Workbench Parts Description
Workbench Parts Description
Lifecycle Phases
The workbench progresses through distinct lifecycle phases during startup:Best Practice: Register contributions in the
AfterRestored or Eventually phase to avoid blocking startup. Only use BlockStartup or BlockRestore for truly critical initialization.Service Initialization
The workbench uses dependency injection for service management:Entry Points
The workbench has different entry points for different environments:- Web
- Desktop
- Common
Workbench Configuration
The workbench can be configured during initialization:Key Responsibilities
1. Error Handling
The workbench sets up global error handlers:2. State Persistence
The workbench manages saving and restoring state:3. Font Rendering
Optimizes font rendering and caching:Next Steps
Workbench Services
Learn about the service layer and dependency injection
Contributions
Understand how to extend the workbench with contributions
Views and Panels
Create custom views and integrate with the sidebar and panel