Merge pull request #534 from xandox/master
Use mix for elixir if it available and vim started from project root
This commit is contained in:
commit
e61aab2b12
@ -14,19 +14,25 @@ if exists("g:loaded_syntastic_elixir_elixir_checker")
|
||||
endif
|
||||
let g:loaded_syntastic_elixir_elixir_checker=1
|
||||
|
||||
let s:syntastic_elixir_compile_command = 'elixir'
|
||||
|
||||
if filereadable('mix.exs')
|
||||
let s:syntastic_elixir_compile_command = 'mix compile'
|
||||
endif
|
||||
|
||||
function! SyntaxCheckers_elixir_elixir_IsAvailable()
|
||||
return executable('elixir')
|
||||
if s:syntastic_elixir_compile_command == 'elixir'
|
||||
return executable('elixir')
|
||||
else
|
||||
return executable('mix')
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! SyntaxCheckers_elixir_elixir_GetLocList()
|
||||
let makeprg = syntastic#makeprg#build({ 'exe': 'elixir' })
|
||||
let makeprg = syntastic#makeprg#build({ 'exe': s:syntastic_elixir_compile_command })
|
||||
let errorformat = '** %*[^\ ] %f:%l: %m'
|
||||
|
||||
let elixir_results = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
|
||||
|
||||
if !empty(elixir_results)
|
||||
return elixir_results
|
||||
endif
|
||||
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
|
||||
endfunction
|
||||
|
||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
|
Loading…
Reference in New Issue
Block a user