Skip to content

Commit d13f670

Browse files
authored
Merge pull request #507 from michaelpj/imp/docs-troubleshooting
Add a Troubleshooting section to the README
2 parents 175eb06 + fc3cc65 commit d13f670

File tree

1 file changed

+41
-1
lines changed

1 file changed

+41
-1
lines changed

README.md

+41-1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ background](https://neilmitchell.blogspot.com/2020/01/one-haskell-ide-to-rule-th
3838
- [Kakoune](#using-haskell-language-server-with-kakoune)
3939
- [Known limitations](#known-limitations)
4040
- [Preprocessor](#preprocessor)
41+
- [Troubleshooting](#troubleshooting)
4142
- [Contributing](#contributing)
4243
- [Building haskell-language-server](#building-haskell-language-server)
4344
- [Using Cabal](#using-cabal)
@@ -561,7 +562,7 @@ are included below.
561562
Make sure to check the READMEs of each of these packages, which explain how to configure the
562563
various parts of the Emacs integration.
563564
In particular, `lsp-haskell` provides customization options for the `haskell-language-server`-specific parts,
564-
such as the path to the server binary.
565+
such as the path to the server executable.
565566

566567
#### Using haskell-language-server with [doom-emacs](https://github.com/hlissner/doom-emacs/tree/develop/modules/lang/haskell#module-flags)
567568

@@ -619,6 +620,45 @@ Example with `tasty-discover`:
619620
```
620621
This returns an error in HLS if 'tasty-discover' is not in the path: `could not execute: tasty-discover`.
621622

623+
## Troubleshooting
624+
625+
### Common issues
626+
627+
#### Difficulties with Stack and `Paths_` modules
628+
629+
These are known to be somewhat buggy at the moment: https://github.com/haskell/haskell-language-server/issues/478.
630+
This issue should be fixed in Stack versions >= 2.5.
631+
632+
### Troubleshooting the server
633+
634+
#### Diagnostic mode
635+
636+
The `haskell-language-server` executable can be run in diagnostic mode, where it will just try to load modules from your project, printing all of its output to stdout.
637+
This makes it much easier to see what's going on and to diagnose build-related problems.
638+
639+
To do this, simply run the executable directly from your shell in the project root.
640+
You can either run it without an argument, in which case it will load random modules, or with a path, in which case it will load modules in that file or directory.
641+
642+
#### Examining the log
643+
644+
Most clients will launch `haskell-language-server` with `--logfile` to make it write a log file.
645+
Please consult the documentation for your client to find out where this is (or how to set it).
646+
647+
The log will contain all the messages that are sent to the server and its responses.
648+
This is helpful for low-level debugging: if you expect a certain action to happen, you can look in the log to see if the corresponding messages are
649+
sent, or if there are any errors.
650+
651+
To get a more verbose, also pass `--debug` to the executable.
652+
653+
### Troubleshooting the client
654+
655+
Many clients provide diagnostic information about a LSP session.
656+
In particular, look for a way to get the status of the server, the server stderr, or a log of the messages that the client has sent to the server.
657+
For example, `lsp-mode` provides all of these (see its [troubleshooting page](https://emacs-lsp.github.io/lsp-mode/page/troubleshooting/) for details).
658+
659+
The most common client-related problem is the client simply not finding the server executable, so make sure that you have the right `PATH` and you have configured
660+
it to look for the right executable.
661+
622662
## Contributing
623663

624664
:heart: The Haskell tooling dream is near, we need your help! :heart:

0 commit comments

Comments
 (0)