]> git.madduck.net Git - etc/vim.git/blob - autoload/ale/fix/registry.vim

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Squashed '.vim/bundle/ale/' content from commit 22185c4c
[etc/vim.git] / autoload / ale / fix / registry.vim
1 " Author: w0rp <devw0rp@gmail.com>
2 " Description: A registry of functions for fixing things.
3
4 let s:default_registry = {
5 \   'add_blank_lines_for_python_control_statements': {
6 \       'function': 'ale#fixers#generic_python#AddLinesBeforeControlStatements',
7 \       'suggested_filetypes': ['python'],
8 \       'description': 'Add blank lines before control statements.',
9 \   },
10 \   'alejandra': {
11 \       'function': 'ale#fixers#alejandra#Fix',
12 \       'suggested_filetypes': ['nix'],
13 \       'description': 'The Uncompromising Nix Code Formatter',
14 \   },
15 \   'align_help_tags': {
16 \       'function': 'ale#fixers#help#AlignTags',
17 \       'suggested_filetypes': ['help'],
18 \       'description': 'Align help tags to the right margin',
19 \   },
20 \   'apkbuild-fixer': {
21 \       'function': 'ale#fixers#apkbuild_fixer#Fix',
22 \       'suggested_filetypes': ['apkbuild'],
23 \       'description': 'Fix policy violations found by apkbuild-lint in APKBUILDs',
24 \   },
25 \   'autoimport': {
26 \       'function': 'ale#fixers#autoimport#Fix',
27 \       'suggested_filetypes': ['python'],
28 \       'description': 'Fix import issues with autoimport.',
29 \   },
30 \   'autoflake': {
31 \       'function': 'ale#fixers#autoflake#Fix',
32 \       'suggested_filetypes': ['python'],
33 \       'description': 'Fix flake issues with autoflake.',
34 \   },
35 \   'autopep8': {
36 \       'function': 'ale#fixers#autopep8#Fix',
37 \       'suggested_filetypes': ['python'],
38 \       'description': 'Fix PEP8 issues with autopep8.',
39 \   },
40 \   'bibclean': {
41 \       'function': 'ale#fixers#bibclean#Fix',
42 \       'suggested_filetypes': ['bib'],
43 \       'description': 'Format bib files using bibclean.',
44 \   },
45 \   'biome': {
46 \       'function': 'ale#fixers#biome#Fix',
47 \       'suggested_filetypes': ['javascript', 'typescript', 'json', 'jsonc', 'css', 'graphql'],
48 \       'description': 'Fix JavaScript and TypeScript using biome.',
49 \   },
50 \   'black': {
51 \       'function': 'ale#fixers#black#Fix',
52 \       'suggested_filetypes': ['python'],
53 \       'description': 'Fix PEP8 issues with black.',
54 \   },
55 \   'buf-format': {
56 \       'function': 'ale#fixers#buf_format#Fix',
57 \       'suggested_filetypes': ['proto'],
58 \       'description': 'Fix .proto files with buf format.',
59 \   },
60 \   'buildifier': {
61 \       'function': 'ale#fixers#buildifier#Fix',
62 \       'suggested_filetypes': ['bzl'],
63 \       'description': 'Format BUILD and .bzl files with buildifier.',
64 \   },
65 \   'css-beautify': {
66 \       'function': 'ale#fixers#css_beautify#Fix',
67 \       'suggested_filetypes': ['css'],
68 \       'description': 'Format CSS using css-beautify from js-beautify.',
69 \    },
70 \   'deno': {
71 \       'function': 'ale#fixers#deno#Fix',
72 \       'suggested_filetypes': ['typescript'],
73 \       'description': 'Fix TypeScript using deno fmt.',
74 \   },
75 \   'dfmt': {
76 \       'function': 'ale#fixers#dfmt#Fix',
77 \       'suggested_filetypes': ['d'],
78 \       'description': 'Fix D files with dfmt.',
79 \   },
80 \   'dhall': {
81 \       'function': 'ale#fixers#dhall#Fix',
82 \       'suggested_filetypes': ['dhall'],
83 \       'description': 'Fix Dhall files with dhall-format.',
84 \   },
85 \   'dhall-format': {
86 \       'function': 'ale#fixers#dhall_format#Fix',
87 \       'suggested_filetypes': ['dhall'],
88 \       'description': 'Standard code formatter for the Dhall language',
89 \       'aliases': ['dhall'],
90 \   },
91 \   'dhall-freeze': {
92 \       'function': 'ale#fixers#dhall_freeze#Freeze',
93 \       'suggested_filetypes': ['dhall'],
94 \       'description': 'Add integrity checks to remote import statements of an expression for the Dhall language',
95 \   },
96 \   'dhall-lint': {
97 \       'function': 'ale#fixers#dhall_lint#Fix',
98 \       'suggested_filetypes': ['dhall'],
99 \       'description': 'Standard code formatter for the Dhall language and removing dead code',
100 \   },
101 \   'djlint': {
102 \       'function': 'ale#fixers#djlint#Fix',
103 \       'suggested_filetypes': ['html', 'htmldjango', 'htmlangular', 'jinja', 'handlebars', 'nunjucks', 'gohtmltmpl'],
104 \       'description': 'Fix HTML templates with `djlint --reformat`.',
105 \   },
106 \   'dune': {
107 \       'function': 'ale#fixers#dune#Fix',
108 \       'suggested_filetypes': ['dune'],
109 \       'description': 'Fix dune files with dune format',
110 \   },
111 \   'erlang_mode': {
112 \       'function': 'ale#fixers#erlang_mode#Fix',
113 \       'suggested_filetypes': ['erlang'],
114 \       'description': 'Indent with the Erlang mode for Emacs',
115 \       'aliases': ['erlang-mode'],
116 \   },
117 \   'erlfmt': {
118 \       'function': 'ale#fixers#erlfmt#Fix',
119 \       'suggested_filetypes': ['erlang'],
120 \       'description': 'Format Erlang code with erlfmt',
121 \   },
122 \   'fecs': {
123 \       'function': 'ale#fixers#fecs#Fix',
124 \       'suggested_filetypes': ['javascript', 'css', 'html'],
125 \       'description': 'Apply fecs format to a file.',
126 \   },
127 \   'hurlfmt': {
128 \       'function': 'ale#fixers#hurlfmt#Fix',
129 \       'suggested_filetypes': ['hurl'],
130 \       'description': 'Fix hurl files with hurlfmt.',
131 \   },
132 \   'kulala_fmt': {
133 \       'function': 'ale#fixers#kulala_fmt#Fix',
134 \       'suggested_filetypes': ['http', 'rest'],
135 \       'description': 'Fix http and rest files with kulala_fmt.',
136 \   },
137 \   'tidy': {
138 \       'function': 'ale#fixers#tidy#Fix',
139 \       'suggested_filetypes': ['html'],
140 \       'description': 'Fix HTML files with tidy.',
141 \   },
142 \   'prettier_standard': {
143 \       'function': 'ale#fixers#prettier_standard#Fix',
144 \       'suggested_filetypes': ['javascript'],
145 \       'description': 'Apply prettier-standard to a file.',
146 \       'aliases': ['prettier-standard'],
147 \   },
148 \   'elm-format': {
149 \       'function': 'ale#fixers#elm_format#Fix',
150 \       'suggested_filetypes': ['elm'],
151 \       'description': 'Apply elm-format to a file.',
152 \       'aliases': ['format'],
153 \   },
154 \   'nimpretty': {
155 \       'function': 'ale#fixers#nimpretty#Fix',
156 \       'suggested_filetypes': ['nim'],
157 \       'description': 'Apply nimpretty to a file.',
158 \   },
159 \   'erblint': {
160 \       'function': 'ale#fixers#erblint#Fix',
161 \       'suggested_filetypes': ['eruby'],
162 \       'description': 'Apply erblint --autocorrect to a file.',
163 \   },
164 \   'eslint': {
165 \       'function': 'ale#fixers#eslint#Fix',
166 \       'suggested_filetypes': ['javascript', 'typescript', 'astro'],
167 \       'description': 'Apply eslint --fix to a file.',
168 \   },
169 \   'mix_format': {
170 \       'function': 'ale#fixers#mix_format#Fix',
171 \       'suggested_filetypes': ['elixir'],
172 \       'description': 'Apply mix format to a file.',
173 \   },
174 \   'isort': {
175 \       'function': 'ale#fixers#isort#Fix',
176 \       'suggested_filetypes': ['python'],
177 \       'description': 'Sort Python imports with isort.',
178 \   },
179 \   'prettier': {
180 \       'function': 'ale#fixers#prettier#Fix',
181 \       'suggested_filetypes': ['javascript', 'typescript', 'css', 'less', 'scss', 'json', 'json5', 'graphql', 'markdown', 'vue', 'svelte', 'html', 'yaml', 'openapi', 'ruby', 'astro'],
182 \       'description': 'Apply prettier to a file.',
183 \   },
184 \   'prettier_eslint': {
185 \       'function': 'ale#fixers#prettier_eslint#Fix',
186 \       'suggested_filetypes': ['javascript'],
187 \       'description': 'Apply prettier-eslint to a file.',
188 \       'aliases': ['prettier-eslint'],
189 \   },
190 \   'pyflyby': {
191 \       'function': 'ale#fixers#pyflyby#Fix',
192 \       'suggested_filetypes': ['python'],
193 \       'description': 'Tidy Python imports with pyflyby.',
194 \   },
195 \   'importjs': {
196 \       'function': 'ale#fixers#importjs#Fix',
197 \       'suggested_filetypes': ['javascript'],
198 \       'description': 'automatic imports for javascript',
199 \   },
200 \   'puppetlint': {
201 \       'function': 'ale#fixers#puppetlint#Fix',
202 \       'suggested_filetypes': ['puppet'],
203 \       'description': 'Run puppet-lint -f on a file.',
204 \   },
205 \   'remove_trailing_lines': {
206 \       'function': 'ale#fixers#generic#RemoveTrailingBlankLines',
207 \       'suggested_filetypes': [],
208 \       'description': 'Remove all blank lines at the end of a file.',
209 \   },
210 \   'trim_whitespace': {
211 \       'function': 'ale#fixers#generic#TrimWhitespace',
212 \       'suggested_filetypes': [],
213 \       'description': 'Remove all trailing whitespace characters at the end of every line.',
214 \   },
215 \   'yamlfix': {
216 \       'function': 'ale#fixers#yamlfix#Fix',
217 \       'suggested_filetypes': ['yaml'],
218 \       'description': 'Fix YAML files with yamlfix.',
219 \   },
220 \   'yamlfmt': {
221 \       'function': 'ale#fixers#yamlfmt#Fix',
222 \       'suggested_filetypes': ['yaml'],
223 \       'description': 'Format YAML files with yamlfmt.',
224 \   },
225 \   'yapf': {
226 \       'function': 'ale#fixers#yapf#Fix',
227 \       'suggested_filetypes': ['python'],
228 \       'description': 'Fix Python files with yapf.',
229 \   },
230 \   'yq': {
231 \       'function': 'ale#fixers#yq#Fix',
232 \       'suggested_filetypes': ['yaml'],
233 \       'description': 'Fix YAML files with yq.',
234 \   },
235 \   'rubocop': {
236 \       'function': 'ale#fixers#rubocop#Fix',
237 \       'suggested_filetypes': ['ruby'],
238 \       'description': 'Fix ruby files with rubocop --auto-correct.',
239 \   },
240 \   'rufo': {
241 \       'function': 'ale#fixers#rufo#Fix',
242 \       'suggested_filetypes': ['ruby'],
243 \       'description': 'Fix ruby files with rufo',
244 \   },
245 \   'scalafmt': {
246 \       'function': 'ale#fixers#scalafmt#Fix',
247 \       'suggested_filetypes': ['sbt', 'scala'],
248 \       'description': 'Fix Scala files using scalafmt',
249 \   },
250 \   'sorbet': {
251 \       'function': 'ale#fixers#sorbet#Fix',
252 \       'suggested_filetypes': ['ruby'],
253 \       'description': 'Fix ruby files with srb tc --autocorrect.',
254 \   },
255 \   'standard': {
256 \       'function': 'ale#fixers#standard#Fix',
257 \       'suggested_filetypes': ['javascript'],
258 \       'description': 'Fix JavaScript files using standard --fix',
259 \   },
260 \   'standardrb': {
261 \       'function': 'ale#fixers#standardrb#Fix',
262 \       'suggested_filetypes': ['ruby'],
263 \       'description': 'Fix ruby files with standardrb --fix',
264 \   },
265 \   'statix': {
266 \       'function': 'ale#fixers#statix#Fix',
267 \       'suggested_filetypes': ['nix'],
268 \       'description': 'Fix common Nix antipatterns with statix fix',
269 \   },
270 \   'stylelint': {
271 \       'function': 'ale#fixers#stylelint#Fix',
272 \       'suggested_filetypes': ['css', 'sass', 'scss', 'sugarss', 'stylus'],
273 \       'description': 'Fix stylesheet files using stylelint --fix.',
274 \   },
275 \   'swiftformat': {
276 \       'function': 'ale#fixers#swiftformat#Fix',
277 \       'suggested_filetypes': ['swift'],
278 \       'description': 'Apply SwiftFormat to a file.',
279 \   },
280 \   'syntax_tree': {
281 \       'function': 'ale#fixers#syntax_tree#Fix',
282 \       'suggested_filetypes': ['ruby'],
283 \       'description': 'Fix ruby files with stree write',
284 \   },
285 \   'apple-swift-format': {
286 \       'function': 'ale#fixers#appleswiftformat#Fix',
287 \       'suggested_filetypes': ['swift'],
288 \       'description': 'Apply apple/swift-format to a file.',
289 \   },
290 \   'phpcbf': {
291 \       'function': 'ale#fixers#phpcbf#Fix',
292 \       'suggested_filetypes': ['php'],
293 \       'description': 'Fix PHP files with phpcbf.',
294 \   },
295 \   'php_cs_fixer': {
296 \       'function': 'ale#fixers#php_cs_fixer#Fix',
297 \       'suggested_filetypes': ['php'],
298 \       'description': 'Fix PHP files with php-cs-fixer.',
299 \   },
300 \   'pint': {
301 \       'function': 'ale#fixers#pint#Fix',
302 \       'suggested_filetypes': ['php'],
303 \       'description': 'Fix PHP files with Laravel Pint.',
304 \   },
305 \   'astyle': {
306 \       'function': 'ale#fixers#astyle#Fix',
307 \       'suggested_filetypes': ['c', 'cpp'],
308 \       'description': 'Fix C/C++ with astyle.',
309 \   },
310 \   'clangtidy': {
311 \       'function': 'ale#fixers#clangtidy#Fix',
312 \       'suggested_filetypes': ['c', 'cpp', 'objc'],
313 \       'description': 'Fix C/C++ and ObjectiveC files with clang-tidy.',
314 \   },
315 \   'clang-format': {
316 \       'function': 'ale#fixers#clangformat#Fix',
317 \       'suggested_filetypes': ['c', 'cpp', 'cs', 'cuda', 'java', 'javascript', 'json', 'objc', 'proto'],
318 \       'description': 'Fix C, C++, C#, CUDA, Java, JavaScript, JSON, ObjectiveC and Protobuf files with clang-format.',
319 \   },
320 \   'cmakeformat': {
321 \       'function': 'ale#fixers#cmakeformat#Fix',
322 \       'suggested_filetypes': ['cmake'],
323 \       'description': 'Fix CMake files with cmake-format.',
324 \   },
325 \   'fish_indent': {
326 \       'function': 'ale#fixers#fish_indent#Fix',
327 \       'suggested_filetypes': ['fish'],
328 \       'description': 'Format fish scripts using fish_indent.',
329 \   },
330 \   'forge': {
331 \       'function': 'ale#fixers#forge#Fix',
332 \       'suggested_filetypes': ['solidity'],
333 \       'description': 'Fix Solidity files with forge fmt.',
334 \   },
335 \   'gleam_format': {
336 \       'function': 'ale#fixers#gleam_format#Fix',
337 \       'suggested_filetypes': ['gleam'],
338 \       'description': 'Fix Gleam files with gleam format.',
339 \   },
340 \   'gofmt': {
341 \       'function': 'ale#fixers#gofmt#Fix',
342 \       'suggested_filetypes': ['go'],
343 \       'description': 'Fix Go files with go fmt.',
344 \   },
345 \   'gofumpt': {
346 \       'function': 'ale#fixers#gofumpt#Fix',
347 \       'suggested_filetypes': ['go'],
348 \       'description': 'Fix Go files with gofumpt, a stricter go fmt.',
349 \   },
350 \   'goimports': {
351 \       'function': 'ale#fixers#goimports#Fix',
352 \       'suggested_filetypes': ['go'],
353 \       'description': 'Fix Go files imports with goimports.',
354 \   },
355 \   'golangci_lint': {
356 \       'function': 'ale#fixers#golangci_lint#Fix',
357 \       'suggested_filetypes': ['go'],
358 \       'description': 'Fix Go files with golangci-lint.',
359 \   },
360 \   'golines': {
361 \       'function': 'ale#fixers#golines#Fix',
362 \       'suggested_filetypes': ['go'],
363 \        'description': 'Fix Go file long lines with golines',
364 \   },
365 \   'gomod': {
366 \       'function': 'ale#fixers#gomod#Fix',
367 \       'suggested_filetypes': ['gomod'],
368 \       'description': 'Fix Go module files with go mod edit -fmt.',
369 \   },
370 \   'gopls': {
371 \       'function': 'ale#fixers#gopls#Fix',
372 \       'suggested_filetypes': ['go'],
373 \       'description': 'Fix Go files with gopls.',
374 \   },
375 \   'tslint': {
376 \       'function': 'ale#fixers#tslint#Fix',
377 \       'suggested_filetypes': ['typescript'],
378 \       'description': 'Fix typescript files with tslint --fix.',
379 \   },
380 \   'rustfmt': {
381 \       'function': 'ale#fixers#rustfmt#Fix',
382 \       'suggested_filetypes': ['rust'],
383 \       'description': 'Fix Rust files with Rustfmt.',
384 \   },
385 \   'textlint': {
386 \       'function': 'ale#fixers#textlint#Fix',
387 \       'suggested_filetypes': ['text','markdown','asciidoc','tex'],
388 \       'description': 'Fix text files with textlint --fix',
389 \   },
390 \   'hackfmt': {
391 \       'function': 'ale#fixers#hackfmt#Fix',
392 \       'suggested_filetypes': ['hack'],
393 \       'description': 'Fix Hack files with hackfmt.',
394 \   },
395 \   'floskell': {
396 \       'function': 'ale#fixers#floskell#Fix',
397 \       'suggested_filetypes': ['haskell'],
398 \       'description': 'Fix Haskell files with floskell.',
399 \   },
400 \   'hfmt': {
401 \       'function': 'ale#fixers#hfmt#Fix',
402 \       'suggested_filetypes': ['haskell'],
403 \       'description': 'Fix Haskell files with hfmt.',
404 \   },
405 \   'brittany': {
406 \       'function': 'ale#fixers#brittany#Fix',
407 \       'suggested_filetypes': ['haskell'],
408 \       'description': 'Fix Haskell files with brittany.',
409 \   },
410 \   'hindent': {
411 \       'function': 'ale#fixers#hindent#Fix',
412 \       'suggested_filetypes': ['haskell'],
413 \       'description': 'Fix Haskell files with hindent.',
414 \   },
415 \   'hlint': {
416 \       'function': 'ale#fixers#hlint#Fix',
417 \       'suggested_filetypes': ['haskell'],
418 \       'description': 'Refactor Haskell files with hlint.',
419 \   },
420 \   'stylish-haskell': {
421 \       'function': 'ale#fixers#stylish_haskell#Fix',
422 \       'suggested_filetypes': ['haskell'],
423 \       'description': 'Refactor Haskell files with stylish-haskell.',
424 \   },
425 \   'purs-tidy': {
426 \       'function': 'ale#fixers#purs_tidy#Fix',
427 \       'suggested_filetypes': ['purescript'],
428 \       'description': 'Format PureScript files with purs-tidy.',
429 \   },
430 \   'purty': {
431 \       'function': 'ale#fixers#purty#Fix',
432 \       'suggested_filetypes': ['purescript'],
433 \       'description': 'Format PureScript files with purty.',
434 \   },
435 \   'ocamlformat': {
436 \       'function': 'ale#fixers#ocamlformat#Fix',
437 \       'suggested_filetypes': ['ocaml', 'ocamlinterface'],
438 \       'description': 'Fix OCaml files with ocamlformat.',
439 \   },
440 \   'ocp-indent': {
441 \       'function': 'ale#fixers#ocp_indent#Fix',
442 \       'suggested_filetypes': ['ocaml', 'ocamlinterface'],
443 \       'description': 'Fix OCaml files with ocp-indent.',
444 \   },
445 \   'refmt': {
446 \       'function': 'ale#fixers#refmt#Fix',
447 \       'suggested_filetypes': ['reason'],
448 \       'description': 'Fix ReasonML files with refmt.',
449 \   },
450 \   'pandoc': {
451 \       'function': 'ale#fixers#pandoc#Fix',
452 \       'suggested_filetypes': ['markdown'],
453 \       'description': 'Fix markdown files with pandoc.',
454 \   },
455 \   'shfmt': {
456 \       'function': 'ale#fixers#shfmt#Fix',
457 \       'suggested_filetypes': ['sh'],
458 \       'description': 'Fix sh files with shfmt.',
459 \   },
460 \   'sqlfluff': {
461 \       'function': 'ale#fixers#sqlfluff#Fix',
462 \       'suggested_filetypes': ['sql'],
463 \       'description': 'Fix SQL files with sqlfluff.',
464 \   },
465 \   'sqlfmt': {
466 \       'function': 'ale#fixers#sqlfmt#Fix',
467 \       'suggested_filetypes': ['sql'],
468 \       'description': 'Fix SQL files with sqlfmt.',
469 \   },
470 \   'sqlformat': {
471 \       'function': 'ale#fixers#sqlformat#Fix',
472 \       'suggested_filetypes': ['sql'],
473 \       'description': 'Fix SQL files with sqlformat.',
474 \   },
475 \   'google_java_format': {
476 \       'function': 'ale#fixers#google_java_format#Fix',
477 \       'suggested_filetypes': ['java'],
478 \       'description': 'Fix Java files with google-java-format.',
479 \   },
480 \   'fixjson': {
481 \       'function': 'ale#fixers#fixjson#Fix',
482 \       'suggested_filetypes': ['json'],
483 \       'description': 'Fix JSON files with fixjson.',
484 \   },
485 \   'jq': {
486 \       'function': 'ale#fixers#jq#Fix',
487 \       'suggested_filetypes': ['json'],
488 \       'description': 'Fix JSON files with jq.',
489 \   },
490 \   'json_pytool': {
491 \       'function': 'ale#fixers#json_pytool#Fix',
492 \       'suggested_filetypes': ['json'],
493 \       'description': "Fix JSON files with python's built-in json.tool module.",
494 \   },
495 \   'protolint': {
496 \       'function': 'ale#fixers#protolint#Fix',
497 \       'suggested_filetypes': ['proto'],
498 \       'description': 'Fix Protocol Buffer files with protolint.',
499 \   },
500 \   'perltidy': {
501 \       'function': 'ale#fixers#perltidy#Fix',
502 \       'suggested_filetypes': ['perl'],
503 \       'description': 'Fix Perl files with perltidy.',
504 \   },
505 \   'xo': {
506 \       'function': 'ale#fixers#xo#Fix',
507 \       'suggested_filetypes': ['javascript', 'typescript'],
508 \       'description': 'Fix JavaScript/TypeScript files using xo --fix.',
509 \   },
510 \   'qmlfmt': {
511 \       'function': 'ale#fixers#qmlfmt#Fix',
512 \       'suggested_filetypes': ['qml'],
513 \       'description': 'Fix QML files with qmlfmt.',
514 \   },
515 \   'dartfmt': {
516 \       'function': 'ale#fixers#dartfmt#Fix',
517 \       'suggested_filetypes': ['dart'],
518 \       'description': 'Fix Dart files with dartfmt.',
519 \   },
520 \   'dart-format': {
521 \       'function': 'ale#fixers#dart_format#Fix',
522 \       'suggested_filetypes': ['dart'],
523 \       'description': 'Fix Dart files with dart format.',
524 \   },
525 \   'dotnet-format': {
526 \       'function': 'ale#fixers#dotnet_format#Fix',
527 \       'suggested_filetypes': ['cs'],
528 \       'description': 'Fix C# files with dotnet format.',
529 \   },
530 \   'xmllint': {
531 \       'function': 'ale#fixers#xmllint#Fix',
532 \       'suggested_filetypes': ['xml'],
533 \       'description': 'Fix XML files with xmllint.',
534 \   },
535 \   'uncrustify': {
536 \       'function': 'ale#fixers#uncrustify#Fix',
537 \       'suggested_filetypes': ['c', 'cpp', 'cs', 'objc', 'objcpp', 'd', 'java', 'p', 'vala' ],
538 \       'description': 'Fix C, C++, C#, ObjectiveC, ObjectiveC++, D, Java, Pawn, and VALA files with uncrustify.',
539 \   },
540 \   'terraform': {
541 \       'function': 'ale#fixers#terraform#Fix',
542 \       'suggested_filetypes': ['hcl', 'terraform'],
543 \       'description': 'Fix tf and hcl files with terraform fmt.',
544 \   },
545 \   'packer': {
546 \       'function': 'ale#fixers#packer#Fix',
547 \       'suggested_filetypes': ['hcl', 'packer'],
548 \       'description': 'Fix Packer HCL files with packer fmt.',
549 \   },
550 \   'crystal': {
551 \       'function': 'ale#fixers#crystal#Fix',
552 \       'suggested_filetypes': ['cr'],
553 \       'description': 'Fix cr (crystal).',
554 \   },
555 \   'ktlint': {
556 \       'function': 'ale#fixers#ktlint#Fix',
557 \       'suggested_filetypes': ['kt', 'kotlin'],
558 \       'description': 'Fix Kotlin files with ktlint.',
559 \   },
560 \   'styler': {
561 \       'function': 'ale#fixers#styler#Fix',
562 \       'suggested_filetypes': ['r', 'rmarkdown', 'rmd'],
563 \       'description': 'Fix R files with styler.',
564 \   },
565 \   'latexindent': {
566 \       'function': 'ale#fixers#latexindent#Fix',
567 \       'suggested_filetypes': ['tex'],
568 \       'description' : 'Indent code within environments, commands, after headings and within special code blocks.',
569 \   },
570 \   'pgformatter': {
571 \       'function': 'ale#fixers#pgformatter#Fix',
572 \       'suggested_filetypes': ['sql'],
573 \       'description': 'A PostgreSQL SQL syntax beautifier',
574 \   },
575 \   'reorder-python-imports': {
576 \       'function': 'ale#fixers#reorder_python_imports#Fix',
577 \       'suggested_filetypes': ['python'],
578 \       'description': 'Sort Python imports with reorder-python-imports.',
579 \   },
580 \   'gnatpp': {
581 \       'function': 'ale#fixers#gnatpp#Fix',
582 \       'suggested_filetypes': ['ada'],
583 \       'description': 'Format Ada files with gnatpp.',
584 \   },
585 \   'nixfmt': {
586 \       'function': 'ale#fixers#nixfmt#Fix',
587 \       'suggested_filetypes': ['nix'],
588 \       'description': 'A nix formatter written in Haskell.',
589 \   },
590 \   'nixpkgs-fmt': {
591 \       'function': 'ale#fixers#nixpkgsfmt#Fix',
592 \       'suggested_filetypes': ['nix'],
593 \       'description': 'A formatter for Nix code',
594 \   },
595 \   'remark-lint': {
596 \       'function': 'ale#fixers#remark_lint#Fix',
597 \       'suggested_filetypes': ['markdown'],
598 \       'description': 'Fix markdown files with remark-lint',
599 \   },
600 \   'html-beautify': {
601 \       'function': 'ale#fixers#html_beautify#Fix',
602 \       'suggested_filetypes': ['html', 'htmldjango'],
603 \       'description': 'Fix HTML files with html-beautify from js-beautify.',
604 \   },
605 \   'htmlbeautifier': {
606 \       'function': 'ale#fixers#htmlbeautifier#Fix',
607 \       'suggested_filetypes': ['eruby'],
608 \       'description': 'Fix ERB files with htmlbeautifier gem.',
609 \   },
610 \   'lua-format': {
611 \       'function': 'ale#fixers#lua_format#Fix',
612 \       'suggested_filetypes': ['lua'],
613 \       'description': 'Fix Lua files with lua-format.',
614 \   },
615 \   'luafmt': {
616 \       'function': 'ale#fixers#luafmt#Fix',
617 \       'suggested_filetypes': ['lua'],
618 \       'description': 'Fix Lua files with luafmt.',
619 \   },
620 \   'dprint': {
621 \       'function': 'ale#fixers#dprint#Fix',
622 \       'suggested_filetypes': ['dockerfile', 'javascript', 'json', 'markdown', 'toml', 'typescript'],
623 \       'description': 'Pluggable and configurable code formatting platform',
624 \   },
625 \   'stylua': {
626 \       'function': 'ale#fixers#stylua#Fix',
627 \       'suggested_filetypes': ['lua'],
628 \       'description': 'Fix Lua files with stylua.',
629 \   },
630 \   'ormolu': {
631 \       'function': 'ale#fixers#ormolu#Fix',
632 \       'suggested_filetypes': ['haskell'],
633 \       'description': 'A formatter for Haskell source code.',
634 \   },
635 \   'fourmolu': {
636 \       'function': 'ale#fixers#fourmolu#Fix',
637 \       'suggested_filetypes': ['haskell'],
638 \       'description': 'A formatter for Haskell source code.',
639 \   },
640 \   'jsonnetfmt': {
641 \       'function': 'ale#fixers#jsonnetfmt#Fix',
642 \       'suggested_filetypes': ['jsonnet'],
643 \       'description': 'Fix jsonnet files with jsonnetfmt',
644 \   },
645 \   'ptop': {
646 \       'function': 'ale#fixers#ptop#Fix',
647 \       'suggested_filetypes': ['pascal'],
648 \       'description': 'Fix Pascal files with ptop.',
649 \   },
650 \   'opafmt': {
651 \       'function': 'ale#fixers#opafmt#Fix',
652 \       'suggested_filetypes': ['rego'],
653 \       'description': 'Fix rego files with opa fmt.',
654 \   },
655 \   'vfmt': {
656 \       'function': 'ale#fixers#vfmt#Fix',
657 \       'suggested_filetypes': ['v'],
658 \       'description': 'A formatter for V source code.',
659 \   },
660 \   'zigfmt': {
661 \       'function': 'ale#fixers#zigfmt#Fix',
662 \       'suggested_filetypes': ['zig'],
663 \       'description': 'Official formatter for Zig',
664 \   },
665 \   'raco_fmt': {
666 \       'function': 'ale#fixers#raco_fmt#Fix',
667 \       'suggested_filetypes': ['racket'],
668 \       'description': 'Fix Racket files with raco fmt.',
669 \   },
670 \   'ruff': {
671 \       'function': 'ale#fixers#ruff#Fix',
672 \       'suggested_filetypes': ['python'],
673 \       'description': 'Fix python files with ruff.',
674 \   },
675 \   'ruff_format': {
676 \       'function': 'ale#fixers#ruff_format#Fix',
677 \       'suggested_filetypes': ['python'],
678 \       'description': 'Fix python files with the ruff formatter.',
679 \   },
680 \   'pycln': {
681 \       'function': 'ale#fixers#pycln#Fix',
682 \       'suggested_filetypes': ['python'],
683 \       'description': 'remove unused python import statements',
684 \   },
685 \   'rustywind': {
686 \       'function': 'ale#fixers#rustywind#Fix',
687 \       'suggested_filetypes': ['html'],
688 \       'description': 'Sort Tailwind CSS classes',
689 \   },
690 \   'npm-groovy-lint': {
691 \       'function': 'ale#fixers#npmgroovylint#Fix',
692 \       'suggested_filetypes': ['groovy'],
693 \       'description': 'Fix Groovy files with npm-groovy-fix.',
694 \   },
695 \   'erb-formatter': {
696 \       'function': 'ale#fixers#erbformatter#Fix',
697 \       'suggested_filetypes': ['eruby'],
698 \       'description': 'Apply erb-formatter -w to eruby/erb files.',
699 \   },
700 \   'nickel_format': {
701 \       'function': 'ale#fixers#nickel_format#Fix',
702 \       'suggested_filetypes': ['nickel'],
703 \       'description': 'Fix nickel files with nickel format',
704 \   },
705 \   'rubyfmt': {
706 \       'function': 'ale#fixers#rubyfmt#Fix',
707 \       'suggested_filetypes': ['ruby'],
708 \       'description': 'A formatter for Ruby source code',
709 \   },
710 \   'scadformat': {
711 \       'function': 'ale#fixers#scadformat#Fix',
712 \       'suggested_filetypes': ['openscad'],
713 \       'description': 'Formatter for scad files',
714 \   },
715 \   'cljfmt': {
716 \       'function': 'ale#fixers#cljfmt#Fix',
717 \       'suggested_filetypes': ['clojure'],
718 \       'description': 'formatter and linter for clojure files',
719 \   },
720 \   'typstyle': {
721 \       'function': 'ale#fixers#typstyle#Fix',
722 \       'suggested_filetypes': ['typst'],
723 \       'description': 'A formatter for Typst files',
724 \   },
725 \}
726
727 " Reset the function registry to the default entries.
728 function! ale#fix#registry#ResetToDefaults() abort
729     let s:entries = deepcopy(s:default_registry)
730     let s:aliases = {}
731
732     " Set up aliases for fixers too.
733     for [l:key, l:entry] in items(s:entries)
734         for l:alias in get(l:entry, 'aliases', [])
735             let s:aliases[l:alias] = l:key
736         endfor
737     endfor
738 endfunction
739
740 " Set up entries now.
741 call ale#fix#registry#ResetToDefaults()
742
743 " Remove everything from the registry, useful for tests.
744 function! ale#fix#registry#Clear() abort
745     let s:entries = {}
746     let s:aliases = {}
747 endfunction
748
749 " Add a function for fixing problems to the registry.
750 " (name, func, filetypes, desc, aliases)
751 function! ale#fix#registry#Add(name, func, filetypes, desc, ...) abort
752     " This command will throw from the sandbox.
753     let &l:equalprg=&l:equalprg
754
755     if type(a:name) isnot v:t_string
756         throw '''name'' must be a String'
757     endif
758
759     if type(a:func) isnot v:t_string
760         throw '''func'' must be a String'
761     endif
762
763     if type(a:filetypes) isnot v:t_list
764         throw '''filetypes'' must be a List'
765     endif
766
767     for l:type in a:filetypes
768         if type(l:type) isnot v:t_string
769             throw 'Each entry of ''filetypes'' must be a String'
770         endif
771     endfor
772
773     if type(a:desc) isnot v:t_string
774         throw '''desc'' must be a String'
775     endif
776
777     let l:aliases = get(a:000, 0, [])
778
779     if type(l:aliases) isnot v:t_list
780     \|| !empty(filter(copy(l:aliases), 'type(v:val) isnot v:t_string'))
781         throw '''aliases'' must be a List of String values'
782     endif
783
784     let s:entries[a:name] = {
785     \   'function': a:func,
786     \   'suggested_filetypes': a:filetypes,
787     \   'description': a:desc,
788     \}
789
790     " Set up aliases for the fixer.
791     if !empty(l:aliases)
792         let s:entries[a:name].aliases = l:aliases
793
794         for l:alias in l:aliases
795             let s:aliases[l:alias] = a:name
796         endfor
797     endif
798 endfunction
799
800 " Get a function from the registry by its short name.
801 function! ale#fix#registry#GetFunc(name) abort
802     " Use the exact name, or an alias.
803     let l:resolved_name = !has_key(s:entries, a:name)
804     \   ? get(s:aliases, a:name, a:name)
805     \   : a:name
806
807     return get(s:entries, l:resolved_name, {'function': ''}).function
808 endfunction
809
810 function! s:ShouldSuggestForType(suggested_filetypes, type_list) abort
811     for l:type in a:type_list
812         if index(a:suggested_filetypes, l:type) >= 0
813             return 1
814         endif
815     endfor
816
817     return 0
818 endfunction
819
820 function! s:IsGenericFixer(suggested_filetypes) abort
821     if empty(a:suggested_filetypes)
822         return 1
823     endif
824
825     return 0
826 endfunction
827
828 function! s:FormatEntry(key, entry) abort
829     let l:aliases_str = ''
830
831     " Show aliases in :ALEFixSuggest if they are there.
832     if !empty(get(a:entry, 'aliases', []))
833         let l:aliases_str = ', ' . join(
834         \   map(copy(a:entry.aliases), 'string(v:val)'),
835         \   ','
836         \)
837     endif
838
839     return printf(
840     \   '%s%s - %s',
841     \   string(a:key),
842     \   l:aliases_str,
843     \   a:entry.description,
844     \)
845 endfunction
846
847 " Get list of applicable fixers for filetype, including generic fixers
848 function! ale#fix#registry#GetApplicableFixers(filetype) abort
849     let l:type_list = split(a:filetype, '\.')
850     let l:fixer_name_list = []
851
852     for l:key in sort(keys(s:entries))
853         let l:suggested_filetypes = s:entries[l:key].suggested_filetypes
854
855         if s:IsGenericFixer(l:suggested_filetypes) || s:ShouldSuggestForType(l:suggested_filetypes, l:type_list)
856             call add(l:fixer_name_list, l:key)
857         endif
858     endfor
859
860     return l:fixer_name_list
861 endfunction
862
863 " Function that returns autocomplete candidates for ALEFix command
864 function! ale#fix#registry#CompleteFixers(ArgLead, CmdLine, CursorPos) abort
865     return filter(ale#fix#registry#GetApplicableFixers(&filetype), 'v:val =~? a:ArgLead')
866 endfunction
867
868 function! ale#fix#registry#SuggestedFixers(filetype) abort
869     let l:type_list = split(a:filetype, '\.')
870     let l:filetype_fixer_list = []
871
872     for l:key in sort(keys(s:entries))
873         let l:suggested_filetypes = s:entries[l:key].suggested_filetypes
874
875         if s:ShouldSuggestForType(l:suggested_filetypes, l:type_list)
876             call add(
877             \   l:filetype_fixer_list,
878             \   s:FormatEntry(l:key, s:entries[l:key]),
879             \)
880         endif
881     endfor
882
883     let l:generic_fixer_list = []
884
885     for l:key in sort(keys(s:entries))
886         if s:IsGenericFixer(s:entries[l:key].suggested_filetypes)
887             call add(
888             \   l:generic_fixer_list,
889             \   s:FormatEntry(l:key, s:entries[l:key]),
890             \)
891         endif
892     endfor
893
894     return [l:filetype_fixer_list, l:generic_fixer_list]
895 endfunction
896
897 " Suggest functions to use from the registry.
898 function! ale#fix#registry#Suggest(filetype) abort
899     let l:suggested = ale#fix#registry#SuggestedFixers(a:filetype)
900     let l:filetype_fixer_list = l:suggested[0]
901     let l:generic_fixer_list = l:suggested[1]
902
903     let l:filetype_fixer_header = !empty(l:filetype_fixer_list)
904     \   ? ['Try the following fixers appropriate for the filetype:', '']
905     \   : []
906     let l:generic_fixer_header = !empty(l:generic_fixer_list)
907     \   ? ['Try the following generic fixers:', '']
908     \   : []
909
910     let l:has_both_lists = !empty(l:filetype_fixer_list) && !empty(l:generic_fixer_list)
911
912     let l:lines =
913     \   l:filetype_fixer_header
914     \   + l:filetype_fixer_list
915     \   + (l:has_both_lists ? [''] : [])
916     \   + l:generic_fixer_header
917     \   + l:generic_fixer_list
918
919     if empty(l:lines)
920         let l:lines = ['There is nothing in the registry to suggest.']
921     else
922         let l:lines += ['', 'See :help ale-fix-configuration']
923     endif
924
925     let l:lines += ['', 'Press q to close this window']
926
927     new +set\ filetype=ale-fix-suggest
928     call setline(1, l:lines)
929     setlocal nomodified
930     setlocal nomodifiable
931 endfunction