seems pretty simple to me, unless I’m missing something
EDIT: yes, I am - it is possible to click outside the goto definition input box and the quick panel stays visible, so this won’t work in that case, and on_close
isn’t fired when the quick panel really is closed. If you just care about when the user is typing in this view, it should be enough to ignore the quick panel view in your plugin because the id doesn’t seem to get reused. But, I’m not sure how to tell when it has been closed, without making changes to Packages/Default/symbols.py
which I wouldn’t recommend
import sublime
import sublime_plugin
class GotoDefinitionListener(sublime_plugin.EventListener):
pre_definition_view = None
definition_view = None
def on_window_command(self, window, command_name, args):
if command_name in ('goto_definition', 'context_goto_definition'):
self.pre_definition_view = window.active_view().id()
def on_activated(self, view):
if self.pre_definition_view is not None:
print('this view is the goto_definition input view', view.id(), 'activated from view', self.pre_definition_view)
self.definition_view = view.id()
self.pre_definition_view = None
elif self.definition_view is not None and self.definition_view != view.id():
print('the goto_definition input view was just deactivated')
self.definition_view = None