Search code examples
webstormlive-templates

groovyScript in Live Template for WebStorm


Is that possible to use (custom) groovyScript in Live Template in WebStorm IDE? I've seen that in Intellij IDEA, but it does not even appear in WebStorm docs. What I want to achieve is have something like:

groovyScript("def uuid=\"uuid\".execute().text; return uuid")

This always returns an empty string for the variable :(


Solution

  • AFAIK groovyScript is not available in PhpStorm/WebStorm (WI-19413 -- status "Declined") as it requires some extra modules (from Java world AFAIK) that only available in full IntelliJ IDEA.

    But they have plans to implement JavaScript support in Live templates instead -- https://youtrack.jetbrains.com/issue/WI-29141 -- star/vote/comment this ticket to get notified on any progress.

    Unfortunately this ticket is not very specific where we can expect this to be implemented as "Fix versions: x.x pool" means very broad "in one of the future versions". Definitely worth asking in the ticket.