# hediet/vscode-debug-visualizer architecture

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

- Interactive diagram: https://gitdiagram.com/hediet/vscode-debug-visualizer
- Repository: https://github.com/hediet/vscode-debug-visualizer

## Overview

##### Main Components
- VS Code Extension Core – This is housed under the “extension” directory. It contains most of the integration logic with VS Code (e.g., activation, command registration, proxy classes like DebugSessionProxy, DebuggerProxy, and DebuggerViewProxy).
- Data Extraction Library – Found in the “data-extraction” directory. This module defines interfaces, default data extractors (e.g., AsIsDataExtractor, GridExtractor, etc.), and supports extracting and formatting debugging data. It serves as the “engine” that collects and standardizes debug information.
- Webview Front-End – Under the “webview” directory, you have React-based components (e.g., App.tsx, ExpressionInput.tsx, Visualizer.tsx) and styling files that display the processed debug data in an interactive UI.
- Visualization Backend – Within the “extension/src/VisualizationBackend” folder, this component ties together different visualization supports (JS, Py, Ruby, etc.) and manages the configuration for rendering debug data.
- Demos – The “demos” directory showcases multiple language-specific examples (C++, C#, Dart, Go, Java, JavaScript, Nim, PHP, Python, Ruby, Rust, Swift). Though not part of the runtime system, these folders illustrate how the visualization works across diverse environments.
- Support & Documentation – Additional files (docs, CONTRIBUTING.md, READMEs, CI configuration in .github) provide context, guides, and build instructions for the project.

##### Relationships and Data Flow
- The Extension Core interacts with the VS Code API and uses proxy classes to communicate with the debugger.
- Debug data is sent to the Data Extraction Library, which uses various “extractor” modules (default and custom) to format data.
- Once data is extracted and standardized, it moves to the Visualization Backend, where it may be further processed or configured.
- The processed data is then passed to the Webview Front-End, where interactive visual components (built with React) render the visualization.
- In parallel, the Demos demonstrate integration and usage examples across multiple language environments.

##### Architectural Patterns and Technologies
- Modularity: The separation of concerns is clear with distinct directories for the data extraction engine, extension activation logic, and UI rendering.
- API and Proxy Patterns: Used within the extension (see proxies under “extension/src/proxies”) to facilitate communication between different parts of the system and possibly abstract the VS Code debugger interactions.
- Front-End Framework: The webview uses React and SCSS instead of raw HTML/CSS to offer a modern and maintainable UI.
- Build and Configuration: Webpack is used (both in data-extraction and webview directories), and TypeScript is the common programming language across many parts of the project.

## Diagram (Mermaid)

```mermaid
graph TD
    External["VS Code Debugger (API)"]:::external
    ExtCore["VS Code Extension Core"]:::extension
    External -->|"calls"| ExtCore

    subgraph "VS Code Extension Environment"
        ExtActivation["Extension Activation (extension/src/extension.ts)"]:::extension
        ExtProxies["Debug Proxies (extension/src/proxies)"]:::extension
        ExtCore --> ExtActivation
        ExtActivation --> ExtProxies
    end

    ExtCore -->|"extracts_data"| DataExtract["Data Extraction Library"]:::dataExtraction

    subgraph "Data Extraction Module"
        DEBase["Core Library (data-extraction)"]:::dataExtraction
        DEAPI["Default Extractors (data-extraction/src/js/api/default-extractors)"]:::dataExtraction
        DataExtract --> DEBase
        DEBase --> DEAPI
    end

    DEBase -->|"forwards_data"| VizBackend["Visualization Backend"]:::visualization

    subgraph "Visualization Backend"
        VizMain["Main Visualization Backend (extension/src/VisualizationBackend)"]:::visualization
        VizComp["Composed Visualization Support (extension/src/VisualizationBackend/ComposedVisualizationSupport.ts)"]:::visualization
        VizDispatch["Dispatching Visualization Backend (extension/src/VisualizationBackend/DispatchingVisualizationBackend.ts)"]:::visualization
        VizBackend --> VizMain
        VizMain --> VizComp
        VizMain --> VizDispatch
    end

    VizMain -->|"renders_to"| Webview["Webview Front-End"]:::webview

    subgraph "Webview UI"
        WVBase["Webview Core (webview)"]:::webview
        WVApp["App Component (webview/src/components/App.tsx)"]:::webview
        WVExpr["Expression Input (webview/src/components/ExpressionInput.tsx)"]:::webview
        WVVis["Visualizer (webview/src/components/Visualizer.tsx)"]:::webview
        Webview --> WVBase
        WVBase --> WVApp
        WVBase --> WVExpr
        WVBase --> WVVis
    end

    ExtCore -->|"demos"| Demos["Demo Applications (demos)"]:::demos

    ExtCore -->|"docs_build"| Docs["Support & Documentation (docs, .github, webpack configs)"]:::docs

    %% Click Events
    click ExtCore "https://github.com/hediet/vscode-debug-visualizer/tree/master/extension"
    click ExtActivation "https://github.com/hediet/vscode-debug-visualizer/blob/master/extension/src/extension.ts"
    click ExtProxies "https://github.com/hediet/vscode-debug-visualizer/tree/master/extension/src/proxies"

    click DataExtract "https://github.com/hediet/vscode-debug-visualizer/tree/master/data-extraction"
    click DEBase "https://github.com/hediet/vscode-debug-visualizer/tree/master/data-extraction/src"
    click DEAPI "https://github.com/hediet/vscode-debug-visualizer/tree/master/data-extraction/src/js/api/default-extractors"

    click Webview "https://github.com/hediet/vscode-debug-visualizer/tree/master/webview"
    click WVApp "https://github.com/hediet/vscode-debug-visualizer/blob/master/webview/src/components/App.tsx"
    click WVExpr "https://github.com/hediet/vscode-debug-visualizer/blob/master/webview/src/components/ExpressionInput.tsx"
    click WVVis "https://github.com/hediet/vscode-debug-visualizer/blob/master/webview/src/components/Visualizer.tsx"

    click VizMain "https://github.com/hediet/vscode-debug-visualizer/tree/master/extension/src/VisualizationBackend"
    click VizComp "https://github.com/hediet/vscode-debug-visualizer/blob/master/extension/src/VisualizationBackend/ComposedVisualizationSupport.ts"
    click VizDispatch "https://github.com/hediet/vscode-debug-visualizer/blob/master/extension/src/VisualizationBackend/DispatchingVisualizationBackend.ts"

    click Demos "https://github.com/hediet/vscode-debug-visualizer/tree/master/demos"
    click Docs "https://github.com/hediet/vscode-debug-visualizer/tree/master/docs"

    %% Styles
    classDef external fill:#f9c,stroke:#333,stroke-width:2px;
    classDef extension fill:#bbf,stroke:#333,stroke-width:2px;
    classDef dataExtraction fill:#bfb,stroke:#333,stroke-width:2px;
    classDef visualization fill:#ffb,stroke:#333,stroke-width:2px;
    classDef webview fill:#fdb,stroke:#333,stroke-width:2px;
    classDef demos fill:#d9f,stroke:#333,stroke-width:2px;
    classDef docs fill:#dfd,stroke:#333,stroke-width:2px;
```
