Open maelcum opened 4 years ago
Hi.
Thanks for reporting. This issue applies only to languages that use $
as a variable prefix — like PHP. Am I correct on this one?
I may look into it at some point. Thanks for reporting again and have a nice day 🥑
Yes, correct. I am sorry, this should have been mentioned somewhere. I've just changed the title to reflect that. And a very nice day to you too.
👋 Ran into this today as well with a Vue.js snippet. Vue uses a lot of $ for properties that bind to the vue instance for example this.$route.query.search
to get the query parameters.
Admittedly it took me 2 seconds to go and add the \\
to fix it but just wanted to add another example. Love the site, saves me loads of time 🙏
Hello.
$Variablenames in VSCode snippets need to be escaped with a double backslash, like: \\$Variablename to look like $Variablename in the inserted code.
It gets tricky when $Variablenames follow a path delimiter, in Windows the backslash... A Windows backslash is escaped with a single backslash, like: \\some\\path Adding the escaped $Variablename directly behind it will not work, ie: \\\\$Variablename. The $Variablename will loose it's '$' and look like: \Variablename What does work is escaping the double escape by double escaping :) as in: \\\\\\$Variablename
tl;dr: it takes six backslashes to escape the combination '\some\path\$Variablename', to look like '\\some\\path\\\\\\$Variablename' This is only necessary if a $Variablename follows a path delimiter. Otherwise a double backslash '\\' would be enough.
phew
This might be related (or cover) Issue #13