Sublime Forum

Enhancement to the QuickPanel API

#1

Just had a great idea for the quickpanel that I see fitting in quite nicely. Could you add an optional parameter to show_quick_panel for some placeholder text? It’s something small, but I use the quickpanel as a key part of my new plugin and wanted some way to add instructions. Here’s a quick mockup:

0 Likes

#2

Your screenshot makes it look you’re presenting the command palette, not a quick panel. If that’s what you meant, the API allows for this: self.window.run_command('show_overlay', {"overlay": "command_palette", "text": "Your text here..." })

0 Likes

#3

@itaiferber: that is a default text. What COD312 wants is a placeholder. A text that will appear when the field is empty and you don’t have to delete it’s content before to start typing.

0 Likes

#4

Yipes, you’re right — I misread. Thanks, iamntz.

0 Likes

#5

good luck

0 Likes

#6

Disregarding the sarcasm and condescension, thanks!

0 Likes

#7

On the topic of QuickPanel improvements, I would love to be able to pre-select a particular item in the quick panel without filtering the results. The user would have the option of choosing that suggestion or filtering or traversing for an alternative option.

This functionality already exists for “Switch Project” and the “Goto Symbol” QuickPanel lists, but is not available in the API. In these cases, an unfiltered list is shown and a specific item is pre-selected and scrolled to (and it is normally not the first item).

0 Likes

#8

It’s already there but not referenced in the doc.
There is a 4th argument to indicate the default item index:

show_quick_panel(items, on_done, <flags>, <default_index>)
0 Likes

#9

[quote=“bizoo”]It’s already there but not referenced in the doc.
There is a 4th argument to indicate the default item index:

show_quick_panel(items, on_done, <flags>, <default_index>)

Thanks bizoo!! Very cool :smile:

0 Likes