# zuhanit/epscript-lsp architecture

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

- Interactive diagram: https://gitdiagram.com/zuhanit/epscript-lsp
- Repository: https://github.com/zuhanit/epscript-lsp

## Overview

##### Main Components

a. Client-Side (VSCode Extension)
- Components:
- Extension Host (extension.ts)
- Build Manager
- EPS Client
- Offset Manager

b. Language Server (Core)
- This in the middle
- Components:
- Server Core (epsServer.ts)
- Parser System
- Context Manager
- Document Providers
- Diagnostic Manager
- Language Manager

c. Supporting Systems
- On the sides
- Components:
- Grammar System (ANTLR4 based)
- Symbol Table
- Evaluator System
- Built-ins Handler

##### Specific Implementation Details to Highlight

- Language Features:
- Code Completion
- Hover Support
- Highlights
- Signature Help
- Jump to Declaration
- Diagnostics
- Semantic Tokens

- Build System:
- euddraft Integration
- Build Manager
- Offset Selection

##### Additional Elements

Supporting elements:
- Configuration Systems
- I18n Support (showing language options)
- Test Infrastructure
- Webpack Build Pipeline

##### Architectural Patterns to Emphasize

Clear separation of:
- Client/Server Architecture
- Listener Pattern Implementation
- Symbol Table Hierarchy
- Evaluation Pipeline

##### LSP Protocol
- LSP protocol boundary between client and server
- Supported message types

##### File Organization
- Packages structure (editors, server, types)
- Configuration file locations

##### Build System Integration
- How the build manager integrates with euddraft
- Offset management system

Keep the abstraction level high enough to show the overall architecture but detailed enough to show the unique features of this epScript implementation.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles
    classDef client fill:#a8d1f0,stroke:#333
    classDef server fill:#90EE90,stroke:#333
    classDef support fill:#FFE5B4,stroke:#333
    classDef feature fill:#E6E6FA,stroke:#333
    classDef external fill:#D3D3D3,stroke:#333

    %% Client Side
    subgraph ClientLayer["Client Layer (VS Code Extension)"]
        ExtHost["Extension Host"]
        BuildMgr["Build Manager"]
        EPSClient["EPS Client"]
        OffsetMgr["Offset Manager"]
    end

    %% Server Side
    subgraph ServerLayer["Server Layer"]
        ServerCore["Server Core"]
        Parser["Parser System"]
        ContextMgr["Context Manager"]
        DocProviders["Document Providers"]
        DiagMgr["Diagnostic Manager"]
        LangMgr["Language Manager"]
    end

    %% Supporting Systems
    subgraph SupportSystems["Supporting Systems"]
        Grammar["Grammar System"]
        SymbolTable["Symbol Table"]
        Evaluator["Evaluator System"]
        Builtins["Built-ins Handler"]
    end

    %% Language Features
    subgraph Features["Language Features"]
        Completion["Code Completion"]
        Hover["Hover Support"]
        Definition["Definition Support"]
        SignatureHelp["Signature Help"]
        Semantic["Semantic Tokens"]
        DocSymbols["Document Symbols"]
    end

    %% External Systems
    VSCode["VS Code"]:::external
    Euddraft["euddraft"]:::external

    %% Relationships
    VSCode --> ExtHost
    ExtHost --> BuildMgr
    ExtHost --> EPSClient
    ExtHost --> OffsetMgr
    BuildMgr --> Euddraft
    EPSClient <--> ServerCore
    
    ServerCore --> Parser
    Parser --> SymbolTable
    SymbolTable --> ContextMgr
    Grammar --> Parser
    ContextMgr --> DocProviders
    ContextMgr --> DiagMgr
    Builtins --> ContextMgr
    Evaluator --> ContextMgr
    
    DocProviders --> Features
    
    %% Click Events
    click ExtHost "https://github.com/zuhanit/epscript-lsp/blob/master/packages/editors/vscode/src/extension.ts"
    click BuildMgr "https://github.com/zuhanit/epscript-lsp/blob/master/packages/editors/vscode/src/client/buildManager.ts"
    click EPSClient "https://github.com/zuhanit/epscript-lsp/blob/master/packages/editors/vscode/src/client/epsClient.ts"
    click OffsetMgr "https://github.com/zuhanit/epscript-lsp/blob/master/packages/editors/vscode/src/client/offsetManager.ts"
    click ServerCore "https://github.com/zuhanit/epscript-lsp/blob/master/packages/server/src/epsServer.ts"
    click Parser "https://github.com/zuhanit/epscript-lsp/blob/master/packages/server/src/parser.ts"
    click ContextMgr "https://github.com/zuhanit/epscript-lsp/blob/master/packages/server/src/context/facade.ts"
    click DocProviders "https://github.com/zuhanit/epscript-lsp/tree/master/packages/server/src/document/"
    click DiagMgr "https://github.com/zuhanit/epscript-lsp/blob/master/packages/server/src/diagnostic/DiagnosticManager.ts"
    click LangMgr "https://github.com/zuhanit/epscript-lsp/blob/master/packages/server/src/i18n/LanguageManager.ts"
    click Grammar "https://github.com/zuhanit/epscript-lsp/tree/master/packages/server/src/grammar/"
    click SymbolTable "https://github.com/zuhanit/epscript-lsp/tree/master/packages/server/src/context/symbolTable/"
    click Evaluator "https://github.com/zuhanit/epscript-lsp/tree/master/packages/server/src/context/evaluator/"
    click Builtins "https://github.com/zuhanit/epscript-lsp/blob/master/packages/server/src/lib/builtins/builtin.ts"
    click Completion "https://github.com/zuhanit/epscript-lsp/blob/master/packages/server/src/document/completion.ts"
    click Hover "https://github.com/zuhanit/epscript-lsp/blob/master/packages/server/src/document/hover.ts"
    click Definition "https://github.com/zuhanit/epscript-lsp/blob/master/packages/server/src/document/definition.ts"
    click SignatureHelp "https://github.com/zuhanit/epscript-lsp/blob/master/packages/server/src/document/signatureHelp.ts"
    click Semantic "https://github.com/zuhanit/epscript-lsp/blob/master/packages/server/src/document/semanticToken.ts"
    click DocSymbols "https://github.com/zuhanit/epscript-lsp/blob/master/packages/server/src/document/documentSymbol.ts"

    %% Style Applications
    class ExtHost,BuildMgr,EPSClient,OffsetMgr client
    class ServerCore,Parser,ContextMgr,DocProviders,DiagMgr,LangMgr server
    class Grammar,SymbolTable,Evaluator,Builtins support
    class Completion,Hover,Definition,SignatureHelp,Semantic,DocSymbols feature
```
