问题
I've been unable to determine the transform to use to grab the directory that a new file is in from the TM_DIRECTORY that VSCode exposes?
i.e. For a path like c:\a\b\c\d\e I would like to get e as the output. I also have linux co-works so it should also work for something like /mnt/a/b/c/d/e
回答1:
Try this snippet:
"stripLastDirectory": {
"prefix": "lsd",
"body": [
"${TM_DIRECTORY/.*[\\\\|\\/]+(.*)/$1/}"
],
},
I am unable to test that on Linux but it should work on all OS's.
来源:https://stackoverflow.com/questions/52877815/vscode-snippet-transform-to-determine-the-containing-directory