Can I use GDSL with Groovy AST transforms, that have closures as parameters?


So I have a question about gdsl files, and if I can use them to add IDE support for a Groovy AST Transform, made for a Grails plugin, that takes up to three closures as parameters? The closures are eventually delegated to a Grails service, which is generate by the plugins install. What I'm looking to get out of this is that the IDE won't mark calls to the Grails service, in the closures as unresolved. If it could allow for code completion of the various methods from the Grails service that would be a bonus.

The plugin:

The AST Transform:

If this can be done, my next question is how? I've looked through documentation and examples, but haven't found any that targets a Groovy AST Transform, with closure parameters. I've also tried something based off:

but it didn't work.

Comment actions Permalink
Official comment


You need closure scope restricted to closures within annotation. 

contributor(context(scope: closureScope(annotationName: "com.virtualdogbert.ast.Enforce"))) {

I've not found `enforserService` in your repo, you just substitute DELEGATE_FQN with its fully qualified name.

Comment actions Permalink

That worked thanks. Now I just have to make a few changes, so that the service is always installed to the same location(rather than user chosen), and I can do a new release. Thanks again.


Please sign in to leave a comment.