diff options
author | Colby Dehart <colbydehart@gmail.com> | 2018-06-06 22:58:32 -0500 |
---|---|---|
committer | Colby Dehart <colbydehart@gmail.com> | 2018-06-07 10:09:08 -0500 |
commit | f0f569f14a18459dcd99a381c5776f7464dfb125 (patch) | |
tree | 82b9e50d19d298b7d69dd3fa2ecc0a374edabd69 /ale_linters/elixir/mix.vim | |
parent | 81739be0a04956458471f196874d4206b21e60fb (diff) | |
download | ale-f0f569f14a18459dcd99a381c5776f7464dfb125.zip |
added test for command callback
Diffstat (limited to 'ale_linters/elixir/mix.vim')
-rw-r--r-- | ale_linters/elixir/mix.vim | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/ale_linters/elixir/mix.vim b/ale_linters/elixir/mix.vim index c4beb42d..25ee8fb8 100644 --- a/ale_linters/elixir/mix.vim +++ b/ale_linters/elixir/mix.vim @@ -30,8 +30,16 @@ function! ale_linters#elixir#mix#Handle(buffer, lines) abort return l:output endfunction +function! ale_linters#elixir#mix#FindProjectRoot(buffer) abort + let l:project_root = ale#path#FindNearestFile(a:buffer, 'mix.exs') + if !empty(l:project_root) + return fnamemodify(l:project_root, ':h') + endif + return '' +endfunction + function! ale_linters#elixir#mix#GetCommand(buffer) abort - let l:project_root = fnamemodify(ale#path#FindNearestFile(a:buffer, 'mix.exs'), ':h') + let l:project_root = ale_linters#elixir#mix#FindProjectRoot(a:buffer) let l:temp_dir = ale#engine#CreateDirectory(a:buffer) @@ -49,4 +57,5 @@ call ale#linter#Define('elixir', { \ 'executable': 'mix', \ 'command_callback': 'ale_linters#elixir#mix#GetCommand', \ 'callback': 'ale_linters#elixir#mix#Handle', +\ 'lint_file': 1, \}) |