# myzel394/config-lsp architecture

> Architecture diagram of the GitHub repository myzel394/config-lsp, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/myzel394/config-lsp
- Repository: https://github.com/myzel394/config-lsp

## Overview

##### Main Components Identification

The system should be divided into these primary components:

a) Core Server Component
- Root Handler (server/root-handler/)
- Common Services (server/common/)
- Document Values (server/doc-values/)

b) File-Specific Handlers
- SSH Config
- SSHD Config
- Fstab
- Hosts
- Aliases
- Wireguard

c) Client Integration
- VS Code Extension
- Other Editor Support

**[Editor Clients Layer]**

- ▼
**[LSP Protocol Layer]**

- ▼
**[Root Handler Layer]**

- ▼
**[File-Specific Handlers Layer]**

- ▼
**[Parsing & Analysis Layer]**

##### Component Details

For each handler, show these common elements:
- AST Parser
- Analyzer
- LSP Feature Handlers
- Fields Definitions
- Document Indexing

##### Data Flow Representation

- Editor ↔ LSP Protocol
- LSP Protocol ↔ Root Handler
- Root Handler ↔ File-Specific Handlers
- Handlers ↔ Parsers/Analyzers

##### Feature Support Matrix

A small matrix showing supported features per file type (as shown in README)

##### Implementation Details

Specific architectural patterns:
- ANTLR4 Grammar-based parsing
- Shared documentation and common utilities
- Handler-specific implementations
- Extension points for new file types

##### Integration Points

External integration with:
- Editor-specific extensions
- LSP protocol implementation
- File system interactions
- External command execution (e.g., wireguard commands)

##### Notes

Annotations for:
- Supported LSP features
- File type detection mechanism
- Handler selection logic
- Common utility usage

- Nested components
- Clear text labels
- Proper grouping of related components

Remember to emphasize the modular nature of the system, showing how new file type handlers can be added without affecting existing components.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Clients
        VSCode["VS Code Extension"]
        OtherEditors["Other Editors"]
    end

    subgraph "LSP Protocol Layer"
        LSPImpl["LSP Protocol Implementation"]
        RootHandler["Root Handler"]
    end

    subgraph "Common Components"
        CommonServices["Common Services"]
        DocValues["Document Values System"]
        CommonDocs["Common Documentation"]
        ParserUtils["Parser Utilities"]
        CoreUtils["Core Utilities"]
    end

    subgraph "File-Specific Handlers"
        SSHConfig["SSH Config Handler"]
        SSHDConfig["SSHD Config Handler"]
        FstabHandler["Fstab Handler"]
        HostsHandler["Hosts Handler"]
        AliasesHandler["Aliases Handler"]
        WireguardHandler["Wireguard Handler"]
    end

    subgraph "Handler Components"
        Parser["AST Parser"]:::parser
        Analyzer["Analyzer"]:::analyzer
        FeatureHandlers["LSP Feature Handlers"]:::feature
        FieldsDefs["Fields Definitions"]:::fields
        DocIndex["Document Indexing"]:::index
    end

    %% Connections
    Clients --> LSPImpl
    LSPImpl --> RootHandler
    RootHandler --> CommonServices
    RootHandler --> DocValues

    RootHandler --> SSHConfig
    RootHandler --> SSHDConfig
    RootHandler --> FstabHandler
    RootHandler --> HostsHandler
    RootHandler --> AliasesHandler
    RootHandler --> WireguardHandler

    SSHConfig & SSHDConfig & FstabHandler & HostsHandler & AliasesHandler & WireguardHandler --> Parser
    Parser --> Analyzer
    Analyzer --> FeatureHandlers
    FeatureHandlers --> DocIndex
    FeatureHandlers --> FieldsDefs

    CommonServices --> ParserUtils
    CommonServices --> CoreUtils
    CommonServices --> CommonDocs

    %% Click Events
    click VSCode "https://github.com/Myzel394/config-lsp/tree/main/vs-code-extension/"
    click RootHandler "https://github.com/Myzel394/config-lsp/tree/main/server/root-handler/"
    click LSPImpl "https://github.com/Myzel394/config-lsp/tree/main/server/root-handler/lsp/"
    click CommonServices "https://github.com/Myzel394/config-lsp/tree/main/server/common/"
    click DocValues "https://github.com/Myzel394/config-lsp/tree/main/server/doc-values/"
    click CommonDocs "https://github.com/Myzel394/config-lsp/tree/main/server/common-documentation/"
    click ParserUtils "https://github.com/Myzel394/config-lsp/tree/main/server/common/parser/"
    click CoreUtils "https://github.com/Myzel394/config-lsp/tree/main/server/utils/"
    click SSHConfig "https://github.com/Myzel394/config-lsp/tree/main/server/handlers/ssh_config/"
    click SSHDConfig "https://github.com/Myzel394/config-lsp/tree/main/server/handlers/sshd_config/"
    click FstabHandler "https://github.com/Myzel394/config-lsp/tree/main/server/handlers/fstab/"
    click HostsHandler "https://github.com/Myzel394/config-lsp/tree/main/server/handlers/hosts/"
    click AliasesHandler "https://github.com/Myzel394/config-lsp/tree/main/server/handlers/aliases/"
    click WireguardHandler "https://github.com/Myzel394/config-lsp/tree/main/server/handlers/wireguard/"

    %% Styles
    classDef default fill:#f9f9f9,stroke:#333,stroke-width:2px
    classDef parser fill:#90EE90,stroke:#333
    classDef analyzer fill:#FFD700,stroke:#333
    classDef feature fill:#DDA0DD,stroke:#333
    classDef fields fill:#87CEEB,stroke:#333
    classDef index fill:#F08080,stroke:#333

    %% Legend
    subgraph Legend
        P["Parser"]:::parser
        A["Analyzer"]:::analyzer
        F["Feature Handler"]:::feature
        FD["Fields Definition"]:::fields
        I["Index"]:::index
    end
```
