Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more features and demos in docs #2257

Merged
merged 6 commits into from Oct 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
32 changes: 31 additions & 1 deletion docs/configuration.md
Expand Up @@ -96,7 +96,9 @@ This is handled by the [`hie-bios`](https://github.com/mpickering/hie-bios) proj

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

However, if the automatic detection fails you can configure `hie-bios` using a `hie.yaml` file in the root of the workspace.
*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`

If the automatic detection fails with that error you can configure `hie-bios` using a `hie.yaml` file in the root of the workspace.
A `hie.yaml` file **explicitly** describes how to setup the environment to compile the various parts of your project.
For that you need to know what *components* your project has, and the path associated with each one.
So you will need some knowledge about
Expand Down Expand Up @@ -194,6 +196,34 @@ dependencies:
- someDep
```

### How to show local documentation on hover

Haskell Language Server can display Haddock documentation on hover and completions if the project and
its dependencies have been built with the `-haddock` GHC flag.

- For cabal:

- Add to your global config file (e.g. `~/.cabal/config`):

```yaml
program-default-options
ghc-options: -haddock
```

- Or, for a single project, run `cabal configure --ghc-options=-haddock`

- For stack, add to global `$STACK_ROOT\config.yaml`, or project's `stack.yaml`:

```yaml
ghc-options:
'$everything': -haddock
```

Note that this flag will cause compilation errors if a dependency contains invalid Haddock markup,
until GHC 9.0 which [will report warnings](https://gitlab.haskell.org/ghc/ghc/-/merge_requests/2377)
instead.


## Configuring your editor

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).
Expand Down
42 changes: 21 additions & 21 deletions docs/features.md
@@ -1,36 +1,36 @@
# Features

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

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

- 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:
- Integration with [retrie](https://hackage.haskell.org/package/retrie)

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

```
program-default-options
ghc-options: -haddock
```
- Code lenses for explicit import lists

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

- For stack, add to global `$STACK_ROOT\config.yaml`, or project's `stack.yaml`:
- 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)

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

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).
- Integration with [hlint](https://github.com/ndmitchell/hlint) to show diagnostics and apply hints via [apply-refact](https://github.com/mpickering/apply-refact)

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

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

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

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

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