-
Notifications
You must be signed in to change notification settings - Fork 18
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
Remove redundant settings for transient menu #13
Comments
Although the current transient can be redundant than needed, it is explicit to handle two cases.
The proposed solutions you shown above will only solve the first case where the entering key is also executing the same command the same key inside of the transient. Also, not to mentioned that implementation the proposed solutions will make overrides more complicated (introduction of implicit keys inside of the transient menu and json key "keys" collision with the overrides) I would love to explore a solution that can solve this that's not overtly complicated just to remove verbosity. |
We could define a "whichkey.bindingsGroup" in the package.json file where we put reusable bindings sub menus. {
"whichkey.bindingsGroup": {
"type": "array",
"markdownDescription": "Reusable bindings of the which key menu",
"default": [
{
"id": "moveLines",
"bindings": [
{
"key": "j",
"name": "Move lines down",
"type": "command",
"command": "editor.action.moveLinesDownAction"
},
{
"key": "k",
"name": "Move lines up",
"type": "command",
"command": "editor.action.moveLinesUpAction"
}
]
}
]
},
"whichkey.bindings": {
"type": "array",
"markdownDescription": "The bindings of the which key menu",
"default": [
{
"key": "j",
"name": "Move lines down",
"type": "transient",
"command": "editor.action.moveLinesDownAction",
"bindings": "moveLines"
},
{
"key": "k",
"name": "Move lines up",
"type": "transient",
"command": "editor.action.moveLinesUpAction",
"bindings": "moveLines"
}
]
}
} This will work in other use cases, too. For instance, you will be able to create aliases ( |
This is another interesting proposal. I like the id reference system; however, it also means commands.executeCommand("whichkey.register", {
bindings: ["myExtension", "bindings"],
overrides: ["myExtension", "bindingOveArrides"],
groups: ["myExtension", "bindingGroups"],
title: "My menu"
}); And for the show directly option, we will not able to handle if the bindings contains any ids (Probably be fine, as long as we documented it well?). In this proposed solutions, the overrides will be simpler to manage and potentially can use the grouping to break off parts of the binding not just transient into its own "group/reference". In a sense, that reminds me of #9 where it was proposed to read the config from a file, and potentially break off parts of the config into its own file. (maybe we should also think what might affect #9, and vice versa) Interestingly, both approaches have its own pros and cons. I like the id approach a little more because it works well-ish with the existing system. I am still not entirely convinced that the added complexity is worth it in order to remove some verbosities of a handful of redundant transient at least atm. Also, adding more complexity to the existing config would force us to figure out the a strategy for unit testing sooner. However, I would say other enhancements like conditional would have a higher priority in terms getting implemented. |
Maybe in this issue we can decide the syntax and the approach. If the "conditional" feature is independent from this one, maybe someone else could work on this. Otherwise we could simply leave the issue pending until "conditional" is implemented. |
It's probably good to keep discussing syntax here. Out of all the the proposals, they all add complexity into the current system. The original proposals are somewhat with a smaller scope, and have impact on the overrides system. The id system is nice, but requires a lot of rework and needs to handle recursion of id, and is more complex than the original proposal. Right now, I am putting on my KISS hat to keep the redundancy and verbosity for now. Hope we can figure out some less complex solution to this redundancy issue. |
Released |
Often you wanna use the keys of a transient menu also as it's starting-point.
But at the moment this means you need to duplicate the menu for every used key.
Example of how it is now:
A better solution would be to have a "headless" transient, which automatically takes it's startingkeys from the menu itself.
Or define a number of keys from which it will take the commands to the upper level,
while it leaves the remaining commands for the transient menu.
The text was updated successfully, but these errors were encountered: