yami-beta / asyncomplete-omni.vim

Omni completion source for asyncomplete.vim
MIT License
39 stars 11 forks source link

Bug with flow-language-server #6

Open entropitor opened 6 years ago

entropitor commented 6 years ago

If used together with flow-language-server and LanguageClient-neovim, the completion through asyncomplete-omni is bugged, it adds the new insertion but doens't removed the typed text that triggered the insertion in the first place

const foo = 3
console.log(f<TAB>

becomes

const foo = 3
console.log(ffoo
yami-beta commented 6 years ago

@entropitor Please send minimum init.vim for test. If it's possible, would you capture screenshot of completion popup and paste it here ?

entropitor commented 6 years ago

I posted an answer yesterday but it apparently didn't get through 😢 Let's try again

call plug#begin('~/.vim/bundle')
Plug 'prabirshrestha/async.vim'
Plug 'prabirshrestha/asyncomplete.vim'
Plug 'yami-beta/asyncomplete-omni.vim'
Plug 'autozimu/LanguageClient-neovim', { 'do': ':UpdateRemotePlugins' }
call plug#end()

let g:asyncomplete_auto_popup = 1
set completeopt+=preview
autocmd! CompleteDone * if pumvisible() == 0 | pclose | endif

au User asyncomplete_setup call asyncomplete#register_source(asyncomplete#sources#omni#get_source_options({
  \ 'name': 'omni',
  \ 'whitelist': ['*'],
  \ 'completor': function('asyncomplete#sources#omni#completor')
  \  }))

let g:LanguageClient_serverCommands = {
    \ 'javascript': ['flow-language-server', '--stdio'],
    \ 'reason': ['ocaml-language-server', '--stdio'],
    \ 'ocaml': ['ocaml-language-server', '--stdio']
    \ }

let g:LanguageClient_autoStart = 1

image image

yami-beta commented 6 years ago

Thanks for minimum init.vim and screenshot !

The completion item by asyncomplete-omni.vim includes [omni] as follows.

2017-12-07 11 38 22

Bug of typed text isn't removed is because of LanguageClient-neovim overrides popup of asyncomplete.vim.

textDocument_completionOmnifunc() method trigger neovim's complete() ( :h complete() ). https://github.com/autozimu/LanguageClient-neovim/blob/master/rplugin/python3/LanguageClient/LanguageClient.py#L1066

It is difficult for asyncomplete-omni.vim to support LanguageClient-neovim.

So I suggest prabirshrestha/asyncomplete-lsp.vim for language server.