Script editor error - collapsing functions and tabbing closing statements

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.
3 Likes

Part of the root cause is that the “then” in the elseif clause has its own fold level.

Ah, didn’t see someone else already posted. @buildthomas can this be merged?

2 Likes

A post was merged into an existing topic: Nested if-elseif-else block don’t collapse properly