GDSL definition for groovy

I created some dsl in groovy and I want to add support for it in Intellij using groovy's gdsl file.
Let's say that it looks like this:

Example 1:
check 'description', {
    comment 'Hello world'
    execute { bean.name.length > 0 }

}

It's the simplest case. I have created a gsdl file for this:


def scriptContext  = context()


contributor(scriptContext) {
    method name:'check',
        params:[description:'java.lang.String', closure:'groovy.lang.Closure']

}


def checkContext = context(scope:closureScope(isArg:true))


contributor(checkContext) {
    if( enclosingCall('check') ) {
        method name:'comment', type:'void', params:[text:'java.lang.String']
        method name:'execute', type:'void', params:[closure:'groovy.lang.Closure']

    }

}

Intellij recognizes the 'comment' and 'execute' methods only if the call for 'check' looks like this:


Example 2:

check('description') {
...

}

It looks like the enclosingCall method only handles cases like the one in Example 2. How can I change the gdsl file to support also the syntax from Example 1?

2 comments
Comment actions Permalink

Sounds like a bug. Could you file a request with this example code?

0
Comment actions Permalink

Thanks Peter. I've filed the request: IDEA-52429. That's a great feature, so I'll definitely monitor this:)

0

Please sign in to leave a comment.