fix: Fix import insertion not being fully cfg aware

This commit is contained in:
Lukas Wirth 2025-05-28 14:24:02 +02:00 committed by Lukas Wirth
parent cd413d0cac
commit 1f0052a496
12 changed files with 214 additions and 128 deletions

View file

@ -207,5 +207,12 @@ fn ws_between(left: &SyntaxElement, right: &SyntaxElement) -> Option<SyntaxToken
}
return Some(make::tokens::whitespace(&format!("\n{indent}")));
}
if left.kind() == SyntaxKind::ATTR {
let mut indent = IndentLevel::from_element(right);
if right.kind() == SyntaxKind::ATTR {
indent.0 = IndentLevel::from_element(left).0.max(indent.0);
}
return Some(make::tokens::whitespace(&format!("\n{indent}")));
}
Some(make::tokens::single_space())
}