i want to make a snippet that give the path of current open file relative to ${workspaceRoot}/src so i made this
{
"get path": {
"prefix": "gp",
"body": [
"${TM_DIRECTORY/.*src(.*)/$1/}",
]
}
}
this work's but for files like /home/username/MyProject/src/dir1/dir2//foo.cc this gives /dir1/dir2 so i changed it to this
"get path": {
"prefix": "gp",
"body": [
"${TM_DIRECTORY/.*src[\/](.*)/$1/}",
]
}
}
so now i expect it to show dir1/dir2 instead it expands to this ${TM_DIRECTORY/.*src[/](.*)//} and this happen with any regex that contain \/
same with this "${TM_DIRECTORY/[\/](.*)/$1/}", expands to ${TM_DIRECTORY/[/](.*)//}
and for some reason this ${TM_DIRECTORY/.*src[\\/](.*)/$1/} works and expands to dir1/dir2
but on https://regex101.com this is invalid
i want to make a snippet that give the path of current open file relative to ${workspaceRoot}/src so i made this
this work's but for files like
/home/username/MyProject/src/dir1/dir2//foo.ccthis gives/dir1/dir2so i changed it to thisso now i expect it to show
dir1/dir2instead it expands to this${TM_DIRECTORY/.*src[/](.*)//}and this happen with any regex that contain\/same with this
"${TM_DIRECTORY/[\/](.*)/$1/}",expands to${TM_DIRECTORY/[/](.*)//}and for some reason this
${TM_DIRECTORY/.*src[\\/](.*)/$1/}works and expands todir1/dir2but on
https://regex101.comthis is invalid