Describe the bug. Describe what is happening when the bug occurs. Describe what you would normally expect to occur.
The following code snippet:
if true then
if true then
if true then
return true
elseif true then
return true
else
return true
end
else
if true then
return true
elseif true then
return true
else
return true
end
end
end
Collapses improperly when I collapse the third if-block in line 3:
Collapses into:
Normally I’d expect it to collapse up to its matching end at line 9.
Trying to collapse the first two if-blocks (line 1 and line 2) don’t have any effect.
Also, collapsing the first elseif block (line 5) collapses the rest of the if-statement:
There is a bug in the script editor that causes scripts to collapse wrong. It also causes automatic incorrect tabbing of closing statements. This only seems to happen with functions containing elseif statements, single if statements and statements containing else, do not seem effected. This issue does not effect running the game, the scripts run as normal.
I noticed this bug today, but I hadn’t used the script editor since Thursday.
In this image the entire function should be collapsed:
Collapsing the first If statement also collapses the final end:
Creating a new line at the end of the script tabs the last end over automatically:
Repro:
Open a new world and insert a server script.
Create a simple function with an if statement containing elseif like the one shown in images
Another issue I noticed is if you type certain keywords in comments, then the collapsing still takes into account the commented code. It doesn’t work with “do” and “function”
and:
The down arrow shows that the code can be collapsed, and when I do collapse the comment just swallows up all code until the next “end” keyword. This is very frustrating because the comment can have any amount of words with a “do” or “function” word in it, and it will become collapsible.
Another case of the collapsing error is when you index a table with another table value inside a function: