Open a01fe opened 4 years ago
Unfortunately, it's a known limitation of the JDT compiler. It only knows about Java classes, not from other languages. Getting a working groovy support would require loading the Groovy Eclipse plugin and its patched JDT compiler instead of JDT, in the Java Language server. It might or might not be doable, but this is definitely a task that will require some contributions from the community. cc @martinlippert, in case he's interested.
I realized this has already been discussed with @martinlippert in #205
Yepp, discussed back then and I don't think anything has really changed since then. However, feel free to get in contact with the people working on groovy-eclipse (https://github.com/groovy/groovy-eclipse) to further discuss this with them (I think @eric-milles is the one).
Joint compilation for Groovy and Java for LSP has been discussed. Also, there may be Groovy LSP implementations already, but I am unsure about their support for joint compilation (inter-dependency) of Groovy and Java sources.
Thanks for your comments! After reading through the linked issues it appears that separate Groovy and Java language servers would be the cleanest way to go. The downside is that crossed Groovy/Java references likely wouldn't work. Is this because language servers would need to know the others contributions to classpath and the there's no established protocol for them to share this?
@a01fe I think it depends on the structure of your project. If you have one-way references only (always from Java to Groovy code or vice versa), you should be able to set this up with separate language servers. But having real cross-references in both directions, you would need a compiler that can compile both, I think.
Has there been any updates since the last convo on this issue/blocker ?
I have the same problem. So, Has there been any updates?
Hope this issue to be attention.😊
In Gradle plugins implemented with a mix of Java and Groovy,
vscode-java
reports "cannot be resolved" errors in.java
files that reference classes defined in.groovy
files. Gradle can compile and build the plugin successfully.Environment
Steps To Reproduce
cd gradle-groovy-java-plugin/test; ./gradlew javaTask
This builds the plugin and runs a task in the plugin to verify it compiles and builds successfullyvscode-java
reports errors on all the references toJavaTaskSpec
.