Script editor's does not collapse blocks of code properly (examples in the thread's replies)

  • 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:

image

Collapses into:

image

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:

image

6 Likes

This is happening to me too.

2 Likes

I’ve found what I think is the same bug by using keywords in comments.

Note the fold/unfold arrow to the left of the comment which shouldn’t be there.

RobloxStudioBeta_2018-08-15_05-46-50

RobloxStudioBeta_2018-08-15_05-47-23

5 Likes

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:
image

Collapsing the first If statement also collapses the final end:
image

Creating a new line at the end of the script tabs the last end over automatically:
image

Repro:

  1. Open a new world and insert a server script.
  2. Create a simple function with an if statement containing elseif like the one shown in images
  3. Try to collapse sections of the function.
6 Likes

Bump. This bug is a huge time waster.

1 Like

This is still happening and is getting a bit irritating to always have to manually fix.

1 Like

I’ve never used the collapse feature because as long as I can remember it’s been buggy. Roblox please fix!

2 Likes

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”
image

and:

image

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:
image

will collapse to:
image

1 Like

I noticed that this has been fixed. Hooray!

Looks like they fixed this specific case, but code folding still gets bugged out by comments.

1 Like

There’s a more dedicated thread for that one: Script Editor: Folding does not work properly when keywords in comments or elseif is involved

3 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.