Home Download Buy Blog Forum Support

Trying to add a snippet & getting error

Trying to add a snippet & getting error

Postby jesseatkinson on Mon Jan 09, 2012 3:45 pm

I'm trying to add a new snippet that I will use most likely for new javascript files. Here is my snippet code.
Code: Select all
<snippet>
   <content><![CDATA[;(function ($, window, undefined) {
         "use strict";

         var ${1:global_namespace} = {

         };

         $(document).ready(function () {
            app.init();
         });

         window.app = app || {};
      }(jQuery, this));
   ]]></content>
   <!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
   <tabTrigger>anon</tabTrigger>
   <!-- Optional: Set a scope to limit where the snippet will trigger -->
   <scope>source.js</scope>
   <!-- Optional: Description to show in the menu -->
   <description>Anonymous self-executing function</description>
</snippet>


And the error I get is:
Error parsing content for snippet Packages/User/anonymousSelfExecutingFunction.sublime-snippet: Empty key


What gives? What am I doing wrong?
jesseatkinson
 
Posts: 9
Joined: Mon Jan 09, 2012 3:42 pm
Location: Detroit

Re: Trying to add a snippet & getting error

Postby jps on Mon Jan 09, 2012 9:18 pm

It's not happy with the standalone $ symbol on the first line, it needs to be escaped, by turning it into \$
jps
Site Admin
 
Posts: 3058
Joined: Wed Mar 19, 2008 12:33 pm

Re: Trying to add a snippet & getting error

Postby jesseatkinson on Mon Jan 09, 2012 9:51 pm

Thank you for the heads up but that didn't fix it. I'm getting the same error.
jesseatkinson
 
Posts: 9
Joined: Mon Jan 09, 2012 3:42 pm
Location: Detroit

Re: Trying to add a snippet & getting error

Postby jps on Mon Jan 09, 2012 11:25 pm

You need to escape the other $ symbol, too
jps
Site Admin
 
Posts: 3058
Joined: Wed Mar 19, 2008 12:33 pm

Re: Trying to add a snippet & getting error

Postby jesseatkinson on Tue Jan 10, 2012 2:40 pm

jps wrote:You need to escape the other $ symbol, too

Oh my lord, I'm an idiot.

Thank you very much!
jesseatkinson
 
Posts: 9
Joined: Mon Jan 09, 2012 3:42 pm
Location: Detroit


Return to Technical Support

Who is online

Users browsing this forum: No registered users and 14 guests