# tekumara/typos-lsp architecture

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

- Interactive diagram: https://gitdiagram.com/tekumara/typos-lsp
- Repository: https://github.com/tekumara/typos-lsp

## Overview

##### Main Components

a) Editor Integration Layer
- VS Code Extension component (TypeScript-based)
- Other Editor Support (Neovim, Helix, Zed)

b) LSP Server Core (Rust-based)
- Main LSP Server component (from typos-lsp crate)
- State Management module
- Typos Integration module
- Windows-specific handling

c) External Dependencies
- Typos library (external spell checking engine)
- Configuration Management (typos.toml handling)

##### Specific Implementation Details

- LSP Protocol Handlers (from lsp.rs)
- State Management (from state.rs)
- Typos Integration Layer (from typos.rs)
- Platform-specific code (from windows.rs)

##### Data Flow Representation

Following flows:

##### Additional Elements

Annotations for:
- Configuration file locations (typos.toml, _typos.toml, .typos.toml)
- Supported file types
- Quick Fix capability
- Workspace context boundaries

##### Technical Details to Highlight

Emphasize:
- Rust-based server implementation
- TypeScript-based VS Code extension
- LSP protocol compliance
- File system interactions
- Configuration management
- Binary vs text file handling

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles
    classDef editor fill:#a8d1f0,stroke:#333
    classDef server fill:#90EE90,stroke:#333
    classDef external fill:#FFE5B4,stroke:#333
    classDef config fill:#FFB6C1,stroke:#333
    classDef test fill:#E6E6FA,stroke:#333

    %% Editor Layer
    subgraph Editors
        VSCode["VS Code Extension"]:::editor
        Helix["Helix Editor"]:::editor
        Neovim["Neovim"]:::editor
        Zed["Zed Editor"]:::editor
    end

    %% LSP Server Core
    subgraph ServerCore
        MainServer["LSP Server Core"]:::server
        LSPHandlers["LSP Protocol Handlers"]:::server
        StateManager["State Management"]:::server
        TyposIntegration["Typos Integration"]:::server
        WindowsHandler["Windows Handler"]:::server
    end

    %% External Components
    subgraph External
        TyposLib["Typos Library"]:::external
        ConfigFiles["Configuration Files"]:::config
    end

    %% Testing Infrastructure
    subgraph Testing
        VSCodeTests["VS Code Tests"]:::test
        LSPTests["LSP Integration Tests"]:::test
    end

    %% Relationships
    VSCode --> MainServer
    Helix --> MainServer
    Neovim --> MainServer
    Zed --> MainServer
    MainServer --> VSCode
    MainServer --> Helix
    MainServer --> Neovim
    MainServer --> Zed

    MainServer --- LSPHandlers
    MainServer --- StateManager
    MainServer --- TyposIntegration
    MainServer --- WindowsHandler

    TyposIntegration --> TyposLib
    ConfigFiles -.-> MainServer

    VSCodeTests -.-> VSCode
    LSPTests -.-> MainServer

    %% Click Events
    click VSCode "https://github.com/tekumara/typos-lsp/blob/main/src/extension.ts"
    click Helix "https://github.com/tekumara/typos-lsp/blob/main/docs/helix-config.md"
    click Neovim "https://github.com/tekumara/typos-lsp/blob/main/docs/neovim-lsp-config.md"
    click Zed "https://github.com/tekumara/typos-lsp/blob/main/docs/zed-config.md"
    click MainServer "https://github.com/tekumara/typos-lsp/blob/main/crates/typos-lsp/src/main.rs"
    click LSPHandlers "https://github.com/tekumara/typos-lsp/blob/main/crates/typos-lsp/src/lsp.rs"
    click StateManager "https://github.com/tekumara/typos-lsp/blob/main/crates/typos-lsp/src/state.rs"
    click TyposIntegration "https://github.com/tekumara/typos-lsp/blob/main/crates/typos-lsp/src/typos.rs"
    click WindowsHandler "https://github.com/tekumara/typos-lsp/blob/main/crates/typos-lsp/src/windows.rs"
    click ConfigFiles "https://github.com/tekumara/typos-lsp/blob/main/.typos.toml"
    click VSCodeTests "https://github.com/tekumara/typos-lsp/blob/main/src/test/suite/integration.test.ts"
    click LSPTests "https://github.com/tekumara/typos-lsp/blob/main/crates/typos-lsp/tests/integration_test.rs"

    %% Legend
    subgraph Legend
        Editor["Editor Components"]:::editor
        Server["Server Components"]:::server
        Ext["External Components"]:::external
        Conf["Configuration"]:::config
        Test["Testing"]:::test
    end
```
