dense-analysis / ale

Check syntax in Vim/Neovim asynchronously and fix files, with Language Server Protocol (LSP) support
BSD 2-Clause "Simplified" License
13.55k stars 1.43k forks source link

Elm: option --output: acceptable arguments to this flag include: any file that ends with .html or .js #980

Closed Kazark closed 7 years ago

Kazark commented 7 years ago

Problem

I just installed ALE, replacing Syntastic, to use with Elm[-vim]. When I load an Vim buffer, I get exactly one complaint, at the top of the file:

option --output: acceptable arguments to this flag include: any file that ends with .html or .js

My Solution

I was able to fix this by commenting out one line:

diff --git a/ale_linters/elm/make.vim b/ale_linters/elm/make.vim index 4038e3b..e1875a8 100644 --- a/ale_linters/elm/make.vim +++ b/ale_linters/elm/make.vim @@ -75,7 +75,7 @@ function! ale_linters#elm#make#GetCommand(buffer) abort " Source: https://github.com/elm-lang/elm-make/blob/master/src/Flags.hs let l:elm_cmd = ale#Escape(l:elm_exe) \ . ' --report=json'

  • \ . ' --output=' . ale#Escape(g:ale#util#nul_file)
  • "\ . ' --output=' . ale#Escape(g:ale#util#nul_file)

    return l:dir_set_cmd . ' ' . l:elm_cmd . ' %t' endfunction

After that, I am able to get errors like I would expect, but once I fix them all I get another top-level error saying

Successfully generated index.html

For which I changed another line, resulting in:

diff --git a/ale_linters/elm/make.vim b/ale_linters/elm/make.vim index 4038e3b..cb98e14 100644 --- a/ale_linters/elm/make.vim +++ b/ale_linters/elm/make.vim @@ -40,7 +40,7 @@ function! ale_linters#elm#make#Handle(buffer, lines) abort }) endif endfor

  • elseif l:line isnot# 'Successfully generated /dev/null'
  • elseif match(l:line, 'Successfully generated') != 0 call add(l:unparsed_lines, l:line) endif endfor @@ -75,7 +75,7 @@ function! ale_linters#elm#make#GetCommand(buffer) abort " Source: https://github.com/elm-lang/elm-make/blob/master/src/Flags.hs let l:elm_cmd = ale#Escape(l:elm_exe) \ . ' --report=json'
  • \ . ' --output=' . ale#Escape(g:ale#util#nul_file)
  • "\ . ' --output=' . ale#Escape(g:ale#util#nul_file)

    return l:dir_set_cmd . ' ' . l:elm_cmd . ' %t' endfunction

Detailed Info

I am on Elm 0.18.0:

$ elm --version 0.18.0

I'm running Windows 7. Vim info:

:version VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Sep 10 2017 15:52:48) MS-Windows 64-bit console version Included patches: 1-1088 Compiled by hp@HP-PC Huge version without GUI. Features included (+) or not (-): +acl +channel +comments +diff +extra_search +gettext/dyn +lambda +lua/dyn +multi_lang +persistent_undo +reltime +statusline +termguicolors -toolbar +vreplace -xpm_w32 +arabic +cindent +conceal +digraphs +farsi -hangul_input +langmap +menu +mzscheme/dyn -postscript +rightleft -sun_workshop +terminal +user_commands +wildignore -xterm_save +autocmd +clientserver +cryptv -dnd +file_in_path +iconv/dyn +libcall +mksession -netbeans_intg +printer +ruby/dyn +syntax -tgetent +vertsplit +wildmenu -balloon_eval +clipboard +cscope -ebcdic +find_in_path +insert_expand +linebreak +modify_fname +num64 +profile +scrollbind +tag_binary -termresponse +virtualedit +windows -browse +cmdline_compl +cursorbind +emacs_tags +float +job +lispindent +mouse +packages +python/dyn +signs +tag_old_static +textobjects +visual +writebackup ++builtin_terms +cmdline_hist +cursorshape +eval +folding +jumplist +listcmds -mouseshape +path_extra +python3/dyn +smartindent -tag_any_white +timers +visualextra -xfontset +byte_offset +cmdline_info +dialog_con +ex_extra -footer +keymap +localmap +multi_byte +perl/dyn +quickfix +startuptime +tcl/dyn +title +viminfo -xim system vimrc file: "$VIM\vimrc" user vimrc file: "$HOME_vimrc" 2nd user vimrc file: "$HOME\vimfiles\vimrc" 3rd user vimrc file: "$VIM_vimrc" user exrc file: "$HOME_exrc" 2nd user exrc file: "$VIM_exrc" defaults file: "$VIMRUNTIME\defaults.vim" Compilation: cl -c /W3 /nologo -I. -Iproto -DHAVE_PATHDEF -DWIN32 -DFEAT_CSCOPE -DFEAT_TERMINAL -DFEAT_JOB_CHANNEL -DWINVER=0x0501 -D_WIN32_WINNT=0x0501 /MP -DHAVE_STDINT_H /Ox /GL -DNDEBUG /MD -DFEAT_MBYTE -DDYNAMIC_ICONV -DDYNAMIC_GETTEXT -DFEAT_TCL -DDYNAMIC_TCL -DDYNAMIC_TCL_DLL=\"tcl86.dll\" -DDYNAMIC_TCL_VER=\"8.6\" -DFEAT_LUA -DDYNAMIC_LUA -DDYNAMIC_LUA_DLL=\"lua53.dll\" -DFEAT_PYTHON -DDYNAMIC_PYTHON -DDYNAMIC_PYTHON_DLL=\"python27.dll\" -DFEAT_PYTHON3 -DDYNAMIC_PYTHON3 -DDYNAMIC_PYTHON3_DLL=\"python36.dll\" -DFEAT_MZSCHEME -I "C:\Users\hp\Desktop\racket-x64\include" -DDYNAMIC_MZSCHEME -DDYNAMIC_MZSCH_DLL=\"libracketxxxxxxx.dll\" -DDYNAMIC_MZGC_DLL=\"libmzgcxxxxxxx.dll\" -DFEAT_PERL -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DDYNAMIC_PERL -DDYNAMIC_PERL_DLL=\"perl526.dll\" -DFEAT_RUBY -DDYNAMIC_RUBY -DDYNAMIC_RUBY_VER=24 -DDYNAMIC_RUBY_DLL=\"x64-msvcrt-ruby240.dll\" -DFEAT_HUGE /Fd.\ObjCULYHTRZAMD64/ /Zi Linking: link /RELEASE /nologo /subsystem:console /LTCG:STATUS oldnames.lib kernel32.lib advapi32.lib shell32.lib gdi32.lib comdlg32.lib ole32.lib uuid.lib /machine:AMD64 msvcrt.lib user32.lib /nodefaultlib:lua53.lib /STACK:8388608 /nodefaultlib:python27.lib /nodefaultlib:python36.lib "C:\TCL\lib\tclstub86.lib" WSock32.lib /PDB:vim.pdb -debug

Output of :ALEInfoToClipboard:

 Current Filetype: elm
Available Linters: ['make']
  Enabled Linters: ['make']
 Linter Variables:

let g:ale_elm_make_executable = 'elm-make'
let g:ale_elm_make_use_global = 0
 Global Variables:

let g:ale_echo_cursor = 1
let g:ale_echo_msg_error_str = 'Error'
let g:ale_echo_msg_format = '%s'
let g:ale_echo_msg_warning_str = 'Warning'
let g:ale_enabled = 1
let g:ale_fix_on_save = 0
let g:ale_fixers = {}
let g:ale_keep_list_window_open = 0
let g:ale_lint_delay = 200
let g:ale_lint_on_enter = 1
let g:ale_lint_on_save = 1
let g:ale_lint_on_text_changed = 'always'
let g:ale_linter_aliases = {}
let g:ale_linters = {}
let g:ale_open_list = 0
let g:ale_set_highlights = 1
let g:ale_set_loclist = 1
let g:ale_set_quickfix = 0
let g:ale_set_signs = 1
let g:ale_sign_column_always = 0
let g:ale_sign_error = '>>'
let g:ale_sign_offset = 1000000
let g:ale_sign_warning = '--'
let g:ale_statusline_format = ['%d error(s)', '%d warning(s)', 'OK']
let g:ale_warn_about_trailing_whitespace = 1
  Command History:

(executable check - success) elm-make
(started) 'cmd /c cd C:\bitbucket\automation\pitchfork\web &&  elm-make --report=json --output=nul C:\Users\pinson\AppData\Local\Temp\VIC102E.tmp\Fork.elm'
(finished - exit code 1) 'cmd /c cd C:\bitbucket\automation\pitchfork\web &&  elm-make --report=json --output=nul C:\Users\pinson\AppData\Local\Temp\VID104E.tmp\Fork.elm'

<<<OUTPUT STARTS>>>
option --output: acceptable arguments to this flag include: any file that ends with .html or .js

elm-make 0.18 (Elm Platform 0.18.0)

Usage: elm-make [FILES...] [--output FILE] [--yes] [--report FORMAT] [--debug]
                [--warn] [--docs FILE] [--prepublish] [--prepublish-core]
  build Elm projects

Available options:
  -h,--help                Show this help text
  --output FILE            Write result to the given .html or .js FILE.
  --yes                    Reply 'yes' to all automated prompts.
  --report FORMAT          Format of error and warning reports (e.g.
                           --report=json)
  --debug                  Generate programs in debug mode.
  --warn                   Report warnings to improve code quality.
  --docs FILE              Write documentation to FILE as JSON.

Examples:
  elm-make Main.elm                     # compile to HTML in index.html
  elm-make Main.elm --output main.html  # compile to HTML in main.html
  elm-make Main.elm --output elm.js     # compile to JS in elm.js
  elm-make Main.elm --warn              # compile and report warnings

Full guide to using elm-make at <https://github.com/elm-lang/elm-make>
<<<OUTPUT ENDS>>>

Reproducing the problem myself on the command-line:

$ elm-make --yes src/Main.elm --output=nul option --output: acceptable arguments to this flag include: any file that ends with .html or .js

elm-make 0.18 (Elm Platform 0.18.0)

Usage: elm-make.exe [FILES...] [--output FILE] [--yes] [--report FORMAT] [--debug] [--warn] [--docs FILE] [--prepublish] [--prepublish-core] build Elm projects

Available options: -h,--help Show this help text --output FILE Write result to the given .html or .js FILE. --yes Reply 'yes' to all automated prompts. --report FORMAT Format of error and warning reports (e.g. --report=json) --debug Generate programs in debug mode. --warn Report warnings to improve code quality. --docs FILE Write documentation to FILE as JSON.

Examples: elm-make Main.elm # compile to HTML in index.html elm-make Main.elm --output main.html # compile to HTML in main.html elm-make Main.elm --output elm.js # compile to JS in elm.js elm-make Main.elm --warn # compile and report warnings

Full guide to using elm-make at https://github.com/elm-lang/elm-make

Kazark commented 7 years ago

I think I've actually solved this now. Looks like elm-make only respects /dev/null, even on Windows. The person who wrote this linter maybe did not test it on Windows, and wrote the code in the way you would expect to be solid by using NUL on Windows. However it seems elm-make is not actually making use of /dev/null but rather using it as a form of flag. I will submit a PR.

Kazark commented 7 years ago

Fixed in #981

w0rp commented 7 years ago

I'm not surprised by that /dev/null behaviour. The same thing happend with one of the Go tools too.

w0rp commented 7 years ago

I was going to cherry-pick this for a 1.5.x release, but the bug was only present on master. Thank you for fixing this!

Kazark commented 7 years ago

@w0rp Sure! Thanks for ALE!