Reputation: 2119
When creating a live template in WebStorm 2017.3.2 is there a way to apply multiple predefined functions on a single input? Or perhaps reference template variables from other template variables from within the same template?
Say for example I want to apply the capitalizeAndUnderscore
function to $FOO$
and also apply the camelCase
function to the same input supplied to the $FOO$
variable elsewhere in the template?
In other words, is it possible to achieve the following:
$FOO$: '$FOO_REFERENCE$'
expands to MY_WHATEVER: 'myWhatever'
While only having to type mywhatever
1 single time?
Upvotes: 1
Views: 641
Reputation: 93728
Both capitalizeAndUnderscore()
and camelCase()
functions have String
parameter - it can be a string constant, expression or a reference to already defined variable. So, you can easily use capitalizeAndUnderscore(FOO)
as $FOO_REFERENCE$
value. But referencing variables defined in other templates is not supported. And you need to make sure that $FOO$
value is defined before being used.
Upvotes: 3