Expand description
Native compilation mode: runs a build / test / lint command off-thread and
streams its output into a read-only *compilation* buffer (CM.1).
Runs a build/test/lint command off-thread (pipe-captured) and
streams its stdout+stderr into a read-only synthetic
*compilation* Document buffer live. The emacs
compilation-mode / M-x recompile and vim :make workflow’s
streaming half, on Lattice’s substrate.
This is a native built-in wired through the SubsystemBoot
install seam (not a plugin). CM.1 delivers the streaming buffer
plus :compile / :recompile / :make. The error list
(CM.2), parser registry (CM.3), and *problems* multibuffer
view (CM.4) land in later slices — see
docs/dev/architecture/compilation-mode.md and its slice plan.
§Shape
- [
events] — theCompilationOutputPushedtyped event +OutputChunk. - [
mode] —CompilationMode(ReadOnly + NoFilemajor) + its streaming drain. - [
service] —CompilationService(process lifecycle, pipe-capture, kill-on-recompile) off the actor thread. - [
ex_commands] —:compile/:recompile/:make. install— the crate-ownedSubsystemBootentry point.
Structs§
- Ansi
Palette - The interned theme elements CM.5 paints ANSI output with.
- Clean
Line - One line with every escape sequence removed, plus the spans that describe what colour the surviving bytes were.
- Compilation
Headerline - A
Headerlineimpl backed byCompilationHeadlineState. - Compilation
Headline State - Shared state the compilation drain updates and the headerline renderer reads.
- Compilation
Location - CM.3b: a source location parsed out of a single
*compilation*buffer line byparse_location_linefor the<CR>-jump.line/colare 0-based — the error substrate +Editor::jump_to_file_line_colconvention. - Compilation
Mode - Major mode for the
*compilation*buffer. - Compilation
Output Pushed - Typed event carrying one
OutputChunkfrom the compilation service to the*compilation*buffer drain. - Compilation
Parser Factories - The registered set of plugin parser factories, in registration order.
- Default
Compilation Service - Default
CompilationService:sh -c <cmd>, pipe-captured, streamed over the event bus. - Parser
Registry - The active set of parsers. Feeds each line to every parser and
concatenates their entries. The
Vec<Box<dyn CompilationParser>>is the extensibility seam: built-in parsers, plus (CM.6) WASM-contributed ones — a plugin implementing theerror-parserworld is registered here as one moreBox<dyn CompilationParser>and is indistinguishable from a native parser downstream. - SgrState
- Active SGR attributes.
Enums§
- Output
Chunk - One unit of streamed compilation output. The drain applies these in arrival order:
Constants§
- COMPILATION_
BUFFER_ NAME - Synthetic name of the streaming compilation buffer.
:lsand:b *compilation*reach it;:bn/:bpskip it (listed = false). - COMPILATION_
HEADERLINE_ PROVIDER_ ID - Provider id tag for the compilation headerline so re-activations
can
unregister/registeridempotently.
Traits§
- Compilation
Parser - A named matcher over streamed compiler-output lines producing
[
ErrorEntry]s. - Compilation
Parser Factory - Mints a fresh
CompilationParserfor one pipe reader. - Compilation
Service - Process-lifecycle surface. Registered in the
ServiceRegistryat boot (asCompilationServiceHandle); theAppEffect::CompileRunhost arm looks it up and callsCompilationService::run(after creating the*compilation*buffer host-side).
Functions§
- apply_
chunk - Pure model of applying one chunk to the current buffer text.
- clean_
line - Strip escape sequences out of one line, returning the clean text
and its spans.
stateis updated in place so the next line continues where this one left off. - gutter_
level - CM.3c: map the parser-native [
ErrorSeverity] onto the renderer- facing [GutterSeverityLevel] (Error→Error,Warning→Warning,Info→Info,Note→Info). The single conversion in the whole compilation-severity pipeline — the parser, the inbound bus, and theAppEffectpayload all carryErrorSeverity, and the host arm calls this once when writing the render-state slot.Notecollapses toInfobecauseGutterSeverityLevelhas noNoterank; there is no reverse conversion, so nothing is lost by round-trip. - install
- Wire the compilation subsystem’s ex-commands, mode, service, and
off-keystroke wake into the editor at boot. One Phase-B line in
editor_boot.rs. - match_
severity - CM.3c: the severity a single
*compilation*line declares, orNonewhen it carries no severity keyword. Reuses the built-in rustc-header and gnu-full-form patterns (via [crate::parsers::match_severity]) — the same compiled regexes the streaming parsers use. Keyword-driven: progress / summary / prose / location (-->) / gnu-short lines returnNone. The severity gutter mark lands on the line where the severity is textually visible (the rustc header line; the gnu full-form line), mirroring emacscompilation-mode. - parse_
location_ line - CM.3b: parse a source location out of ONE
*compilation*buffer line — the<CR>-jump seam. Runs the built-in rustc--->and gnu-style location regexes (the same compiled patterns the streaming parsers use, via [crate::parsers::match_location_line]) against the line and returns the first match, converting 1-based line/col to 0-based.Nonewhen the line carries no navigable location (progress, summary, backtraces, prose). - register_
compilation_ ex_ commands - Register
:compile/:recompile/:make. - scan_
location_ lines - CM.3c: scan a block of streamed text for severity lines, returning
(absolute_line, severity)for each match.base_lineis the 0-based buffer line number the block’s FIRST line lands on; lineiof the block (viastr::lines) maps to absolute linebase_line + i. - scan_
severities - CM.3c: scan a block of streamed text for severity lines, returning
(absolute_line, severity)for each match.base_lineis the 0-based buffer line number the block’s FIRST line lands on; lineiof the block (viastr::lines) maps to absolute linebase_line + i. - start_
compilation - Provision the
*compilation*buffer and kick off a run — the compilation mode’s own responsibility, driven through the&mut-backed [ModeActivator::ensure_named_document] creation seam.
Type Aliases§
- Compilation
Ansi Slot - CM.5: write-once slot holding the interned
compilation.ansi.*element ids the pipe readers paint captured SGR with. - Compilation
Gutter BusHandle - CM.3c: the off-thread → host-state seam for the
*compilation*buffer’s per-buffer severity gutter index. The compilation drain (inCompilationMode::on_activate) sends(buffer_id, full_index)through this bus whenever the index changes; theinstall-registered handler maps each send to [AppEffect::CompilationGutterSet]. Registered as aServiceRegistryhandle under this exact alias (per the Arc/TypeId convention); the drain looks it up viactx.service::<CompilationGutterBusHandle>().sendbakes in the editor wake, so marks reach the screen off-keystroke. - Compilation
Location BusHandle - CM.3c (2026-07-22): the off-thread → host-state seam for the
*compilation*buffer’s location-line index (theme-based highlighting). Twin ofCompilationGutterBusHandle: the compilation drain sends(buffer_id, full_location_lines)through this bus whenever the index changes; theinstall-registered handler maps each send to [AppEffect::CompilationLocationLines]. Registered as a ServiceRegistry handle under this exact alias; the drain looks it up viactx.service::<CompilationLocationBusHandle>(). - Compilation
Parser Factories Handle - The runtime-mutable handle, registered as a boot service under this
exact alias (the
ServiceRegistryArc/TypeId convention). - Compilation
Service Handle - Per the
ServiceRegistryArc/TypeId convention: register and look up under this exact alias. - Compilation
Theme Colors BusHandle - CM.3d (2026-07-22): the theme colours bus — the mode sends
resolved
(bg, fg)once during activation; the handler maps to [AppEffect::CompilationThemeColors].