Repository navigation
Split concat chains led by a multi-line long string when over width - #1184
Open
Anatomydotexe wants to merge 4 commits into
Open
Anatomydotexe wants to merge 4 commits into
Anatomydotexe wants to merge 4 commits into
Conversation
added 4 commits
October 30, 2026 07:48
… so parenthesised leads are idempotent
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1174.
Problem
An assignment whose RHS is a
..concatenation chain that starts with a multi-line long string ([[ ... ]]) was never split, even when the remaining part of the chain went far pastcolumn_width. When deciding whether to hang the chain, only the first line of the RHS was measured, so the long tail after]]was never taken into account.Change
src/formatters/assignment.rs: for a concat chain led by a multi-line long string, the hang decision now looks at the formatted expression and only hangs it when hanging actually brings it within budget. Other RHS shapes keep their current behaviour.Tests
tests/inputs/concat-multiline-string-chain.lua(+ snapshot): a[[ ]]-led chain over width now splits after]]; plain-string chains and short chains are unchanged.tests/test_concat_idempotence.rs: formatting the output a second time yields no changes, including a parenthesised([[ ... ]])lead (an earlier iteration of this patch was not idempotent there).cargo testfor the default, no-default, all-features, luau, lua52, lua53, lua54, luajit and cfxlua feature sets, pluscargo fmt --checkandcargo clippy; all pass. The new tests fail without the change.run_comparisons.py(4257 files): no output differences againstmain, and no new non-idempotent files.Limits
This change was prepared with AI coding agents and reviewed by me before submission.