editor-core-treesitter
editor-core-treesitter provides an offline, incremental Tree-sitter pipeline for
editor-core:
- syntax highlighting →
ProcessingEdit::ReplaceStyleLayer - folding regions →
ProcessingEdit::ReplaceFoldingRegions
The public output is expressed in editor-core's derived-state model, so hosts can apply results
through EditorStateManager::apply_processing_edits (or apply_processor).
Quick start
use EditorStateManager;
use ;
use LANGUAGE;
let mut state = new;
let config = new
.with_default_rust_folds
.with_simple_capture_styles;
let mut processor = new.unwrap;
state.apply_processor.unwrap;
Notes
- Incrementality is driven by
EditorStateManager::last_text_delta(); if no delta is available (or it doesn't match the processor's internal text), the processor falls back to a full re-parse. - Queries are Tree-sitter queries (
.scm) and capture names are mapped toStyleIdby the host.