Skip to main content

Module fold_provider

Module fold_provider 

Source
Expand description

D.3.f.0 (2026-05-29): FoldProvider substrate.

See docs/dev/architecture/fold-architecture.md for the full design; capsule:

  • One primary provider runs per recompute_folds() call, keyed on :set foldmethod=.
  • All overlay providers run on every recompute_folds().
  • Providers are pure functions of FoldContext; the registry pre-loads inputs.

This module ships the trait + the registry; the five built-in primary providers wrap the existing crate::folds helpers. Overlays are mode-owned (DX.3-C7): diff-mode registers a HunkFoldSource and MultibufferMode its excerpt / file-boundary sources via the FoldOverlayService.

Structs§

FoldContext
D.3.f.0: per-recompute inputs passed to every provider.
FoldOverlayServiceImpl
M.7: lattice_core::FoldOverlayService impl that wraps the shared Arc<Mutex<FoldRegistry>>. MultibufferMode::on_activate obtains this via ctx.service::<FoldOverlayServiceHandle>() and registers ExcerptFoldProvider without depending on lattice-host.
FoldRegistry
D.3.f.0: per-Editor fold-provider registry.
FoldSourceAdapter
M.7: wraps a lattice_core::FoldSource as a FoldProvider. target_buffer_id scopes this overlay: compute() returns empty when ctx.buffer_id doesn’t match, so providers from multiple simultaneous multibuffers don’t bleed into each other.

Traits§

FoldProvider
D.3.f.0: a registered source of folds.