Open sblask opened 2 years ago
+1 for this from me, same issue precisely. I might have a poke around in Supertab in the next week or two to try to figure out a fix.
Edit: I ended up switching to mucomplete, so I won't be looking any further on this.
This happens because SuperTabCodeComplete
has the line:
let Func = function(b:SuperTabChain[0])
which makes a funcref
out of b:SuperTabChain[0]
, and the docs for v:lua
explicitly say:
Note: v:lua without a call is not allowed in a Vimscript expression: Funcrefs cannot represent Lua functions.
You can work around this with the following:
vim.cmd [[
function! SuperTabLspOmnifunc(findstart, base)
return v:lua.vim.lsp.omnifunc(a:findstart, a:base)
endfunction
]]
vim.bo.omnifunc = "SuperTabLspOmnifunc"
-- Reactivate completion chaining after setting omnifunc (see `:h supertab-completionchaining`)
vim.fn.SuperTabChain("SuperTabLspOmnifunc", "<c-p>")
vim.fn.SuperTabSetDefaultCompletionType("<c-x><c-u>")
I set up Neovim's LSP following the guide here: https://github.com/neovim/nvim-lspconfig the relevant bit being this:
There are two problems with it. Because the omnifunc is only set when the LSP attaches, the autocmd to configure SuperTab:
for setting up the chaining doesn't work because when it's executed omnifunc is still empty.
But even if I change it to:
I get errors:
Is there anything I can do or can SuperTab be changed to make this work?