An Emacs Lisp library for interacting with a haskell-ide-engine server using Microsoft's Language Server Protocol.
The library is designed to integrate with existing Emacs IDE frameworks (completion-at-point, xref (beginning with Emacs 25.1), flycheck, haskell-mode, intero, etc).
This package is still under development, and is not recommended for daily use.
Install lsp-mode first, and either clone
this repository, or install from MELPA. Add the following to your .emacs:
(require 'lsp)
(require 'lsp-haskell)
(add-hook 'haskell-mode-hook #'lsp)Note: All three packages are also available via MELPA.
It needs the HIE server in your path, so follow the appropriate OSX or Linux section below accordingly.
The following steps are recommended to bootstrap lsp-haskell on OSX.
git clone https://github.com/haskell/haskell-ide-engine
cd haskell-ide-engine
makeWe need to run make here instead of stack install to ensure that
all versions of ghc are available to support various project
requirements.
After this, we need to instruct Emacs to prefer hie-wrapper over
hie so Hie can infer which version of ghc we need for a particular
project.
(setq lsp-haskell-process-path-hie "hie-wrapper")Or of you are on linux (only place it has been tested, reports please)
git clone https://github.com/haskell/haskell-ide-engine
cd haskell-ide-engine
makeThis will build executables called hie-8.0.2, hie-8.2.2 etc which
can be selected by usingM-x customize for lsp-haskell
HIE has some settings that can be changed on the fly. These are exposed via a set of interactive functions.
lsp-haskell-set-hlint-on/lsp-haskell-set-hlint-offTurn hlint checks on or off.lsp-haskell-set-max-number-of-problemsSet the maximum number of diagnostics reported.lsp-haskell-set-liquid-on/lsp-haskell-set-liquid-offTurn liquid haskell checks on save on or off.lsp-haskell-set-completion-snippets-on/lsp-haskell-set-completion-snippets-offWhether completion should return plain text or snippets.
There are also non-interactive versions that do not actually send the
settings to the live server, but are suitable for use in .dir-locals
for a specific project.
lsp-haskell-set-hlintlsp-haskell-set-max-problemslsp-haskell-set-liquidlsp-haskell-set-completion-snippets