Closed jordi-chacon closed 7 years ago
I can't reproduce 6: I get the correct indentation on every line as far as I can see:
def foo() {
if (1) {
}
}
@Wilfred do you get the correct indentation immediately or do you have to actively press Tab on the closing curly bracket line?
What do you mean by immediately? I'm indenting by selecting the whole buffer and running M-x indent-region
.
What do you have bound to TAB?
Exactly, you are indenting by selecting the whole buffer and running M-x indent-region
.
What I am saying is that with java and js modes (just to name a couple), you don't need to do those two steps. Instead, as soon as you type }
, the closing curly bracket gets properly indented automatically, which is the behaviour that I'd like to see in groovy mode too.
But feel free to drop this if you don't agree :+1:
Aha, gotcha. So the issue isn't that the indentation is wrong, it's that } isn't triggering indentation (so-called electric indent).
Would you mind filing a separate bug for that? It seems like a very reasonable feature.
1-4 are now fixed, 5 has moved to #83, and 6 is now a separate issue #62.
Given that, I'm going to close this issue in favour of the more specific issues we have open.
Hi, I have noticed the following indentation issues. For each issue I have specified how it works today, and how I would expect it to work based on my experience with modes of other languages.
1. Overly indented closure body
Current:
Desired:
2. Unaligned list items
Current:
Desired:
3. Unaligned map items
(same problem as for lists) Current:
Desired:
4. Unaligned function arguments
(Same as for lists and maps) Current:
Desired:
5. Wrongly indented arguments within method chaining
Current:
Desired:
6. Closing curly bracket does not auto-indent
I have to manually press Tab on the line of the closing curly bracket for it to get indented properly. Both java and js modes indent closing curly brackets automatically.
Will keep reporting as I find more of these cases.
Thank you for your work! 🙏