I'd like to create a live template to quickly add a new state variable using React hooks in PyCharm for example.
I think I got something close to what I want (including state type for TypeScript):
const [$1$, set$1$] = useState<$2$>($3$);
$END$
But doing that with count for example, I still have to rename the function setcount for it to be CamelCase because I get:
const [count, setcount] = useState<number>(0);
Avoid using numbers for variable names, use proper names. It's easier to read and reference them.
Introduce another variable for
set$1$, e.g.set$NAME2$.Then on the
Edit variablesscreen, for that newNAME2variable just reference the original variable and use withcapitalize()function. https://www.jetbrains.com/help/webstorm/template-variables.html#configure_template_variablesThis way that intermediate
$NAME2$variable will be used (transformed) but you will not be filling it manually and it will be skipped when jumping between edit points once that live template is expanded.(use proper abbreviation/description of course)