SwiftFormat
SwiftFormat copied to clipboard
Rule for "remove blank line in multi-line code chaining"?
SwiftFormat does not seem to have a rule to deal with the following untidiness:
Text("Hello, world")
.font(.footnote)
.foregroundColor(Color.gray)
I would expect to be able to remove the extra blank line, yielding:
Text("Hello, world")
.font(.footnote)
.foregroundColor(Color.gray)
Neither "Format Selection" nor "Format File" resolves this.
@pfurbacher you're right - I tend to assume that blank lines to break up code should be at the developer's discretion. I think it would make sense to make an exception for lines inserted inside a chained expression though.
Looks like this was just implemented! https://github.com/nicklockwood/SwiftFormat/pull/1480