We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f88b07c commit 167e2ffCopy full SHA for 167e2ff
Sources/CasePathsMacros/CasePathableMacro.swift
@@ -140,11 +140,13 @@ extension CasePathableMacro: MemberMacro {
140
let leadingTriviaLines = decl.leadingTrivia.description
141
.drop(while: \.isNewline)
142
.split(separator: "\n", omittingEmptySubsequences: false)
143
- let indent = leadingTriviaLines
+ let indent =
144
+ leadingTriviaLines
145
.compactMap { $0.isEmpty ? nil : $0.prefix(while: \.isWhitespace).count }
146
.min(by: { (lhs: Int, rhs: Int) -> Bool in lhs == 0 ? lhs > rhs : lhs < rhs })
147
?? 0
- let leadingTrivia = leadingTriviaLines
148
+ let leadingTrivia =
149
150
.map { String($0.dropFirst(indent)) }
151
.joined(separator: "\n")
152
return """
0 commit comments