erlang-ls / erlang_ls

The Erlang Language Server
https://erlang-ls.github.io/
Apache License 2.0
626 stars 136 forks source link

Support for older Erlang versions #1452

Closed finzic closed 9 months ago

finzic commented 1 year ago

I am working on a project that uses Erlang 17.3. Is there any plan to extend compatibility to older Erlang versions, or is it not possible because of missing language features? Thank you

robertoaloi commented 1 year ago

Hi! While a modern version of Erlang is required to build Erlang LS itself, you should still be able to use it in combination with older projects. Some features may not work as expected, but in that case the best thing would be to try and report.

Clone the repo, compile the server with rebar3 escriptize (with a modern version of Erlang). Then (assuming you are using it via VS Code) go to the extension settings and change the erlang_ls.serverPath setting to point to the executable you just built. For other editors, the procedure will be similar.

finzic commented 1 year ago

Perhaps my problem is that I work under Windows and the project in in WSL2 Ubuntu 18.04, so my VSCODE is running under windows. I built erlang_ls under WSL with the command you suggested; then I put it under ${HOME}/bin/erlang_ls; modified the extension settings and restarted the window, but still I get the same error, which is not very verbose: image Any suggestions? Thanks in advance!

finzic commented 1 year ago

I managed to have VScode with erlang_ls plugin working smoothly under WSL2 with Ubuntu-22.04, which gave me enough hints about how to setup the system. Thank you; will report when I will be able to run VScode on my project.

robertoaloi commented 1 year ago

@finzic The troubleshooting section of the website contains a few tips on troubleshooting Erlang LS. In your case, I am not sure it will help, though, since it seems like the entire server cannot start up. To me it sounds like an environment issue. I would attempt at starting the server manually in the same env where VS Code starts, via escript:

escript /path/to/erlang_ls -h # Show help
escript /path/to/erlang_ls # Start in server mode
robertoaloi commented 1 year ago

One way to ensure Erlang, escript and erlang_ls are in the path is to add a mock launch configuration which starts the server, just to verify whether you get a better error.

Also, you could check selecting something else than "Erlang LS" in the output tab (most likely VS Code - UI or VS Code - Workspace) to check whether there's a more specific error message.

finzic commented 1 year ago

@finzic The troubleshooting section of the website contains a few tips on troubleshooting Erlang LS. In your case, I am not sure it will help, though, since it seems like the entire server cannot start up. To me it sounds like an environment issue. I would attempt at starting the server manually in the same env where VS Code starts, via escript:

escript /path/to/erlang_ls -h # Show help
escript /path/to/erlang_ls # Start in server mode

Thank you, my solution was to