First, let me thank all the Neovim & neovim-lsp maintainers for the wonderful piece of software, it helps me every single day to get the job done!
Now onto the problem: I am working mainly on OCaml code and use merlin
(GitHub - ocaml/merlin: Context sensitive completion for OCaml in Vim and Emacs) for completion/diagnostics. Recently, I decided to try builtin lsp with ocamllsp
(which uses merlin as a backend btw). So far, looks really good! There is one piece of it, which I don’t really understand - omnicompletion behaviour with <ctrl-x> <ctrl-o>
. Typically, I press <ctrl-x>
and then <ctrl-o>
multiple times. This selects & pre-fills each new alternative until I am satisfied. See recording:
I wanted to do the same with lsp version and have this in my lua heredoc string
local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
But it doesn’t behave as I expect. Specifically, the completion menu gets populated on <ctrl-x><ctrl-o>
, but the next <ctrl-o>
closes the completion menu and leaves me with the initial prefix / diagnostic message. Like this:
Will attach the recording to the first comment because of limitations for new users
The question is - is it a bug or feature? If the latter - what is the way to make it work like merlin does?
FTR, merlin does this for omnifunc: merlin/merlin.vim at master · ocaml/merlin · GitHub