Issues with ElixirLS: Elixir sources not found and error while running own Elixir LS Version

Hello everyone,

I have two problems with Elixir LS. In the image you can see both problems/questions. I’m using VSCode and the Elixir LS extension. The screenshot is from my Phoenix project. I’ve installed Erlang and Elixir through asdf.

Question 1

The last line says: Elixir sources not found and I’m wondering if it is possible to change the path in the info message? I’m not sure why the path is /home/build/elixir.

Question 2

I’m missing some intellisense features in VSCode and I was hoping to solve it with compiling Elixir LS with the same Elixir and Erlang version, I’m using. So I was following this guide: https://dragoshmocrii.com/fix-vscode-elixirls-intellisense-for-code-imported-with-use/?PageSpeed=noscript

The compilation was successful but I get a JsonRPC error while checking the Output Panel of the VSCode console. This error is already mentioned in the trouble shooting page of Elixir LS: GitHub - elixir-lsp/elixir-ls: A frontend-independent IDE "smartness" server for Elixir. Implements the "Language Server Protocol" standard and provides debugger support via the "Debug Adapter Protocol"

Unfortunately I was unable to find a fix…

3 Likes

Regarding question 1:
I had to clone the elixir repo into /home/builds/elixir: GitHub - elixir-lang/elixir at v1.12.3

for question 2 problem:

Vscode elixir introduced setting languageServerOverridePath. You could find it in vscode settings ElixirLS.
This setting can be configured per workspace, so each project will have its own elixirLS release, which is handy if you’re using asdf for elixir installation and have different elixir versions per project.

Basically, you need to download ElixirLS precompiled release for desired elixir version from here
Releases · elixir-lsp/elixir-ls · GitHub and upzip it to some directory. Then use absolute path to that directory to set languageServerOverridePath setting. Then remove .elixir_ls and _build directories in your project and restart VsCode.
Every time, when vscode elixir ls extension upgrades ElixirLS version, you’ll need to download a new release and repeat all the above.

IMO, it’s better than compiling ElixirLS manually and replacing it in vscode extensions.

1 Like

languageServerOverridePath may no longer be useful. Since v0.14 the extension uses Mix.install which builds and installs elixirLS using the correct elixir and OTP combo

2 Likes

Hey folks, a quick question: I started working on a project for Elixir 1.11 this morning; according to the support matrix I see that Elixir <= 1.12 is not supported, is that correct ? Am I missing something ? Any workaround to have this working in some way with Elixir 1.11 Otp 23 ?

Thanks in advance.

Elixir 1.11 is still listed as supported here: https://github.com/elixir-lang/elixir/blob/main/lib/elixir/pages/references/compatibility-and-deprecations.md

And you can use it with Erlang 21 to 23.

1 Like

Thanks @dimitarvp

Ops, probably there’s been a misunderstanding, actually ElixirLS does not support Elixir versions <= 1.12:

image

:frowning:

Well, try and upgrade? Is there an obstacle?

Well, the message was there … but it’s working :sweat_smile:

I still wouldn’t count on that though. No good reason to hold off version upgrades IMO.

3 Likes

Ahaha nice one !

I’d agree, but with 0.16 (latest version) I have a set or recurring failures in less than 3 seconds that cause the language server to stop. :man_shrugging:

That’s workable. Just delete all build artifacts, stop VSCode (if you are using that then just stop your editor, whichever it is) and start over:

rm -rf .vscode .elixir_ls _build deps
mix do deps.get, compile

Then start your editor again.

1 Like

@brunoripa @dimitarvp the latest version of ElixirLS (v0.16.0) requires elixir 1.13+. The final version that supported 1.11 was v0.12.0. ElixirLS aims to support last 3 elixir releases.

Ah, thank you.

I’ll remember that for the next time when a manager asks me “why do we have to upgrade on a regular basis”? :grin:

FYI in release 0.17.6 I managed to get some support for elixir 1.12 back

1 Like