Closed sebastianludwig closed 3 years ago
@sebastianludwig I'm seeing a slightly different bug. When I try your code sample with the default rules I get:
firstly {
doSomething()
}
// then do something else
.then {
doSomethingElse()
}
// convert the thing
.map {
transform($0)
}
which is caused by the blankLinesBetweenScopes
rule. Can you confirm which version of SwiftFormat you are using, and what configuration (if any)?
oh, yeah, could have thought of that
--disable blankLinesBetweenScopes
--disable wrapMultilineStatementBraces
--commas false
--xcodeindentation enabled
--extensionacl on-declarations
--modifierorder public,override
@sebastianludwig fixed in 0.47.13.
Hey, sorry for the delay, I just got around to testing the fix. The given example works great 👍 However I noticed a second constellation which does not work yet
input
// trim whitespace and newlines at the beginning and end
.trimmingCharacters(in: .whitespacesAndNewlines)
// trim spaces at the end of every line
.split(separator: "\n")
.map { String($0).replacingOccurrences(of: "\\s+$", with: "", options: .regularExpression) }
.joined(separator: "\n")
becomes
input
// trim whitespace and newlines at the beginning and end
.trimmingCharacters(in: .whitespacesAndNewlines)
// trim spaces at the end of every line
.split(separator: "\n")
.map { String($0).replacingOccurrences(of: "\\s+$", with: "", options: .regularExpression) }
.joined(separator: "\n")
Do you want me to open a separate issue for that?
We're using PromiseKit and sometimes like to annotate longer chains (I guess it's the same for Rx). Unfortunately the following code block
get's formatted to
Running SwiftFormat with
--verbose
showed that only-- rules applied: indent
was applied to the file. We did not find a way to change this behaviour - is there? Or is it a bug?A block without comments remains unchanged