pub fn leading_indent(node: &SyntaxNode) -> Option<SmolStr> {
    for token in prev_tokens(node.first_token()?) {
        if let Some(ws) = ast::Whitespace::cast(token.clone()) {
            let ws_text = ws.text();
            if let Some(pos) = ws_text.rfind('\n') {
                return Some(ws_text[pos + 1..].into());
            }
        }
        if token.text().contains('\n') {
            break;
        }
    }
    None
}
/// If the node is on the beginning of the line, calculate indent.
If the node is on the beginning of the line, calculate indent.
If the node is on the beginning of the line calculate indent .
pub fn leading_indent(node: &SyntaxNode) -> Option<SmolStr> {
    for token in prev_tokens(node.first_token()?) {
        if let Some(ws) = ast::Whitespace::cast(token.clone()) {
            let ws_text = ws.text();
            if let Some(pos) = ws_text.rfind('\n') {
                return Some(ws_text[pos + 1..].into());
            }
        }
        if token.text().contains('\n') {
            break;
        }
    }
    None
}
pub fn leading_indent ( node : & SyntaxNode ) -> Option < SmolStr > { for token in prev_tokens ( node . first_token ( ) ? ) { if let Some ( ws ) = ast :: Whitespace :: cast ( token . clone ( ) ) { let ws_text = ws . text ( ) ; if let Some ( pos ) = ws_text . rfind ( '\n' ) { return Some ( ws_text [ pos + 1 .. ] . into ( ) ) ; } } if token . text ( ) . contains ( '\n' ) { break ; } } None }
If the node is on the beginning of the line, calculate indent.
If the node is on the beginning of the line calculate indent .
node
&SyntaxNode