Skip to main content

Module synthetic_buffers

Module synthetic_buffers 

Source
Expand description

Synthetic-buffer management on Editor.

Phase 5.7.B.9: migrates the synthetic-buffer plumbing (SYNTHETIC_BUFFER_FLAGS, seed_empty_document_locals, activate_major_by_id, append_to_owned_buffer, ensure_named_synthetic_document) from impl App (TUI, lattice-ui-tui::app::lsp_log_buffers + lattice-ui-tui::app::lifecycle) to impl Editor (host).

The TUI peer keeps thin wrappers so existing call sites (App::new boot, ex-command handlers like do_open_messages, :b *lsp* ensure paths) stay compiling while both renderer peers reach the same canonical bodies.

§What synthetic buffers are

“Synthetic” = subsystem-owned Document buffers that don’t correspond to an on-disk file. Examples:

  • *lsp* – the global LSP subsystem log (one per editor).
  • *lsp:<server>:<workspace>* – per-LSP-instance log.
  • *messages* – the editor’s echo / tracing::* transcript.
  • *scratch* (future) – a user-visible scratch buffer.

All of them register in the same crate::buffer_registry::BufferRegistry keyed by BufferId, marked with SYNTHETIC_BUFFER_FLAGS (listed: false, hidden: false – skip from :bn/:bp cycles, show in :ls with a marker, reach via :b <name>).

Each synthetic buffer’s content + lifecycle is driven by its major mode (e.g. messages-mode, lsp-log-mode); the host plumbing here is renderer-neutral.

Constants§

SYNTHETIC_BUFFER_FLAGS
Unlisted, non-hidden flags – the canonical shape every mode-owned synthetic buffer wants. :bn / :bp cycles skip, :ls shows with a u marker, :b <name> still reaches.