diff --git a/ale_linters/elixir/next_ls.vim b/ale_linters/elixir/next_ls.vim new file mode 100644 index 0000000000..72ffbd8762 --- /dev/null +++ b/ale_linters/elixir/next_ls.vim @@ -0,0 +1,17 @@ +" Author: Mitchell Hanberg +" Description: Next LS (https://github.com/elixir-tools/next-ls) + +call ale#Set('elixir_next_ls_executable', 'nextls') +call ale#Set('elixir_next_ls_options', '--stdio') + +function! ale_linters#elixir#next_ls#GetCommand(buffer) abort + return '%e' . ale#Pad(ale#Var(a:buffer, 'elixir_next_ls_options')) +endfunction + +call ale#linter#Define('elixir', { +\ 'name': 'next_ls', +\ 'lsp': 'stdio', +\ 'executable': {b -> ale#Var(b, 'elixir_next_ls_executable')}, +\ 'command': function('ale_linters#elixir#next_ls#GetCommand'), +\ 'project_root': function('ale#handlers#elixir#FindMixUmbrellaRoot'), +\}) diff --git a/test/linter/test_next_ls.vader b/test/linter/test_next_ls.vader new file mode 100644 index 0000000000..949ee14e15 --- /dev/null +++ b/test/linter/test_next_ls.vader @@ -0,0 +1,22 @@ +Before: + call ale#assert#SetUpLinterTest('elixir', 'next_ls') + +After: + call ale#assert#TearDownLinterTest() + +Execute(should set correct defaults): + AssertLinter 'nextls', '''nextls'' --stdio' + +Execute(should set next_ls options): + let b:ale_elixir_next_ls_executable = 'boo' + let b:ale_elixir_next_ls_options = '--spooky' + + AssertLinter 'boo', '''boo'' --spooky' + +Execute(should set correct LSP values): + call ale#test#SetFilename('../test-files/elixir/umbrella_project/apps/app1/lib/app.ex') + + AssertLSPLanguage 'elixir' + AssertLSPOptions {} + AssertLSPConfig {} + AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/elixir/umbrella_project')