Frage

I wrote that little snippet to help my workflow in Sublime Text 3:

<snippet>
    <content><![CDATA[
    (function ($) {"use strict";$(function () {$1});}(jQuery));
]]></content>
    Optional: Tab trigger to activate the snippet
    <tabTrigger>self.function</tabTrigger>
    <!-- Optional: Scope the tab trigger will be active in -->
    <scope>source.js</scope>
    <!-- Optional: Description to show in the menu -->
    <description>self.trigger.function</description>
</snippet>

The contextual menu display is when I start to type "self" in a javascript file, but when I hit "Enter", nothing is pasted to my file.

Any idea why that is?

Thanks

War es hilfreich?

Lösung

You need to escape $ if you want that character to appear literally. Or else SublimeText would assume it to be a Variable field. So just do this -

(function (\$) {"use strict";\$(function () {$1});}(jQuery));

Now it'll work. Details are under the content section of the documentation.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top