Auto Indent Rule re-indents the line you press enter FROM

When you have a piece of code like this:

local goldPet = normalPet:Clone()
  :SetGolden()
  :SetAmount(amountGold)

And you press Enter on the “:SetAmount(amountGold)” line, it turns the code into this:

local goldPet = normalPet:Clone()
  :SetGolden()
:SetAmount(amountGold)

This is very frustrating, and there is no simple solution. This is using the Auto Indent Rule ‘Absolute’. I have tried using ‘Relative’ but this creates further issues elsewhere.

Auto-indent should only effect the indent of the next line your cursor is being sent to - NOT the current line. This behavior should either be disabled, or it should have an option in the settings for it.

Expected behavior

Pressing enter on the bottom line of this code:

local goldPet = normalPet:Clone()
  :SetGolden()
  :SetAmount(amountGold)

Should result in no indent changes to the original code and the cursor should end up as shown:

local goldPet = normalPet:Clone()
  :SetGolden()
  :SetAmount(amountGold)
  | <-- CURSOR
4 Likes

I’ve actually had this issue with function arguments before, where it even gives a warning for behaviour that I am not responsible for:

local Value = math.max(
    MyValue1, -- Presses enter...
MyValue2, --WARNING: Statement spans multiple lines, use indentation to silence
-- MyValue1 also loses it's preceding indentation :(
)
2 Likes

Thanks for the report! We’ve filed a ticket in our internal database and we’ll follow up when we have an update for you.

2 Likes

Hi,

Thank you for the report, can you also include what the issues are with relative formatting?

I have tried using ‘Relative’ but this creates further issues elsewhere.

This is fixed! Anyone still having issues?

1 Like

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