HACKER Q&A
📣 behnamoh

Elixir LSP doesn't work on VSCode and Neovim. Any solutions?


I have tried installing Elixir+Erlang through Homebrew (as instructed by the official Elixir website): https://elixir-lang.org/install.html#macos

I also tried uninstalling them and installing through ASDF and I made sure that they both had the same version (27) as mentioned in this article: https://elixir-ko.github.io/install.html

This Issue mentions that Elixir may be incompatible with the most recent OpenSSL versions, but I don't want to downgrade OpenSSL: https://github.com/erlang/otp/issues/4577#issuecomment-925962048. Also: https://elixirforum.com/t/elixirls-cannot-connect-to-server-in-vscode/55345/8

I also did every tip mentioned on the Github page of the Elixir LSP: https://github.com/elixir-lsp/elixir-ls?tab=readme-ov-file#troubleshooting

Several hours later, I still can't use the Elixir LSP in VSCode. This is the error I keep getting:

``` Client ElixirLS - elx: connection to server is erroring. Header must provide a Content-Length property. {"{\"jsonrpc\"":"\"2.0\",\"method\":\"window/logMessage\",\"params\":{\"message\":\"Running in /Users//Downloads/LLM/elx\",\"type\":3}}Content-Length: 130"} Shutting down server. ```

And

``` Client ElixirLS - elx: connection to server is erroring. Header must provide a Content-Length property. {"{\"jsonrpc\"":"\"2.0\",\"method\":\"window/logMessage\",\"params\":{\"message\":\"Started ElixirLS v0.21.3\",\"type\":3}}Content-Length: 121"} Shutting down server. ```

And

``` Client ElixirLS - elx: connection to server is erroring. Header must provide a Content-Length property. {"\u001b[6 qcontent-length":"103"} Shutting down server. ```

This isn't supposed to be like this, and a search on Google shows many people have this problem. I like Elixir and BEAM, but the tooling is not comparable to Rust, Haskell, Go, etc.

Even with Python (which has one of the worst toolings), all I need to do before using the language is:

1. Install Python through Homebrew or a binary.

2. Install the plugin on VSCode.

3. Profit.


  👤 calebjosue Accepted Answer ✓
I know You are talking specifically about VSCode. So, most likely My comment may be irrelevant.

I happen to have a vídeo on having Elixir support on Sublime Texto 4.[1]

I Also do have a couple of videos on installing Erlang and Elixir on Debían. I am not sure if this can be reprocuced on a Mac.[2]

[1] https://youtu.be/LhDycf5G5RM?si=P_B9sqg3wSbsZ5mY

[2]https://youtu.be/pj8_UujqfN4?si=rFV7uEYY7QgKVFkv


👤 rio517
The https://elixirforum.com/ might get you quicker/better answers.