victorolinasc

victorolinasc

Emacs lsp-mode (language server) + elixir-ls anyone?

Has anyone tried the emacs lsp-mode + elixir-ls?

I’ve noticed that the emacs support is starting to get behind other editors. Actually, alchemist and elixir-mode are really nice, but they are lagging behind in terms of evolution. Several issues without answer and no new releases for a while.

I started to take a look at alternatives and I really like the idea of a Language Server for Elixir (and Erlang). Elixir-ls works nicely with Visual Studio Code and I wonder if it would work with emacs-lsp but Haven found the time to try it yet.

So, has anyone tried this combination with luck? I really think all efforts on IDE/text editors support should focus on language server now. We would all have a very similar experience with our prefered keybindings and plugins…

Most Liked

rodrigues

rodrigues

It’s definitely still in progress, but now it’s talking to elixir-ls behind the scenes!! https://gist.github.com/rodrigues/a7277c70ab9be361390fa52f923e7e03 :cowboy_hat_face:

Thanks @JakeBecker, the releases really helped!

EDIT: moved it into a github repo. PRs are more than welcome!

https://github.com/rodrigues/lsp-elixir

victorolinasc

victorolinasc

I’ve managed to get elixir-ls through alchemist working too. Here is my configuration just in case anyone would want to give it a try:

First, I’ve cloned @Trevoke’s for on ~/.alchemist. Then on my init.el (with use-package already configured), I have:

(use-package company
  :ensure t
  :diminish company-mode
  :bind ("M-/" . company-complete)
  :defer t
  :config
  (global-company-mode))

 (use-package company-quickhelp
  :after (company)
  :ensure t
  :config
  (company-quickhelp-mode))

(use-package lsp-mode
  :ensure t)

(use-package lsp-ui
  :after (lsp-mode)
  :ensure t)

(use-package company-lsp
  :after (company lsp-mode)
  :config
  (push 'company-lsp company-backends)
  :ensure t)

(use-package alchemist
  :after (elixir-mode)
  :load-path "../.alchemist"
  :config
  (require 'alchemist-elixir-ls)
  (require 'alchemist-goto)
  (require 'alchemist))

Hope this helps!

edmz

edmz

BTW, Spacemacs just added LSP support. Maybe you can see what they did there to make it work.

JakeBecker

JakeBecker

I’ve just gotten around to publishing a precompiled release package which includes .sh and .bat scripts for launching the language server and debugger: Releases · JakeBecker/elixir-ls · GitHub

I’m hoping this makes it easier to integrate into IDE plugins. Hope that helps @rodrigues and everyone!

Trevoke

Trevoke

Hi all,

Thanks for the interest!

Yeah, this is not yet ready for spacemacs, unfortunately. I originally thought I could do a back-end refactor of alchemist and get rid of all the original code, using only elixir-ls, but it turns out that alchemist does a lot of things that need to be implemented in the LSP server, so I’m going to do the refactor much more incrementally.

I’m looking forward to collaborating with the community on the growth of elixir_sense (the Elixir code analyzer), elixir-ls (the Elixir LSP server) and alchemist (the emacs client).

I’ve started forks of the back-end components ( Elixir Language Server Protocol · GitHub ) because I had a very hard time getting in touch with the maintainers – and because I think this stuff should belong to the community, not a single person.

Where Next?

Popular in Questions Top

aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
fireproofsocks
I’m working on defining a simple Ecto schema for a table (in PostGres), but I don’t see where I can define a column as NOT NULL. Conside...
New
tduccuong
Hi, is there any work on GUI with Elixir, that is similar to Electron/Javascript? My idea is to bundle Phoenix and BEAM into a single se...
New
Fl4m3Ph03n1x
About me? ( if you have nothing better to do than reading about some random guy in the internet :stuck_out_tongue: ) Hello all, this is ...
New
LegitStack
I’m trying to make a websocket server in Phoenix or raw Elixir. I heard about gun, I think I could use cowboy, but since I’m not that sma...
New
Qqwy
Original source of discussion: This topic on the Pragmatic Programmers’ Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New

Other popular topics Top

Darmani72
If I have a post route which an argument: post /my_post_route/:my_param1, MyController.my_post_handler How would get the post params ...
New
sorentwo
Hello! tl;dr Announcing Oban, an Ecto based job processing library with a focus on reliability and historical observability. After spen...
985 42920 311
New
skosch
To my knowledge, put_in, Map.update etc. all have the one limitation of not automatically creating intermediate keys when needed (for exa...
New
JeremM34
Hello, how can I check the Phoenix version ? Thanks !
New
AngeloChecked
What learn first? Rust or Elixir Hi Elixir community! I’m here because i want learn a new language. I’m a junior developer and mainly i ...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New
New
pmjoe
I have a relationship of love and hate with Elixir. Lots of things are just absolutely right, but there are some things that are kind of ...
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
New

We're in Beta

About us Mission Statement