question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Trailing commas disallow short lines from being collapsed

See original GitHub issue
val 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:open
  • Created a year ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
att14commented, Jul 19, 2022

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.

1reaction
JavierSegoviaCordobacommented, Jul 19, 2022

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…

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found