[英]Intellij Idea wrapping live template
I want to create a live template to wrap a code before the dot.我想创建一个实时模板来在点之前包装代码。
Example:例子:
userDao.getUser().asst
userDao.getUser().asst
assertThat(userDao.getUser())
assertThat(userDao.getUser())
So basically I want to create a live template with functionality similar to sout
, try
, listOf
etc. Can you suggest how to create it?所以基本上我想创建一个功能类似于
sout
、 try
、 listOf
等的实时模板。你能建议如何创建它吗?
You can use Postfix Completion for that.您可以为此使用Postfix Completion 。
The result will look like this:结果将如下所示:
Not exactly what you need but as an alternative;不完全是您需要的,但作为替代方案;
template text
, write asst
(or a
for shorter version) in the abbreviation input field.template text
中添加以下行,在缩写输入字段中写入asst
(或更短a
版本)。assertThat($SELECTION$)$END$
userDao.getUser()
and hit cmd + alt + j , you will have Select Template
pop-up.userDao.getUser()
并点击cmd + alt + j时,您将弹出Select Template
。 When you then hit a it will automatically surround it with assertThat.
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.