I try to format groovy code using Eclipse formatter, but in some cases opening curly bracket stays in newline despite having groovy.formatter.braces.start=same configured.
My environment:
- Groovy Development Tools-4.3.0.RELEASE
- Eclipse version 2021-09 (4.21.0)
- Java Formatter settings - default builtin
- Groovy formatter settings:
groovy.formatter.braces.end=next
groovy.formatter.braces.start=same
groovy.formatter.longListLength=100
groovy.formatter.multiline.indentation=4
groovy.formatter.remove.unnecessary.semicolons=true
org.eclipse.jdt.core.formatter.indent_empty_lines=false
org.eclipse.jdt.core.formatter.tabulation.char=space
org.eclipse.jdt.core.formatter.tabulation.size=4
The same issue occurs when I use spotless gradle plugin and greplise with configuration above
The most basic code to reproduce the issue:
def method1() {
// Both comment and block with curly brackets are needed
if (true) {
println("method1")
}
}
def method2()
{
println("method2")
}
In example above, the lonely opening bracket of method2 is not formatted. It works ok if I remove comment or if statement from method1.
I have little experience with Eclipse, so I'm not sure if I did something wrong, or there is a bug in Groovy Eclipse Formatter.
I try to format groovy code using Eclipse formatter, but in some cases opening curly bracket stays in newline despite having
groovy.formatter.braces.start=sameconfigured.My environment:
The same issue occurs when I use spotless gradle plugin and greplise with configuration above
The most basic code to reproduce the issue:
In example above, the lonely opening bracket of
method2is not formatted. It works ok if I remove comment or if statement frommethod1.I have little experience with Eclipse, so I'm not sure if I did something wrong, or there is a bug in Groovy Eclipse Formatter.