eclipse-archived / ceylon.formatter

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

Alignment #18

Open lucaswerkmeister opened 10 years ago

lucaswerkmeister commented 10 years ago

There should be a way to allow alignment of code. For example:

Integer i;    // int
String  s;    // string
File    file; // file
lucaswerkmeister commented 10 years ago

For AST elements (i. e. everything except comments), we could probably get this by implementing “tab stops” in the FormattingWriter and using them in the FormattingVisitor.

lucaswerkmeister commented 10 years ago

Another use case (@luolong here):

value sumOfStuff = calculateSomeStuff(1)
                 + calculateSomeOtherStuff(2);

and

value sumOfStuff = calculateSomeStuff(1) +
                   calculateSomeOtherStuff(2);
luolong commented 9 years ago

Another use case (from #105):

shared actual Boolean equals(Object that)
        => if (is This that)
           then this.thing == that.thing
           else false;
lucaswerkmeister commented 8 years ago

Another one, from https://github.com/ceylon/ceylon.formatter/issues/105#issuecomment-169006171:

void method(A a,
            B b){}