Shougo / ddc-source-lsp

lsp source for ddc.vim
Other
67 stars 21 forks source link

Error after line break #1

Closed uga-rosa closed 3 years ago

uga-rosa commented 3 years ago

The LSP I used is pyright.

bug

Message: Error executing vim.schedule lua callback: ...epos/github.com/Shougo/ddc-nvim-lsp/lua/ddc_nvim_lsp.lua:5: attempt to index local 'result' (a nil value)

I don't think the mapping to \ has anything to do with it, since the same error occurs when inserting by o.

This is part of my dein_lazy.toml.

~~~
[[plugins]]
repo = 'vim-denops/denops.vim'

[[plugins]]
repo = 'Shougo/ddc-sorter_rank'

[[plugins]]
repo = 'Shougo/ddc-matcher_head'

[[plugins]]
repo = 'Shougo/ddc-around'

[[plugins]]
repo = 'Shougo/ddc-zsh'

[[plugins]]
repo = 'Shougo/ddc-nvim-lsp'

[[plugins]]
repo = 'Shougo/ddc.vim'
on_event = 'InsertEnter'
depends = ['denops.vim', 'ddc-sorter_rank', 'ddc-matcher_head', 'ddc-around', 'ddc-zsh', 'ddc-nvim-lsp']
hook_source = '''
inoremap <silent><expr> <cr> pumvisible() ? ddc#insert_candidate(0) : '<cr>'
'''
hook_post_source = '''
call ddc#custom#patch_global('sources', ['around'])
call ddc#custom#patch_global('sourceOptions', {
      \'_': {
        \'sorters': ['sorter_rank'],
        \'matchers': ['matcher_head']
      \},
      \ 'around': {'mark': 'A'},
      \})
call ddc#custom#patch_filetype(['python', 'rust'], 'sources', ['around', 'nvimlsp'])
call ddc#custom#patch_filetype(['python', 'rust'], 'sourceOptions', {
      \ 'nvimlsp': {'mark': 'lsp', 'forceCompletionPattern': '\.|:|->'},
      \})
call ddc#custom#patch_filetype('zsh', 'sources', ['around', 'zsh'])
call ddc#custom#patch_filetype('zsh', 'sourceOptions', {
      \ 'zsh': {'mark': 'Z'}
      \})
call ddc#enable()
'''

[[plugins]]
repo = 'neovim/nvim-lspconfig'
on_ft = ['rust', 'python']
hook_source = '''
lua << EOL
lsps = {rust = 'rust_analyzer', python = 'pyright'}
for lang, server in pairs(lsps) do
  if vim.bo.filetype == lang then
    require'lspconfig'[server].setup{}
  end
end
EOL
'''

By the way, rust-analyzer gave a lot of errors and did not work at all. Failed to call 'onEvent' with ["Auto"]: ReferenceError: rec is not defined ~

Shougo commented 3 years ago

Fixed. Please update it.