Refactor extension lifecycle to implement a dynamic Feature Registry pattern
- Dominant language
- TypeScript
- Stars
- 193k
- Forks
- 42.4k
- PR merge metrics
- PR metrics pending
Description
## Overview
Currently, the extension activation and configuration change listener rely on hardcoded `if-else` blocks for individual features (e.g., `NpmUpToDateFeature`). As the codebase grows and new extension features are introduced, this approach becomes difficult to scale and maintain.
## Proposed Solution
Introduce a centralized **Feature Registry** pattern using a declarative array (`FeatureDefinition`) combined with a dynamic `Map`.
* **Scalability:** New features can be registered seamlessly via configuration keys and factory functions without modifying core lifecycle logic.
* **Encapsulation:** Configuration synchronization, initialization, and disposal logic are handled centrally and uniformly.
* **Cleanup:** Guarantees proper memory management and resource disposal through `vscode.Disposable` mapping.
## Changes Included
- Added `FeatureDefinition` interface mapping config keys to instantiation factories.
- Replaced manual property checks with iterative feature synchronization over a registry array.
- Improved `dispose` routine to clear active feature instances cleanly.
Contributor guide
Assessment
This issue has not been assessed yet.