-
Notifications
You must be signed in to change notification settings - Fork 91
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
Add support for groovy #132
Comments
Any chance you might be able to build the groovy support and submit a PR? Get Outlook for Androidhttps://aka.ms/ghei36 On Sun, Aug 21, 2016 at 3:02 AM -0400, "Alexander" <notifications@github.commailto:notifications@github.com> wrote: It would be great if the plugin can format sources that contain groovy code as well. You are receiving this because you are subscribed to this thread. |
I'm looking into this. First try was to use the java formatter as we have it for java. That really has issues with groovy, mostly due to missing semi colon but also seems to squash weirdly. So it is clear portions of the jdt patch that groovy has is needed. Now I need to look into possibility they released that to central. If not, we may need a module like jdst-core to pull that information and then use that to process groovy. It appears it is just a super set and there is a small subset of additional settings users can choose over the inherited java version. |
For reference, need this code https://github.com/groovy/groovy-eclipse/tree/9cbb8c65f89f3ce679b1ffe718266bb405e8a408/ide/org.codehaus.groovy.eclipse.refactoring/src/org/codehaus/groovy/eclipse/refactoring/formatter However, it is not exposed currently. |
This is likely to be complicated. After much digging, I need patches that groovy-eclipse has but doesn't appear to publish outside of the build. In order for this to work, it needs those groovy patches. I'm not clear really on how eclipse even works with this. More specifically the CompilationUnit class has 2 additional parameters for eclipse only. However it also contains a copy of groovy untouched along with full copy of various patches they are doing. I suspect some strange reflection usage and this is only needed at build time. However, when trying to run a solution similar to what we did with jsdt-core, it fails due to this class being necessary. So, at the moment, I'm going to try to build out their project and if that works, take the JAR I need and some how integrate that into the solution. Even if this works, it effectively means the entire jdt we use now is a waste. This is a complete copy of it to allow groovy to work. My gut tells me all other languages that run on the jvm are doing something similar and the weight is not really worth it here. I'll keep looking into this but not expecting that this will end up working. Even if it does, I think maybe it warrants a separate plugin as it is not light weight by any means and seriously high on duplication. This is probalby why upon every eclipse upgrade, groovy has to be uninstalled before the upgrade can work. |
It would be great if the plugin can format sources that contain groovy code as well.
Probably DefaultGroovyFormatter from https://github.com/groovy/groovy-eclipse can be used for that purpose:
groovy-eclipse/ide/org.codehaus.groovy.eclipse.refactoring/src/org/codehaus/groovy/eclipse/refactoring/formatter/DefaultGroovyFormatter.java
The text was updated successfully, but these errors were encountered: