The first child, if the node has children.
ReadonlyfromThe start position of the node.
The node's last child, if available.
ReadonlynameThe name of the node (.type.name).
This node's next sibling, if any.
ReadonlynodeRetrieve a stable syntax node at this position.
The node's parent node, if any.
This node's previous sibling.
ReadonlytoThe end position of the node.
ReadonlytreeGet the tree that represents the current node, if any. Will return null when the node is in a tree buffer.
ReadonlytypeThe type of the node.
Enter the child at the given position. If side is -1 the child may end at that position, when 1 it may start there.
This will by default enter
overlaid
mounted trees. You can set
overlays to false to disable that.
Similarly, when buffers is false this will not enter
buffers, only nodes (which
is mostly useful when looking for props, which cannot exist on
buffer-allocated nodes).
Optionalmode: IterModeMove the position to the innermost node before pos that looks
like it is unfinished (meaning it ends in an error node or has a
child ending in an error node right at its end).
Get the first child of the given type (which may be a node
name or a group
name). If before is non-null, only
return children that occur somewhere after a node with that name
or group. If after is non-null, only return children that
occur somewhere before a node with that name or group.
Optionalbefore: string | numberOptionalafter: string | numberLike getChild, but return all
matching children, not just the first.
Optionalbefore: string | numberOptionalafter: string | numberTest whether the node matches a given context—a sequence of direct parent nodes. Empty strings in the context array act as wildcards, other strings must match the ancestor node's name.
Find the node around, before (if side is -1), or after (side
is 1) the given position. Will look in parent nodes if the
position is outside this node.
Optionalside: -1 | 0 | 1Similar to resolve, but enter
overlaid nodes.
Optionalside: -1 | 0 | 1
A syntax node provides an immutable pointer to a given node in a tree. When iterating over large amounts of nodes, you may want to use a mutable cursor instead, which is more efficient.