For example, if you have an if-then-else expression with a cast and a less-than operation, you might write
return if (foo :: number) < bar
then very + very + very + long + line + right + here + hopefully
else lets + ensure + stylua + writes + this + out + using + multiple + lines
When the line is long enough for StyLua 2.0.2 with syntax = "Luau" specified in the config to prefer formatting it in this way, with then and else on their own lines, it also chooses to discard the parentheses around the cast expression, leaving
return if foo :: number < bar
then very + very + very + long + line + right + here + hopefully
else lets + ensure + stylua + writes + this + out + using + multiple + lines
This is a syntax error because the parser thinks bar is now a type parameter for number, thanks to < after number, but never finds a closing >.
For example, if you have an if-then-else expression with a cast and a less-than operation, you might write
When the line is long enough for StyLua 2.0.2 with
syntax = "Luau"specified in the config to prefer formatting it in this way, withthenandelseon their own lines, it also chooses to discard the parentheses around the cast expression, leavingThis is a syntax error because the parser thinks
baris now a type parameter fornumber, thanks to<afternumber, but never finds a closing>.