Structural search question


I was trying to replace closure actions (Grails project) with methind actions. Basically the pattern is simple:

def $VarName$ = {$ClosureBody$}

needs to be replaced with

def $VarName$() {$ClosureBody$}

is there a simple way to do this. Seems like structure repalce is the right tool, just does not work.

This is in version 11.1

Any, hints as to how to get this done woudl be greatly appreciated.

Comment actions Permalink

i think it only supports java?

Comment actions Permalink

Indeed, structural search didn't work for closures. I've just fixed this bug, the fix will be available in the next EAP. Also note, that you need to choose "unlimited occurences" setting for variable $closureBody$ (only in this case it will match a list of statements). If you have any other problems with Structural Search & Replace, please report issues to our tracker


Please sign in to leave a comment.