Elixir language server extension based on elixir-ls for coc.nvim
.
-
Make sure you've got
elixir
andmix
available in$PATH
. -
Inside (neo)vim run this command:
:CocInstall coc-elixir
-
Make sure you've got
elixir
,mix
andyarn
available in$PATH
. -
Inside your
plug#begin/end
block in your.vimrc
(vim) orinit.vim
(neovim) file, aftercoc.nvim
add:
Plug 'amiralies/coc-elixir', {'do': 'yarn install && yarn prepack'}
- Go to definition support
- Code completion
- Inline diagnostic (Build errors and warning)
- Documentation on hover
- Smart closing of code blocks
- Code formatter
Upon upgrading coc-elixir
it is possible that the binary files were compiled
using an OTP or Elixir version that differ from the ones you have installed.
When this happens, the language server will fail to start.
You can build ElixirLS yourself to solve this:
Start by building a binary of ElixirLS from its source:
git clone https://github.com/elixir-lsp/elixir-ls.git ~/.elixir-ls
cd ~/.elixir-ls
mix deps.get && mix compile && mix elixir_ls.release -o release
Afterwards, create or update your coc-settings file and add this line:
{
"elixir.pathToElixirLS": "~/.elixir-ls/release/language_server.sh"
}
To open your coc-settings file directly from Vim or Nvim, you can use this command:
:CocConfig
Doing these steps should make this plugin work with CoC.
MIT