e3749c4a75
When dializer isn't a dependency, mix dialyzer recompiles the whole project because it's not possible to know if this command dialyzer exist or not until recompilation is done. Then the timestamps of the project is messed up which results in broken hot-loading. In this case, mix help dialyzer would return zero which prevents compilation of the whole project since dialyzer isn't installed, it's help manual doesn't exist. When dialyzer is a dependency, mix dialyzer would just run the command. In this case, mix help dialyzer would return 1 which allows mix dialyzer to run.
34 lines
992 B
VimL
34 lines
992 B
VimL
" Author: Fran C. - https://github.com/franciscoj
|
|
" Description: Add dialyzer support for elixir through dialyxir
|
|
" https://github.com/jeremyjh/dialyxir
|
|
|
|
function! ale_linters#elixir#dialyxir#Handle(buffer, lines) abort
|
|
" Matches patterns line the following:
|
|
"
|
|
" lib/filename.ex:19: Function fname/1 has no local return
|
|
let l:pattern = '\v(.+):(\d+): (.+)$'
|
|
let l:output = []
|
|
let l:type = 'W'
|
|
|
|
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
|
if bufname(a:buffer) == l:match[1]
|
|
call add(l:output, {
|
|
\ 'bufnr': a:buffer,
|
|
\ 'lnum': l:match[2] + 0,
|
|
\ 'col': 0,
|
|
\ 'type': l:type,
|
|
\ 'text': l:match[3],
|
|
\})
|
|
endif
|
|
endfor
|
|
|
|
return l:output
|
|
endfunction
|
|
|
|
call ale#linter#Define('elixir', {
|
|
\ 'name': 'dialyxir',
|
|
\ 'executable': 'mix',
|
|
\ 'command': 'mix help dialyzer && mix dialyzer',
|
|
\ 'callback': 'ale_linters#elixir#dialyxir#Handle',
|
|
\})
|
|
|