# andythigpen/nvim-coverage architecture

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

- Interactive diagram: https://gitdiagram.com/andythigpen/nvim-coverage
- Repository: https://github.com/andythigpen/nvim-coverage

## Overview

##### Main Components Structure
a. Core Layer (top)
b. Language Support Layer (middle)
c. Parser Layer (bottom)

##### Component Details

Core Layer:
- Config Manager (config.lua)
- Sign Manager (signs.lua)
- Manager (highlight.lua)
- Report Generator (report.lua)
- Summary Generator (summary.lua)
- Watch Service (watch.lua)

Language Support Layer:
- Common Language Interface (languages/common.lua)
- Individual Language Modules (group the 20+ language files)
- Inheritance/implementation relationship from common to specific

Parser Layer:
- "Parsers" container with:
- LCOV Parser (lcov.lua)
- Cobertura Parser (parsers/corbertura.lua)

##### Interactions and Data Flow
- External coverage file → Parsers
- Parsers → Language Handlers
- Language Handlers → Core Module components
- Core Module → Neovim Interface (signs, highlights, windows)

##### Integration Points
- External dependencies:
- Plenary.nvim connection
- Optional lua-xmlreader for Cobertura
- Neovim API interface points

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph External
        NV[Neovim API]
        PL[Plenary.nvim]
        XML[lua-xmlreader]:::optional
        CF[Coverage Files]
    end

    subgraph Core["Core Layer"]
        direction TB
        INIT["Plugin Entry"]:::core
        CONFIG["Config Manager"]:::core
        SIGN["Sign Manager"]:::core
        HIGH["Highlight Manager"]:::core
        REPORT["Report Generator"]:::core
        SUMM["Summary Generator"]:::core
        WATCH["Watch Service"]:::core
        UTIL["Utility Functions"]:::core
    end

    subgraph Lang["Language Support Layer"]
        direction TB
        COMMON["Common Language Interface"]:::lang
        subgraph Handlers["Language Handlers"]
            direction TB
            JS["JavaScript"]:::lang
            PY["Python"]:::lang
            TS["TypeScript"]:::lang
            RUBY["Ruby"]:::lang
            JAVA["Java"]:::lang
            GO["Go"]:::lang
            RUST["Rust"]:::lang
            MORE["...Other Languages"]:::lang
        end
    end

    subgraph Parse["Parser Layer"]
        direction TB
        LCOV["LCOV Parser"]:::parser
        COB["Cobertura Parser"]:::parser
    end

    %% Relationships
    CF --> Parse
    Parse --> Lang
    Lang --> Core
    Core --> NV
    PL --> Core
    XML -.-> COB
    COMMON --> Handlers
    WATCH --> CF

    %% Click Events
    click INIT "https://github.com/andythigpen/nvim-coverage/blob/main/lua/coverage/init.lua"
    click CONFIG "https://github.com/andythigpen/nvim-coverage/blob/main/lua/coverage/config.lua"
    click SIGN "https://github.com/andythigpen/nvim-coverage/blob/main/lua/coverage/signs.lua"
    click HIGH "https://github.com/andythigpen/nvim-coverage/blob/main/lua/coverage/highlight.lua"
    click REPORT "https://github.com/andythigpen/nvim-coverage/blob/main/lua/coverage/report.lua"
    click SUMM "https://github.com/andythigpen/nvim-coverage/blob/main/lua/coverage/summary.lua"
    click WATCH "https://github.com/andythigpen/nvim-coverage/blob/main/lua/coverage/watch.lua"
    click COMMON "https://github.com/andythigpen/nvim-coverage/blob/main/lua/coverage/languages/common.lua"
    click Handlers "https://github.com/andythigpen/nvim-coverage/tree/main/lua/coverage/languages/"
    click LCOV "https://github.com/andythigpen/nvim-coverage/blob/main/lua/coverage/lcov.lua"
    click COB "https://github.com/andythigpen/nvim-coverage/blob/main/lua/coverage/parsers/corbertura.lua"
    click UTIL "https://github.com/andythigpen/nvim-coverage/blob/main/lua/coverage/util.lua"
    click JS "https://github.com/andythigpen/nvim-coverage/blob/main/lua/coverage/languages/javascript.lua"
    click PY "https://github.com/andythigpen/nvim-coverage/blob/main/lua/coverage/languages/python.lua"
    click TS "https://github.com/andythigpen/nvim-coverage/blob/main/lua/coverage/languages/typescript.lua"
    click RUBY "https://github.com/andythigpen/nvim-coverage/blob/main/lua/coverage/languages/ruby.lua"
    click JAVA "https://github.com/andythigpen/nvim-coverage/blob/main/lua/coverage/languages/java.lua"
    click GO "https://github.com/andythigpen/nvim-coverage/blob/main/lua/coverage/languages/go.lua"
    click RUST "https://github.com/andythigpen/nvim-coverage/blob/main/lua/coverage/languages/rust.lua"

    %% Styles
    classDef core fill:#2196F3,stroke:#1565C0,color:white
    classDef lang fill:#4CAF50,stroke:#2E7D32,color:white
    classDef parser fill:#FF9800,stroke:#EF6C00,color:white
    classDef optional stroke-dasharray: 5 5
    
    %% Legend
    subgraph Legend
        L1[Core Component]:::core
        L2[Language Component]:::lang
        L3[Parser Component]:::parser
        L4[Optional Component]:::optional
    end
```
