javakotlinintellij-idealive-templates

Intellij Idea wrapping live template


I want to create a live template to wrap a code before the dot.

Example:

  1. I enter userDao.getUser().asst
  2. Press enter
  3. Code is wrapped and the result is: 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?


Solution

  • You can use Postfix Completion for that.

    enter image description here

    The result will look like this:

    enter image description here