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

@ -187,6 +187,13 @@ pub enum Event {
/// Wall time of the build in milliseconds.
elapsed_ms: u64,
},
/// The outline of a buffer changed; refetch it with `syntax.outline`.
/// Sent at most every 200 ms per buffer, and once after a buffer's
/// first parse.
OutlineChanged {
/// Buffer id.
id: u64,
},
}
/// One match of [`Event::SearchResults`]. Positions are 0-based; columns
@ -361,4 +368,12 @@ mod tests {
json!({"kind": "recoveryResolved", "paths": ["src/a.php"]})
);
}
#[test]
fn outline_changed_shape() {
assert_eq!(
serde_json::to_value(Event::OutlineChanged { id: 4 }).unwrap(),
json!({"kind": "outlineChanged", "id": 4})
);
}
}