Trailing commas disallow short lines from being collapsed
See original GitHub issueval foo =
Short(
"one",
"two",
)
will not be reformatted, but
val foo =
Short(
"one",
"two"
)
will be reformatted to
val foo = Short("one", "two")
Issue Analytics
- State:
- Created a year ago
- Comments:10 (5 by maintainers)
Top Results From Across the Web
New trailing comma behavior means a list will never be one ...
If enough items for the list are removed, this list will never be collapsed, because black added the trailing comma after the last...
Read more >The Black code style - Black 22.12.0 documentation
Black will add trailing commas to expressions that are split by comma where each element is on its own line. This includes function...
Read more >How to turn off the prettier trailing comma in VS Code?
Select a piece of TypeScript, press Ctrl + Shift + F and the trailing commas still appear.
Read more >Trailing commas - JavaScript - MDN Web Docs
Trailing commas (sometimes called "final commas") can be useful when adding new elements, parameters, or properties to JavaScript code.
Read more >Configuration · Scalafmt - Scalameta
When this parameter is disabled, no indentation is added for same-line single-arg ... The rule handles how trailing commas are treated in case...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
There is no reason I can think of to ever do that, so the formatter makes an opinion that this is not allowed. For that same reason I’m advocating that the formatter also make an opinion about trailing commas and collapsing short lines.
It shouldn’t do that TBH, because literally the intention of setting
;
there, is to have the code in one line, there is no other reason to put;
there if it is not getting a single line…