From bf1ac8e822835ac2b0e1173e1e014c773b8e51a6 Mon Sep 17 00:00:00 2001 From: Matteo Centenaro Date: Wed, 10 Oct 2018 18:19:47 +0200 Subject: FIX: use mix from the project root directory (#1954) * FIX: use mix from the project root directory * Move find root project function to autoloaded handlers * add tests for #ale#handlers#elixr#FindMixProjectRoot --- ale_linters/elixir/mix.vim | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) (limited to 'ale_linters/elixir/mix.vim') diff --git a/ale_linters/elixir/mix.vim b/ale_linters/elixir/mix.vim index 4552ace5..dc3c1818 100644 --- a/ale_linters/elixir/mix.vim +++ b/ale_linters/elixir/mix.vim @@ -29,18 +29,8 @@ function! ale_linters#elixir#mix#Handle(buffer, lines) abort return l:output endfunction -function! ale_linters#elixir#mix#FindProjectRoot(buffer) abort - let l:mix_file = ale#path#FindNearestFile(a:buffer, 'mix.exs') - - if !empty(l:mix_file) - return fnamemodify(l:mix_file, ':p:h') - endif - - return '.' -endfunction - function! ale_linters#elixir#mix#GetCommand(buffer) abort - let l:project_root = ale_linters#elixir#mix#FindProjectRoot(a:buffer) + let l:project_root = ale#handlers#elixir#FindMixProjectRoot(a:buffer) let l:temp_dir = ale#engine#CreateDirectory(a:buffer) @@ -49,8 +39,8 @@ function! ale_linters#elixir#mix#GetCommand(buffer) abort \ : 'MIX_BUILD_PATH=' . ale#Escape(l:temp_dir) return ale#path#CdString(l:project_root) - \ . l:mix_build_path - \ . ' mix compile %s' + \ . l:mix_build_path + \ . ' mix compile %s' endfunction call ale#linter#Define('elixir', { -- cgit v1.2.3