Home Download Buy Blog Forum Support

How to use jQuery snippets?

How to use jQuery snippets?

Postby nicktheandroid on Tue Feb 08, 2011 5:44 pm

I'm used to E text editor, it's easy.
I just downloaded sublime 2 for the first time, i downloaded this folder with all the jquery snippets for sublime: http://sublime.akalias.net/snippets/Jav ... %20jQuery/
then i opened the packages folder and moved the jquery snippets folder into the packages folder.
when i reset sublime, Jquery showed up in the snippets menu.... but it doesn't let me use any of the TAB shortcuts..... WHY?

I saw another menu called syntax, which did NOT have Jquery in it...


..... Why aren't snippets working for Jquery, when I have them installed.
is there a jquery syntax folder/file available to download that will make this work? or? uhhh?
nicktheandroid
 
Posts: 16
Joined: Tue Feb 08, 2011 5:33 pm

Re: HOW TO USE JQUERY SNIPPETS?????????????????

Postby jbrooksuk on Tue Feb 08, 2011 7:07 pm

I can't seem to get any snippets working in v2.
jbrooksuk
 
Posts: 689
Joined: Sun Apr 11, 2010 10:37 am
Location: England

Re: HOW TO USE JQUERY SNIPPETS?????????????????

Postby jps on Wed Feb 09, 2011 2:44 am

jQuery won't have shown up in the snippets menu because you need a corresponding .tmLanguage file for it: there are only snippets at that link.

The snippets are scoped on "source.js.jquery", which means they'll only trigger if the current file is using the jQuery tmLanguage file. You'll need to find one.
jps
Site Admin
 
Posts: 3058
Joined: Wed Mar 19, 2008 12:33 pm

Re: HOW TO USE JQUERY SNIPPETS?????????????????

Postby jps on Wed Feb 09, 2011 4:26 am

A .tmLanguage file needs at least one fileType entry to appear in the list of available syntaxes in Sublime Text
jps
Site Admin
 
Posts: 3058
Joined: Wed Mar 19, 2008 12:33 pm

Re: How to use jQuery snippets?

Postby nicktheandroid on Fri Feb 11, 2011 9:39 am

I'm sorry maybe i'm a little dull, but i downloaded the .zip from the bitbucket link you posted. then in S2 I went to 'preferences' > 'browse packages' then when the folder opened, i stuck the jquery folder i downloaded in there with all the other folders. i reset S2, and I see Jquery in the snippets menu, but not in the syntax menu, i even scrolled all the way down, and pressed J to scroll through all those starting with J.

Was it supposed to work after doing that?

WindowsXP 32bit
nicktheandroid
 
Posts: 16
Joined: Tue Feb 08, 2011 5:33 pm

Re: How to use jQuery snippets?

Postby nicktheandroid on Fri Feb 11, 2011 11:22 am

Just tried deleting the cache file, and it's still not showing up inside the syntax menu under 'tools'. I searched Google for the textmate folder with snippets and all that stuff that's in your download link, and i tried that too, and when i added that one it had the 't.h.i.s TAB' stuff in the snippets menu next to the snippet, which isn't there when i use the one you put a link to. But either way it's still not in the syntax menu. Is there a way to make jquery work under the javascript syntax? or? i'm just trying to find any way to make jquery syntax work, sublime is no good to me if I can't get this working. It works in E text-editor, but development over there seems dead and there's a few problems that haven't been taken care of and it's been too long.

I'm using Sublime 2 Build 2020 on windowsXP 32bit
nicktheandroid
 
Posts: 16
Joined: Tue Feb 08, 2011 5:33 pm

Re: How to use jQuery snippets?

Postby jps on Fri Feb 11, 2011 12:13 pm

Check that:

A) You have a .tmLanguage file for jQuery
B) Inside the .tmLanguage file, it has one or more entries in the <fileTypes> array
jps
Site Admin
 
Posts: 3058
Joined: Wed Mar 19, 2008 12:33 pm

Re: How to use jQuery snippets?

Postby nicktheandroid on Sat Feb 12, 2011 3:51 am

jps wrote:Check that:

A) You have a .tmLanguage file for jQuery
B) Inside the .tmLanguage file, it has one or more entries in the <fileTypes> array


PERFECT, there was no <fileTypes>, so i copied it from the javascript package and now jquery shows up in the syntax list. How did it work for you subliminator if you didn't have the <fileTypes> line in your language file? Also, in the package you put online, there's no tabTrigger in any of the .sublime-snippet files. Does your converter keep the tab trigger? because looking through it, none of the snippets in the package you put online have tabTriggers. I added a few tab triggers to see if jquery works, and i finally got it working after adding the <fileTypes> line, and then adding <tabTrigger>trigger word</tabTrigger> to each snippet.
nicktheandroid
 
Posts: 16
Joined: Tue Feb 08, 2011 5:33 pm

Re: How to use jQuery snippets?

Postby nicktheandroid on Sat Feb 12, 2011 4:44 am

so, i can copy what you posted right there, copy that into the keymap file and it will take the name of the snippet and make that the tab trigger?
nicktheandroid
 
Posts: 16
Joined: Tue Feb 08, 2011 5:33 pm

Re: How to use jQuery snippets?

Postby atomi on Wed Mar 02, 2011 12:50 am

Why not use the tabTrigger?

It seems messy to pollute the user's .sublime-keymap file.
atomi
 
Posts: 342
Joined: Thu Jan 20, 2011 5:06 pm
Location: Los Angeles CA US

Next

Return to Technical Support

Who is online

Users browsing this forum: Google [Bot] and 10 guests