ca1989

ca1989

How do you manage multiple versions of elixir-ls?

Hi all,
how do you manage multiple versions of elixir-ls?

Is there a tool similar to asdf to do that?

First Post!

arcanemachine

arcanemachine

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!

Where Next?

Popular in Discussions Top

Nvim
Elixir appears to be a superior language to Python. I don’t see any advantage of Python over Elixir. Are there any?
New
thojanssens1
It would be nice to be able to define a redirect from one route to another from the router.ex file. E.g.: redirect "/", UserController, ...
New
AngeloChecked
What learn first? Rust or Elixir Hi Elixir community! I’m here because i want learn a new language. I’m a junior developer and mainly i ...
New
mmmrrr
Just saw that dhh announced https://hotwire.dev/ Is it just me or is this essentially live view? :smiley: Although I like the “iFrame-e...
New
lucaong
Hello Elixir and Nerves community, I have been working for a while on an open-source embedded key-value database for Elixir, that I call...
230 13924 124
New
AlexMcConnell
The reason that Rails is as popular as it is is because it’s very easy for relatively inexperienced developers to get a lot of work done....
588 19568 166
New
mbenatti
Following https://github.com/tbrand/which_is_the_fastest |> https://raw.githubusercontent.com/tbrand/which_is_the_fastest/master/imgs...
New
New
AstonJ
Can you believe the first professionally published Elixir book was published just 8 years ago? Since then I think we’ve seen more books f...
New
AstonJ
If so I (and hopefully others!) might have some tips for you :slight_smile: But first, please say which area you’re finding most challen...
New

Other popular topics Top

johnnyicon
Hi all, I’ve just started learning Elixir and Phoenix Framework, so please pardon my n00bness at this stage. I’m trying to use Postgres...
New
minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
dokuzbir
I want to highlight html closing tags when i click a html tag. That works in .html files but doesnt work for html.eex templates. How can...
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
AstonJ
Please see the new poll here: Which code editor or IDE do you use? (Poll) (2022 Edition) It’s been a while since we first asked this, I...
208 31142 143
New
AstonJ
We’ve put together this wiki for Phoenix LiveView - please feel free to add any info you feel is worth including. What is Phoenix LiveV...
New
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
AstonJ
Seen any cool LiveView demos, sample apps or examples? Please post them here! :003:
New

We're in Beta

About us Mission Statement