Sublime Forum

Filter context menu options as you type

#1

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.

0 Likes

#2

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.

0 Likes

#3

That’s right edanm, I’m talking about the autocomplete menu here! The filtering wouldn’t make sense for mouse-driven context menus.

0 Likes

#4

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

[code]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]

<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… :confused:

0 Likes

#5

@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, )).

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 :smile:

0 Likes

#6

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.

0 Likes

#7

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.

0 Likes

#8

Exactly! While I wouldn’t like ST to become a bloated full-blown IDE, some features would be nice to have. :wink:

0 Likes