Swiftformat: Unexpected `spaceInsideBraces` spacing instead of newline

Created on 10 Jun 2020  路  2Comments  路  Source: nicklockwood/SwiftFormat

With this code:

foo.subscribe(onNext: {
       if true {
       }})

If you format with swiftformat --rules spaceInsideBraces foo.swift --swiftversion 5.2 --cache clear

You get:

foo.subscribe(onNext: {
       if true {
       } })

But maybe this should be used alongside another rule to give you something more like:

foo.subscribe(onNext: {
       if true {
       }
})

0.44.13

bug fixed in develop

All 2 comments

But maybe this should be used alongside another rule to give you something more like:

foo.subscribe(onNext: {
       if true {
       }
})

With the default settings, the emptyBraces rule means this gets formatted as

foo.subscribe(onNext: {
    if true {}
})

which seems pretty reasonable.

@keith fixed in 0.44.15. Thanks for reporting!

Was this page helpful?
0 / 5 - 0 ratings