Can't pass variable to predefined function in

2019-07-09 04:33发布

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: template format

What I think should work: enter image description here

But every time I tab out of the field, it just reverts to: enter image description here

How do I get class to take instance as input and capitalize it?

2条回答
虎瘦雄心在
2楼-- · 2019-07-09 05:11

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.

查看更多
爷的心禁止访问
3楼-- · 2019-07-09 05:15

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

查看更多
登录 后发表回答