diff --git a/syntax_checkers/elixir/elixir.vim b/syntax_checkers/elixir/elixir.vim index 9cb9a7f5..521e9456 100644 --- a/syntax_checkers/elixir/elixir.vim +++ b/syntax_checkers/elixir/elixir.vim @@ -14,40 +14,30 @@ if exists("g:loaded_syntastic_elixir_elixir_checker") endif let g:loaded_syntastic_elixir_elixir_checker=1 -let s:syntastic_elixir_compile_command = 'elixir' - +" TODO: we should probably split this into separate checkers function! SyntaxCheckers_elixir_elixir_IsAvailable() - if s:syntastic_elixir_compile_command == 'elixir' - return executable('elixir') - else - return executable('mix') - endif + return executable('elixir') && executable('mix') endfunction function! SyntaxCheckers_elixir_elixir_GetLocList() - let s:syntastic_elixir_compile_command = 'elixir' - + let make_options = {} + let compile_command = 'elixir' let mix_file = syntastic#util#findInParent('mix.exs', expand('%:p:h')) if filereadable(mix_file) - let s:syntastic_elixir_compile_command = 'mix compile' - let cwd = fnamemodify(mix_file, ':p:h') - else - let cwd = expand('%:p:h') + let compile_command = 'mix compile' + let make_options['cwd'] = fnamemodify(mix_file, ':p:h') endif - let makeprg = syntastic#makeprg#build({ - \ 'exe': s:syntastic_elixir_compile_command, + let make_options['makeprg'] = syntastic#makeprg#build({ + \ 'exe': compile_command, \ 'filetype': 'elixir', \ 'subchecker': 'elixir' }) - let errorformat = '** %*[^\ ] %f:%l: %m' + let make_options['errorformat'] = '** %*[^\ ] %f:%l: %m' - return SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat, - \ 'cwd': cwd }) + return SyntasticMake(make_options) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({