File: README.md

package info (click to toggle)
emacs-lsp-haskell 1.0.20211214-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 156 kB
  • sloc: lisp: 250; makefile: 2
file content (77 lines) | stat: -rw-r--r-- 3,663 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
lsp-haskell
===========

[![MELPA](https://melpa.org/packages/lsp-haskell-badge.svg)](https://melpa.org/#/lsp-haskell) [![Build Status](https://travis-ci.com/emacs-lsp/lsp-haskell.svg?branch=master)](https://travis-ci.com/emacs-lsp/lsp-haskell)

An Emacs Lisp library for interacting with a Haskell language server such as [`haskell-language-server`](https://github.com/haskell/haskell-language-server/) using Microsoft's [Language Server Protocol](https://github.com/Microsoft/language-server-protocol/).

The library acts as a client for [`lsp-mode`](https://github.com/emacs-lsp/lsp-mode).

## Functionality

This main functionality of `lsp-haskell` is:
- Finding and launching the `haskell-language-server` binary
- Providing configuration options to `haskell-language-server`

If you would like to know about how LSP functionality is provided in Emacs and how to use it, please consult [`lsp-mode`](https://github.com/emacs-lsp/lsp-mode).
If you would like to know about the LSP functionality which is provided by the Haskell language server, please consult [`haskell-language-server`](https://github.com/haskell/haskell-language-server).

## Installation

Follow the `lsp-mode` [installation instructions](https://emacs-lsp.github.io/lsp-mode/page/installation/).
Do not skip this!
It has important information.

`lsp-mode` automatically requires the `lsp-haskell` package , so you do not need to `require` `lsp-haskell` unless you like being explicit.

You will need to set some hooks to ensure that `lsp-mode` is triggered when the `haskell-mode` major mode is entered.

```emacs-lisp
(add-hook 'haskell-mode-hook #'lsp)
(add-hook 'haskell-literate-mode-hook #'lsp)
```

## Configuration

HLS has some [configuration](https://haskell-language-server.readthedocs.io/en/latest/configuration.html) you can modify using either the `lsp-haskell` or `lsp` customization groups:

```emacs-lisp
(customize-group 'lsp-haskell)

; or

(customize-group 'lsp)
```

If you want to modify some configuration that this project doesn't support yet you can customize things explicitly yourself using `lsp--set-configuration`. For example:

```emacs-lisp
(add-hook 'lsp-after-initialize-hook
          '(lambda ()
             (lsp--set-configuration
              '(:haskell (:plugin (:tactics (:config (:timeout_duration 5)))))
              )))
```


## Language server installation

Follow the instructions on the [`haskell-language-server`](https://github.com/haskell/haskell-language-server) repositories to install the server binaries.

If you have installed the binaries to a location that is not on your `PATH`, or you are not using the `haskell-language-server-wrapper`, then you will need to customize the `lsp-haskell-server-path` variable to point to the executable you want to launch.

## Server configuration

`lsp-haskell` provides a few options for for setting the server executable and arguments, and numerous settings for configuring the server itself (`hlint`, choice of formatting provider, etc.).

Note that server configuration settings will currently [not](https://github.com/emacs-lsp/lsp-mode/issues/1174) be applied until the server is restarted.

## Troubleshooting

`lsp-haskell` is *just* the glue between `lsp-mode` and `haskell-language-server`.

If you have an issue with Emacs, it is probably a `lsp-mode` issue.
If you have an issue with the Haskell functionality itself, it is probably a `haskell-language-server` issue.
If you have an issue specifically with how the two are joined together, then it belongs here!

If you're not sure what the problem is, the `haskell-language-server` README provides some troubleshooting instructions.