Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deoplete.nvim does not provide completions when it is loaded lazily #508

gkapfham opened this issue Jul 3, 2017 · 4 comments


Copy link

gkapfham commented Jul 3, 2017

Problem Summary

Hello @Shougo! Thanks again for developing this plugin. As discussed in #500, there seems to be a problem with the lazy loading of the plugin. You asked me to raise an issue explicitly about this issue.

I would like to load this plugin in a lazy fashion. I followed the documentation for deoplete.nvim and found that the lazy loading seems to make the functions available but it never actually causes the completions to appear on the screen.


I would like to see the completions appear on the screen after the plugin finishes loading in an asynchronous fashion.

Environment Information

  • OS: Ubuntu 16.04

  • neovim version: NVIM v0.2.1-dev

  • :CheckHealth result(neovim ver.0.1.5-452+):

## deoplete.nvim
  - SUCCESS: has("nvim") was successful
  - SUCCESS: has("python3") was successful
  - INFO: If you're still having problems, try the following commands:
    $ export NVIM_PYTHON_LOG_FILE=/tmp/log
    $ nvim
    $ cat /tmp/log_{PID}
    and then create an issue on github

## jedi
#### Jedi-vim debug information
Using Python version: 2
 - sys.version: `2.7.12 (default, Nov 19 2016, 06:48:10), [GCC 5.4.0 20160609]`
 - site module: `/usr/lib/python2.7/site.pyc`
Jedi path: `/home/gkapfham/.vim/bundle/jedi-vim/jedi/jedi/__init__.pyc`
 - version: 0.10.2
 - sys_path:
    - `/home/gkapfham/.vim/bundle/jedi-vim`
    - `/usr/lib/python2.7`
    - `/usr/lib/python2.7/plat-x86_64-linux-gnu`
    - `/usr/lib/python2.7/lib-tk`
    - `/usr/lib/python2.7/lib-old`
    - `/usr/lib/python2.7/lib-dynload`
    - `/home/gkapfham/.local/lib/python2.7/site-packages`
    - `/usr/local/lib/python2.7/dist-packages`
    - `/usr/lib/python2.7/dist-packages`
    - `/usr/lib/python2.7/dist-packages/PILcompat`
    - `/usr/lib/python2.7/dist-packages/gtk-2.0`
    - `/usr/lib/python2.7/dist-packages/ubuntu-sso-client`
    - `_vim_path_`
    - `/home/gkapfham/.vim/bundle/MatchTagAlways/autoload/../python`
 - jedi-vim git version: 6411de0
 - jedi git submodule status:  5427b02712828b2875d35b5ee1c8b5e58f820537 jedi (v0.10.2)

g:jedi#force_py_version = '2' (default: 'auto')
g:jedi#auto_vim_configuration = 0 (default: 1)
g:jedi#completions_enabled = 0 (default: 1)

	Last set from /usr/share/nvim/runtime/ftplugin/html.vim
	Last set from ~/.vim/bundle/deoplete.nvim/autoload/deoplete/mapping.vim

## Configuration
  - WARNING: $NVIM_TUI_ENABLE_CURSOR_SHAPE is ignored in Nvim 0.2+
      - Use the 'guicursor' option to configure cursor shape. :help |'guicursor'|

## Performance
  - SUCCESS: Build type: RelWithDebInfo

## Remote Plugins
  - SUCCESS: Up to date

## terminal
  - INFO: key_backspace (kbs) terminfo entry: key_backspace=\177
  - INFO: key_dc (kdch1) terminfo entry: key_dc=\E[3~

## tmux
  - SUCCESS: escape-time: 1ms
  - INFO: $TERM: screen-256color
  - INFO: default-terminal: screen
  - ERROR: $TERM differs from the tmux `default-terminal` setting. Colors might look wrong.
      - $TERM may have been set by some rc (.bashrc, .zshrc, ...).

## Clipboard (optional)
  - SUCCESS: Clipboard tool found: xsel

## Python 2 provider (optional)
  - INFO: `g:python_host_prog` is not set.  Searching for python2 in the environment.
  - INFO: Executable: /usr/bin/python2
  - INFO: Python2 version: 2.7.12
  - INFO: python2-neovim version: 0.1.11dev (outdated; from /usr/local/lib/python2.7/dist-packages/neovim)
  - WARNING: Latest python2-neovim is NOT installed: 0.1.13

## Python 3 provider (optional)
  - INFO: `g:python3_host_prog` is not set.  Searching for python3 in the environment.
  - INFO: Executable: /usr/bin/python3
  - INFO: Python3 version: 3.5.2
  - INFO: python3-neovim version: 0.1.11dev (outdated; from /usr/local/lib/python3.5/dist-packages/neovim)
  - WARNING: Latest python3-neovim is NOT installed: 0.1.13

## Ruby provider (optional)
  - INFO: Ruby: ruby 2.3.1p112 (2016-04-26) [x86_64-linux-gnu]
  - INFO: Host: /usr/local/bin/neovim-ruby-host
  - SUCCESS: Latest "neovim" gem is installed: 0.4.0

Note that I can see some of my configurations (e.g., the cursor shape and the version of the Python2 and Python3 plugins) are a little out of date. If you need me to update these before you can move forward with this issue, please let me know. It is possible that I will have enough time to complete those tasks.

Provide a minimal init.vim with less than 50 lines

" Your minimal init.vim
call plug#begin('~/.vim/bundle')
Plug 'Shougo/deoplete.nvim'}
" ... I also load many other plugins
" Always load special fonts last
Plug 'ryanoasis/vim-devicons'
call plug#end()

" Configure completion with deoplete
if has("nvim")
  " Disable YCM and enable Deoplete
  let g:loaded_youcompleteme = 1
  let g:deoplete#enable_at_startup = 0
  let g:deoplete#auto_complete_delay = 5

  " Configure deoplete so that it uses tabs
  inoremap <silent><expr><Tab> pumvisible() ? "\<C-n>"
        \ : (<SID>is_whitespace() ? "\<Tab>" : deoplete#mappings#manual_complete())
  inoremap <expr><S-Tab>  pumvisible() ? "\<C-p>" : "\<C-h>"

  " Register Java's completion function with deoplete
  let g:deoplete#omni#functions = {}
  let = [
        \ 'javacomplete#Complete'

  " Configure deoplete to work with LaTeX
  if !exists('g:deoplete#omni#input_patterns')
      let g:deoplete#omni#input_patterns = {}
  let g:deoplete#omni#input_patterns.tex = '\\(?:'
        \ .  '\w*cite\w*(?:\s*\[[^]]*\]){0,2}\s*{[^}]*'
        \ . '|\w*ref(?:\s*\{[^}]*|range\s*\{[^,}]*(?:}{)?)'
        \ . '|hyperref\s*\[[^]]*'
        \ . '|includegraphics\*?(?:\s*\[[^]]*\]){0,2}\s*\{[^}]*'
        \ . '|(?:include(?:only)?|input)\s*\{[^}]*'
        \ . '|\w*(gls|Gls|GLS)(pl)?\w*(\s*\[[^]]*\]){0,2}\s*\{[^}]*'
        \ . '|includepdf(\s*\[[^]]*\])?\s*\{[^}]*'
        \ . '|includestandalone(\s*\[[^]]*\])?\s*\{[^}]*'
        \ . '|usepackage(\s*\[[^]]*\])?\s*\{[^}]*'
        \ . '|documentclass(\s*\[[^]]*\])?\s*\{[^}]*'
        \ . '|\w*'
        \ .')'

  autocmd InsertEnter * call deoplete#enable()

The reproduce ways from neovim starting

If you start Neovim with any file (I have mostly tried this with Markdown files) you will notice that the completions do not start to appear. However, interestingly, the various deoplete.nvim functions are now available. For instance, if you type :call deoplete# and press tab in command-mode you can see that all of the functions are available. However, the completion menu never seems to appear.

Okay, I hope that this gives you enough information to reproduce and fix the defect. Thanks again for all of your work on this plugin, @Shougo! I really enjoy using it and hope to see this issue resolved soon.

@Shougo Shougo added the bug label Jul 3, 2017
Copy link

Shougo commented Jul 3, 2017

It is fatal bug. I will fix it ASAP.

Copy link

gkapfham commented Jul 3, 2017

Thanks @Shougo! I appreciate your willingness to look into this right away. Please let me know if you need any additional information to support the debugging process and the implementation of a fix.

@Shougo Shougo closed this as completed in 376b0c9 Jul 4, 2017
Copy link

gkapfham commented Jul 5, 2017

Hello @Shougo, I am writing to confirm that you have correctly resolved this issue! I have tested two different approaches to lazy loading deoplete.nvim (i.e., using the approach that you describe in the documentation and an alternative that leverages vim-plug.

Both of these work correctly. I can also confirm that lazy loading substantially improves the startup time of Neovim and the completion starts seamlessly during the first time that I enter insert mode.

Thank you so much for implementing this fix — I used deoplete.nvim on a regular basis and the lazy loading and this fix make my overall experience even more awesome than before.

Copy link

Shougo commented Jul 5, 2017

deoplete startuptime will be faster.


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

No branches or pull requests

2 participants