Did you upgrade to/compile latest binary? Run shell command
languageclient 0.1.156
(Neovim users only) Did you check output of :checkhealth LanguageClient?
Yes, everything looks fine
health#LanguageClient#check
========================================================================
- OK: binary found: /home/jiahao/.vim/plugged/LanguageClient-neovim/bin/languageclient
- OK: languageclient 0.1.156
- INFO: Floating window is not supported. Preview window will be used for hover
LanguageClient-neovim works fine with the other languages. The issue is specific about golang. When completing golang using lsp server gopls, the completion is always one line above the expected location when the package is not imported before hand.
This case is tricky because gopls will automatically import library at the top. It looks like that the completion function isn't aware of such change and added completion to original row. Here is a gif record of this behavior.
Features: +acl +iconv -jemalloc +tui
See ":help feature-compile"
system vimrc file: "$VIM/sysinit.vim"
fall-back for $VIM: "/usr/share/nvim"
Run :checkhealth for more info
- This plugin version (`git rev-parse --short HEAD`): `222e250`
- This plugin's binary version (`bin/languageclient --version`): languageclient 0.1.156
- Minimal vimrc content (A minimal vimrc is the smallest vimrc that could
reproduce the issue. Refer to an example [here][min-vimrc.vim]):
[min-vimrc.vim]: https://github.com/autozimu/LanguageClient-neovim/blob/next/min-vimrc.vim
## To Reproduce
Steps to reproduce the behavior:
1. Create a dummy project using the following go code\
package exp
func exp() {
}
1. Start vim, `nvim -u min-vimrc.vim` ...
1. Edit : try to `insert fmt.Println` and when you type the next parenthesis
1. Execute: type the "("
1. See error: the cursor goes to the line above and completion is inserted at wrong position.
## Current behavior
The cursor goes to the line above and completion is inserted at wrong position.
## Expected behavior
The cursor should stay at the line where I trigger the completion.
## Screenshots
Attached above.
## Additional context
gopls automatically adds imported package at the beginning.
Did you upgrade to latest plugin version? Yes
Did you upgrade to/compile latest binary? Run shell command languageclient 0.1.156
(Neovim users only) Did you check output of
:checkhealth LanguageClient
? Yes, everything looks fineDid you check [troubleshooting]? [troubleshooting]: https://github.com/autozimu/LanguageClient-neovim/blob/next/INSTALL.md#6-troubleshooting Yes
Describe the bug
LanguageClient-neovim works fine with the other languages. The issue is specific about golang. When completing golang using lsp server gopls, the completion is always one line above the expected location when the package is not imported before hand.
This case is tricky because gopls will automatically import library at the top. It looks like that the completion function isn't aware of such change and added completion to original row. Here is a gif record of this behavior.
Environment
Features: +acl +iconv -jemalloc +tui See ":help feature-compile"
system vimrc file: "$VIM/sysinit.vim" fall-back for $VIM: "/usr/share/nvim"
Run :checkhealth for more info
call plug#begin('~/.vim/plugged') Plug 'autozimu/LanguageClient-neovim', { \ 'branch': 'next', \ 'do': 'bash install.sh', \ }
Plug 'ncm2/ncm2' call plug#end()
let g:LanguageClient_serverCommands = { \ 'go': ['gopls'], \ } " enable ncm2 for all buffers autocmd BufEnter * call ncm2#enable_for_buffer()
golang.org/x/tools/gopls v0.3.3 golang.org/x/tools/gopls@v0.3.3 h1:mTFqRDJQmpSsgDDWvbtGnSva1z9uX2XcDszSWa6DhBQ=
package exp
func exp() { }