Giter Club home page Giter Club logo

Comments (6)

stevenguh avatar stevenguh commented on July 22, 2024 1

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.

stevenguh avatar stevenguh commented on July 22, 2024

Although the current transient can be redundant than needed, it is explicit to handle two cases.

  1. Execute a command before entering the menu (e.g. the move line you mentioned above)
  2. 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.

MarcoIeni avatar MarcoIeni commented on July 22, 2024

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.

MarcoIeni avatar MarcoIeni commented on July 22, 2024

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.

stevenguh avatar stevenguh commented on July 22, 2024

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.

stevenguh avatar stevenguh commented on July 22, 2024

Released v0.9.0 finally! Closing this :)

from vscode-which-key.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.