Hi all,
how do you manage multiple versions of elixir-ls?
Is there a tool similar to asdf to do that?
Hi all,
how do you manage multiple versions of elixir-ls?
Is there a tool similar to asdf to do that?
I haven’t dealt with the issue but if I had to, I would keep different versions of the program somewhere in directories with names based on the plugin version, e.g. ~/.local/share/elixir-ls/0.15.1
.
I would have a symlink called ~/.local/bin/elixir-ls
(or somewhere sensible that is in your $PATH
) which points to the elixir-ls
version in use at any given time, and reference that in the elixir.pathToElixirLS
setting in my coc-settings.json
file (I use NeoVim, so your config file would be different for e.g. VSCode).
Then I would make a script called elixir-ls-switch-version
that looks something like this:
#!/usr/bin/env sh
if [ "$1" = "" ]; then
echo "You must pass the name of the elixir-ls version you want to use as the first positional parameter."
exit 2
elif [ "$1" = "ls" ]; then
echo "Here is a list of installed elixir-ls versions:"
ls ~/.local/share/elixir-ls
exit
fi
# make a new symlink containing the desired version of elixir-ls
path_to_new_symlink="~/.local/bin/elixir-ls"
echo "Making a new symlink..."
ln -sf "~/.local/share/elixir-ls/$1/language_server.sh $path_to_new_symlink"
I would place this script in my $PATH
(probably in ~/.local/bin/elixir-ls-switch-version
) and keep a backup in my handy-dandy scripts
git repo.
Then, I would run elixir-ls-switch-version 0.15.1
(or run elixir-ls-switch-version ls
if I want to see a list of installed versions).
Then, in NeoVim, I would run :CocRestart
(or whatever the equivalent is for your editor of choice) and hope for the best!
Ah, the script is a nice idea.
I was using coc, and I had a local coc-settings file pointing to the right executable.
(:CocLocalConfig
creates a .vim/coc-settings.json
in the current working directory)
Now I switched to the neovim bultin lsp config and I miss that feature.