Skip to content

Commit d4d50a6

Browse files
authored
Merge pull request #432 from googleson78/docs-formatters
Add docs on how to choose a formatter
2 parents 248e8df + d65e7d4 commit d4d50a6

File tree

1 file changed

+26
-3
lines changed

1 file changed

+26
-3
lines changed

README.md

+26-3
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ This is *very* early stage software.
2929
- [Building](#building)
3030
- [Install via cabal](#install-via-cabal)
3131
- [Install specific GHC Version](#install-specific-ghc-version)
32+
- [HLS LSP Configuration](#hls-lsp-configuration)
3233
- [Project Configuration](#project-configuration)
3334
- [Editor Integration](#editor-integration)
3435
- [VS Code](#using-haskell-language-server-with-vs-code)
@@ -207,7 +208,7 @@ The script will install the executables `haskell-language-server-wrapper` and `h
207208
It will copy the latter appending the used ghc version, needed by the wrapper to choose the suitable version
208209
for the project at hand.
209210

210-
So installing the executables directly with `stack install` or `cabal v2-install` may not be enough
211+
So installing the executables directly with `stack install` or `cabal v2-install` may not be enough
211212
for it to work properly.
212213

213214
Install haskell-language-server for the latest available and supported GHC version (and hoogle docs):
@@ -253,6 +254,28 @@ If your desired ghc has been found, you use it to install haskell-language-serve
253254
./cabal-hls-install data
254255
```
255256

257+
## HLS LSP Configuration
258+
259+
haskell-language-server supports some forms of configuration.
260+
261+
This configuration is done via the LSP settings you provide with your editor and/or LSP client.
262+
Some examples include:
263+
* in VSCode/VSCodium this is done via the `Settings` tab
264+
* with `LanguageClient-neovim` you can point the [`g:LanguageClient_settingsPath`](https://github.com/autozimu/LanguageClient-neovim/blob/0e5c9546bfddbaa2b01e5056389c25aefc8bf989/doc/LanguageClient.txt#L221)
265+
variable to the file in which you want to keep your LSP settings
266+
267+
### Formatting providers
268+
##### Raw LSP key name: `haskell.formattingProvider`
269+
270+
By default, haskell-language-server is compiled with support for several different formatters.
271+
272+
These include
273+
* `floskell`
274+
* `fourmolu`
275+
* `ormolu`
276+
* `stylish-haskell`
277+
* `brittany` (if compiled with AGPL)
278+
256279
## Project Configuration
257280

258281
**For a full explanation of possible configurations, refer to [hie-bios/README](https://github.com/mpickering/hie-bios/blob/master/README.md).**
@@ -567,7 +590,7 @@ This returns an error in HLS if 'tasty-discover' is not in the path: `could not
567590
### Style guidelines
568591

569592
The project includes a [`.editorconfig`](https://editorconfig.org) [file](https://github.com/haskell/haskell-language-server/blob/master/.editorconfig) with the editor basic settings used by the project.
570-
However, most editors will need some action to honour those settings automatically.
593+
However, most editors will need some action to honour those settings automatically.
571594
For example vscode needs to have installed a specific [extension](https://marketplace.visualstudio.com/items?itemName=EditorConfig.EditorConfig).
572595
Please, try to follow those basic settings to keep the codebase as uniform as possible.
573596

@@ -608,7 +631,7 @@ If you want to test HLS while hacking on it, follow the steps below.
608631
To do once:
609632
- Open some codebase on which you want to test your hacked HLS in your favorite editor
610633
- Configure this editor to use your custom HLS executable
611-
- With Cabal:
634+
- With Cabal:
612635
- On Unix systems: `cabal exec which haskell-language-server`
613636
- On Windows: `cabal exec where haskell-language-server`
614637
- With Stack: `$(stack path --dist-dir)/build/haskell-language-server/haskell-language-server`

0 commit comments

Comments
 (0)