-
Notifications
You must be signed in to change notification settings - Fork 27.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add TM_FILENAME_BASE snippet variable #32737
Comments
Snippet transform is tracked here #6920. Just having |
stretch for August, PR welcome. See https://github.com/Microsoft/vscode/blob/master/src/vs/editor/contrib/snippet/browser/snippetVariables.ts#L85 |
I'll look at it this weekend. |
I would love this for creating go test files. For example, if I'm in a go package I have a created a snippet like the following in
which produces
However, if I'm in a file How do I accomplish this? I tried using I'd really like to have access to the "parent package" but being able to manipulate the current filename with knowledge of workspace root would probably be good enough. Will the fix mentioned in this issue support my use case (pretty common for go developers) and is there an ETA? :-) Thanks! |
No, what you want is tracked here: #6920. This issue is about a pragmatic change to add a new variable which is the name of a file without its extension |
@firelizzard18 Is this still on your radar? I don't wanna steel you thunder but I'd tackle this myself on Monday otherwise. Happy Coding |
@jrieken Feel free to tackle it. Other issues have taken precedence :/ |
I am adding my own snippets to try to replace what exists in Visual Studio, as much as I can. I would like a variable such as
TM_FILENAME_BASE
that does not include any extensions, since that is the default class/etc name for many languages. Or better yet, the ability to apply regex replacement rules to the variables, such as${TM_FILENAME,/^([A-Z])/\L$1/,/([a-z])([A-Z])/$1-\L$2/g,/\..*$//}
:TM_FILENAME
- start with the filename/^([A-Z])/\L$1/
- if the first character is uppercase, replace it with lowercase/([a-z])([A-Z])/$1-\L$2/g
- replace allxY
withx-y
/\..*$//
- if the filename ends with an extension, remove itMyCustomElement.html
becomesmy-custom-element
The text was updated successfully, but these errors were encountered: