44
44
; ; Originally generated from the vscode extension's package.json using lsp-generate-bindings.
45
45
; ; Should ideally stay in sync with what's offered in the vscode extension.
46
46
47
- (defcustom lsp-haskell-formatting-provider
47
+ (defcustom-lsp lsp-haskell-formatting-provider
48
48
" ormolu"
49
49
" The formatter to use when formatting a document or range. Ensure the plugin is enabled."
50
50
:group 'lsp-haskell
51
- :type '(choice (const " brittany" ) (const " floskell" ) (const " fourmolu" ) (const " ormolu" ) (const " stylish-haskell" ) (const " none" )))
52
- (defcustom lsp-haskell-check-project
51
+ :type '(choice (const " brittany" ) (const " floskell" ) (const " fourmolu" ) (const " ormolu" ) (const " stylish-haskell" ) (const " none" ))
52
+ :lsp-path " haskell.formattingProvider" )
53
+ (defcustom-lsp lsp-haskell-check-project
53
54
t
54
55
" Whether to typecheck the entire project on load. It could lead to bad perfomance in large projects."
55
56
:group 'lsp-haskell
56
- :type 'boolean )
57
- (defcustom lsp-haskell-max-completions
57
+ :type 'boolean
58
+ :lsp-path " haskell.checkProject" )
59
+ (defcustom-lsp lsp-haskell-max-completions
58
60
40
59
61
" Maximum number of completions sent to the editor."
60
62
:group 'lsp-haskell
61
- :type 'number )
63
+ :type 'number
64
+ :lsp-path " haskell.maxCompletions" )
62
65
63
66
; ; ---------------------------------------------------------------------
64
67
; ; Plugin-specific configuration
65
68
(defgroup lsp-haskell-plugins nil
66
69
" Customization group for 'lsp-haskell' plugins."
67
70
:group 'lsp-haskell )
68
71
69
- (defcustom lsp-haskell-plugin-import-lens-code-actions-on
72
+ (defcustom-lsp lsp-haskell-plugin-import-lens-code-actions-on
70
73
t
71
74
" Enables explicit imports code actions"
72
75
:group 'lsp-haskell-plugins
73
- :type 'boolean )
74
- (defcustom lsp-haskell-plugin-import-lens-code-lens-on
76
+ :type 'boolean
77
+ :lsp-path " haskell.plugin.importLens.codeActionsOn" )
78
+ (defcustom-lsp lsp-haskell-plugin-import-lens-code-lens-on
75
79
t
76
80
" Enables explicit imports code lenses"
77
81
:group 'lsp-haskell-plugins
78
- :type 'boolean )
79
- (defcustom lsp-haskell-plugin-hlint-code-actions-on
82
+ :type 'boolean
83
+ :lsp-path " haskell.plugin.importLens.codeLensOn" )
84
+ (defcustom-lsp lsp-haskell-plugin-hlint-code-actions-on
80
85
t
81
86
" Enables hlint code actions (apply hints)"
82
87
:group 'lsp-haskell-plugins
83
- :type 'boolean )
84
- (defcustom lsp-haskell-plugin-hlint-diagnostics-on
88
+ :type 'boolean
89
+ :lsp-path " haskell.plugin.hlint.codeActionsOn" )
90
+ (defcustom-lsp lsp-haskell-plugin-hlint-diagnostics-on
85
91
t
86
92
" Enables hlint diagnostics"
87
93
:group 'lsp-haskell-plugins
88
- :type 'boolean )
89
- (defcustom lsp-haskell-plugin-hlint-config-flags
94
+ :type 'boolean
95
+ :lsp-path " haskell.plugin.hlint.diagnosticsOn" )
96
+ (defcustom-lsp lsp-haskell-plugin-hlint-config-flags
90
97
nil
91
98
" Flags used by hlint"
92
99
:group 'lsp-haskell-plugins
93
- :type 'lsp-string-vector )
94
- (defcustom lsp-haskell-plugin-eval-global-on
100
+ :type 'lsp-string-vector
101
+ :lsp-path " haskell.plugin.hlint.config.flags" )
102
+ (defcustom-lsp lsp-haskell-plugin-eval-global-on
95
103
t
96
104
" Enables eval plugin"
97
105
:group 'lsp-haskell-plugins
98
- :type 'boolean )
99
- (defcustom lsp-haskell-plugin-module-name-global-on
106
+ :type 'boolean
107
+ :lsp-path " haskell.plugin.eval.globalOn" )
108
+ (defcustom-lsp lsp-haskell-plugin-module-name-global-on
100
109
t
101
110
" Enables module name plugin"
102
111
:group 'lsp-haskell-plugins
103
- :type 'boolean )
104
- (defcustom lsp-haskell-plugin-splice-global-on
112
+ :type 'boolean
113
+ :lsp-path " haskell.plugin.moduleName.globalOn" )
114
+ (defcustom-lsp lsp-haskell-plugin-splice-global-on
105
115
t
106
116
" Enables splice plugin (expand template haskell definitions)"
107
117
:group 'lsp-haskell-plugins
108
- :type 'boolean )
109
- (defcustom lsp-haskell-plugin-haddock-comments-global-on
118
+ :type 'boolean
119
+ :lsp-path " haskell.plugin.splice.globalOn" )
120
+ (defcustom-lsp lsp-haskell-plugin-haddock-comments-global-on
110
121
t
111
122
" Enables haddock comments plugin"
112
123
:group 'lsp-haskell-plugins
113
- :type 'boolean )
114
- (defcustom lsp-haskell-plugin-class-global-on
124
+ :type 'boolean
125
+ :lsp-path " haskell.plugin.haddockComments.globalOn" )
126
+ (defcustom-lsp lsp-haskell-plugin-class-global-on
115
127
t
116
128
" Enables type class plugin"
117
129
:group 'lsp-haskell-plugins
118
- :type 'boolean )
119
- (defcustom lsp-haskell-plugin-retrie-global-on
130
+ :type 'boolean
131
+ :lsp-path " haskell.plugin.class.globalOn" )
132
+ (defcustom-lsp lsp-haskell-plugin-retrie-global-on
120
133
t
121
134
" Enables retrie plugin"
122
135
:group 'lsp-haskell-plugins
123
- :type 'boolean )
124
- (defcustom lsp-haskell-plugin-tactics-global-on
136
+ :type 'boolean
137
+ :lsp-path " haskell.plugin.retrie.globalOn" )
138
+ (defcustom-lsp lsp-haskell-plugin-tactics-global-on
125
139
t
126
140
" Enables Wingman (tactics) plugin"
127
141
:group 'lsp-haskell-plugins
128
- :type 'boolean )
129
- (defcustom lsp-haskell-plugin-tactics-config-auto-gas
142
+ :type 'boolean
143
+ :lsp-path " haskell.plugin.tactics.globalOn" )
144
+ (defcustom-lsp lsp-haskell-plugin-tactics-config-auto-gas
130
145
4
131
146
" 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."
132
147
:group 'lsp-haskell-plugins
133
- :type 'number )
134
- (defcustom lsp-haskell-plugin-tactics-config-hole-severity
148
+ :type 'number
149
+ :lsp-path " haskell.plugin.tactics.config.auto_gas" )
150
+ (defcustom-lsp lsp-haskell-plugin-tactics-config-hole-severity
135
151
nil
136
152
" The severity to use when showing hole diagnostics."
137
153
:group 'lsp-haskell-plugins
138
- :type '(choice (const 1 ) (const 2 ) (const 3 ) (const 4 ) (const nil )))
139
- (defcustom lsp-haskell-plugin-tactics-config-max-use-ctor-actions
154
+ :type '(choice (const 1 ) (const 2 ) (const 3 ) (const 4 ) (const nil ))
155
+ :lsp-path " haskell.plugin.tactics.config.hole_severity" )
156
+ (defcustom-lsp lsp-haskell-plugin-tactics-config-max-use-ctor-actions
140
157
5
141
158
" Maximum number of `Use constructor <x>` code actions that can appear"
142
159
:group 'lsp-haskell-plugins
143
- :type 'number )
144
- (defcustom lsp-haskell-plugin-tactics-config-timeout-duration
160
+ :type 'number
161
+ :lsp-path " haskell.plugin.tactics.config.max_use_ctor_actions" )
162
+ (defcustom-lsp lsp-haskell-plugin-tactics-config-timeout-duration
145
163
2
146
164
" The timeout for Wingman actions, in seconds"
147
165
:group 'lsp-haskell-plugins
148
- :type 'number )
149
- (defcustom lsp-haskell-plugin-tactics-config-proofstate-styling
166
+ :type 'number
167
+ :lsp-path " haskell.plugin.tactics.config.timeout_duration" )
168
+ (defcustom-lsp lsp-haskell-plugin-tactics-config-proofstate-styling
150
169
t
151
170
" Should Wingman emit styling markup when showing metaprogram proof states?"
152
171
:group 'lsp-haskell-plugins
153
- :type 'boolean )
154
- (defcustom lsp-haskell-plugin-pragmas-code-actions-on
172
+ :type 'boolean
173
+ :lsp-path " haskell.plugin.tactics.config.proofstate_styling" )
174
+ (defcustom-lsp lsp-haskell-plugin-pragmas-code-actions-on
155
175
t
156
176
" Enables pragmas code actions"
157
177
:group 'lsp-haskell-plugins
158
- :type 'boolean )
159
- (defcustom lsp-haskell-plugin-pragmas-completion-on
178
+ :type 'boolean
179
+ :lsp-path " haskell.plugin.pragmas.codeActionsOn" )
180
+ (defcustom-lsp lsp-haskell-plugin-pragmas-completion-on
160
181
t
161
182
" Enables pragmas completions"
162
183
:group 'lsp-haskell-plugins
163
- :type 'boolean )
164
- (defcustom lsp-haskell-plugin-ghcide-completions-config-auto-extend-on
184
+ :type 'boolean
185
+ :lsp-path " haskell.plugin.pragmas.completionsOn" )
186
+ (defcustom-lsp lsp-haskell-plugin-ghcide-completions-config-auto-extend-on
165
187
t
166
188
" Extends the import list automatically when completing a out-of-scope identifier"
167
189
:group 'lsp-haskell-plugins
168
- :type 'boolean )
169
- (defcustom lsp-haskell-plugin-ghcide-completions-config-snippets-on
190
+ :type 'boolean
191
+ :lsp-path " haskell.plugin.ghcide-completions.config.autoExtendOn" )
192
+ (defcustom-lsp lsp-haskell-plugin-ghcide-completions-config-snippets-on
170
193
lsp-enable-snippet
171
194
" Inserts snippets when using code completions"
172
195
:group 'lsp-haskell-plugins
173
- :type 'boolean )
174
- (defcustom lsp-haskell-plugin-ghcide-type-lenses-global-on
196
+ :type 'boolean
197
+ :lsp-path " haskell.plugin.ghcide-completions.config.snippetsOn" )
198
+ (defcustom-lsp lsp-haskell-plugin-ghcide-type-lenses-global-on
175
199
t
176
200
" Enables type lenses plugin"
177
201
:group 'lsp-haskell-plugins
178
- :type 'boolean )
179
- (defcustom lsp-haskell-plugin-ghcide-type-lenses-config-mode
202
+ :type 'boolean
203
+ :lsp-path " haskell.plugin.ghcide-type-lenses.globalOn" )
204
+ (defcustom-lsp lsp-haskell-plugin-ghcide-type-lenses-config-mode
180
205
t
181
206
" Control how type lenses are shown"
182
207
:group 'lsp-haskell-plugins
183
- :type '(choice (const " always" ) (const " exported" ) (const " diagnostics" )))
184
- (defcustom lsp-haskell-plugin-refine-imports-global-on
208
+ :type '(choice (const " always" ) (const " exported" ) (const " diagnostics" ))
209
+ :lsp-path " haskell.plugin.ghcide-type-lenses.config.mode" )
210
+ (defcustom-lsp lsp-haskell-plugin-refine-imports-global-on
185
211
t
186
212
" Enables refine imports plugin"
187
213
:group 'lsp-haskell-plugins
188
- :type 'boolean )
214
+ :type 'boolean
215
+ :lsp-path " haskell.plugin.refineImports.globalOn" )
189
216
190
217
; ; ---------------------------------------------------------------------
191
218
; ; Non-language server options
@@ -248,38 +275,6 @@ These are assembled from the customizable variables `lsp-haskell-server-path'
248
275
and `lsp-haskell-server-args' and `lsp-haskell-server-wrapper-function' ."
249
276
(funcall lsp-haskell-server-wrapper-function (append (list lsp-haskell-server-path " --lsp" ) lsp-haskell-server-args) ))
250
277
251
- ; ; Register all the language server settings with lsp-mode.
252
- ; ; Note that customizing these will currently *not* send the updated configuration to the server,
253
- ; ; users must manually restart. See https://github.com/emacs-lsp/lsp-mode/issues/1174.
254
- (lsp-register-custom-settings
255
- '((" haskell.plugin.refineImports.globalOn" lsp-haskell-plugin-refine-imports-global-on t )
256
- (" haskell.plugin.ghcide-type-lenses.config.mode" lsp-haskell-plugin-ghcide-type-lenses-config-mode)
257
- (" haskell.plugin.ghcide-type-lenses.globalOn" lsp-haskell-plugin-ghcide-type-lenses-global-on t )
258
- (" haskell.plugin.ghcide-completions.config.snippetsOn" lsp-haskell-plugin-ghcide-completions-config-snippets-on t )
259
- (" haskell.plugin.ghcide-completions.config.autoExtendOn" lsp-haskell-plugin-ghcide-completions-config-auto-extend-on t )
260
- (" haskell.plugin.pragmas.completionOn" lsp-haskell-plugin-pragmas-completion-on t )
261
- (" haskell.plugin.pragmas.codeActionsOn" lsp-haskell-plugin-pragmas-code-actions-on t )
262
- (" haskell.plugin.tactics.config.proofstate_styling" lsp-haskell-plugin-tactics-config-proofstate-styling t )
263
- (" haskell.plugin.tactics.config.timeout_duration" lsp-haskell-plugin-tactics-config-timeout-duration)
264
- (" haskell.plugin.tactics.config.max_use_ctor_actions" lsp-haskell-plugin-tactics-config-max-use-ctor-actions)
265
- (" haskell.plugin.tactics.config.hole_severity" lsp-haskell-plugin-tactics-config-hole-severity)
266
- (" haskell.plugin.tactics.config.auto_gas" lsp-haskell-plugin-tactics-config-auto-gas)
267
- (" haskell.plugin.tactics.globalOn" lsp-haskell-plugin-tactics-global-on t )
268
- (" haskell.plugin.retrie.globalOn" lsp-haskell-plugin-retrie-global-on t )
269
- (" haskell.plugin.class.globalOn" lsp-haskell-plugin-class-global-on t )
270
- (" haskell.plugin.haddockComments.globalOn" lsp-haskell-plugin-haddock-comments-global-on t )
271
- (" haskell.plugin.splice.globalOn" lsp-haskell-plugin-splice-global-on t )
272
- (" haskell.plugin.moduleName.globalOn" lsp-haskell-plugin-module-name-global-on t )
273
- (" haskell.plugin.eval.globalOn" lsp-haskell-plugin-eval-global-on t )
274
- (" haskell.plugin.hlint.config.flags" lsp-haskell-plugin-hlint-config-flags)
275
- (" haskell.plugin.hlint.diagnosticsOn" lsp-haskell-plugin-hlint-diagnostics-on t )
276
- (" haskell.plugin.hlint.codeActionsOn" lsp-haskell-plugin-hlint-code-actions-on t )
277
- (" haskell.plugin.importLens.codeLensOn" lsp-haskell-plugin-import-lens-code-lens-on t )
278
- (" haskell.plugin.importLens.codeActionsOn" lsp-haskell-plugin-import-lens-code-actions-on t )
279
- (" haskell.maxCompletions" lsp-haskell-max-completions)
280
- (" haskell.checkProject" lsp-haskell-check-project t )
281
- (" haskell.formattingProvider" lsp-haskell-formatting-provider)))
282
-
283
278
; ; This mapping is set for 'haskell-mode -> haskell' in the lsp-mode repo itself. If we move
284
279
; ; it there, then delete it from here.
285
280
; ; It also isn't *too* important: it only sets the language ID, see
@@ -295,11 +290,13 @@ and `lsp-haskell-server-args' and `lsp-haskell-server-wrapper-function'."
295
290
:major-modes '(haskell-mode haskell-literate-mode haskell-tng-mode)
296
291
; ; This is arbitrary.
297
292
:server-id 'lsp-haskell
298
- ; ; We need to manually pull out the configuration section and set it. Possibly in
299
- ; ; the future lsp-mode will asssociate servers with configuration sections more directly.
293
+ ; ; HLS does not currently send 'workspace/configuration' on startup (https://github.com/haskell/haskell-language-server/issues/2762),
294
+ ; ; so we need to push the configuration to it manually on startup. We should be able to
295
+ ; ; get rid of this once the issue is fixed in HLS.
300
296
:initialized-fn (lambda (workspace )
301
297
(with-lsp-workspace workspace
302
298
(lsp--set-configuration (lsp-configuration-section " haskell" ))))
299
+ :synchronize-sections '(" haskell" )
303
300
; ; This is somewhat irrelevant, but it is listed in lsp-language-id-configuration, so
304
301
; ; we should set something consistent here.
305
302
:language-id " haskell"
0 commit comments