I am trying to create a live template where the second variable is simply an uppercased version of the first variable. The predefined function capitalize(String)
seems like exactly what I need but I am at a loss as to how to actually pass the variable in. Every time I try to set the parameter in the expression, it just resets to String
.
Template Format:
What I think should work:
But every time I tab out of the field, it just reverts to:
How do I get class
to take instance
as input and capitalize it?
It appears to be a known issue, please vote for it:
https://youtrack.jetbrains.com/issue/IDEA-132965
In addition, there is a request for rethinking this dialog:
https://youtrack.jetbrains.com/issue/IDEA-146698
So at the moment you may hit 'Enter' after changing the parameter from 'String' to 'instance' (it will be applied) or type the whole expression manually.
The solution is to hit the OK button with your mouse after setting the field. Do not hit enter or tab.
Credit: https://youtrack.jetbrains.com/issue/IDEA-132965#comment=27-850938