-
Notifications
You must be signed in to change notification settings - Fork 467
Enabling Parrot Parser for Groovy Eclipse #975
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
So I didn't think this workaround would work since Assuming you use gradle, If you add a configuration.pluginFactory = org.codehaus.groovy.control.ParserPluginFactory.antlr4() and then reference that file in your compileGroovy.groovyOptions.configurationScript = file('config.groovy') It should get it working with groovy 3+ syntax. This really should work by default though. |
I stand corrected...my previous example doesn't work. There seems to be no way to enable this short of passing JVM options when running gradle 😞 |
@jamesdh Thanks for the hint. I would not like to extend the interface for this one, but just accept Setting a system property is not an option, but eclipse-groovy allows the configuration per PU. Unfortunately it creates the PU statically That could be solved by declaring this option as not changeable, as we did it for WTP. I am afraid this one is not high on my list. PRs are welcome... |
@jamesdh Sorry, was writing my previous comment while you were writing yours 😄 I really don't want to add too much code on Spotless side. In my opinion the best solution would be on eclipse-groovy side, making the |
I'm struggling to understand what you mean by this. Could you give a bit more context? Thanks for the help already! |
For the Eclipse WTP formatter you cannot configure everything per project. Some things are still configured for per workspace. The WTP stores them statically. So I propose for
|
Since spotless depends on groovy-eclipse for groovy parsing/formatting, and since groovy-eclipse doesn't enable the parrot parser by default, Spotless fails when configured for groovy code that utilizes Groovy 3+ syntax.
After experiencing some pain with spotless + groovy, I stumbled upon #246 which led me to dig into groovy-eclipse. Turns out groovy-eclipse leaves the new antlr4 based Parrot Parser disabled by default, which means any newer Groovy 3 syntax that contains, for example, Java lambdas, blows up.
I can manually add
-Dgroovy.antlr4=true
to my Gradle execution and that gets it working for me locally, but there should be some way to configure this right within build.gradle? I'm trying to find a solution that is more amenable to a team environment.In the past I've modified JavaExec tasks and the like to include forked JVM options. But there seems to be no way to do that for SpotlessTask.
Am I missing something obvious here?
The text was updated successfully, but these errors were encountered: