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