Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(elixir): add Next LS #4626

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 <mitch@mitchellhanberg.com>
" 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')