M2.7: Structure tool window and syntax.outline

Engine: every open PHP buffer keeps a tree-sitter tree, reparsed
incrementally on a worker thread off the engine lock (200 ms debounce,
edit batches recorded by buffer.edit, full parse when the chain breaks).
syntax.outline {id} returns {items, truncated, version}; outlineChanged
{id} at most every 200 ms per buffer. Replaced trees and outlines are
freed on the worker.

UI: left stripe with Project | Structure in MainLayout, the Structure
tool window (WAI-ARIA tree, Lucide kind icons, signatures, jumps via
editor.reveal), view.toggleStructure on Mod+2.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
danny 2026-10-17 13:31:37 +02:00
parent 73819df926
commit c68932c39c
27 changed files with 2596 additions and 28 deletions

View file

@ -132,7 +132,8 @@ impl Engine {
/// changed directories and conflicts), writes due recovery-journal
/// entries (see [`crate::journal`]), moves finished search results into
/// events (see [`cmd::search`]), merges index updates (see
/// [`cmd::goto`]) and returns every queued event.
/// [`cmd::goto`]), stores finished parses and starts due ones (see
/// [`cmd::syntax`]) and returns every queued event.
/// Hosts call it regularly, e.g. every 100 ms from a background thread.
///
/// # Errors
@ -145,6 +146,7 @@ impl Engine {
crate::journal::tick(state, std::time::Instant::now());
cmd::search::pump(state);
cmd::goto::sync(state);
cmd::syntax::pump(state, std::time::Instant::now());
Ok(())
})?;
Ok(state.take_events())
@ -387,6 +389,7 @@ mod tests {
"settings.list",
"settings.reset",
"settings.set",
"syntax.outline",
"test.disabled",
"theme.list",
"theme.systemPreference",