Skip to main content

Crate lattice_host

Crate lattice_host 

Source
Expand description

lattice-host – the renderer-agnostic editor substrate.

This crate is the home of the editor’s logic: App state, dispatch, picker sources, mode lifecycle, LSP coordination, options cascade, keymap registry, buffer registry, folds, search, completion engine, file ops, oil + file-tree state.

It depends on lattice-core, lattice-grammar, lattice-config, lattice-mode, lattice-picker, lattice-completion, lattice-lsp, lattice-runtime, lattice-syntax, and the other domain crates. It does not depend on any renderer crate – lattice-ui-tui and the future lattice-ui-gpui both depend on this, never the other way around.

The public entry point (Phase 5.6+) will be:

ⓘ
pub fn run(app: App, renderer: impl lattice_render::Renderer) -> Result<()>

§Phase 5 status

Phase 5.1 (this slice): the crate is empty. The seam exists; the workspace builds with the new crate declared; downstream consumers can depend on it. Phase 5.2 begins the actual migration of renderer-agnostic modules out of lattice-ui-tui.

See docs/dev/architecture/phase-5-extraction.md for the slice plan and module classification.

Re-exports§

pub use renderer::MinimalRenderer;
pub use renderer::Renderer;

Modules§

action
Action enum – the dispatch language of the editor.
actions
App-side action registrations – the CommandKind::Action peers of the grammar’s built-in motions / operators / text- objects (lattice_grammar::builtins) and built-in ex-commands (lattice_grammar::ex_commands).
activator
M.2.b.2 (2026-06-01): impl ModeActivator for Editor.
autoread
Autoread — external-change detection + refresh for file-backed Document buffers (vim’s autoread).
boot_context
Boot-composition: the BootContext — the host’s generic-primitive surface.
buffer_registry
Unified buffer registry (DESIGN.md §5.9).
buffers
Buffer kind + id + flags – moved from lattice-ui-tui to the renderer-agnostic substrate in Phase 5.2 first wave.
cells_worker
Background cell-builder worker — replaces per-frame shape_line with an off-thread cell matrix build.
chord
Re-export shim for the chord primitives.
command_line_expand_mode
MB.2 (rich minibuffer, tier 2): command-line-expand-mode.
command_line_mode
MB.1 (rich minibuffer, tier 1): command-line-mode.
cursor_shape
Vim-style cursor shape derived from ModalState.
dashboard
Host-side applier for the *dashboard* launch page (DB.2).
decline
AP.0.2 — the layer peel behind Effect::Declined, in one place.
diagnostics_query
L4b (lsp-architecture.md §15): host-side lattice_lsp::modes::DiagnosticsQuery impl backing lsp-diagnostics-mode’s mode-owned gl handler.
diff
Host façade over the diff subsystem, which now lives in the lattice-diff crate (moved out of lattice-host at BC.6/DX.6).
dispatch
Renderer-neutral action dispatch.
display_matrix
Per-line display cache — the substrate that retires the per-character lattice_cells::CellMatrix.
editor
editor_actor
EditorActor — the editor runs on its own thread.
error_list
CM.2 (2026-07-22): the error list — a persistent, cross-file list of navigable locations with an index, walked by generic host dispatch (:cnext / :cprev / :cc and the Builtin ]q / [q chords).
excommand
Phase 2->3 ex-command parser.
file_tree
File-tree buffer model – re-exported from lattice-file-tree.
fold_provider
D.3.f.0 (2026-05-29): FoldProvider substrate.
folds
Computed folds (DESIGN.md §5.1, §15:18; user-facing reference at docs/user/folding.md).
grep_highlight
PH.3: concrete grep-preview highlighter.
help
Help buffer model – re-exported from lattice-help.
help_topics
Help topic registry – re-exported from lattice-help::topics.
highlights
Phase 5.8.AF.6 / Slice X2.6: this module is intentionally empty after the legacy refresh_highlights_window + VisibleHighlightsKey were retired. display-line B4.2: the worker-published visible-spans cell this module used to point at was also deleted (the dead span/ row prepaint cache); syntax colour now flows through the cells / DisplayMatrix substrate, and overlay backgrounds through lattice_host::overlay_worker. The path is renderer-agnostic; no Editor method is needed for it.
host_generators
App-state-dependent completion generators.
indent_guides
Indentation guides — the per-pane layer both renderers paint from.
input
Translate canonical KeyChord values into Actions.
keymap
Re-export shim for the static keymap catalog + keymap_entry! macro.
keymap_cancel
CG.1 — the foreground-cancel binding (<C-g>).
keymap_entry
Static keymap catalog + keymap_entry! macro (DESIGN.md §5.2.3).
keymap_help
K.3.2 (2026-06-02): help-prefix (<C-h> map) bindings.
keymap_insert
Insert-mode binding registration + drift-test helpers.
keymap_mode_contributions
K.2.4 — host translation pass for mode-contributed keymaps.
keymap_normal
Normal-mode binding registration + lookup helper.
keymap_registry
Re-export shim — KeymapCapability, KeymapError, KeymapHandle, KeymapRegistry, LayerId, and PushLayerKind moved to lattice-keymap in K.3 (2026-06-07). KeymapReverseLookupHandle stays here because it implements lattice_completion::KeymapReverseLookup — lattice-keymap cannot depend on lattice-completion.
keymap_replace
Replace-mode binding registration + drift-test helpers.
keymap_select
Select-mode dispatch (SN.3d.1).
keymap_terminal
Keystroke → ANSI byte encoder for Terminal-Insert mode.
keymap_trie
Re-export shim — KeymapTrie, KeymapLayer, BoundCommand, and LookupResult moved to lattice-keymap in K.3 (2026-06-07). Existing use crate::keymap_trie::{...} callers in this crate continue to work unchanged.
keymap_visual
Visual-mode binding registration + drift-test helpers.
lsp_helpers
Phase 5.5.LSP.1 step 2: pure LSP utility helpers, lifted from lattice_ui_tui::app. These functions translate between the editor’s internal byte-indexed shapes and lsp-types’s wire shapes (UTF-16 column positions, hover-content markdown). They depend only on lattice_core::Buffer, lattice_grammar::Position, and lattice_lsp::position – all host-side – so they have no reason to live in the renderer crate.
lsp_watcher
LSP file-watcher subsystem (Phase 5.8.AF.5 / Slice 1).
messages
*messages* buffer management on Editor.
mode_action_handlers
SN.3c.0: boot-time registration of modes’ declarative global action handlers (Mode::action_handlers).
modeline
Built-in modeline element vocabulary + shared per-pane content resolution (slice ML.1a-render).
modes
Major modes for buffer kinds owned by the TUI layer.
mouse
MO.2: editor-body mouse hit-testing.
oil
Oil buffer model – re-exported from lattice-oil.
operator_chord_wirer
CM.2: the host’s answer to a plugin operator that declared a chord.
overlay_worker
Background overlay worker — static-overlay bucketing off the UI thread.
pane
M.4 follow-up: pane geometry moved to lattice-core::ui::pane. Re-exported here for transitional compatibility.
pane_group
D.4.a (2026-05-29): pane-group substrate.
pane_history
PBH.1: per-pane buffer history — the trail of buffers one pane has shown, walkable with <C-6> (back) / <C-7> (forward).
pane_render
Mode-keyed pane render resolution (renderer-agnostic algorithm).
per_buffer_cache
PerBufferCache<T> — per-buffer cache primitive for the 5.8.AF.5 Slice 3b migration.
popup
Popup placement model – re-exported from lattice-core::ui::popup.
preview
Preview isolation (PI series).
prompt_line_mode
prompt-line-mode: the generic one-line minibuffer text prompt backing Effect::OpenPrompt.
render_state
RenderState — the renderer’s read contract with the host.
renderer
The host-side Renderer trait.
search_line_mode
MB.5a (rich minibuffer): search-line-mode.
state
Small App-helper state types – pure data, no renderer coupling.
sticky_context
TC.3b — the sticky-context layer both renderers paint from.
synthetic_buffers
Synthetic-buffer management on Editor.
tutor
Tutor subsystem — session data, minor mode, headerline, and score persistence.
ui
Renderer-neutral UI types: theme, style, color.
vcs
Layer 2 VCS subsystem — auto-inline-diff against HEAD.
versioned
Versioned<T> — a tiny newtype wrapper that bumps a monotonic u64 version on every &mut access via DerefMut.
virtual_rows_worker
D.0a.1 (2026-05-29) — Virtual-rows worker.
visual
Visual-mode selection helpers — renderer-neutral computation of the highlighted range when editor.modal == Visual(_).
wasm_context
TC.3a — WASM sticky context: producer → per-buffer scope cache → resolver.
wasm_decorations
PL8.E — WASM gutter decorations: producer → per-buffer cache → renderer.
wasm_media
IM.7 — WASM inline media: producer → per-buffer blocks → virtual rows.

Macros§

keymap_entry
Construct a KeymapEntry with the row’s source location captured at the macro invocation site. Forms:

Functions§

disable_autoload
Suppress boot-time plugin auto-discovery for this process.
flush_plugin_stores
Write out every plugin’s store before the process exits.