Sublime Forum

Call function when completion selected? on_query_completions

#1

Hi,
I am using on_query_completions to add some custom completions and was wondering whether it’s possible to call a function when a specific completion is selected?

Below is an example for my returned listed. When the user selects cite, the curser jumps to the place between the curled brackets {}. Now I would like to automatically call a function (for tex people, I would like to call the function that allows me to select the bibtex key). Is that possible?

Thanks!

"cite\t(author year)", "citep{$1}"),
("section\tSection*", "section*{$1}\n$0")]
0 Likes

#2

There is no on_completion_selected event unfortunately. You could use on_modified to constantly monitor the view and read the text in and around the cursor position. This might be overkill though, as you could just assign a key-binding to invoke a macro, command, etc…

0 Likes