I would love to see on_query_completions
allow for an on_highlighted
/on_change
callback function to be provided that would be called when the current selection in the completions menu changes. This would allow for more information to be provided regarding the current selection in an HTML popup alongside the completion menu.
To implement this I would envision allowing for returning a tuple from on_query_completions
like so: (completions, flags, on_change)
, where the on_change
callback would be called with the index of the completion in the corresponding completions list whenever an item in the overall completion list is highlighted that is from that set.
This might be really tricky to implement since there are potentially going to be many different sources/plugins providing completions via on_query_completions
and the correct callback with the correct original index (since all the completions are aggregated into one list) would have to be called as the selection changes.
As far as rating this goes, I would say Minor
since I would definitely use this, but the lack of it doesn’t prevent completion lists from being useful.
…As I was writing this I recalled this thread: Dev Build 3071. Based on that I guess the popup API is not supposed to be used as I just described, so alternately it would be nice to see the suggestion made there implemented: