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: Freeze / Infinite Recursion when trying to show keymaps #714

Closed
4 tasks done
yavorski opened this issue Jul 15, 2024 · 5 comments · Fixed by #713
Closed
4 tasks done

bug: Freeze / Infinite Recursion when trying to show keymaps #714

yavorski opened this issue Jul 15, 2024 · 5 comments · Fixed by #713
Labels
bug Something isn't working

Comments

@yavorski
Copy link

Did you check docs and existing issues?

  • I have read all the which-key.nvim docs
  • I have updated the plugin to the latest version before submitting this issue
  • I have searched the existing issues of which-key.nvim
  • I have searched the existing issues of plugins related to this issue

Neovim version (nvim -v)

0.10

Operating system/version

Arch Linux

Describe the bug

Neovim freezes when trying to show s keymaps. I am trying to show mini.surround keymaps, as discussed in several other issues.

Steps To Reproduce

Please see minimal repro.lua and just press s key in normal mode.
I run it with nvim -u repro.lua

Expected Behavior

To not freeze, expand and show keymaps.

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
- WARNING |nvim-web-devicons| is not installed
- WARNING Keymap icon support will be limited.

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

Log too long ... trimmed it to 512k -> https://pastebin.com/raw/LQJR2SWz

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",
      event = "VeryLazy",
      config = function()
        local wk = require("which-key")
        wk.setup({ debug = true })
        vim.keymap.set({ "n", "x" }, "s", "<Nop>")
        vim.keymap.set("n", "s", function() wk.show({ keys = "s", mode = "n" }) end, { desc = "Show s keymaps" })
      end
    }
  }
})
@yavorski yavorski added the bug Something isn't working label Jul 15, 2024
@folke
Copy link
Owner

folke commented Jul 15, 2024

I mean, what do you expect?
You're literally mapping s and ask which-key to show the results for s

@folke folke closed this as not planned Won't fix, can't repro, duplicate, stale Jul 15, 2024
@folke
Copy link
Owner

folke commented Jul 15, 2024

You can achieve what you want by adding waited = vim.o.timeoutlen to the show options

@folke
Copy link
Owner

folke commented Jul 15, 2024

ok, I'll change it so that this is always set when using the API...

folke added a commit that referenced this issue Jul 15, 2024
…and not the actual mapping in case of overlap. Fixes #714
@yavorski
Copy link
Author

I mean, what do you expect? You're literally mapping s and ask which-key to show the results for s

Yeah that sounds about right.

You can achieve what you want by adding waited = vim.o.timeoutlen to the show options

This works yes, Thank you!

@folke
Copy link
Owner

folke commented Jul 15, 2024

I updated the defaults for the API, so should work without explicitely setting that option

folke pushed a commit that referenced this issue Jul 15, 2024
🤖 I have created a release *beep* *boop*
---


##
[3.5.0](v3.4.0...v3.5.0)
(2024-07-15)


### Features

* **api:** using wk.show() always assumes you want to see the group, and
not the actual mapping in case of overlap. Fixes
[#714](#714)
([f5067d2](f5067d2))


### Bug Fixes

* **state:** attach on BufNew as well. Fixes
[#681](#681)
([0f58176](0f58176))
* **state:** make sure mode always exists even when not safe. See
[#681](#681)
([7915964](7915964))


### Performance Improvements

* **plugin:** only expand plugins when needed
([1fcfc72](1fcfc72))
* **view:** set buf/win opts with eventignore
([e81e55b](e81e55b))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants