Skip to content
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

Bug: Weight not being respected #19

Open
dwoznicki opened this issue Feb 20, 2025 · 1 comment
Open

Bug: Weight not being respected #19

dwoznicki opened this issue Feb 20, 2025 · 1 comment

Comments

@dwoznicki
Copy link

Or maybe I'm not using it correctly.

Expected behavior

Commands with a lower weight value should appear below commands with a higher weight value.

Actual behavior

The ordering appears to be not entirely consistent. Here's my setup.

require("toolbox").setup({
  commands = {
    {
      name = "Copy pytest path to clipboard",
      weight = 10, -- prefer this one first
      execute = function()
        -- ...
      end
    },
    {
      name = "Format JSON block",
      weight = -20,
      execute = function()
        -- ...
      end,
    },
    {
      name = "Format text block with newlines",
      weight = -30,
      execute = function()
        -- ...
      end,
    },
  },
})

I've noticed that sometimes the commands are out of order.

Image
@DanWlker
Copy link
Owner

Thanks for the report, I'll take a look over the weekend

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants