You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
luafmt is not idempotent: layout of a nested call alternates between two states forever #1302
This input never stabilizes: from the 3rd pass on, luafmt flips between two layouts forever (pass 3 == pass 5, pass 3 != pass 4), so luafmt --check fails on its own output.
Without the enclosing function ... end (two columns less indentation) it converges after one pass. The first pass also emitted a 123-column line elsewhere in the same codebase with max_line_width = 120, which the second pass then split.
On a 165-file codebase, 25 files changed again on the second pass, 5 on the third, and 2 kept alternating. --verify reports this, but there's no way to reach a fixed point.
Activity
mareklangiewicz commentedon Oct 16, 2026
Correction to the repro above:
--max-line-width 120alone converges. It needs 2-space indent as well, and only widths 118–120 cycle:Cause and fix in #1305: the call-arg layout estimated the first line from the first argument's source column, which the two layouts move.
test(formatter): assert idempotency in the EmmyLuaLs#1302 helper, exp…