Skip to content

Conditionally compiled imports not sorted #1027

Open
@natecook1000

Description

@natecook1000

Imports outside of conditional compilation blocks are sorted, but inside, the ordering of imports is ignored. For example, this code:

import Zebras
import Apples
#if canImport(Darwin)
  import Foundation
  import Darwin
#elseif canImport(Glibc)
  import Glibc
  import Foundation
#endif
import Aardvarks

is currently formatted as:

import Aardvarks
import Apples
import Zebras

#if canImport(Darwin)
  import Foundation
  import Darwin
#elseif canImport(Glibc)
  import Glibc
  import Foundation
#endif

leaving the Foundation imports out of order. The result should be:

import Aardvarks
import Apples
import Zebras

#if canImport(Darwin)
  import Darwin
  import Foundation
#elseif canImport(Glibc)
  import Foundation
  import Glibc
#endif

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