ShinKage / idris2-nvim

Simple configuration and extra tools for NVIM + LSP + Idris2
MIT License
46 stars 7 forks source link

Error when executing `metavars.request_all` #6

Closed phijor closed 2 years ago

phijor commented 2 years ago

What

When executing :lua require("idris2.metavars").request_all(), the following error appears:

Error executing vim.schedule lua callback: vim/shared.lua:0: Expected table, got nil
stack traceback:
        [C]: in function 'assert'
        vim/shared.lua: in function 'tbl_isempty'
        ...te/pack/packer/start/idris2-nvim/lua/idris2/metavars.lua:77: in function 'handler'
        /usr/share/nvim/runtime/lua/vim/lsp.lua:995: in function ''
        vim.lua: in function <vim.lua:0>

Why?

I think this is a bug in this check:

https://github.com/ShinKage/idris2-nvim/blob/be1cd749df1da85834eab51ed6df59b4b1a62a33/lua/idris2/metavars.lua#L76-L77

The argument result might be nil (see :help lsp-handler), so the call to tbl_isempty fails.

Installed software

Neovim:

$ nvim --version
NVIM v0.7.0-dev+848-gb4fbb9dcf2
Build type: RelWithDebInfo
LuaJIT 2.0.5
Compilation: /usr/bin/cc -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -DNVIM_TS_HAS_SET_MATCH_LIMIT -O2 -g -Og -g -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/build/neovim-git/src/build/config -I/build/neovim-git/src/neovim-git/src -I/usr/include -I/build/neovim-git/src/build/src/nvim/auto -I/build/neovim-git/src/build/include
Compiled by builduser

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

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

Run :checkhealth for more info