I have figured out that I can use $SELECTION$
as a parameter to live template functions inside the "EDIT VARIABLES" modal. However, it will only work if I invoke it the "Surround with Live Template" hotkey. However, only templates which have $SELECTION$
written in the "Template Text" area will appear as an option for "Surround with Live Template". If $SELECTION$
appears in the "EDIT VARIABLES" modal, but not in the "Template Text" area, then the template will not appear in "Surround with Live Template".
The problem with this is that I don't want to use the raw value of $SELECTION$
in the "Template Text" area.
How can I make the template appear in "Surround with Live Template" without $SELECTION$
being in the "Template Text" area, yet being in the "EDIT VARIABLES" modal?
The reason I want to do this is that I want to run a regularExpression()
on the $SELECTION$
and output the resultant string to the template body.
The following picture show my current work around. It allows me to invoke the template as a surround template, and it places the $END$
cursor just before $SELECTION$
. This makes it easy to select the $SELECTION$
after invoking the template so that it can be deleted manually.
This document is not revealing pertaining to this issue. https://www.jetbrains.com/help/webstorm/template-variables.html