fn descend_node_at_offset(
        &self,
        node: &SyntaxNode,
        offset: TextSize,
    ) -> impl Iterator<Item = impl Iterator<Item = SyntaxNode> + '_> + '_ {
        node.token_at_offset(offset)
            .map(move |token| self.descend_into_macros(token))
            .map(|descendants| {
                descendants.into_iter().map(move |it| self.token_ancestors_with_macros(it))
            })
            // re-order the tokens from token_at_offset by returning the ancestors with the smaller first nodes first
            // See algo::ancestors_at_offset, which uses the same approach
            .kmerge_by(|left, right| {
                left.clone()
                    .map(|node| node.text_range().len())
                    .lt(right.clone().map(|node| node.text_range().len()))
            })
    }
// Note this return type is deliberate as [`find_nodes_at_offset_with_descend`] wants to stop
// traversing the inner iterator when it finds a node.
// The outer iterator is over the tokens descendants
// The inner iterator is the ancestors of a descendant
Note this return type is deliberate as [`find_nodes_at_offset_with_descend`] wants to stop
traversing the inner iterator when it finds a node.
The outer iterator is over the tokens descendants
The inner iterator is the ancestors of a descendant
Note this return type is deliberate as [ ` find_nodes_at_offset_with_descend ` ] wants to stop traversing the inner iterator when it finds a node . The outer iterator is over the tokens descendants The inner iterator is the ancestors of a descendant
fn descend_node_at_offset(
        &self,
        node: &SyntaxNode,
        offset: TextSize,
    ) -> impl Iterator<Item = impl Iterator<Item = SyntaxNode> + '_> + '_ {
        node.token_at_offset(offset)
            .map(move |token| self.descend_into_macros(token))
            .map(|descendants| {
                descendants.into_iter().map(move |it| self.token_ancestors_with_macros(it))
            })
            // re-order the tokens from token_at_offset by returning the ancestors with the smaller first nodes first
            // See algo::ancestors_at_offset, which uses the same approach
            .kmerge_by(|left, right| {
                left.clone()
                    .map(|node| node.text_range().len())
                    .lt(right.clone().map(|node| node.text_range().len()))
            })
    }
fn descend_node_at_offset ( & self , node : & SyntaxNode , offset : TextSize , ) -> impl Iterator < Item = impl Iterator < Item = SyntaxNode > + ' _ > + ' _ { node . token_at_offset ( offset ) . map ( move | token | self . descend_into_macros ( token ) ) . map ( | descendants | { descendants . into_iter ( ) . map ( move | it | self . token_ancestors_with_macros ( it ) ) } ) // re-order the tokens from token_at_offset by returning the ancestors with the smaller first nodes first // See algo::ancestors_at_offset, which uses the same approach . kmerge_by ( | left , right | { left . clone ( ) . map ( | node | node . text_range ( ) . len ( ) ) . lt ( right . clone ( ) . map ( | node | node . text_range ( ) . len ( ) ) ) } ) }
Note this return type is deliberate as [`find_nodes_at_offset_with_descend`] wants to stop
traversing the inner iterator when it finds a node.
Note this return type is deliberate as [ ` find_nodes_at_offset_with_descend ` ] wants to stop traversing the inner iterator when it finds a node .
&self
node
&SyntaxNode
offset
TextSize
&self
node
&SyntaxNode
offset
TextSize