1
0
Fork 0
mirror of synced 2024-06-16 22:11:12 -04:00
ultimate-vim/sources_non_forked/ale/autoload/ale/handlers/elixir.vim

29 lines
999 B
VimL
Raw Normal View History

2018-11-01 06:03:42 -04:00
" Author: Matteo Centenaro (bugant) - https://github.com/bugant
2018-12-17 06:28:27 -05:00
" Author: Jon Parise <jon@indelible.org>
" Description: Functions for working with Elixir projects
2018-11-01 06:03:42 -04:00
2018-12-17 06:28:27 -05:00
" Find the root directory for an elixir project that uses mix.
2018-11-01 06:03:42 -04:00
function! ale#handlers#elixir#FindMixProjectRoot(buffer) abort
let l:mix_file = ale#path#FindNearestFile(a:buffer, 'mix.exs')
if !empty(l:mix_file)
2018-12-17 06:28:27 -05:00
return fnamemodify(l:mix_file, ':p:h')
2018-11-01 06:03:42 -04:00
endif
return '.'
endfunction
2018-12-17 06:28:27 -05:00
" Similar to ale#handlers#elixir#FindMixProjectRoot but also continue the
" search upward for a potential umbrella project root. If an umbrella root
" does not exist, the initial project root will be returned.
function! ale#handlers#elixir#FindMixUmbrellaRoot(buffer) abort
let l:app_root = ale#handlers#elixir#FindMixProjectRoot(a:buffer)
let l:umbrella_root = fnamemodify(l:app_root, ':h:h')
if filereadable(l:umbrella_root . '/mix.exs')
return l:umbrella_root
endif
return l:app_root
endfunction