ElixirLS (VSCode extension) installation issue on WSL2, Ubuntu

Hi everyone, I am new to Elixir and to programming in general. I am still setting things up to get working whith Elixir.

When installing ElixirLS extension in VSCode (running in Ubuntu WSL2, whith WSL extension installed), I have this output :

/root/.vscode-server/extensions/jakebecker.elixir-ls-0.14.0/elixir-ls-release/launch.sh: line 77:  5504 Killed                  elixir "$SCRIPTPATH/quiet_install.exs" > /dev/null 2> /dev/null < /dev/zero
[Error - 6:45:20 PM] Server initialization failed.
    Message: Pending response rejected since connection got disposed
    Code: -32097 
[Info  - 6:45:20 PM] Connection to server got closed. Server will restart.
true
[Error - 6:45:20 PM] ElixirLS - elixir client: couldn't create connection to server.
    Message: Pending response rejected since connection got disposed
    Code: -32097

Environment

  • Windows 11 → WSL2 → Ubuntu 22.04.2 LTS
  • VSCode whith WLS extension
  • Erlang/OTP 25 / Elixir 1.14.4 (installed using asdf, no problem using elixir or iex commands)

Troubleshooting

  • [tried] : Restart your editor (which will restats ElixirLS) sometimes fixes issues
  • [couldn’t find any directory] : Stop your editor, remove the entire .elixir_ls directory, then restart your editor

To be honest I don’t understand the output and what server is involved in the process of the installation. But I saw that people managed to install this extension on WSL2 without trouble here : VSCode - Elixir LS + WSL - #15 by robert

Thanks a lot if you have insights :pray:

I’m experiencing the same thing. I believe it’s a bug in the brand-new v0.14.0 release. I’d recommend reverting to v0.13.0 until it’s resolved, which will hopefully be soon.

Extension settings:

Click the down arrow next to Uninstall, then Install Another Version…

Select 0.13.0. May need to reload VSCode.

5 Likes

I will try and let you know, thanks for answering and for the tip to change extension version :blush:

1 Like

Hi Zachallaun, it worked for the most part, no major error. But it seems that there will be some issues since I don’t use the same OTP and Elixir versions as ElixirLS. Here is the output :

[Info  - 9:30:54 AM] Started ElixirLS v0.13.0
[Info  - 9:30:54 AM] ElixirLS built with elixir "1.12.3" on OTP "22"
[Info  - 9:30:54 AM] Running on elixir "1.14.4 (compiled with Erlang/OTP 25)" on OTP "25"
[Warn  - 9:30:54 AM] OTP compiled without EEP48 documentation chunks. Language features for erlang modules will run in limited mode. Please reinstall or rebuild OTP with approperiate flags.
[Info  - 9:30:54 AM] Elixir sources not found (checking in /home/build/elixir). Code navigation to Elixir modules disabled.
[Info  - 9:30:54 AM] Loaded DETS databases in 36ms
[Info  - 9:30:54 AM] Starting build with MIX_ENV: test MIX_TARGET: host
[Warn  - 9:30:54 AM] No mixfile found in project. To use a subdirectory, set `elixirLS.projectDir` in your settings. Looked for mixfile at "/root/myDev/elixir/mix.exs"
[Info  - 9:30:54 AM] Compile took 4 milliseconds
[Info  - 9:30:54 AM] [ElixirLS WorkspaceSymbols] Indexing...
[Info  - 9:30:54 AM] [ElixirLS WorkspaceSymbols] Module discovery complete
[Info  - 9:30:54 AM] [ElixirLS WorkspaceSymbols] 22 callbacks added to index
[Info  - 9:30:54 AM] [ElixirLS WorkspaceSymbols] 128 modules added to index
[Info  - 9:30:55 AM] [ElixirLS WorkspaceSymbols] 344 types added to index
[Info  - 9:30:56 AM] [ElixirLS WorkspaceSymbols] 3808 functions added to index

Since I am learning I don’t know yet about the mixfile. But with erlang modules in limited mode and code navigation to Elixir modules disabled, I guess that essential features won’t work.

Ironically, Elixir/OTP mismatch issues was the big fix for 0.14.0 :slight_smile: IMO, don’t worry about it right now, move on without perfect language server integration, and check back in periodically to give it a try when you see a new release.

Another tip when ElixirLS is acting up: you can delete the .elixirls folder in the root of your project and run the VSCode command thats something like “ElixirLS: restart language server”.

1 Like

0.14.2 is out now with a fix - working here™

2 Likes

Thanks to you too for your answers.

I myself am very close to having everything working. But I still encounter an issue :

[Info  - 6:20:19 PM] Elixir sources not found (checking in /home/build/elixir). Code navigation to Elixir modules disabled.

I think I did everything correctly with asdf, following every step of the pugin instructions for Erlang and Elixir. But maybe I’m missing something… I saw that ElixirLS was designed to work with Elixir installed via asdf, so I wonder why it is trying to find Elixir in /home/build/elixir.

I saw here that someone cloned the Elixir repo on the previously mentioned path. But it seems a bit strange to have Elixir on my computer twice.

No need to clone it like that. The LS won’t link to precompiled asdf install, but you can tell asdf to build it for you.

Edit: Cached page as original no longer available: Fixing "Go to Definition" for Elixir's standard library | Random Developer's Blog (original: Fixing “Go To Definition” for Elixir’s standard library | Random Developer’s Blog )

It turns out asdf-elixir is using precompiled version when you execute asdf install elixir <version> which does not contain source code. However, if you take any commit reference (SHA string) from Elixir repo and use asdf install elixir ref:<commit_reference>, asdf will actually build it from the source to which that reference points. Each Elixir release is tagged so finding a commit reference for a correct version is pretty straightforward. After that, just as with normal asdf installation, you have to execute asdf global elixir ref:<commit_reference> to set that version as global.

After this is done, go to any project, delete .elixir_ls, deps and _build, run VSCode again and wait for the language server finish its job. Now, “Go to Definition” should work for everything (for the standard library it actually takes a couple of seconds; others should be instant).

4 Likes

:clap: Thanks to you my journey through the winding and shady paths that lead to the configuration of a perfect environment is coming to an end! And I am in the best conditions to start the ascent of Mount Elixir. See you soon, companions.

1 Like

Bon voyage :rocket: :mountain:

1 Like

Ah, I’d been having the same problem for several days …
Only reverting the ElixirLS plugin to 0.13.x helped. None of 0.14.x versions worked (I’m using VSCode on Mac M1).

1 Like

Same issue today. Macbook M1

This is also happening to me, also on a Macbook M1. Plugin version 0.14.4 did not work, but 0.13.x did.

I’m having the same problem, it just stopped working recently. Going back to version 1.13.0 has not helped either. I was able to get it to work by going back to 1.12.0.

1 Like

Thanks for that, I have used the same solution now, reverting from 16.0 to 15.2 on my Linux ubuntu and worked fine!