File tree Expand file tree Collapse file tree 2 files changed +9
-27
lines changed
Sources/SwiftFormat/PrettyPrint
Tests/SwiftFormatTests/PrettyPrint Expand file tree Collapse file tree 2 files changed +9
-27
lines changed Original file line number Diff line number Diff line change @@ -1516,7 +1516,7 @@ fileprivate final class TokenStreamCreator: SyntaxVisitor {
1516
1516
1517
1517
override func visit( _ node: SourceFileSyntax ) -> SyntaxVisitorContinueKind {
1518
1518
if shouldFormatterIgnore ( file: node) {
1519
- appendFormatterIgnored ( node : Syntax ( node) )
1519
+ appendToken ( . verbatim ( Verbatim ( text : " \ ( node) " , indentingBehavior : . none ) ) )
1520
1520
return . skipChildren
1521
1521
}
1522
1522
after ( node. shebang, tokens: . break( . same, newlines: . soft) )
Original file line number Diff line number Diff line change @@ -318,36 +318,18 @@ final class IgnoreNodeTests: PrettyPrintTestCase {
318
318
{
319
319
var bazzle = 0 }
320
320
"""
321
+ assertPrettyPrintEqual ( input: input, expected: input, linelength: 50 )
322
+ }
321
323
322
- let expected =
324
+ func testIgnoreWholeFileDoesNotTouchWhitespace( ) {
325
+ let input =
323
326
"""
324
327
// swift-format-ignore-file
325
- import Zoo
326
- import Aoo
327
- import foo
328
-
329
- struct Foo {
330
- private var baz: Bool {
331
- return foo +
332
- bar + // poorly placed comment
333
- false
334
- }
335
-
336
- var a = true // line comment
337
- // aligned line comment
338
- var b = false // correct trailing comment
339
-
340
- var c = 0 +
341
- 1
342
- + (2 + 3)
343
- }
344
-
345
- class Bar
346
- {
347
- var bazzle = 0 }
328
+ /// foo bar
329
+ \u{0020}
330
+ // baz
348
331
"""
349
-
350
- assertPrettyPrintEqual ( input: input, expected: expected, linelength: 50 )
332
+ assertPrettyPrintEqual ( input: input, expected: input, linelength: 100 )
351
333
}
352
334
353
335
func testIgnoreWholeFileInNestedNode( ) {
You can’t perform that action at this time.
0 commit comments