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 >
.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4