When ElixirLS is compiled with a different version of Elixir/Erlang than we use in our projects, it is unable to show pop-up documentation and auto-completion for certain constructs (like imports or requires done by a using
block).
To check if you have a version mismatch, you can scroll to the top of the output pane for ElixirLS (VSCode View
-> Output
, then select ElixirLS
from the dropdown list).
In v0.13.0, vscode-elixir-ls added the ability to override the default elixirLS release path in config. This allows us to recompile elixirLS with whichever versions of Elixir and Erlang we like and then tell the extension to use that version. It should even be possible to compile with multiple different Elixir/Erlang combinations and use different versions in different projects, though I haven't tried that yet.
Here's how to do this:
# First time only
git clone [email protected]:elixir-lsp/elixir-ls.git
cd elixir-ls
# Second and subsequent times
cd elixir-ls
git pull
# Always
asdf local erlang {desired version}
asdf local elixir {desired version}
asdf install # should do nothing, but just to be safe
mix deps.get
# --force seems to be needed to get the reported version to update
MIX_ENV=prod mix compile --force
# Specify a release dir if you plan to compile for multiple versions
MIX_ENV=prod mix elixir_ls.release # -o {release_dir}
Once built, provide the absolute path to the release directory (default release
) as the value of the Elixir LS: Language Server Override Path
setting in VSCode.
For more information, see the ElixirLS README.
It is possible to recompile the extension with the same versions of Elixir and Erlang that we use in our projects as follows. You'll have to do this every time the extension updates itself from the marketplace unless you turn off auto-updating of all extensions.
# First time only
git clone --recursive [email protected]:elixir-lsp/vscode-elixir-ls.git
cd vscode-elixir-lsp
# Second and subsequent times
cd vscode-elixir-lsp
git pull && git submodule update --recursive
# Always
npm install
cd elixir-ls
asdf local erlang {desired version}
asdf local elixir {desired version}
asdf install # should do nothing, but just to be safe
cd ..
rm *.vsix
npx vsce package
code --install-extension *.vsix --force