Search code examples
javaintellij-ideareplaceselectionlive-templates

IntelliJ Idea Live Template remove current line


Does IntelliJ IDEA's Live Template feature support the ability to remove the current line(s) the user is interacting with before replacing it with the live-template content?

I know I can use the parameter $SELECTION$ to take the current highlighted code, but is there a way to delete the rest of the current line(s)? (Similar action would be like the "Keymap -> Editor Actions -> Delete Line" keyboard command).

I don't know if I may have missed it in the docs:
Jetbrains live-templates variables documentation

Example Setup of Live-template (for Java): Example Setup of Live-template

Example usage would be to highlight the String parameter in: System.out.println("highlight me!"); and use Ctrl + Alt + J to open available templates and convert it:

Example:
Example Code


Solution

  • After further investigation. This is not possible in the current version of IntelliJ Idea. Closing question.