Home Download Buy Blog Forum Support

adding "<" to auto_completions.py

Re: adding "<" to auto_completions.py

Postby atomi on Tue May 01, 2012 3:02 am

C0D312 wrote:In the on_query_completions,
Code: Select all
if 'tag' in scope_name(pt):
  return


@COD312 I would not have thought of that without really spending more time with the API. Brilliant thanks!

The bigger issue though is the sublime-completions files aren't loading in the autocomplete list - unfortunately.
atomi
 
Posts: 342
Joined: Thu Jan 20, 2011 5:06 pm
Location: Los Angeles CA US

Re: adding "<" to auto_completions.py

Postby C0D312 on Tue May 01, 2012 3:06 am

I'm not super familar with how the scoping system works but I believe theres away to say "minus scope x." So in your completion file, you can have scope = text.html, minus tags.

Edit: yep. Here's some info: viewtopic.php?f=2&t=1809&p=8405&hilit=scope+except#p8405 text.html - tag
C0D312
 
Posts: 1063
Joined: Sun Jul 10, 2011 3:23 am

Re: adding "<" to auto_completions.py

Postby atomi on Tue May 01, 2012 3:11 am

Well yeah, your posts are really helpful man.

I'll see if I can't get to the bottom of that and post a new thread with more information if I can't get it to do what I need.
Edit: Perfect. Thanks!
atomi
 
Posts: 342
Joined: Thu Jan 20, 2011 5:06 pm
Location: Los Angeles CA US

Re: adding "<" to auto_completions.py

Postby atomi on Tue May 01, 2012 3:21 am

So okay. That solves the triggering unwanted autocompletes in tags.

But completions in sublime-completions files arent being loaded into the autocomplete list (even with just text.html as the scope).
I think it might be that ST is expecting an array/list to be returned by the plugin when there is no autocomplete so that it has something to extend or append to.
atomi
 
Posts: 342
Joined: Thu Jan 20, 2011 5:06 pm
Location: Los Angeles CA US

Re: adding "<" to auto_completions.py

Postby agibsonsw on Tue May 01, 2012 11:05 am

atomi wrote:So okay. That solves the triggering unwanted autocompletes in tags.

But completions in sublime-completions files arent being loaded into the autocomplete list (even with just text.html as the scope).
I think it might be that ST is expecting an array/list to be returned by the plugin when there is no autocomplete so that it has something to extend or append to.


Yes I think you need to return an empty list:

Code: Select all
if 'tag' in scope_name(pt):
  return []

Also sublime.INHIBIT_WORD_COMPLETIONS | sublime.INHIBIT_EXPLICIT_COMPLETIONS is requesting that only your completions will appear in the list.

I still think you should test a small subset of your completions before getting too deeply involved. You can suppress them from appearing within 'tag' scope, but if you edit within a tag they won't reappear. And <b>Typing this text</b> will cause your completions to pop up for every letter typed.
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
agibsonsw
 
Posts: 901
Joined: Fri Jan 27, 2012 9:11 pm

Re: adding "<" to auto_completions.py

Postby atomi on Tue May 01, 2012 5:55 pm

agibsonsw wrote:Yes I think you need to return an empty list:

Code: Select all
if 'tag' in scope_name(pt):
  return []

Also sublime.INHIBIT_WORD_COMPLETIONS | sublime.INHIBIT_EXPLICIT_COMPLETIONS is requesting that only your completions will appear in the list.

I still think you should test a small subset of your completions before getting too deeply involved. You can suppress them from appearing within 'tag' scope, but if you edit within a tag they won't reappear. And <b>Typing this text</b> will cause your completions to pop up for every letter typed.



So I removed INHIBIT_WORD_COMPLETIONS | INHIBIT_EXPLICIT_COMPLETIONS and sublime-completions files still are not working with this.

Sublime-completion files work well when I return an empty list, but not when that list contains completions. Even after removing the INHIBIT directives.

Would this be a bug?
atomi
 
Posts: 342
Joined: Thu Jan 20, 2011 5:06 pm
Location: Los Angeles CA US

Re: adding "<" to auto_completions.py

Postby agibsonsw on Tue May 01, 2012 6:36 pm

I'm not sure about this line - it might be creating a generator.

Code: Select all
html = ([(list(item)[-2],"<" + list(item)[1]) for item in html])


try following it with 'print html' and check it in the Console (Ctrl '). Also check the Console for error messages. Alternatively, try

Code: Select all
html = [(list(item)[-2],"<" + list(item)[1]) for item in html]
print html
return (html)
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
agibsonsw
 
Posts: 901
Joined: Fri Jan 27, 2012 9:11 pm

Re: adding "<" to auto_completions.py

Postby atomi on Tue May 01, 2012 8:07 pm

I don't think it's that line I can comment it out and sublime-completions files still don't load for html.

That line just adds a leading less than character to every second string in the completions list.
I'm not sure how efficient it is; I'll likely add to a global variable later.
atomi
 
Posts: 342
Joined: Thu Jan 20, 2011 5:06 pm
Location: Los Angeles CA US

Previous

Return to Plugin Development

Who is online

Users browsing this forum: No registered users and 4 guests