SublimeText / jQuery

Sublime Text package bundle for jQuery
323 stars 98 forks source link

autocomplete of ajax command doubles $-indicator #11

Open stackem opened 10 years ago

stackem commented 10 years ago

When I type

jQuery.ajax or $.ajax

and then select the first normal ajax function, the following appears:

$.$.ajax({ ... or jQuery.$.ajax({ ...

It helps to have a good function build but you always have to remove the leading doubled indicator. It maybe is the case with other functions too, but am using the ajax request quite often so it's quite annoying.

Best, Robin

mrmartineau commented 9 years ago

Hi @stackem, your issue actually applies to all jQuery. methods (jQuery.ajax(), jQuery.map() etc) so I would have to change it for all of them. Do you think that is a good idea?

stackem commented 9 years ago

yeah I think that would be a good change

gaboesquivel commented 9 years ago

Hi I'm trying to solve this problem here https://github.com/gaboesquivel/jQuery/tree/new-triggers

I've reorganized the snippets in the following directories: ├── Completion_Snippets -----> these will not include $. or jQuery. ├── Dollar_Snippets -----> these ones will include $. ├── Plugin_Snippets ----> snippets for building plugins ├── jQuery_Snippets -----> these will include jQuery.

for dollar snippets I'm using j_ prefix and for jQuery snippets J_ . Sublime snippet triggers are caseSensitive. for completion snippets I'm not sure if we need to use .triggerString ( includes the dot ) or simply the function name as trigger.

For all them ideally we will get the list of options while typing and we need to properly describe that this is jQuery autocomplete in description.

let me know your ideas.

also what are Support and Syntaxes for?

paulmist commented 1 year ago

Old issue, but one that has been bothering me only more recently.

I've implemented a "fix/hack" that's working for me.

My main issue was the snippet for $('') producing a double-$.

I edited the tabTrigger to be a double-$ and it works to produce a single $ instead. Sublime has even learned that when I use a single $ + tab it triggers this snippet accurately.

Edited snippet:

<snippet>
    <content><![CDATA[\$('${1:string/element/array/function/jQuery object/string, context}')$0]]></content>
    <tabTrigger>$$</tabTrigger>
    <description>$('#select DOM Element')</description>
    <scope>source.js</scope>
</snippet>