SwiftFormat icon indicating copy to clipboard operation
SwiftFormat copied to clipboard

Rule for "remove blank line in multi-line code chaining"?

Open pfurbacher opened this issue 4 years ago • 2 comments

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 avatar Jun 10 '21 20:06 pfurbacher

@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.

nicklockwood avatar Jun 11 '21 08:06 nicklockwood

Looks like this was just implemented! https://github.com/nicklockwood/SwiftFormat/pull/1480

calda avatar Aug 05 '23 01:08 calda