VS Code tips — Snippet variable transforms

preview_player
Показать описание
Today's VS Code tip: snippet variable transforms

Apply a regular expression based replacement to variables in snippets. The syntax is: ${VAR/regexp/replacement/}

One common use case is generating a valid class name from the current file name.

Рекомендации по теме
Комментарии
Автор

Any idea how to use global or project or environmental variables in snippets? Let's say I have a project that use textdomain XXX for translations and I would like to write snippets for functions like __() or _e() or esc_html(), etc... and they need a second argument to be automatically that XXX, so in next project I can easily change it in a single place and not in every single snippet again and again

JakubNovak
Автор

I can't get my snippet to appear in autocomplete. I'm using C.

sarnobat
Автор

hi. i hace a question. how can apply a capitalize the first letter, i want create a snippet to create class in python: class Test (the first letter in uppercase). how can i do this with placeholders. thanks

jorgev
Автор

Can I transform tab stops this way? So that for example the second tabstop has a different letter compared to the first one.

Syubukov
welcome to shbcf.ru