From e74843c941b51aacae39dbbd5c71bfc97de5ea11 Mon Sep 17 00:00:00 2001 From: Thomas Holmes Date: Fri, 5 Jul 2013 22:32:55 -0400 Subject: [PATCH] Mix needs the cwd to be set to the mix file. --- syntax_checkers/elixir/elixir.vim | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/syntax_checkers/elixir/elixir.vim b/syntax_checkers/elixir/elixir.vim index c38b52bc..9cb9a7f5 100644 --- a/syntax_checkers/elixir/elixir.vim +++ b/syntax_checkers/elixir/elixir.vim @@ -16,10 +16,6 @@ let g:loaded_syntastic_elixir_elixir_checker=1 let s:syntastic_elixir_compile_command = 'elixir' -if filereadable(syntastic#util#findInParent('mix.exs', expand('%:p:h'))) - let s:syntastic_elixir_compile_command = 'mix compile' -endif - function! SyntaxCheckers_elixir_elixir_IsAvailable() if s:syntastic_elixir_compile_command == 'elixir' return executable('elixir') @@ -29,6 +25,18 @@ function! SyntaxCheckers_elixir_elixir_IsAvailable() endfunction function! SyntaxCheckers_elixir_elixir_GetLocList() + + let s:syntastic_elixir_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') + endif + let makeprg = syntastic#makeprg#build({ \ 'exe': s:syntastic_elixir_compile_command, \ 'filetype': 'elixir', @@ -38,7 +46,8 @@ function! SyntaxCheckers_elixir_elixir_GetLocList() return SyntasticMake({ \ 'makeprg': makeprg, - \ 'errorformat': errorformat }) + \ 'errorformat': errorformat, + \ 'cwd': cwd }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({