# talv/vscode-sc2-galaxy architecture

> Architecture diagram of the GitHub repository talv/vscode-sc2-galaxy, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/talv/vscode-sc2-galaxy
- Repository: https://github.com/talv/vscode-sc2-galaxy

## Overview

##### Main Components
- VS Code Extension Host: At the center of the design is the VS Code platform where the extension runs.
- Extension Entry Point: The main source file (src/extension.ts) acts as the initializer, registering commands, language features, and integration points.
- Language Features:
- Syntax Highlighting: Represented by the syntaxes folder (e.g., syntaxes/galaxy.json) that defines the grammar.
- Code Snippets: Indicated by the snippets folder (snippets/general.json) for quick code insertions.
- Language Configuration: The language-configuration.json file that helps define comment styles, brackets, etc.
- Feature Modules Activated by the Extension:
- Code Diagnostics and Typechecking: This component handles real time code validation.
- Code Completions and Context-Aware Suggestions: This includes signature help, hover tooltips, goto definition, navigation, symbol rename, and references.
- Indexing of external assets: Linking with game data (e.g., *Data.xml files) and Trigger scheme files; though the actual indexing logic uses the external [plaxtony] library.
- Assets and Supporting Documentation:
- Assets: Visual demonstrations (assets folder) and documentation (docs folder) that help illustrate functionalities and guide users.
- Package and Build Configurations: Files like package.json, tsconfig.json, .editorconfig, and others that define dependencies and configurations.

##### Relationships and Interactions
- The VS Code Extension Host interacts with the extension written in src/extension.ts.
- Within the extension, there are clear connections between the registered language features and their configuration files (syntax, snippets, language configuration).

##### Architectural Patterns/Design Principles
- Integration with a Host Platform: Clearly illustrate how the extension interacts with the VS Code API and extension host mechanisms.
- External Dependencies: Note the dependency on the plaxtony library for specific functionalities (indexing triggers and game data), which is more like a plug-in or helper module.

## Diagram (Mermaid)

```mermaid
graph TD
    %% VS Code Platform Layer
    subgraph "VS Code Platform Layer"
        UI["User Interaction (typing,hovering)"]:::host
        VSC["VS Code Extension Host"]:::host
    end

    %% Extension Backend Layer
    subgraph "Extension Backend Layer"
        EXT["Extension Entry Point (src/extension.ts)"]:::core

        subgraph "Language Features"
            SYNTAX["Syntax Highlighting (syntaxes/galaxy.json)"]:::config
            SNIPPETS["Code Snippets (snippets/general.json)"]:::config
            LANGCFG["Language Configuration (language-configuration.json)"]:::config
        end

        subgraph "Feature Modules"
            DIAG["Diagnostics & Typechecking"]:::core
            COMPLETIONS["Code Completions & Suggestions"]:::core
            INDEX["Indexing External Assets"]:::core
            PLAX["Plaxtony Integration"]:::external
        end

        subgraph "Assets & Documentation"
            ASSETS["Visual Assets (assets)"]:::assets
            DOCS["Documentation & Guides (docs)"]:::assets
        end

        subgraph "Package & Build Configurations"
            PKG["package.json"]:::config
            TSCONFIG["tsconfig.json"]:::config
            EDITORCFG[".editorconfig"]:::config
        end
    end

    %% Connections - User Interaction and VS Code Platform
    UI -->|"triggers"| VSC
    VSC -->|"launches"| EXT

    %% Connections - Extension registering language features
    EXT -->|"registers"| SYNTAX
    EXT -->|"registers"| SNIPPETS
    EXT -->|"registers"| LANGCFG

    %% Connections - Extension activating feature modules
    EXT -->|"invokes"| DIAG
    EXT -->|"invokes"| COMPLETIONS
    EXT -->|"activates"| INDEX
    INDEX -->|"uses"| PLAX

    %% Click Events
    click EXT "https://github.com/talv/vscode-sc2-galaxy/blob/master/src/extension.ts"
    click SYNTAX "https://github.com/talv/vscode-sc2-galaxy/blob/master/syntaxes/galaxy.json"
    click SNIPPETS "https://github.com/talv/vscode-sc2-galaxy/blob/master/snippets/general.json"
    click LANGCFG "https://github.com/talv/vscode-sc2-galaxy/blob/master/language-configuration.json"
    click ASSETS "https://github.com/talv/vscode-sc2-galaxy/tree/master/assets"
    click DOCS "https://github.com/talv/vscode-sc2-galaxy/tree/master/docs"
    click PKG "https://github.com/talv/vscode-sc2-galaxy/blob/master/package.json"
    click TSCONFIG "https://github.com/talv/vscode-sc2-galaxy/blob/master/tsconfig.json"
    click EDITORCFG "https://github.com/talv/vscode-sc2-galaxy/blob/master/.editorconfig"

    %% Class definitions for styling
    classDef host fill:#FFD700,stroke:#333,stroke-width:2px;
    classDef core fill:#87CEFA,stroke:#333,stroke-width:2px;
    classDef config fill:#90EE90,stroke:#333,stroke-width:2px;
    classDef external fill:#FFB6C1,stroke:#333,stroke-width:2px;
    classDef assets fill:#FFA07A,stroke:#333,stroke-width:2px;
```
