@@ -1519,6 +1519,7 @@ fileprivate final class TokenStreamCreator: SyntaxVisitor {
1519
1519
appendFormatterIgnored ( node: Syntax ( node) )
1520
1520
return . skipChildren
1521
1521
}
1522
+ after ( node. shebang, tokens: . break( . same, newlines: . soft) )
1522
1523
after ( node. endOfFileToken, tokens: . break( . same, newlines: . soft) )
1523
1524
return . visitChildren
1524
1525
}
@@ -2673,7 +2674,7 @@ fileprivate final class TokenStreamCreator: SyntaxVisitor {
2673
2674
var verbatimText = " "
2674
2675
for piece in trailingTrivia [ ... lastIndex] {
2675
2676
switch piece {
2676
- case . shebang , . unexpectedText, . spaces, . tabs, . formfeeds, . verticalTabs:
2677
+ case . unexpectedText, . spaces, . tabs, . formfeeds, . verticalTabs:
2677
2678
piece. write ( to: & verbatimText)
2678
2679
default :
2679
2680
// The implementation of the lexer today ensures that newlines, carriage returns, and
@@ -3160,7 +3161,7 @@ fileprivate final class TokenStreamCreator: SyntaxVisitor {
3160
3161
}
3161
3162
}
3162
3163
3163
- case . shebang ( let text ) , . unexpectedText( let text) :
3164
+ case . unexpectedText( let text) :
3164
3165
// Garbage text in leading trivia might be something meaningful that would be disruptive to
3165
3166
// throw away when formatting the file, like a hashbang line or Unicode byte-order marker at
3166
3167
// the beginning of a file, or source control conflict markers. Keep it as verbatim text so
0 commit comments