-
-
Notifications
You must be signed in to change notification settings - Fork 18
/
haskell-tools.txt
580 lines (378 loc) · 23.4 KB
/
haskell-tools.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
==============================================================================
Table of Contents *haskell-tools.contents*
Introduction ··························································· |intro|
The haskell-tools module ······································· |haskell-tools|
plugin configuration ···································· |haskell-tools.config|
haskell-language-server LSP client tools ··················· |haskell-tools.lsp|
haskell-tools nvim-dap setup ······························· |haskell-tools.dap|
haskell-tools Hoogle search ····························· |haskell-tools.hoogle|
haskell-tools GHCi REPL module ···························· |haskell-tools.repl|
haskell-tools Project module ··························· |haskell-tools.project|
haskell-tools fast-tags module ···························· |haskell-tools.tags|
haskell-tools Logging ······································ |haskell-tools.log|
==============================================================================
Introduction *intro*
This plugin automatically configures the `haskell-language-server` builtin LSP client
and integrates with other haskell tools.
WARNING:
Do not call the `lspconfig.hls` setup or set up the lsp manually,
as doing so may cause conflicts.
NOTE: This plugin is a filetype plugin.
There is no need to call a `setup` function.
==============================================================================
The haskell-tools module *haskell-tools*
Entry-point into this plugin's public API.
HaskellTools *HaskellTools*
==============================================================================
plugin configuration *haskell-tools.config*
To configure haskell-tools.nvim, set the variable `vim.g.haskell_tools`,
which is a `haskell-tools.Opts` table, in your neovim configuration.
Example:
>
---@type haskell-tools.Opts
vim.g.haskell_tools = {
---@type haskell-tools.tools.Opts
tools = {
-- ...
},
---@type haskell-tools.lsp.ClientOpts
hls = {
on_attach = function(client, bufnr)
-- Set keybindings, etc. here.
end,
-- ...
},
---@type haskell-tools.dap.Opts
dap = {
-- ...
},
}
<
Note: `vim.g.haskell_tools` can also be a function that returns a 'haskell-tools.Opts' table.
haskell-tools.Opts *haskell-tools.Opts*
Fields: ~
{tools?} (haskell-tools.tools.Opts)
haskell-tools module options.
{hls?} (haskell-tools.lsp.ClientOpts)
haskell-language-server client options.
{dap?} (haskell-tools.dap.Opts)
debug adapter config for nvim-dap.
haskell-tools.tools.Opts *haskell-tools.tools.Opts*
Fields: ~
{codeLens?} (haskell-tools.codeLens.Opts)
LSP codeLens options.
{hoogle?} (haskell-tools.hoogle.Opts)
Hoogle type signature search options.
{hover?} (haskell-tools.hover.Opts)
LSP hover options.
{definition?} (haskell-tools.definition.Opts) LSP go-to-definition options.
{repl?} (haskell-tools.repl.Opts)
GHCi repl options.
{tags?} (haskell-tools.fast-tags.Opts)
fast-tags module options.
{log?} (haskell-tools.log.Opts)
haskell-tools logger options.
haskell-tools.codeLens.Opts *haskell-tools.codeLens.Opts*
Fields: ~
{autoRefresh?} (fun():boolean|boolean)
(default: `true`) Whether to auto-refresh code-lenses.
haskell-tools.hoogle.Opts *haskell-tools.hoogle.Opts*
Fields: ~
{mode?} (haskell-tools.hoogle.Mode)
Use a telescope with a local hoogle installation or a web backend,
or use the browser for hoogle signature search?
haskell-tools.hoogle.Mode *haskell-tools.hoogle.Mode*
Type: ~
"auto"|"telescope-local"|"telescope-web"|"browser"
haskell-tools.hover.Opts *haskell-tools.hover.Opts*
Fields: ~
{enable?} (fun():boolean|boolean)
(default: `true`) Whether to enable haskell-tools hover.
{border?} (string[][])
The hover window's border. Set to `nil` to disable.
{stylize_markdown?} (boolean)
(default: `false`) The builtin LSP client's default behaviour is to stylize markdown.
Setting this option to false sets the file type to markdown
and enables treesitter syntax highligting for Haskell snippets if nvim-treesitter is installed.
{auto_focus?} (boolean)
(default: `false`) Whether to automatically switch to the hover window.
haskell-tools.definition.Opts *haskell-tools.definition.Opts*
Fields: ~
{hoogle_signature_fallback?} (fun():boolean|boolean)
(default: `false`) Configure |vim.lsp.definition| to fall back to hoogle search
(does not affect |vim.lsp.tagfunc|).
haskell-tools.repl.Opts *haskell-tools.repl.Opts*
Fields: ~
{handler?} (fun():haskell-tools.repl.Handler|haskell-tools.repl.Handler)
`'builtin'`: Use the simple builtin repl.
`'toggleterm'`: Use akinsho/toggleterm.nvim.
{prefer?} (fun():haskell-tools.repl.Backend|haskell-tools.repl.Backend)
Prefer cabal or stack when both stack and cabal project files are present?
{builtin?} (haskell-tools.repl.builtin.Opts)
Configuration for the builtin repl.
{auto_focus?} (boolean)
Whether to auto-focus the repl on toggle or send. If unset, the handler decides.
haskell-tools.repl.Handler *haskell-tools.repl.Handler*
Type: ~
"builtin"|"toggleterm"
haskell-tools.repl.Backend *haskell-tools.repl.Backend*
Type: ~
"cabal"|"stack"
haskell-tools.repl.builtin.Opts *haskell-tools.repl.builtin.Opts*
Fields: ~
{create_repl_window?} (fun(view:haskell-tools.repl.View):fun(mk_repl_cmd:mk_ht_repl_cmd_fun))
How to create the repl window.
Should return a function that calls one of the |haskell-tools.repl.View|'s functions.
haskell-tools.repl.View *haskell-tools.repl.View*
Fields: ~
{create_repl_split?} (fun(opts:haskell-tools.repl.view.Opts):mk_ht_repl_cmd_fun)
Create the REPL in a horizontally split window.
{create_repl_vsplit?} (fun(opts:haskell-tools.repl.view.Opts):mk_ht_repl_cmd_fun)
Create the REPL in a vertically split window.
{create_repl_tabnew?} (fun(opts:haskell-tools.repl.view.Opts):mk_ht_repl_cmd_fun)
Create the REPL in a new tab.
{create_repl_cur_win?} (fun(opts:haskell-tools.repl.view.Opts):mk_ht_repl_cmd_fun)
Create the REPL in the current window.
haskell-tools.repl.view.Opts *haskell-tools.repl.view.Opts*
Fields: ~
{delete_buffer_on_exit?} (boolean)
Whether to delete the buffer when the Repl quits.
{size?} (fun():number|number)
The size of the window or a function that determines it.
mk_ht_repl_cmd_fun *mk_ht_repl_cmd_fun*
Type: ~
fun():string[]|nil
haskell-tools.fast-tags.Opts *haskell-tools.fast-tags.Opts*
Fields: ~
{enable?} (boolean|fun():boolean)
Enabled by default if the `fast-tags` executable is found.
{package_events?} (string[])
The |autocmd| events to trigger package tag generation.
haskell-tools.log.Opts *haskell-tools.log.Opts*
Fields: ~
{level?} (number|string)
The log level.
See: ~
|vim.log.levels|
haskell-tools.lsp.ClientOpts *haskell-tools.lsp.ClientOpts*
Fields: ~
{auto_attach?} (fun():boolean|boolean)
Whether to automatically attach the LSP client.
Defaults to `true` if the haskell-language-server executable is found.
{debug?} (boolean)
Whether to enable haskell-language-server debug logging.
{on_attach?} (fun(client:number,bufnr:number,ht:HaskellTools))
Callback that is invoked when the client attaches to a buffer.
{cmd?} (fun():string[]|string[])
The command to start haskell-language-server with.
{capabilities?} (lsp.ClientCapabilities)
LSP client capabilities.
{settings?} (fun(project_root:string|nil):table|table)
The haskell-language-server settings or a function that creates them.
To view the default settings, run `haskell-language-server generate-default-config`.
{default_settings?} (table)
The default haskell-language-server settings that will be used if no settings are specified or detected.
{logfile?} (string)
The path to the haskell-language-server log file.
To print all options that are available for your haskell-language-server version, run `haskell-language-server-wrapper generate-default-config`
See: https://haskell-language-server.readthedocs.io/en/latest/configuration.html.
haskell-tools.dap.Opts *haskell-tools.dap.Opts*
Fields: ~
{cmd?} (string[])
The command to start the debug adapter server with.
{logFile?} (string)
Log file path for detected configurations.
{logLevel?} (haskell-tools.debugAdapter.LogLevel)
The log level for detected configurations.
{auto_discover?} (boolean|haskell-tools.dap.AddConfigOpts) Set to `false` to disable auto-discovery of launch configurations. `true` uses the default configurations options`.
haskell-tools.debugAdapter.LogLevel *haskell-tools.debugAdapter.LogLevel*
Type: ~
"Debug"|"Info"|"Warning"|"Error"
haskell-tools.dap.AddConfigOpts *haskell-tools.dap.AddConfigOpts*
Fields: ~
{autodetect} (boolean)
Whether to automatically detect launch configurations for the project.
{settings_file_pattern} (string)
File name or pattern to search for.
Defaults to 'launch.json'.
==============================================================================
haskell-language-server LSP client tools *haskell-tools.lsp*
The following commands are available:
* `:Hls start` - Start the LSP client.
* `:Hls stop` - Stop the LSP client.
* `:Hls restart` - Restart the LSP client.
* `:Hls evalAll` - Evaluate all code snippets in comments.
haskell-tools.load_hls_settings.Opts *haskell-tools.load_hls_settings.Opts*
Fields: ~
{settings_file_pattern} (string|nil) File name or pattern to search for. Defaults to 'hls.json'
haskell-tools.Hls *haskell-tools.Hls*
*Hls.load_hls_settings*
Hls.load_hls_settings({project_root}, {opts})
Search the project root for a haskell-language-server settings JSON file and load it to a Lua table.
Falls back to the `hls.default_settings` if no file is found or file cannot be read or decoded.
Parameters: ~
{project_root} (string|nil) The project root
{opts} (haskell-tools.load_hls_settings.Opts|nil)
Returns: ~
(table) hls_settings
See: ~
|https://haskell-language-server.readthedocs.io/en/latest/configuration.html|
Hls.start({bufnr}) *Hls.start*
Start or attach the LSP client.
Fails silently if the buffer's filetype is not one of the filetypes specified in the config.
Parameters: ~
{bufnr} (number|nil) The buffer number (optional), defaults to the current buffer
Returns: ~
(number|nil) The LSP client ID
Hls.stop({bufnr}) *Hls.stop*
Stop the LSP client.
Parameters: ~
{bufnr} (number|nil) The buffer number (optional), defaults to the current buffer
Returns: ~
(table[]) A list of clients that will be stopped
Hls.restart({bufnr}) *Hls.restart*
Restart the LSP client.
Fails silently if the buffer's filetype is not one of the filetypes specified in the config.
Parameters: ~
{bufnr} (number|nil) The buffer number (optional), defaults to the current buffer
Returns: ~
(number|nil) The LSP client ID after restart
Hls.buf_eval_all({bufnr}) *Hls.buf_eval_all*
Evaluate all code snippets in comments.
Parameters: ~
{bufnr} (number|nil) Defaults to the current buffer.
Returns: ~
(nil)
==============================================================================
haskell-tools nvim-dap setup *haskell-tools.dap*
haskell-tools.dap.LaunchConfiguration *haskell-tools.dap.LaunchConfiguration*
haskell-tools.Dap *haskell-tools.Dap*
*Dap.discover_configurations*
Dap.discover_configurations({bufnr}, {opts})
Discover nvim-dap launch configurations for haskell-debug-adapter.
Parameters: ~
{bufnr} (number|nil) The buffer number
{opts} (haskell-tools.dap.AddConfigOpts|nil)
Returns: ~
(nil)
==============================================================================
haskell-tools Hoogle search *haskell-tools.hoogle*
haskell-tools.Hoogle *haskell-tools.Hoogle*
Hoogle.hoogle_signature({options}) *Hoogle.hoogle_signature*
Parameters: ~
{options} (table<string,any>|nil) Includes the `search_term` and options to pass to the telescope picker (if available)
Returns: ~
(nil)
==============================================================================
haskell-tools GHCi REPL module *haskell-tools.repl*
The following commands are available:
* `:Haskell repl toggle {file?}` - Toggle a GHCi repl.
* `:Haskell repl quit` - Quit the current repl.
* `:Haskell repl load {file?}` - Load a Haskell file into the repl.
* `:Haskell repl reload` - Reload the current repl.
* `:Haskell repl paste_type {register?}` - Query the repl for the type of |registers| {register}
* `:Haskell repl cword_type` - Query the repl for the type of |cword|
* `:Haskell repl paste_info {register?}` - Query the repl for the info on |registers| {register}
* `:Haskell repl cword_info` - Query the repl for info on |cword|
haskell-tools.Repl *haskell-tools.Repl*
Repl.buf_mk_repl_cmd() *Repl.buf_mk_repl_cmd*
Create the command to create a repl for the current buffer.
Returns: ~
(table|nil) command
Repl.operator() *Repl.operator*
See: ~
|operatorfunc|
Repl.paste({reg}) *Repl.paste*
Paste from register `reg` to the REPL
Parameters: ~
{reg} (string|nil) register (defaults to '"')
Repl.paste_type({reg}) *Repl.paste_type*
Query the REPL for the type of register `reg`
Parameters: ~
{reg} (string|nil) register (defaults to '"')
Repl.cword_type() *Repl.cword_type*
Query the REPL for the type of word under the cursor
Repl.paste_info({reg}) *Repl.paste_info*
Query the REPL for info on register `reg`
Parameters: ~
{reg} (string|nil) register (defaults to '"')
Repl.cword_info() *Repl.cword_info*
Query the REPL for the type of word under the cursor
Repl.load_file({filepath}) *Repl.load_file*
Load a file into the REPL
Parameters: ~
{filepath} (string) The absolute file path
Repl.reload() *Repl.reload*
Reload the repl
==============================================================================
haskell-tools Project module *haskell-tools.project*
The following commands are available:
* `:Haskell projectFile` - Open the project file for the current buffer (cabal.project or stack.yaml).
* `:Haskell packageYaml` - Open the package.yaml file for the current buffer.
* `:Haskell packageCabal` - Open the *.cabal file for the current buffer.
haskell-tools.Project *haskell-tools.Project*
Project.root_dir({project_file}) *Project.root_dir*
Get the project's root directory
Parameters: ~
{project_file} (string) The path to a project file
Returns: ~
(string|nil)
Project.open_package_yaml() *Project.open_package_yaml*
Open the package.yaml of the package containing the current buffer.
Returns: ~
(nil)
Project.open_package_cabal() *Project.open_package_cabal*
Open the *.cabal file of the package containing the current buffer.
Returns: ~
(nil)
Project.open_project_file() *Project.open_project_file*
Open the current buffer's project file (cabal.project or stack.yaml).
Returns: ~
(nil)
==============================================================================
haskell-tools fast-tags module *haskell-tools.tags*
*haskell-tools.tags.generate_project_tags.Opts*
haskell-tools.tags.generate_project_tags.Opts
Fields: ~
{refresh} (boolean) Whether to refresh the tags if they have already been generated
haskell-tools.FastTags *haskell-tools.FastTags*
for the project (default: true)
*FastTags.generate_project_tags*
FastTags.generate_project_tags({path}, {opts})
Generates tags for the current project
Parameters: ~
{path} (string|nil) File path
{opts} (haskell-tools.tags.generate_project_tags.Opts|nil) Options
FastTags.generate_package_tags({path}) *FastTags.generate_package_tags*
Generate tags for the package containing `path`
Parameters: ~
{path} (string|nil) File path
==============================================================================
haskell-tools Logging *haskell-tools.log*
The following commands are available:
* `:Haskell log setLevel` - Set the haskell-tools.nvim and LSP client log level.
* `:Haskell log openLog` - Open the haskell-tools.nvim log file.
* `:Haskell log openHlsLog` - Open the haskell-language-server log file.
haskell-tools.Log *haskell-tools.Log*
Log.get_hls_logfile() *Log.get_hls_logfile*
Get the haskell-language-server log file
Returns: ~
(string) filepath
Log.get_logfile() *Log.get_logfile*
Get the haskell-tools.nvim log file path.
Returns: ~
(string) filepath
Log.nvim_open_hls_logfile() *Log.nvim_open_hls_logfile*
Open the haskell-language-server log file
Returns: ~
(nil)
Log.nvim_open_logfile() *Log.nvim_open_logfile*
Open the haskell-tools.nvim log file.
Returns: ~
(nil)
Log.set_level() *Log.set_level*
Returns: ~
(nil)
See: ~
|vim.log.levels|
vim:tw=78:ts=8:noet:ft=help:norl: