Home Download Buy Blog Forum Support

auto_complete_triggers

auto_complete_triggers

Postby MrMartineau on Tue Jan 10, 2012 4:56 pm

I am curious about this setting & would like to know what could possibly added or removed to improve my experience with Sublime. Currently this is what is in my Base File settings:
Code: Select all
"auto_complete_triggers": [ {"selector": "text.html", "characters": "<"} ]


I would also like to know what the above items refer to, for example, what is 'selector'? I presume it's a CSS selector but am not sure..

Any help would be really useful.

Cheers
@MrMartineau || Setup Sublime Text quickly: Find out all you need at https://github.com/mrmartineau/SublimeTextSetup
MrMartineau
 
Posts: 78
Joined: Thu Jul 28, 2011 8:35 am

Re: auto_complete_triggers

Postby C0D312 on Tue Jan 10, 2012 5:05 pm

But default, Sublime only triggers when you type letters. It shouldn't trigger for numbers or symbols. However, because html tags begin with '<', ST is set to trigger autocomplete when you press <. A selector is how Sublime identifies what type of file you're using and what your scope is within that file. To check your scope, you can press "option+command+p" on OSX or I believe its control+alt+shift+p on windows and linux (but you can check your default keybindings to make sure). The name of all applicable selectors will appear in the statusbar.

As for other uses for this setting, for example, if you use css, you can set autocomplete to trigger on # and have the selector set to source.css. There are many other applications as well.

I hope that makes sense.
C0D312
 
Posts: 1063
Joined: Sun Jul 10, 2011 3:23 am

Re: auto_complete_triggers

Postby MrMartineau on Tue Jan 10, 2012 6:10 pm

Thanks for your reply, it clears a few things up but I am still in need of some assistance. How would I have two selectors: html & css & then two characters: < & #, for example?
@MrMartineau || Setup Sublime Text quickly: Find out all you need at https://github.com/mrmartineau/SublimeTextSetup
MrMartineau
 
Posts: 78
Joined: Thu Jul 28, 2011 8:35 am

Re: auto_complete_triggers

Postby C0D312 on Tue Jan 10, 2012 8:59 pm

MrMartineau wrote:Thanks for your reply, it clears a few things up but I am still in need of some assistance. How would I have two selectors: html & css & then two characters: < & #, for example?


I'm not 100% sure what your looking for. My guess is you're looking for something like:
Code: Select all
   "auto_complete_triggers": [ {"selector": "text.html, source.css", "characters": "<#"} ]


I just tested this. Apparently css has a problem with autocomplete triggering on # (not sure why).
C0D312
 
Posts: 1063
Joined: Sun Jul 10, 2011 3:23 am


Return to General Discussion

Who is online

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