RRethy / vim-illuminate

illuminate.vim - (Neo)Vim plugin for automatically highlighting other uses of the word under the cursor using either LSP, Tree-sitter, or regex matching.
2.12k stars 44 forks source link

bad argument #1 to 'ipairs' (table expected, got nil)" #156

Closed fgheng closed 1 year ago

fgheng commented 1 year ago

Describe the bug Sometimes an error was occured

ERROR vim-illuminate: An internal error has occured: false"...share/nvim/lazy/vim-illuminate/lua/illuminate/engine.lua:176: bad argument #1 to 'ipairs' (table expected, got nil)"

I don't know how to use the common method to reproduce. I can only reproduce it on my environment. But I think the below code will solve this problem

image

To Reproduce Steps to reproduce the behavior (include minimal init.vim or .vimrc):

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Note Omitting a minimal init.vim/init.lua/.vimrc will likely result in the issue being closed without explanation.

Output from :IlluminateDebug

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Additional context Add any other context about the problem here.

RRethy commented 1 year ago

Please fill in the issue template or the issue will be closed. I'm not going to add random null checks everywhere without understanding first why a function that should never return nil is returning nil.