是否可以制作一个片段来生成如下所示的代码,同时只使用一个制表位?或者至少在用户点击时将
SomeVar
作为占位符。
const someVar = SomeVarClass();
我目前的尝试无法识别
pascalcase
{
"Initialize variable to it's class": {
"prefix": "ivtc",
"body": [
"const ${1:someVar} = ${1:/pascalcase}Class()",
],
}
}
当点击转换时,解决方案看起来像
{
"Initialize variable to it's class": {
"prefix": "ivtc",
"body": [
"const ${1:someVar} = ${1/(.*)/${1:/pascalcase}/}Class();",
],
}
}
然后我可以通过包装将之前的转换用作变量
{
"Initialize variable to it's class": {
"prefix": "ivtc",
"body": [
"const ${1:someVar} = ${2:${1/(.*)/${1:/pascalcase}/}}Class();",
"$2",
],
}
}