⚠️ work in progress – Emacs lsp-mode for Elixir, using elixir-ls server, both based on the Language Server Protocol.
Switch branches/tags
Nothing to show
Clone or download
Latest commit f84c6f5 Mar 7, 2018
Permalink
Failed to load latest commit information.
LICENSE First commit Mar 6, 2018
README.md More config docs Mar 7, 2018
elixirls First commit Mar 6, 2018
elixirls-setup First commit Mar 6, 2018
lsp-elixir.el Fix command configuration Mar 6, 2018

README.md

lsp-elixir

Emacs lsp-mode for Elixir, using elixir-ls server, both based on the Language Server Protocol.

⚠️ This package is still under development, it only works partially, and is not recommended for daily use.

🔋 Pull Requests with fixes and improvements are more than welcome.

Installation

  • Have packages elixir-mode and lsp-mode installed.

  • Clone this repository: $ git clone https://github.com/rodrigues/lsp-elixir.git

  • Add this to your emacs config:

(require 'elixir-mode)
(require 'lsp-mode)

(add-to-list 'load-path "<path to lsp-elixir>")
(require 'lsp-elixir)

(add-hook 'elixir-mode-hook #'lsp-elixir-enable)

This assumes you have an executable elixirls that will run elixir-ls language server.

  • You can use the one provided in this repo, and use elixirls-setup, also provided in this repo, to provide a elixir-ls release.

  • You can also customize the command that is run, using M-x customize-group lsp-elixir. Alternatively, you can also add to emacs config:

(setq lsp-elixir-ls-command "sh")
(setq lsp-elixir-ls-args '("YOUR_PATH_TO_ELIXIRLS/language_server.sh"))

Auto format on save

Add the following to your emacs config:

(add-hook 'elixir-mode-hook (lambda () (add-hook 'before-save-hook 'lsp-format-buffer)))

Company integration

You'd need to install the packages company and company-lsp and add the following to your emacs config:

(require 'company-lsp)
(require 'company)

(push 'company-lsp company-backends)

Flycheck integration

You need to have lsp-ui package to have flycheck integration.

(require 'lsp-ui)
(add-hook 'lsp-mode-hook 'lsp-ui-mode)
(setq lsp-ui-flycheck-enable 1)

Disabling partially lsp-ui

(setq lsp-ui-COMPONENT-enable nil)

COMPONENT needs to be one of: sideline, doc, peek, imenu, or flycheck.