Skip to content

Commit 6a980da

Browse files
author
VeryMilkyJoe
committed
Update Contributing.md
Add instructions for specifying local hls executable to be used in VS Code project
1 parent ca68e17 commit 6a980da

File tree

1 file changed

+38
-13
lines changed

1 file changed

+38
-13
lines changed

docs/contributing/contributing.md

Lines changed: 38 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -138,24 +138,49 @@ cradle:
138138
### Manually testing your hacked HLS
139139
If you want to test HLS while hacking on it, follow the steps below.
140140
141-
To do once:
141+
#### Using Cabal
142142
143-
- 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)
144-
- Configure this editor to use your custom HLS executable
145-
- With Cabal:
146-
- On Unix systems: `cabal exec which haskell-language-server`
147-
- On Windows: `cabal exec where haskell-language-server`
148-
- With Stack: `$(stack path --dist-dir)/build/haskell-language-server/haskell-language-server`
143+
- Whenever you want to build HLS, call `cabal install exe:haskell-language-server --overwrite-policy=always`.
144+
In the output you will find the path the HLS executable was installed to, i.e.:
149145

150-
To do every time you change HLS code and want to test it:
146+
```
147+
Resolving dependencies...
148+
Symlinking 'haskell-language-server' to
149+
'/home/user/.cabal/bin/haskell-language-server'
150+
Symlinking 'haskell-language-server-wrapper' to
151+
'/home/user/.cabal/bin/haskell-language-server-wrapper'
152+
```
151153
152-
- Build HLS
153-
- With Cabal: `cabal build exe:haskell-language-server`
154-
- With Stack: `stack build haskell-language-server:exe:haskell-language-server`
155-
- Restart HLS
156-
- With VS Code: `Haskell: Restart Haskell LSP Server`
154+
In this example output, the path would be `/home/user/.cabal/bin/haskell-language-server`.
155+
156+
- Open some codebase on which you want to test your local HLS in your favorite editor (it can also be the HLS codebase itself: see previous section for configuration)
157+
- Configure this editor to use your custom HLS executable by using the path you obtained previously.
158+
- Restart HLS in your project:
159+
- With VS Code: Press `CTRL + Shift + P` and type `Haskell: Restart Haskell LSP Server`
157160
- With Emacs: `lsp-workspace-restart`
158161
162+
##### VS Code
163+
164+
When using VS Code you can set up a test project to use a specific HLS executable:
165+
166+
- If it doesn't already exist in your project directory, create a directory called `.vscode`.
167+
- In the `.vscode` directory create a file called `settings.json` with the below contents. The path used here is the one obtained by using the `cabal` install command.
168+
169+
```json
170+
{
171+
"haskell.serverExecutablePath": "/home/user/.cabal/bin/haskell-language-server"
172+
}
173+
```
174+
175+
#### Using Stack
176+
177+
- Open some codebase on which you want to test your local HLS in your favorite editor (it can also be the HLS codebase itself: see previous section for configuration)
178+
- Configure this editor to use your custom HLS executable
179+
- To obtain the path to your local HLS executable: `$(stack path --dist-dir)/build/haskell-language-server/haskell-language-server`
180+
181+
- Build HLS
182+
- `stack build haskell-language-server:exe:haskell-language-server`
183+
159184
## Style guidelines
160185

161186
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.

0 commit comments

Comments
 (0)