nvim-lua / diagnostic-nvim

A wrapper for neovim built in LSP diagnosis config
Apache License 2.0
219 stars 15 forks source link

Error executing vim.schedule lua callback diagnostic/util.lua:149 Index out of bounds #36

Closed ahmedelgabri closed 4 years ago

ahmedelgabri commented 4 years ago

I keep getting this error especially when I open a .lua file

So this is my setup (and also if I open the file I get these errors) https://github.com/ahmedelgabri/dotfiles/blob/26f32ba6aae362a20095523b180f5f06d74f5bcb/roles/vim/files/.vim/lua/lsp.lua

And the error seems to be coming from this line https://github.com/nvim-lua/diagnostic-nvim/blob/bdef92a8d434329c47077e12373f2f62e82c70cf/lua/diagnostic/util.lua#L149

Error executing vim.schedule lua callback: ...ack/minpac/start/diagnostic-nvim/lua/diagnostic/util.lua:149: Index out of bounds
Error executing vim.schedule lua callback: ...ack/minpac/start/diagnostic-nvim/lua/diagnostic/util.lua:149: Index out of bounds
Error executing vim.schedule lua callback: ...ack/minpac/start/diagnostic-nvim/lua/diagnostic/util.lua:149: Index out of bounds

Here is a recording of the issue, I only opened the file and moved the cursor up/down.

asciicast

gavares commented 4 years ago

I'm seeing the same issue while editing .scala files using nvim-lsp. The errors seem to happen very frequently when trying to create new functions or classes.

Iron-E commented 4 years ago

If you use vim-sandwich, it will happen every time you use one of the sr (surround replace) mappings. It doesn't happen when using sa (surround add) or sd (surround delete). If I have some time later today I might try to look at the differences between these.

gavares commented 4 years ago

A bit more info if this is helpful:

nvim --version

NVIM v0.5.0-583-g7b529e791
Build type: Release
LuaJIT 2.1.0-beta3
Compilation: /Applications/Xcode-10.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -O2 -DNDEBUG -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/Users/travis/build/neovim/bot-ci/build/neovim/build/config -I/Users/travis/build/neovim/bot-ci/build/neovim/src -I/Users/travis/build/neovim/bot-ci/build/neovim/.deps/usr/include -I/usr/include -I/usr/local/opt/gettext/include -I/Users/travis/build/neovim/bot-ci/build/neovim/build/src/nvim/auto -I/Users/travis/build/neovim/bot-ci/build/neovim/build/include
Compiled by travis@Traviss-Mac-6.local

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/share/nvim"

Run :checkhealth for more info

PlugSnapshot output:

" Generated by vim-plug
" Sat Jul  4 10:36:03 2020
" :source this file in vim to restore the snapshot
" or execute: vim -S snapshot.vim

silent! let g:plugs['ayu-vim'].commit = '0745635'
silent! let g:plugs['completion-nvim'].commit = '81ec73b'
silent! let g:plugs['diagnostic-nvim'].commit = 'bdef92a'
silent! let g:plugs['echodoc.vim'].commit = '4719626'
silent! let g:plugs['falcon'].commit = 'da34685'
silent! let g:plugs['fzf.vim'].commit = '2bf85d2'
silent! let g:plugs['gruvbox'].commit = 'bf2885a'
silent! let g:plugs['nerdcommenter'].commit = 'fade3d4'
silent! let g:plugs['nerdtree'].commit = '6571452'
silent! let g:plugs['nvim-lsp'].commit = '8defde9'
silent! let g:plugs['nvim-metals'].commit = '1138826'
silent! let g:plugs['oceanic-next'].commit = '08158ee'
silent! let g:plugs['vim-airline'].commit = 'ba9b3e1'
silent! let g:plugs['vim-airline-themes'].commit = '04fa4fc'
silent! let g:plugs['vim-better-whitespace'].commit = '8cf4b21'
silent! let g:plugs['vim-devicons'].commit = '1ac5894'
silent! let g:plugs['vim-easymotion'].commit = 'dd7b4b5'
silent! let g:plugs['vim-elixir'].commit = '53c530f'
silent! let g:plugs['vim-fugitive'].commit = '1da7c13'
silent! let g:plugs['vim-nerdtree-syntax-highlight'].commit = 'c838988'
silent! let g:plugs['vim-polyglot'].commit = 'd09a56a'
silent! let g:plugs['vim-signify'].commit = 'c3d450e'
silent! let g:plugs['vim-solarized8'].commit = '5df7666'
silent! let g:plugs['vim-tmux-navigator'].commit = '44ba6fb'
Iron-E commented 4 years ago

I created a PR that should fix this. Can you try it out and verify?


Hmm… one thing I am noticing is that g:diagnostic_enable_virtual_text isn't doing anything for me right now (no virtual text is shown, only things in the sign column. Is this happening for you too?


Seems to be happening only on certain language servers. sumneko_lua and bashls are two of them, but interestingly enough omnisharp and gopls work but the diagnostics stay on screen after they should disappear.

haorenW1025 commented 4 years ago

For the virtaul text issue you can open another issue for it.