Groovy-Emacs-Modes / groovy-emacs-modes

A groovy major mode, grails minor mode, and a groovy inferior mode.
84 stars 39 forks source link

Indentation issues on 20170529.46 #56

Closed jordi-chacon closed 7 years ago

jordi-chacon commented 7 years ago

Hi,

I just installed 20170529.46 and quickly noticed three fundamental indentation issues:

class foo {
    def bar() {
        def a = 1
        def b = a +
        1
        def c =
        1
        def d = a
        .baz()
    }
}

Using Emacs 24.5.1.

russel commented 7 years ago

But what is it that you expect to happen?

jordi-chacon commented 7 years ago

I expect it to get indented like this:

class foo {
    def bar() {
        def a = 1
        def b = a +
            1
        def c =
            1
        def d = a
            .baz()
    }
}
jordi-chacon commented 7 years ago

Modes for java, javascript and c indent the example above in expected ways:

C:

main() {
    int a = 1;
    int b = a +
        1;
    int c = a()
        .b()
        .foo();
}

Java:

public class Foo {
    public String bar() {
        int a =
            1;
        int b = 2 +
            a;
        int c = foo()
            .bar()
            .baz();
    }
}

Javascript:

function bar() {
  var a =
    1;
  var b = a +
        1;
  var c = a()
        .b()
        .foo();
}
russel commented 7 years ago

I'll see if I can add this as a test, which will then fail and require a bug fix.

Actually it may have to be two tests, one with spaces for indent one with tabs for indent.

jordi-chacon commented 7 years ago

Thanks for fixing this!