WebStorm Live Templates variables - groovyScript("groovy code") not working?
I'm trying to do some stuff with Live Templates, and thought I'll use Groovy to get the file path (see here):
groovyScript("_editor.getVirtualFile().getPath()")
When using that Live Template inside a file, nothing happens. Not even if I define that variable to be:
groovyScript("return \"test\"")
I took a look in the idea.log file, and found this error:
java.lang.NoClassDefFoundError: groovy/lang/GroovyShell
at com.intellij.codeInsight.template.macro.GroovyScriptMacro.a(GroovyScriptMacro.java:61)
at com.intellij.codeInsight.template.macro.GroovyScriptMacro.calculateResult(GroovyScriptMacro.java:51)
[………………….]
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
2017-12-19 15:26:35,810 [6004506] ERROR - Insight.lookup.impl.LookupImpl - WebStorm 2017.3.1 Build #WS-173.3942.31
2017-12-19 15:26:35,810 [6004506] ERROR - Insight.lookup.impl.LookupImpl - JDK: 1.8.0_152-release
2017-12-19 15:26:35,810 [6004506] ERROR - Insight.lookup.impl.LookupImpl - VM: OpenJDK 64-Bit Server VM
2017-12-19 15:26:35,810 [6004506] ERROR - Insight.lookup.impl.LookupImpl - Vendor: JetBrains s.r.o
2017-12-19 15:26:35,810 [6004506] ERROR - Insight.lookup.impl.LookupImpl - OS: Mac OS X
2017-12-19 15:26:35,811 [6004507] ERROR - Insight.lookup.impl.LookupImpl - Last Action: EditorChooseLookupItemReplace
2017-12-19 15:26:35,811 [6004507] ERROR - Insight.lookup.impl.LookupImpl - Current Command: Choose Lookup Item Replace
2017-12-19 15:26:36,516 [6005212] INFO - ter.rhino.RhinoFunctionManager - [ApplicationImpl pooled thread 91] JSHINT 2.9.5 function extraction took 58.55 ms
Any way to get this working?
Thanks,
Alex
请先登录再写评论。
Unfortunately this doesn't currently work in WebStorm because Groovy plugin is not bundled and can't be added to Webstorm:( please follow https://youtrack.jetbrains.com/issue/WEB-28139 for updates