I have used and created Live Templates before but I didn’t know about the special keyword $SELECTION$
. I found out after reading IntelliJ IDEA / Android Studio Tricks: Surround With by Ivan Morgillo.
In short, when a template gets invoked, $SELECTION$
gets replaced by whatever is selected at that moment.
I won’t go into details about creating a new template. You can read all about it at Ivan’s post. But when you learn how to create one then add the following:
This way you can do something like this:
PS: the $END$
keyword is another special one that pinpoints where the cursor will stop after adding values for an invoked template
Top comments (0)