elixir-ls icon indicating copy to clipboard operation
elixir-ls copied to clipboard

Feature Request: Distribute Through Hex

Open LandonSchropp opened this issue 2 years ago • 5 comments

With other language servers, I'm usually able to install them via the language's package manager. For example, in Node.js I can install the language server package via Yarn or NPM:

yarn add -D javascript-typescript-langserver

And in Ruby I can put it in my Gemfile like so:

gem 'solargraph', group: :development

I was a bit surprised to see that elixir-ls isn't distributed via Hex. (Apologies if it is. I didn't see it in hex or in the docs.) I would expect to be able to do something like this:

defp deps do
  [
    ...
    {:elixir_ls, "..."}
  ]
end

The advantage of this approach is I can install the language server on a per-project basis, with different versioning as needed. My editor can easily be configured to use a local version of a package rather than a global version, and installation becomes a snap.

LandonSchropp avatar Jul 14 '21 18:07 LandonSchropp

Hi, thanks for bringing this up :+1: Indeed ElixirLS is currently not available via hex. It would be nice to be able to specify the version of ElixirLS to use via the project deps, although it is important to me to do it in a way that would not require ElixirLS to be specified in the project deps (otherwise I wouldn't be able to use ElixirLS on any Elixir project that I want). But I do think that it would be great to be able to use ElixirLS in that way.

axelson avatar Jul 18 '21 22:07 axelson

Thanks for the reply @axelson! Is there anything I can do to help in setting this up? I'm sure you'll want to own the account that actually controls the package, but I'm happy to do any leg work you'd find helpful to get this working.

LandonSchropp avatar Jul 23 '21 17:07 LandonSchropp

It should all be possible with git dependencies (https://elixir-lang.org/getting-started/mix-otp/dependencies-and-umbrella-projects.html) so you wouldn't even need to create a hex package when setting it all up.

Also it may be worthwhile to read this packaging issue and related discussion: https://github.com/elixir-lsp/elixir-ls/issues/115

axelson avatar Jul 24 '21 22:07 axelson

@axelson Sorry for the slow reply on this! This issue fell off my radar.

You're right, this is totally possible using a Git in the package manager. The big downside to this is you'd lose Hex's version management. It's possible to specify a specific commit or tag when listing the package, but mix deps.update wouldn't work for patches or minor version bumps. You could also use a branch dependency, but if anything go wrong on a development branch or isn't perfect, then you're pulling those issues into your branch. You also lose the benefit of semantic versioning with the Git approach.

I think the package manager solves these issues, so if you're open to it, that approach feels cleaner.

I read through the discussion you posted. Sorry for missing that before! If you'd like, I'd be happy to move this discussion there.

I think I find myself agreeing with @tomekowal's thoughts there:

I wonder if it would be possible to go one step further and make elixir_ls dev dependency of a project, like credo or dialyxir. It would guarantee, elixir_lsp uses the same version of Erlang/Elixir and JSON libraries as the project. It seems simpler to me than a global server with multiple instances running different Elixir versions communicating with it.

This is what I'd expect when compared to other languages' language servers.

If you're up for a Hex package, is there anything specific you'd like me to tackle? I'd imagine you'd want to own the Hex accounts for the package. I could configure the mix.exs file if you'd like and look into anything else required. I haven't personally set up a Hex package before, but I'd imagine it isn't much different than a Node package or a Ruby gem.

LandonSchropp avatar Aug 23 '21 21:08 LandonSchropp

I think that much greater benefit of distributing trough hex would be ability to use the Mix.install function. This could be combined with elixir version managers and ensure that your server will be using same version of the Elixir as an given project.

mpmiszczyk avatar Dec 23 '21 10:12 mpmiszczyk

This is not currently planned

lukaszsamson avatar Oct 06 '22 16:10 lukaszsamson