autozimu / LanguageClient-neovim

Language Server Protocol (LSP) support for vim and neovim.
MIT License
3.55k stars 273 forks source link

gopls suggestions missing first letter #823

Closed delfick closed 5 years ago

delfick commented 5 years ago

Describe the bug

When I select suggestions that appear in the completion menu from gopls, vim leaves out the first letter of the suggestion.

So say I start typing "f" and the first suggestion is "fmt", when I choose that suggestion the "f" changes to "mt"

Environment

NVIM v0.3.4
Build type: Release
LuaJIT 2.0.5
Features: +acl +iconv +jemalloc +tui
(stephenmoore) ~/.vim/plugged/LanguageClient-neovim
 8:10 ──   git rev-parse HEAD
41c948e05532a92b27c9ef0509cea651592d6bb5
(stephenmoore) ~/.vim/plugged/LanguageClient-neovim
 8:11 ──   bin/languageclient --version
languageclient 0.1.146 ec4af74cc389f802c3c43a660c963049848a8a93
call plug#begin('~/.vim/plugged')
Plug 'roxma/nvim-yarp'
Plug 'ncm2/ncm2'

Plug 'autozimu/LanguageClient-neovim', {
    \ 'branch': 'next',
    \ 'do': 'bash install.sh',
    \ }

call plug#end()
autocmd BufEnter  *  call ncm2#enable_for_buffer()

set shortmess+=c
set completeopt=noinsert,menuone,noselect
set pumheight=6

" Always draw sign column. Prevent buffer moving when adding/deleting sign.
set signcolumn=yes

let g:LanguageClient_serverCommands = {
    \ 'go': ['gopls'],
    \ }
let g:LanguageClient_loggingLevel = 'INFO'
let g:LanguageClient_loggingFile =  expand('~/.local/share/nvim/LanguageClient.log')
let g:LanguageClient_serverStderr = expand('~/.local/share/nvim/LanguageServer.log')

https://github.com/golang/go/wiki/gopls

gopls 1.16.0

GOFLAGS="" GO111MODULE=on go get golang.org/x/tools/cmd/gopls@1.16.0

To Reproduce

install gopls and get min vimrc specified in this issue

Create a main.go with

package main

import "fmt"

func main() {
}

in main() start typing "f", wait for it to suggest "fmt" and choose it.

Current behavior

The suggestion gets filled without the first letter

Expected behavior

The whole suggestion gets filled. I noticed that if I use golang-server instead of gopls then it works correctly.

butterflyfish commented 5 years ago

@delfick , does snippet(Function parameter expansion) works at your side w/ ncm2/gopls?

delfick commented 5 years ago

I forgot to update this issue, I updated gopls a few weeks ago and the problem seemed to go away.