Skip to content

Commit aa7f6ae

Browse files
committed
Add new configuration settings for HLS 2.1.0.0
Add add a description of how to do it.
1 parent 918ffa2 commit aa7f6ae

File tree

2 files changed

+78
-4
lines changed

2 files changed

+78
-4
lines changed

CONTIBUTING.md

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Contributing to lsp-haskell
2+
3+
## Updating the configuration options for lsp-haskell
4+
5+
1. Generate the vscode settings file
6+
7+
```sh
8+
haskell-language-server-9.6.2 vscode-extension-schema > /tmp/schema.json
9+
```
10+
Add `{"contributes": {"configuration": { "properties":`
11+
to the top and
12+
`}}}` to the bottom.
13+
14+
2. Generate the settings snippet
15+
16+
Make sure you have https://github.com/emacs-lsp/lsp-mode/blob/master/scripts/lsp-generate-settings.el
17+
on your machine somewhere. In this example it is at `/tmp/lsp-generate-settings.el`
18+
19+
In emacs, activate IELM, `M-x ielm`
20+
21+
In IELM,
22+
23+
```elisp
24+
(load-library "/tmp/lsp-generate-settings.el")
25+
;; Do direct output to buffer
26+
(defun p (x) (move-end-of-line 0) (insert (format "\n%s" x)))
27+
(p (lsp-generate-settings "/tmp/schema.json" 'lsp-haskell))
28+
```
29+
30+
This will emit settings that do not currently exist in the running
31+
emacs instance.
32+
33+
Edit them into [lsp-haskell.el](./lsp-haskell.el)

lsp-haskell.el

+45-4
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,15 @@
4747

4848
(defcustom-lsp lsp-haskell-formatting-provider
4949
"ormolu"
50-
"The formatter to use when formatting a document or range. Ensure the plugin is enabled."
50+
"The formatter to use when formatting a document or range.
51+
Ensure the plugin is enabled."
5152
:group 'lsp-haskell
5253
:type '(choice (const "brittany") (const "floskell") (const "fourmolu") (const "ormolu") (const "stylish-haskell") (const "none"))
5354
:lsp-path "haskell.formattingProvider")
5455
(defcustom-lsp lsp-haskell-check-project
5556
t
56-
"Whether to typecheck the entire project on load. It could lead to bad perfomance in large projects."
57+
"Whether to typecheck the entire project on load.
58+
It could lead to bad perfomance in large projects."
5759
:group 'lsp-haskell
5860
:type 'boolean
5961
:lsp-path "haskell.checkProject")
@@ -150,7 +152,9 @@
150152
:lsp-path "haskell.plugin.tactics.globalOn")
151153
(defcustom-lsp lsp-haskell-plugin-tactics-config-auto-gas
152154
4
153-
"The depth of the search tree when performing \"Attempt to fill hole\". Bigger values will be able to derive more solutions, but will take exponentially more time."
155+
"The depth of the search tree when performing \"Attempt to fill hole\".
156+
Bigger values will be able to derive more solutions,
157+
but will take exponentially more time."
154158
:group 'lsp-haskell-plugins
155159
:type 'number
156160
:lsp-path "haskell.plugin.tactics.config.auto_gas")
@@ -221,6 +225,43 @@
221225
:type 'boolean
222226
:lsp-path "haskell.plugin.refineImports.globalOn")
223227

228+
;; Updated for haskell-language-server 2.1.0.0
229+
230+
(lsp-defcustom lsp-haskell-plugin-cabal-code-actions-on t
231+
"Enables cabal code actions"
232+
:type 'boolean
233+
:group 'lsp-haskell
234+
:package-version '(lsp-mode . "8.0.1")
235+
:lsp-path "haskell.plugin.cabal.codeActionsOn")
236+
237+
(lsp-defcustom lsp-haskell-plugin-overloaded-record-dot-global-on t
238+
"Enables overloaded-record-dot plugin"
239+
:type 'boolean
240+
:group 'lsp-haskell
241+
:package-version '(lsp-mode . "8.0.1")
242+
:lsp-path "haskell.plugin.overloaded-record-dot.globalOn")
243+
244+
(lsp-defcustom lsp-haskell-plugin-pragmas-completion-global-on t
245+
"Enables pragmas-completion plugin"
246+
:type 'boolean
247+
:group 'lsp-haskell
248+
:package-version '(lsp-mode . "8.0.1")
249+
:lsp-path "haskell.plugin.pragmas-completion.globalOn")
250+
251+
(lsp-defcustom lsp-haskell-plugin-pragmas-disable-global-on t
252+
"Enables pragmas-disable plugin"
253+
:type 'boolean
254+
:group 'lsp-haskell
255+
:package-version '(lsp-mode . "8.0.1")
256+
:lsp-path "haskell.plugin.pragmas-disable.globalOn")
257+
258+
(lsp-defcustom lsp-haskell-plugin-pragmas-suggest-global-on t
259+
"Enables pragmas-suggest plugin"
260+
:type 'boolean
261+
:group 'lsp-haskell
262+
:package-version '(lsp-mode . "8.0.1")
263+
:lsp-path "haskell.plugin.pragmas-suggest.globalOn")
264+
224265
;; ---------------------------------------------------------------------
225266
;; Non-language server options
226267

@@ -298,7 +339,7 @@ and `lsp-haskell-server-args' and `lsp-haskell-server-wrapper-function'."
298339
:major-modes '(haskell-mode haskell-literate-mode haskell-tng-mode haskell-cabal-mode)
299340
;; This is arbitrary.
300341
:server-id 'lsp-haskell
301-
;; HLS does not currently send 'workspace/configuration' on startup (https://github.com/haskell/haskell-language-server/issues/2762),
342+
;; HLS does not currently send 'workspace/configuration' on startup (https://github.com/haskell/haskell-language-server/issues/2762),
302343
;; so we need to push the configuration to it manually on startup. We should be able to
303344
;; get rid of this once the issue is fixed in HLS.
304345
:initialized-fn (lambda (workspace)

0 commit comments

Comments
 (0)