# Emacs - Elixir Setup Configuration Wiki

**URL:** <https://forum.elixirforum.com/t/emacs-elixir-setup-configuration-wiki/19196>\
**Category:** Wikis\
**Tags:** spacemacs, wiki, emacs, code-editors, language-server-protocol\
**Created:** [January 6, 2019, 7:38pm UTC](https://forum.elixirforum.com/t/emacs-elixir-setup-configuration-wiki/19196 "2019-01-06T19:38:53Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![axelson](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/axelson/32/26351_2.png) [@axelson](https://forum.elixirforum.com/u/axelson)\
**Post date:** [January 6, 2019, 7:38pm UTC](https://forum.elixirforum.com/t/emacs-elixir-setup-configuration-wiki/19196/1 "2019-01-06T19:38:53Z")

</div>

_This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!)_

This post collects concrete information about configuring Emacs to be an Elixir editing environment.

Related posts/info:

- General Elixir Emacs resources/links/blog posts: [Emacs - General Discussion, Blog Posts, Wiki](https://forum.elixirforum.com/t/emacs-general-discussion-blog-posts-wiki/427)
- Emacs lsp thread: [Emacs lsp-mode (language server) + elixir-ls anyone? - #15 by rodrigues](https://forum.elixirforum.com/t/emacs-lsp-mode-language-server-elixir-ls-anyone/11834/15)

# Overview

- [Alchemist](http://alchemist-elixir.org/) - Very full featured but development has stalled, not currently recommended
- [elixir-mode](https://github.com/elixir-editors/emacs-elixir) - Provides the basic font-locking, indentation and navigation support
  - Should be used as the baseline of support

- [elixir-ts-mode](https://github.com/wkirschbaum/elixir-ts-mode) - Provides font-locking and other basic features based on the [tree-sitter grammar for elixir](https://github.com/elixir-lang/tree-sitter-elixir)
  - Built into Emacs as of 29.1
  - Either elixir-ts-mode or elixir-mode may be used, but not both.

- Elixir Language Server backend
  - [elixir-ls](https://github.com/elixir-lsp/elixir-ls) - Elixir LSP server implementation (previously this was a fork, but it has since been reconciled)

- Language Server Emacs Frontend **(choose 1)**
  - [lsp-mode](https://github.com/emacs-lsp/lsp-mode/) - General LSP (Language Server Protocol) mode, use it together with a language server implementation
  - [eglot](https://github.com/joaotavora/eglot/) - an Emacs [LSP](https://microsoft.github.io/language-server-protocol/) client that stays out of your way

- [exunit.el](https://github.com/ananthakumaran/exunit.el) - Simple test runner for ex\_unit tests

# Configuration Examples/Instructions

## Installing elixir language server

Note: Elixir 1.8.2 (compiled on otp 21) and Erlang 21.3.8 are recommended if you want to work on a wide range of projects. If you use [asdf](https://github.com/asdf-vm/asdf-elixir/), then this will be taken care of for you with a `cp .release-tool-versions .tool-versions && asdf install`.

- Clone the elixir-lsp elixir-ls repository locally
  - `git clone https://github.com/elixir-lsp/elixir-ls.git`

- `cd elixir-ls` (that you just cloned)
- `mix deps.get`
- `mix elixir_ls.release`

This will create a `release/language_server.sh` (and `.bat` for windows) file that you will need for the Emacs integration, so note down this path (referred to later as `path-to-elixir-ls/release`).

## `eglot` Configuration

### With Spacemacs

_Warning: I still face issues with evil-mode and eglot in Spacemacs. If anyone manages to make it work properly, feel free to edit this guide._

1. The `elixir` layer in Spacemacs does not play well with Eglot: it calls `lsp-mode` from the Spacemacs `lsp` layer. Do NOT use it. Instead, add `elixir-mode` in `dotspacemacs-additional-packages` .
2. Add `eglot` in `dotspacemacs-additional-packages`.
3. Add in `dotspacemacs/user-config` :

```lisp
(require 'eglot)

;; This is optional. It automatically runs `M-x eglot` for you whenever you are in `elixir-mode`
(add-hook 'elixir-mode-hook 'eglot-ensure)

;; Make sure to edit the path appropriately, use the .bat script instead for Windows
(add-to-list 'eglot-server-programs '(elixir-mode "path-to-elixir-ls/release/language_server.sh"))

```

1. If you didn’t add the optional hook, run `M-x` in any Elixir file to activate `eglot`.

Note:

- The `require` instruction must come before the others.
- If you fail to add the `require` instruction appropriately, `eglot` will randomly stop working on Emacs restart, and you will be prompted the error described [in this GitHub issue](https://github.com/joaotavora/eglot/issues/238#issuecomment-604736804).

### With Vanilla Emacs

```lisp
(package-install 'eglot)

;; This is optional. It automatically runs `M-x eglot` for you whenever you are in `elixir-mode`
(add-hook 'elixir-mode-hook 'eglot-ensure)

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

```

Note: the `package-install` line must come before the `add-to-list`

And then, if you didn’t add the optional hook, type `M-x eglot` in any elixir file.

(You may also want to view this [alternative configuration example](https://gist.github.com/rodrigues/0866b71ba98a600169cc04ab1473beb6) which used to be recommended here)

## `lsp-mode` Configuration

### With Doom Emacs:

Elixir module documentation can be found at: [https://github.com/hlissner/doom-emacs/blob/develop/modules/lang/elixir/README.org](https://github.com/hlissner/doom-emacs/blob/develop/modules/lang/elixir/README.org)

1. In your `init.el` ensure that the `lsp` Doom module is enabled
2. In your `init.el` enable the Elixir layer with `(elixir +lsp)`
3. Ensure that `language_server.sh` (generated from `mix elixir_ls.release`) is on your `$PATH`

### With Spacemacs:

1. Ensure that you are using the `develop` branch of spacemacs (your `~/.emacs.d` should be on the `develop` branch)  
a. This is necessary as of 2019/03/03 but once 0.300 comes out it should be fine to use the stable release
2. Set the elixir-backend variable inside your layer definitions i.e. `(elixir :variables elixir-backend 'lsp)`

**NOTE** : As of [Add elixir-ls as a language backend for elixir by mpanarin · Pull Request #12668 · syl20bnr/spacemacs · GitHub](https://github.com/syl20bnr/spacemacs/pull/12668) alchemist is no longer included by default so excluding alchemist is no longer necessary

Add alchemist to your excluded package list `dotspacemacs-excluded-packages '(alchemist)` so that it is not loaded (since we’re using `lsp-mode` instead)

### With Vanilla Emacs

- Add `lsp-mode` via MELPA
  - M-x `package-install` [RET] `lsp-mode` [RET]

### For both Spacemacs and Vanilla Emacs

```elisp
  (use-package lsp-mode
    :commands lsp
    :ensure t
    :diminish lsp-mode
    :hook
    (elixir-mode . lsp)
    :init
    (add-to-list 'exec-path "path-to-elixir-ls/release"))

```

Verify that it is working by opening up a file in an elixir project (you should receive a prompt like `mix.exs is not part of any project. Select action:`. To which you probably want to respond `Import project root`. Then if there are no errors you can run `M-x lsp-describe-session` which will show you all of your lsp server sessions. On this screen you can press `RET` on the "diamond’ icon next to `Capabilities` to see the detected capabilities of the server.

Note: there is also [GitHub - elixir-lsp/lsp-elixir.el: Emacs minor mode to interact with elixir buffers by using LSP · GitHub](https://github.com/Trevoke/lsp-elixir.el) that will manage the elixir-ls installation for you, but by installing it manually (as above) you can more easily contribute to elixir-ls.

Note: if you already have lsp-mode installed make sure it is up-to date (version 5.0 had many breaking changes)

Handy optional configuration: add `'(lsp-ui-doc-enable nil t)` to remove the auto-doc popups (instead you can run `, h h` when you want the docs). You can also run `, T d` to temporarilly enable/disable the popups.

**ElixirLS Configuration**

As mentioned in the elixir-ls README, as with VSCode you can configure the language server through entries in `settings.json`.

**Configure emacs settings with lsp-mode**

To configure through emacs (using lsp-mode), you can use code like the below.

```lisp
  (defvar lsp-elixir--config-options (make-hash-table))

  (add-hook 'lsp-after-initialize-hook
            (lambda ()
              (lsp--set-configuration `(:elixirLS, lsp-elixir--config-options))))

```

You can use a `.dir-locals.el` file to set config options specific to the project. For example to disable dialyzer in one project, you’d run the above code in your init and the following in your `.dir-locals.el`:

```lisp
  (puthash "dialyzerEnabled" :json-false lsp-elixir--config-options)

```

**Configure emacs settings with eglot**

You can use `.dir-locals.el` local to your project directory like so, without configuring any other explicitly configuration-related hooks for `eglot`:

```elisp
((elixir-mode
  . ((eglot-workspace-configuration
      . ((:elixirLS . (:projectDir "subdir")))))))

```

**DAP(Debug Adapter Protocol)**  
For integrated debugging, optionally enable DAP ([Debug Adapter Protocol](https://microsoft.github.io/debug-adapter-protocol/)) (requires installing `dap-mode` from MELPA):

```lisp
(require 'dap-elixir)
(dap-ui-mode)
(dap-mode)

```

## exunit.el configuration

Note: this is recommended because the LSP protocol does not currently include running tests (so this is a good supplement to `lsp-mode` and `eglot`)

Note: Doom Emacs `elixir` module installs exunit.el by default

**Install by cloning locally:**

- clone [GitHub - ananthakumaran/exunit.el: Emacs ExUnit test runner · GitHub](https://github.com/ananthakumaran/exunit.el.git) locally

Add this to your emacs configuration:

```lisp
  (add-to-list 'load-path "~/path_to_exunit.el")
  (require 'exunit)

```

**Or Install via melpa:**

M-x `package-install` [RET] `exunit` [RET]

**Optional key binding examples with Spacemacs:**

```lisp
  (with-eval-after-load 'elixir-mode
    (spacemacs/declare-prefix-for-mode 'elixir-mode
      "mt" "tests" "testing related functionality")
    (spacemacs/set-leader-keys-for-major-mode 'elixir-mode
      "tb" 'exunit-verify-all
      "ta" 'exunit-verify
      "tk" 'exunit-rerun
      "tt" 'exunit-verify-single))

```

In Spacemacs (and I assume custom configs if you have popwin installed) you can add:

```lisp
(push '("*exunit-compilation*"
        :dedicated t
        :position bottom
        :stick t
        :height 0.4
        :noselect t)
      popwin:special-display-config)

```

To make the exunit window always appear at the bottom and close when you press `C-g`

## Tips and Tricks

- Enable code folding with Doom Emacs: [https://blog.evalcode.com/enable-elixir-code-folding-in-doom-emacs/](https://blog.evalcode.com/enable-elixir-code-folding-in-doom-emacs/)
  - If you’re using Vanilla Emacs you could duplicate this setup as well

---

<div class="post-metadata">

**Author:** ![ananthakumaran](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/ananthakumaran/32/36597_2.png) [@ananthakumaran](https://forum.elixirforum.com/u/ananthakumaran)\
**Post date:** [January 7, 2019, 10:06am UTC](https://forum.elixirforum.com/t/emacs-elixir-setup-configuration-wiki/19196/2 "2019-01-07T10:06:01Z")

</div>

exunit is available in melpa, so it could be installed via `package-install`

---

<div class="post-metadata">

**Author:** ![jeremyjh](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/jeremyjh/32/5995_2.png) [@jeremyjh](https://forum.elixirforum.com/u/jeremyjh)\
**Post date:** [January 7, 2019, 1:14pm UTC](https://forum.elixirforum.com/t/emacs-elixir-setup-configuration-wiki/19196/3 "2019-01-07T13:14:14Z")

</div>

Thanks for putting this together! Is it recommended for Spacemacs users to add `dotspacemacs-excluded-packages '(alchemist)` ?

I know there was also an attempt to update Alchemist to use `elixir-ls`, maybe the alternative is to add an option to the spacemacs layer that would implement most of this.

---

<div class="post-metadata">

**Author:** ![axelson](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/axelson/32/26351_2.png) [@axelson](https://forum.elixirforum.com/u/axelson)\
**Post date:** [January 7, 2019, 5:09pm UTC](https://forum.elixirforum.com/t/emacs-elixir-setup-configuration-wiki/19196/4 "2019-01-07T17:09:43Z")

</div>

> [@ananthakumaran](#):
>
> exunit is available in melpa, so it could be installed via `package-install`

Thanks! I’ve updated the instructions to include that.

---

<div class="post-metadata">

**Author:** ![axelson](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/axelson/32/26351_2.png) [@axelson](https://forum.elixirforum.com/u/axelson)\
**Post date:** [January 7, 2019, 5:29pm UTC](https://forum.elixirforum.com/t/emacs-elixir-setup-configuration-wiki/19196/5 "2019-01-07T17:29:00Z")

</div>

> [@jeremyjh](#):
>
> Thanks for putting this together! Is it recommended for Spacemacs users to add `dotspacemacs-excluded-packages '(alchemist)` ?

Your welcome! Yes it is (at least IMO), and I realized that I forgot that portion of the required configuration. Adding it to the wiki now.

> [@jeremyjh](#):
>
> I know there was also an attempt to update Alchemist to use `elixir-ls` , maybe the alternative is to add an option to the spacemacs layer that would implement most of this.

There were actually two attempts by @trevoke:

- A complete rewrite attempt (that removes alchemist server): [[Abandoned - use elixir-ls] Switching to elixir-ls as back-end by Trevoke · Pull Request #341 · tonini/alchemist.el · GitHub](https://github.com/tonini/alchemist.el/pull/341)
- A more piece-by-piece replacement attempt: [[WIP] goto def and find usage now backed by elixir-ls by Trevoke · Pull Request #350 · tonini/alchemist.el · GitHub](https://github.com/tonini/alchemist.el/pull/350)

But they ultimately became stale and were never merged into alchemist.el (hence not being recommended in this wiki).

It is a good idea to update the spacemacs `+lang/elixir` layer to switch from alchemist to a properly configured `lsp-mode` (which had completely slipped my mind until you mentioned it). I would assume it’s okay for `+lang/elixir` to depend on the `lsp` layer but we’ll have to see if that flies with the spacemacs team.

---

<div class="post-metadata">

**Author:** ![joaotavora](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/joaotavora/32/13483_2.png) [@joaotavora](https://forum.elixirforum.com/u/joaotavora)\
**Post date:** [January 8, 2019, 5:49pm UTC](https://forum.elixirforum.com/t/emacs-elixir-setup-configuration-wiki/19196/6 "2019-01-08T17:49:05Z")

</div>

I’m Eglot’s author. I stumbled upon this. Just wanted to say here that it is nonsense to call the section “Eglot configuration”, because Eglot is a [completely different LSP client for Emacs](https://github.com/joaotavora/eglot). It’s setup is also much simpler, it’s probably just

```elixir
(package-install 'eglot)
(add-to-list 'eglot-server-programs (elixir-mode "path-to-exilir-ls-executable"))

```

And then type `M-x eglot` in any elixir file.

---

<div class="post-metadata">

**Author:** ![axelson](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/axelson/32/26351_2.png) [@axelson](https://forum.elixirforum.com/u/axelson)\
**Post date:** [January 8, 2019, 7:47pm UTC](https://forum.elixirforum.com/t/emacs-elixir-setup-configuration-wiki/19196/7 "2019-01-08T19:47:07Z")

</div>

> [@joaotavora](#):
>
> I’m Eglot’s author. I stumbled upon this. Just wanted to say here that it is nonsense to call the section “Eglot configuration”, because Eglot is a [completely different LSP client for Emacs](https://github.com/joaotavora/eglot).

Welcome to the forum and thanks for contributing 🙂. I have restructured the sections to make it more obvious that you should use either Eglot or lsp-mode since they provide the same functionality. Looks like I initially missed eglot in the overview section as well (which I have now rectified).

> [@joaotavora](#):
>
> It’s setup is also much simpler, it’s probably just
> 
> ```elisp
> 
> (package-install 'eglot)
> 
> (add-to-list 'eglot-server-programs (elixir-mode "path-to-exilir-ls-executable"))
> 
> ```
> 
> And then type `M-x eglot` in any elixir file.

Thanks! That is **much** simpler, so I’ve updated the instructions to that. Since I haven’t tried using eglot I just copied the configuration instructions from this [other forum post](https://forum.elixirforum.com/t/emacs-lsp-mode-language-server-elixir-ls-anyone/11834/15) which links to this [gist](https://gist.github.com/rodrigues/0866b71ba98a600169cc04ab1473beb6) (which it looks like you found already 😄).

---

<div class="post-metadata">

**Author:** ![yyoncho](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/yyoncho/32/13471_2.png) [@yyoncho](https://forum.elixirforum.com/u/yyoncho)\
**Post date:** [January 8, 2019, 8:55pm UTC](https://forum.elixirforum.com/t/emacs-elixir-setup-configuration-wiki/19196/8 "2019-01-08T20:55:07Z")

</div>

@axelson lsp-mode also have debugger support for Elixir via dap-mode. The configuration is simple as the configuration of lsp-mode:

Install dap-mode and then:

(require 'dap-elixir)  
(dap-ui-mode)  
(dap-mode)

 ![](https://forum.elixirforum.com/uploads/default/original/2X/6/683e9e02a81882ad0f3e972ab4c36d4216104453.png)

---

<div class="post-metadata">

**Author:** ![axelson](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/axelson/32/26351_2.png) [@axelson](https://forum.elixirforum.com/u/axelson)\
**Post date:** [January 9, 2019, 9:16am UTC](https://forum.elixirforum.com/t/emacs-elixir-setup-configuration-wiki/19196/9 "2019-01-09T09:16:50Z")

</div>

Thanks! Added! And welcome to the forum as well 🙂

---

<div class="post-metadata">

**Author:** ![kpanic](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/kpanic/32/2052_2.png) [@kpanic](https://forum.elixirforum.com/u/kpanic)\
**Post date:** [January 19, 2019, 3:21pm UTC](https://forum.elixirforum.com/t/emacs-elixir-setup-configuration-wiki/19196/10 "2019-01-19T15:21:19Z")

</div>

Hello, instructions regarding eglot half-worked for me. With OTP 21 elixir\_ls server crashes, looks like it’s required OTP 20. I recompiled it and now eglot connected to the language\_server (ran from `release/language_server.sh` (not `dist` folder)

EDIT: I also created the release with `MIX_ENV=prod mix elixir_ls.release` – not sure if that helps 🙂

---

<div class="post-metadata">

**Author:** ![axelson](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/axelson/32/26351_2.png) [@axelson](https://forum.elixirforum.com/u/axelson)\
**Post date:** [January 19, 2019, 6:12pm UTC](https://forum.elixirforum.com/t/emacs-elixir-setup-configuration-wiki/19196/11 "2019-01-19T18:12:42Z")

</div>

Thanks! I committed an asdf `.tool-versions` file and added elixir and erlang versions to the readme. I’m using 1.6.6 with erlang 20.2.4. Updated the instructions (changed `dist` to `release` as well).

---

<div class="post-metadata">

**Author:** ![kpanic](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/kpanic/32/2052_2.png) [@kpanic](https://forum.elixirforum.com/u/kpanic)\
**Post date:** [January 20, 2019, 11:00am UTC](https://forum.elixirforum.com/t/emacs-elixir-setup-configuration-wiki/19196/12 "2019-01-20T11:00:40Z")

</div>

Thanks to you! 😉

---

<div class="post-metadata">

**Author:** ![belaustegui](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/belaustegui/32/36580_2.png) [@belaustegui](https://forum.elixirforum.com/u/belaustegui)\
**Post date:** [January 20, 2019, 4:55pm UTC](https://forum.elixirforum.com/t/emacs-elixir-setup-configuration-wiki/19196/13 "2019-01-20T16:55:53Z")

</div>

> [@axelson](#):
>
> - [elixir-ls](https://github.com/JakeBecker/elixir-ls) - Original Elixir LSP server implementation, development has currently stalled in Oct. 2018
> - [elixir-ls elixir-lsp fork](https://github.com/elixir-lsp/elixir-ls) - Fork of @JakeBecker’s elixir-ls that is currently (as of Jan. 2019) being actively developed

Is this true? I am an Elixir LS user myself (in VSCode instead of Emacs, but this applies equally) and it is true that the Elixir LS repository has many open PRs waiting to be merged.  
It would be great to know whether the original author has really abandoned the repository or whether he has temporally paused the work.

---

<div class="post-metadata">

**Author:** ![NobbZ](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/nobbz/32/27235_2.png) [@NobbZ](https://forum.elixirforum.com/u/NobbZ)\
**Post date:** [January 20, 2019, 5:51pm UTC](https://forum.elixirforum.com/t/emacs-elixir-setup-configuration-wiki/19196/14 "2019-01-20T17:51:41Z")

</div>

> [@belaustegui](#):
>
> [has] the original author […] really abandoned the repository or [..] has [he] temporally paused the work[?]

@JakeBecker is unresponsive here, at GitHub and on slack, so I think we can safely assume he has abondoned the project, if not elixir as a whole…

---

<div class="post-metadata">

**Author:** ![JakeBecker](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/jakebecker/32/11288_2.png) [@JakeBecker](https://forum.elixirforum.com/u/JakeBecker)\
**Post date:** [January 21, 2019, 1:22am UTC](https://forum.elixirforum.com/t/emacs-elixir-setup-configuration-wiki/19196/15 "2019-01-21T01:22:01Z")

</div>

Hi!

Sorry I’ve been unresponsive. I’ve been feeling burnt out on maintaining ElixirLS and have not been active in responding to people, but I plan to catch up on PRs soon. I’ll continue to try to fix breaking bugs quickly, but minor bugs and feature requests are going on the back-burner. I know that can be frustrating – apologies to anyone who’s tried to contribute and been unable to get ahold of me.

---

<div class="post-metadata">

**Author:** ![axelson](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/axelson/32/26351_2.png) [@axelson](https://forum.elixirforum.com/u/axelson)\
**Post date:** [January 21, 2019, 6:44am UTC](https://forum.elixirforum.com/t/emacs-elixir-setup-configuration-wiki/19196/16 "2019-01-21T06:44:42Z")

</div>

I’m glad to hear that! ElixirLS is an important and valued project 🙂

---

<div class="post-metadata">

**Author:** ![NobbZ](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/nobbz/32/27235_2.png) [@NobbZ](https://forum.elixirforum.com/u/NobbZ)\
**Post date:** [January 21, 2019, 9:05am UTC](https://forum.elixirforum.com/t/emacs-elixir-setup-configuration-wiki/19196/17 "2019-01-21T09:05:32Z")

</div>

After things are moving now, would you mind getting in touch and join forces with the new elixir-lsp group on github? I’d prefer if we keep friction low and avoid a community split…

---

<div class="post-metadata">

**Author:** ![clag](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/clag/32/11919_2.png) [@clag](https://forum.elixirforum.com/u/clag)\
**Post date:** [March 2, 2019, 3:14pm UTC](https://forum.elixirforum.com/t/emacs-elixir-setup-configuration-wiki/19196/19 "2019-03-02T15:14:17Z")

</div>

@axelson first thanks for taking the time to write this guide, I’m getting an error with eglot,

(Spacemacs) Error in dotspacemacs/user-config: Symbol’s value as variable is void: eglot-server-programs

I’m writting the configuration inside the user-config (not sure if it’s the best place for this)

```elixir
  (add-to-list
   'eglot-server-programs
   '(elixir-mode "/home/yo/Descargas/proj/elixir/elixir-ls/rel"))
  )

```

I’ve tried different ways

```elixir
  (add-to-list
   'eglot-server-programs
   '(elixir-mode "/home/yo/Descargas/proj/elixir/elixir-ls/rel/language_server.sh"))
  )

(add-to-list
 'eglot-server-programs
'(elixir-mode . ("sh" "/home/yo/Descargas/proj/elixir/elixir-ls/rel/language_server.sh")))

```

but no one works for me…do you know which could be the issue here?..thank you

---

<div class="post-metadata">

**Author:** ![clag](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/clag/32/11919_2.png) [@clag](https://forum.elixirforum.com/u/clag)\
**Post date:** [March 3, 2019, 1:30am UTC](https://forum.elixirforum.com/t/emacs-elixir-setup-configuration-wiki/19196/20 "2019-03-03T01:30:38Z")

</div>

hi guy, thanks to joao I can activate eglot and seems working fine

[https://github.com/joaotavora/eglot/issues/238](https://github.com/joaotavora/eglot/issues/238)

now I’m a bit stuck with the lsp-mode, I’m using spacemacs, so I add lsp to my configuration layers, after restart nothing happen, so I try the vanilla way, I add lsp-mode to my packages and the config, nothing happen again, when I open an elixir file I don’t get any alert…

I install lsp-elixir.el and now when I open an elixir file finally seems it runs…but I get an error: No LSP for elixir-mode

my lsp configuration is inside user-config and is

```elixir

  (use-package lsp-mode
    :commands lsp
    :ensure t
    :diminish lsp-mode
    :hook
    (elixir-mode . lsp)
    :init
    (add-to-list 'exec-path "/home/yo/Descargas/proj/elixir/elixir-ls/rel/language_server.sh"))

```

is it correct?..thank you

by the way, the eglot error was that I was missing the line  
(require 'eglot)

before the configuration…not sure if your guide must be update with this info

thank you

UPDATE  
ok…seems that I was missing the line (choose 1) and I installed both, eglot seems run and working but I don’t get autocompletion with spacemacs, I think that autocompletion is the most required featured for me so if you guys use spacemacs and eglot, I’ll appreciate any help…thank ypu

---

<div class="post-metadata">

**Author:** ![axelson](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/axelson/32/26351_2.png) [@axelson](https://forum.elixirforum.com/u/axelson)\
**Post date:** [March 3, 2019, 6:00pm UTC](https://forum.elixirforum.com/t/emacs-elixir-setup-configuration-wiki/19196/21 "2019-03-03T18:00:17Z")

</div>

> [@clag](#):
>
> ok…seems that I was missing the line (choose 1) and I installed both, eglot seems run and working but I don’t get autocompletion with spacemacs, I think that autocompletion is the most required featured for me so if you guys use spacemacs and eglot, I’ll appreciate any help…thank ypu

I’m glad you were able to get eglot installed successfully! Also I just made the “(choose 1)” section bold so hopefully that’ll help next time 🙂

My understanding of eglot is admittedly incomplete (as I use `lsp-mode`), but I think eglot tries to be less in your face by default and you may need to install `company-mode` to get auto-completion: [GitHub - company-mode/company-mode: Modular in-buffer completion framework for Emacs · GitHub](https://github.com/company-mode/company-mode)

[Next page](https://forum.elixirforum.com/t/emacs-elixir-setup-configuration-wiki/19196.md?page=2)
