Shougo / ddc.vim

Dark deno-powered completion framework for Vim/NeoVim
MIT License
669 stars 33 forks source link

preview window calls Source.onCompleteDone #133

Closed uga-rosa closed 1 year ago

uga-rosa commented 1 year ago

Warning: I will close the issue without the minimal init.vim and the reproduction instructions.

Problems summary

Source.onCompleteDone fires on selecting item by pum#map#insert_relative().

Expected

Environment Information

Latest

Provide a minimal init.vim/vimrc without plugin managers (Required!)

set runtimepath+=~/.config/minimal/plugins/denops.vim
set runtimepath+=~/.config/minimal/plugins/ddc.vim
set runtimepath+=~/.config/minimal/plugins/ddc-ui-pum
set runtimepath+=~/.config/minimal/plugins/pum.vim
set runtimepath+=~/.config/minimal/plugins/ddc-filter-matcher_head
set runtimepath+=~/.config/minimal/plugins/denops-popup-preview.vim

call ddc#custom#patch_global(#{
      \ ui: 'pum',
      \ sources: ['minimal'],
      \ sourceOptions: #{
      \   _: #{
      \     minAutoCompleteLength: 1,
      \     matchers: ['matcher_head'],
      \   },
      \ },
      \})

inoremap <C-n> <Cmd>call pum#map#insert_relative(+1)<CR>
inoremap <C-p> <Cmd>call pum#map#insert_relative(-1)<CR>
inoremap <C-y> <Cmd>call pum#map#confirm()<CR>

call ddc#enable()
call popup_preview#enable()

type Params = Record<never, never>;

export class Source extends BaseSource { gather(): Promise { return Promise.resolve([ { word: "test1", info: "test1", user_data: {} }, { word: "test2", info: "test2", user_data: {} }, ]); }

async onCompleteDone({ denops, }: OnCompleteDoneArguments): Promise { await fn.setline(denops, ".", "fire!"); }

params(): Params { return {}; } }



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

1. Input `t`.
2. Select first item with `<C-n>`.
3. `onCompleteDone` fires and the current line is rewritten to `fire!`.

## Screenshot (if possible)
![insert_relative](https://github.com/Shougo/ddc.vim/assets/82267684/2a5944a0-ecf7-42d5-bed1-3ac7911c2c2c)

## Upload the log messages by `:redir` and `:message` (if errored)
Shougo commented 1 year ago

Reproduced.

Shougo commented 1 year ago

Fixed.