Live templates - providing default values from the template text Follow
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.
Please sign in to leave a 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.