Incorrect auto indentation with multiline argument list of function call in another argument list

As of version 0.654.2, auto-indentation gives an incorrect result on a function call with multiple arguments that is an argument of a function call on the same line. The closing brackets are indented with an extra tab, which is inconsistent with a table literal or calling the function with a string or table.

print(string.format(
	'really long function call split into multiple lines %f',
	game:GetService('RunService').RenderStepped:Wait()
	)) -- this line should not be indented

--these are correctly formatted
print({
})

print(table.freeze{
})

print(string.byte[[
]])

print(string.byte'\z
')

Expected behavior

The behaviour on a function call matches the other cases described, which should be the following:

print(string.format(
	'really long function call split into multiple lines %f',
	game:GetService('RunService').RenderStepped:Wait()
))

Hi @nothing_1649

Usually, we add one level of indentation for a line if it’s part of a multiline statement. For example, in the first case, we provide extra indentation for line 4 since it’s part of the previous line:

print(string.format(
____)) – ← this is part of string.format()

We also have a special indentation rule for table syntax, as it’s common for people to assign table elements on different lines and add an extra line for the closing brace }.

Additionally, we don’t indent lines that begin with a string literal.

We understand your point, and we’ll follow this up as a feature request.

Thanks for reporting this!

1 Like