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…

First 10 of 19 Posts Switch mode

karmajunkie

karmajunkie

Definitely agree—I use spacemacs daily but know just enough elisp to be dangerous… literally. Trying get mix format to format my code on save i managed to get my emacs into a situation where I literally could not close it short of a force kill. Don’t ask me how, I have no idea.

So the moral of the story is that I’m at the tender mercies of those brave souls who forge a path for us mortals to tread. I wish I could help move integrations like alchemist forward, but seriously, I’m a danger to others. I’m going to check out this lsp-mode and pray I don’t manage set off a WarGames situation. Will report back if I’m successful, but don’t wait too long to send out search parties.

rodrigues

rodrigues

Seems an interesting path to move into!

My elisp is also potentially dangerous heheh, I’ve been using emacs for a couple of months only, so I can only do the basic stuff… but gonna play a bit with it, at least take a look at what they did for the other languages :+1:

@karmajunkie on the mix format issue, I’m using GitHub - anildigital/mix-format.el: Emacs package to format Elixir code in Emacs with elixir-mode · GitHub, so far no problems with it!

victorolinasc

victorolinasc OP

I am using mix-format too, though it is a bit slower on Emacs than on VS Code. The issue is that it is not on Melpa yet so I`ve copied it to my config.

Also, the creator of mix-format is interested in merging it into elixir-mode itself. Though it seems it is blocked currently because there is a shortage of elisp reviewers =/

rodrigues

rodrigues

Was trying to hack my way through this, but it still doesn’t work. Here is the wip as for now: https://gist.github.com/rodrigues/a7277c70ab9be361390fa52f923e7e03

karmajunkie

karmajunkie

Any luck with that approach?

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!

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

erikbye

erikbye

I’m using Alchemist with elixir-ls.

https://github.com/tonini/alchemist.el/pull/341

victorolinasc

victorolinasc OP

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!

Where Next?

Trending in Questions Top

jonnycharles
I’m in search of an Elixir library that offers PDF generation capabilities similar to Ruby’s Prawn. While there have been discussions abo...
New
spammy
I’m looking to build a personal workflow to quickly deploy web applications written in elixir/phoenix, for local consumption (ie not on t...
New
silverdr
Using Phoenix.LiveView.TagEngine as an EEx.Engine is deprecated! To compile HEEx, use Phoenix.LiveView.TagEngine.compile/2 instead. Sta...
New
dli
Before I dive in myself, did anyone successfully sprinkle Hologram into their existing LiveView app? Looking for hints regarding: Addi...
New
bottlenecked
Hi all, I wanted to ask how the community is dealing with post-release steps. Today we have Ecto migrations, which make sure that the db...
New
michallepicki
I am using Oban and occasionally, shortly after a deployment, a handful of jobs can fail because of dependency on other parts of the syst...
New
rahultumpala
Hello, I have an Elixir backend that implements a custom protocol over TCP. I want to load test the backend and assess the performance o...
New

Other Trending Topics Top

JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New
ausimian
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New
type1fool
I just stumbled on a newly redesigned elixir-lang.org. :tada: It looks like @Software_Mansion did the work, and I think it is generally a...
New
akoutmos
@hugobarauna and I (Alex Koutmos) have been hard at work on writing a book on Nerves that takes you from simply blinking LEDs to building...
New

We're in Beta

About us Mission Statement