EDIT — This is not possible with coc-snippets. It's possible with Ultisnips.
I've got the following vim snippet that I'm using (with coc-snippets) for React:
snippet STATE_HOOK "useState hook" b
const [${1:state}, set${1:`!v expand('%:t:r')`}] = useState($2)
endsnippet
This could be used to quickly create the following (incorrect) code:
const [color, setcolor] = useState("green");
The problem is that the setcolor
needs to be camelcased, like this: setColor
How would one write this snippet so that the expanded input is capitalized?