]> git.madduck.net Git - etc/vim.git/blob - .vim/bundle/ale/autoload/ale/handlers/elixir.vim

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Merge commit 'a39f715c13be3352193ffd9c5b7536b8786eff64' as '.vim/bundle/vim-lsp'
[etc/vim.git] / .vim / bundle / ale / autoload / ale / handlers / elixir.vim
1 " Author: Matteo Centenaro (bugant) - https://github.com/bugant
2 " Author: Jon Parise <jon@indelible.org>
3 " Description: Functions for working with Elixir projects
4
5 " Find the root directory for an elixir project that uses mix.
6 function! ale#handlers#elixir#FindMixProjectRoot(buffer) abort
7     let l:mix_file = ale#path#FindNearestFile(a:buffer, 'mix.exs')
8
9     if !empty(l:mix_file)
10         return fnamemodify(l:mix_file, ':p:h')
11     endif
12
13     return '.'
14 endfunction
15
16 " Similar to ale#handlers#elixir#FindMixProjectRoot but also continue the
17 " search upward for a potential umbrella project root. If an umbrella root
18 " does not exist, the initial project root will be returned.
19 function! ale#handlers#elixir#FindMixUmbrellaRoot(buffer) abort
20     let l:app_root = ale#handlers#elixir#FindMixProjectRoot(a:buffer)
21     let l:umbrella_root = fnamemodify(l:app_root, ':h:h')
22
23     if filereadable(l:umbrella_root . '/mix.exs')
24         return l:umbrella_root
25     endif
26
27     return l:app_root
28 endfunction