StyLua
StyLua copied to clipboard
Сomment incorrectly influences formation
local arg_with_long_name, function_with_long_name
--- 1
function_with_long_name(function_with_long_name(
arg_with_long_name, -- comment
arg_with_long_name,
arg_with_long_name,
arg_with_long_name,
arg_with_long_name,
arg_with_long_name
))
--- 2
function_with_long_name(function_with_long_name(
arg_with_long_name, --[[comment]]
arg_with_long_name,
arg_with_long_name,
arg_with_long_name,
arg_with_long_name,
arg_with_long_name
))
--- 3
function_with_long_name(function_with_long_name(
arg_with_long_name,
arg_with_long_name,
arg_with_long_name,
arg_with_long_name,
arg_with_long_name,
arg_with_long_name
))
For 1 case formatting does not work and does not look like expected behavior.
The problem here is we eagerly select a different codepath because of the singleline comment in the first example. It is difficult to detect this comment without being too expensive since it is nested inside another function call. Will see if there is a way to solve this without a major performance penalty.