Overview
The Registry pattern allows different parts of VS Code to contribute functionality to well-defined extension points without tight coupling. Each extension point is identified by a unique string identifier.Core Registry Interface
The base registry provides three simple operations:Common Registry Extension Points
VS Code defines many typed registries for different purposes. Here are the most commonly used ones:Configuration Registry
Configuration Registry
The Configuration Registry manages all settings that appear in VS Code’s settings UI.The registry provides methods for:
registerConfiguration()- Register settingsgetConfigurations()- Get all registered configurationsgetConfigurationProperties()- Get all setting propertiesonDidSchemaChange- Event when configuration schema changes
Keybindings Registry
Keybindings Registry
The Keybindings Registry stores all keybinding rules including default and extension-provided bindings.The registry manages:
- Primary and secondary keybindings
- Platform-specific bindings (Windows, Mac, Linux)
- Context-aware activation via
whenclauses - Weighted priority resolution
Creating Custom Registries
You can create your own registries for custom extension points:Best Practices
Extension Point Naming: Use descriptive, namespaced extension point IDs like
'platform.configuration' or 'myExtension.providers' to avoid collisions.Type Safety: Always define TypeScript interfaces for your registry implementations and use
Registry.as<T>() with the correct type parameter.Initialization Timing: Registry contributions should happen during module initialization, not lazily. This ensures all contributions are available when needed.