Skip to content
This repository was archived by the owner on Oct 7, 2020. It is now read-only.

Commit 9bc0b01

Browse files
authored
Merge pull request #1240 from Infinisil/trouble-emacs
Troubleshooting for emacs
2 parents ab028cf + f92d17d commit 9bc0b01

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ we talk to clients.__
5252
- [Documentation](#documentation)
5353
- [Architecture](#architecture)
5454
- [Troubleshooting](#troubleshooting)
55+
- [Emacs](#emacs)
56+
- [Parse errors, file state going out of sync](#parse-errors-file-state-going-out-of-sync)
57+
- [`emacs-direnv` loads environment too late](#emacs-direnv-loads-environment-too-late)
5558
- [DYLD on macOS](#dyld-on-macos)
5659
- [macOS: Got error while installing GHC 8.6.1 or 8.6.2 - dyld: Library not loaded: /usr/local/opt/gmp/lib/libgmp.10.dylib](#macos-got-error-while-installing-ghc-861-or-862---dyld-library-not-loaded-usrlocaloptgmpliblibgmp10dylib)
5760
- [macOS: Got error while processing diagnostics: unable to load package `integer-gmp-1.0.2.0`](#macos-got-error-while-processing-diagnostics-unable-to-load-package-integer-gmp-1020)
@@ -559,6 +562,22 @@ Have a look at
559562

560563
## Troubleshooting
561564

565+
### Emacs
566+
567+
#### Parse errors, file state going out of sync
568+
With the `lsp-mode` client for Emacs, it seems that the document can very easily get out of sync between, which leads to parse errors being displayed. To fix this, enable full document synchronization with
569+
570+
```elisp
571+
(setq lsp-document-sync-method 'full)
572+
```
573+
574+
#### [`emacs-direnv`](https://github.com/wbolster/emacs-direnv) loads environment too late
575+
`emacs-direnv` sometimes loads the environment too late, meaning `lsp-mode` won't be able to find correct GHC/cabal versions. To fix this, add a direnv update hook *after* adding the lsp hook for `haskell-mode` (meaning the direnv hook is executed first, because hooks are LIFO):
576+
```elisp
577+
(add-hook 'haskell-mode-hook 'lsp)
578+
(add-hook 'haskell-mode-hook 'direnv-update-environment)
579+
```
580+
562581
### DYLD on macOS
563582

564583
If you hit a problem that looks like ```can't load .so/.DLL for: libiconv.dylib (dlopen(libiconv.dylib, 5): image not found)```, it means that libraries cannot be found in the library path. We can hint where to look for them and append more paths to `DYLD_LIBRARY_PATH`.

0 commit comments

Comments
 (0)