Home Download Buy Blog Forum Support

Selectively trigger commands on user input

Selectively trigger commands on user input

Postby Kronuz on Thu May 26, 2011 9:45 pm

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.
Kronuz
 
Posts: 98
Joined: Mon Feb 14, 2011 3:14 pm

Re: Selectively trigger commands on user input

Postby Kronuz on Tue May 31, 2011 1:34 am

In this direction, check out viewtopic.php?f=5&t=2202
Kronuz
 
Posts: 98
Joined: Mon Feb 14, 2011 3:14 pm


Return to Plugin Development

Who is online

Users browsing this forum: No registered users and 4 guests