Skip to main content

Module document

Module document 

Source
Expand description

A source kept parsed across edits.

crate::highlight parses the whole text on every call. A Document holds the tree, takes each edit as it happens, and reparses from the old tree, so a keystroke costs a reparse of what it touched.

Spans come back the way crate::highlight paints them: of the patterns that capture one node, the first in the query wins, and a node inside another paints over it.

Document::new answers None for a Grammar::Wasm language and for a language with an injections query.

Structs§

Document
One text, its language, and its current tree.