Sublime Forum

Selectively trigger commands on user input

#1

I’d like to trigger a command when a user writes something… for example, like TAB triggers the autocompletion, I’d want to trigger a function on the event the user writes something and then immediately an opening parenthesis or something and a dot (’.’) (for C and python) or ‘->’ (for C) to show a list of attributes or methods available in the scope. I want to “bind” this events to certain characters in a per-language basis as to present intellisense-like completions and tooltips. I would also like to bind to tooltips and autocomplete menus so when the user presses ‘)’ or TAB or other keys (depending) it’d finish/rollback the completion. The binding method would choose when to fire or not a command to show a menu or a tooltip.

I’m not sure if this is already possible in Sublime Text 2 or not, but if not, I see two possible ways of doing this triggering: One, make a callback availabe for each user keypress. Or two, perhaps more efficient, add a way of configuring keypress bindings certain “input regexps” that would trigger any given callback per language.

This is only lay the ground for intellisense support by plugins.

0 Likes

#2

In this direction, check out CodeIntel ported from Open Komodo Editor

0 Likes