Search code examples
visual-studio-codevscode-snippets

Capitalize name of parent directory in vs code user snippets


I am creating a user snippet in vs code for my react development.

I have one transform to extract immediate parent folder name using

${TM_DIRECTORY/^.+\\\\(.*)$/$1/}

and another transform to capitalize

"${TM_DIRECTORY/(.*)/${1:/capitalize}/}"

Link : How to get the base directory in visual studio code snippet?

I am still a noob at this so trying to figure out how to extract capitalized immediate parent folder name.


Solution

  • Figured it out !

    I took help from this How to apply more than on transform on visual studio code snippets?

    ${TM_DIRECTORY/^.+\\\\(.*)$/${1:/capitalize}/}