Skip to main content

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:

Workbench Main Class

Located in: src/vs/workbench/browser/workbench.ts

Layout Service

Located in: src/vs/workbench/services/layout/browser/layoutService.ts
Available parts:
  • Parts.TITLEBAR_PART - Title bar
  • Parts.ACTIVITYBAR_PART - Activity bar
  • Parts.SIDEBAR_PART - Primary sidebar
  • Parts.EDITOR_PART - Editor area
  • Parts.PANEL_PART - Bottom/side panel
  • Parts.AUXILIARYBAR_PART - Secondary sidebar
  • Parts.STATUSBAR_PART - Status bar

Editor Management

Located in: src/vs/workbench/services/editor/common/editorGroupsService.ts
Located in: src/vs/workbench/browser/parts/editor/editorPart.ts

Contribution Model

The workbench uses a contribution-based architecture where features register themselves:
Located in: src/vs/workbench/common/contributions.ts
Lifecycle phases:
  • LifecyclePhase.Starting - Very early, before window opens
  • LifecyclePhase.Ready - Window is ready, services available
  • LifecyclePhase.Restored - Workbench state restored
  • LifecyclePhase.Eventually - After everything else

Viewlets and Views

Feature Contributions

The contrib/ directory contains major features:
Located in: src/vs/workbench/contrib/files/File explorer, file operations, and file management.
Located in: src/vs/workbench/contrib/debug/
Located in: src/vs/workbench/contrib/scm/

Extension API Implementation

The api/ directory implements the VS Code Extension API:
Extensions run in a separate process and communicate with the main thread via IPC.

Commands and Actions

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