IntelliJ自定义模板变量 [英] IntelliJ Custom Template Variable

查看:391
本文介绍了IntelliJ自定义模板变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用名为$MyName的自定义变量创建我的自定义模板.而且我认为IntelliJ应该可以询问变量的值是否未初始化.他们在文档中提供了有关如何执行此操作的一些信息,但他们没有真实的示例.他们只是说,以某种方式IntelliJ Idea会要求我指定它.

I am trying to create my custom template with a custom variable called $MyName. And I think it should be possible for IntelliJ to ask about the variable's value if it was not initialized. In the documentation they provide some informations about how to do this, but they don't have a real example. They just say, it somehow IntelliJ Idea will ask me to specify it.

如果在应用模板时某些模板变量的值 未知,IntelliJ IDEA会要求您指定它们.

If, when applying a template, the values of certain template variable are not known, IntelliJ IDEA will ask you to specify them.

如何创建类似$MyName的自定义变量,然后当用户使用模板时,它将询问他的名字是什么?

How can I create a custom variable like $MyName and then when the user uses the template, it will ask him what his name is?

IntelliJ IDEA 2016.1文档

如您所见,自定义变量未被识别或无效.如果我像${MyName}一样声明它,则也将不起作用.

As you can see, the custom variable is not recognized or not valid. If I declare it like ${MyName}, it won't work either.

推荐答案

这是IntelliJ IDEA中的错误,归档为

It's a bug in IntelliJ IDEA, filed as https://youtrack.jetbrains.com/issue/IDEA-154958. Thanks for noticing!

这篇关于IntelliJ自定义模板变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆