Closed entropitor closed 4 years ago
asyncomplete-omni.vim is omni completion source of asyncomplete.vim. Maybe, neovim's native lsp completion does not use asyncomplete-omni.vim.
@yami-beta they use omni function but they use a lua function to do so. This is configured using v:lua:...
and that seems to be erroring in this plugin
I guess it's related to this
After struggling, this worked for me:
diff --git a/autoload/asyncomplete/sources/omni.vim b/autoload/asyncomplete/sources/omni.vim
index 78acce7..a12a424 100644
--- a/autoload/asyncomplete/sources/omni.vim
+++ b/autoload/asyncomplete/sources/omni.vim
@@ -34,12 +34,20 @@ endfunction
function! s:safe_omnifunc(...) abort
let cursor = getpos('.')
try
- return call(&omnifunc, a:000)
+ if &omnifunc == 'v:lua.vim.lsp.omnifunc'
+ return s:call_nvim_lsp_omnifunc(a:1, a:2)
+ elseif
+ return call(&omnifunc, a:000)
+ endif
finally
call setpos('.', cursor)
endtry
endfunction
+function! s:call_nvim_lsp_omnifunc(a:fundstart, a:base) abort
+ return v:lua.vim.lsp.omnifunc(a:findstart, a:base)
+endfunction
+
let &cpo = s:save_cpo
unlet s:save_cpo
I really not familiar with VimScript so please anyone improve this!!
I'll create a pull.
When I set up neovim using https://neovim.io/doc/user/lsp.html#vim.lsp.omnifunc(), this plugin fails with the following error
Vim(return):E117: Unknown function: v:lua.vim.lsp.omnifunc
How can I fix this?