Closed munificent closed 2 months ago
instead of just failing to format
Does it fail to format, or does it change the order to the correct one in the formatted code?
Prior to this PR, it would change the order to the correct one in the formatter output. But that would then cause the formatter's own internal "I only make whitespace changes" sanity check to fail since it would see that as a non-whitespace change, which would then cause the formatter to abort writing that file.
With this PR, it just keeps the order that the user wrote, which also then means it is only making whitespace changes.
Oh I see from the other thread it trips the detection that something other than whitespace changed...
PR #1550 fixed the bug where if you had both clauses, it would output them in the wrong order. But it turns out that the parser today allows them in either order even though the language spec doesn't.
Since I've seen a handful of cases like this in the wild, instead of just failing to format, simply preserve the clause order that the user wrote.