简体   繁体   中英

How to create your own Live Template, using the current line (Intellij)

I am trying to create my own live template which uses the current line that my cursor is on, but I cannot find the variable for it.

To explain what I mean, IntelliJ has a built-in.sout template which SOUTs the current statement. 在此处输入图像描述

在此处输入图像描述

I am trying to find a way to add my own.[extention] that wraps the current code on that line, into a different statement.

So something like this:

在此处输入图像描述

Will turn into this: 在此处输入图像描述

Any ideas on how to get that done properly?

You need to create postfix completion. Rather than Live template, postfix completion surrounds an expression you've just typed. See https://www.jetbrains.com/help/idea/settings-postfix-completion.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM