When using Luau type syntax and you define a function like foo(a: {}), the auto indent drops one tab so you have to manually keep adding the format back in. However pressing enter or even pasting on a line that you have added the indent back on will remove it again.
This happens to every line after the table typing in the function declaration. Every line above that still works fine. This gets very annoying and time consuming when you have to keep formatting for every line you edit.
Very easy to reproduce. The following in a script will show the issue.
–!strict
local function foo(a: string): string
if type(a) == 'string' then
return "a is a string"
else
return "a is not a string"
end
end
local function bar(a: {}): string -- auto indent continues to work above this line but not below
if type(a) == 'table' then
return "a is a table"
-- pressed enter at the end of the line above and lose an indent
else
return "a is not a table"
end
end