mirror of
https://github.com/dense-analysis/ale
synced 2024-12-11 17:06:52 +00:00
22 lines
746 B
VimL
22 lines
746 B
VimL
" Author: Daniel Schemala <istjanichtzufassen@gmail.com>
|
|
" Description: rustc invoked by cargo for rust files
|
|
|
|
|
|
function! ale_linters#rust#cargo#GetCargoExecutable(bufnr)
|
|
if ale#util#FindNearestFile(a:bufnr, 'Cargo.toml') !=# ''
|
|
return 'cargo'
|
|
else
|
|
" if there is no Cargo.toml file, we don't use cargo even if it exists,
|
|
" so we return '', because executable('') apparently always fails
|
|
return ''
|
|
endif
|
|
endfunction
|
|
|
|
call ale#linter#Define('rust', {
|
|
\ 'name': 'cargo',
|
|
\ 'executable_callback': 'ale_linters#rust#cargo#GetCargoExecutable',
|
|
\ 'command': 'cargo rustc -- --error-format=json -Z no-trans',
|
|
\ 'callback': 'ale_linters#rust#rustc#HandleRustcErrors',
|
|
\ 'output_stream': 'stderr',
|
|
\})
|