-
Notifications
You must be signed in to change notification settings - Fork 29.4k
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
Allow multiple keybindings to work #134544
Comments
I understand the kind of system you are proposing, but we don't want to build that. This is the reason we have created context keys and dispatch keybindings based on The solution here is for the Custom context keys can be created/updated using |
Thanks for the clear explanation. |
This is not a duplicate of
I'm specifically asking to run multiple commands in sequence.
Unconditionally running multiple commands per keypress is already possible using the geddski.macros extension. Also, implementing this would not necessarily satisfy
#871
since its up to the bound command to decide if execution should continue to other bindings.Problem
Both
yzhang.markdown-all-in-one
andtakumii.markdowntable
define keybindings to overwrite thetab
key. In both cases, the behavior is dependant on the content and the cursor position.The
yzhang.markdown-all-in-one
binding allows for indenting list items. If the cursor is not in a list, a tab character is inserted instead.The
takumii.markdowntable
binding moves the cursor between cells in a formatted table. If the cursor is not in a table, a tab character is inserted instead.Both of these provide a "new" behavior in some cases and falls back to a "default" if the new behaviour is not applicable. The use cases for these two new behaviors are unrelated, but due to the way keybindings work in vscode, they are fully incompatible.
See these issues for more context
New Feature
Keybindings should be able to call a
preventDefault
function (or for compatibility purposes, anallowDefault
orcallNext
function such that if the current keybinding determines it is ineffective control may be handed back to either the next matched keybinding if one (or more) exists or the default behavior.Additionally, some way to order the execution of the bindings would likely be beneficial. This would not require a new GUI either, adding a new property to a keybinding definition
"priority": 1
which can be used to define the execution order. (Though in this case, the order the keybindings are executed would not matter)In this case, the higher priority command
markdown.extension.onTabKey
will execute first, falling back tomarkdowntable.nextCell
, then finally the default action provided by VSCode to insert a tab character (or indentation with spaces).The text was updated successfully, but these errors were encountered: