Module ra_ap_syntax::algo [−][src]
Expand description
Collection of assorted algorithms for syntax trees.
Structs
Enums
Functions
Returns ancestors of the node at the offset, sorted by length. This should
do the right thing at an edge, e.g. when searching for expressions at { $0foo }
we will get the name reference instead of the whole block, which
we would get if we just did find_token_at_offset(...).flat_map(|t| t.parent().ancestors())
.
Finds a (potentially minimal) diff, which, applied to from
, will result in to
.
Finds a node of specific Ast type at offset. Note that this is slightly imprecise: if the cursor is strictly between two nodes of the desired type, as in
Adds specified children (tokens or nodes) to the current node at the specific position.
Finds the first sibling in the given direction which is not trivia
Replaces all nodes in to_delete
with nodes from to_insert
Skip to next non trivia
token