eclipse-archived / ceylon.formatter

A formatter for the Ceylon programming language, written in Ceylon.
Apache License 2.0
14 stars 11 forks source link

Add a better LineBreakStrategy #11

Open lucaswerkmeister opened 10 years ago

lucaswerkmeister commented 10 years ago

A better LineBreakStrategy should try to ensure that the next line won’t be indented too much – i. e., it should prefer

bla(bla, bla, bla, bla, bla,
    bla(bla(bla(bla))));

to

bla(bla, bla, bla, bla, bla, bla(bla(
            bla(bla))));
lucaswerkmeister commented 9 years ago

The Dart formatter seems to be all about good line breaks, so there’s lots of good ideas in here: http://journal.stuffwithstuff.com/2015/09/08/the-hardest-program-ive-ever-written/

lukedegruchy commented 8 years ago

My opinion is that there should at least be opt-in behaviour to do this:

bla(bla, 
    bla, 
    bla, 
    bla, 
    bla, 
    bla(bla(bla(bla))));