Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LeaderfFunction raises IndexError when g:Lf_ReverseOrder is set. #329

Closed
2 of 6 tasks
wangyandongnx opened this issue May 27, 2019 · 5 comments
Closed
2 of 6 tasks
Labels

Comments

@wangyandongnx
Copy link

  • vim or neovim?
    • vim
    • neovim
  • Output of vim --version or nvim --version:
VIM - Vi IMproved 8.1 (2018 May 18, compiled Feb 18 2019 23:51:40)
macOS version
Included patches: 1-950
Compiled by [email protected]
Huge version with MacVim GUI.  Features included (+) or not (-):
+acl               -farsi             +mouse_sgr         -tag_any_white
+arabic            +file_in_path      -mouse_sysmouse    -tcl
+autocmd           +find_in_path      +mouse_urxvt       +termguicolors
+autochdir         +float             +mouse_xterm       +terminal
-autoservername    +folding           +multi_byte        +terminfo
+balloon_eval      -footer            +multi_lang        +termresponse
+balloon_eval_term +fork()            -mzscheme          +textobjects
+browse            +fullscreen        +netbeans_intg     +textprop
++builtin_terms    -gettext           +num64             +timers
+byte_offset       -hangul_input      +odbeditor         +title
+channel           +iconv             +packages          +toolbar
+cindent           +insert_expand     +path_extra        +transparency
+clientserver      +job               +perl/dyn          +user_commands
+clipboard         +jumplist          +persistent_undo   +vartabs
+cmdline_compl     +keymap            +postscript        +vertsplit
+cmdline_hist      +lambda            +printer           +virtualedit
+cmdline_info      +langmap           +profile           +visual
+comments          +libcall           +python/dyn        +visualextra
+conceal           +linebreak         +python3/dyn       +viminfo
+cryptv            +lispindent        +quickfix          +vreplace
+cscope            +listcmds          +reltime           +wildignore
+cursorbind        +localmap          +rightleft         +wildmenu
+cursorshape       +lua/dyn           +ruby/dyn          +windows
+dialog_con_gui    +menu              +scrollbind        +writebackup
+diff              +mksession         +signs             -X11
+digraphs          +modify_fname      +smartindent       -xfontset
+dnd               +mouse             +startuptime       +xim
-ebcdic            +mouseshape        +statusline        -xpm
+emacs_tags        +mouse_dec         -sun_workshop      -xsmp
+eval              -mouse_gpm         +syntax            -xterm_clipboard
+ex_extra          -mouse_jsbterm     +tag_binary        -xterm_save
+extra_search      +mouse_netterm     +tag_old_static
   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: "/Applications/MacVim.app/Contents/Resources/vim"
Compilation: clang -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_MACVIM -Wall -Wno-unknown-pragmas -pipe  -DMACOS_X -DMACOS_X_DARWIN  -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: clang   -L. -fstack-protector-strong -L/usr/local/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/readline/lib -L. -fstack-protector-strong -L/usr/local/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/readline/lib  -L/usr/local/lib -o Vim -framework Cocoa -framework Carbon       -lm  -lncurses -liconv -framework AppKit   -fstack-protector  -L/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE
  • Output of :echo has("python"):
0
  • Output of :echo has("python3"):
1
  • Output of :echo &pythondll(only vim, not neovim):
/usr/local/Frameworks/Python.framework/Versions/2.7/Python
  • Output of :echo &pythonthreedll(only vim, not neovim):
/usr/local/Frameworks/Python.framework/Versions/3.7/Python
  • Output of :py print(sys.version):
E836: This Vim cannot execute :python after using :py3
E263: Sorry, this command is disabled, the Python library could not be loaded.
  • Output of :py3 print(sys.version):
3.7.3 (default, Mar 27 2019, 09:23:15)
[Clang 10.0.1 (clang-1001.0.46.3)]
  • Output of :echo g:Lf_Debug_Cmd:
  • Output of :echo g:Lf_FilesFromCache:
  • Operating system:
    • Linux
    • Mac OS X
    • Windows
    • Etc.
  • Configurations related to LeaderF in vimrc:
Plug 'Yggdroot/LeaderF', { 'do': './install.sh' }

let g:Lf_ReverseOrder = 1

Describe your question, feature request, or bug.

LeaderfFunction raises IndexError when g:Lf_ReverseOrder is set.

Steps to reproduce

  1. Example golang code
package main

import (
	"fmt"
)

func hello() {
	fmt.Println("hello")
}

func world() {
	fmt.Println("world")
}

func main() {
	hello()
	world()
}
  1. Launch :LeaderfFunction and then press Tab key.
  2. Press Down Arrow key cause IndexError
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/wangyandong/.vim/plugged/LeaderF/autoload/leaderf/python/leaderf/functionExpl.py", line 330, in _previewR
esult
    self._acceptSelection(line)
  File "/Users/wangyandong/.vim/plugged/LeaderF/autoload/leaderf/python/leaderf/functionExpl.py", line 230, in _acceptSe
lection
    line = line.rsplit("\t", 1)[1][1:-1]    # file:line buf_number
IndexError: list index out of range

Screen Shot 2019-05-27 at 18 38 29

Screen Shot 2019-05-27 at 18 38 45

Screen Shot 2019-05-27 at 18 32 35

Actual behaviour

IndexError

Expected behaviour

LeaderfFunction should not raise any IndexError.

@Yggdroot
Copy link
Owner

I can not reproduce this issue.

@Yggdroot
Copy link
Owner

Reproduced.

@Yggdroot Yggdroot added the bug label May 28, 2019
@wangyandongnx
Copy link
Author

wangyandongnx commented May 28, 2019

I can not reproduce this issue.

I've tried this in a vagrant machine, and it still gets the IndexError.

vagrant@ubuntu-bionic:~$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 18.04.2 LTS
Release:	18.04
Codename:	bionic
vagrant@ubuntu-bionic:~$ vim --version
VIM - Vi IMproved 8.1 (2018 May 18, compiled May 27 2019 13:46:23)
Included patches: 1-1408
Modified by [email protected]
Compiled by [email protected]
Huge version without GUI.  Features included (+) or not (-):
+acl               +extra_search      +mouse_netterm     -tag_old_static
+arabic            -farsi             +mouse_sgr         -tag_any_white
+autocmd           +file_in_path      -mouse_sysmouse    -tcl
+autochdir         +find_in_path      +mouse_urxvt       +termguicolors
-autoservername    +float             +mouse_xterm       +terminal
-balloon_eval      +folding           +multi_byte        +terminfo
+balloon_eval_term -footer            +multi_lang        +termresponse
-browse            +fork()            -mzscheme          +textobjects
++builtin_terms    +gettext           +netbeans_intg     +textprop
+byte_offset       -hangul_input      +num64             +timers
+channel           +iconv             +packages          +title
+cindent           +insert_expand     +path_extra        -toolbar
-clientserver      +job               -perl              +user_commands
-clipboard         +jumplist          +persistent_undo   +vartabs
+cmdline_compl     +keymap            +postscript        +vertsplit
+cmdline_hist      +lambda            +printer           +virtualedit
+cmdline_info      +langmap           +profile           +visual
+comments          +libcall           -python            +visualextra
+conceal           +linebreak         +python3           +viminfo
+cryptv            +lispindent        +quickfix          +vreplace
+cscope            +listcmds          +reltime           +wildignore
+cursorbind        +localmap          +rightleft         +wildmenu
+cursorshape       -lua               -ruby              +windows
+dialog_con        +menu              +scrollbind        +writebackup
+diff              +mksession         +signs             -X11
+digraphs          +modify_fname      +smartindent       -xfontset
-dnd               +mouse             +startuptime       -xim
-ebcdic            -mouseshape        +statusline        -xpm
+emacs_tags        +mouse_dec         -sun_workshop      -xsmp
+eval              +mouse_gpm         +syntax            -xterm_clipboard
+ex_extra          -mouse_jsbterm     +tag_binary        -xterm_save
   system vimrc file: "$VIM/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: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H   -Wdate-time  -g -O2 -fdebug-prefix-map=/build/vim-8Y2wWO/vim-8.1.1408=. -fstack-protector-strong -Wformat -Werror=format-security -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc   -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -o vim        -lm -ltinfo -lnsl  -lselinux  -lacl -lattr -lgpm -ldl     -L/usr/lib/python3.6/config-3.6m-x86_64-linux-gnu -lpython3.6m -lpthread -ldl -lutil -lm

$MYVIMRC

if empty(glob('~/.vim/autoload/plug.vim'))
  silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
    \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
  autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif

call plug#begin('~/.vim/plugged')

Plug 'Yggdroot/LeaderF', { 'do': './install.sh' }

call plug#end()

let g:Lf_ReverseOrder = 1

ezgif-1-8b908b8fa21b

Yggdroot added a commit that referenced this issue May 28, 2019
@Yggdroot
Copy link
Owner

Fixed.

@wangyandongnx
Copy link
Author

Fixed.

Good work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants