Sublime Forum

TextMate Snippets - Completion not working

#1

I added jquery textmate snippets to my packages directory. The snippets work fine in the “snippets” menu, but the one snippet I really want to use is the “$(document).ready(function() { });” snippet, the famous jquery main function. I type “ready” and hit tab, and, strangely, sublime changes ready to “already”! What is this? Some strange “spelling” completion? I also tried ‘test’ hit tab it expanded to ‘tests’…

0 Likes

#2

The jquery snippets have a selector of “source.js.jquery”, which means they’ll only trigger if you use the jquery .tmLanguage file from the same bundly (i.e., if your syntax needs to be set to “jQuery (JavaScript)”.

0 Likes

#3

Hey MMackus, I am in the process of porting the Textmate jQuery bundle to a Sublime package & you can download the latest on my Github page here: github.com/mrmartineau/jQuery-S … xt-Package

I am also connverting the HTML5 Textmate bundle too (github.com/mrmartineau/Placeholders)

The HTML5 & jQuery packages are still not finished but you can use them without problem.

0 Likes

#4

This is definitly something I expected to come already with Sublime. Even dreamweaver added Jquery to the default install. I think a lot of people would really appreciate that in the next build(or in a future build)(sooner the better), thanks!

0 Likes

#5

Thank you for your replies.

I was under the impression textmate snipplets were drop in functionality for Sublime - this is one of the main reasons I’m interesting in purchasing sublime. Perhaps I should look at something like E that has actual support for textmate snippets.

So, from what I understand, it needs to be in the correct scope. Not too big of a deal. Will other snippets work though? Such as PHP, etc?

RE: Github conversion - thats great, but I was hoping they would work out of the box. Thank you for the link though.

What about PHP, Python, and Ruby? I use those all the time…

0 Likes

#6

[quote=“MMackus”]Thank you for your replies.

I was under the impression textmate snipplets were drop in functionality for Sublime - this is one of the main reasons I’m interesting in purchasing sublime. Perhaps I should look at something like E that has actual support for textmate snippets.

So, from what I understand, it needs to be in the correct scope. Not too big of a deal. Will other snippets work though? Such as PHP, etc?

RE: Github conversion - thats great, but I was hoping they would work out of the box. Thank you for the link though.

What about PHP, Python, and Ruby? I use those all the time…[/quote]

As Sublimator said, they do work out of the box.

0 Likes

#7

Hmmm ok well the jquery snippets have a source.js.jquery scope right? How do I activate this scope? I’d rather this just be activated by default… I guess I could just do mass find->replace source.js.jquery. Is there a way to automatically activate this scope whenever I’m in a block (or .js file)?

[quote=“sublimator”]

This is the reason why @MrMartineau thought it necessary to convert the snippets to sublime-snippet format. I see in the conversionthey aren’t scoped at all.

You just have to make sure you have the correct grammar applied. There’s no real need to convert the snippets.[/quote]

What do you mean by correct grammar?

Thanks guys, I’ll try installing more snippets working tonight. Makes more sense now why the jquery ones didn’t work.

0 Likes

#8

I can’t get this working. My snippet is as follows which is a direct copy of a TextMate Snippet. This aims for the # key to insert the charcaters #{} around text within a double quotes string. At the moment it does nothing. Any ideas??

[code]<?xml version="1.0" encoding="UTF-8"?>

content #{${1:$TM_SELECTED_TEXT}} keyEquivalent # name Embedded Code — #{…} scope (string.quoted.double.ruby|string.interpolated.ruby) - string source uuid 12F6DE4C-6981-4413-8582-C0286D2ED84B [/code]
0 Likes