nicklockwood / SwiftFormat

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

Make blankLinesAroundMark prioritized over blankLinesAtStartOfScope #1541

Open ghost opened 10 months ago

ghost commented 10 months ago

Currently blankLinesAtStartOfScope is prioritized over the blankLinesAroundMark rule.

Consequently, when both rules are enabled, if you create a class/struct/... with a MARK at the beginning, the rule applies to the lower portion, but for the upper section, it's overridden by blankLinesAtStartOfScope.

I suggest giving priority to blankLinesAroundMark, as it aligns with most common code styles. Alternatively, implementing a prioritization rule between these two would be an option.

Example of both rules being turned on:

  class Foo {
-
    // MARK: - Properties
    var bar: String
  }

  class Foo {
    // MARK: - Properties
+
    var bar: String
  }