Skip to content

Commit cb3416f

Browse files
sir4ur0npepeiborra
authored andcommitted
Sir4ur0n/doc/cleanup hie (#2311)
* Update documentation on using HIE with HLS Followup of #1230 * Cleanup some documentation links that are not visible with inline code
1 parent 1204cce commit cb3416f

File tree

4 files changed

+31
-32
lines changed

4 files changed

+31
-32
lines changed

Diff for: docs/configuration.md

+10-10
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ For example, there are protocol methods for highlighting matching identifiers th
2121
This is a capability which any server can implement, so the client can decide generically whether to ask the server to do it or not.
2222
So your editor can provide a setting to turn this on or off globally, for any language server you might use.
2323

24-
Settings like this are typically provided by the generic LSP client support for your editor, for example in Emacs by [`lsp-mode`](https://github.com/emacs-lsp/lsp-mode).
24+
Settings like this are typically provided by the generic LSP client support for your editor, for example in Emacs by [lsp-mode](https://github.com/emacs-lsp/lsp-mode).
2525

2626
### Generic editor options
2727

2828
Your editor may provide some settings that affect how the information from the language server is used.
2929
For example, whether popups are shown, or whether code lenses appear by default.
3030

31-
Settings like this are typically provided by the generic LSP client support for your editor, for example in Emacs by [`lsp-mode`](https://github.com/emacs-lsp/lsp-mode).
31+
Settings like this are typically provided by the generic LSP client support for your editor, for example in Emacs by [lsp-mode](https://github.com/emacs-lsp/lsp-mode).
3232

3333
### Language-specific server options
3434

@@ -48,7 +48,7 @@ Here is a list of the additional settings currently supported by `haskell-langua
4848
- Hlint (`haskell.hlintOn`, default true): whether to enable Hlint support. *Deprecated* as it is equivalen to `haskell.plugin.hlint.globalOn`
4949
- Max completions (`haskell.maxCompletions`, default 40): maximum number of completions sent to the LSP client.
5050
- Check project (`haskell.checkProject`, default true): whether to typecheck the entire project on load. As it is activated by default could drive to bad perfomance in large projects.
51-
- Check parents (`haskell.checkParents`, default `CheckOnSaveAndClose`): when to typecheck reverse dependencies of a file; one of `NeverCheck`, `CheckOnClose`, `CheckOnSaveAndClose`, or `AlwaysCheck`.
51+
- Check parents (`haskell.checkParents`, default `CheckOnSaveAndClose`): when to typecheck reverse dependencies of a file; one of `NeverCheck`, `CheckOnClose`, `CheckOnSaveAndClose`, or `AlwaysCheck`.
5252

5353
#### Generic plugin configuration
5454

@@ -57,7 +57,7 @@ Plugins have a generic config to control their behaviour. The schema of such con
5757
- `haskell.plugin.${pluginName}.globalOn`: usually with default true. Whether the plugin is enabled at runtime or it is not. That is the option you might use if you want to disable completely a plugin.
5858
- Actual plugin names are: `ghcide-code-actions-fill-holes`, `ghcide-completions`, `ghcide-hover-and-symbols`, `ghcide-type-lenses`, `ghcide-code-actions-type-signatures`, `ghcide-code-actions-bindings`, `ghcide-code-actions-imports-exports`, `eval`, `moduleName`, `pragmas`, `refineImports`, `importLens`, `class`, `tactics` (aka wingman), `hlint`, `haddockComments`, `retrie`, `splice`.
5959
- So to disable the import lens with an explicit list of module definitions you could set `haskell.plugin.importLens.globalOn: false`
60-
- `haskell.plugin.${pluginName}.${lspCapability}On`: usually with default true. Whether a concrete plugin capability is enabled.
60+
- `haskell.plugin.${pluginName}.${lspCapability}On`: usually with default true. Whether a concrete plugin capability is enabled.
6161
- Capabilities are the different ways a lsp server can interact with the editor. The current available capabilities of the server are: `callHierarchy`, `codeActions`, `codeLens`, `diagnostics`, `hover`, `symbols`, `completion`, `rename`.
6262
- Note that usually plugins don't provide all capabilities but some of them or even only one.
6363
- So to disable code changes suggestions from the `hlint` plugin (but no diagnostics) you could set `haskell.plugin.hlint.codeActionsOn: false`
@@ -78,7 +78,7 @@ Plugins have a generic config to control their behaviour. The schema of such con
7878
This reference of configuration can be outdated at any time but we can query the `haskell-server-executable` about what configuration is effectively used:
7979
- `haskell-language-server generate-default-config`: will print the json configuration with all default values. It can be used as template to modify it.
8080
- `haskell-language-server vscode-extension-schema`: will print a json schema used to setup the haskell vscode extension. But it is useful to see what range of values can an option take and a description about it.
81-
81+
8282
Settings like this are typically provided by the language-specific LSP client support for your editor, for example in Emacs by `lsp-haskell`.
8383

8484
### Client options
@@ -90,11 +90,11 @@ Settings like this are typically be provided by the language-specific LSP client
9090
## Configuring your project build
9191

9292
`haskell-language-server` has to compile your project in order to give you diagnostics, which means that it needs to know how to do so.
93-
This is handled by the [`hie-bios`](https://github.com/mpickering/hie-bios) project.
93+
This is handled by the [hie-bios](https://github.com/mpickering/hie-bios) project.
9494

95-
**For a full explanation of how `hie-bios` determines the project build configuration, and how to configure it manually, refer to the [`hie-bios` README](https://github.com/mpickering/hie-bios/blob/master/README.md).**
95+
**For a full explanation of how `hie-bios` determines the project build configuration, and how to configure it manually, refer to the [hie-bios README](https://github.com/mpickering/hie-bios/blob/master/README.md).**
9696

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

9999
*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`
100100

@@ -104,7 +104,7 @@ For that you need to know what *components* your project has, and the path assoc
104104
So you will need some knowledge about
105105
[stack](https://docs.haskellstack.org/en/stable/build_command/#components) or [cabal](https://cabal.readthedocs.io/en/latest/cabal-commands.html?#cabal-v2-build) components.
106106

107-
You also can use [this utility](https://github.com/Avi-D-coder/implicit-hie) to automatically generate `hie.yaml` files for
107+
You also can use [implicit-hie](https://github.com/Avi-D-coder/implicit-hie) to automatically generate `hie.yaml` files for
108108
the most common stack and cabal configurations
109109

110110
For example, to state that you want to use `stack` then the configuration file
@@ -351,7 +351,7 @@ it may also be helpful to also specify root markers:
351351
let g:LanguageClient_rootMarkers = ['*.cabal', 'stack.yaml']
352352
```
353353

354-
Further configuration can be done by pointing the [`g:LanguageClient_settingsPath`](https://github.com/autozimu/LanguageClient-neovim/blob/0e5c9546bfddbaa2b01e5056389c25aefc8bf989/doc/LanguageClient.txt#L221)
354+
Further configuration can be done by pointing the `g:LanguageClient_settingsPath` [option](https://github.com/autozimu/LanguageClient-neovim/blob/0e5c9546bfddbaa2b01e5056389c25aefc8bf989/doc/LanguageClient.txt#L221)
355355
variable to the file in which you want to keep your LSP settings.
356356

357357
### Atom

Diff for: docs/contributing/contributing.md

+21-16
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ The Haskell tooling dream is near, we need your help!
1010
- Join the [haskell-tooling channel](https://matrix.to/#/#haskell-tooling:matrix.org) in [matrix](https://matrix.org/).
1111
- Visit [the project GitHub repo](https://github.com/haskell/haskell-language-server) to view the source code, or open issues or pull requests.
1212

13-
## Building haskell-language-server
13+
## Building
1414

1515
Clone the repository:
1616
```shell
@@ -19,26 +19,18 @@ $ git clone https://github.com/haskell/haskell-language-server
1919

2020
The project can then be built with both `cabal build` and `stack build`.
2121

22-
haskell-language-server can also be used with itself. We provide preset samples of `hie.yaml` for Cabal and Stack.
23-
24-
Note: the `./install/` folder is not directly tied to the project so it has dedicated `./install/hie.yaml.[cbl|stack]`
25-
templates.
26-
2722
### Using Cabal
2823

2924
```shell
30-
$ cp hie-cabal.yaml hie.yaml
31-
$ cp install/hie-cabal.yaml install/hie.yaml
25+
# If you have not run `cabal update` in a while
26+
$ cabal update
27+
# Then
28+
$ cabal build
3229
```
3330

3431
### Using Stack
3532

3633
```shell
37-
$ cp hie-stack.yaml hie.yaml
38-
$ cp install/hie-stack.yaml install/hie.yaml
39-
$ cp ghcide/hie-stack.yaml ghcide/hie.yaml
40-
$ stack build --test --no-run-tests
41-
$ cd install
4234
$ stack build
4335
```
4436

@@ -119,26 +111,39 @@ An alternative, which only recompiles when tests (or dependencies) change:
119111
$ cabal run haskell-language-server:func-test -- -p "hlint enables"
120112
```
121113

122-
### Test your hacked HLS in your editor
114+
## Using HLS on HLS code
115+
116+
[HLS project configuration guidelines](../configuration.md#configuring-your-project-build) also apply to the HLS project itself.
117+
118+
Note: HLS implicitly detects HLS codebase as a Stack project (see [hie-bios implicit configuration documentation](https://github.com/haskell/hie-bios/blob/master/README.md#implicit-configuration)).
119+
If you want HLS to use Cabal, you need to create an `hie.yaml` file:
120+
```yaml
121+
cradle:
122+
cabal:
123+
```
124+
125+
Also note that the `install/` subdirectory is a different project, so if you want to work on this part of the code, you may also have to create an `install/hie.yaml` file.
123126

127+
### Manually testing your hacked HLS
124128
If you want to test HLS while hacking on it, follow the steps below.
125129

126130
To do once:
127131

128-
- Open some codebase on which you want to test your hacked HLS in your favorite editor
132+
- Open some codebase on which you want to test your hacked HLS in your favorite editor (it can also be HLS codebase itself: see previous section for configuration)
129133
- Configure this editor to use your custom HLS executable
130134
- With Cabal:
131135
- On Unix systems: `cabal exec which haskell-language-server`
132136
- On Windows: `cabal exec where haskell-language-server`
133137
- With Stack: `$(stack path --dist-dir)/build/haskell-language-server/haskell-language-server`
134138

135-
To do every time you changed code and want to test it:
139+
To do every time you change HLS code and want to test it:
136140

137141
- Build HLS
138142
- With Cabal: `cabal build exe:haskell-language-server`
139143
- With Stack: `stack build haskell-language-server:exe:haskell-language-server`
140144
- Restart HLS
141145
- With VS Code: `Haskell: Restart Haskell LSP Server`
146+
- With Emacs: `lsp-workspace-restart`
142147

143148
## Style guidelines
144149

Diff for: install/hie-cabal.yaml

-3
This file was deleted.

Diff for: install/hie-stack.yaml

-3
This file was deleted.

0 commit comments

Comments
 (0)