VSpaceCode / vscode-which-key

which-key like menu for Visual Studio Code
https://vspacecode.github.io/docs/whichkey
MIT License
166 stars 18 forks source link

Option to selectively hide items from menu? #51

Closed yhshin11 closed 2 years ago

yhshin11 commented 3 years ago

Problem

The neovim which-key plugin allows the user to hide active mappings in the which-key popup by providing a flag when creating the mapping. The idea is that you don't want to see hints for mappings that you've used a million times before. So you can choose to hide these specific mappings from the menu, and only get hints for infrequent mappings.

I don't see a way to do this currently in vscode-which-key. I think this could be a useful addition.

Solution

An optional flag in bindingOverrides to hide the mapping from menu, e.g.

    "vspacecode.bindingOverrides": [
        {
            "keys": "\t",
            "name": "",
            "hide": true,
            "icon": "",
            "type": "commands",
            "commands": [
                "workbench.action.quickOpenPreviousRecentlyUsedEditorInGroup",
                "list.select"
            ]
        },
    ],

Alternatives

An alternative is to provide an optional flag to set the sort priority, in order to allow user to fully specify the order that mappings appear in the menu. This seems more involved and I'm not sure is quite necessary.

MarcoIeni commented 3 years ago

The "hide" option seems nice. The "sort priority" one seems a little bit more complicated, I agree with you. I don't think it's necessary.

stevenguh commented 3 years ago

That's interesting. I would suggest the implementation to have a key call display instead of a boolean. e.g. display: "hidden". This might help with the case where we have SPC 0/1/2/3/4/5/6/7/8/9 showing in the menu item.

The ordering is actually possible with possible the position key in override which can control the order (See https://vspacecode.github.io/docs/menu-customization#addreplace). But this would probably change when we change vspacecode to use layers instead (WIP).

stevenguh commented 2 years ago

Implemented in b7296c98f1958956b5f45bc56097da8f5e0f98b5 and released in v0.10.0.