summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authorw0rp <w0rp@users.noreply.github.com>2018-11-06 20:02:34 +0000
committerGitHub <noreply@github.com>2018-11-06 20:02:34 +0000
commitad98cb74488c017a4b23e5a848e37ac5bc0840b0 (patch)
tree1e58ca494ada0e0968ab8176ddc731d8d0aaf680 /autoload
parent51341fbe369362ceb34e46844c3a638485ae36d0 (diff)
parentb25794e81b79d4ce1a6f2d9d0fbcc6876ecaa124 (diff)
downloadale-ad98cb74488c017a4b23e5a848e37ac5bc0840b0.zip
Merge pull request #2045 from jparise/elixir-ls-umbrella
elixir-ls now recognizes umbrella projects
Diffstat (limited to 'autoload')
-rw-r--r--autoload/ale/handlers/elixir.vim21
1 files changed, 18 insertions, 3 deletions
diff --git a/autoload/ale/handlers/elixir.vim b/autoload/ale/handlers/elixir.vim
index 91b75aac..2fddf8e7 100644
--- a/autoload/ale/handlers/elixir.vim
+++ b/autoload/ale/handlers/elixir.vim
@@ -1,13 +1,28 @@
" Author: Matteo Centenaro (bugant) - https://github.com/bugant
-"
-" Description: find the root directory for an elixir project that uses mix
+" Author: Jon Parise <jon@indelible.org>
+" Description: Functions for working with Elixir projects
+" Find the root directory for an elixir project that uses mix.
function! ale#handlers#elixir#FindMixProjectRoot(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')
+ return fnamemodify(l:mix_file, ':p:h')
endif
return '.'
endfunction
+
+" 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