ale/test/command_callback/test_elixir_mix_command_callbacks.vader
Jon Parise b25794e81b elixir-ls now recognizes umbrella projects
Previously, elixir-ls would treat each sub-project within an umbrella as
standalone, which isn't desirable from a language server perspective.

Added ale#handlers#elixir#FindMixUmbrellaRoot, which locates the current
project's root and then continues searching upwards for a potential
umbrella project root. This literally looks just two levels up to keep
things simple while keeping in line with Elixir project conventions.

Use this new function to determine elixir-ls's LSP project root.
2018-11-04 06:40:25 -08:00

34 lines
1.1 KiB
Plaintext

Before:
call ale#assert#SetUpLinterTest('elixir', 'mix')
let g:env_prefix = has('win32')
\ ? 'set MIX_BUILD_PATH=' . ale#Escape('TEMP_DIR') . ' && '
\ : 'MIX_BUILD_PATH=' . ale#Escape('TEMP_DIR') . ' '
After:
unlet! g:env_prefix
call ale#assert#TearDownLinterTest()
Execute(The default mix command should be correct):
call ale#test#SetFilename('mix_paths/wrapped_project/lib/app.ex')
AssertLinter 'mix',
\ ale#path#CdString(ale#path#Simplify(g:dir . '/mix_paths/wrapped_project'))
\ . g:env_prefix
\ . 'mix compile %s'
Execute(FindMixProjectRoot should detect the project root directory via mix.exs):
silent execute 'file ' . fnameescape(g:dir . '/elixir_paths/mix_project/lib/app.ex')
AssertEqual
\ ale#path#Simplify(g:dir . '/elixir_paths/mix_project'),
\ ale#handlers#elixir#FindMixProjectRoot(bufnr(''))
Execute(FindMixUmbrellaRoot should detect the umbrella root directory via mix.exs):
silent execute 'file ' . fnameescape(g:dir . '/elixir_paths/umbrella_project/apps/app1/lib/app.ex')
AssertEqual
\ ale#path#Simplify(g:dir . '/elixir_paths/umbrella_project'),
\ ale#handlers#elixir#FindMixUmbrellaRoot(bufnr(''))