Skip to content

Commit 9f0e3bb

Browse files
VeryMilkyJoefendor
VeryMilkyJoe
authored andcommitted
Update Contributing.md
Add instructions for specifying local hls executable to be used in VS Code project
1 parent c3ddf43 commit 9f0e3bb

File tree

1 file changed

+39
-13
lines changed

1 file changed

+39
-13
lines changed

docs/contributing/contributing.md

Lines changed: 39 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -138,23 +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
142+
143+
- Whenever you want to build HLS, call `cabal install exe:haskell-language-server --overwrite-policy=always`.
144+
At the end of the output you will find the path the HLS executable was installed to, i.e.:
145+
146+
```
147+
...
148+
Resolving dependencies...
149+
Symlinking 'haskell-language-server' to
150+
'/home/user/.cabal/bin/haskell-language-server'
151+
Symlinking 'haskell-language-server-wrapper' to
152+
'/home/user/.cabal/bin/haskell-language-server-wrapper'
153+
```
154+
155+
In this example output, the path would be `/home/user/.cabal/bin/haskell-language-server`.
156+
157+
- 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)
158+
- Configure this editor to use your custom HLS executable by using the path you obtained previously.
159+
- Restart HLS in your project:
160+
- With VS Code: Press `CTRL + Shift + P` and type `Haskell: Restart Haskell LSP Server`
161+
- With Emacs: `lsp-workspace-restart`
142162
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`
163+
##### VS Code
164+
165+
When using VS Code you can set up a test project to use a specific HLS executable:
149166
150-
To do every time you change HLS code and want to test it:
167+
- If it doesn't already exist in your project directory, create a directory called `.vscode`.
168+
- 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.
169+
170+
```json
171+
{
172+
"haskell.serverExecutablePath": "/home/user/.cabal/bin/haskell-language-server"
173+
}
174+
```
175+
176+
#### Using Stack
177+
178+
- 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)
179+
- Configure this editor to use your custom HLS executable
180+
- To obtain the path to your local HLS executable: `$(stack path --dist-dir)/build/haskell-language-server/haskell-language-server`
151181

152182
- 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`
157-
- With Emacs: `lsp-workspace-restart`
183+
- `stack build haskell-language-server:exe:haskell-language-server`
158184

159185
## Style guidelines
160186

0 commit comments

Comments
 (0)