Construct a tree fragment. You'll usually want to use
addTree and
applyChanges instead of
calling this directly.
The start of the unchanged range pointed to by this fragment. This refers to an offset in the updated document (as opposed to the original tree).
The end of the unchanged range.
The tree that this fragment is based on.
The offset between the fragment's tree and the document that this fragment can be used against. Add this when going from document to tree positions, subtract it to go from tree to document positions.
OptionalopenStart: booleanOptionalopenEnd: booleanReadonlyfromThe start of the unchanged range pointed to by this fragment. This refers to an offset in the updated document (as opposed to the original tree).
ReadonlyoffsetThe offset between the fragment's tree and the document that this fragment can be used against. Add this when going from document to tree positions, subtract it to go from tree to document positions.
ReadonlytoThe end of the unchanged range.
ReadonlytreeThe tree that this fragment is based on.
Whether the end of the fragment represents the end of a full-document parse, or the start of a change.
Whether the start of the fragment represents the start of a parse, or the end of a change. (In the second case, it may not be safe to reuse some nodes at the start, depending on the parsing algorithm.)
StaticaddCreate a set of fragments from a freshly parsed tree, or update
an existing set of fragments by replacing the ones that overlap
with a tree with content from the new tree. When partial is
true, the parse is treated as incomplete, and the resulting
fragment has openEnd set to
true.
Optionalfragments: readonly TreeFragment[]Optionalpartial: booleanStaticapplyApply a set of edits to an array of fragments, removing or splitting fragments as necessary to remove edited ranges, and adjusting offsets for fragments that moved.
OptionalminGap: number
Tree fragments are used during incremental parsing to track parts of old trees that can be reused in a new parse. An array of fragments is used to track regions of an old tree whose nodes might be reused in new parses. Use the static
applyChangesmethod to update fragments for document changes.