groovy-language-server
groovy-language-server copied to clipboard
New Feature: Add support for Gradle based groovy projects.
So, what would this involve exactly? Would it just be a matter of parsing the gradle file for the targets/libraries to consume? I think Java language servers already can do this... I might take a look to see if it can be borrowed...
The JDT language server is based on Eclipse and says it uses Buildship for Gradle support. Not sure how easy that would be to integrate outside of an Eclipse-based environment.
https://github.com/eclipse/eclipse.jdt.ls
What would be the work around for this before this feature is done?
say I have all my gradle dependencies in ~/.gradle/caches/modules-2/files-2.1/
Can I manually configure the class path with a glob?
Like ~/.gradle/caches/modules-2/files-2.1/**/*
Update: I realize that if I want this ill have to add it as a feature to https://github.com/dansomething/coc-groovy which uses this server.
Based on the solution implemented in the referenced PR by @joshzcold (https://github.com/dansomething/coc-groovy/pull/12), it seems like the challenging part was to get the classpath but from what I understand you can get the classpath via gradlew with:
./gradlew dependencies --configuration compileClasspath
or for the runtime classpath:
./gradlew dependencies --configuration runtimeClasspath
That being said, in typical gradle fashion it only outputs in a pretty human readable way so parsing this might be annoying
@shaneikennedy the maintainer of coc-groovy made a script to handle that for the same reason
https://github.com/dansomething/coc-groovy/tree/main/utils%2Fgradle-classpath%2Fbin
He references the built jar of another one of his projects
https://github.com/dansomething/gradle-classpath
@joshzcold I read the PR but didn't realize that script became it's own repo :) thanks!