nicklockwood / SwiftFormat

A command-line tool and Xcode Extension for formatting Swift code
MIT License
7.9k stars 639 forks source link

Options for blanklinesaroundmark #464

Closed dmiluski closed 4 years ago

dmiluski commented 5 years ago

Given Rule blanklinesaroundmark https://github.com/nicklockwood/SwiftFormat/blob/master/Rules.md#blanklinesaroundmark

I have a preference for 2 lines above // MARK: and 1 line below to help boost readability of each section.

Request: Provide options for rule blanklinesaroundmark

Options { -default: 1 line above, 1 line below -spacious: 2 lines above, 1 line below }

I'm going to start reading through rule/options for a better understanding, but seeing if this would be useful to other parties of created? If here are any hints on where to start if I am to file a PR shortly if there is a prior model to use as precedence that could be useful here?

Questions:

  1. Option names?
  2. Implementation details
lordzsolt commented 5 years ago

I would also like to have this option.

I went ahead and implemented it as well. After a few hours of that, I realised it interferes with the consecutiveBlankLines rule. And there seems to be no precedence of setting up logic between rules.

Technically you could make one of them run before the other one, but that is fragile.

I'd love to hear some suggestions from the current maintainers of the project.

ullstrm commented 2 years ago

This is a rule we would very much like to have in place!