How to set default value of variable in live template in Intellij IDEA?

Vitalii Korsakov picture Vitalii Korsakov · Dec 23, 2012 · Viewed 7.5k times · Source

There could be a little misunterstanding in live templates in Intellij IDEA. I mean default values for variables in templates.

Suppose we have this live template

enter image description here enter image description here

What I expect here, that when calling this template (type jqon and press TAB) I will see default values already typed which I can change or leave as it is. Like this

enter image description here

But no. I have empty strings instead of default values

enter image description here

Why?

Answer

Vitalii Korsakov picture Vitalii Korsakov · Dec 23, 2012

I was wrong about Default value field. I don't need this in my case. I need to fill Expression field.

If I want just paste some string as default value I should put this string in quote in Expression. So now my variable settings look this way

enter image description here

And everything works how I want!