Sublime Forum

Delay when using quick panel with many options

#1

I have a plugin where I initialize a quick panel with perhaps a few hundred options. The quick panel loads instantly, but upon making a selection, there is a 1-2 second lag. I’m curious why that might be and what I can do about it. I would have expected the loading to take time, but the selection to be instant because theres no iteration going on. Posting the code below.

class CanopyCategorySelectCommand(sublime_plugin.TextCommand):
  def run(self, edit):
    selected_index = CanopyParseData.categories_by_index[CanopyInterfaceManager.get_cursor_position()
      ]['index']

    CanopyInterfaceManager.create_quick_panel(
      self.generate_display_list(CanopyParseData.categories),
      self.on_done,
      selected_index=selected_index
    )

  def on_done(self, selection_index):
    if selection_index > -1:
      category = CanopyParseData.categories[selection_index]
      CanopyInterfaceManager.set_cursor_position(category['start'])

  def generate_display_list(self, categories):
    return [category['name'] for category in categories]
0 Likes

#2

Package Control creates quick panels with about 5000 items - not causing any delays.

Maybe caused by any plugin activity triggered by change selections?

0 Likes

#3

Interesting, that could be. I will look into it. Thanks!

0 Likes

#5

You were right, I had an on activation handler and didn’t realize that quick panel reactivated the window after selection. Thanks!

0 Likes