Skip to main content
The Registry is a central pattern in VS Code’s architecture that enables loosely-coupled, extensible component registration. It provides a type-safe way to register and retrieve extensions, configurations, actions, and other platform features.

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:
The global Registry instance is available at:

Common Registry Extension Points

VS Code defines many typed registries for different purposes. Here are the most commonly used ones:
The Configuration Registry manages all settings that appear in VS Code’s settings UI.
The registry provides methods for:
  • registerConfiguration() - Register settings
  • getConfigurations() - Get all registered configurations
  • getConfigurationProperties() - Get all setting properties
  • onDidSchemaChange - Event when configuration schema changes
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 when clauses
  • Weighted priority resolution

Creating Custom Registries

You can create your own registries for custom extension points:
Then consume it elsewhere:

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.

Real-World Example

Here’s how the Color Registry works in VS Code:

See Also