Open Ahbee opened 1 month ago
The explanation here is the same as for your other report - in Swift a+ b
is not legal code.
In this case since the intent is obvious I can probably add a workaround, but there are other cases like a+ -b
that are legal in C but would be ambiguous in Swift.
Sorry, my reading comprehension is not good today 🤦♂️ I'm not sure why the formatting isn't being applied here - I will investigate.
@Ahbee I think what's happening here is that by default the SwiftFormat Xcode extension has the "Infer Options Automatically" option enabled, which means that it looks at the existing contents of the file to decide which settings to use. If your file has more unspaced operators than spaced ones, it will assume that's the style you wanted.
Uncheck the "Infer Options Automatically" option in the SwiftFormat for Xcode app and see if that solves it.
yeah that seems to solve it thanks! But I feel that option should not be part of the default? I think most new users would just be confused why the code is not formatting?
Im using the Xcode source editor extension with the default options, However the space around the
+
and*
is not being applied for this input:the formatting does nothing but I expect it to look like this: