“Embedded” LSP Server

New Elixir LSP Server design

The old/current elixir-ls project starts a language server per project, running the language server in the project’s directory so that things like asdf-vm pick up the project’s version of OTP and Elixir, which is what we want. This has two major drawbacks:

The new design tries to solve this by running a BEAM instance per project and one “controller” that runs the show. The controller contains all of Elixir-LS, and the per-project BEAM instances contain just a very small application with a random (and therefore hopefully unique) name and no dependencies. Inter-BEAM communications works through Erlang clustering.

The new startup sequence is:

It is a little bit roundabout and makes implementing Elixir-LS somewhat harder because of all the remote calls, but it solves all the versioning problems.

This application contains the per-beam code and therefore cannot contain any dependencies; also, it is compiled at run-time to make sure that there are no incompatibilities.

Note that there is a potential for conflict with another application called eels. This can be alleviated simply by renaming this application to something obscure, like eels_24692c715a9dc2f8c3a88632dbb18704 but that’s probably best postponed to when it actually is needed. To reduce the change of this happening, eels is published as a Hex package.