folke / which-key.nvim

💥 Create key bindings that stick. WhichKey helps you remember your Neovim keymaps, by showing available keybindings in a popup as you type.
Apache License 2.0
5.12k stars 163 forks source link

bug: keymap description is not being shown #803

Closed 4rtemis-4rrow closed 1 month ago

4rtemis-4rrow commented 1 month ago

Did you check docs and existing issues?

Neovim version (nvim -v)

v0.10.1

Operating system/version

linux, endeavourOS

Describe the bug

some keymap descriptions are being shown properly, some aren't being shown at all, for example, I have the following keymaps for some LSP operations

vim.keymap.set('n', "<leader>ld", function() vim.lsp.buf.definition() end, opts, {desc = 'Go To The Definition'})
vim.keymap.set('n', "<leader>lc", vim.cmd.CodeActionMenu, {desc = 'Suggest Code Fix'})
vim.keymap.set('n', '<leader>lh', function() vim.lsp.buf.hover() end, opts, {desc = 'Show Info'})
vim.keymap.set('n', '<leader>lr', function() vim.lsp.buf.rename() end, opts, {desc = 'Rename'})
vim.keymap.set('n', '<leader>lf', function() vim.lsp.buf.formatting() end, opts, {desc = 'Format'})
vim.keymap.set('n', "<leader>lR", function() require('telescope.builtin').lsp_references() end, opts, {desc="List References"})
vim.keymap.set('n', "<leader>xx", "<cmd> Trouble diagnostics<CR>", {desc = 'Show All LSP Messages'})
vim.keymap.set("n", "<leader>gr", "<cmd> Telescope lsp_references<CR>", {desc = 'Show All References'})

when I press leader l, I am shown the correct keys, but not the description, of those specified keymaps, I am only shown the description for leader lc, the others are just blank

Steps To Reproduce

honestly, no idea, idk how this even happened, all I know is that I'm unable to fix it

Expected Behavior

to display the description properly

Health

which-key: require("which-key.health").check()

- OK Most of these checks are for informational purposes only.
  WARNINGS should be treated as a warning, and don't necessarily indicate a problem with your config.
  Please |DON't| report these warnings as an issue.

Checking your config ~
- WARNING |mini.icons| is not installed
- OK |nvim-web-devicons| is installed

Checking for issues with your mappings ~
- OK No issues reported

checking for overlapping keymaps ~
- WARNING In mode `n`, <gc> overlaps with <gcc>:
  - <gc>: Toggle comment
  - <gcc>: Toggle comment line
- OK Overlapping keymaps are only reported for informational purposes.
  This doesn't necessarily mean there is a problem with your config.

Checking for duplicate mappings ~
- OK No duplicate mappings found

Log

opt.debug. opts.debug, and vim.opt.debug all failed, the first 2 don't exist (?), and the last required a string value, sorry

Repro

vim.env.LAZY_STDPATH = ".repro"
load(vim.fn.system("curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua"))()

require("lazy.minit").repro({
  spec = {
    { "folke/which-key.nvim", opts = {} },
    -- add any other plugins here
  },
})
max397574 commented 1 month ago

well that's because your way of defining keymaps is wrong desc it part of the opts you can't just pass two opts tables to vim.keymap.set

4rtemis-4rrow commented 1 month ago

bruh, then why did it work before?

damn, sorry for this dumb mistake, and thank you

4rtemis-4rrow commented 1 month ago

fixed

max397574 commented 1 month ago

bruh, then why did it work before?

damn, sorry for this dumb mistake, and thank you

I'd say it's impossible that this ever worked except if you only added the opts parameter recently