Expand description
The GPUI renderer: lattice’s windowed, GPU-accelerated front end, a peer
of the terminal renderer (lattice-ui-tui) over the same lattice-host
editor substrate (Phase 5.7). The real window needs the window feature,
which lattice-cli turns on under its gui feature.
Design anchor: docs/dev/architecture/design.md §5.6 (rendering
layered architecture) + docs/dev/architecture/phase-5-extraction.md
slice 5.7 + post-Option-E pivot notes (lines 348–349). The
original §5.6.1 Renderer trait (with Frame / InputEvent /
LayoutConstraints / paint) was dropped: ratatui’s pull-based
draw loop and GPUI’s retained-mode element tree are structurally
different, and forcing a shared Frame type buys nothing. The
current renderer-trait shape (lattice_host::Renderer) is the
composition-typed associated-types version that came out of 5.B.
Per the design (§5.6.1) the GPU UI is the primary v1 surface;
the TUI is a first-class peer for headless / SSH / low-bandwidth
use. This crate is the GPU peer; both renderers share the host
substrate (lattice-host) and never depend on each other.
§Slicing
This file ships the renderer-neutral scaffold types — they build on every host (including headless CI and WSL2 without display libs) and exercise the host-substrate decoupling claim:
-
GpuiTheme— stub theme cache. Mirrors the role oflattice-ui-tui::theme::Theme(cached pre-computed render primitives so per-frame reads are direct) but will hold GPUI native style primitives (Hsla,TextStyle) in 5.7.B+. Empty today so the scaffold has no transitive gpui-link requirement. -
GpuiPaneRenderRegistry— stub registry implementinglattice_host::pane_render::ProviderLookup. The host’s mode-walk (lattice_host::pane_render::resolve_pane_render_mode) already routes through it; storage will fill with the GPUI-typed render fn signature in 5.8+. -
GpuiRenderer—impl lattice_host::Rendererzero-sized marker that surfaces the renderer-specific associated types to the host’s renderer-trait machinery. -
GpuiApp— the renderer-side composition root. Mirrorslattice-ui-tui::app::Appin shape:{editor, theme, pane_render_registry}(anlsp_file_watcherfield joins when the LSP runtime adapter for GPUI lands in 5.8+).
The window-opening entry point lives in the lattice-gpui
binary (src/bin/lattice_gpui.rs) behind the window Cargo
feature. That binary pulls real gpui at link time; the lib above
does not. This split keeps the scaffold’s test target buildable
everywhere while the binary is opt-in for environments with
display libs installed.
Phase 5.7.B.1 landed lattice_host::editor::Editor::boot:
the renderer-neutral construction body (LSP subsystem,
command registry, mode registry, snippet registry, event
bus, completion / picker / config registries, syntax +
buffer registry seeding) lives on the host substrate. Phase
5.7.B.2 (this slice) wires GpuiApp::new to call it:
GpuiApp::new(document) mirrors lattice-ui-tui::App::new’s
shape — the renderer-neutral half goes through Editor::boot,
the renderer-side wrapper holds the theme + pane-render
registry. Real dispatch + paint wiring (key events ->
Action -> editor.dispatch; paint reads editor.document
snapshot + cursor) follows in 5.7.B.3 / 5.7.B.4.
Modules§
- gpui_
chord - GPUI
Keystroke→KeyChordadapter. - pane_
options - Per-pane resolved view options (gutter, cursorline, sign columns, indent
guides). Deliberately NOT behind the
windowfeature: it names no gpui type, and the rule it enforces — a pane’s options come from the buffer it shows, never the active document — is worth testing in the headless build that CI runs. The view options for ONE pane, resolved against the buffer that pane shows.
Structs§
- GpuiApp
- The GPUI-side renderer composition root. Mirrors
lattice-ui-tui::app::Appin shape: renderer-side caches plus the renderer-neutralEditor. A futurelsp_file_watcherfield joins when the LSP runtime adapter for GPUI lands. - Gpui
Pane Render Registry - Stub GPUI pane-render registry. Implements
ProviderLookupso the host’s mode-walk already routes through it; storage fills with the GPUI-typed render fn signature in 5.8+. - Gpui
Renderer - GPUI renderer marker. Holds no state — the renderer-trait associated types point at the renderer-specific theme + pane-render registry types this crate owns.
- Gpui
Theme - GPUI peer’s typed theme cache.