How gitkraken/vscode-gitlens works
Main Components (Core Architecture)
a) Extension Host Layer:
• Main extension entry point (src/extension.ts)
• Container.ts as the dependency injection container
b) Core Services Layer:
• Git Provider Service (src/git/gitProviderService.ts)
• Command System (src/commands/)
• View System (src/views/)
• Webview System (src/webviews/)
• Telemetry Service (src/telemetry/)
c) Feature Modules Layer:
• Annotations System (src/annotations/)
• CodeLens System (src/codelens/)
• Hovers System (src/hovers/)
• AI Integration (src/ai/)
Integration Points
a) External Services:
• Git Integration
• Remote Providers (GitHub, GitLab, Bitbucket, etc.)
• AI Services (OpenAI, Anthropic, etc.)
b) VS Code APIs:
• Source Control API
• WebView API
• Command API
• Window API
Data Flow
• Git commands and responses
• UI updates and user interactions
• Remote provider API calls
• Telemetry data
Key Subsystems
a) Git Integration:
• Git Provider Interface
• Git Models (src/git/models/)
• Git Parsers (src/git/parsers/)
• Git Actions (src/git/actions/)
b) UI Components:
• Views (Commits, Branches, Remotes, etc.)
• Webviews (Home, Settings, Graph, etc.)
• Annotations and CodeLens
• Status Bar Integration
Pro Features Section
Premium features in a separate section:
• Commit Graph
• Worktrees
• Visual File History
• Cloud Patches
• Launchpad
Component Details
For each major component, include:
• Name and purpose
• Key files/modules
• Dependencies
• Communication patterns
Notes
Annotations for:
• Extension activation flow
• Command registration
• View registration
• WebView initialization
• Git provider initialization
Implementation Details
Important patterns like:
• Event system implementation
• Command registration system
• View provider system
• Git provider abstraction
• Modularity of the system
• Clear separation of concerns
• Extension points for Pro features
• Integration with VS Code APIs
• Interaction with external services
This structure reflects GitLens' architecture as a sophisticated VS Code extension with both free and premium features, extensive Git integration, and multiple external service connections.