Skip to content

Commit 44468f1

Browse files
jneiramergify[bot]
andauthored
Add more features and demos in docs (#2257)
* Add more features and demos * Link issue about jump to def * Move haddock build config And discourage the use of a explicit hie.yaml * Remove haddock config from features * Correct link to haddock config Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
1 parent 4ab35bc commit 44468f1

File tree

2 files changed

+52
-22
lines changed

2 files changed

+52
-22
lines changed

Diff for: docs/configuration.md

+31-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,9 @@ This is handled by the [`hie-bios`](https://github.com/mpickering/hie-bios) proj
9696

9797
At the moment, `haskell-language-server` has support to automatically detect your project build configuration to handle most use cases.
9898

99-
However, if the automatic detection fails you can configure `hie-bios` using a `hie.yaml` file in the root of the workspace.
99+
*So using a explicit `hie.yaml` file will not likely fix your ide setup*. It will do it almost only if you see an error like `Multi Cradle: No prefixes matched`
100+
101+
If the automatic detection fails with that error you can configure `hie-bios` using a `hie.yaml` file in the root of the workspace.
100102
A `hie.yaml` file **explicitly** describes how to setup the environment to compile the various parts of your project.
101103
For that you need to know what *components* your project has, and the path associated with each one.
102104
So you will need some knowledge about
@@ -194,6 +196,34 @@ dependencies:
194196
- someDep
195197
```
196198

199+
### How to show local documentation on hover
200+
201+
Haskell Language Server can display Haddock documentation on hover and completions if the project and
202+
its dependencies have been built with the `-haddock` GHC flag.
203+
204+
- For cabal:
205+
206+
- Add to your global config file (e.g. `~/.cabal/config`):
207+
208+
```yaml
209+
program-default-options
210+
ghc-options: -haddock
211+
```
212+
213+
- Or, for a single project, run `cabal configure --ghc-options=-haddock`
214+
215+
- For stack, add to global `$STACK_ROOT\config.yaml`, or project's `stack.yaml`:
216+
217+
```yaml
218+
ghc-options:
219+
'$everything': -haddock
220+
```
221+
222+
Note that this flag will cause compilation errors if a dependency contains invalid Haddock markup,
223+
until GHC 9.0 which [will report warnings](https://gitlab.haskell.org/ghc/ghc/-/merge_requests/2377)
224+
instead.
225+
226+
197227
## Configuring your editor
198228

199229
Most editors provide a Haskell-specific extension that provides support for launching `haskell-language-server` and talking to it, as well as [exposing configuration options](#configuring-haskell-language-server).

Diff for: docs/features.md

+21-21
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,36 @@
11
# Features
22

3-
- Code evaluation codelens ([Tutorial](https://github.com/haskell/haskell-language-server/tree/master/plugins/hls-eval-plugin/README.md)):
3+
- Warning and error diagnostics from GHC
4+
- Type information and documentation on hover, [including your own comments](./configuration.md#how-to-show-local-documentation-on-hover).
5+
- Jump to definition: [for now only for local code definitions](https://github.com/haskell/haskell-language-server/issues/708)
6+
- Document symbols
7+
- Highlight references in document
8+
- Code completion
9+
- Formatting via Brittany, Floskell, Fourmolu, Ormolu or Stylish Haskell
10+
- Code evaluation (Haskell Language Server), see ([Tutorial](https://github.com/haskell/haskell-language-server/blob/master/plugins/hls-eval-plugin/README.md))
411

5-
![Eval Demo](https://github.com/haskell/haskell-language-server/tree/master/plugins/hls-eval-plugin/demo.gif)
12+
![Eval Demo](https://raw.githubusercontent.com/haskell/haskell-language-server/master/plugins/hls-eval-plugin/demo.gif)
613

7-
- Type information and documentation on hover. Note that currently, in order for docs to be displayed for dependencies, they must have been built with GHC's `-haddock` flag:
14+
- Integration with [retrie](https://hackage.haskell.org/package/retrie)
815

9-
- For cabal:
10-
- Add to your global config file (e.g. `~/.cabal/config`):
16+
![Retrie Demo](https://i.imgur.com/Ev7B87k.gif)
1117

12-
```
13-
program-default-options
14-
ghc-options: -haddock
15-
```
18+
- Code lenses for explicit import lists
1619

17-
- Or, for a single project, run `cabal configure --ghc-options=-haddock`
20+
![Imports code lens Demo](https://imgur.com/pX9kvY4.gif)
1821

19-
- For stack, add to global `$STACK_ROOT\config.yaml`, or project's `stack.yaml`:
22+
- Generate functions from type signatures, and intelligently complete holes using [Wingman (tactics)](https://github.com/haskell/haskell-language-server/tree/master/plugins/hls-tactics-plugin)
2023

21-
```
22-
ghc-options:
23-
"$everything": -haddock
24-
```
24+
![Wingman Demo](https://user-images.githubusercontent.com/307223/92657198-3d4be400-f2a9-11ea-8ad3-f541c8eea891.gif)
2525

26-
This will cause compilation errors if a dependency contains invalid Haddock markup, though from GHC version 9.0, [these will be demoted to warnings](https://gitlab.haskell.org/ghc/ghc/-/merge_requests/2377).
26+
- Integration with [hlint](https://github.com/ndmitchell/hlint) to show diagnostics and apply hints via [apply-refact](https://github.com/mpickering/apply-refact)
2727

28-
- Integration with [retrie](https://hackage.haskell.org/package/retrie)
28+
![Hlint Demo](https://user-images.githubusercontent.com/54035/110860028-8f9fa900-82bc-11eb-9fe5-6483d8bb95e6.gif)
2929

30-
![Retrie](https://i.imgur.com/Ev7B87k.gif)
30+
- Module name suggestions for insertion or correction
3131

32-
- Code lenses for explicit import lists
32+
![Module Name Demo](https://user-images.githubusercontent.com/54035/110860755-78ad8680-82bd-11eb-9845-9ea4b1cc1f76.gif)
3333

34-
![Imports code lens](https://imgur.com/pX9kvY4.gif)
34+
- Call hierarchy support
3535

36-
- Many more (TBD)
36+
![Call Hierarchy in VSCode](https://github.com/haskell/haskell-language-server/raw/2857eeece0398e1cd4b2ffb6069b05c4d2308b39/plugins/hls-call-hierarchy-plugin/call-hierarchy-in-vscode.gif)

0 commit comments

Comments
 (0)