atom / command-palette

Command Palette in Atom
MIT License
116 stars 56 forks source link

add option to hide namespaces #90

Closed despairblue closed 6 years ago

despairblue commented 7 years ago

Description of the Change

This adds a new configuration that takes a comma separated list of namespaces that should be hidden from the palette. A namespace is what comes before the first colon in a command name. If set this.commandsForActiveElement is filtered from commands that match any of those namespaces before this.panel.show is called.

Alternate Designs

  1. If there is a way to quickly find out from which package a command is coming from that would probably be a preferable solution.
  2. When registering a command a flag could be given that would hide that command from the palette.
  3. Only render the first x results.

I assume that 1. and 2. need changes to atom's core and how commands are handled. Also I'm not sure about 2. since that takes away control from the user. 3. is tackling this from a different angle but defaulting to a small x may confuse users that do try to go through the list.

Benefits

This helps to reduce the amount of entries rendered to the palette. Some packages register a lot of commands that are only supposed to be used via shortcuts (like character-table or vim-mode-plus).

In my case I can cut the rendered elements almost in half by hiding everything from vim-mode-plus: 424 (vmp) / 1050 (total).

Possible Drawbacks

Prefixing commands with the package name seems more of a convention. So this only works if the package one's trying to hide the commands from adheres to this convention. That's also why I chose to use the word namespace instead of package, to make a distinction there, so no one assumes this work on a package level.

Applicable Issues

35, #80, #81

despairblue commented 7 years ago

I amended the commit, I messed a bit up while selectively committing lines. Now it should be fine.

rsese commented 6 years ago

Hey @despairblue - I asked the team to take a look at this and related issues/PRs and while the general idea is good, the decision was to pursue the approach in https://github.com/atom/command-palette/pull/92. Thanks very much for this and your many other contributions in issues and PRs :bow: