-
Notifications
You must be signed in to change notification settings - Fork 28.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hide keybinding in cmd pallet when the when clause doesnt apply #27611
Comments
Yes, looks like an issue with the keybindings system. In stable, set cc @sandy081 |
@alexandrudima FYI |
@ramya-rao-a Sorry I didn't understand what is the issue with the keybindings system ? |
The According to this Now, when you bring up this command in the command palette, This is the issue that @Tyriar brought up. Now I get that it might be an overhead to calculate the This issue applies to all commands that are bound to a keybinding with a when clause which has config settings |
@alexandrudima ping cc @rebornix |
My personal take is we should not render key shortcut in this case but still show this command in the list. But I found another interesting behavior. Let's say we are working on a TypeScript file and Emmet should not work in this case. However you can still run Emmet Expand from command palette and it will insert a Tab. My expected result is this command does nothing in this case. (I may be talking about the same thing as #18517 . ) |
Thanks, I understand now your point. The problem is that evaluating e.g. {
"key": "alt+cmd+up",
"command": "editor.action.insertCursorAbove",
"when": "editorTextFocus"
} The command {
"key": "f12",
"command": "editor.action.goToDeclaration",
"when": "editorHasDefinitionProvider && editorTextFocus && !isInEmbeddedEditor"
} Consider having opened two files, one Plain Text, and one which is a TypeScript file, the TypeScript file defines The current presented keybindings are those that are proven to be reachable. Consider the following: e.g.: {
"key": "f12",
"command": "command1",
"when": "editorTextFocus && !isInEmbeddedEditor"
},
{
"key": "f12",
"command": "command2",
"when": "editorTextFocus"
} Only in such cases, where we can statically prove that a keybinding rule is shadowed by another rule, we don't show the keybinding. i.e. in this case, the binding for But in other cases e.g.: {
"key": "f12",
"command": "command1",
"when": "editorTextFocus"
},
{
"key": "f12",
"command": "command2",
"when": "editorTextFocus && b"
} In such cases it is not possible to statically prove that there exists no context where I am open for ideas to how to improve this. |
@alexandrudima No bright ideas from me here :( Closing this issue for now. The concern specifically around Emmet command and tab will be taken care of once we move to new emmet model and tab will no longer be associated with emmet Edit: |
#27316
The command palette says tab:
But pressing tab in this state does nothing:
keybindings.json entry:
Maybe it's an issue with the keybindings system? Why is it saying tab in the command palette when the context is wrong (
emmet.useModules
is true)The text was updated successfully, but these errors were encountered: