Swiftformat: Multiline comments formatting breaks with 0.44.8

Created on 4 May 2020  路  3Comments  路  Source: nicklockwood/SwiftFormat

I would assume this is either a side-effect of #609 or something that was present before 0.44.8, but currently this snippet:

public final class TestView {
  /** Initialize a new test view.
  */
  init<V: View>(_ view: V,
                _ subviews: [TestView] = []) {
  }
}

is re-formatted as

public final class TestView {
  /** Initialize a new test view.
      */
  init<V: View>(_ view: V,
                _ subviews: [TestView] = []) {}
}

And then on a subsequent formatting iteration as

public final class TestView {
  /** Initialize a new test view.
          */
  init<V: View>(_ view: V,
                _ subviews: [TestView] = []) {}
}

and so on, with the position of */ never converging to something fixed.

I know this would be detrimental for performance, but maybe SwiftFormat could do another formatting run internally to verify that it converges to something stable to avoid issues like this in the future? Maybe if not in CLI runs for users, then in the test suite if it's not doing that in the test suite yet?

bug fixed in develop

All 3 comments

I know this would be detrimental for performance, but maybe SwiftFormat could do another formatting run internally to verify that it converges to something stable to avoid issues like this in the future? Maybe if not in CLI runs for users, then in the test suite if it's not doing that in the test suite yet?

It does this in the test suite, but unfortunately it only works for cases included in the test suite :-)

I'll add this case, and fix it for the next release.

@MaxDesiatov fixed in 0.44.9

Splendid, thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fellipecaetano picture fellipecaetano  路  4Comments

shripada picture shripada  路  3Comments

zizi4n5 picture zizi4n5  路  3Comments

AniHovhannisyanAni picture AniHovhannisyanAni  路  3Comments

MaxDesiatov picture MaxDesiatov  路  3Comments