Skip to content

602.0.0 and 603.0.0 produce different output with the same configuration #1242

Description

@davidkoski

See attached config -- this is the dump from 603 with a few custom settings at the top:

swift-format.txt

Consider this swift file:

import Foundation
import MLX
@_spi(Testing) @testable import MLXLMCommon
import MLXNN
import Testing

struct Test {
}

Test.swift.txt

602 gives this output:

[dkoski@dkoski-m5 swift-format-602 (602.0.0)]$ swift run swift-format /tmp/Test.swift
import Foundation
import MLX
@_spi(Testing) @testable import MLXLMCommon
import MLXNN
import Testing

struct Test {
}

while 603 gives this output:

[dkoski@dkoski-m5 swift-format (603.0.0 ✗)]$ swift run swift-format /tmp/Test.swift
import Foundation
import MLX
import MLXNN
import Testing

@_spi(Testing) @testable import MLXLMCommon

struct Test {
}

The new configuration in 603 is:

  "indentBlankLines" : false,
  "orderedImports" : {
    "includeConditionalImports" : true
  },

and no setting on those will produce the 602 output. This makes it hard to use in CI -- do I pin a version of swift-format? Ideally no, because people might use different versions for various reasons. Can I just use config to make all the versions do the same thing? Ideally yes -- this would be stable. You just need a version later than the one it is based on.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions