Shougo / deoplete.nvim

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

Deoplete completion menu hides copilot suggestion #1195

Closed artemave closed 2 years ago

artemave commented 2 years ago

Problems summary

I am using deoplete and copilot (with neovim) and it seems like deoplete menu often dismisses copilot suggestion. As in, copilot suggestion appears first and then deoplete menu shows up and copilot suggestion disappears at the same time.

Expected

I am able to choose either deoplete or copilot suggestion.

Environment Information

https://github.com/Shougo/deoplete.nvim/commit/1c40f648d2b00e70beb4c473b7c0e32b633bd9ae

❯ nvim --version
NVIM v0.6.1
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/gcc-11 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNVIM_TS_HAS_SET_MATCH_LIMIT -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=always -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/home/runner/work/neovim/neovim/build/config -I/home/runner/work/neovim/neovim/src -I/home/runner/work/neovim/neovim/.deps/usr/include -I/usr/include -I/home/runner/work/neovim/neovim/build/src/nvim/auto -I/home/runner/work/neovim/neovim/build/include
Compiled by runner@fv-az87-780

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

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "
/home/runner/work/neovim/neovim/build/nvim.AppDir/usr/share/nvim"

deoplete: health#deoplete#check
========================================================================
## deoplete.nvim
  - OK: exists("v:t_list") was successful
  - OK: has("timers") was successful
  - OK: has("python3") was successful
  - OK: Require Python 3.6.1+ was successful
  - OK: Require msgpack 1.0.0+ was successful
  - INFO: If you're still having problems, try the following commands:
    - $ export NVIM_PYTHON_LOG_FILE=/tmp/log
    - $ export NVIM_PYTHON_LOG_LEVEL=DEBUG
    - $ nvim
    - $ cat /tmp/log_{PID}
    - and then create an issue on github

null-ls: require("null-ls.health").check()
========================================================================
  - OK: rubocop: the command "rubocop" is executable.
  - OK: rubocop: the command "rubocop" is executable.
  - ERROR: eslint: the command "eslint" is not executable.
  - ERROR: eslint: the command "eslint" is not executable.
  - ERROR: eslint: the command "eslint" is not executable.
  - ERROR: autopep8: the command "autopep8" is not executable.
  - ERROR: reorder_python_imports: the command "reorder-python-imports" is not executable.
  - ERROR: flake8: the command "flake8" is not executable.

nvim: health#nvim#check
========================================================================
## Configuration
  - OK: no issues found

## Performance
  - OK: Build type: RelWithDebInfo

## Remote Plugins
  - OK: Up to date

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

## tmux
  - OK: escape-time: 10
  - INFO: Checking stuff
  - OK: focus-events: on
  - INFO: $TERM: xterm-kitty
  - ERROR: $TERM should be "screen-256color" or "tmux-256color" in tmux. Colors might look wrong.
    - ADVICE:
      - Set default-terminal in ~/.tmux.conf:
          set-option -g default-terminal "screen-256color"
      - https://github.com/neovim/neovim/wiki/FAQ

nvim-treesitter: require("nvim-treesitter.health").check()
========================================================================
## Installation
  - WARNING: `tree-sitter` executable not found (parser generator, only needed for :TSInstallFromGrammar, not required for :TSInstall)
  - OK: `node` found v14.18.3 (only needed for :TSInstallFromGrammar)
  - OK: `git` executable found.
  - OK: `cc` executable found. Selected from { vim.NIL, "cc", "gcc", "clang", "cl", "zig" }
    Version: cc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
  - OK: Neovim was compiled with tree-sitter runtime ABI version 13 (required >=13). Parsers must be compatible with runtime ABI.

## Parser/Features H L F I J
  - ql             ✓ ✓ . ✓ ✓ 
  - dot            ✓ . . . ✓ 
  - python         ✓ ✓ ✓ ✓ ✓ 
  - rust           ✓ ✓ ✓ ✓ ✓ 
  - query          ✓ ✓ ✓ ✓ ✓ 
  - fusion         ✓ ✓ ✓ ✓ . 
  - beancount      ✓ . ✓ . . 
  - r              ✓ ✓ . ✓ . 
  - gomod          ✓ . . . ✓ 
  - gowork         ✓ . . . ✓ 
  - zig            ✓ . ✓ ✓ ✓ 
  - javascript     ✓ ✓ ✓ ✓ ✓ 
  - typescript     ✓ ✓ ✓ ✓ ✓ 
  - perl           ✓ . . . . 
  - json5          ✓ . . . ✓ 
  - fish           ✓ ✓ ✓ ✓ ✓ 
  - pioasm         ✓ . . . ✓ 
  - dart           ✓ ✓ . ✓ ✓ 
  - php            ✓ ✓ ✓ ✓ ✓ 
  - java           ✓ ✓ . ✓ ✓ 
  - kotlin         ✓ ✓ ✓ . ✓ 
  - http           ✓ . . . ✓ 
  - julia          ✓ ✓ ✓ ✓ ✓ 
  - ruby           ✓ ✓ ✓ ✓ ✓ 
  - css            ✓ . ✓ ✓ ✓ 
  - scss           ✓ . . ✓ . 
  - lalrpop        ✓ ✓ . . . 
  - elixir         ✓ ✓ ✓ ✓ ✓ 
  - vala           x . . . . 
  - norg           . . . . . 
  - surface        ✓ . ✓ ✓ ✓ 
  - hjson          ✓ ✓ ✓ ✓ ✓ 
  - rasi           ✓ ✓ ✓ ✓ . 
  - eex            ✓ . . . ✓ 
  - cpp            ✓ ✓ ✓ ✓ ✓ 
  - heex           ✓ ✓ ✓ ✓ ✓ 
  - lua            ✓ ✓ ✓ ✓ ✓ 
  - ocaml          ✓ ✓ ✓ . ✓ 
  - bash           ✓ ✓ ✓ . ✓ 
  - html           ✓ ✓ ✓ ✓ ✓ 
  - tsx            ✓ ✓ ✓ ✓ ✓ 
  - go             ✓ ✓ ✓ ✓ ✓ 
  - c_sharp        ✓ ✓ ✓ . ✓ 
  - prisma         ✓ . . . . 
  - vue            ✓ . ✓ ✓ ✓ 
  - llvm           ✓ . . . . 
  - hocon          ✓ . . . ✓ 
  - scala          ✓ . ✓ . ✓ 
  - cmake          ✓ . ✓ . . 
  - bibtex         ✓ . ✓ ✓ . 
  - latex          ✓ . ✓ . ✓ 
  - svelte         ✓ . ✓ ✓ ✓ 
  - json           ✓ ✓ ✓ ✓ . 
  - vim            ✓ ✓ . . ✓ 
  - turtle         ✓ ✓ ✓ ✓ ✓ 
  - tlaplus        ✓ ✓ ✓ . ✓ 
  - clojure        ✓ ✓ ✓ . ✓ 
  - make           ✓ . . . ✓ 
  - toml           ✓ ✓ ✓ ✓ ✓ 
  - commonlisp     ✓ ✓ ✓ . . 
  - c              ✓ ✓ ✓ ✓ ✓ 
  - ocaml_interface✓ ✓ ✓ . ✓ 
  - regex          ✓ . . . . 
  - pascal         ✓ ✓ ✓ ✓ ✓ 
  - pug            ✓ . . . ✓ 
  - verilog        ✓ ✓ ✓ . ✓ 
  - hcl            ✓ . ✓ ✓ ✓ 
  - glimmer        ✓ . . . . 
  - jsonc          ✓ ✓ ✓ ✓ ✓ 
  - comment        ✓ . . . . 
  - jsdoc          ✓ . . . . 
  - yaml           ✓ ✓ ✓ ✓ ✓ 
  - cuda           ✓ ✓ ✓ ✓ ✓ 
  - yang           ✓ . ✓ . . 
  - sparql         ✓ ✓ ✓ ✓ ✓ 
  - rst            ✓ ✓ . . ✓ 
  - ninja          ✓ . ✓ ✓ . 
  - fennel         ✓ ✓ . . ✓ 
  - glsl           ✓ ✓ ✓ ✓ ✓ 
  - dockerfile     ✓ . . . ✓ 
  - graphql        ✓ . . ✓ ✓ 

  Legend: H[ighlight], L[ocals], F[olds], I[ndents], In[j]ections
         +) multiple parsers found, only one will be used
         x) errors found in the query, try to run :TSUpdate {lang}

## The following errors have been detected:
  - ERROR: vala(highlights): Failed to load parser: uv_dlopen: /home/artem/.vim/plugged/nvim-treesitter/parser/vala.so: undefined symbol: tree_sitter_vala_external_scanner_create
    vala(highlights) is concatenated from the following files:
    | [ERROR]:"/home/artem/.vim/plugged/nvim-treesitter/queries/vala/highlights.scm", failed to load: Failed to load parser: uv_dlopen: /home/artem/.vim/plugged/nvim-treesitter/parser/vala.so: undefined symbol: tree_sitter_vala_external_scanner_create

provider: health#provider#check
========================================================================
## Clipboard (optional)
  - OK: Clipboard tool found: xclip

## Python 2 provider (optional)
  - INFO: pyenv: Path: /home/artem/.pyenv/libexec/pyenv
  - INFO: pyenv: Root: /home/artem/.pyenv
  - INFO: `g:python_host_prog` is not set.  Searching for python2 in the environment.
  - WARNING: pyenv is not set up optimally.
    - ADVICE:
      - Create a virtualenv specifically for Nvim using pyenv, and set `g:python_host_prog`.  This will avoid the need to install the pynvim module in each version/virtualenv.
  - INFO: Executable: /usr/bin/python2
  - ERROR: Command error (job=7, exit code 1): `'/usr/bin/python2' -c 'import sys; sys.path = list(filter(lambda x: x != "", sys.path)); import neovim; print(neovim.__file__)'` (in '/home/artem/projects/myrcs')
    stderr: Traceback (most recent call last):  File "<string>", line 1, in <module>  File "/usr/local/lib/python2.7/dist-packages/neovim/__init__.py", line 5, in <module>    import pynvim  File "/usr/local/lib/python2.7/dist-packages/pynvim/__init__.py", line 9, in <module>    from .api import Nvim, NvimError  File "/usr/local/lib/python2.7/dist-packages/pynvim/api/__init__.py", line 7, in <module>    from .buffer import Buffer  File "/usr/local/lib/python2.7/dist-packages/pynvim/api/buffer.py", line 2, in <module>    from .common import Remote  File "/usr/local/lib/python2.7/dist-packages/pynvim/api/common.py", line 4, in <module>    from msgpack import unpackbImportError: No module named msgpack
  - INFO: Python version: 2.7.18
  - INFO: pynvim version: unable to load neovim Python module
  - ERROR: pynvim is not installed.
    Error: unable to load neovim Python module
    - ADVICE:
      - Run in shell: /usr/bin/python2 -m pip install pynvim

## Python 3 provider (optional)
  - INFO: pyenv: Path: /home/artem/.pyenv/libexec/pyenv
  - INFO: pyenv: Root: /home/artem/.pyenv
  - INFO: `g:python3_host_prog` is not set.  Searching for python3 in the environment.
  - WARNING: pyenv is not set up optimally.
    - ADVICE:
      - Create a virtualenv specifically for Nvim using pyenv, and set `g:python3_host_prog`.  This will avoid the need to install the pynvim module in each version/virtualenv.
  - INFO: Executable: /home/linuxbrew/.linuxbrew/bin/python3
  - INFO: Python version: 3.9.10
  - INFO: pynvim version: 0.4.2 (outdated; from /home/linuxbrew/.linuxbrew/Cellar/python@3.9/3.9.10/lib/python3.9/site-packages/neovim)
  - WARNING: Latest pynvim is NOT installed: 0.4.3

## Python virtualenv
  - OK: no $VIRTUAL_ENV

## Ruby provider (optional)
  - INFO: Ruby: ruby 2.7.4p191 (2021-07-07 revision a21a3b7d23) [x86_64-linux]
  - WARNING: `neovim-ruby-host` not found.
    - ADVICE:
      - Run `gem install neovim` to ensure the neovim RubyGem is installed.
      - Run `gem environment` to ensure the gem bin directory is in $PATH.
      - If you are using rvm/rbenv/chruby, try "rehashing".
      - See :help |g:ruby_host_prog| for non-standard gem installations.

## Node.js provider (optional)
  - INFO: Node.js: v14.18.3
  - WARNING: Missing "neovim" npm (or yarn) package.
    - ADVICE:
      - Run in shell: npm install -g neovim
      - Run in shell (if you use yarn): yarn global add neovim

## Perl provider (optional)
  - ERROR: perl provider error:
    - ADVICE:
      - "Neovim::Ext" cpan module is not installed

vim.lsp: require("vim.lsp.health").check()
========================================================================
  - INFO: LSP log level : WARN
  - INFO: Log path: /home/artem/.cache/nvim/lsp.log
  - INFO: Log size: 83 KB

vim.treesitter: require("vim.treesitter.health").check()
========================================================================
  - INFO: Runtime ABI version : 13
  - OK: Loaded parser for bash: ABI version 13
  - OK: Loaded parser for beancount: ABI version 13
  - OK: Loaded parser for bibtex: ABI version 13
  - OK: Loaded parser for c: ABI version 13
  - OK: Loaded parser for c_sharp: ABI version 13
  - OK: Loaded parser for clojure: ABI version 13
  - OK: Loaded parser for cmake: ABI version 13
  - OK: Loaded parser for comment: ABI version 13
  - OK: Loaded parser for commonlisp: ABI version 13
  - OK: Loaded parser for cpp: ABI version 13
  - OK: Loaded parser for css: ABI version 13
  - OK: Loaded parser for cuda: ABI version 13
  - OK: Loaded parser for dart: ABI version 13
  - OK: Loaded parser for dockerfile: ABI version 13
  - OK: Loaded parser for dot: ABI version 13
  - OK: Loaded parser for eex: ABI version 13
  - OK: Loaded parser for elixir: ABI version 13
  - OK: Loaded parser for fennel: ABI version 13
  - OK: Loaded parser for fish: ABI version 13
  - OK: Loaded parser for fusion: ABI version 13
  - OK: Loaded parser for glimmer: ABI version 13
  - OK: Loaded parser for glsl: ABI version 13
  - OK: Loaded parser for go: ABI version 13
  - OK: Loaded parser for gomod: ABI version 13
  - OK: Loaded parser for gowork: ABI version 13
  - OK: Loaded parser for graphql: ABI version 13
  - OK: Loaded parser for hcl: ABI version 13
  - OK: Loaded parser for heex: ABI version 13
  - OK: Loaded parser for hjson: ABI version 13
  - OK: Loaded parser for hocon: ABI version 13
  - OK: Loaded parser for html: ABI version 13
  - OK: Loaded parser for http: ABI version 13
  - OK: Loaded parser for java: ABI version 13
  - OK: Loaded parser for javascript: ABI version 13
  - OK: Loaded parser for jsdoc: ABI version 13
  - OK: Loaded parser for json: ABI version 13
  - OK: Loaded parser for json5: ABI version 13
  - OK: Loaded parser for jsonc: ABI version 13
  - OK: Loaded parser for julia: ABI version 13
  - OK: Loaded parser for kotlin: ABI version 13
  - OK: Loaded parser for lalrpop: ABI version 13
  - OK: Loaded parser for latex: ABI version 13
  - OK: Loaded parser for llvm: ABI version 13
  - OK: Loaded parser for lua: ABI version 13
  - OK: Loaded parser for make: ABI version 13
  - OK: Loaded parser for ninja: ABI version 13
  - OK: Loaded parser for norg: ABI version 13
  - OK: Loaded parser for ocaml: ABI version 13
  - OK: Loaded parser for ocaml_interface: ABI version 13
  - OK: Loaded parser for pascal: ABI version 13
  - OK: Loaded parser for perl: ABI version 13
  - OK: Loaded parser for php: ABI version 13
  - OK: Loaded parser for pioasm: ABI version 13
  - OK: Loaded parser for prisma: ABI version 13
  - OK: Loaded parser for pug: ABI version 13
  - OK: Loaded parser for python: ABI version 13
  - OK: Loaded parser for ql: ABI version 13
  - OK: Loaded parser for query: ABI version 13
  - OK: Loaded parser for r: ABI version 13
  - OK: Loaded parser for rasi: ABI version 13
  - OK: Loaded parser for regex: ABI version 13
  - OK: Loaded parser for rst: ABI version 13
  - OK: Loaded parser for ruby: ABI version 13
  - OK: Loaded parser for rust: ABI version 13
  - OK: Loaded parser for scala: ABI version 13
  - OK: Loaded parser for scss: ABI version 13
  - OK: Loaded parser for sparql: ABI version 13
  - OK: Loaded parser for surface: ABI version 13
  - OK: Loaded parser for svelte: ABI version 13
  - OK: Loaded parser for teal: ABI version 13
  - OK: Loaded parser for tlaplus: ABI version 13
  - OK: Loaded parser for toml: ABI version 13
  - OK: Loaded parser for tsx: ABI version 13
  - OK: Loaded parser for turtle: ABI version 13
  - OK: Loaded parser for typescript: ABI version 13
  - ERROR: Impossible to load parser for vala: Failed to load parser: uv_dlopen: /home/artem/.vim/plugged/nvim-treesitter/parser/vala.so: undefined symbol: tree_sitter_vala_external_scanner_create
  - OK: Loaded parser for verilog: ABI version 13
  - OK: Loaded parser for vim: ABI version 13
  - OK: Loaded parser for vue: ABI version 13
  - OK: Loaded parser for yaml: ABI version 13
  - OK: Loaded parser for yang: ABI version 13
  - OK: Loaded parser for zig: ABI version 13
  - OK: Loaded parser for c: ABI version 13

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

Using vim-plug:

sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs \
      https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
set nocompatible

call plug#begin()

Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
let g:deoplete#enable_at_startup = 1

Plug 'github/copilot.vim'

call plug#end()

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

Given test.rb:

class A
  def print_local_time_to_console
  end
end

Open it and then see the video down below for how to trigger the problem:

 nvim -u mini.vim -c 'PlugInstall' test.rb

Screenshot (if possible)

https://user-images.githubusercontent.com/23721/154651343-3eed7b17-3e66-4ff0-9a72-2f8593c69986.mp4

Shougo commented 2 years ago

Reproduced. But it is copilot feature.

copilot checks pumvisible() and it uses timer feature. It does not work when completion window is visible.

I think it should be documented in copilot documentaiton.

Shougo commented 2 years ago

ddc.vim + pum.vim + copilot.vim works expected. You should use them instead.

set runtimepath+=~/work/denops.vim
set runtimepath+=~/work/ddc.vim
set runtimepath+=~/work/ddc-around
set runtimepath+=~/work/ddc-matcher_head
set runtimepath+=~/work/ddc-sorter_rank
set runtimepath+=~/work/pum.vim

set runtimepath+=~/src/copilot.vim

call ddc#custom#patch_global('sources', ['around'])

call ddc#custom#patch_global('sourceOptions', {
      \ '_': {
      \   'matchers': ['matcher_head'],
      \   'sorters': ['sorter_rank']},
      \ })
call ddc#custom#patch_global('completionMenu', 'pum.vim')

inoremap <silent><expr> <TAB>
      \ pum#visible() ? '<Cmd>call pum#map#insert_relative(+1)<CR>' :
      \ (col('.') <= 1 <Bar><Bar> getline('.')[col('.') - 2] =~# '\s') ?
      \ '<TAB>' : ddc#manual_complete()
inoremap <S-Tab> <Cmd>call pum#map#insert_relative(-1)<CR>
inoremap <C-n>   <Cmd>call pum#map#select_relative(+1)<CR>
inoremap <C-p>   <Cmd>call pum#map#select_relative(-1)<CR>
inoremap <C-y>   <Cmd>call pum#map#confirm()<CR>
inoremap <C-e>   <Cmd>call pum#map#cancel()<CR>

call ddc#enable()
artemave commented 2 years ago

Thanks for quick reply! Ideally, it would be great to have a copilot source for deoplete. So it's all in one menu.

Shougo commented 2 years ago

Unfortunately, the copilot item is multiline. It cannot be completed.

artemave commented 2 years ago

This works, thank you!

I really miss how deoplete was giving me suggestions based on parts of the term all mashed together. For example, "usest" would match "user_test". Is it possible to have this with ddc.vim?

Shougo commented 2 years ago

You can use ddc-fuzzy for it.

https://github.com/tani/ddc-fuzzy