Skip to content

Commit

Permalink
feat(elixir): add Next LS
Browse files Browse the repository at this point in the history
Next LS is a new language server for Elixir

Homepage: https://www.elixir-tools.dev/next-ls
GitHub: https://github.com/elixir-tools/next-ls
  • Loading branch information
mhanberg committed Oct 9, 2023
1 parent 53b01d6 commit ed3b454
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
17 changes: 17 additions & 0 deletions ale_linters/elixir/next_ls.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
" Author: Mitchell Hanberg <[email protected]>
" 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'),
\})
22 changes: 22 additions & 0 deletions test/linter/test_next_ls.vader
Original file line number Diff line number Diff line change
@@ -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')

0 comments on commit ed3b454

Please sign in to comment.