Shougo / pum.vim

Original popup completion menu framework library
MIT License
110 stars 19 forks source link

onCompleteDone is delayed when show new menu after typing with a word inserted. #41

Closed kuuote closed 1 year ago

kuuote commented 1 year ago

Problems summary

onCompleteDone is delayed when show new menu after typing with a word inserted.

Expected

Always call onCompleteDone immediately.

Environment Information (Required!)

NVIM v0.10.0-dev-575+ge59cf3b3a-dirty
Build type: Debug
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/cc -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wvla -Wdouble-promotion -Wmissing-noreturn -Wmissing-format-attribute -Wmissing-prototypes -fno-common -Wimplicit-fallthrough -fdiagnostics-color=auto -fstack-protector-strong -DNVIM_LOG_DEBUG -DUNIT_TESTING -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_TS_HAS_SET_MAX_START_DEPTH -I/data/builder/src/neovim/src/neovim/.deps/usr/include/luajit-2.1 -I/usr/include -I/data/builder/src/neovim/src/neovim/.deps/usr/include -I/data/builder/src/neovim/src/neovim/build/src/nvim/auto -I/data/builder/src/neovim/src/neovim/build/include -I/data/builder/src/neovim/src/neovim/build/cmake.config -I/data/builder/src/neovim/src/neovim/src

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

Run :checkhealth for more info

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

set rtp+=/path/to/vim-denops/denops.vim
set rtp+=/path/to/Shougo/ddc.vim
set rtp+=/path/to/Shougo/ddc-ui-native
set rtp+=/path/to/Shougo/ddc-ui-pum
set rtp+=/path/to/Shougo/pum.vim
set noshowmode

call ddc#enable()
call ddc#register('source', expand('<sfile>:h') .. '/a.ts')
call ddc#custom#patch_global('ui', 'pum')
call ddc#custom#patch_global('sources', ['a'])
inoremap <C-n>   <Cmd>call pum#map#insert_relative(+1)<CR>
inoremap <C-y>   <Cmd>call pum#map#confirm()<CR>

and place this source to same directory of init.vim named "a.ts"

import { BaseSource } from "https://deno.land/x/ddc_vim@v3.2.0/types.ts";

type Params = Record<never, never>;

export class Source extends BaseSource<Params> {
  override async gather() {
    return [{
      word: "hoge",
      user_data: {},
    }];
  }

  override async onCompleteDone() {
    console.log(Math.random());
  }

  override params() {
    return {};
  }
}

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

  1. Run nvim -u init.vim.
  2. Insert "ho" and insert candidate. (<C-n>)
  3. Type any alphabet. (If action that close menu(e.g. , , etc...), then works properly)

Not called at this timing and delayed until time to close menu.

Shougo commented 1 year ago

Fixed.