Skip to main content

Module ptr

Module ptr 

Source
Expand description

A cursor-free, serializable handle to a CST node.

rowan ships SyntaxNodePtr / AstPtr for the same-revision case (re-exported from crate::ast), but their fields are private — they cannot be constructed from a mapped (kind, range) or deserialized. NodePtr is arity’s canonical handle: it owns its construction (so a range mapped across an edit can be re-resolved) and derives serde (so it can ride an LSP CallHierarchyItem.data field).

Like rowan’s pointers, a NodePtr resolves only against a tree built from the same text it was taken against. To survive an edit, first map its range through that edit (map_range_through_edit), then resolve against the new tree — the path the arity crate’s incremental::Analysis::resolve_ptr takes.

Structs§

NodePtr
A location-based handle to a syntax node: its SyntaxKind plus its text range. Cheap (Copy), serializable, and resolvable to a live SyntaxNode via NodePtr::try_to_node.