Scenario 1
Nested if-expressions without parentheses will be treated as incomplete if-blocks.
local variable =
if cond_a then if cond_b then 1 else 2 else 3
Scenario 2
When there is a comment line in between an assignment’s = character and if-expression line, then the if-expression will be treated as an incomplete if-block.
local variable =
-- some comment
if condition then 1 else 2
When either of these situations happen, the indentation level will be increased by 1 for all following code (and this stacks).
print("hey!")
whereas it should be:
print("hey!")
Also, a redundant end will be added when pressing enter when the cursor is at location which supports end auto-complete/auto-formatting (provided that format-on-enter is enabled in studio settings).
if thing then
end -- (inserted automatically when pressing enter)
print("hey!")
end
Also, this prevents code blocks from collapsing correctly: the final end will not be visible when collapsed, and the next highest level of the code following what should be the final end will also be collapsed (since the parser is looking for an extra end).