I can't find a way to create the following snippet :
[
"${1:SECTION NAME/(.*)/${1:/upcase}/}",
"====================================\n$0"
]
I want the following outcome :
<selection>SECTION NAME</selection>
====================================
I then enter: "i am hopeless". [TAB]
I AM HOPELESS
====================================
<selection />
The closest I got is this :
[
"${1/(.*)/${1:/upcase}/} ${1:SECTION NAME}",
"====================================\n$0"
]
But I get a duplicate.
Just to save some frustration, placeholder transforms do not work on default or choice syntaxes. As in:
"${1:foo/(.*)/$1:/upcase}/}"
"${2:|foo,bar|/(.*)/{1:/upcase}/}",
They do work when there is no default or choice value. So the following works:
"${3/(.*)/${1:/upcase}/}",
Also, you can use a default variable if it is not transformed at the inital tabstop but is later transformed on a subsequent usage. So the following works:
"${4:SECTION NAME}",
"${4/(.*)/${1:/upcase}/}",
or the reverse also works:
"${3/(.*)/${1:/upcase}/}",
"${3:SECTION NAME}",
So you can provide a default but it cannot be transformed until another reference to that same tabstop.
See the discussion vscode issues: placeholder transforms. No word if work on supporting transforms of default/choice variables is being worked on.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With