nvim-lua / completion-nvim

A async completion framework aims to provide completion to neovim's built in LSP written in Lua
Apache License 2.0
975 stars 79 forks source link

completion does not work due to hover.lua error #283

Open gohm44 opened 3 years ago

gohm44 commented 3 years ago

init.vim

all plug#begin('~/.vim/plugged')
    Plug 'neovim/nvim-lsp'
    Plug 'nvim-lua/completion-nvim'
call plug#end()
lua require'lspconfig'.sumneko_lua.setup{on_attach=require'completion'.on_attach}
au Filetype lua setl omnifunc=v:lua.vim.lsp.omnifunc
" Use <Tab> and <S-Tab> to navigate through popup menu
inoremap <expr> <Tab>   pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"

" Set completeopt to have a better completion experience
set completeopt=menuone,noinsert,noselect

nvim --version

NVIM v0.5.0-828-g0a95549d6
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/gcc-5 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -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/home/travis/build/neovim/bot-ci/build/neovim/build/config -I/home/travis/build/neovim/bot-ci/build/neovim/src -I/home/travis/build/neovim/bot-ci/build/neovim/.deps/usr/include -I/usr/include -I/home/travis/build/neovim/bot-ci/build/neovim/build/src/nvim/auto -I/home/travis/build/neovim/bot-ci/build/neovim/build/include
Compiled by travis@travis-job-abaca5c2-51e7-4cf1-bc06-8cf3e644ab24

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

How to reproduce run neovim with the given configuration

Description At start nvim throws an error and completion does not work.

Error detected while processing /home/gohm/.config/nvim/init.vim:
line    5:
E5108: Error executing lua ...hm/.vim/plugged/completion-nvim/lua/completion/hover.lua:250: attempt to index field 'handlers' (a nil value)

So I guess the root cause of an issue:

M.default_handler = vim.lsp.handlers[handler]

Remove of this line allows to avoid an error during launch but still, completion does not work.

sl8vz commented 3 years ago

Hi, See #274, the problem is because the nvim nightly with the matching API hasn't been released yet. Temporary workaround is possible.

gil-air-may commented 3 years ago

Same issue here :eyes:

gohm44 commented 3 years ago

As @sl8vz pointed out we need a newer version of neovim. I did install neovim-git via AUR on arch and it resolved the issue.

cyansprite commented 3 years ago

The manual bash script way to install the latest and greatest of Neovim. I know they have a CMakeFile but it didn't work for me so I just did it manually this way, hope that helps.

git clone https://github.com/neovim/neovim.git
cd neovim
mkdir .deps
cd .deps
cmake ../third-party
make
cd ..
mkdir build
cd build
cmake ..
make
sudo make install
cd ../../
rm -rf neovim

You'll probably need these too

sudo apt install gperf luajit luarocks libuv1-dev libluajit-5.1-dev libunibilium-dev libmsgpack-dev libtermkey-dev libvterm-dev libutf8proc-dev