Groovy Code Style Questions

Can someone tell me how Intellij determines the code style for groovy code in its editor? It doesn't appear to use the code style set for my java code, and it appears to use the "other" for indentation formatting.

I really think it makes sense to use the settings in the Global Code Style to format my groovy code. Tabs, alignment, braces all apply equally to groovy as well as java.

2 comments
Comment actions Permalink

...

I really think it makes sense to use the settings in the Global Code Style to format
my groovy code. Tabs, alignment, braces all apply equally to groovy as well as java.


Not all of it and/or not for everyone.

I use a lot of line breaks that render Groovy code uncompilable. These line breaks require backslashes in Groovy.

Personally, I think the price paid for making semicolon optional is far too high to justify, but most Java programmers just jam their code into a blob, and for them Groovy's syntax is OK. I'm unwilling to do that because I consider the results illegible.


Randall Schulz

0
Comment actions Permalink

Yeah, when I wrote this I realized that there are a LOT of java code style settings, not all of which could/should apply to groovy. I find enough similarities in my java style and groovy style (formatting mainly) that I was hoping a quick fix for the idea developers might be to take the parts of the java style that DO make sense in groovy and just apply them. I'd really be happy for groovy, java indenting, braces alignment to be the same and gsp, jsp indenting to be the same.

Adding language specific styles (groovy, ruby, javascript, etc) supporting areas where the language features diverge certainly makes sense.

0

Please sign in to leave a comment.