"E688: More targets than List items" when trying to jump to definition of symbol with \rj
I press \rj to jump to the definition of a c++ symbol and I get:
Error detected while processing function <lambda>6[1]..rtags#HandleResults[11]..rtags#ExecuteHandlers[6]..rtags#JumpToHandler:
line 11:
E688: More targets than List items
line 15:
E121: Undefined variable: jump_file
E116: Invalid arguments for function rtags#jumpToLocation(jump_file, lnum, col)
E15: Invalid expression: rtags#jumpToLocation(jump_file, lnum, col)
It also does not jump to the definition, presumably as a result of the error. It happens all the time. I used to be able to run vim-rtag without problems but I've re-created my setup with the latest version of the tools and now it no longer works.
I'm using the latest vim-rtag plugin version from git (via Vundle):
commit 054cd8970eda8e222fc5b4c7b88d2a8727d34f25
Author: lyuts <[email protected]>
Date: Mon Jul 10 21:55:38 2017 -0700
Set s:rtagsAsync to 0 to not break older version of vim when async is
not available.
I'm also using using the latest version of rtags from git:
commit 65c8f03ff0112ce5c5e11aff6867ad0eb9019e63
Author: Anders Bakken <[email protected]>
Date: Sat Jul 15 09:19:36 2017 -0700
Issue #1004. Support regex (-Z) for --find-symbols.
And the latest version of Vim from git on Linux x86_64 (xubuntu-16.04):
:version
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Jul 17 2017 18:00:30)
Included patches: 1-727
Compiled by dope@pel-desktop
Huge version with GTK3 GUI. Features included (+) or not (-):
+acl -ebcdic +listcmds +persistent_undo +termresponse
+arabic +emacs_tags +localmap +postscript +textobjects
+autocmd +eval -lua +printer +timers
+balloon_eval +ex_extra +menu +profile +title
+browse +extra_search +mksession -python +toolbar
++builtin_terms +farsi +modify_fname +python3 +user_commands
+byte_offset +file_in_path +mouse +quickfix +vertsplit
+channel +find_in_path +mouseshape +reltime +virtualedit
+cindent +float +mouse_dec +rightleft +visual
+clientserver +folding +mouse_gpm -ruby +visualextra
+clipboard -footer -mouse_jsbterm +scrollbind +viminfo
+cmdline_compl +fork() +mouse_netterm +signs +vreplace
+cmdline_hist +gettext +mouse_sgr +smartindent +wildignore
+cmdline_info -hangul_input -mouse_sysmouse +startuptime +wildmenu
+comments +iconv +mouse_urxvt +statusline +windows
+conceal +insert_expand +mouse_xterm -sun_workshop +writebackup
+cryptv +job +multi_byte +syntax +X11
+cscope +jumplist +multi_lang +tag_binary -xfontset
+cursorbind +keymap -mzscheme +tag_old_static +xim
+cursorshape +lambda +netbeans_intg -tag_any_white +xpm
+dialog_con_gui +langmap +num64 -tcl +xsmp_interact
+diff +libcall +packages +termguicolors +xterm_clipboard
+digraphs +linebreak +path_extra +terminal -xterm_save
+dnd +lispindent -perl +terminfo
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
2nd user vimrc file: "~/.vim/vimrc"
user exrc file: "$HOME/.exrc"
system gvimrc file: "$VIM/gvimrc"
user gvimrc file: "$HOME/.gvimrc"
2nd user gvimrc file: "~/.vim/gvimrc"
defaults file: "$VIMRUNTIME/defaults.vim"
system menu file: "$VIMRUNTIME/menu.vim"
fall-back for $VIM: "/usr/local/share/vim"
Compilation: gcc-7 -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK -pthread -I/usr/inclu
de/gtk-3.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus
-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -I/usr/include/gtk-3.0 -I/usr/include
/gio-unix-2.0/ -I/usr/include/mirclient -I/usr/include/mircore -I/usr/include/mircookie
-I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/p
ango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/inc
lude/freetype2 -I/usr/include/libpng12 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/lib
png12 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -g -O2 -U_
FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc-7 -L/usr/local/lib -Wl,--as-needed -o vim -lgtk-3 -lgdk-3 -lpangocairo
-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject
-2.0 -lglib-2.0 -lSM -lICE -lXpm -lXt -lX11 -lXdmcp -lSM -lICE -lm -ltinfo -lnsl -lse
linux -lacl -lattr -lgpm -ldl -L/usr/lib/python3.5/config-3.5m-x86_64-linux-gnu -l
python3.5m -lpthread -ldl -lutil -lm
Any idea what causes the error?
I have the same issue with:
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Jul 11 2017 12:56:49)
Included patches: 1-705
Modified by <[email protected]>
Compiled by <[email protected]>
Huge version without GUI. Features included (+) or not (-):
+acl +file_in_path +mouse_sgr +tag_old_static
+arabic +find_in_path -mouse_sysmouse -tag_any_white
+autocmd +float +mouse_urxvt -tcl
-balloon_eval +folding +mouse_xterm +termguicolors
-browse -footer +multi_byte +terminfo
++builtin_terms +fork() +multi_lang +termresponse
+byte_offset +gettext -mzscheme +textobjects
+channel -hangul_input +netbeans_intg +timers
+cindent +iconv +num64 +title
-clientserver +insert_expand +packages -toolbar
-clipboard +job +path_extra +user_commands
+cmdline_compl +jumplist +perl/dyn +vertsplit
+cmdline_hist +keymap +persistent_undo +virtualedit
+cmdline_info +lambda +postscript +visual
+comments +langmap +printer +visualextra
+conceal +libcall +profile +viminfo
+cryptv +linebreak +python/dyn +vreplace
+cscope +lispindent +python3/dyn +wildignore
+cursorbind +listcmds +quickfix +wildmenu
+cursorshape +localmap +reltime +windows
+dialog_con +lua/dyn +rightleft +writebackup
+diff +menu +ruby/dyn -X11
+digraphs +mksession +scrollbind -xfontset
-dnd +modify_fname +signs -xim
-ebcdic +mouse +smartindent -xpm
+emacs_tags -mouseshape +startuptime -xsmp
+eval +mouse_dec +statusline -xterm_clipboard
+ex_extra +mouse_gpm -sun_workshop -xterm_save
+extra_search -mouse_jsbterm +syntax
+farsi +mouse_netterm +tag_binary
system vimrc file: "/etc/vimrc"
user vimrc file: "$HOME/.vimrc"
2nd user vimrc file: "~/.vim/vimrc"
user exrc file: "$HOME/.exrc"
defaults file: "$VIMRUNTIME/defaults.vim"
fall-back for $VIM: "/etc"
f-b for $VIMRUNTIME: "/usr/share/vim/vim80"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -O2 -g -pipe -Wall -Werror=format-security -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/python3.6m -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc -L. -Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -fstack-protector -rdynamic -Wl,-export-dynamic -Wl,--enable-new-dtags -Wl,-z,relro -Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -L/usr/local/lib -Wl,--as-needed -o vim -lm -lnsl -lselinux -lncurses -lacl -lattr -lgpm -ldl -Wl,--enable-new-dtags -Wl,-z,relro -Wl,-z,relro -fstack-protector-strong -L/usr/local/lib -L/usr/lib64/perl5/CORE -lperl -lpthread -lresolv -lnsl -ldl -lm -lcrypt -lutil -lc
The "E688: More targets than List items" error comes from here in ~/.vim/bundle/vim-rtags/plugin/rtags.vim:386:
375 function! rtags#JumpToHandler(results, args)
376 let results = a:results
377 let open_opt = a:args['open_opt']
378 if len(results) >= 0 && open_opt != g:SAME_WINDOW
379 call rtags#cloneCurrentBuffer(open_opt)
380 endif
381
382 if len(results) > 1
383 call rtags#DisplayResults(results)
384 elseif len(results) == 1
385 let [location; symbol_detail] = split(results[0], '\s\+')
!386 let [jump_file, lnum, col; rest] = split(location, ':')
Debugging, I see that results[0] is "Not indexed" so line 386 gives an error.
When I find time, I will try older versions of rtags, vim-rtags, or vim or in case an incompatible change was recently introduced.
I investigated further and the bug is a recent regression in vim-rtag plugin.
Snippet of git log:
commit ba58fc0aa46411a1e0b1a4442b9d31924d3892fb
Author: taku25 <[email protected]>
Date: Fri Jun 23 16:50:49 2017 +0900
imp: async. ExecuteThen Function
commit 344ffe479f7100fee4e4ac3fb6dae267224651c2
Author: taku25 <[email protected]>
Date: Fri Jun 23 14:59:42 2017 +0900
delete debug message
commit ba174ea825665cdd2d05434cf527d135657a380d
Author: taku25 <[email protected]>
Date: Fri Jun 23 14:48:24 2017 +0900
refactoring
- at ba174ea825665cdd2d05434cf527d135657a380d (Jun 23 14:48), everything works fine
- at 344ffe479f7100fee4e4ac3fb6dae267224651c2 (Jun 23 14:59), jumping to symbol works fine, but I see an error when starting vim (no apparent consequences):
Error detected while processing /home/dope/.vim/bundle/vim-rtags/plugin/rtags.vim:
line 850:
E193: :endfunction not inside a function
- at ba58fc0aa46411a1e0b1a4442b9d31924d3892fb (Jun 23 16:50), I see the same error at startup, and jumping to symbol definition with \rj no longer works.
I have the same issue, and make a workaround after some debugging work. The reason is quite simple.
The 'rc' command doesn't accept input location without path information. For example, you have a source file: '~/work/hello.c', and you can use 'rc' command to inspect if the --follow-location is working or not. Using the 'rc --follow-location hello.c:10:1' will print 'Error, can't resolve argument'. The 'rc' command expects it's input argument has the path information, no matter it is relative or absolute. Using 'rc --follow-location ~/work/hello.c' will generate the correct information.
To do so, we need to change one place of rtags##getCurrentLocation function in 'vim-rtags/plugin/rtags.vim'. Change line(334):
return printf("%s:%s:%s", expand("%"), lnum, col)
to
return printf("%s:%s:%s", expand("%:p"), lnum, col)
to make the current file name to be expand to full path when calling 'rc' command