Live templates - providing default values from the template text

Answered

Hey,

I know I can set defaults values with the UI ("Edit Variables"), but any way to do that directly with the syntax in the snippet? For instance:

foo = $bar$ * 2

Let's say I want "bar" to be 42 by default.

0
1 comment

You can use groovyScript to check the value of the variable passed to the template and set it to something different if not provided: https://stackoverflow.com/questions/35405836/how-to-pass-variable-to-groovy-code-in-intellij-idea-live-templates-groovy-scrip.

0

Please sign in to leave a comment.