Home Download Buy Blog Forum Support

noob question : snippets not working?

noob question : snippets not working?

Postby bill on Wed Oct 03, 2012 9:06 pm

I am trying to set up sublime text 2 with PHP, but I am having some trouble getting the snippets to work. I have loaded a PHP project and see that the syntax is correctly set to PHP. When I go to preferences -> browse -> packages _>php , I can see a number of PHP snippets that I am unable to activate including $_files $_get ,$post. As far as I can tell, the tab trigger for these are '$_'

<snippet>
<content><![CDATA[\$_COOKIE['${1:variable}']]]></content>
<tabTrigger>$_</tabTrigger>
<scope>source.php</scope>
<description>COOKIE['…']</description>
</snippet>

but this does not generate any snippets being displayed, when I try it in a php file.

Can anyone give me advice on what to do next?

Thank you,

Bill.
bill
 
Posts: 1
Joined: Wed Oct 03, 2012 9:03 pm

Re: noob question : snippets not working?

Postby pickledegg on Mon Nov 12, 2012 8:56 am

Have you checked you dont have any unescaped '$' signs in your snippets , for example if its a jQuery snippet. From the manual:

Keep the following in mind when writing your own snippets:

If you want the get a literal $, you have to escape it like this: \$.
When writing a snippet that contains indentation, always use tabs. The tabs will be transformed into spaces when the snippet is inserted if the option translateTabsToSpaces is set to true.
The content must be included in a <![CDATA[…]]> section. Snippets won’t work if you don’t do this!


http://sublimetext.info/docs/en/extensi ... ppets.html
pickledegg
 
Posts: 5
Joined: Tue Oct 30, 2012 11:02 am


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 30 guests

cron