Groovy-Emacs-Modes / groovy-emacs-modes

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

Indent after comma #115

Closed djlindstr closed 6 years ago

djlindstr commented 6 years ago

This PR tries to fix #111. While working with the code, I discovered a few other indentation errors which are also fixed, e.g.

def a = 'b'+
1
def a = b[3]+
1

// becomes
def a = 'b'+
    1
def a = b[3]+
    1

etc.

I also did some changes to the formatting of the indentation unit tests, for better readability (IMHO). It was hard to visually line up some of the tests as the first line was Lisp-indented, so I have started each test string with a line-break.

coveralls commented 6 years ago

Coverage Status

Coverage increased (+0.2%) to 95.911% when pulling a1c45fa0aec64024aeb45ce752bc790b0af53225 on djlindstr:indent-after-comma into 88e851a7685a4f6f65786f088423163ba33be84b on Groovy-Emacs-Modes:master.

Wilfred commented 6 years ago

OK, this is a corner of Groovy syntax that I'm not familiar with. What is b[3]+ and how does it differ from b[3] +?

The code and tests generally look good 👍. I agree your changes to formatting were worth doing, but please keep them in separate commits in future so it's easier to review logic changes :)

djlindstr commented 6 years ago

Good point about splitting the commits.

Well, there is no requirement to have whitespace between tokens, although it is considered good style. def a=b[3]+1 is the same as def a = b[3] + 1. So if a line break is inserted, it should be handled in the same way.

Wilfred commented 6 years ago

Oh, gotcha. I misunderstood before: I thought you were saying that foo+ shouldn't indent the next line, but you were actually saying that it should indent the next line and currently isn't.

Thanks :)