deoplete-plugins / deoplete-lsp

LSP Completion source for deoplete

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[deoplete] Too many errors from "lsp". This source is disabled until Neovim is restarted

Jab2870 opened this issue · comments

Hi,

I recently upgraded neovim to the latest master and the LSP completion has stopped working. This is the output if I type :messages

[deoplete] Traceback (most recent call last):
  File "/home/jonathan/.dotfiles/nvim/.config/nvim/pack/bundle/opt/deoplete.nvim/rplugin/python3/deoplete/child.py", line 194, in _gather_results
    result = self._get_result(context, source)
  File "/home/jonathan/.dotfiles/nvim/.config/nvim/pack/bundle/opt/deoplete.nvim/rplugin/python3/deoplete/child.py", line 254, in _get_result
    ctx['candidates'] = source.gather_candidates(ctx)
  File "/home/jonathan/.config/nvim/pack/bundle/opt/deoplete-lsp/rplugin/python3/deoplete/source/lsp.py", line 75, in gather_candidates
    self.vim.call(
  File "/usr/lib/python3.8/site-packages/pynvim/api/nvim.py", line 299, in call
    return self.request('nvim_call_function', name, args, **kwargs)
  File "/usr/lib/python3.8/site-packages/pynvim/api/nvim.py", line 182, in request
    res = self._session.request(name, *args, **kwargs)
  File "/usr/lib/python3.8/site-packages/pynvim/msgpack_rpc/session.py", line 102, in request
    raise self.error_wrapper(err)
pynvim.api.common.NvimError: Vim:E5108: Error executing lua shared.lua:199: Expected table, got number
Error from lsp: Vim:E5108: Error executing lua shared.lua:199: Expected table, got number.  Use :messages / see above for error details.
[deoplete] Traceback (most recent call last):
  File "/home/jonathan/.dotfiles/nvim/.config/nvim/pack/bundle/opt/deoplete.nvim/rplugin/python3/deoplete/child.py", line 194, in _gather_results
    result = self._get_result(context, source)
  File "/home/jonathan/.dotfiles/nvim/.config/nvim/pack/bundle/opt/deoplete.nvim/rplugin/python3/deoplete/child.py", line 254, in _get_result
    ctx['candidates'] = source.gather_candidates(ctx)
  File "/home/jonathan/.config/nvim/pack/bundle/opt/deoplete-lsp/rplugin/python3/deoplete/source/lsp.py", line 75, in gather_candidates
    self.vim.call(
  File "/usr/lib/python3.8/site-packages/pynvim/api/nvim.py", line 299, in call
    return self.request('nvim_call_function', name, args, **kwargs)
  File "/usr/lib/python3.8/site-packages/pynvim/api/nvim.py", line 182, in request
    res = self._session.request(name, *args, **kwargs)
  File "/usr/lib/python3.8/site-packages/pynvim/msgpack_rpc/session.py", line 102, in request
    raise self.error_wrapper(err)
pynvim.api.common.NvimError: Vim:E5108: Error executing lua shared.lua:199: Expected table, got number
Error from lsp: Vim:E5108: Error executing lua shared.lua:199: Expected table, got number.  Use :messages / see above for error details.
[deoplete] Too many errors from "lsp". This source is disabled until Neovim is restarted.
:version
NVIM v0.5.0-782-gb6897ebc0
Build type: RelWithDebInfo
LuaJIT 2.0.5
Compilation: /usr/bin/cc -D_FORTIFY_SOURCE=2 -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -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 -Wimplic
it-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/home/jonathan/.cache/yay/neovim-git/src/build/config -I/home/jonathan
/.cache/yay/neovim-git/src/neovim-git/src -I/usr/include -I/home/jonathan/.cache/yay/neovim-git/src/build/src/nvim/auto -I/home/jonathan/.cache/yay/neovim-git/src/build/include
Compiled by jonathan@jonathanhodgson-laptop

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

If there is anything else I can provide to help diagnose the issue, let me know

The specification is changed.

Too bad.

It works for me. I have tested the latest version.

Please upload the minimal vimrc and the reproduce instructions.
If not, I will close the issue.

スクリーンショット_2020-10-28_08-13-32

スクリーンショット_2020-10-28_08-14-06

Thanks for replying. Here is a minimal init.vim that still produces the error

if has('packages')
	packadd! deoplete.nvim
	packadd! deoplete-lsp
endif
let g:deoplete#enable_at_startup = 1

???

Why don't you configure LSP?
This is the real minimal vimrc.

set rtp+=~/work/deoplete.nvim/
set rtp+=~/work/nvim-yarp
set rtp+=~/work/vim-hug-neovim-rpc
set rtp+=~/src/deoplete-lsp
set rtp+=~/src/nvim-lsp
let g:deoplete#enable_at_startup = 1

set completeopt+=noinsert

call deoplete#custom#option('sources', {
    \ 'css': ['buffer', 'lsp'],
    \ 'html': ['buffer', 'file', 'lsp'],
    \ 'javascript': ['buffer', 'lsp'],
    \ 'javascript.jsx': ['buffer', 'lsp'],
    \ 'scala': ['buffer', 'lsp'],
    \ 'typescript': ['buffer', 'lsp'],
    \ 'typescript.tsx': ['buffer', 'lsp'],
    \ 'rust': ['buffer', 'lsp'],
    \ 'python': ['buffer', 'lsp'],
    \})
call deoplete#custom#source('_', 'converters', [
    \ 'converter_remove_paren',
    \ 'converter_remove_overlap',
    \ 'converter_truncate_abbr',
    \ 'converter_truncate_info',
    \ 'converter_truncate_menu',
    \ 'converter_auto_delimiter'
    \])
call deoplete#custom#source('lsp', 'converters', ['converter_reorder_attr'])
call deoplete#custom#filter('converter_reorder_attr', 'attrs_order', {
    \ 'rust': {
    \    'kind': [
    \      '!Snippet'
    \    ]
    \ }
    \})

call deoplete#enable()

lua <<EOF
local nvim_lsp = require'nvim_lsp'
nvim_lsp.rust_analyzer.setup{}
EOF

Here is a minimal init.vim that still produces the error

Why don't you upload the reproduce instructions? Please describe it.

  1. Open nvim
  2. Enter insert mode
  3. Start typing
  4. See the error

Why don't you configure LSP?

I thought the point of a minimal config is that it shouldn't contain more than the essentials to reproduce the error?

if has('packages')
	packadd! nvim-lspconfig
	packadd! deoplete.nvim
	packadd! deoplete-lsp
endif
let g:deoplete#enable_at_startup = 1

lua <<EOF
	-- Bash Language Server
	require'nvim_lsp'.bashls.setup{}
	-- Clang Language Server
	require'nvim_lsp'.clangd.setup{}
	-- Go Language Server
	require'nvim_lsp'.gopls.setup{}
	-- Python Language Server
	require'nvim_lsp'.pyls.setup{}
	-- Vim Language Server
	require'nvim_lsp'.vimls.setup{}
	-- VUE Language Server
	require'nvim_lsp'.vuels.setup{}
EOF
function! s:ConfigureBuffer()
	nnoremap <buffer> <silent> <c-]> <cmd>lua vim.lsp.buf.definition()<CR>
	nnoremap <buffer> <silent> <Leader>ld <cmd>lua vim.lsp.util.show_line_diagnostics()<CR>
	nnoremap <buffer> <silent> K <cmd>lua vim.lsp.buf.hover()<CR>
	nnoremap <buffer> <silent> gd <cmd>lua vim.lsp.buf.declaration()<CR>
endfunction
if has('autocmd')
	augroup JHLanguageClientAutocmds
		autocmd!
		autocmd FileType bash,c,go,python,vim,vue  call s:ConfigureBuffer()
	augroup END
endif

vimrc:

set runtimepath+=/path/to/deoplete.nvim
set runtimepath+=/path/to/deoplete-lsp
let g:deoplete#enable_at_startup = v:true

I bisected and neovim/neovim@6312792 (neovim/neovim#12764) is the first bad commit.

BTW, this repo doesn't have ISSUE_TEMPLATE.

This seems to happen only when a filetype has no LSP support.

I think #38 will fix this issue.

Thanks. I get it.

My minimum vimrc (thanks @e-kwsm

if has('vim_starting')
  set encoding=utf-8
endif
scriptencoding utf-8

if &compatible
  " vint: -ProhibitSetNoCompatible
  set nocompatible
endif

if !isdirectory(expand('/tmp/plugged/vim-plug'))
  silent !curl -fLo /tmp/plugged/vim-plug/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
end
execute printf('source %s', expand('/tmp/plugged/vim-plug/plug.vim'))

call plug#begin('/tmp/plugged')
Plug 'neovim/nvim-lspconfig'
Plug 'Shougo/deoplete.nvim'
Plug 'Shougo/deoplete-lsp'
call plug#end()

let g:deoplete#enable_at_startup = 1

lua <<EOF
	-- Bash Language Server
	require'nvim_lsp'.bashls.setup{}
	-- Clang Language Server
	require'nvim_lsp'.clangd.setup{}
	-- Go Language Server
	require'nvim_lsp'.gopls.setup{}
	-- Python Language Server
	require'nvim_lsp'.pyls.setup{}
	-- Vim Language Server
	require'nvim_lsp'.vimls.setup{}
	-- VUE Language Server
	require'nvim_lsp'.vuels.setup{}
EOF
function! s:ConfigureBuffer()
	nnoremap <buffer> <silent> <c-]> <cmd>lua vim.lsp.buf.definition()<CR>
	nnoremap <buffer> <silent> <Leader>ld <cmd>lua vim.lsp.util.show_line_diagnostics()<CR>
	nnoremap <buffer> <silent> K <cmd>lua vim.lsp.buf.hover()<CR>
	nnoremap <buffer> <silent> gd <cmd>lua vim.lsp.buf.declaration()<CR>
endfunction
if has('autocmd')
	augroup JHLanguageClientAutocmds
		autocmd!
		autocmd FileType bash,c,go,python,vim,vue  call s:ConfigureBuffer()
	augroup END
endif

Works after the PR is merged.

BTW, this repo doesn't have ISSUE_TEMPLATE.

I have added the issue template.

I'm having the same problem.

NVIM v0.6.0
Build type: Release
LuaJIT 2.1.0-beta3
Features: +acl +iconv +tui

It only happens if I start editing before the LSP attaches (which can take a while on a big project). If I wait for the indicator I use in my on_attach callback, there's no errors.

Fixed. Please use the latest.