From 7eae7812915602ece637714e6f82d4551e9697b6 Mon Sep 17 00:00:00 2001 From: Jon Parise Date: Fri, 28 Sep 2018 11:42:50 -0700 Subject: Add elixir-ls language server support ElixirLS (https://github.com/JakeBecker/elixir-ls) is an LSP server for Elixir. It's distributed as a release package that can be downloaded from https://github.com/JakeBecker/elixir-ls/releases or built locally. The easiest way to start it is via Unix- and Win32-specific helper scripts, so that's the basis of this command integration. Alternatively, we could implement the contents of those platform-specific scripts in the linter's command callback in a language-neutral way, but there isn't any benefit to doing that aside from eliminating the platform check, and that could prove to be too tight of a coupling going forward. --- ale_linters/elixir/elixir_ls.vim | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 ale_linters/elixir/elixir_ls.vim (limited to 'ale_linters') diff --git a/ale_linters/elixir/elixir_ls.vim b/ale_linters/elixir/elixir_ls.vim new file mode 100644 index 00000000..d5ad7cfc --- /dev/null +++ b/ale_linters/elixir/elixir_ls.vim @@ -0,0 +1,19 @@ +" Author: Jon Parise +" Description: elixir-ls integration (https://github.com/JakeBecker/elixir-ls) + +call ale#Set('elixir_elixir_ls_release', 'elixir-ls') + +function! ale_linters#elixir#elixir_ls#GetExecutable(buffer) abort + let l:dir = ale#path#Simplify(ale#Var(a:buffer, 'elixir_elixir_ls_release')) + let l:cmd = ale#Has('win32') ? '\language_server.bat' : '/language_server.sh' + + return l:dir . l:cmd +endfunction + +call ale#linter#Define('elixir', { +\ 'name': 'elixir-ls', +\ 'lsp': 'stdio', +\ 'executable_callback': 'ale_linters#elixir#elixir_ls#GetExecutable', +\ 'command_callback': 'ale_linters#elixir#elixir_ls#GetExecutable', +\ 'project_root_callback': 'ale#handlers#elixir#FindMixProjectRoot', +\}) -- cgit v1.2.3