# luce-editor/luce architecture

> Architecture diagram of the GitHub repository luce-editor/luce, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/luce-editor/luce
- Repository: https://github.com/luce-editor/luce

## Overview

Luce is a native desktop code editor. The primary workflow is opening a project or file, editing its text with language highlighting and editor services, and using the surrounding UI for navigation, preview, and source control. The graph also preserves documented terminal and Lua-plugin capabilities. Relationships from sampled code and the SOURCE INDEX are cited; README-only subsystem links are documented capabilities, not verified call paths.

Main entry points: [`src/ui/app.cpp`](https://github.com/luce-editor/luce/blob/main/src/ui/app.cpp) (App Shell), [`src/ui/icon_manager.cpp`](https://github.com/luce-editor/luce/blob/main/src/ui/icon_manager.cpp) (Icon Manager), [`src/editor/editor_view.cpp`](https://github.com/luce-editor/luce/blob/main/src/editor/editor_view.cpp) (Text Editor), [`src/main.cpp`](https://github.com/luce-editor/luce/blob/main/src/main.cpp) (Desktop Entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Application Runtime"]
  node_main["Desktop Entry<br/>[main.cpp]"]
  node_app["App Shell<br/>[app.cpp]"]
  node_tabs["Tabs and Splits<br/>[tab_bar.cpp]"]
  node_icons["Icon Manager<br/>[icon_manager.cpp]"]
  node_json["JSON Support<br/>[json.hpp]"]
  node_svg["SVG Parser<br/>[nanosvg.h]"]
  node_raster["SVG Rasterizer<br/>[nanosvgrast.h]"]
  node_image["Image Loader<br/>[stb_image.h]"]
end

subgraph group_editing["Editing Services"]
  node_editor["Text Editor<br/>[editor_view.cpp]"]
  node_buffer["Text Buffer<br/>[text_buffer.cpp]"]
  node_syntax["Syntax Highlighting"]
  node_lexers["Language Lexers"]
  node_symbols["Symbol Index<br/>[symbol_index.cpp]"]
  node_diagnostics["Diagnostics"]
end

subgraph group_workspace["Workspace Features"]
  node_explorer["File Explorer<br/>[file_explorer.cpp]"]
  node_palette["Command Palette"]
  node_markdown["Markdown Preview"]
  node_git["Git Integration<br/>[git_manager.cpp]"]
  node_settings["Settings"]
  node_theme["Themes<br/>[theme.cpp]"]
end

subgraph group_extensions["Extensions and Platform"]
  node_plugins["Plugin Manager<br/>[plugin_manager.cpp]"]
  node_lua["Lua Plugins<br/>[lua_plugin.cpp]"]
  node_terminal["Embedded Terminal<br/>[terminal_panel.cpp]"]
  node_platform["Platform Services<br/>[platform.cpp]"]
end

node_user(("Editor User"))
node_shell(("Shell Process"))

node_user -->|"starts editor"| node_main
node_main -->|"runs app"| node_app
node_app -->|"opens files"| node_tabs
node_tabs -.->|"hosts editor"| node_editor
node_editor -->|"edits text"| node_buffer
node_editor -->|"highlights text"| node_syntax
node_syntax -.->|"uses lexers"| node_lexers
node_editor -->|"queries symbols"| node_symbols
node_editor -.->|"shows diagnostics"| node_diagnostics
node_app -->|"owns workspace UI"| node_explorer
node_app -->|"owns commands"| node_palette
node_app -->|"offers preview"| node_markdown
node_app -->|"invokes Git actions"| node_git
node_app -->|"loads settings"| node_settings
node_app -->|"owns theme state"| node_theme
node_app -->|"initializes icons"| node_icons
node_icons -->|"reads mappings"| node_json
node_icons -->|"parses SVG"| node_svg
node_icons -->|"rasterizes SVG"| node_raster
node_icons -->|"loads images"| node_image
node_app -->|"owns plugins"| node_plugins
node_plugins -->|"loads scripts"| node_lua
node_app -.->|"offers terminal"| node_terminal
node_terminal -.->|"spawns process"| node_platform
node_platform -.->|"runs command"| node_shell

click node_main "https://github.com/luce-editor/luce/blob/main/src/main.cpp"
click node_app "https://github.com/luce-editor/luce/blob/main/src/ui/app.cpp"
click node_tabs "https://github.com/luce-editor/luce/blob/main/src/ui/tab_bar.cpp"
click node_editor "https://github.com/luce-editor/luce/blob/main/src/editor/editor_view.cpp"
click node_buffer "https://github.com/luce-editor/luce/blob/main/src/editor/text_buffer.cpp"
click node_syntax "https://github.com/luce-editor/luce/blob/main/src/syntax/syntax_highlighter.cpp"
click node_lexers "https://github.com/luce-editor/luce/tree/main/src/syntax"
click node_symbols "https://github.com/luce-editor/luce/blob/main/src/editor/symbol_index.cpp"
click node_diagnostics "https://github.com/luce-editor/luce/blob/main/src/editor/diagnostic_runner.cpp"
click node_explorer "https://github.com/luce-editor/luce/blob/main/src/ui/file_explorer.cpp"
click node_palette "https://github.com/luce-editor/luce/blob/main/src/ui/command_palette.cpp"
click node_markdown "https://github.com/luce-editor/luce/blob/main/src/ui/markdown_preview.cpp"
click node_git "https://github.com/luce-editor/luce/blob/main/src/editor/git_manager.cpp"
click node_settings "https://github.com/luce-editor/luce/blob/main/src/ui/settings_manager.cpp"
click node_theme "https://github.com/luce-editor/luce/blob/main/src/ui/theme.cpp"
click node_icons "https://github.com/luce-editor/luce/blob/main/src/ui/icon_manager.cpp"
click node_json "https://github.com/luce-editor/luce/blob/main/include/external/json.hpp"
click node_svg "https://github.com/luce-editor/luce/blob/main/include/nanosvg.h"
click node_raster "https://github.com/luce-editor/luce/blob/main/include/nanosvgrast.h"
click node_image "https://github.com/luce-editor/luce/blob/main/src/ui/stb_image.h"
click node_plugins "https://github.com/luce-editor/luce/blob/main/src/plugin/plugin_manager.cpp"
click node_lua "https://github.com/luce-editor/luce/blob/main/src/plugin/lua_plugin.cpp"
click node_terminal "https://github.com/luce-editor/luce/blob/main/src/ui/terminal_panel.cpp"
click node_platform "https://github.com/luce-editor/luce/blob/main/src/platform.cpp"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_main,node_app,node_tabs,node_icons,node_json,node_svg,node_raster,node_image,node_user toneBlue
class node_editor,node_buffer,node_syntax,node_lexers,node_symbols,node_diagnostics toneAmber
class node_explorer,node_palette,node_markdown,node_git,node_settings,node_theme toneMint
class node_plugins,node_lua,node_terminal,node_platform toneRose
class node_shell toneIndigo
```

## Components

### Application Runtime

- [Desktop Entry](https://github.com/luce-editor/luce/blob/main/src/main.cpp): `src/main.cpp`
- [App Shell](https://github.com/luce-editor/luce/blob/main/src/ui/app.cpp): `src/ui/app.cpp`
- [Tabs and Splits](https://github.com/luce-editor/luce/blob/main/src/ui/tab_bar.cpp): `src/ui/tab_bar.cpp`
- [Icon Manager](https://github.com/luce-editor/luce/blob/main/src/ui/icon_manager.cpp): `src/ui/icon_manager.cpp`
- [JSON Support](https://github.com/luce-editor/luce/blob/main/include/external/json.hpp): `include/external/json.hpp`
- [SVG Parser](https://github.com/luce-editor/luce/blob/main/include/nanosvg.h): `include/nanosvg.h`
- [SVG Rasterizer](https://github.com/luce-editor/luce/blob/main/include/nanosvgrast.h): `include/nanosvgrast.h`
- [Image Loader](https://github.com/luce-editor/luce/blob/main/src/ui/stb_image.h): `src/ui/stb_image.h`

### Editing Services

- [Text Editor](https://github.com/luce-editor/luce/blob/main/src/editor/editor_view.cpp): `src/editor/editor_view.cpp`
- [Text Buffer](https://github.com/luce-editor/luce/blob/main/src/editor/text_buffer.cpp): `src/editor/text_buffer.cpp`
- [Syntax Highlighting](https://github.com/luce-editor/luce/blob/main/src/syntax/syntax_highlighter.cpp): `src/syntax/syntax_highlighter.cpp`
- [Language Lexers](https://github.com/luce-editor/luce/tree/main/src/syntax): `src/syntax`
- [Symbol Index](https://github.com/luce-editor/luce/blob/main/src/editor/symbol_index.cpp): `src/editor/symbol_index.cpp`
- [Diagnostics](https://github.com/luce-editor/luce/blob/main/src/editor/diagnostic_runner.cpp): `src/editor/diagnostic_runner.cpp`

### Workspace Features

- [File Explorer](https://github.com/luce-editor/luce/blob/main/src/ui/file_explorer.cpp): `src/ui/file_explorer.cpp`
- [Command Palette](https://github.com/luce-editor/luce/blob/main/src/ui/command_palette.cpp): `src/ui/command_palette.cpp`
- [Markdown Preview](https://github.com/luce-editor/luce/blob/main/src/ui/markdown_preview.cpp): `src/ui/markdown_preview.cpp`
- [Git Integration](https://github.com/luce-editor/luce/blob/main/src/editor/git_manager.cpp): `src/editor/git_manager.cpp`
- [Settings](https://github.com/luce-editor/luce/blob/main/src/ui/settings_manager.cpp): `src/ui/settings_manager.cpp`
- [Themes](https://github.com/luce-editor/luce/blob/main/src/ui/theme.cpp): `src/ui/theme.cpp`

### Extensions and Platform

- [Plugin Manager](https://github.com/luce-editor/luce/blob/main/src/plugin/plugin_manager.cpp): `src/plugin/plugin_manager.cpp`
- [Lua Plugins](https://github.com/luce-editor/luce/blob/main/src/plugin/lua_plugin.cpp): `src/plugin/lua_plugin.cpp`
- [Embedded Terminal](https://github.com/luce-editor/luce/blob/main/src/ui/terminal_panel.cpp): `src/ui/terminal_panel.cpp`
- [Platform Services](https://github.com/luce-editor/luce/blob/main/src/platform.cpp): `src/platform.cpp`

### Other components

- **Editor User**
- **Shell Process**

## Connections

- Editor User → Desktop Entry: starts editor
- Desktop Entry → App Shell: runs app (evidence: `src/main.cpp`)
- App Shell → Tabs and Splits: opens files (evidence: `src/ui/app.cpp`)
- Tabs and Splits → Text Editor: hosts editor
- Text Editor → Text Buffer: edits text
- Text Editor → Syntax Highlighting: highlights text
- Syntax Highlighting → Language Lexers: uses lexers
- Text Editor → Symbol Index: queries symbols (evidence: `src/editor/editor_view.cpp`)
- Text Editor → Diagnostics: shows diagnostics
- App Shell → File Explorer: owns workspace UI
- App Shell → Command Palette: owns commands
- App Shell → Markdown Preview: offers preview
- App Shell → Git Integration: invokes Git actions (evidence: `src/ui/app.cpp`)
- App Shell → Settings: loads settings (evidence: `src/ui/app.cpp`)
- App Shell → Themes: owns theme state
- App Shell → Icon Manager: initializes icons
- Icon Manager → JSON Support: reads mappings (evidence: `src/ui/icon_manager.cpp`)
- Icon Manager → SVG Parser: parses SVG (evidence: `src/ui/icon_manager.cpp`)
- Icon Manager → SVG Rasterizer: rasterizes SVG (evidence: `src/ui/icon_manager.cpp`)
- Icon Manager → Image Loader: loads images (evidence: `src/ui/icon_manager.cpp`)
- App Shell → Plugin Manager: owns plugins
- Plugin Manager → Lua Plugins: loads scripts
- App Shell → Embedded Terminal: offers terminal
- Embedded Terminal → Platform Services: spawns process
- Platform Services → Shell Process: runs command
