The Workbench UI Framework provides the structural foundation for the VS Code interface. It manages a parts-based layout system that organizes the editor area, sidebars, panels, and toolbars into a cohesive user experience. The framework is built on a service-oriented architecture, using dependency injection to coordinate complex interactions between the layout, editor management, and view contributions.
The workbench is divided into several distinct Parts, each represented by a class extending Part src/vs/workbench/browser/part.ts29 The Layout class src/vs/workbench/browser/layout.ts143 orchestrates the visibility, sizing, and positioning of these parts using a grid-based system.
TitleBarPart, EditorPart, SidebarPart, PanelPart, AuxiliaryBarPart, and StatusbarPart src/vs/workbench/services/layout/browser/layoutService.ts15SerializableGrid src/vs/workbench/browser/layout.ts28 to maintain the proportional relationship between UI elements via a set of LayoutClasses such as SIDEBAR_HIDDEN, PANEL_HIDDEN, or STATUSBAR_HIDDEN src/vs/workbench/browser/layout.ts98-104IAuxiliaryWindowService src/vs/workbench/browser/layout.ts50 allows the workbench to span across multiple native windows, with certain parts like the Editor area being capable of existing in auxiliary windows via AuxiliaryEditorPart.For details, see Layout and Parts System.
Sources: src/vs/workbench/browser/layout.ts143 src/vs/workbench/services/layout/browser/layoutService.ts15 src/vs/workbench/browser/part.ts29
The Editor area is the central component of the workbench. It is managed by two primary services: IEditorService src/vs/workbench/services/editor/common/editorService.ts19 and IEditorGroupsService src/vs/workbench/services/editor/common/editorGroupsService.ts35
EditorGroupView), which can be split vertically or horizontally src/vs/workbench/browser/parts/editor/editorGroupView.ts65EditorInput src/vs/workbench/common/editor/editorInput.ts28 such as TextResourceEditorInput or DiffEditorInput src/vs/workbench/browser/parts/editor/editor.contribution.ts20-22EditorGroupModel tracks the state of editors within a group, including the Most Recently Used (MRU) order, pinned state, and sticky editors src/vs/workbench/common/editor/editorGroupModel.ts7For details, see Editor Groups and Editor Service.
Sources: src/vs/workbench/services/editor/browser/editorService.ts39 src/vs/workbench/browser/parts/editor/editorGroupView.ts65 src/vs/workbench/common/editor.ts13
Views are specialized UI components (typically trees or lists) that reside within containers like the Sidebar or Panel.
IViewDescriptorService src/vs/workbench/common/views.ts61 which handles the registration and location of view containers.ViewPane instances src/vs/workbench/browser/parts/views/viewPane.ts59ActivitybarPart src/vs/workbench/browser/parts/activitybar/activitybarPart.ts43 provides navigation for switching between view containers. It supports a standard width (48px) and a compact mode (36px) src/vs/workbench/browser/parts/activitybar/activitybarPart.ts48-49For details, see Views, Panels, and Activity Bar.
Sources: src/vs/workbench/common/views.ts61 src/vs/workbench/browser/parts/views/viewPane.ts59 src/vs/workbench/browser/parts/activitybar/activitybarPart.ts43
The following diagram illustrates how the core services interact to form the Workbench UI.
Sources: src/vs/workbench/browser/layout.ts143 src/vs/workbench/services/editor/browser/editorService.ts39 src/vs/workbench/browser/parts/views/viewPaneContainer.ts37
This table bridges the conceptual UI parts to their primary implementation classes and associated services.
| UI Concept | Code Entity (Class) | Primary Service |
|---|---|---|
| Main Layout | Layout src/vs/workbench/browser/layout.ts143 | IWorkbenchLayoutService |
| Editor Area | EditorPart src/vs/workbench/browser/parts/editor/editorPart.ts89 | IEditorGroupsService |
| Sidebar | SidebarPart src/vs/workbench/browser/parts/sidebar/sidebarPart.ts25 | IPaneCompositePartService |
| Activity Bar | ActivitybarPart src/vs/workbench/browser/parts/activitybar/activitybarPart.ts43 | IViewDescriptorService |
| Status Bar | StatusbarPart src/vs/workbench/browser/parts/statusbar/statusbarPart.ts64 | IStatusbarService |
| Title Bar | BrowserTitlebarPart src/vs/workbench/browser/parts/titlebar/titlebarPart.ts91 | ITitleService |
Sources: src/vs/workbench/browser/parts/editor/editorGroupView.ts65 src/vs/workbench/browser/parts/views/viewPaneContainer.ts37 src/vs/workbench/common/editor.ts97
AuxiliaryWindowService.EditorInput types, and EditorGroupModel.ViewPaneContainer, and the composite bar.ThemeIcon, and CSS variables.IConfigurationService, and command shortcuts.Refresh this wiki
This wiki was recently refreshed. Please wait 7 days to refresh again.