1

In my framework we are having a code structure like:

varname => ${VARNAME}

I am trying to use VSCode user snippet to make it working but unable to capitalize given varname!

https://code.visualstudio.com/updates/v1_25#_snippet-placeholder-transformations Tried this exact code but not working!!

Also tried already solved solutions also. But none of them working. VS Code: How to convert snippet placeholder to uppercase or lowercase?

When using variable transformations like TM_FILENAME, capitalize working. (https://code.visualstudio.com/docs/editor/userdefinedsnippets#_variables)

"Insert_const_variable": {
        "prefix": "const",      
        "body": "${1:varname} -> ${1/(.*)/${1:/upcase}/}", 
        "description": "Declare const"
}

expected : const -> CONST

actual : const -> const

Thanks in advance.

javaNewbie
  • 11
  • 1
  • Are you trying to end up with `const myVar -> MYVAR`? Your snippet is wrong if so. Otherwise it is working for me to change `myVar` to `MYVAR`. – Mark May 17 '19 at 13:55
  • @Mark Based on your reply I tried the same snippet with Javascript project and it worked, but not working with our project. It seems problem is with an language server extension we are using for our framework. Disabling makes snippet works. Thanks for the help. – javaNewbie May 19 '19 at 06:21

0 Answers0