Custom use of the command palette


#1

I was wondering if it was possible to leverage the command palette to have it list a set of command of my choosing rather than the full list?

the idea being my plugin with have its own set of commands that I don’t want muddled in with the rest

Thanks in advance


#2

I’m not sure that it’s neither possible nor desirable from a user POV. If I understand your idea properly, installing your package would make every other commands unavailable from the palette. Quite intrusive, isn’t it?

The command palette already filter the entries as you type, so if you use the package name as prefix it should reduce the suggested commands to the ones of your packages.

Now if you really want to have a command palette specifically for your package you can create your own view based on the original one and binds it to a different keybinding:

https://github.com/atom/command-palette/blob/master/lib/command-palette-view.coffee

The code is quite simple so it shouldn’t be much work to adapt it to your need.


#3

The intention wasn’t to replace or hide the other commands. That would be very intrusive :smile:

The intention was, as you say, to have a command palette specific to the package.

Although in looking around it seems this is against the convention so I might use the prefix idea instead.

Thanks


#4

You could use something like Package Manager, where its toggle command shows a list of configured projects. So, you could show your list of commands.