Reputation: 806
Ok, so I am having a small problem, more of an annoyance. And it brings up a question of why sublime text is acting this way. Yes, although this is compass and sass markup, the question is related to sublime text snippets.
So this is the code I want to repeat in a snippet through sublime (my end goal):
$default-box-shadow-color: #333333;
$default-box-shadow-h-offset: 0px;
$default-box-shadow-v-offset: 0px;
$default-box-shadow-blur: 5px;
$default-box-shadow-spread: false;
$default-box-shadow-inset: false;
and so i make a new snippet and this is how I input it:
<snippet>
<content><![CDATA[
$default-box-shadow-color: ${1:#333333};
$default-box-shadow-h-offset: ${2:0px};
$default-box-shadow-v-offset: ${3:0px};
$default-box-shadow-blur: ${4:5px};
$default-box-shadow-spread: ${5:false};
$default-box-shadow-inset: ${6:false};
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>defaultboxshadow</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.sass</scope>
</snippet>
Everything seems good right? You are probably thinking, "this guy doesn't know how to make a snippet! Why is he wasting my time?" Well just watch this... when I use the tab trigger in my main document to invoke this snippet, this is what it outputs:
-box-shadow-color: #333333;
-box-shadow-h-offset: 0px;
-box-shadow-v-offset: 0px;
-box-shadow-blur: 5px;
-box-shadow-spread: false;
-box-shadow-inset: false;
Weirdly enough... all the
$defaultparts are gone. So I am hoping that someone has an explanation for me. Or is this a bug in sublime?
Here are some things I know (98% certainty) are not the problem:
So alas, here we are. I have troubleshot it and I think it has to do with the $ in front. When I remove the dollar sign i get
default-box-shadow-color: #333333;which is close, except that compass needs that dollar sign and the whole point of the snippet was to make my life easier.
Is there a way to character cancel the $? is this a known issue? Am I doing something wrong or should I bring this up with the devs of sublime? I would like to just be able to use this if I could. Any help would be appreciated. Thanks.
Upvotes: 1
Views: 732
Reputation: 14498
Escape all of the $default
variables with a \
<snippet>
<content><![CDATA[
\$default-box-shadow-color: ${1:#333333};
\$default-box-shadow-h-offset: ${2:0px};
\$default-box-shadow-v-offset: ${3:0px};
\$default-box-shadow-blur: ${4:5px};
\$default-box-shadow-spread: ${5:false};
\$default-box-shadow-inset: ${6:false};
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>defaultboxshadow</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.sass</scope>
</snippet>
Upvotes: 4