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

363 Views Asked by At

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. enter image description here

enter image description here

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:

enter image description here

Will turn into this: enter image description here

Any ideas on how to get that done properly?

1

There are 1 best solutions below

0
Konstantin Annikov On

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