What is Elixir LS?
Elixir LS by Jake Becker is the language server implementation for Elixir.
What is a language server?
The Language Server Protocol (LSP) defines the protocol used between an editor or IDE and a language server that provides language features like auto complete, go to definition, find all references etc.
This allows creators to build universal “language servers” that can be used by any text editor.
How to integrate with Vim
Using a language server requires a client implementation for your editor and we are going to use ALE by w0rp.
If you’re using vim-plug you can install ALE by adding the following to your
.vimrc and running
:PlugInstall. Otherwise, consult your plugin manager’s documentation.
" .vimrc call plug#begin('~/.vim/bundle') ... Plug 'w0rp/ale' call plug#end()
Now let’s install Elixir LS!
$ git clone email@example.com:elixir-lsp/elixir-ls.git $ cd elixir-ls && mkdir rel $ mix deps.get && mix compile $ mix elixir_ls.release -o rel
Note: As of writing, you will need to compile
elixir-lswith the same Elixir and Erlang versions as your project.
Perfect, our final step is to tell vim where our Elixir LS instance lives.
" .vimrc let g:ale_elixir_elixir_ls_release = '<your path to elixir-ls>/rel'
I would familiarize yourself with the features of ALE and decide how you want to incorporate them into your workflow. ALE doesn’t prescribe any keymappings, so feel free to experiment to see what works best for you!
Check out my .vimrc to see how I use ALE.