Skip to content

Commit a0cd84b

Browse files
jneiramichaelpj
andauthored
[skip circleci] Update troubleshooting section (#2326)
* [skip circleci] update troubleshooting * Removing the old issue about Path_ modules * Adding the issue about TH and multi component support with stack * Adding the strategy of disable plugins to help trace the cause * Rephrasing stack issue Co-authored-by: Michael Peyton Jones <[email protected]> * Remove dead bullet Co-authored-by: Michael Peyton Jones <[email protected]> * Repharsing/corrections Co-authored-by: Michael Peyton Jones <[email protected]> * Rephrasing/corrections Co-authored-by: Michael Peyton Jones <[email protected]> * Apply suggestions from code review Co-authored-by: Michael Peyton Jones <[email protected]> Co-authored-by: Michael Peyton Jones <[email protected]>
1 parent e9e8e71 commit a0cd84b

File tree

1 file changed

+25
-8
lines changed

1 file changed

+25
-8
lines changed

docs/troubleshooting.md

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,30 @@ Example with `tasty-discover`:
2121

2222
This returns an error in HLS if 'tasty-discover' is not in the path: `could not execute: tasty-discover`.
2323

24-
## Common issues
25-
26-
### Difficulties with Stack and `Paths_` modules
24+
### Problems with multi component (tests suites, executables, benchmarks) support using stack
2725

28-
These are known to be somewhat buggy at the moment: <https://github.com/haskell/haskell-language-server/issues/478>.
29-
This issue should be fixed in Stack versions >= 2.5.
26+
Due to some limitations in the interaction between HLS and stack, there are some issues in projects with a main library and executables, test suites or benchmarks:
27+
- The stack project has to be built succesfully *before* loading it with HLS to get components other than the library work.
28+
- Changes in the library are not automatically propagated to other components, especially in the presence of errors in the library, so you have to restart HLS to get those components correctly loaded. The usual symptom is the editor showing errors like `Could not load module ...` or `Cannot satisfy -package ...`
29+
- See https://github.com/haskell/haskell-language-server/issues/366 for more info about.
30+
## Common issues
3031

3132
### Problems with dynamic linking
3233

3334
As haskell-language-server prebuilt binaries are statically linked, they don't play well with projects using dynamic linking.
3435
An usual symptom is the presence of errors containing `unknown symbol` and it is typical in arch linux, where a dynamically linked version of ghc is used.
3536

36-
The workaround is to use a version of haskell-language-server compiled from source with `-dynamic` enabled`. See more details [here](https://github.com/haskell/haskell-language-server/issues/1160#issuecomment-756566273).
37+
The workaround is to use a version of haskell-language-server compiled from source with the ghc option `-dynamic` enabled. See more details [here](https://github.com/haskell/haskell-language-server/issues/1160#issuecomment-756566273).
38+
39+
### Problems with Template Haskell
40+
41+
Due to how Template Haskell code is evaluated at compile time and some limitations in the interaction between HLS and GHC, the loading of modules using TH can be problematic.
42+
43+
The errors thrown are usually related to linking and usually make HLS crash: `Segmentation fault`, `GHC runtime linker: fatal error`, etc
44+
45+
A workaround which has helped in some cases is to compile HLS from source with the ghc option `-dynamic` enabled, as in the previous issue.
46+
47+
We have a [dedicated label](https://github.com/haskell/haskell-language-server/issues?q=is%3Aissue+is%3Aopen+label%3A%22type%3A+template+haskell+related%22) in the issue tracker and an [general issue](https://github.com/haskell/haskell-language-server/issues/1431) tracking support for TH.
3748

3849
## Troubleshooting the server
3950

@@ -56,11 +67,17 @@ sent, or if there are any errors.
5667

5768
To get a more verbose, also pass `--debug` to the executable.
5869

70+
### Identify which plugin could be the cause of the issue.
71+
72+
Sometimes the issue is produced by one of the plugins included in HLS. To diagnose that and help to trace the final cause one possible strategy is simple disable all plugins, check if the issue is gone and then enable them selectively until the issue is reproduced again.
73+
74+
There is a configuration json snippet which disables all plugins [here](https://github.com/haskell/haskell-language-server/issues/2151#issuecomment-911397030).
75+
5976
## Troubleshooting the client
6077

6178
Many clients provide diagnostic information about a LSP session.
6279
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.
6380
For example, `lsp-mode` provides all of these (see its [troubleshooting page](https://emacs-lsp.github.io/lsp-mode/page/troubleshooting/) for details).
81+
For vscode you can read how to access the lsp session log [here])https://github.com/haskell/vscode-haskell#investigating-and-reporting-problems).
6482

65-
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
66-
it to look for the right executable.
83+
The most common client-related problem is the client simply not finding the server executable or the tools needed to load Haskell code (`ghc`, `cabal`, or `stack`). So make sure that you have the right `PATH` and you have configured the client to look for the right executables.

0 commit comments

Comments
 (0)