I have the following WebStorm Live Template:
[$VAR1$, set$VAR1$]
My goal is to capitalize the second occurrence of $VAR1$
.
e.g. for the input: foo
the output should be: [foo, setFoo]
right now the output is: [foo, setfoo]
For Live Templates, there is a Dialog where I can define a function expression to capitalize a variable:
The problem here is that the definition is per variable, so both occurrences are capitalized then.
How can I capitalize only the second occurrence, or copy the value of one variable into another one which would be capitalized then?
Just add another variable:
$VAR1$, set$VAR2$
See https://blog.jetbrains.com/webstorm/2022/02/creating-and-using-code-snippets-with-placeholders/, you may find this blog post useful