Shougo / deoplete.nvim

:stars: Dark powered asynchronous completion framework for neovim/Vim8
Other
5.94k stars 295 forks source link

When loading further sources, deoplete (nvim?) resets the selected entry #838

Closed andrewferrier closed 6 years ago

andrewferrier commented 6 years ago

Problems summary

When I have multiple sources defined for deoplete, some of which are slow to load (e.g. the dictionary source), and I'm "too quick" for deoplete and select an entry, it resets the selection as soon as further entries are loaded. This is an irritation and means I often end up selecting the wrong one or none at all.

Expected

deoplete doesn't change the selected entry from the complete list even when lazy-loading more entries from other sources.

Environment Information

Features: +acl +iconv +jemalloc +tui See ":help feature-compile"

system vimrc file: "$VIM/sysinit.vim" fall-back for $VIM: "/usr/local/Cellar/neovim/0.3.1/share/nvim"


 * `:checkhealth` or `:CheckHealth` result(neovim only):

health#deoplete#check

deoplete.nvim

health#nvim#check

Configuration

Performance

Remote Plugins

terminal

health#provider#check

Clipboard (optional)

Python 2 provider (optional)

Python 3 provider (optional)

Ruby provider (optional)

Node.js provider (optional)

Provide a minimal init.vim/vimrc with less than 50 lines (Required!)

set runtimepath+=~/.vim/plugged/deoplete.nvim/
let g:deoplete#enable_at_startup = 1
call deoplete#custom#option('auto_complete_delay', 600)
call deoplete#custom#source('dictionary', 'matchers', ['matcher_head'])

augroup dictionary_init
    autocmd BufRead * setlocal dictionary+=/usr/share/dict/words,~/.vim/spell/en.utf-8.add
augroup END

How to reproduce the problem from neovim/Vim startup (Required!)

  1. Load nvim.
  2. Open any file with a number of keywords already in it.
  3. Find a blank space and enter insert mode.
  4. Enter enough characters to trigger deoplete (e.g. 2). Make sure the characters are a prefix for one of the keywords already in the file (for around/buffer mode), and are also a valid prefix for (unrelated) words in the dictionary.
  5. Initially deoplete will just show "around" and "buffer" words. Quickly press the down arrow a few times to select one before the "dictionary" words are loaded.
  6. Once dictionary words are loaded (approx 0.5 sec on my main system, although slower on some others I have), the selection will be removed from the word you selected.
  7. If you "move too fast" and hit Return at this point, no word will be inserted (which is my irritation and the issue here). To work as desired you have to notice that it's been deselected, and reselect it, before hitting Return.

Generate a logfile if appropriate

2018-09-03 15:32:05,483 [ERROR @ base_events.py:default_exception_handler:1591] 38517 - Task exception was never retrieved
future: <Task finished coro=<BaseEventLoop.subprocess_exec() done, defined at /usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/base_events.py:1491> exception=RuntimeError('Cannot add child handler, the child watcher does not have a loop attached')>
Traceback (most recent call last):
  File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/base_events.py", line 1516, in subprocess_exec
    bufsize, **kwargs)
  File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/unix_events.py", line 193, in _make_subprocess_transport
    self._child_watcher_callback, transp)
  File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/unix_events.py", line 924, in add_child_handler
    "Cannot add child handler, "
RuntimeError: Cannot add child handler, the child watcher does not have a loop attached
2018-09-03 15:32:05,485 [ERROR @ base_events.py:default_exception_handler:1591] 38517 - Task exception was never retrieved
future: <Task finished coro=<BaseEventLoop.subprocess_exec() done, defined at /usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/base_events.py:1491> exception=RuntimeError('Cannot add child handler, the child watcher does not have a loop attached')>
Traceback (most recent call last):
  File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/base_events.py", line 1516, in subprocess_exec
    bufsize, **kwargs)
  File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/unix_events.py", line 193, in _make_subprocess_transport
    self._child_watcher_callback, transp)
  File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/unix_events.py", line 924, in add_child_handler
    "Cannot add child handler, "
RuntimeError: Cannot add child handler, the child watcher does not have a loop attached
2018-09-03 15:32:05,487 [ERROR @ base_events.py:default_exception_handler:1591] 38517 - Task exception was never retrieved
future: <Task finished coro=<BaseEventLoop.subprocess_exec() done, defined at /usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/base_events.py:1491> exception=RuntimeError('Cannot add child handler, the child watcher does not have a loop attached')>
Traceback (most recent call last):
  File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/base_events.py", line 1516, in subprocess_exec
    bufsize, **kwargs)
  File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/unix_events.py", line 193, in _make_subprocess_transport
    self._child_watcher_callback, transp)
  File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/unix_events.py", line 924, in add_child_handler
    "Cannot add child handler, "
RuntimeError: Cannot add child handler, the child watcher does not have a loop attached
2018-09-03 15:32:05,488 [ERROR @ base_events.py:default_exception_handler:1591] 38517 - Task exception was never retrieved
future: <Task finished coro=<BaseEventLoop.subprocess_exec() done, defined at /usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/base_events.py:1491> exception=RuntimeError('Cannot add child handler, the child watcher does not have a loop attached')>
Traceback (most recent call last):
  File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/base_events.py", line 1516, in subprocess_exec
    bufsize, **kwargs)
  File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/unix_events.py", line 193, in _make_subprocess_transport
    self._child_watcher_callback, transp)
  File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/unix_events.py", line 924, in add_child_handler
    "Cannot add child handler, "
RuntimeError: Cannot add child handler, the child watcher does not have a loop attached
Shougo commented 6 years ago

It is not possible. Because, Vim/neovim does not support the feature. Closing.

I think you should disable parallel feature.

       call deoplete#custom#option('num_processes', 1)
andrewferrier commented 6 years ago

Ok, thanks for the clarification, I guess if vim doesn't support it, not much one can do. Thanks for the workaround - it works OK for me. Thanks for your work on this great plugin too.