1

I just wanted to know how you put a cursor in a specific place in a live template for IntelliJ

For example:

# $var$ is an insance of the $objectType$ class
assert isinstance($var$, $objectType$)$END$

What happens here is that your cursor gets dragged to $var$ in the comment string first and then to your other values inside assert. What I wanted to know is how you chose where the cursor goes first.

I've read the documentation, but this is not mentioned, although a lot of other things are.

4

1 回答 1

4

您可以安排访问变量的顺序。您可以在此 IntelliJ 帮助文档中的第 5 项下找到信息:http: //www.jetbrains.com/idea/webhelp/creating-and-editing-template-variables。 html

要按照您希望 IntelliJ IDEA 在相关输入字段之间切换的顺序排列变量,请使用Move UpMove Down按钮。


编辑

您必须将宏定义更新为类似于以下内容:

# $varComment$ is an insance of the $objectTypeComment$ class
assert isinstance($var$, $objectType$)$END$

然后你将顺序var表达式定义为这样的东西(我对你没有任何好的表达orderType):

在此处输入图像描述

由于您填写Skip if defined了两个注释变量,他们只会从varand中获取值orderType并填写它。这将完全符合您的要求:-)

于 2013-06-20T14:54:19.763 回答