Expand description
Buffer-level folding semantics.
M.7 adds FoldSource + FoldOverlayService — a dep-safe
bridge that lets subsystems below lattice-host (e.g.
lattice-multibuffer) register overlay fold providers
without depending on FoldContext or FoldProvider.
FoldMethod decides which provider feeds the per-buffer fold
list. Fold is the per-range entry the list holds. Both are
renderer-agnostic: a fold is just (start_line, end_line, closed, identity); the gutter glyph + summary-line text are
rendering concerns layered on top.
Structs§
- Fold
- One contiguous fold range in a document buffer.
- Provider
Id - Stable identifier for a registered fold provider. Two distinct providers must produce distinct ids; a single provider produces the same id across recomputes. Used by the registry for lookup and by diagnostics that need to attribute a fold back to its source.
Enums§
- Fold
Method :set foldmethod=...(DESIGN.md §15:18, C.2;docs/user/folding.md). Decides which provider feeds the per-buffer fold list.- Provider
Kind - Distinguishes mutually-exclusive primary fold sources
(one runs at a time, picked by
:set foldmethod=) from additive overlay sources (always compose). Seedocs/dev/architecture/fold-architecture.md§2.
Traits§
- Fold
Overlay Service - Service for registering / deregistering overlay fold sources.
Implemented by
FoldOverlayServiceImplinlattice-host(which wrapsArc<Mutex<FoldRegistry>>). Registered in theServiceRegistryat boot soMultibufferMode::on_activatecan calladd_sourcewithout depending onlattice-host. - Fold
Source - Data-only fold source for subsystems that live below
lattice-host(e.g.ExcerptFoldProviderinlattice-multibuffer). Implementors cannot depend onFoldContextorFoldProvider(both defined inlattice-host).FoldSourceAdapterinlattice-host::fold_providerwraps anyFoldSourceas aFoldProviderby delegatingcompute()tocompute_foldsand ignoringFoldContext.
Type Aliases§
- Fold
Overlay Service Handle - Cheap-clone handle for the fold-overlay service. Mode guards hold
one Arc so they can call
remove_sourceon Drop.