Hi,
I’m writing a “Goto Usage” plugin (opposite of Goto Definition).
When invoked the plugin pops up a list of “usages” of a given class/function/var using window.show_quick_panel
and highlighting any of them opens the file, scrolls to the “usage” and selects it.
During the first 500ms or so after the file gets opened it works, after that highilighting items in the quick panel simply scrolls the view but the selection doesn’t change!?
Here’s a gif of the problem. It pops up the quick panel and moving up and down in it, it scrolls to the correct place and for the first 3 times it also selects one or the other “usage” but at some point it doesn’t anymore:
(note the text background and the highlighted line number)
I’m opening the quick panel here: https://github.com/syko/SublimeGotoUsage/blob/master/GotoUsage.py#L57
Upon highlighting core.open_usage
gets called: https://github.com/syko/SublimeGotoUsage/blob/master/core.py#L367
There I open the file and add a callback to stack that gets executed upon opening the file (this feels like a hack, if there’s a better way to do this, I’m all ears).
Anyway, in the final show_usage
function I’m simply doing:
sel = view.sel() sel.clear() sel.add(select and usage['region'] or usage['region'].a)
Could this be a bug in ST3?