Shougo / ddc.vim

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

Error with neco-vim on Vim where many functions exist #30

Closed statiolake closed 3 years ago

statiolake commented 3 years ago

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

Problems summary

When there're a lot of functions registered in Vim, triggering completion causes error Failed to parse received text '...': Syntax Error: Unexpected token i in JSON at position 65540. (Actually '...' is received JSON. The position or exact error message may differ, but error position is around 65000-. The shown received JSON seems incomplete.)

Expected

ddc.vim normally shows completion list.

Environment Information

VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Aug 15 2021 22:20:28)
MS-Windows 64 ビット GUI 版
適用済パッチ: 1-3350
Compiled by dicen@THUNDERBOLT
Huge 版 with GUI.  機能の一覧 有効(+)/無効(-)
+acl                +cursorbind         +iconv/dyn          -mzscheme           -sodium             +vartabs
+arabic             +cursorshape        +insert_expand      +netbeans_intg      +sound              +vertsplit
+autocmd            +darkmode_w32       +ipv6               +num64              +spell              +virtualedit
+autochdir          +dialog_con_gui     +job                -ole                +startuptime        +visual
+autoservername     +diff               +jumplist           +packages           +statusline         +visualextra
+balloon_eval       +digraphs           +keymap             +path_extra         -sun_workshop       +viminfo
-balloon_eval_term  +directx            +lambda             -perl               +syntax             +vreplace
+browse             -dnd                +langmap            +persistent_undo    +tag_binary         -vtp
++builtin_terms     -ebcdic             +libcall            +popupwin           -tag_old_static     +wildignore
+byte_offset        +emacs_tags         +linebreak          -postscript         -tag_any_white      +wildmenu
+channel            +eval               +lispindent         +printer            -tcl                +windows
+cindent            +ex_extra           +listcmds           +profile            -termguicolors      +writebackup
+clientserver       +extra_search       +localmap           -python             +terminal           -xfontset
+clipboard          -farsi              +lua/dyn            +python3/dyn        -termresponse       -xim
+cmdline_compl      +file_in_path       +menu               +quickfix           +textobjects        +xpm_w32
+cmdline_hist       +find_in_path       +mksession          +reltime            +textprop           -xterm_save
+cmdline_info       +float              +modify_fname       +rightleft          -tgetent            
+comments           +folding            +mouse              -ruby               +timers             
+conceal            -footer             +mouseshape         +scrollbind         +title              
+cryptv             +gettext/dyn        +multi_byte_ime/dyn +signs              +toolbar            
+cscope             -hangul_input       +multi_lang         +smartindent        +user_commands      
      システム vimrc: "$VIM\vimrc"
      ユーザー vimrc: "$HOME\_vimrc"
   第2ユーザー vimrc: "$HOME\vimfiles\vimrc"
   第3ユーザー vimrc: "$VIM\_vimrc"
       ユーザー exrc: "$HOME\_exrc"
    第2ユーザー exrc: "$VIM\_exrc"
     システム gvimrc: "$VIM\gvimrc"
     ユーザー gvimrc: "$HOME\_gvimrc"
  第2ユーザー gvimrc: "$HOME\vimfiles\gvimrc"
  第3ユーザー gvimrc: "$VIM\_gvimrc"
  デフォルトファイル: "$VIMRUNTIME\defaults.vim"
    システムメニュー: "$VIMRUNTIME\menu.vim"
コンパイル: cl -c /W3 /GF /nologo  -I. -Iproto -DHAVE_PATHDEF -DWIN32  -DFEAT_CSCOPE -DFEAT_TERMINAL -DFEAT_SOUND -DFEAT_NETBEANS_INTG -DFEAT_JOB_CHANNEL -DFEAT_IPV6   -DFEAT_XPM_W32    -DFEAT_DARKMODE_W32   -DWINVER=0x0501 -D_WIN32_WINNT=0x0501 /source-charset:utf-8 /MP -DHAVE_STDINT_H /Ox /GL -DNDEBUG  /Zl /MT /D_CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE -DFEAT_MBYTE_IME -DDYNAMIC_IME -DFEAT_GUI_MSWIN -DFEAT_DIRECTX -DDYNAMIC_DIRECTX -DFEAT_DIRECTX_COLOR_EMOJI -DDYNAMIC_ICONV -DDYNAMIC_GETTEXT -DFEAT_LUA -DDYNAMIC_LUA  -DDYNAMIC_LUA_DLL=\"lua53.dll\" -DFEAT_PYTHON3 -DDYNAMIC_PYTHON3 -DDYNAMIC_PYTHON3_DLL=\"python39.dll\" -DFEAT_HUGE /Fd.\ObjGXUHKAMD64/ /Zi
リンク: link  /nologo /opt:ref /LTCG:STATUS /HIGHENTROPYVA:NO oldnames.lib kernel32.lib advapi32.lib shell32.lib gdi32.lib  comdlg32.lib ole32.lib netapi32.lib uuid.lib /machine:AMD64 gdi32.lib version.lib  Dwmapi.lib  winspool.lib comctl32.lib advapi32.lib shell32.lib netapi32.lib  /machine:AMD64  libcmt.lib  user32.lib  /nodefaultlib:lua53.lib    /nodefaultlib:python39.lib    winmm.lib WSock32.lib Ws2_32.lib xpm\x64\lib-vc14\libXpm.lib  /PDB:gvim.pdb -debug

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

Save the following file as a repro.vim.

set nocompatible laststatus=2 cmdheight=2

" Please prepare dependencies in the current directory or specify the path to
" those plugins.
" - 'vim-denops/denops.vim'
" - 'Shougo/ddc.vim'
" - 'Shougo/ddc-matcher_head'
" - 'Shougo/ddc-sorter_rank'
" - 'Shougo/neco-vim'
set runtimepath+=denops.vim,ddc.vim,ddc-matcher_head,ddc-sorter_rank,neco-vim

" Register a lot of functions.
for i in range(20000)
  function! ASDF{i}() abort
  endfunction
endfor

call ddc#custom#patch_global('sourceOptions', {
  \   '_': {
  \     'matchers': ['matcher_head'],
  \     'sorters': ['sorter_rank'],
  \   },
  \ })
call ddc#custom#patch_filetype(['vim'], 'sources', ['necovim'])

" This manual completion is not required
inoremap <silent><expr> <C-Space> ddc#manual_complete()

call ddc#enable()

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

  1. Prepare dependencies
  2. gvim -u repro.vim test.vim
  3. :set ft=vim
  4. Type call exp in insert mode and wait for compleion (or press to force completion).
  5. You'll see error message as below and no completions show up.

image

  1. :message to see complete error messages.

Screenshot (if possible)

Very long error messages show up like below.

image

Shougo commented 3 years ago

It seems denops error. It is hard to debug for me.

Shougo commented 3 years ago

It is reproduced in Windows environment. Not reproduced in Linux.

Shougo commented 3 years ago

I have analysed the error. It is from channel JSON RPC. It cannot be fixed in denops side.

I have added the filter for neco-vim. Please update neco-vim to the latest.