mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-29 14:33:29 +00:00
fix: inserted imports must come after a shebang if present
This commit is contained in:
parent
f32ad8362f
commit
c32f133236
1 changed files with 2 additions and 1 deletions
|
@ -403,7 +403,8 @@ fn insert_use_(
|
||||||
.take_while(|child| match child {
|
.take_while(|child| match child {
|
||||||
NodeOrToken::Node(node) => is_inner_attribute(node.clone()),
|
NodeOrToken::Node(node) => is_inner_attribute(node.clone()),
|
||||||
NodeOrToken::Token(token) => {
|
NodeOrToken::Token(token) => {
|
||||||
[SyntaxKind::WHITESPACE, SyntaxKind::COMMENT].contains(&token.kind())
|
[SyntaxKind::WHITESPACE, SyntaxKind::COMMENT, SyntaxKind::SHEBANG]
|
||||||
|
.contains(&token.kind())
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.filter(|child| child.as_token().map_or(true, |t| t.kind() != SyntaxKind::WHITESPACE))
|
.filter(|child| child.as_token().map_or(true, |t| t.kind() != SyntaxKind::WHITESPACE))
|
||||||
|
|
Loading…
Reference in a new issue