createIncrementalParseStateField
Creates a state field that parses the document with the given parser when the state is created, and parses it again incrementally on every document change, reusing the fragments the change left intact.
Import:
import { createIncrementalParseStateField } from '@mnaoumov/obsidian-lib/codemirror/incremental-parse-state-field';Signature:
function createIncrementalParseStateField(parser: Parser): StateField<IncrementalParse>Parameters:
| Parameter | Type | Description |
|---|---|---|
parser |
Parser | The Lezer parser to parse the document with. |
Returns: StateField<IncrementalParse> — The state field. Add it to the editor’s extensions and read it with state.field(field).tree.