(Emacs Polyglot - Emacs LSP client. It's an Emacs package)

To install it in Emacs, please add eglot package with Emacs package installer you use.
Or Just type M-x package-install RET eglot RET into Emacs 26.1+.

Next, you need elixir-ls i.e. Elixir Language Server for using eglot

Clone elixir-ls to a directory

git clone

cd elixir-ls

mix deps.get

mix compile

Create elixir-ls release

mix elixir_ls.release -o release

Then in your Emacs config

Add following lines (You should be already using elixir-mode)

(require 'eglot)
(add-to-list 'eglot-server-programs `(elixir-mode "/path/to/elixir-ls/release/"))

(add-hook 'elixir-mode-hook 'eglot-ensure)

This is it.

Now restart Emacs and visit your Elixir project, Eglot should be in action.

Go to any elixir file and type code, it should auto suggest the code, select the one you like and hit enter.

That's it. Magic!

Also you can add following hook to auto elixir-format files on save

(require 'elixir-mode)
(require 'eglot)

(add-hook 'elixir-mode-hook
          (lambda () (add-hook 'before-save-hook 'eglot-format-buffer nil t)))

So whenever you save the file, it will automatically elixir-format the buffer.

For more info, you can checkout my Emacs config for Elixir

My emacs config. Contribute to anildigital/emacs development by creating an account on GitHub.