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]: which_key config issue - attempt to index field 'which_key' (a nil value) #404

Closed
1 task done
astutecat opened this issue Oct 11, 2023 · 3 comments · Fixed by #405
Closed
1 task done

[Bug]: which_key config issue - attempt to index field 'which_key' (a nil value) #404

astutecat opened this issue Oct 11, 2023 · 3 comments · Fixed by #405
Assignees
Labels
bug Something isn't working

Comments

@astutecat
Copy link

astutecat commented Oct 11, 2023

Similar Issues

  • Before filing, I have searched for similar issues.

Neovim Version

Build type: Release
LuaJIT 2.1.1692716794

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/__w/neovim/neovim/build/nvim.AppDir/usr/share/nvim"

Run :checkhealth for more info```

### Steps to Reproduce

1. Follow warning on startup and move config to `config.extensions.which_key` from `config.which_key`.
2. Restart nvim

### Expected Behavior

No error on startup.

### Actual Behavior

I am getting the following error on startup:

Error detected while processing VimEnter Autocommands for "*":
E5108: Error executing lua ...vim/lazy/legendary.nvim/lua/legendary/util/which_key.lua:37: attempt to index field 'whic
h_key' (a nil value)
stack traceback:
...vim/lazy/legendary.nvim/lua/legendary/util/which_key.lua:37: in function 'wk_to_legendary'
...vim/lazy/legendary.nvim/lua/legendary/util/which_key.lua:89: in function <...vim/lazy/legendary.nvim/lua/leg
endary/util/which_key.lua:87>
vim/shared.lua: in function 'tbl_map'
...vim/lazy/legendary.nvim/lua/legendary/util/which_key.lua:87: in function 'parse_whichkey'
...vim/lazy/legendary.nvim/lua/legendary/util/which_key.lua:108: in function 'bind_whichkey'
...zy/legendary.nvim/lua/legendary/extensions/which_key.lua:31: in function 'register'
...zy/which-key.nvim/lua/which-key/plugins/presets/misc.lua:90: in function 'setup'
...zy/which-key.nvim/lua/which-key/plugins/presets/init.lua:86: in function 'setup'
.../nvim/lazy/which-key.nvim/lua/which-key/plugins/init.lua:37: in function '_setup'
.../nvim/lazy/which-key.nvim/lua/which-key/plugins/init.lua:19: in function 'setup'
...al/share/nvim/lazy/which-key.nvim/lua/which-key/init.lua:85: in function 'load'
[string ":lua"]:1: in main chunk
Press ENTER or type command to continue


Looks like the `which_key.lua` in `util` is still referring to the old config?

### Minimal Configuration to Reproduce

```lua
local root = vim.fn.fnamemodify('./.repro', ':p')

-- set stdpaths to use .repro
for _, name in ipairs({ 'config', 'data', 'state', 'cache' }) do
  vim.env[('XDG_%s_HOME'):format(name:upper())] = root .. '/' .. name
end

-- bootstrap lazy
local lazypath = root .. '/plugins/lazy.nvim'
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({
    'git',
    'clone',
    '--filter=blob:none',
    '--single-branch',
    'https://github.com/folke/lazy.nvim.git',
    lazypath,
  })
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
  -- do not remove the colorscheme! it makes testing nicer
  'folke/tokyonight.nvim',
  {
    'mrjones2014/legendary.nvim',
    dependencies = {
      -- place your `vim.ui.select()` handler plugin here
      -- for example:
      -- 'nvim-telescope/telescope.nvim',
      -- 'stevearc/dressing.nvim',
    },
  },
  -- add any other pugins here
}

require('lazy').setup(plugins, {
  root = root .. '/plugins',
})

require('dressing').setup()

require('legendary').setup({
  -- add any options here
})

-- add anything else here
vim.opt.termguicolors = true
-- do not remove the colorscheme! it makes testing nicer
vim.cmd([[colorscheme tokyonight]])

Output from :LegendaryLog

:LegendaryLog output (click to expand)
[Wed 11 Oct 2023 10:08:24 AM CEST][legendary.nvim] Preparing to register items from which-key.nvim automatically
[Wed 11 Oct 2023 10:08:24 AM CEST][legendary.nvim] setup() parsed and applied all configuration.

Additional Details and/or Screenshots

No response

@astutecat astutecat added the bug Something isn't working label Oct 11, 2023
@astutecat astutecat changed the title [Bug]: [Bug]: which_key config issue - attempt to index field 'which_key' (a nil value) Oct 11, 2023
@mrjones2014
Copy link
Owner

Whoops, sorry about that. Thanks for testing new versions early! Does #405 fix it for you?

@mrjones2014
Copy link
Owner

Should be fixed in v2.13.3

@astutecat
Copy link
Author

Whoops, sorry about that. Thanks for testing new versions early! Does #405 fix it for you?

yep, it works now :)

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