Closed dollar2048 closed 1 year ago
I have this piece of Swift code:
struct FontKit { var style: UIFont.TextStyle var size: CGFloat? } var title: FontKit { #if os(iOS) .init(style: .title2) #else .init(style: .title2, size: 40) #endif }
When running SwiftFormat 0.51.9 with --ifdef no-indent I get:
--ifdef no-indent
But I would expect no changes to be made.
Some interesting info: The following UnitTests (SwiftUI) are working fine: https://github.com/nicklockwood/SwiftFormat/blob/master/Tests/RulesTests%2BIndentation.swift#L2135
So in case of some code presence before #if it works as expected. Otherwise, not.
#if
@dollar2048 fixed in 0.51.10
Thank you @nicklockwood. it works now perfectly!
I have this piece of Swift code:
When running SwiftFormat 0.51.9 with
--ifdef no-indent
I get:But I would expect no changes to be made.
Some interesting info: The following UnitTests (SwiftUI) are working fine: https://github.com/nicklockwood/SwiftFormat/blob/master/Tests/RulesTests%2BIndentation.swift#L2135
So in case of some code presence before
#if
it works as expected. Otherwise, not.