Home > Software engineering >  How to create your own Live Template, using the current line (Intellij)
How to create your own Live Template, using the current line (Intellij)

Time:12-02

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?

CodePudding user response:

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

  • Related