/// Finds the first sibling in the given direction which is not `trivia`
Finds the first sibling in the given direction which is not `trivia`
Finds the first sibling in the given direction which is not ` trivia `
pub fn non_trivia_sibling(element: SyntaxElement, direction: Direction) -> Option<SyntaxElement> {
    return match element {
        SyntaxElement::Node(node) => node.siblings_with_tokens(direction).skip(1).find(not_trivia),
        SyntaxElement::Token(token) => {
            token.siblings_with_tokens(direction).skip(1).find(not_trivia)
        }
    };
    fn not_trivia(element: &SyntaxElement) -> bool {
        match element {
            SyntaxElement::Node(_) => true,
            SyntaxElement::Token(token) => !token.kind().is_trivia(),
        }
    }
}
pub fn non_trivia_sibling ( element : SyntaxElement , direction : Direction ) -> Option < SyntaxElement > { return match element { SyntaxElement :: Node ( node ) => node . siblings_with_tokens ( direction ) . skip ( 1 ) . find ( not_trivia ) , SyntaxElement :: Token ( token ) => { token . siblings_with_tokens ( direction ) . skip ( 1 ) . find ( not_trivia ) } } ; fn not_trivia ( element : & SyntaxElement ) -> bool { match element { SyntaxElement :: Node ( _ ) => true , SyntaxElement :: Token ( token ) => ! token . kind ( ) . is_trivia ( ) , } } }
Finds the first sibling in the given direction which is not `trivia`
Finds the first sibling in the given direction which is not ` trivia `
element
SyntaxElement
direction
Direction