Comments (6)
This is another interesting proposal. I like the id reference system; however, it also means whichkey.register
will need to add one extra field to point to the "reference" config like
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.
from vscode-which-key.
Although the current transient can be redundant than needed, it is explicit to handle two cases.
- Execute a command before entering the menu (e.g. the move line you mentioned above)
- Just entering the transient menu without command execution (e.g. zoom transient)
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.
from vscode-which-key.
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 (SPC w
and SPC W
could refer to the "window" bindings group for example).
from vscode-which-key.
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.
After, we can open a new issue where we formalize those and we explain which parts of the code have to be edited.
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.
from vscode-which-key.
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.
from vscode-which-key.
Released v0.9.0
finally! Closing this :)
from vscode-which-key.
Related Issues (20)
- Unable to create when condition for pin/unpin editor HOT 4
- Option to selectively hide items from menu? HOT 3
- Support for VSCode Web HOT 3
- Navigate up / back in the menu structure HOT 2
- Show key bindings in menus HOT 3
- Support partial override HOT 1
- triggerKey Not Firing from edamagit HOT 7
- Weird behaviour with Github Pull Request extension HOT 1
- `whichkey.delay` causes a delay in `SPC SPC` shortcut, others seem to be unaffected HOT 6
- Add default binding for `git pull`
- Crash when mixing `key` / `keys` and using `whichkey.sortOrder` HOT 2
- [bug/ feature?]: whichkey.searchBindings should support fuzzy search HOT 2
- [Help Wanted] Show the menu when press g HOT 3
- Debug Transient State gets closed. HOT 4
- Support several menus HOT 4
- Space keybind with vscode-neovim and the Commands option HOT 5
- `bindings` vs `bindingOverrides` and `keys` vs `key` HOT 3
- Ability to specify font for menu "keys" HOT 6
- Typos in commands
- Reliable key sequence handling HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vscode-which-key.