Reputation: 49
For example I want to reuse this transform like a variable in my snippet instead of write the transform again and again
${TM_FILENAME_BASE/(.*)$/${1:/pascalcase}/}
"example": {
"prefix": "example",
"body": [
"${TM_FILENAME_BASE/(.*)$/${1:/pascalcase}/} ${1:name1} = _${1};",
"${TM_FILENAME_BASE/(.*)$/${1:/pascalcase}/} ${2:name2} = _${2};",
"${TM_FILENAME_BASE/(.*)$/${1:/pascalcase}/} ${3:name3} = _${3};",
//...
],
"description": "example"
},
Upvotes: 4
Views: 797
Reputation: 41
You can repeat the same transform by assigning it to a placeholder and referencing that number, like this:
"example": {
"prefix": "example",
"body": [
"${4:${TM_FILENAME_BASE/(.*)$/${1:/pascalcase}/}} ${1:name1} = _${1};",
"${4} ${2:name2} = _${2};",
"${4} ${3:name3} = _${3};",
]
}
Upvotes: 4