roxma / nvim-completion-manager

:warning: PLEASE USE https://github.com/ncm2/ncm2 INSTEAD
MIT License
917 stars 49 forks source link

Trailing whitespace with g:cm_matcher and nsf/gocode #165

Open namedots opened 6 years ago

namedots commented 6 years ago

I've run into a rather strange bug with g:cm_matcher and nsf/gocode Maybe it's nsf/gocode's bug. the g:cm_matcher interaction is strange though, possibly doing something needed to reproduce the issue for nsf/gocode, and I wouldn't know where to start with a bug report for nsf/gocode

The bug looks like this: https://asciinema.org/a/CuDs6CEXQJYn0ueiutCYqCgIc (the red-marked trailing whitespace shouldn't be there, it should have been removed when I left that line)

Reproducing the bug in a minimal environment:

curl -fLo ~/.config/nvim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim pip3 install --user neovim jedi psutil setproctitle go get github.com/nsf/gocode export PATH=~/go/bin:$PATH

With a vimrc like this:

call plug#begin('~/.config/nvim/plugged')
Plug 'roxma/nvim-completion-manager'
let g:cm_matcher = {
        \ 'module': 'cm_matchers.fuzzy_matcher',
        \ 'case': 'smartcase'
        \}
call plug#end()

With the configuration complete, the bug doesn't yet occur. However, after writing a hello world program in go:

package main
import "fmt"
func main() {
    fmt.Println("hello world")
}

Presumably getting something to change about nsf/gocode's persistent state in the filesystem...

Now, after opening nvim (no file needed), and typing:

    hello

(indented and then a word)

followed by ENTER (ctrl m) twice -- this causes trailing whitespace on the line after hello.

Removing the g:cm_matcher part in the vimrc stops this behaviour. Happens for both abbrev_matcher and fuzzy_matcher