maralla / completor.vim

Async completion framework made ease.
MIT License
1.27k stars 63 forks source link

Overwrites string arguments when using tern completion #243

Open strange opened 5 years ago

strange commented 5 years ago

Description

Arguments are replaced when a string is present as an argument to a function during completion in JavaScript files.

Steps to reproduce

Open test.js and enter the following:

const longVariableName = 'abc';
console.log('abc', lo

The pum is displayed and I select longVariableName.

Expected outcome

longVariableName is inserted as an argument and the editor displays the following:

const longVariableName = 'abc';
console.log('abc', longVariableName

Actual outcome

longVariableName is inserted, but all other arguments are removed:

const longVariableName = 'abc';
console.log(longVariableName

It seems to erase back to the first quotation mark of the first string argument. Other arguments such as variable names, integers, booleans etc are unaffected.

Context

:version                                                                                                                                                                       
VIM - Vi IMproved 8.1 (2018 May 18, compiled Dec  8 2018 11:23:48)                                                                                                             
Included patches: 1-570                                                                                                                                                        
Compiled by Arch Linux                                                                                                                                                         
Huge version with GTK3 GUI.  Features included (+) or not (-):                                                                                                                 
+acl               +cmdline_compl     +emacs_tags        +insert_expand     +modify_fname      +netbeans_intg     +ruby/dyn          +terminfo          +wildignore            
+arabic            +cmdline_hist      +eval              +job               +mouse             +num64             +scrollbind        +termresponse      +wildmenu              
+autocmd           +cmdline_info      +ex_extra          +jumplist          +mouseshape        +packages          +signs             +textobjects       +windows               
+autochdir         +comments          +extra_search      +keymap            +mouse_dec         +path_extra        +smartindent       +timers            +writebackup           
-autoservername    +conceal           +farsi             +lambda            +mouse_gpm         +perl/dyn          +startuptime       +title             +X11                   
+balloon_eval      +cryptv            +file_in_path      +langmap           -mouse_jsbterm     +persistent_undo   +statusline        +toolbar           -xfontset              
+balloon_eval_term +cscope            +find_in_path      +libcall           +mouse_netterm     +postscript        -sun_workshop      +user_commands     +xim                   
+browse            +cursorbind        +float             +linebreak         +mouse_sgr         +printer           +syntax            +vartabs           -xpm                   
++builtin_terms    +cursorshape       +folding           +lispindent        -mouse_sysmouse    +profile           +tag_binary        +vertsplit         +xsmp_interact         
+byte_offset       +dialog_con_gui    -footer            +listcmds          +mouse_urxvt       +python/dyn        +tag_old_static    +virtualedit       +xterm_clipboard       
+channel           +diff              +fork()            +localmap          +mouse_xterm       +python3/dyn       -tag_any_white     +visual            -xterm_save            
+cindent           +digraphs          +gettext           +lua/dyn           +multi_byte        +quickfix          +tcl/dyn           +visualextra                              
+clientserver      +dnd               -hangul_input      +menu              +multi_lang        +reltime           +termguicolors     +viminfo                                  
+clipboard         -ebcdic            +iconv             +mksession         -mzscheme          +rightleft         +terminal          +vreplace                                 
   system vimrc file: "/etc/vimrc"                                                                                                                                             
     user vimrc file: "$HOME/.vimrc"                                                                                                                                           
 2nd user vimrc file: "~/.vim/vimrc"                                                                                                                                           
      user exrc file: "$HOME/.exrc"                                                                                                                                            
  system gvimrc file: "/etc/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/share/vim"                                                                                                                                         
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK  -I/usr/include/gtk-3.0 -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/lib/
libffi-3.2.1/include -I/usr/include/fribidi -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/harfbuzz -I/usr/includ
e/uuid -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/gio-unix-2.0 -I/usr/include/libdrm -I/usr/include/atk-1.0 -I/usr/include/at-sp
i2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include -pthread  -D_FORTIFY_SOURCE=2  -march=x86-64 -mtune=generic -O2 -pipe -fstack-protecto
r-strong -fno-plt -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1                                                                                                                        
Linking: gcc   -L. -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -fstack-protector -rdynamic -Wl,-export-dynamic -Wl,-E -Wl,-rpath,/usr/lib/perl5/5.28/core_perl/CORE  -Wl,
-O1,--sort-common,--as-needed,-z,relro,-z,now -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_pi
xbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0  -lSM -lICE -lXt -lX11 -lXdmcp -lSM -lICE  -lm -ltinfo -lelf -lnsl    -lacl -lattr -lgpm -ldl   -Wl,-E -Wl,-rpath,/usr/lib/perl5/5.
28/core_perl/CORE -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -fstack-protector-strong -L/usr/local/lib  -L/usr/lib/perl5/5.28/core_perl/CORE -lperl -lpthread -ldl -lm -
lcrypt -lutil -lc   -L/usr/lib -ltclstub8.6 -ldl -lz -lpthread -lm  
amadeus commented 5 years ago

Yeah this bug is super destructive because often it happens in the middle of an insertion and u won't undo it the way you'd usually want it to.

scwood commented 5 years ago

Any updates on this issue? Looks like something was merged in but this is still broken for me.

Screen Shot 2019-04-09 at 1 53 44 PM

Screen Shot 2019-04-09 at 1 53 52 PM

.vimrc:

call plug#begin($HOME . '/.vim/plugged')
Plug 'maralla/completor.vim', { 'do': 'make js' }
let g:completor_node_binary = '/usr/local/bin/node'
call plug#end()
amadeus commented 5 years ago

Yeah, the merged PR fixed some cases of it, but not all

soyuka commented 4 years ago

Can confirm the issue is still present