Home Download Buy Blog Forum Support

completions[] + auto_complete

Re: completions[] + auto_complete

Postby atomi on Wed May 23, 2012 7:38 pm

C0D312 wrote:Did you get it working? Let me know if you need help.


Okay. I stepped out for lunch, and now I need to refactor a bit.
But I'll ping back definitely in a bit. Thanks.
atomi
 
Posts: 342
Joined: Thu Jan 20, 2011 5:06 pm
Location: Los Angeles CA US

Re: completions[] + auto_complete

Postby atomi on Wed May 23, 2012 9:10 pm

It works fine. In your Display Functions plugin, help text can also be added in the on_query_completions (I just missed it): https://github.com/BoundInCode/Display- ... ns.py#L172

It's amazing how you figured all this out. I searched Google for run_command('auto_complete') and there is only sparse information and most of it is from you. For example, how did you know about 'next_competion_if_showing'? I couldn't find documentation for it anywhere.
atomi
 
Posts: 342
Joined: Thu Jan 20, 2011 5:06 pm
Location: Los Angeles CA US

Re: completions[] + auto_complete

Postby C0D312 on Wed May 23, 2012 9:22 pm

http://www.sublimetext.com/dev

search for Build 2148.

When I was first figuring stuff out, I used https://github.com/Kronuz/SublimeCodeIn ... el.py#L290 as a guide. Helped get me off my feet, since at the time, CodeIntel was one of the only plugins to use on_query_completions (zencoding is a whole different story).
C0D312
 
Posts: 1063
Joined: Sun Jul 10, 2011 3:23 am

Re: completions[] + auto_complete

Postby atomi on Wed May 23, 2012 10:07 pm

This is a small nuisance, but if the auto_complete popup is present, triggering my own api completions wont work unless the popup is closed by pressing escape. Is there a way to make sure the completions popup is closed in textCommand?
Last edited by atomi on Thu May 24, 2012 1:29 am, edited 1 time in total.
atomi
 
Posts: 342
Joined: Thu Jan 20, 2011 5:06 pm
Location: Los Angeles CA US

Re: completions[] + auto_complete

Postby C0D312 on Wed May 23, 2012 10:17 pm

It's funny because I came across that same exact problem. I tried a few things such as closing the autocomplete at the beginning of the plugin and setting a short timeout. However, nothing worked as smooth as just setting auto_complete_triggers to '.' for java (in Display-Java's case). I'll play around with in though and see what I can do.
C0D312
 
Posts: 1063
Joined: Sun Jul 10, 2011 3:23 am

Re: completions[] + auto_complete

Postby atomi on Fri May 25, 2012 6:33 am

C0D312 wrote:It's funny because I came across that same exact problem. I tried a few things such as closing the autocomplete at the beginning of the plugin and setting a short timeout. However, nothing worked as smooth as just setting auto_complete_triggers to '.' for java (in Display-Java's case). I'll play around with in though and see what I can do.


I tried, as you probably did (but not working either):

self.view.run_command('hide_auto_complete')


I also thought maybe I could change the keybinding to work when auto_complete_visible is true but it seems like Sublime is hard coded to kill auto_complete when any key not used by auto_complete is sent.
There just might not be away around it. I'll keep my hopes up.
atomi
 
Posts: 342
Joined: Thu Jan 20, 2011 5:06 pm
Location: Los Angeles CA US

Re: completions[] + auto_complete

Postby C0D312 on Fri May 25, 2012 5:37 pm

Awesome. I got it working. All you need to do is set a timeout to run_command('auto_complete')

This is the code I used:
    def activate_ac(self):
self.view.run_command('auto_complete', {
'disable_auto_insert': True,
'api_completions_only': True,
'next_competion_if_showing': False
})
view.run_command('hide_auto_complete')
sublime.set_timeout(self.activate_ac,100)
C0D312
 
Posts: 1063
Joined: Sun Jul 10, 2011 3:23 am

Re: completions[] + auto_complete

Postby atomi on Fri May 25, 2012 5:52 pm

C0D312 wrote:Awesome. I got it working. All you need to do is set a timeout to run_command('auto_complete')

This is the code I used:
    def activate_ac(self):
self.view.run_command('auto_complete', {
'disable_auto_insert': True,
'api_completions_only': True,
'next_competion_if_showing': False
})
view.run_command('hide_auto_complete')
sublime.set_timeout(self.activate_ac,100)



My lazy butt didn't try a timeout since you mentioned you tried that as well.

I tried a few things such as closing the autocomplete at the beginning of the plugin and setting a short timeout.


Glad you posted back. I'll give you a heartfelt shout out for the help on the plugin readme man - thanks.
I'll try it in a bit and see how well it works.
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: Exabot [Bot] and 5 guests