vim-erlang / vim-erlang-compiler

Erlang syntax checking and compiler plugin for Vim
https://vim-erlang.github.io
56 stars 24 forks source link

:make Error "Usage|| see --help." #37

Open vimalk78 opened 7 years ago

vimalk78 commented 7 years ago

whenever there is a syntax error in the erlang file, and upon saving the file, the error window appears, the :make command always fails with above error after fixing the error.

i have to quit and reopen the erlang file to make :make work.

hcs42 commented 7 years ago

Could you send a screenshot and your Vim version? (:version) Does it happen with any Erlang file that has a syntax error?

vimalk78 commented 7 years ago
:version
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Jul 12 2016 20:31:32)
Included patches: 1-2028
Compiled by vimal@BLR1000011929
Huge version with GTK2 GUI.  Features included (+) or not (-):
+acl             +cmdline_compl   +digraphs        +folding         +libcall         +mouse_dec       -netbeans_intg   +quickfix        +tag_binary      +user_commands   +X11
+arabic          +cmdline_hist    +dnd             -footer          +linebreak       -mouse_gpm       +num64           +reltime         +tag_old_static  +vertsplit       -xfontset
+autocmd         +cmdline_info    -ebcdic          +fork()          +lispindent      -mouse_jsbterm   +packages        +rightleft       -tag_any_white   +virtualedit     +xim
+balloon_eval    +comments        +emacs_tags      +gettext         +listcmds        +mouse_netterm   +path_extra      +ruby            -tcl             +visual          +xsmp_interact
+browse          +conceal         +eval            -hangul_input    +localmap        +mouse_sgr       +perl            +scrollbind      +termguicolors   +visualextra     +xterm_clipboard
++builtin_terms  +cryptv          +ex_extra        +iconv           +lua             -mouse_sysmouse  +persistent_undo +signs           +terminfo        +viminfo         -xterm_save
+byte_offset     +cscope          +extra_search    +insert_expand   +menu            +mouse_urxvt     +postscript      +smartindent     +termresponse    +vreplace        +xpm
+channel         +cursorbind      +farsi           +job             +mksession       +mouse_xterm     +printer         +startuptime     +textobjects     +wildignore
+cindent         +cursorshape     +file_in_path    +jumplist        +modify_fname    +multi_byte      +profile         +statusline      +timers          +wildmenu
+clientserver    +dialog_con_gui  +find_in_path    +keymap          +mouse           +multi_lang      +python          -sun_workshop    +title           +windows
+clipboard       +diff            +float           +langmap         +mouseshape      -mzscheme        -python3         +syntax          +toolbar         +writebackup
   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"
    system menu file: "$VIMRUNTIME/menu.vim"
  fall-back for $VIM: "/usr/local/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK  -pthread -I/usr/include/gtk-2.0 -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr
/include/gdk-pixbuf-2.0 -I/usr/include/pango-1.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/freetype2 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pix
man-1 -I/usr/include/libpng12 -I/usr/include/harfbuzz     -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc   -L. -Wl,-Bsymbolic-functions -Wl,-z,relro -L/build/buildd/ruby1.9.1-1.9.3.484/debian/lib -rdynamic -Wl,-export-dynamic -Wl,-E   -L/usr/local/lib -Wl,--as-needed -o vim   -lgtk
-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo -lpango-1.0 -lfontconfig -lgobject-2.0 -lglib-2.0 -lfreetype   -lSM -lICE -lXpm -lXt -lX11
 -lXdmcp -lSM -lICE  -lm -ltinfo -lnsl  -lselinux  -ldl  -L/usr/include/lua5.1/lib/x86_64-linux-gnu -lluajit-5.1 -Wl,-E  -fstack-protector -L/usr/local/lib  -L/usr/lib/perl/5.18/CORE -lperl
-ldl -lm -lpthread -lcrypt -L/usr/lib/python2.7/config-x86_64-linux-gnu -lpython2.7 -lpthread -ldl -lutil -lm -Xlinker -export-dynamic -Wl,-O1 -Wl,-Bsymbolic-functions   -lruby-1.9.1 -lpthre
ad -lrt -ldl -lcrypt -lm  -L/usr/lib
vimalk78 commented 7 years ago

yes, it happens with any erlang file which has syntax error. even after correcting the errors, the :make results in same error

vimalk78 commented 7 years ago

i am using following vim plugins

$ ls
bufexplorer/  dirsettings/         nerdtree/   tagbar/       vim-airline-themes/  vim-erlang-compiler/      vim-erlang-runtime/  vim-go   YouCompleteMe/
ctrlp.vim/    erlang-motions.vim/  syntastic/  vim-airline/  vim-bufonly/         vim-erlang-omnicomplete/  vim-erlang-tags/     vim-qf/
hcs42 commented 7 years ago

Thanks for the plugin list. Could you disable Syntasic? It is known to cause issues for vim-erlang-compiler: https://github.com/vim-erlang/vim-erlang-compiler/issues/35

vimalk78 commented 7 years ago

i moved syntastic out of ~/.vim/bundle to ~/.vim/backups

and tried to recreate the error, but i am getting same behaviour. i.e. :make doesnt work after an error introduced and then removed.

if i reload the file, :make works

hcs42 commented 7 years ago

Could you sent a screenshot?

vimalk78 commented 7 years ago
  1. Introduce Error error1

  2. Fix Error error2

  3. Do :make error3

hcs42 commented 7 years ago

Could you type this when :make doesn't work and send the output?

:verbose set makeprg?

makeprg is supposed to look like this:

makeprg=.../vim-erlang-compiler/compiler/erlang_check.erl --outdir . %

:make should replace % with the file name and pass it to erlang_check.erl. But it seems that nothing is passed to erlang_check, not even --outdir, because erlang_check prints "Usage: see --help." only when it gets no parameters at all.

vimalk78 commented 7 years ago

when :make doesn't work, the makeprg is :

  makeprg=~/.vim/bundle/vim-erlang-compiler/compiler/erlang_check.erl
        Last set from ~/.vim/bundle/vim-erlang-compiler/autoload/erlang_compiler.vim

if reload the file, and :make works, the makeprg is set to :

  makeprg=~/.vim/bundle/vim-erlang-compiler/compiler/erlang_check.erl --outdir . %
        Last set from ~/.vim/bundle/vim-erlang-compiler/ftplugin/erlang.vim

i checked filetype, it is set to erlang in both cases.

hcs42 commented 7 years ago

I added a few debug printouts that will help to narrow down the problem.

Could you do the following:

  1. Check out the debug_printouts branch.

  2. Open the Erlang file in Vim, introduce error, fix error, do :make.

  3. Type :messages to see the debug printouts and send the output.

When you save an Erlang file and the errors are automatically shown, erlang_compiler.vim temporarily modifies makeprg (removing the "--outdir . %" parameters). Afterwards it resets the original makeprg. It looks as if makeprg wasn't reset in your case.

When I save an Erlang file, I see this in :messages:

GetLocalInfo makeprg: /home/hcs/Dropbox/cp/vim-erlang/vim-erlang-compiler/compiler/erlang_check.erl --outdir . %
GetFlymakeOptions flymake_options:
AutoRun makeprg: /home/hcs/Dropbox/cp/vim-erlang/vim-erlang-compiler/compiler/erlang_check.erl
SetLocalInfo makeprg: /home/hcs/Dropbox/cp/vim-erlang/vim-erlang-compiler/compiler/erlang_check.erl --outdir . %

This means that GetLocalInfo saves the options, AutoRun modified them, and then SetLocalInfo resets the original value.

vimalk78 commented 7 years ago

i get the following output

Messages maintainer: Bram Moolenaar <Bram@vim.org>
"process.erl" 45L, 1093C
"process.erl" 45L, 1094C written
GetLocalInfo makeprg: /home/vimal/.vim/bundle/vim-erlang-compiler/compiler/erlang_check.erl --outdir . %
GetFlymakeOptions flymake_options:
AutoRun makeprg: /home/vimal/.vim/bundle/vim-erlang-compiler/compiler/erlang_check.erl
SetLocalInfo makeprg: /home/vimal/.vim/bundle/vim-erlang-compiler/compiler/erlang_check.erl --outdir . %
"process.erl" 45L, 1093C written
GetLocalInfo makeprg: /home/vimal/.vim/bundle/vim-erlang-compiler/compiler/erlang_check.erl
GetFlymakeOptions flymake_options:
AutoRun makeprg: /home/vimal/.vim/bundle/vim-erlang-compiler/compiler/erlang_check.erl
SetLocalInfo makeprg: /home/vimal/.vim/bundle/vim-erlang-compiler/compiler/erlang_check.erl
"Usage" 0L, 0C
"process.erl" 45L, 1093C
vimalk78 commented 7 years ago

i think i narrowed down the issue to one plugin.

vim-qf https://github.com/romainl/vim-qf

if i remove this plugin, :make works and the output from debug_prinouts branch plugin is :

Messages maintainer: Bram Moolenaar <Bram@vim.org>
"process.erl" 45L, 1093C
"process.erl" 45L, 1094C written
GetLocalInfo makeprg: /home/vimal/.vim/bundle/vim-erlang-compiler/compiler/erlang_check.erl --outdir . %
GetFlymakeOptions flymake_options:
AutoRun makeprg: /home/vimal/.vim/bundle/vim-erlang-compiler/compiler/erlang_check.erl
SetLocalInfo makeprg: /home/vimal/.vim/bundle/vim-erlang-compiler/compiler/erlang_check.erl --outdir . %
"process.erl" 45L, 1093C written
GetLocalInfo makeprg: /home/vimal/.vim/bundle/vim-erlang-compiler/compiler/erlang_check.erl --outdir . %
GetFlymakeOptions flymake_options:
AutoRun makeprg: /home/vimal/.vim/bundle/vim-erlang-compiler/compiler/erlang_check.erl
SetLocalInfo makeprg: /home/vimal/.vim/bundle/vim-erlang-compiler/compiler/erlang_check.erl --outdir . %

not sure how this plugin resets the makeprg , did not find any makeprg keyword in this plugin source