swift-format breaks compilation when reformatting code with """ includes other """ multiline strings, like these:
let initSyntax: DeclSyntax = """
public init(_ enumValue: \(raw: name), environment: JNIEnvironment? = nil) {
let _environment = if let environment {
environment
} else {
try! JavaVirtualMachine.shared().environment()
}
let classObj = try! JavaClass<Self>(in: _environment)
switch enumValue {
\(raw: enumFields.map {
return """
case .\($0.getName()):
if let \($0.getName()) = classObj.\($0.getName()) {
self = \($0.getName())
} else {
fatalError("Enum value \($0.getName()) was unexpectedly nil, please re-run Java2Swift on the most updated Java class")
}
"""
}.joined(separator: "\n"))
}
}
""" <<<< this gets formatted wrong
results in:
/__w/swift-java/swift-java/Sources/Java2SwiftLib/JavaTranslator.swift:586:5: error: insufficient indentation of line in multi-line string literal
584 | }
585 | """
586 | }.joined(separator: "\n"))
| |- error: insufficient indentation of line in multi-line string literal
| `- note: change indentation of this line to match closing delimiter
587 | }
588 | }
589 | """
| `- note: should match space here
590 |
swift-format breaks compilation when reformatting code with """ includes other """ multiline strings, like these:
results in:
Like here: https://github.com/swiftlang/swift-java/actions/runs/11511458930/job/32044929995?pr=109
Version: