forked from dense-analysis/ale
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ale.txt
2277 lines (1687 loc) · 96.5 KB
/
ale.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
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
*ale.txt* For Vim version 8.0.
*ale*
ALE - Asynchronous Lint Engine
===============================================================================
CONTENTS *ale-contents*
1. Introduction.........................|ale-introduction|
2. Supported Languages & Tools..........|ale-support|
3. Linting..............................|ale-lint|
4. Fixing Problems......................|ale-fix|
5. Language Server Protocol Support.....|ale-lsp|
5.1 Completion........................|ale-completion|
5.2 Go To Definition..................|ale-go-to-definition|
6. Global Options.......................|ale-options|
6.1 Highlights........................|ale-highlights|
6.2 Options for write-good Linter.....|ale-write-good-options|
7. Integration Documentation............|ale-integrations|
asciidoc..............................|ale-asciidoc-options|
write-good..........................|ale-asciidoc-write-good|
asm...................................|ale-asm-options|
gcc.................................|ale-asm-gcc|
awk...................................|ale-awk-options|
gawk................................|ale-awk-gawk|
c.....................................|ale-c-options|
clang...............................|ale-c-clang|
clang-format........................|ale-c-clangformat|
clangtidy...........................|ale-c-clangtidy|
cppcheck............................|ale-c-cppcheck|
gcc.................................|ale-c-gcc|
chef..................................|ale-chef-options|
foodcritic..........................|ale-chef-foodcritic|
clojure...............................|ale-clojure-options|
joker...............................|ale-clojure-joker|
cmake.................................|ale-cmake-options|
cmakelint...........................|ale-cmake-cmakelint|
cpp...................................|ale-cpp-options|
clang...............................|ale-cpp-clang|
clangcheck..........................|ale-cpp-clangcheck|
clang-format........................|ale-cpp-clangformat|
clangtidy...........................|ale-cpp-clangtidy|
cppcheck............................|ale-cpp-cppcheck|
cpplint.............................|ale-cpp-cpplint|
gcc.................................|ale-cpp-gcc|
c#....................................|ale-cs-options|
mcs.................................|ale-cs-mcs|
mcsc................................|ale-cs-mcsc|
css...................................|ale-css-options|
prettier............................|ale-css-prettier|
stylelint...........................|ale-css-stylelint|
cuda..................................|ale-cuda-options|
nvcc................................|ale-cuda-nvcc|
dart..................................|ale-dart-options|
dartanalyzer........................|ale-dart-dartanalyzer|
dockerfile............................|ale-dockerfile-options|
hadolint............................|ale-dockerfile-hadolint|
elixir................................|ale-elixir-options|
mix.................................|ale-elixir-mix|
elm...................................|ale-elm-options|
elm-format..........................|ale-elm-elm-format|
elm-make............................|ale-elm-elm-make|
erlang................................|ale-erlang-options|
erlc................................|ale-erlang-erlc|
syntaxerl...........................|ale-erlang-syntaxerl|
eruby.................................|ale-eruby-options|
fish..................................|ale-fish-options|
fortran...............................|ale-fortran-options|
gcc.................................|ale-fortran-gcc|
fountain..............................|ale-fountain-options|
fusionscript..........................|ale-fuse-options|
fusion-lint.........................|ale-fuse-fusionlint|
git commit............................|ale-gitcommit-options|
gitlint.............................|ale-gitcommit-gitlint|
glsl..................................|ale-glsl-options|
glslang.............................|ale-glsl-glslang|
glslls..............................|ale-glsl-glslls|
go....................................|ale-go-options|
gofmt...............................|ale-go-gofmt|
gometalinter........................|ale-go-gometalinter|
graphql...............................|ale-graphql-options|
eslint..............................|ale-graphql-eslint|
gqlint..............................|ale-graphql-gqlint|
handlebars............................|ale-handlebars-options|
ember-template-lint.................|ale-handlebars-embertemplatelint|
haskell...............................|ale-haskell-options|
brittany............................|ale-haskell-brittany|
ghc.................................|ale-haskell-ghc|
hdevtools...........................|ale-haskell-hdevtools|
hfmt................................|ale-haskell-hfmt|
stack-build.........................|ale-haskell-stack-build|
html..................................|ale-html-options|
htmlhint............................|ale-html-htmlhint|
tidy................................|ale-html-tidy|
write-good..........................|ale-html-write-good|
idris.................................|ale-idris-options|
idris...............................|ale-idris-idris|
java..................................|ale-java-options|
checkstyle..........................|ale-java-checkstyle|
javac...............................|ale-java-javac|
google-java-format..................|ale-java-google-java-format|
javascript............................|ale-javascript-options|
eslint..............................|ale-javascript-eslint|
flow................................|ale-javascript-flow|
importjs............................|ale-javascript-importjs|
jscs................................|ale-javascript-jscs|
jshint..............................|ale-javascript-jshint|
prettier............................|ale-javascript-prettier|
prettier-eslint.....................|ale-javascript-prettier-eslint|
prettier-standard...................|ale-javascript-prettier-standard|
standard............................|ale-javascript-standard|
xo..................................|ale-javascript-xo|
json..................................|ale-json-options|
jsonlint............................|ale-json-jsonlint|
prettier............................|ale-json-prettier|
kotlin................................|ale-kotlin-options|
kotlinc.............................|ale-kotlin-kotlinc|
ktlint..............................|ale-kotlin-ktlint|
latex.................................|ale-latex-options|
write-good..........................|ale-latex-write-good|
less..................................|ale-less-options|
lessc...............................|ale-less-lessc|
prettier............................|ale-less-prettier|
stylelint...........................|ale-less-stylelint|
llvm..................................|ale-llvm-options|
llc.................................|ale-llvm-llc|
lua...................................|ale-lua-options|
luac................................|ale-lua-luac|
luacheck............................|ale-lua-luacheck|
markdown..............................|ale-markdown-options|
write-good..........................|ale-markdown-write-good|
nroff.................................|ale-nroff-options|
write-good..........................|ale-nroff-write-good|
objc..................................|ale-objc-options|
clang...............................|ale-objc-clang|
objcpp................................|ale-objcpp-options|
clang...............................|ale-objcpp-clang|
ocaml.................................|ale-ocaml-options|
merlin..............................|ale-ocaml-merlin|
ols.................................|ale-ocaml-ols|
perl..................................|ale-perl-options|
perl................................|ale-perl-perl|
perlcritic..........................|ale-perl-perlcritic|
php...................................|ale-php-options|
hack................................|ale-php-hack|
hackfmt.............................|ale-php-hackfmt|
langserver..........................|ale-php-langserver|
phan................................|ale-php-phan|
phpcbf..............................|ale-php-phpcbf|
phpcs...............................|ale-php-phpcs|
phpmd...............................|ale-php-phpmd|
phpstan.............................|ale-php-phpstan|
pod...................................|ale-pod-options|
write-good..........................|ale-pod-write-good|
proto.................................|ale-proto-options|
protoc-gen-lint.....................|ale-proto-protoc-gen-lint|
pug...................................|ale-pug-options|
puglint.............................|ale-pug-puglint|
puppet................................|ale-puppet-options|
puppetlint..........................|ale-puppet-puppetlint|
python................................|ale-python-options|
autopep8............................|ale-python-autopep8|
flake8..............................|ale-python-flake8|
isort...............................|ale-python-isort|
mypy................................|ale-python-mypy|
prospector..........................|ale-python-prospector|
pycodestyle.........................|ale-python-pycodestyle|
pylint..............................|ale-python-pylint|
pyls................................|ale-python-pyls|
yapf................................|ale-python-yapf|
r.....................................|ale-r-options|
lintr...............................|ale-r-lintr|
reasonml..............................|ale-reasonml-options|
merlin..............................|ale-reasonml-merlin|
ols.................................|ale-reasonml-ols|
refmt...............................|ale-reasonml-refmt|
restructuredtext......................|ale-restructuredtext-options|
write-good..........................|ale-restructuredtext-write-good|
ruby..................................|ale-ruby-options|
brakeman............................|ale-ruby-brakeman|
rails_best_practices................|ale-ruby-rails_best_practices|
reek................................|ale-ruby-reek|
rubocop.............................|ale-ruby-rubocop|
ruby................................|ale-ruby-ruby|
rust..................................|ale-rust-options|
cargo...............................|ale-rust-cargo|
rls.................................|ale-rust-rls|
rustc...............................|ale-rust-rustc|
rustfmt.............................|ale-rust-rustfmt|
sass..................................|ale-sass-options|
stylelint...........................|ale-sass-stylelint|
scala.................................|ale-scala-options|
scalastyle..........................|ale-scala-scalastyle|
scss..................................|ale-scss-options|
prettier............................|ale-scss-prettier|
stylelint...........................|ale-scss-stylelint|
sh....................................|ale-sh-options|
shell...............................|ale-sh-shell|
shellcheck..........................|ale-sh-shellcheck|
shfmt...............................|ale-sh-shfmt|
sml...................................|ale-sml-options|
smlnj...............................|ale-sml-smlnj|
solidity..............................|ale-solidity-options|
solhint.............................|ale-solidity-solhint|
solium..............................|ale-solidity-solium|
spec..................................|ale-spec-options|
rpmlint.............................|ale-spec-rpmlint|
stylus................................|ale-stylus-options|
stylelint...........................|ale-stylus-stylelint|
tcl...................................|ale-tcl-options|
nagelfar............................|ale-tcl-nagelfar|
terraform.............................|ale-terraform-options|
tflint..............................|ale-terraform-tflint|
tex...................................|ale-tex-options|
chktex..............................|ale-tex-chktex|
lacheck.............................|ale-tex-lacheck|
texinfo...............................|ale-texinfo-options|
write-good..........................|ale-texinfo-write-good|
text..................................|ale-text-options|
write-good..........................|ale-text-write-good|
thrift................................|ale-thrift-options|
thrift..............................|ale-thrift-thrift|
typescript............................|ale-typescript-options|
eslint..............................|ale-typescript-eslint|
prettier............................|ale-typescript-prettier|
tslint..............................|ale-typescript-tslint|
tsserver............................|ale-typescript-tsserver|
verilog/systemverilog.................|ale-verilog-options|
iverilog............................|ale-verilog-iverilog|
verilator...........................|ale-verilog-verilator|
vim...................................|ale-vim-options|
vint................................|ale-vim-vint|
vim help..............................|ale-vim-help-options|
write-good..........................|ale-vim-help-write-good|
xhtml.................................|ale-xhtml-options|
write-good..........................|ale-xhtml-write-good|
xml...................................|ale-xml-options|
xmllint.............................|ale-xml-xmllint|
yaml..................................|ale-yaml-options|
swaglint............................|ale-yaml-swaglint|
yamllint............................|ale-yaml-yamllint|
8. Commands/Keybinds....................|ale-commands|
9. API..................................|ale-api|
10. Special Thanks......................|ale-special-thanks|
11. Contact.............................|ale-contact|
===============================================================================
1. Introduction *ale-introduction*
ALE provides the means to run linters asynchronously in Vim in a variety of
languages and tools. ALE sends the contents of buffers to linter programs
using the |job-control| features available in Vim 8 and NeoVim. For Vim 8,
Vim must be compiled with the |job| and |channel| and |timer| features
as a minimum.
ALE supports the following key features for linting:
1. Running linters when text is changed.
2. Running linters when files are opened.
3. Running linters when files are saved. (When a global flag is set.)
4. Populating the |loclist| with warning and errors.
5. Setting |signs| with warnings and errors for error markers.
6. Using |echo| to show error messages when the cursor moves.
7. Setting syntax highlights for errors.
ALE can fix problems with files with the |ALEFix| command, using the same job
control functionality used for checking for problems. Try using the
|ALEFixSuggest| command for browsing tools that can be used to fix problems
for the current buffer.
===============================================================================
2. Supported Languages & Tools *ale-support*
The following languages and tools are supported.
Notes:
`^` No linters for text or Vim help filetypes are enabled by default.
`!!` These linters check only files on disk. See |ale-lint-file-linters|
* ASM: `gcc`
* Ansible: `ansible-lint`
* API Blueprint: `drafter`
* AsciiDoc: `alex`!!, `proselint`, `redpen`, `write-good`
* Awk: `gawk`
* Bash: `shell` (-n flag), `shellcheck`, `shfmt`
* Bourne Shell: `shell` (-n flag), `shellcheck`, `shfmt`
* C: `cppcheck`, `cpplint`!!, `gcc`, `clang`, `clangtidy`!!, `clang-format`
* C++ (filetype cpp): `clang`, `clangcheck`!!, `clangtidy`!!, `clang-format`, `cppcheck`, `cpplint`!!, `gcc`
* CUDA: `nvcc`!!
* C#: `mcs`, `mcsc`!!
* Chef: `foodcritic`
* Clojure: `joker`
* CMake: `cmakelint`
* CoffeeScript: `coffee`, `coffeelint`
* Crystal: `crystal`!!
* CSS: `csslint`, `prettier`, `stylelint`
* Cython (pyrex filetype): `cython`
* D: `dmd`
* Dafny: `dafny`!!
* Dart: `dartanalyzer`!!, `language_server`
* Dockerfile: `hadolint`
* Elixir: `credo`, `dogma`!!
* Elm: `elm-format, elm-make`
* Erb: `erb`, `erubis`
* Erlang: `erlc`, `SyntaxErl`
* Fish: `fish` (-n flag)
* Fortran: `gcc`
* Fountain: `proselint`
* FusionScript: `fusion-lint`
* Git Commit Messages: `gitlint`
* GLSL: glslang, `glslls`
* Go: `gofmt`, `goimports`, `go vet`, `golint`, `gotype`, `gometalinter`!!, `go build`!!, `gosimple`!!, `staticcheck`!!
* GraphQL: `eslint`, `gqlint`
* Haml: `haml-lint`
* Handlebars: `ember-template-lint`
* Haskell: `brittany`, `ghc`, `stack-ghc`, `stack-build`!!, `ghc-mod`, `stack-ghc-mod`, `hlint`, `hdevtools`, `hfmt`
* HTML: `alex`!!, `HTMLHint`, `proselint`, `tidy`, `write-good`
* Idris: `idris`
* Java: `checkstyle`, `javac`, `google-java-format`
* JavaScript: `eslint`, `flow`, `jscs`, `jshint`, `prettier`, `prettier-eslint`, `prettier-standard`, `standard`, `xo`
* JSON: `jsonlint`, `prettier`
* Kotlin: `kotlinc`, `ktlint`
* LaTeX (tex): `alex`!!, `chktex`, `lacheck`, `proselint`, `redpen`, `vale`, `write-good`
* Less: `lessc`, `prettier`, `stylelint`
* LLVM: `llc`
* Lua: `luac`, `luacheck`
* Mail: `alex`!!, `proselint`, `vale`
* Make: `checkmake`
* Markdown: `alex`!!, `mdl`, `proselint`, `redpen`, `remark-lint`, `vale`, `write-good`
* MATLAB: `mlint`
* Nim: `nim check`!!
* nix: `nix-instantiate`
* nroff: `alex`!!, `proselint`, `write-good`
* Objective-C: `clang`
* Objective-C++: `clang`
* OCaml: `merlin` (see |ale-ocaml-merlin|), `ols`
* Perl: `perl -c`, `perl-critic`
* PHP: `hack`, `hackfmt`, `langserver`, `phan`, `php -l`, `phpcs`, `phpmd`, `phpstan`, `phpcbf`
* Pod: `alex`!!, `proselint`, `write-good`
* proto: `protoc-gen-lint`
* Pug: `pug-lint`
* Puppet: `puppet`, `puppet-lint`
* Python: `autopep8`, `flake8`, `isort`, `mypy`, `prospector`, `pycodestyle`, `pyls`, `pylint`!!, `yapf`
* R: `lintr`
* ReasonML: `merlin`, `ols`, `refmt`
* reStructuredText: `alex`!!, `proselint`, `redpen`, `rstcheck`, `vale`, `write-good`
* Re:VIEW: `redpen`
* RPM spec: `rpmlint`
* Ruby: `brakeman`, `rails_best_practices`!!, `reek`, `rubocop`, `ruby`
* Rust: `cargo`!!, `rls`, `rustc` (see |ale-integration-rust|), `rustfmt`
* SASS: `sass-lint`, `stylelint`
* SCSS: `prettier`, `sass-lint`, `scss-lint`, `stylelint`
* Scala: `scalac`, `scalastyle`
* Slim: `slim-lint`
* SML: `smlnj`
* Solidity: `solhint, solium`
* Stylus: `stylelint`
* SQL: `sqlint`
* Swift: `swiftlint`, `swiftformat`
* Tcl: `nagelfar`!!
* Terraform: `tflint`
* Texinfo: `alex`!!, `proselint`, `write-good`
* Text^: `alex`!!, `proselint`, `vale`, `write-good`, `redpen`
* Thrift: `thrift`
* TypeScript: `eslint`, `prettier`, `tslint`, `tsserver`, `typecheck`
* Verilog: `iverilog`, `verilator`
* Vim: `vint`
* Vim help^: `alex`!!, `proselint`, `write-good`
* XHTML: `alex`!!, `proselint`, `write-good`
* XML: `xmllint`
* YAML: `swaglint`, `yamllint`
===============================================================================
3. Linting *ale-lint*
ALE's primary focus is on checking for problems with your code with various
programs via some Vim code for integrating with those programs, referred to
as 'linters.' ALE supports a wide array of programs for linting by default,
but additional programs can be added easily by defining files in |runtimepath|
with the filename pattern `ale_linters/<filetype>/<filename>.vim`. For more
information on defining new linters, see the extensive documentation
for |ale#linter#Define()|.
Without any configuration, ALE will attempt to check all of the code for every
file you open in Vim with all available tools by default. To see what ALE
is doing, and what options have been set, try using the |:ALEInfo| command.
Most of the linters ALE runs will check the Vim buffer you are editing instead
of the file on disk. This allows you to check your code for errors before you
have even saved your changes. ALE will check your code in the following
circumstances, which can be configured with the associated options.
* When you modify a buffer. - |g:ale_lint_on_text_changed|
* When you open a new or modified buffer. - |g:ale_lint_on_enter|
* When you save a buffer. - |g:ale_lint_on_save|
* When the filetype changes for a buffer. - |g:ale_lint_on_filetype_changed|
* If ALE is used to check code manually. - |:ALELint|
In addition to the above options, ALE can also check buffers for errors when
you leave insert mode with |g:ale_lint_on_insert_leave|, which is off by
default. It is worth reading the documentation for every option.
*ale-lint-file-linters*
Some programs must be run against files which have been saved to disk, and
simply do not support reading temporary files or stdin, either of which are
required for ALE to be able to check for errors as you type. The programs
which behave this way are documented in the lists and tables of supported
programs. ALE will only lint files with these programs in the following
circumstances.
* When you open a new or modified buffer. - |g:ale_lint_on_enter|
* When you save a buffer. - |g:ale_lint_on_save|
* When the filetype changes for a buffer. - |g:ale_lint_on_filetype_changed|
* If ALE is used to check code manually. - |:ALELint|
ALE will report problems with your code in the following ways, listed with
their relevant options.
* By updating loclist. (On by default) - |g:ale_set_loclist|
* By updating quickfix. (Off by default) - |g:ale_set_quickfix|
* By setting error highlights. - |g:ale_set_highlights|
* By creating signs in the sign column. - |g:ale_set_signs|
* By echoing messages based on your cursor. - |g:ale_echo_cursor|
* By showing balloons for your mouse cursor - |g:ale_set_balloons|
Please consult the documentation for each option, which can reveal some other
ways of tweaking the behaviour of each way of displaying problems. You can
disable or enable whichever options you prefer.
Most settings can be configured for each buffer. (|b:| instead of |g:|),
including disabling ALE for certain buffers with |b:ale_enabled|. The
|g:ale_pattern_options| setting can be used to configure files differently
based on regular expressions for filenames. For configuring entire projects,
the buffer-local options can be used with external plugins for reading Vim
project configuration files. Buffer-local settings can also be used in
ftplugin files for different filetypes.
===============================================================================
4. Fixing Problems *ale-fix*
ALE can fix problems with files with the |ALEFix| command. When |ALEFix| is
run, the variable |g:ale_fixers| will be read for getting a |List| of commands
for filetypes, split on `.`, and the functions named in |g:ale_fixers| will be
executed for fixing the errors.
The |ALEFixSuggest| command can be used to suggest tools that be used to
fix problems for the current buffer.
The values for `g:ale_fixers` can be a list of |String|, |Funcref|, or
|lambda| values. String values must either name a function, or a short name
for a function set in the ALE fixer registry.
Each function for fixing errors must accept either one argument `(buffer)` or
two arguments `(buffer, lines)`, representing the buffer being fixed and the
lines to fix. The functions must return either `0`, for changing nothing, a
|List| for new lines to set, or a |Dictionary| for describing a command to be
run in the background.
Functions receiving a variable number of arguments will not receive the second
argument `lines`. Functions should name two arguments if the `lines` argument
is desired. This is required to avoid unnecessary copying of the lines of
the buffers being checked.
When a |Dictionary| is returned for an |ALEFix| callback, the following keys
are supported for running the commands.
`command` A |String| for the command to run. This key is required.
When `%t` is included in a command string, a temporary
file will be created, containing the lines from the file
after previous adjustment have been done.
`read_temporary_file` When set to `1`, ALE will read the contents of the
temporary file created for `%t`. This option can be used
for commands which need to modify some file on disk in
order to fix files.
`process_with` An optional callback for post-processing.
The callback must accept two arguments,
`(buffer, output)`, which can be used for converting
the output from a command into lines to replace the
buffer's contents with.
A |List| of |String|s must be returned.
`chain_with` An optional key for defining a callback to call next.
The callback must accept two or three arguments,
`(buffer, output)` or `(buffer, output, input)` .
Functions receiving a variable number of arguments will
only receive the first two values. The `output` argument
will contain the lines of output from the command run.
The `input` argument is the List of lines for the
buffer, after applying any previous fixers.
The callback must return the same values returned for
any fixer function. This allows fixer functions to be
chained recursively.
When the command string returned for a fixer is an empty
string, the next command in the chain will still be run.
This allows commands to be skipped, like version checks
that are cached. An empty List will be passed to the
next callback in the chain for the `output`.
`read_buffer` An optional key for disabling reading the buffer.
When set to `0`, ALE will not pipe the buffer's data
into the command via stdin. This option is ignored and
the buffer is not read when `read_temporary_file` is
`1`.
This option defaults to `0` when `chain_with` is defined
as anything other than `v:null`, and defaults to `1`
otherwise. This is so earlier commands in a chain
do not receive the buffer's data by default.
*ale-fix-configuration*
Synchronous functions and asynchronous jobs will be run in a sequence for
fixing files, and can be combined. For example:
>
let g:ale_fixers = {
\ 'javascript': [
\ 'DoSomething',
\ 'eslint',
\ {buffer, lines -> filter(lines, 'v:val !=~ ''^\s*//''')},
\ ],
\}
ALEFix
<
The above example will call a function called `DoSomething` which could act
upon some lines immediately, then run `eslint` from the ALE registry, and
then call a lambda function which will remove every single line comment
from the file.
For buffer-local settings, such as in |g:ale_pattern_options| or in ftplugin
files, a |List| may be used for configuring the fixers instead.
>
" Same as the above, only a List can be used instead of a Dictionary.
let b:ale_fixers = [
\ 'DoSomething',
\ 'eslint',
\ {buffer, lines -> filter(lines, 'v:val !=~ ''^\s*//''')},
\]
ALEFix
<
For convenience, a plug mapping is defined for |ALEFix|, so you can set up a
keybind easily for fixing files. >
" Bind F8 to fixing problems with ALE
nmap <F8> <Plug>(ale_fix)
<
Files can be fixed automatically with the following options, which are all off
by default.
|g:ale_fix_on_save| - Fix files when they are saved.
===============================================================================
5. Language Server Protocol Support *ale-lsp*
ALE offers some support for integrating with Language Server Protocol (LSP)
servers. LSP linters can be used in combination with any other linter, and
will automatically connect to LSP servers when needed. ALE also supports
`tsserver` for TypeScript, which uses a different but very similar protocol.
ALE supports the following LSP/tsserver features.
1. Diagnostics/linting - Enabled via selecting linters as usual.
2. Completion (Only for tsserver)
3. Go to definition
-------------------------------------------------------------------------------
5.1 Completion *ale-completion*
NOTE: At the moment, only `tsserver` for TypeScript code is supported for
completion.
ALE offers limited support for automatic completion of code while you type.
Completion is only supported while a least one LSP linter is enabled. ALE
will only suggest symbols provided by the LSP servers.
Suggestions will be made while you type after completion is enabled.
Completion can be enabled by setting |g:ale_completion_enabled| to `1`. The
delay for completion can be configured with |g:ale_completion_delay|. ALE will
only suggest so many possible matches for completion. The maximum number of
items can be controlled with |g:ale_completion_max_suggestions|.
-------------------------------------------------------------------------------
5.2 Go To Definition *ale-go-to-definition*
ALE supports jumping to the files and locations where symbols are defined
through any enabled LSP linters. The locations ALE will jump to depend on the
information returned by LSP servers. The following commands are supported:
|ALEGoToDefinition| - Open the definition of the symbol under the cursor.
|ALEGoToDefinitionInTab| - The same, but for opening the file in a new tab.
===============================================================================
6. Global Options *ale-options*
g:airline#extensions#ale#enabled *g:airline#extensions#ale#enabled*
Type: |Number|
Default: `1`
Enables or disables the |airline|'s native extension for ale, which displays
warnings and errors in the status line, prefixed by
|airline#extensions#ale#error_symbol| and
|airline#extensions#ale#warning_symbol|.
g:ale_cache_executable_check_failures *g:ale_cache_executable_check_failures*
Type: |Number|
Default: `0`
When set to `1`, ALE will cache failing executable checks for linters. By
default, only executable checks which succeed will be cached.
When this option is set to `1`, Vim will have to be restarted after new
executables are installed for ALE to be able to run linters for those
executables.
g:ale_change_sign_column_color *g:ale_change_sign_column_color*
Type: |Number|
Default: `0`
When set to `1`, this option will set different highlights for the sign
column itself when ALE reports problems with a file. This option can be
combined with |g:ale_sign_column_always|.
ALE uses the following highlight groups for highlighting the sign column:
`ALESignColumnWithErrors` - Links to `error` by default.
`ALESignColumnWithoutErrors` - Uses the value for `SignColumn` by default.
The sign column color can only be changed globally in Vim. The sign column
might produce unexpected results if editing different files in split
windows.
g:ale_command_wrapper *g:ale_command_wrapper*
*b:ale_command_wrapper*
Type: |String|
Default: `''`
An option for wrapping all commands that ALE runs, for linters, fixers,
and LSP commands. This option can be set globally, or for specific buffers.
This option can be used to apply nice to all commands. For example: >
" Prefix all commands with nice.
let g:ale_command_wrapper = 'nice -n5'
<
Use the |ALEInfo| command to view the commands that are run. All of the
arguments for commands will be put on the end of the wrapped command by
default. A `%*` marker can be used to spread the arguments in the wrapped
command. >
" Has the same effect as the above.
let g:ale_command_wrapper = 'nice -n5 %*'
<
For passing all of the arguments for a command as one argument to a wrapper,
`%@` can be used instead. >
" Will result in say: /bin/bash -c 'other-wrapper -c "some command" -x'
let g:ale_command_wrapper = 'other-wrapper -c %@ -x'
<
For commands including `&&` or `;`, only the last command in the list will
be passed to the wrapper. `&&` is most commonly used in ALE to change the
working directory before running a command.
g:ale_completion_delay *g:ale_completion_delay*
Type: |Number|
Default: `100`
The number of milliseconds before ALE will send a request to a language
server for completions after you have finished typing.
See |ale-completion|
g:ale_completion_enabled *g:ale_completion_enabled*
Type: |Number|
Default: `0`
When this option is set to `1`, completion support will be enabled.
See |ale-completion|
g:ale_completion_max_suggestions *g:ale_completion_max_suggestions*
Type: |Number|
Default: `50`
The maximum number of items ALE will suggest in completion menus for
automatic completion.
Setting this number higher will require more processing time, and may
suggest too much noise. Setting this number lower will require less
processing time, but some suggestions will not be included, so you might not
be able to see the suggestions you want.
Adjust this option as needed, depending on the complexity of your codebase
and your available processing power.
g:ale_echo_cursor *g:ale_echo_cursor*
Type: |Number|
Default: `1`
When this option is set to `1`, a truncated message will be echoed when a
cursor is near a warning or error. ALE will attempt to find the warning or
error at a column nearest to the cursor when the cursor is resting on a line
which contains a warning or error. This option can be set to `0` to disable
this behaviour.
The format of the message can be customizable in |g:ale_echo_msg_format|.
g:ale_echo_delay *g:ale_echo_delay*
*b:ale_echo_delay*
Type: |Number|
Default: `10`
Given any integer, this option controls the number of milliseconds before
ALE will echo a message for a problem near the cursor.
The value can be increased to decrease the amount of processing ALE will do
for files displaying a large number of problems.
g:ale_echo_msg_error_str *g:ale_echo_msg_error_str*
Type: |String|
Default: `'Error'`
The string used for `%severity%` for errors. See |g:ale_echo_msg_format|
g:ale_echo_msg_format *g:ale_echo_msg_format*
b:ale_echo_msg_format *b:ale_echo_msg_format*
Type: |String|
Default: `'%code: %%s'`
This variable defines a message format for echoed messages. The following
sequences of characters will be replaced.
`%s` - replaced with the text for the problem
`%...code...% `- replaced with the error code
`%linter%` - replaced with the name of the linter
`%severity%` - replaced withe severity of the problem
The strings for `%severity%` can be configured with the following options.
|g:ale_echo_msg_error_str| - Defaults to `'Error'`
|g:ale_echo_msg_info_str| - Defaults to `'Info'`
|g:ale_echo_msg_warning_str| - Defaults to `'Warning'`
`%code%` is replaced with the error code, and replaced with an empty string
when there is no error code. Any extra characters between the percent signs
will be printed when an error code is present. For example, a message like
`(error code): message` will be printed for `'%(code): %%s'` and simply the
message will be printed when there is no code.
|g:ale_echo_cursor| needs to be set to 1 for messages to be displayed.
The echo message format can also be configured separately for each buffer,
so different formats can be used for differnt languages. (Say in ftplugin
files.)
g:ale_echo_msg_info_str *g:ale_echo_msg_info_str*
Type: |String|
Default: `'Info'`
The string used for `%severity%` for info. See |g:ale_echo_msg_format|
g:ale_echo_msg_warning_str *g:ale_echo_msg_warning_str*
Type: |String|
Default: `'Warning'`
The string used for `%severity%` for warnings. See |g:ale_echo_msg_format|
g:ale_emit_conflict_warnings *g:ale_emit_conflict_warnings*
Type: |Number|
Default: `1`
When set to `0`, ALE will not emit any warnings on startup about conflicting
plugins. ALE will probably not work if other linting plugins are installed.
When this option is set to `1`, ALE will add its `after` directory to
|runtimepath| automatically, so the checks can be applied. Setting this
option to `0` before ALE is loaded will prevent ALE from modifying
|runtimepath|.
g:ale_enabled *g:ale_enabled*
*b:ale_enabled*
Type: |Number|
Default: `1`
When set to `0`, this option will completely disable ALE, such that no
error checking will be performed, etc. ALE can be toggled on and off with
the |ALEToggle| command, which changes this option.
ALE can be disabled in each buffer by setting `let b:ale_enabled = 0`
Disabling ALE based on filename patterns can be accomplished by setting
a regular expression for |g:ale_pattern_options|. For example: >
" Disable linting for all minified JS files.
let g:ale_pattern_options = {'\.min.js$': {'ale_enabled': 0}}
<
See |g:ale_pattern_options| for more information on that option.
g:ale_fixers *g:ale_fixers*
*b:ale_fixers*
Type: |Dictionary|
Default: `{}`
A mapping from filetypes to |List| values for functions for fixing errors.
See |ale-fix| for more information.
This variable can be overridden with variables in each buffer.
`b:ale_fixers` can be set to a |List| of callbacks instead, which can be
more convenient.
g:ale_fix_on_save *g:ale_fix_on_save*
b:ale_fix_on_save *b:ale_fix_on_save*
Type: |Number|
Default: `0`
When set to 1, ALE will fix files when they are saved.
If |g:ale_lint_on_save| is set to 1, files will be checked with linters
after files are fixed, only when the buffer is open, or re-opened. Changes
to the file will be saved to the file on disk.
Fixing files can be disabled or enabled for individual buffers by setting
`b:ale_fix_on_save` to `0` or `1`.
g:ale_history_enabled *g:ale_history_enabled*
Type: |Number|
Default: `1`
When set to `1`, ALE will remember the last few commands which were run
for every buffer which is open. This information can be viewed with the
|ALEInfo| command. The size of the buffer can be controlled with the
|g:ale_max_buffer_history_size| option.
This option can be disabled if storing a command history is not desired.
g:ale_history_log_output *g:ale_history_log_output*
Type: |Number|
Default: `1`
When set to `1`, ALE will store the output of commands which have completed
successfully in the command history, and the output will be displayed when
using |ALEInfo|.
|g:ale_history_enabled| must be set to `1` for this output to be stored or
printed.
Some memory will be consumed by this option. It is very useful for figuring
out what went wrong with linters, and for bug reports. Turn this option off
if you want to save on some memory usage.
g:ale_keep_list_window_open *g:ale_keep_list_window_open*
*b:ale_keep_list_window_open*
Type: |Number|
Default: `0`
When set to `1`, this option will keep the loclist or quickfix windows
event after all warnings/errors have been removed for files. By default
the loclist or quicfix windows will be closed automatically when there
are no warnings or errors.
See |g:ale_open_list|
g:ale_list_window_size *g:ale_list_window_size*
*b:ale_list_window_size*
Type: |Number|
Default: `10`
This number configures the number of lines to set for the height of windows
opened automatically for ALE problems. The default of `10` matches the Vim
default height.
See |g:ale_open_list| for information on automatically opening windows
for quickfix or the loclist.
g:ale_lint_delay *g:ale_lint_delay*
Type: |Number|
Default: `200`
This variable controls the milliseconds delay after which the linters will
be run after text is changed. This option is only meaningful with the
|g:ale_lint_on_text_changed| variable set to `always`, `insert`, or `normal`.
g:ale_lint_on_enter *g:ale_lint_on_enter*
Type: |Number|
Default: `1`
When this option is set to `1`, the |BufWinEnter| and |BufRead| events will
be used to apply linters when buffers are first opened. If this is not
desired, this variable can be set to `0` in your vimrc file to disable this
behaviour.
The |FileChangedShellPost| and |BufEnter| events will be used to check if
files have been changed outside of Vim. If a file is changed outside of
Vim, it will be checked when it is next opened.
A |BufWinLeave| event will be used to look for the |E924|, |E925|, or |E926|
errors after moving from a loclist or quickfix window to a new buffer. If
prompts for these errors are opened after moving to new buffers, then ALE
will automatically send the `<CR>` key needed to close the prompt.
g:ale_lint_on_filetype_changed *g:ale_lint_on_filetype_changed*
Type: |Number|
Default: `1`
This option will cause ALE to run whenever the filetype is changed. A short
delay will be used before linting will be done, so the filetype can be
changed quickly several times in a row, but resulting in only one lint
cycle.
If |g:ale_lint_on_enter| is set to `0`, then ALE will not lint a file when
the filetype is initially set. Otherwise ALE would still lint files when
buffers are opened, and the option for doing so is turned off.
g:ale_lint_on_save *g:ale_lint_on_save*
Type: |Number|
Default: `1`
This option will make ALE run the linters whenever a file is saved when it
it set to `1` in your vimrc file. This option can be used in combination
with the |g:ale_lint_on_enter| and |g:ale_lint_on_text_changed| options to
make ALE only check files after that have been saved, if that is what is
desired.
g:ale_lint_on_text_changed *g:ale_lint_on_text_changed*
Type: |String|
Default: `always`
By default, ALE will check files with the various supported programs when
text is changed by using the |TextChanged| event. If this behaviour is not
desired, then this option can be disabled by setting it to `never`. The
|g:ale_lint_delay| variable will be used to set a |timer_start()| on a
delay, and each change to a file will continue to call |timer_stop()| and
|timer_start()| repeatedly until the timer ticks by, and the linters will be
run. The checking of files will run in the background, so it should not
inhibit editing files. This option can also be set to `insert` or `normal`
to lint when text is changed only in insert or normal mode respectively.