Home Download Buy Blog Forum Support

Filter context menu options as you type

Filter context menu options as you type

Postby guillermooo on Fri May 07, 2010 9:42 am

Now you can only navigate the context menu with the arrow keys. A filter (similar to the QuickPanel's) would be great to have.

Some ideas:

Once the options have been narrowed down to say 5 items, you can select them by pressing 1..5. Or maybe cycle through them with TAB.
Last edited by guillermooo on Wed May 12, 2010 11:08 pm, edited 1 time in total.
guillermooo
 
Posts: 728
Joined: Thu Jul 23, 2009 9:06 am

Re: Filter context menu options as you type

Postby edanm on Fri May 07, 2010 1:20 pm

What do you mean by "context menu"?
Are you talking about the "autocomplete" menu? Cause I keep wishing the autocomplete menu would be built on top of the quickpanel.
edanm
 
Posts: 131
Joined: Thu Mar 04, 2010 11:05 pm

Re: Filter context menu options as you type

Postby guillermooo on Fri May 07, 2010 1:43 pm

That's right edanm, I'm talking about the autocomplete menu here! The filtering wouldn't make sense for mouse-driven context menus.
guillermooo
 
Posts: 728
Joined: Thu Jul 23, 2009 9:06 am

Re: Filter context menu options as you type

Postby guillermooo on Fri May 07, 2010 2:11 pm

Would something like this work for you? (it will only be triggered inside "[]"):

Code: Select all
import sublime, sublimeplugin

class CleanupLeftoversCommand(sublimeplugin.TextCommand):
    def run(self, view, args):
        sel = view.sel()[0]
        a, b = sel.begin(), sel.end()
        precedingChar = view.substr(sublime.Region(a - 1,a))
        if precedingChar == "[":
            view.runCommand("leftDeleteCharacters")
            view.runCommand("rightDeleteCharacters")
        else:
            view.runCommand("leftDeleteCharacters")


Code: Select all
   <binding key="backspace" command="cleanupLeftovers">
      <context name="allFollowingCharacter" value="]" />
   </binding>


Just to make sure we're on the same page!

EDIT: Posted in the wrong place... :/
guillermooo
 
Posts: 728
Joined: Thu Jul 23, 2009 9:06 am

Re: Filter context menu options as you type

Postby edanm on Fri May 07, 2010 4:13 pm

@guillermooo: Is this in reply to the other thread about deleting special chars?


Anyways, about the autocomplete menu, you can probably patch up a plugin which uses the QuickPanel for autocomplete, since there is a function to get the autocompletion options available (extractCompletions(prefix, <point>)).

Basically, you just need to give it the proper word for a prefix, the point it was called from, and pop up a QuickPanel to show the different options. I might cook it up myself next week if I have time (in between the other 3 plugins I'm trying to get through :)
edanm
 
Posts: 131
Joined: Thu Mar 04, 2010 11:05 pm

Re: Filter context menu options as you type

Postby guillermooo on Wed May 12, 2010 8:59 am

Yep, you can use the quick panel too, but the completions menu is less intrusive and can have its uses. Enabling more control of this little menu would be great: styling the contents, for example. That would let us create advanced autocompletion plugins.

But I'm not in a hurry for this.
guillermooo
 
Posts: 728
Joined: Thu Jul 23, 2009 9:06 am

Re: Filter context menu options as you type

Postby edanm on Wed May 12, 2010 10:10 am

Yeah I agree, a non-intrusive autocomplete panel is better than using the QuickPanel for everything.

Have you ever seen Eclipse? They have really great auto-complete type menus, with lots of info on each entry (help, etc.).
It would definitely be great if we could style the SublimeText menus a little, add more options to them, to take them to Eclipse's level.
edanm
 
Posts: 131
Joined: Thu Mar 04, 2010 11:05 pm

Re: Filter context menu options as you type

Postby guillermooo on Wed May 12, 2010 11:06 pm

Exactly! While I wouldn't like ST to become a bloated full-blown IDE, some features would be nice to have. ;)
guillermooo
 
Posts: 728
Joined: Thu Jul 23, 2009 9:06 am


Return to Ideas and Feature Requests

Who is online

Users browsing this forum: No registered users and 8 guests