deoplete-plugins / deoplete-jedi

deoplete.nvim source for Python
MIT License
589 stars 39 forks source link

Automatically inserting functions #7

Closed alexlafroscia closed 8 years ago

alexlafroscia commented 8 years ago

I've noticed that my function results in Deoplete seem to be inserting themselves when I don't want them to.

For example, if I start typing and Deoplete suggests a list of items, and the first one is a function from Jedi, as soon as I hit <C-n> to start navigating through the list, the item gets inserted. I think this is due to the fact that the ( is added automatically. If I cycle through the list backwards, it correctly passes over other Deoplete options, and variables from Jedi, but as soon as it hits a function and the ( is inserted, the behavior breaks.

I can't get the behavior to break all the time, but can upload a file and describe what I'm doing that triggers the undesired behavior.

The follow Python file shows the error:

// error.py
def test_model(test_file_name):
    pass

If you place the cursor at the end of the file and write test I get a completion that looks like this:

screen shot 2016-02-17 at 1 42 15 am

After pressing <C-n> I would expect the first item in the list to be highlighted, but not actually entered. However, pressing <C-n> only once brings me to the following instead:

screen shot 2016-02-17 at 1 43 36 am

nhooyr commented 8 years ago

Its straight up inserted? As in you cannot press <c-n> again to move to the next option?

alexlafroscia commented 8 years ago

@nhooyr exactly

nhooyr commented 8 years ago

@alexlafroscia does this happen with manual completion?

alexlafroscia commented 8 years ago

@nhooyr what do you mean by

manual completion

?

Shougo commented 8 years ago

@alexlafroscia Please create minimal init.vim less than 50 lines and without the plugin manager configurations. I will test it.

alexlafroscia commented 8 years ago

Alright, so assuming you're using vim-plug for addon management, the following configuration shows the error:

if empty(glob('~/.config/nvim/autoload/plug.vim'))
  silent !curl -fLo ~/.config/nvim/autoload/plug.vim --create-dirs
    \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
  autocmd VimEnter * PlugInstall
endif

let &runtimepath .= "," . $DOTFILES . "/nvim"

call plug#begin()
Plug 'airblade/vim-gitgutter'
Plug 'Shougo/deoplete.nvim'
Plug 'zchee/deoplete-jedi',               { 'for': 'python' }
call plug#end()

let g:deoplete#enable_at_startup = 1
let g:deoplete#sources = {}
let g:deoplete#sources.python = ['jedi', 'ultisnips']

I ran the command as nvim -u init.vim error.py where init.vim has the contents listed above. Note, I had to run :UpdateRemotePlugins this first time, closed Neovim, and then ran the same command again.

The issue seems to be vim-gitgutter, strangely enough. Using my normal configuration, removing that single plugin fixed the problem.

Shougo commented 8 years ago

OK. I think it is vim-gitgutter's bug. It is not deoplete-jedi's problem. Closing.

https://github.com/airblade/vim-gitgutter/issues/310

alexlafroscia commented 8 years ago

👍 thanks!