Incorrect auto formatting when multiple method calls are made

Reproduction Steps
Using two or more : or . on the same line will cause the auto-formatting to display an incorrect result for arguments provided within the next lines.

Let’s say we have a sample class:

local class = {}
function class.recursive(foo, bar)
    return class
end

You would then call the method recursive of class twice on the same line. Note that this isn’t limited to just recursive methods, this is just an example.
You would then provide arguments on proceeding lines after calling the method:

class.recursive().recursive(
    "foo",
    "bar"
)

Expected Behavior
Calling the method on one line, while providing arguments in the next lines within the parenthesis will format correctly:

class.recursive().recursive(
    "foo", --> tab
    "bar" --> tab
)

Actual Behavior
Calling the method on one line, while providing arguments in the next lines within the parenthesis will format incorrectly:

class.recursive().recursive(
"foo", --> no tab
"bar" --> no tab
)

Workaround

  1. Calling everything on one line:
class.recursive().recursive("foo", "bar")
  1. Skipping a line on the second method call:
class.recursive()
.recursive(
    "foo",
    "bar"
)
  1. Manually formatting the code

Here’s a video of some listed examples:


Issue Area: Studio
Issue Type: Display
Impact: Moderate
Frequency: Constantly

5 Likes

Thanks for the report! We’ll follow up when we have an update for you.

3 Likes

The issue should be fixed now!

Thank you for your patience and sorry for the delay!

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