Skip to content

Commit 2e79619

Browse files
m4lvinmichaelpj
andauthored
Docs: update Emacs section: add eglot with config example (#3509)
* Docs: update Emacs section: add eglot with config example Based on the discussion at #3157 * Update docs/configuration.md Co-authored-by: Michael Peyton Jones <[email protected]> --------- Co-authored-by: Michael Peyton Jones <[email protected]>
1 parent f8e954e commit 2e79619

File tree

1 file changed

+35
-5
lines changed

1 file changed

+35
-5
lines changed

docs/configuration.md

+35-5
Original file line numberDiff line numberDiff line change
@@ -396,13 +396,17 @@ Install the two Atom packages [atom-ide-ui](https://atom.io/packages/atom-ide-ui
396396
$ apm install language-haskell atom-ide-ui haskell
397397
```
398398

399-
### Emacs
399+
### [Emacs](https://www.gnu.org/software/emacs/)
400400

401-
Emacs support is provided by a combination of the following packages:
401+
Emacs support can be provided by different combinations of packages:
402402

403-
[lsp-mode](https://github.com/emacs-lsp/lsp-mode)
404-
[lsp-ui](https://github.com/emacs-lsp/lsp-ui)
405-
[lsp-haskell](https://github.com/emacs-lsp/lsp-haskell)
403+
- [eglot](https://github.com/joaotavora/eglot) (built-in from Emacs 29 onwards)
404+
405+
or
406+
407+
- [lsp-mode](https://github.com/emacs-lsp/lsp-mode),
408+
[lsp-ui](https://github.com/emacs-lsp/lsp-ui) and
409+
[lsp-haskell](https://github.com/emacs-lsp/lsp-haskell)
406410

407411
You can install these manually if you are using plain Emacs; instructions for some specific flavours
408412
are included below.
@@ -412,6 +416,32 @@ various parts of the Emacs integration.
412416
In particular, `lsp-haskell` provides customization options for the `haskell-language-server`-specific parts,
413417
such as the path to the server executable.
414418

419+
#### [use-package](https://github.com/jwiegley/use-package) [eglot](https://github.com/joaotavora/eglot)
420+
421+
If you are using vanilla emacs with `use-package`, put the following into your `~/.emacs`.
422+
This will install `eglot` and enable it by default in `haskell-mode`.
423+
To configure `haskell-language-server` we use the `eglot-workspace-configuration` variable.
424+
With `M-x eglot-show-workspace-configuration` you can see the JSON that `eglot` will send to `haskell-language-server`.
425+
See <https://joaotavora.github.io/eglot/#Customizing-Eglot> for more information.
426+
As an example, the setting below will disable the `stan` plugin.
427+
428+
```emacs-lisp
429+
(use-package eglot
430+
:ensure t
431+
:config
432+
(add-hook 'haskell-mode-hook 'eglot-ensure)
433+
:config
434+
(setq-default eglot-workspace-configuration
435+
'((haskell
436+
(plugin
437+
(stan
438+
(globalOn . :json-false)))))) ;; disable stan
439+
:custom
440+
(eglot-autoshutdown t) ;; shutdown language server after closing last file
441+
(eglot-confirm-server-initiated-edits nil) ;; allow edits without confirmation
442+
)
443+
```
444+
415445
#### [doom-emacs](https://github.com/hlissner/doom-emacs/tree/develop/modules/lang/haskell#module-flags)
416446

417447
Manual installation of packages is not required.

0 commit comments

Comments
 (0)