mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-07 05:04:28 +08:00
Compare commits
315 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ae3b13d132 | ||
|
|
a8951cc802 | ||
|
|
fd49c2d207 | ||
|
|
f66027c49e | ||
|
|
10e1545630 | ||
|
|
970b62756e | ||
|
|
db64571b4c | ||
|
|
c8b77fd4b8 | ||
|
|
bd92616e2a | ||
|
|
f95bc00bd6 | ||
|
|
106d439f56 | ||
|
|
3014d85325 | ||
|
|
f84411f3f1 | ||
|
|
191967cfee | ||
|
|
c0a279f967 | ||
|
|
f2837b5802 | ||
|
|
cae194d1bd | ||
|
|
18509195f5 | ||
|
|
ce89d93e1c | ||
|
|
e49e7d52bc | ||
|
|
8a659b7cc6 | ||
|
|
d9717147bf | ||
|
|
3c55cb087d | ||
|
|
ef1ec5341f | ||
|
|
cd0dc0a227 | ||
|
|
eaf35bc611 | ||
|
|
ae8dd39760 | ||
|
|
feab494286 | ||
|
|
29a9c9a255 | ||
|
|
6fce8ddc5a | ||
|
|
b67c9a83b2 | ||
|
|
7fd0fd514b | ||
|
|
51a063be31 | ||
|
|
8d49da1f1c | ||
|
|
d0f579c5fc | ||
|
|
d8d13ef264 | ||
|
|
1258b032e6 | ||
|
|
e5ad9076b3 | ||
|
|
3a3c244723 | ||
|
|
c1da7866d0 | ||
|
|
b071f1a795 | ||
|
|
8a1099bb59 | ||
|
|
c23acb00e2 | ||
|
|
4a76cb0dd5 | ||
|
|
115952fae3 | ||
|
|
0c472c2244 | ||
|
|
c3f61c391b | ||
|
|
089a07c6a6 | ||
|
|
2f40da76e6 | ||
|
|
d40f447931 | ||
|
|
168569b8b0 | ||
|
|
57f0454a55 | ||
|
|
199fcd48ac | ||
|
|
38c66d33fe | ||
|
|
5fe74c7dc8 | ||
|
|
f7ecf3f47a | ||
|
|
7541a40859 | ||
|
|
9023987fe0 | ||
|
|
230656e678 | ||
|
|
ffa6fd4bed | ||
|
|
eb3ab87569 | ||
|
|
8cee39c614 | ||
|
|
3bc07b482b | ||
|
|
df8c45ed55 | ||
|
|
27144eee8c | ||
|
|
726a768464 | ||
|
|
7c0219efcc | ||
|
|
6495fac820 | ||
|
|
e2c33f2f6c | ||
|
|
14dc05f36b | ||
|
|
12d79894a4 | ||
|
|
e59cd6b7c0 | ||
|
|
f11637b62b | ||
|
|
ae85695543 | ||
|
|
3331f6c8f4 | ||
|
|
b81bc8d481 | ||
|
|
11780e1d3d | ||
|
|
129eb96561 | ||
|
|
9da015f74f | ||
|
|
b7996803c9 | ||
|
|
6ab3fdc4d0 | ||
|
|
d1d705cc84 | ||
|
|
4a63a90d0d | ||
|
|
04b54f5c17 | ||
|
|
603e61ad71 | ||
|
|
d8d09c2048 | ||
|
|
e6fe2d86b8 | ||
|
|
41c0b837ae | ||
|
|
ebbf7d0353 | ||
|
|
93a046a78f | ||
|
|
7d6a303592 | ||
|
|
ef130c4428 | ||
|
|
0b3ee11546 | ||
|
|
286abd12d3 | ||
|
|
5a365e7926 | ||
|
|
87ad4dfbe7 | ||
|
|
d8a673515a | ||
|
|
498be478be | ||
|
|
20241c87ef | ||
|
|
1e6651e0a0 | ||
|
|
63bbb38c0c | ||
|
|
6f6d35c0bd | ||
|
|
f16384f323 | ||
|
|
a591b191db | ||
|
|
f9ba3d924f | ||
|
|
fb720251bf | ||
|
|
60917c9005 | ||
|
|
f5f3424fcf | ||
|
|
56c7957a75 | ||
|
|
a0aa9aa9b7 | ||
|
|
0cd8e8630b | ||
|
|
3401a4e8ea | ||
|
|
6c93cded64 | ||
|
|
f064ba48f5 | ||
|
|
3f0e1cd05d | ||
|
|
9d00695249 | ||
|
|
da9a005c60 | ||
|
|
697fd4ac75 | ||
|
|
719b790574 | ||
|
|
3a47413286 | ||
|
|
49c4bfde14 | ||
|
|
4903b966a7 | ||
|
|
2f2dcb8444 | ||
|
|
7cf3ddf6c4 | ||
|
|
1123669839 | ||
|
|
f9ae58849a | ||
|
|
91d7e81ebc | ||
|
|
121e806423 | ||
|
|
bb775e4e22 | ||
|
|
c5d3af04fc | ||
|
|
85a2a00826 | ||
|
|
912f632bf5 | ||
|
|
a2acdecbc2 | ||
|
|
8baab691e9 | ||
|
|
f1d56a343e | ||
|
|
95ec9bb780 | ||
|
|
018831d601 | ||
|
|
dfb3e194d7 | ||
|
|
27c5faeafe | ||
|
|
8e9ae59e5e | ||
|
|
8b34a4bf6b | ||
|
|
45c5fe7f43 | ||
|
|
8d4852a127 | ||
|
|
84952918cc | ||
|
|
164c711b3d | ||
|
|
107516c757 | ||
|
|
d14558da32 | ||
|
|
562862073f | ||
|
|
1d33d2cacf | ||
|
|
dbf530e87f | ||
|
|
ec5750f57b | ||
|
|
c525f49f09 | ||
|
|
722607b866 | ||
|
|
7a87520ba5 | ||
|
|
87217ae347 | ||
|
|
cf62ef7b07 | ||
|
|
69237a7e57 | ||
|
|
0678eb1f45 | ||
|
|
b769b67b2f | ||
|
|
ca2472a460 | ||
|
|
f0325d7322 | ||
|
|
c0279de661 | ||
|
|
763fcb8512 | ||
|
|
7593e20377 | ||
|
|
18d0aeb1a0 | ||
|
|
64c95d4881 | ||
|
|
57a93cbc04 | ||
|
|
6452c5e2f0 | ||
|
|
38953c4626 | ||
|
|
3fb7efa2c6 | ||
|
|
c47b5fd4b8 | ||
|
|
0cb3e36554 | ||
|
|
43e8f47e6e | ||
|
|
68b9399d4c | ||
|
|
434f22e44a | ||
|
|
440502dc93 | ||
|
|
92612a9eab | ||
|
|
1b1e53ef61 | ||
|
|
c112ee9dff | ||
|
|
bdd8d2399f | ||
|
|
b08fdd16b8 | ||
|
|
302f69e933 | ||
|
|
92e6e4d1ba | ||
|
|
7e1a9a9810 | ||
|
|
05d39bc1a9 | ||
|
|
b586eba4a4 | ||
|
|
6320ce6674 | ||
|
|
9258c73680 | ||
|
|
1995afa855 | ||
|
|
0a0535546f | ||
|
|
b7363bef7d | ||
|
|
32091fb8ad | ||
|
|
c572cfd2d2 | ||
|
|
2a575ca551 | ||
|
|
193a4b9336 | ||
|
|
f476c28b29 | ||
|
|
08cfd5f90c | ||
|
|
565ffa0dc5 | ||
|
|
857723e7d5 | ||
|
|
8a77290553 | ||
|
|
b6bf6ecdbc | ||
|
|
540952ca8e | ||
|
|
ad7ffe2875 | ||
|
|
2c2c7ceb1d | ||
|
|
acbe527e15 | ||
|
|
2096562899 | ||
|
|
fbbb8c17d9 | ||
|
|
1d0690f6d7 | ||
|
|
aea5de282e | ||
|
|
f64db199f1 | ||
|
|
7e20d9c639 | ||
|
|
7ec684206c | ||
|
|
b15706d9a9 | ||
|
|
d86371cd29 | ||
|
|
cfa3e6a924 | ||
|
|
82f8a04e18 | ||
|
|
478a2883a6 | ||
|
|
0ddf16194d | ||
|
|
0292e5a458 | ||
|
|
b6ccd60dd0 | ||
|
|
b5209d31e8 | ||
|
|
4941bd8d0e | ||
|
|
8b304f77b7 | ||
|
|
ab5257c344 | ||
|
|
89f8d3e456 | ||
|
|
5915a0ee39 | ||
|
|
608b6dafd4 | ||
|
|
5972b97223 | ||
|
|
fcb7932d7d | ||
|
|
f979da54d4 | ||
|
|
716b46e10d | ||
|
|
a3329ef3fc | ||
|
|
c2ab885384 | ||
|
|
5dc884b24d | ||
|
|
91b7a75afb | ||
|
|
dda132c1a2 | ||
|
|
33b3331b04 | ||
|
|
0f822b063c | ||
|
|
31e0f48d62 | ||
|
|
7c4decf804 | ||
|
|
b13f290390 | ||
|
|
23db293bdf | ||
|
|
52fe924a13 | ||
|
|
bb095df25e | ||
|
|
4df87eaadd | ||
|
|
c589e3d57d | ||
|
|
863fb60695 | ||
|
|
1832240cff | ||
|
|
65fc5d11c7 | ||
|
|
7ef55a8615 | ||
|
|
ea60fcea39 | ||
|
|
9dad25778f | ||
|
|
bc63325881 | ||
|
|
34e6368610 | ||
|
|
dffc162dd6 | ||
|
|
ef898fa303 | ||
|
|
be47e37bbc | ||
|
|
9849c79ff7 | ||
|
|
b28a6ddbe4 | ||
|
|
d562d53102 | ||
|
|
dd413a4732 | ||
|
|
038789f0ed | ||
|
|
acf9c92ab4 | ||
|
|
7cd25181b2 | ||
|
|
1d3b542031 | ||
|
|
8675bfc4ab | ||
|
|
7b50b3ec82 | ||
|
|
a5ec4143d2 | ||
|
|
042dec059a | ||
|
|
eddda2f8b5 | ||
|
|
045c92ed65 | ||
|
|
aa29c91cdc | ||
|
|
13c839cf16 | ||
|
|
f6af75aac4 | ||
|
|
e18aba1d7e | ||
|
|
5005871644 | ||
|
|
65fa901ef0 | ||
|
|
ba1540a545 | ||
|
|
2ef45ab745 | ||
|
|
adba2bd919 | ||
|
|
29acafdaf4 | ||
|
|
547716eabb | ||
|
|
112fcf7dd5 | ||
|
|
68d4a2216c | ||
|
|
ff388bbcd5 | ||
|
|
b5a5cdf920 | ||
|
|
eecbacb742 | ||
|
|
f1747901cc | ||
|
|
b6d1c41925 | ||
|
|
c9d66b861b | ||
|
|
7a1a534305 | ||
|
|
401b964e9c | ||
|
|
ff8d4c5286 | ||
|
|
5285b0b332 | ||
|
|
e98a3899da | ||
|
|
80342b119a | ||
|
|
d9a3722e06 | ||
|
|
1e34210f9a | ||
|
|
681c35169f | ||
|
|
d8f71c46da | ||
|
|
b0eaddadc9 | ||
|
|
3b0c67e42c | ||
|
|
c90b45c559 | ||
|
|
e2d3dca486 | ||
|
|
c165c7c5d1 | ||
|
|
48cae6afc4 | ||
|
|
0548cf9177 | ||
|
|
4d4d2d8122 | ||
|
|
2c9c5dec1e | ||
|
|
e43e7065da | ||
|
|
2495744fc3 | ||
|
|
87ffc9b55c | ||
|
|
d4b43d23f4 | ||
|
|
537d162ee7 | ||
|
|
4b56b91ac8 |
7
.gitignore
vendored
7
.gitignore
vendored
@@ -1,6 +1,7 @@
|
|||||||
/init.vim
|
|
||||||
/doc/tags
|
|
||||||
.*
|
|
||||||
!.editorconfig
|
!.editorconfig
|
||||||
*.obj
|
*.obj
|
||||||
|
.*
|
||||||
|
/doc/tags
|
||||||
|
/init.vim
|
||||||
|
/test/ale-info-test-file
|
||||||
tags
|
tags
|
||||||
|
|||||||
2
LICENSE
2
LICENSE
@@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2016-2017, w0rp <devw0rp@gmail.com>
|
Copyright (c) 2016-2018, w0rp <devw0rp@gmail.com>
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
|||||||
@@ -12,7 +12,8 @@ READ THIS: Before creating a pull request, please consider the following first.
|
|||||||
that ALE can work with, please add Vader tests for them. Look at existing
|
that ALE can work with, please add Vader tests for them. Look at existing
|
||||||
tests in the test/handler directory, etc.
|
tests in the test/handler directory, etc.
|
||||||
* If you add or modify a function for computing a command line string for
|
* If you add or modify a function for computing a command line string for
|
||||||
running a command, please add Vader tests for that.
|
running a command, please add Vader tests for that. Look at existing
|
||||||
|
tests in the test/command_callback directory, etc.
|
||||||
* Generally try and cover anything with Vader tests, although some things just
|
* Generally try and cover anything with Vader tests, although some things just
|
||||||
can't be tested with Vader, or at least they can be hard to test. Consider
|
can't be tested with Vader, or at least they can be hard to test. Consider
|
||||||
breaking up your code so that some parts can be tested, and generally open up
|
breaking up your code so that some parts can be tested, and generally open up
|
||||||
|
|||||||
212
README.md
212
README.md
@@ -1,10 +1,10 @@
|
|||||||
# Asynchronous Lint Engine [](https://travis-ci.org/w0rp/ale) [](https://ci.appveyor.com/project/w0rp/ale)
|
# Asynchronous Lint Engine [](https://travis-ci.org/w0rp/ale) [](https://ci.appveyor.com/project/w0rp/ale)
|
||||||
|
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
ALE (Asynchronous Lint Engine) is a plugin for providing linting in NeoVim
|
ALE (Asynchronous Lint Engine) is a plugin for providing linting in NeoVim
|
||||||
and Vim 8 while you edit your text files.
|
0.2.0+ and Vim 8 while you edit your text files.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
@@ -16,8 +16,18 @@ back to a filesystem.
|
|||||||
|
|
||||||
In other words, this plugin allows you to lint while you type.
|
In other words, this plugin allows you to lint while you type.
|
||||||
|
|
||||||
In addition to linting support, ALE offers some support for fixing code with
|
ALE offers support for fixing code with command line tools in a non-blocking
|
||||||
formatting tools, and some Language Server Protocol and `tsserver` features.
|
manner with the `:ALEFix` feature, supporting tools in many languages, like
|
||||||
|
`prettier`, `eslint`, `autopep8`, and more.
|
||||||
|
|
||||||
|
ALE acts as a "language client" to support a variety of Language Server Protocol
|
||||||
|
features, including:
|
||||||
|
|
||||||
|
* Diagnostics (via Language Server Protocol linters)
|
||||||
|
* Go To Definition (`:ALEGoToDefinition`)
|
||||||
|
* Completion (`let g:ale_completion_enabled = 1`)
|
||||||
|
* Finding references (`:ALEFindReferences`)
|
||||||
|
* Hover information (`:ALEHover`)
|
||||||
|
|
||||||
## Table of Contents
|
## Table of Contents
|
||||||
|
|
||||||
@@ -27,6 +37,8 @@ formatting tools, and some Language Server Protocol and `tsserver` features.
|
|||||||
2. [Fixing](#usage-fixing)
|
2. [Fixing](#usage-fixing)
|
||||||
3. [Completion](#usage-completion)
|
3. [Completion](#usage-completion)
|
||||||
4. [Go To Definition](#usage-go-to-definition)
|
4. [Go To Definition](#usage-go-to-definition)
|
||||||
|
5. [Find References](#usage-find-references)
|
||||||
|
6. [Hovering](#usage-hover)
|
||||||
3. [Installation](#installation)
|
3. [Installation](#installation)
|
||||||
1. [Installation with Vim package management](#standard-installation)
|
1. [Installation with Vim package management](#standard-installation)
|
||||||
2. [Installation with Pathogen](#installation-with-pathogen)
|
2. [Installation with Pathogen](#installation-with-pathogen)
|
||||||
@@ -48,6 +60,7 @@ formatting tools, and some Language Server Protocol and `tsserver` features.
|
|||||||
13. [Will this plugin eat all of my laptop battery power?](#faq-my-battery-is-sad)
|
13. [Will this plugin eat all of my laptop battery power?](#faq-my-battery-is-sad)
|
||||||
14. [How can I configure my C or C++ project?](#faq-c-configuration)
|
14. [How can I configure my C or C++ project?](#faq-c-configuration)
|
||||||
15. [How can I configure ALE differently for different buffers?](#faq-buffer-configuration)
|
15. [How can I configure ALE differently for different buffers?](#faq-buffer-configuration)
|
||||||
|
16. [How can I configure the height of the list in which ALE displays errors?](#faq-list-window-height)
|
||||||
|
|
||||||
<a name="supported-languages"></a>
|
<a name="supported-languages"></a>
|
||||||
|
|
||||||
@@ -79,8 +92,8 @@ formatting.
|
|||||||
| Awk | [gawk](https://www.gnu.org/software/gawk/)|
|
| Awk | [gawk](https://www.gnu.org/software/gawk/)|
|
||||||
| Bash | shell [-n flag](https://www.gnu.org/software/bash/manual/bash.html#index-set), [shellcheck](https://www.shellcheck.net/), [shfmt](https://github.com/mvdan/sh) |
|
| Bash | shell [-n flag](https://www.gnu.org/software/bash/manual/bash.html#index-set), [shellcheck](https://www.shellcheck.net/), [shfmt](https://github.com/mvdan/sh) |
|
||||||
| Bourne Shell | shell [-n flag](http://linux.die.net/man/1/sh), [shellcheck](https://www.shellcheck.net/), [shfmt](https://github.com/mvdan/sh) |
|
| Bourne Shell | shell [-n flag](http://linux.die.net/man/1/sh), [shellcheck](https://www.shellcheck.net/), [shfmt](https://github.com/mvdan/sh) |
|
||||||
| C | [cppcheck](http://cppcheck.sourceforge.net), [cpplint](https://github.com/google/styleguide/tree/gh-pages/cpplint), [gcc](https://gcc.gnu.org/), [clang](http://clang.llvm.org/), [clangtidy](http://clang.llvm.org/extra/clang-tidy/) !!, [clang-format](https://clang.llvm.org/docs/ClangFormat.html)|
|
| C | [cppcheck](http://cppcheck.sourceforge.net), [cpplint](https://github.com/google/styleguide/tree/gh-pages/cpplint), [clang](http://clang.llvm.org/), [clangtidy](http://clang.llvm.org/extra/clang-tidy/) !!, [clang-format](https://clang.llvm.org/docs/ClangFormat.html), [flawfinder](https://www.dwheeler.com/flawfinder/), [gcc](https://gcc.gnu.org/) |
|
||||||
| C++ (filetype cpp) | [clang](http://clang.llvm.org/), [clangcheck](http://clang.llvm.org/docs/ClangCheck.html) !!, [clangtidy](http://clang.llvm.org/extra/clang-tidy/) !!, [clang-format](https://clang.llvm.org/docs/ClangFormat.html), [cppcheck](http://cppcheck.sourceforge.net), [cpplint](https://github.com/google/styleguide/tree/gh-pages/cpplint) !!, [gcc](https://gcc.gnu.org/) |
|
| C++ (filetype cpp) | [clang](http://clang.llvm.org/), [clangcheck](http://clang.llvm.org/docs/ClangCheck.html) !!, [clangtidy](http://clang.llvm.org/extra/clang-tidy/) !!, [clang-format](https://clang.llvm.org/docs/ClangFormat.html), [cppcheck](http://cppcheck.sourceforge.net), [cpplint](https://github.com/google/styleguide/tree/gh-pages/cpplint) !!, [flawfinder](https://www.dwheeler.com/flawfinder/), [gcc](https://gcc.gnu.org/) |
|
||||||
| CUDA | [nvcc](http://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/index.html) |
|
| CUDA | [nvcc](http://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/index.html) |
|
||||||
| C# | [mcs](http://www.mono-project.com/docs/about-mono/languages/csharp/) see:`help ale-cs-mcs` for details, [mcsc](http://www.mono-project.com/docs/about-mono/languages/csharp/) !! see:`help ale-cs-mcsc` for details and configuration|
|
| C# | [mcs](http://www.mono-project.com/docs/about-mono/languages/csharp/) see:`help ale-cs-mcs` for details, [mcsc](http://www.mono-project.com/docs/about-mono/languages/csharp/) !! see:`help ale-cs-mcsc` for details and configuration|
|
||||||
| Chef | [foodcritic](http://www.foodcritic.io/) |
|
| Chef | [foodcritic](http://www.foodcritic.io/) |
|
||||||
@@ -89,60 +102,69 @@ formatting.
|
|||||||
| CoffeeScript | [coffee](http://coffeescript.org/), [coffeelint](https://www.npmjs.com/package/coffeelint) |
|
| CoffeeScript | [coffee](http://coffeescript.org/), [coffeelint](https://www.npmjs.com/package/coffeelint) |
|
||||||
| Crystal | [crystal](https://crystal-lang.org/) !! |
|
| Crystal | [crystal](https://crystal-lang.org/) !! |
|
||||||
| CSS | [csslint](http://csslint.net/), [prettier](https://github.com/prettier/prettier), [stylelint](https://github.com/stylelint/stylelint) |
|
| CSS | [csslint](http://csslint.net/), [prettier](https://github.com/prettier/prettier), [stylelint](https://github.com/stylelint/stylelint) |
|
||||||
|
| Cucumber | [cucumber](https://cucumber.io/) |
|
||||||
| Cython (pyrex filetype) | [cython](http://cython.org/) |
|
| Cython (pyrex filetype) | [cython](http://cython.org/) |
|
||||||
| D | [dmd](https://dlang.org/dmd-linux.html) |
|
| D | [dmd](https://dlang.org/dmd-linux.html) |
|
||||||
| Dafny | [dafny](https://rise4fun.com/Dafny) !! |
|
| Dafny | [dafny](https://rise4fun.com/Dafny) !! |
|
||||||
| Dart | [dartanalyzer](https://github.com/dart-lang/sdk/tree/master/pkg/analyzer_cli) !!, [language_server](https://github.com/natebosch/dart_language_server) |
|
| Dart | [dartanalyzer](https://github.com/dart-lang/sdk/tree/master/pkg/analyzer_cli) !!, [language_server](https://github.com/natebosch/dart_language_server) |
|
||||||
| Dockerfile | [hadolint](https://github.com/lukasmartinelli/hadolint) |
|
| Dockerfile | [hadolint](https://github.com/hadolint/hadolint) |
|
||||||
| Elixir | [credo](https://github.com/rrrene/credo), [dogma](https://github.com/lpil/dogma) !! |
|
| Elixir | [credo](https://github.com/rrrene/credo), [dialyxir](https://github.com/jeremyjh/dialyxir), [dogma](https://github.com/lpil/dogma) !!|
|
||||||
| Elm | [elm-format](https://github.com/avh4/elm-format), [elm-make](https://github.com/elm-lang/elm-make) |
|
| Elm | [elm-format](https://github.com/avh4/elm-format), [elm-make](https://github.com/elm-lang/elm-make) |
|
||||||
| Erb | [erb](https://github.com/jeremyevans/erubi), [erubis](https://github.com/kwatch/erubis) |
|
| Erb | [erb](https://apidock.com/ruby/ERB), [erubi](https://github.com/jeremyevans/erubi), [erubis](https://github.com/kwatch/erubis) |
|
||||||
| Erlang | [erlc](http://erlang.org/doc/man/erlc.html), [SyntaxErl](https://github.com/ten0s/syntaxerl) |
|
| Erlang | [erlc](http://erlang.org/doc/man/erlc.html), [SyntaxErl](https://github.com/ten0s/syntaxerl) |
|
||||||
|
| Fish | fish [-n flag](https://linux.die.net/man/1/fish)
|
||||||
| Fortran | [gcc](https://gcc.gnu.org/) |
|
| Fortran | [gcc](https://gcc.gnu.org/) |
|
||||||
|
| Fountain | [proselint](http://proselint.com/) |
|
||||||
| FusionScript | [fusion-lint](https://github.com/RyanSquared/fusionscript) |
|
| FusionScript | [fusion-lint](https://github.com/RyanSquared/fusionscript) |
|
||||||
|
| Git Commit Messages | [gitlint](https://github.com/jorisroovers/gitlint) |
|
||||||
| GLSL | [glslang](https://github.com/KhronosGroup/glslang), [glslls](https://github.com/svenstaro/glsl-language-server) |
|
| GLSL | [glslang](https://github.com/KhronosGroup/glslang), [glslls](https://github.com/svenstaro/glsl-language-server) |
|
||||||
| Go | [gofmt](https://golang.org/cmd/gofmt/), [goimports](https://godoc.org/golang.org/x/tools/cmd/goimports), [go vet](https://golang.org/cmd/vet/), [golint](https://godoc.org/github.com/golang/lint), [gometalinter](https://github.com/alecthomas/gometalinter) !!, [go build](https://golang.org/cmd/go/) !!, [gosimple](https://github.com/dominikh/go-tools/tree/master/cmd/gosimple) !!, [staticcheck](https://github.com/dominikh/go-tools/tree/master/cmd/staticcheck) !! |
|
| Go | [gofmt](https://golang.org/cmd/gofmt/), [goimports](https://godoc.org/golang.org/x/tools/cmd/goimports), [go vet](https://golang.org/cmd/vet/) !!, [golint](https://godoc.org/github.com/golang/lint), [gotype](https://godoc.org/golang.org/x/tools/cmd/gotype) !!, [gometalinter](https://github.com/alecthomas/gometalinter) !!, [go build](https://golang.org/cmd/go/) !!, [gosimple](https://github.com/dominikh/go-tools/tree/master/cmd/gosimple) !!, [staticcheck](https://github.com/dominikh/go-tools/tree/master/cmd/staticcheck) !! |
|
||||||
| GraphQL | [eslint](http://eslint.org/), [gqlint](https://github.com/happylinks/gqlint) |
|
| GraphQL | [eslint](http://eslint.org/), [gqlint](https://github.com/happylinks/gqlint), [prettier](https://github.com/prettier/prettier) |
|
||||||
| Haml | [haml-lint](https://github.com/brigade/haml-lint) |
|
| Haml | [haml-lint](https://github.com/brigade/haml-lint) |
|
||||||
| Handlebars | [ember-template-lint](https://github.com/rwjblue/ember-template-lint) |
|
| Handlebars | [ember-template-lint](https://github.com/rwjblue/ember-template-lint) |
|
||||||
| Haskell | [brittany](https://github.com/lspitzner/brittany), [ghc](https://www.haskell.org/ghc/), [stack-ghc](https://haskellstack.org/), [stack-build](https://haskellstack.org/) !!, [ghc-mod](https://github.com/DanielG/ghc-mod), [stack-ghc-mod](https://github.com/DanielG/ghc-mod), [hlint](https://hackage.haskell.org/package/hlint), [hdevtools](https://hackage.haskell.org/package/hdevtools), [hfmt](https://github.com/danstiner/hfmt) |
|
| Haskell | [brittany](https://github.com/lspitzner/brittany), [ghc](https://www.haskell.org/ghc/), [stack-ghc](https://haskellstack.org/), [stack-build](https://haskellstack.org/) !!, [ghc-mod](https://github.com/DanielG/ghc-mod), [stack-ghc-mod](https://github.com/DanielG/ghc-mod), [hlint](https://hackage.haskell.org/package/hlint), [hdevtools](https://hackage.haskell.org/package/hdevtools), [hfmt](https://github.com/danstiner/hfmt) |
|
||||||
| HTML | [alex](https://github.com/wooorm/alex) !!, [HTMLHint](http://htmlhint.com/), [proselint](http://proselint.com/), [tidy](http://www.html-tidy.org/), [write-good](https://github.com/btford/write-good) |
|
| HTML | [alex](https://github.com/wooorm/alex) !!, [HTMLHint](http://htmlhint.com/), [proselint](http://proselint.com/), [tidy](http://www.html-tidy.org/), [write-good](https://github.com/btford/write-good) |
|
||||||
| Idris | [idris](http://www.idris-lang.org/) |
|
| Idris | [idris](http://www.idris-lang.org/) |
|
||||||
| Java | [checkstyle](http://checkstyle.sourceforge.net), [javac](http://www.oracle.com/technetwork/java/javase/downloads/index.html), [google-java-format](https://github.com/google/google-java-format) |
|
| Java | [checkstyle](http://checkstyle.sourceforge.net), [javac](http://www.oracle.com/technetwork/java/javase/downloads/index.html), [google-java-format](https://github.com/google/google-java-format), [PMD](https://pmd.github.io/) |
|
||||||
| JavaScript | [eslint](http://eslint.org/), [flow](https://flowtype.org/), [jscs](http://jscs.info/), [jshint](http://jshint.com/), [prettier](https://github.com/prettier/prettier), [prettier-eslint](https://github.com/prettier/prettier-eslint), [prettier-standard](https://github.com/sheerun/prettier-standard), [standard](http://standardjs.com/), [xo](https://github.com/sindresorhus/xo)
|
| JavaScript | [eslint](http://eslint.org/), [flow](https://flowtype.org/), [jscs](http://jscs.info/), [jshint](http://jshint.com/), [prettier](https://github.com/prettier/prettier), [prettier-eslint](https://github.com/prettier/prettier-eslint-cli), [prettier-standard](https://github.com/sheerun/prettier-standard), [standard](http://standardjs.com/), [xo](https://github.com/sindresorhus/xo)
|
||||||
| JSON | [jsonlint](http://zaa.ch/jsonlint/), [prettier](https://github.com/prettier/prettier) |
|
| JSON | [fixjson](https://github.com/rhysd/fixjson), [jsonlint](http://zaa.ch/jsonlint/), [jq](https://stedolan.github.io/jq/), [prettier](https://github.com/prettier/prettier) |
|
||||||
| Kotlin | [kotlinc](https://kotlinlang.org) !!, [ktlint](https://ktlint.github.io) !! see `:help ale-integration-kotlin` for configuration instructions |
|
| Kotlin | [kotlinc](https://kotlinlang.org) !!, [ktlint](https://ktlint.github.io) !! see `:help ale-integration-kotlin` for configuration instructions |
|
||||||
| LaTeX | [alex](https://github.com/wooorm/alex) !!, [chktex](http://www.nongnu.org/chktex/), [lacheck](https://www.ctan.org/pkg/lacheck), [proselint](http://proselint.com/), [redpen](http://redpen.cc/), [vale](https://github.com/ValeLint/vale), [write-good](https://github.com/btford/write-good) |
|
| LaTeX | [alex](https://github.com/wooorm/alex) !!, [chktex](http://www.nongnu.org/chktex/), [lacheck](https://www.ctan.org/pkg/lacheck), [proselint](http://proselint.com/), [redpen](http://redpen.cc/), [vale](https://github.com/ValeLint/vale), [write-good](https://github.com/btford/write-good) |
|
||||||
| Less | [lessc](https://www.npmjs.com/package/less), [prettier](https://github.com/prettier/prettier), [stylelint](https://github.com/stylelint/stylelint) |
|
| Less | [lessc](https://www.npmjs.com/package/less), [prettier](https://github.com/prettier/prettier), [stylelint](https://github.com/stylelint/stylelint) |
|
||||||
| LLVM | [llc](https://llvm.org/docs/CommandGuide/llc.html) |
|
| LLVM | [llc](https://llvm.org/docs/CommandGuide/llc.html) |
|
||||||
| Lua | [luacheck](https://github.com/mpeterv/luacheck) |
|
| Lua | [luac](https://www.lua.org/manual/5.1/luac.html), [luacheck](https://github.com/mpeterv/luacheck) |
|
||||||
| Mail | [alex](https://github.com/wooorm/alex) !!, [proselint](http://proselint.com/), [vale](https://github.com/ValeLint/vale) |
|
| Mail | [alex](https://github.com/wooorm/alex) !!, [proselint](http://proselint.com/), [vale](https://github.com/ValeLint/vale) |
|
||||||
| Make | [checkmake](https://github.com/mrtazz/checkmake) |
|
| Make | [checkmake](https://github.com/mrtazz/checkmake) |
|
||||||
| Markdown | [alex](https://github.com/wooorm/alex) !!, [mdl](https://github.com/mivok/markdownlint), [proselint](http://proselint.com/), [redpen](http://redpen.cc/), [remark-lint](https://github.com/wooorm/remark-lint) !!, [vale](https://github.com/ValeLint/vale), [write-good](https://github.com/btford/write-good) |
|
| Markdown | [alex](https://github.com/wooorm/alex) !!, [markdownlint](https://github.com/DavidAnson/markdownlint) !!, [mdl](https://github.com/mivok/markdownlint), [prettier](https://github.com/prettier/prettier), [proselint](http://proselint.com/), [redpen](http://redpen.cc/), [remark-lint](https://github.com/wooorm/remark-lint) !!, [textlint](https://textlint.github.io/), [vale](https://github.com/ValeLint/vale), [write-good](https://github.com/btford/write-good) |
|
||||||
| MATLAB | [mlint](https://www.mathworks.com/help/matlab/ref/mlint.html) |
|
| MATLAB | [mlint](https://www.mathworks.com/help/matlab/ref/mlint.html) |
|
||||||
|
| Mercury | [mmc](http://mercurylang.org) !! |
|
||||||
|
| NASM | [nasm](https://www.nasm.us/) !! |
|
||||||
| Nim | [nim check](https://nim-lang.org/docs/nimc.html) !! |
|
| Nim | [nim check](https://nim-lang.org/docs/nimc.html) !! |
|
||||||
| nix | [nix-instantiate](http://nixos.org/nix/manual/#sec-nix-instantiate) |
|
| nix | [nix-instantiate](http://nixos.org/nix/manual/#sec-nix-instantiate) |
|
||||||
| nroff | [alex](https://github.com/wooorm/alex) !!, [proselint](http://proselint.com/), [write-good](https://github.com/btford/write-good)|
|
| nroff | [alex](https://github.com/wooorm/alex) !!, [proselint](http://proselint.com/), [write-good](https://github.com/btford/write-good)|
|
||||||
| Objective-C | [clang](http://clang.llvm.org/) |
|
| Objective-C | [clang](http://clang.llvm.org/) |
|
||||||
| Objective-C++ | [clang](http://clang.llvm.org/) |
|
| Objective-C++ | [clang](http://clang.llvm.org/) |
|
||||||
| OCaml | [merlin](https://github.com/the-lambda-church/merlin) see `:help ale-ocaml-merlin` for configuration instructions, [ols](https://github.com/freebroccolo/ocaml-language-server) |
|
| OCaml | [merlin](https://github.com/the-lambda-church/merlin) see `:help ale-ocaml-merlin` for configuration instructions, [ols](https://github.com/freebroccolo/ocaml-language-server) |
|
||||||
| Perl | [perl -c](https://perl.org/), [perl-critic](https://metacpan.org/pod/Perl::Critic) |
|
| Perl | [perl -c](https://perl.org/), [perl-critic](https://metacpan.org/pod/Perl::Critic), [perltidy](https://metacpan.org/pod/distribution/Perl-Tidy/bin/perltidy) |
|
||||||
| PHP | [hack](http://hacklang.org/), [hackfmt](https://github.com/facebook/flow/tree/master/hack/hackfmt), [langserver](https://github.com/felixfbecker/php-language-server), [phan](https://github.com/phan/phan) see `:help ale-php-phan` to instructions, [php -l](https://secure.php.net/), [phpcs](https://github.com/squizlabs/PHP_CodeSniffer), [phpmd](https://phpmd.org), [phpstan](https://github.com/phpstan/phpstan), [phpcbf](https://github.com/squizlabs/PHP_CodeSniffer) |
|
| PHP | [hack](http://hacklang.org/), [hackfmt](https://github.com/facebook/flow/tree/master/hack/hackfmt), [langserver](https://github.com/felixfbecker/php-language-server), [phan](https://github.com/phan/phan) see `:help ale-php-phan` to instructions, [php -l](https://secure.php.net/), [phpcs](https://github.com/squizlabs/PHP_CodeSniffer), [phpmd](https://phpmd.org), [phpstan](https://github.com/phpstan/phpstan), [phpcbf](https://github.com/squizlabs/PHP_CodeSniffer), [php-cs-fixer](http://cs.sensiolabs.org/) |
|
||||||
|
| PO | [alex](https://github.com/wooorm/alex) !!, [msgfmt](https://www.gnu.org/software/gettext/manual/html_node/msgfmt-Invocation.html), [proselint](http://proselint.com/), [write-good](https://github.com/btford/write-good) |
|
||||||
| Pod | [alex](https://github.com/wooorm/alex) !!, [proselint](http://proselint.com/), [write-good](https://github.com/btford/write-good) |
|
| Pod | [alex](https://github.com/wooorm/alex) !!, [proselint](http://proselint.com/), [write-good](https://github.com/btford/write-good) |
|
||||||
|
| Pony | [ponyc](https://github.com/ponylang/ponyc) |
|
||||||
| proto | [protoc-gen-lint](https://github.com/ckaznocha/protoc-gen-lint) |
|
| proto | [protoc-gen-lint](https://github.com/ckaznocha/protoc-gen-lint) |
|
||||||
| Pug | [pug-lint](https://github.com/pugjs/pug-lint) |
|
| Pug | [pug-lint](https://github.com/pugjs/pug-lint) |
|
||||||
| Puppet | [puppet](https://puppet.com), [puppet-lint](https://puppet-lint.com) |
|
| Puppet | [puppet](https://puppet.com), [puppet-lint](https://puppet-lint.com) |
|
||||||
| Python | [autopep8](https://github.com/hhatto/autopep8), [flake8](http://flake8.pycqa.org/en/latest/), [isort](https://github.com/timothycrosley/isort), [mypy](http://mypy-lang.org/), [prospector](http://github.com/landscapeio/prospector), [pycodestyle](https://github.com/PyCQA/pycodestyle), [pyls](https://github.com/palantir/python-language-server), [pylint](https://www.pylint.org/) !!, [yapf](https://github.com/google/yapf) |
|
| Python | [autopep8](https://github.com/hhatto/autopep8), [black](https://github.com/ambv/black), [flake8](http://flake8.pycqa.org/en/latest/), [isort](https://github.com/timothycrosley/isort), [mypy](http://mypy-lang.org/), [prospector](http://github.com/landscapeio/prospector), [pycodestyle](https://github.com/PyCQA/pycodestyle), [pyls](https://github.com/palantir/python-language-server), [pylint](https://www.pylint.org/) !!, [yapf](https://github.com/google/yapf) |
|
||||||
|
| QML | [qmlfmt](https://github.com/jesperhh/qmlfmt), [qmllint](https://github.com/qt/qtdeclarative/tree/5.11/tools/qmllint) |
|
||||||
| R | [lintr](https://github.com/jimhester/lintr) |
|
| R | [lintr](https://github.com/jimhester/lintr) |
|
||||||
| ReasonML | [merlin](https://github.com/the-lambda-church/merlin) see `:help ale-integration-reason-merlin` for configuration instructions, [ols](https://github.com/freebroccolo/ocaml-language-server), [refmt](https://github.com/reasonml/reason-cli) |
|
| ReasonML | [merlin](https://github.com/the-lambda-church/merlin) see `:help ale-reasonml-ols` for configuration instructions, [ols](https://github.com/freebroccolo/ocaml-language-server), [refmt](https://github.com/reasonml/reason-cli) |
|
||||||
| reStructuredText | [alex](https://github.com/wooorm/alex) !!, [proselint](http://proselint.com/), [redpen](http://redpen.cc/), [rstcheck](https://github.com/myint/rstcheck), [vale](https://github.com/ValeLint/vale), [write-good](https://github.com/btford/write-good) |
|
| reStructuredText | [alex](https://github.com/wooorm/alex) !!, [proselint](http://proselint.com/), [redpen](http://redpen.cc/), [rstcheck](https://github.com/myint/rstcheck), [vale](https://github.com/ValeLint/vale), [write-good](https://github.com/btford/write-good) |
|
||||||
| Re:VIEW | [redpen](http://redpen.cc/) |
|
| Re:VIEW | [redpen](http://redpen.cc/) |
|
||||||
| RPM spec | [rpmlint](https://github.com/rpm-software-management/rpmlint) (disabled by default; see `:help ale-integration-spec`) |
|
| RPM spec | [rpmlint](https://github.com/rpm-software-management/rpmlint) (disabled by default; see `:help ale-integration-spec`) |
|
||||||
| Ruby | [brakeman](http://brakemanscanner.org/) !!, [rails_best_practices](https://github.com/flyerhzm/rails_best_practices) !!, [reek](https://github.com/troessner/reek), [rubocop](https://github.com/bbatsov/rubocop), [ruby](https://www.ruby-lang.org) |
|
| Ruby | [brakeman](http://brakemanscanner.org/) !!, [rails_best_practices](https://github.com/flyerhzm/rails_best_practices) !!, [reek](https://github.com/troessner/reek), [rubocop](https://github.com/bbatsov/rubocop), [ruby](https://www.ruby-lang.org), [rufo](https://github.com/ruby-formatter/rufo) |
|
||||||
| Rust | cargo !! (see `:help ale-integration-rust` for configuration instructions), [rls](https://github.com/rust-lang-nursery/rls), [rustc](https://www.rust-lang.org/), [rustfmt](https://github.com/rust-lang-nursery/rustfmt) |
|
| Rust | cargo !! (see `:help ale-integration-rust` for configuration instructions), [rls](https://github.com/rust-lang-nursery/rls), [rustc](https://www.rust-lang.org/), [rustfmt](https://github.com/rust-lang-nursery/rustfmt) |
|
||||||
| SASS | [sass-lint](https://www.npmjs.com/package/sass-lint), [stylelint](https://github.com/stylelint/stylelint) |
|
| SASS | [sass-lint](https://www.npmjs.com/package/sass-lint), [stylelint](https://github.com/stylelint/stylelint) |
|
||||||
| SCSS | [prettier](https://github.com/prettier/prettier), [sass-lint](https://www.npmjs.com/package/sass-lint), [scss-lint](https://github.com/brigade/scss-lint), [stylelint](https://github.com/stylelint/stylelint) |
|
| SCSS | [prettier](https://github.com/prettier/prettier), [sass-lint](https://www.npmjs.com/package/sass-lint), [scss-lint](https://github.com/brigade/scss-lint), [stylelint](https://github.com/stylelint/stylelint) |
|
||||||
| Scala | [scalac](http://scala-lang.org), [scalastyle](http://www.scalastyle.org) |
|
| Scala | [fsc](https://www.scala-lang.org/old/sites/default/files/linuxsoft_archives/docu/files/tools/fsc.html), [scalac](http://scala-lang.org), [scalastyle](http://www.scalastyle.org) |
|
||||||
| Slim | [slim-lint](https://github.com/sds/slim-lint) |
|
| Slim | [slim-lint](https://github.com/sds/slim-lint) |
|
||||||
| SML | [smlnj](http://www.smlnj.org/) |
|
| SML | [smlnj](http://www.smlnj.org/) |
|
||||||
| Solidity | [solhint](https://github.com/protofire/solhint), [solium](https://github.com/duaraghav8/Solium) |
|
| Solidity | [solhint](https://github.com/protofire/solhint), [solium](https://github.com/duaraghav8/Solium) |
|
||||||
@@ -152,12 +174,13 @@ formatting.
|
|||||||
| Tcl | [nagelfar](http://nagelfar.sourceforge.net) !! |
|
| Tcl | [nagelfar](http://nagelfar.sourceforge.net) !! |
|
||||||
| Terraform | [tflint](https://github.com/wata727/tflint) |
|
| Terraform | [tflint](https://github.com/wata727/tflint) |
|
||||||
| Texinfo | [alex](https://github.com/wooorm/alex) !!, [proselint](http://proselint.com/), [write-good](https://github.com/btford/write-good)|
|
| Texinfo | [alex](https://github.com/wooorm/alex) !!, [proselint](http://proselint.com/), [write-good](https://github.com/btford/write-good)|
|
||||||
| Text^ | [alex](https://github.com/wooorm/alex) !!, [proselint](http://proselint.com/), [vale](https://github.com/ValeLint/vale), [write-good](https://github.com/btford/write-good), [redpen](http://redpen.cc/) |
|
| Text^ | [alex](https://github.com/wooorm/alex) !!, [proselint](http://proselint.com/), [redpen](http://redpen.cc/), [textlint](https://textlint.github.io/), [vale](https://github.com/ValeLint/vale), [write-good](https://github.com/btford/write-good) |
|
||||||
| Thrift | [thrift](http://thrift.apache.org/) |
|
| Thrift | [thrift](http://thrift.apache.org/) |
|
||||||
| TypeScript | [eslint](http://eslint.org/), [prettier](https://github.com/prettier/prettier), [tslint](https://github.com/palantir/tslint), tsserver, typecheck |
|
| TypeScript | [eslint](http://eslint.org/), [prettier](https://github.com/prettier/prettier), [tslint](https://github.com/palantir/tslint), tsserver, typecheck |
|
||||||
| Verilog | [iverilog](https://github.com/steveicarus/iverilog), [verilator](http://www.veripool.org/projects/verilator/wiki/Intro) |
|
| Verilog | [iverilog](https://github.com/steveicarus/iverilog), [verilator](http://www.veripool.org/projects/verilator/wiki/Intro) |
|
||||||
| Vim | [vint](https://github.com/Kuniwak/vint) |
|
| Vim | [vint](https://github.com/Kuniwak/vint) |
|
||||||
| Vim help^ | [alex](https://github.com/wooorm/alex) !!, [proselint](http://proselint.com/), [write-good](https://github.com/btford/write-good) |
|
| Vim help^ | [alex](https://github.com/wooorm/alex) !!, [proselint](http://proselint.com/), [write-good](https://github.com/btford/write-good) |
|
||||||
|
| Vue | [prettier](https://github.com/prettier/prettier) |
|
||||||
| XHTML | [alex](https://github.com/wooorm/alex) !!, [proselint](http://proselint.com/), [write-good](https://github.com/btford/write-good) |
|
| XHTML | [alex](https://github.com/wooorm/alex) !!, [proselint](http://proselint.com/), [write-good](https://github.com/btford/write-good) |
|
||||||
| XML | [xmllint](http://xmlsoft.org/xmllint.html) |
|
| XML | [xmllint](http://xmlsoft.org/xmllint.html) |
|
||||||
| YAML | [swaglint](https://github.com/byCedric/swaglint), [yamllint](https://yamllint.readthedocs.io/) |
|
| YAML | [swaglint](https://github.com/byCedric/swaglint), [yamllint](https://yamllint.readthedocs.io/) |
|
||||||
@@ -187,24 +210,42 @@ ale-linter-options` for options specified to particular linters.
|
|||||||
### 2.ii Fixing
|
### 2.ii Fixing
|
||||||
|
|
||||||
ALE can fix files with the `ALEFix` command. Functions need to be configured
|
ALE can fix files with the `ALEFix` command. Functions need to be configured
|
||||||
for different filetypes with the `g:ale_fixers` variable. For example, the
|
either in each buffer with a `b:ale_fixers`, or globally with `g:ale_fixers`.
|
||||||
following code can be used to fix JavaScript code with ESLint:
|
|
||||||
|
The recommended way to configure fixers is to define a List in an ftplugin file.
|
||||||
|
|
||||||
```vim
|
```vim
|
||||||
" Put this in vimrc or a plugin file of your own.
|
" In ~/.vim/ftplugin/javascript.vim, or somewhere similar.
|
||||||
" After this is configured, :ALEFix will try and fix your JS code with ESLint.
|
|
||||||
|
" Fix files with prettier, and then ESLint.
|
||||||
|
let b:ale_fixers = ['prettier', 'eslint']
|
||||||
|
" Equivalent to the above.
|
||||||
|
let b:ale_fixers = {'javascript': ['prettier', 'eslint']}
|
||||||
|
```
|
||||||
|
|
||||||
|
You can also configure your fixers from vimrc using `g:ale_fixers`, before
|
||||||
|
or after ALE has been loaded.
|
||||||
|
|
||||||
|
```vim
|
||||||
|
" In ~/.vim/vimrc, or somewhere similar.
|
||||||
let g:ale_fixers = {
|
let g:ale_fixers = {
|
||||||
\ 'javascript': ['eslint'],
|
\ 'javascript': ['eslint'],
|
||||||
\}
|
\}
|
||||||
|
```
|
||||||
|
|
||||||
" Set this setting in vimrc if you want to fix files automatically on save.
|
If you want to automatically fix files when you save them, you need to turn
|
||||||
" This is off by default.
|
a setting on in vimrc.
|
||||||
|
|
||||||
|
```vim
|
||||||
|
" Set this variable to 1 to fix files when you save them.
|
||||||
let g:ale_fix_on_save = 1
|
let g:ale_fix_on_save = 1
|
||||||
```
|
```
|
||||||
|
|
||||||
The `:ALEFixSuggest` command will suggest some supported tools for fixing code,
|
The `:ALEFixSuggest` command will suggest some supported tools for fixing code.
|
||||||
but fixers can be also implemented with functions, including lambda functions
|
Both `g:ale_fixers` and `b:ale_fixers` can also accept functions, including
|
||||||
too. See `:help ale-fix` for detailed information.
|
lambda functions, as fixers, for fixing files with custom tools.
|
||||||
|
|
||||||
|
See `:help ale-fix` for complete information on how to fix files with ALE.
|
||||||
|
|
||||||
<a name="usage-completion"></a>
|
<a name="usage-completion"></a>
|
||||||
|
|
||||||
@@ -212,9 +253,7 @@ too. See `:help ale-fix` for detailed information.
|
|||||||
|
|
||||||
ALE offers some support for completion via hijacking of omnicompletion while you
|
ALE offers some support for completion via hijacking of omnicompletion while you
|
||||||
type. All of ALE's completion information must come from Language Server
|
type. All of ALE's completion information must come from Language Server
|
||||||
Protocol linters, or similar protocols. At the moment, completion is only
|
Protocol linters, or from `tsserver` for TypeSript.
|
||||||
supported for TypeScript code with `tsserver`, when `tsserver` is enabled. You
|
|
||||||
can enable completion like so:
|
|
||||||
|
|
||||||
```vim
|
```vim
|
||||||
" Enable completion where available.
|
" Enable completion where available.
|
||||||
@@ -228,10 +267,34 @@ See `:help ale-completion` for more information.
|
|||||||
### 2.iv Go To Definition
|
### 2.iv Go To Definition
|
||||||
|
|
||||||
ALE supports jumping to the definition of words under your cursor with the
|
ALE supports jumping to the definition of words under your cursor with the
|
||||||
`:ALEGoToDefinition` command using any enabled LSP linters and `tsserver`.
|
`:ALEGoToDefinition` command using any enabled Language Server Protocol linters
|
||||||
|
and `tsserver`.
|
||||||
|
|
||||||
See `:help ale-go-to-definition` for more information.
|
See `:help ale-go-to-definition` for more information.
|
||||||
|
|
||||||
|
<a name="usage-find-references"></a>
|
||||||
|
|
||||||
|
### 2.v Find References
|
||||||
|
|
||||||
|
ALE supports finding references for words under your cursor with the
|
||||||
|
`:ALEFindReferences` command using any enabled Language Server Protocol linters
|
||||||
|
and `tsserver`.
|
||||||
|
|
||||||
|
See `:help ale-find-references` for more information.
|
||||||
|
|
||||||
|
<a name="usage-hover"></a>
|
||||||
|
|
||||||
|
### 2.vi Hovering
|
||||||
|
|
||||||
|
ALE supports "hover" information for printing brief information about symbols at
|
||||||
|
the cursor taken from Language Server Protocol linters and `tsserver` with the
|
||||||
|
`ALEHover` command.
|
||||||
|
|
||||||
|
On vim/gvim with `balloon` support you can see the information in a tooltip
|
||||||
|
that appears under the mouse when you mouseover a symbol.
|
||||||
|
|
||||||
|
See `:help ale-hover` for more information.
|
||||||
|
|
||||||
<a name="installation"></a>
|
<a name="installation"></a>
|
||||||
|
|
||||||
## 3. Installation
|
## 3. Installation
|
||||||
@@ -340,12 +403,28 @@ on Freenode. Web chat is available [here](https://webchat.freenode.net/?channels
|
|||||||
|
|
||||||
### 5.i. How do I disable particular linters?
|
### 5.i. How do I disable particular linters?
|
||||||
|
|
||||||
By default, all available tools for all supported languages will be run.
|
By default, all available tools for all supported languages will be run. If you
|
||||||
If you want to only select a subset of the tools, simply create a
|
want to only select a subset of the tools, you can define `b:ale_linters` for a
|
||||||
`g:ale_linters` dictionary in your vimrc file mapping filetypes
|
single buffer, or `g:ale_linters` globally.
|
||||||
to lists of linters to run.
|
|
||||||
|
The recommended way to configure linters is to define a List in an ftplugin
|
||||||
|
file.
|
||||||
|
|
||||||
```vim
|
```vim
|
||||||
|
" In ~/.vim/ftplugin/javascript.vim, or somewhere similar.
|
||||||
|
|
||||||
|
" Enable ESLint only for JavaScript.
|
||||||
|
let b:ale_linters = ['eslint']
|
||||||
|
|
||||||
|
" Equivalent to the above.
|
||||||
|
let b:ale_linters = {'javascript': ['eslint']}
|
||||||
|
```
|
||||||
|
|
||||||
|
You can also declare which linters you want to run in your vimrc file, before or
|
||||||
|
after ALE has been loaded.
|
||||||
|
|
||||||
|
```vim
|
||||||
|
" In ~/.vim/vimrc, or somewhere similar.
|
||||||
let g:ale_linters = {
|
let g:ale_linters = {
|
||||||
\ 'javascript': ['eslint'],
|
\ 'javascript': ['eslint'],
|
||||||
\}
|
\}
|
||||||
@@ -356,6 +435,14 @@ be run for those languages, just as when the dictionary is not defined.
|
|||||||
Running many linters should not typically obstruct editing in Vim,
|
Running many linters should not typically obstruct editing in Vim,
|
||||||
as they will all be executed in separate processes simultaneously.
|
as they will all be executed in separate processes simultaneously.
|
||||||
|
|
||||||
|
If you don't want ALE to run anything other than what you've explicitly asked
|
||||||
|
for, you can set `g:ale_linters_explicit` to `1`.
|
||||||
|
|
||||||
|
```vim
|
||||||
|
" Only run linters named in ale_linters settings.
|
||||||
|
let g:ale_linters_explicit = 1
|
||||||
|
```
|
||||||
|
|
||||||
This plugin will look for linters in the [`ale_linters`](ale_linters) directory.
|
This plugin will look for linters in the [`ale_linters`](ale_linters) directory.
|
||||||
Each directory within corresponds to a particular filetype in Vim, and each file
|
Each directory within corresponds to a particular filetype in Vim, and each file
|
||||||
in each directory corresponds to the name of a particular linter.
|
in each directory corresponds to the name of a particular linter.
|
||||||
@@ -474,6 +561,8 @@ There are 3 global options that allow customizing the echoed message.
|
|||||||
|
|
||||||
- `g:ale_echo_msg_format` where:
|
- `g:ale_echo_msg_format` where:
|
||||||
* `%s` is the error message itself
|
* `%s` is the error message itself
|
||||||
|
* `%...code...%` is an optional error code, and most characters can be
|
||||||
|
written between the `%` characters.
|
||||||
* `%linter%` is the linter name
|
* `%linter%` is the linter name
|
||||||
* `%severity` is the severity type
|
* `%severity` is the severity type
|
||||||
- `g:ale_echo_msg_error_str` is the string used for error severity.
|
- `g:ale_echo_msg_error_str` is the string used for error severity.
|
||||||
@@ -491,20 +580,28 @@ Will give you:
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
See `:help g:ale_echo_msg_format` for more information.
|
||||||
|
|
||||||
<a name="faq-autocmd"></a>
|
<a name="faq-autocmd"></a>
|
||||||
|
|
||||||
### 5.viii. How can I execute some code when ALE starts or stops linting?
|
### 5.viii. How can I execute some code when ALE starts or stops linting?
|
||||||
|
|
||||||
ALE runs its own [autocmd](http://vimdoc.sourceforge.net/htmldoc/autocmd.html)
|
ALE runs its own [autocmd](http://vimdoc.sourceforge.net/htmldoc/autocmd.html)
|
||||||
events whenever has a linter is started and has been successfully executed and
|
events when a lint or fix cycle are started and stopped. There is also an event
|
||||||
processed. These events can be used to call arbitrary functions before and after
|
that runs when a linter job has been successfully started. These events can be
|
||||||
ALE stops linting.
|
used to call arbitrary functions during these respective parts of the ALE's
|
||||||
|
operation.
|
||||||
|
|
||||||
```vim
|
```vim
|
||||||
augroup YourGroup
|
augroup YourGroup
|
||||||
autocmd!
|
autocmd!
|
||||||
autocmd User ALELintPre call YourFunction()
|
autocmd User ALELintPre call YourFunction()
|
||||||
autocmd User ALELintPost call YourFunction()
|
autocmd User ALELintPost call YourFunction()
|
||||||
|
|
||||||
|
autocmd User ALEJobStarted call YourFunction()
|
||||||
|
|
||||||
|
autocmd User ALEFixPre call YourFunction()
|
||||||
|
autocmd User ALEFixPost call YourFunction()
|
||||||
augroup END
|
augroup END
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -571,6 +668,9 @@ let g:ale_open_list = 1
|
|||||||
let g:ale_keep_list_window_open = 1
|
let g:ale_keep_list_window_open = 1
|
||||||
```
|
```
|
||||||
|
|
||||||
|
You can also set `let g:ale_list_vertical = 1` to open the windows vertically
|
||||||
|
instead of the default horizontally.
|
||||||
|
|
||||||
<a name="faq-jsx-stylelint-eslint"></a>
|
<a name="faq-jsx-stylelint-eslint"></a>
|
||||||
|
|
||||||
### 5.xii. How can I check JSX files with both stylelint and eslint?
|
### 5.xii. How can I check JSX files with both stylelint and eslint?
|
||||||
@@ -592,9 +692,18 @@ augroup END
|
|||||||
```
|
```
|
||||||
|
|
||||||
Supposing the filetype has been set correctly, you can set the following
|
Supposing the filetype has been set correctly, you can set the following
|
||||||
options in your vimrc file:
|
options in a jsx.vim ftplugin file.
|
||||||
|
|
||||||
```vim
|
```vim
|
||||||
|
" In ~/.vim/ftplugin/jsx.vim, or somewhere similar.
|
||||||
|
let b:ale_linters = ['stylelint', 'eslint']
|
||||||
|
let b:ale_linter_aliases = ['css']
|
||||||
|
```
|
||||||
|
|
||||||
|
Or if you want, you can configure the linters from your vimrc file.
|
||||||
|
|
||||||
|
```vim
|
||||||
|
" In ~/.vim/vimrc, or somewhere similar.
|
||||||
let g:ale_linters = {'jsx': ['stylelint', 'eslint']}
|
let g:ale_linters = {'jsx': ['stylelint', 'eslint']}
|
||||||
let g:ale_linter_aliases = {'jsx': 'css'}
|
let g:ale_linter_aliases = {'jsx': 'css'}
|
||||||
```
|
```
|
||||||
@@ -689,3 +798,14 @@ let g:ale_pattern_options_enabled = 1
|
|||||||
```
|
```
|
||||||
|
|
||||||
Buffer-local variables for settings always override the global settings.
|
Buffer-local variables for settings always override the global settings.
|
||||||
|
|
||||||
|
<a name="faq-list-window-height"></a>
|
||||||
|
|
||||||
|
### 5.xvi. How can I configure the height of the list in which ALE displays errors?
|
||||||
|
|
||||||
|
To set a default height for the error list, use the `g:ale_list_window_size` variable.
|
||||||
|
|
||||||
|
```vim
|
||||||
|
" Show 5 lines of errors (default: 10)
|
||||||
|
let g:ale_list_window_size = 5
|
||||||
|
```
|
||||||
|
|||||||
@@ -1,37 +0,0 @@
|
|||||||
" Author: w0rp <devw0rp@gmail.com>
|
|
||||||
" Description: Follow-up checks for the plugin: warn about conflicting plugins.
|
|
||||||
|
|
||||||
" A flag for ensuring that this is not run more than one time.
|
|
||||||
if exists('g:loaded_ale_after')
|
|
||||||
finish
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Set the flag so this file is not run more than one time.
|
|
||||||
let g:loaded_ale_after = 1
|
|
||||||
|
|
||||||
" Check if the flag is available and set to 0 to disable checking for and
|
|
||||||
" emitting conflicting plugin warnings.
|
|
||||||
if exists('g:ale_emit_conflict_warnings') && !g:ale_emit_conflict_warnings
|
|
||||||
finish
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Conflicting Plugins Checks
|
|
||||||
|
|
||||||
function! s:GetConflictingPluginWarning(plugin_name) abort
|
|
||||||
return 'ALE conflicts with ' . a:plugin_name
|
|
||||||
\ . '. Uninstall it, or disable this warning with '
|
|
||||||
\ . '`let g:ale_emit_conflict_warnings = 0` in your vimrc file, '
|
|
||||||
\ . '*before* plugins are loaded.'
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
if exists('g:loaded_syntastic_plugin')
|
|
||||||
throw s:GetConflictingPluginWarning('Syntastic')
|
|
||||||
endif
|
|
||||||
|
|
||||||
if exists('g:loaded_neomake')
|
|
||||||
throw s:GetConflictingPluginWarning('Neomake')
|
|
||||||
endif
|
|
||||||
|
|
||||||
if exists('g:loaded_validator_plugin')
|
|
||||||
throw s:GetConflictingPluginWarning('Validator')
|
|
||||||
endif
|
|
||||||
@@ -12,7 +12,11 @@ function! ale_linters#awk#gawk#GetExecutable(buffer) abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! ale_linters#awk#gawk#GetCommand(buffer) abort
|
function! ale_linters#awk#gawk#GetCommand(buffer) abort
|
||||||
|
" note the --source 'BEGIN ...' is to prevent
|
||||||
|
" gawk from attempting to execute the body of the script
|
||||||
|
" it is linting.
|
||||||
return ale_linters#awk#gawk#GetExecutable(a:buffer)
|
return ale_linters#awk#gawk#GetExecutable(a:buffer)
|
||||||
|
\ . " --source 'BEGIN { exit } END { exit 1 }'"
|
||||||
\ . ' ' . ale#Var(a:buffer, 'awk_gawk_options')
|
\ . ' ' . ale#Var(a:buffer, 'awk_gawk_options')
|
||||||
\ . ' ' . '-f %t --lint /dev/null'
|
\ . ' ' . '-f %t --lint /dev/null'
|
||||||
endfunction
|
endfunction
|
||||||
@@ -21,6 +25,6 @@ call ale#linter#Define('awk', {
|
|||||||
\ 'name': 'gawk',
|
\ 'name': 'gawk',
|
||||||
\ 'executable_callback': 'ale_linters#awk#gawk#GetExecutable',
|
\ 'executable_callback': 'ale_linters#awk#gawk#GetExecutable',
|
||||||
\ 'command_callback': 'ale_linters#awk#gawk#GetCommand',
|
\ 'command_callback': 'ale_linters#awk#gawk#GetCommand',
|
||||||
\ 'callback': 'ale#handlers#cpplint#HandleCppLintFormat',
|
\ 'callback': 'ale#handlers#gawk#HandleGawkFormat',
|
||||||
\ 'output_stream': 'both'
|
\ 'output_stream': 'both'
|
||||||
\})
|
\})
|
||||||
|
|||||||
@@ -8,15 +8,15 @@ function! ale_linters#c#clang#GetExecutable(buffer) abort
|
|||||||
return ale#Var(a:buffer, 'c_clang_executable')
|
return ale#Var(a:buffer, 'c_clang_executable')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! ale_linters#c#clang#GetCommand(buffer) abort
|
function! ale_linters#c#clang#GetCommand(buffer, output) abort
|
||||||
let l:paths = ale#c#FindLocalHeaderPaths(a:buffer)
|
let l:cflags = ale#c#GetCFlags(a:buffer, a:output)
|
||||||
|
|
||||||
" -iquote with the directory the file is in makes #include work for
|
" -iquote with the directory the file is in makes #include work for
|
||||||
" headers in the same directory.
|
" headers in the same directory.
|
||||||
return ale#Escape(ale_linters#c#clang#GetExecutable(a:buffer))
|
return ale#Escape(ale_linters#c#clang#GetExecutable(a:buffer))
|
||||||
\ . ' -S -x c -fsyntax-only '
|
\ . ' -S -x c -fsyntax-only '
|
||||||
\ . '-iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h')) . ' '
|
\ . '-iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h')) . ' '
|
||||||
\ . ale#c#IncludeOptions(l:paths)
|
\ . l:cflags
|
||||||
\ . ale#Var(a:buffer, 'c_clang_options') . ' -'
|
\ . ale#Var(a:buffer, 'c_clang_options') . ' -'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@@ -24,6 +24,9 @@ call ale#linter#Define('c', {
|
|||||||
\ 'name': 'clang',
|
\ 'name': 'clang',
|
||||||
\ 'output_stream': 'stderr',
|
\ 'output_stream': 'stderr',
|
||||||
\ 'executable_callback': 'ale_linters#c#clang#GetExecutable',
|
\ 'executable_callback': 'ale_linters#c#clang#GetExecutable',
|
||||||
\ 'command_callback': 'ale_linters#c#clang#GetCommand',
|
\ 'command_chain': [
|
||||||
|
\ {'callback': 'ale#c#GetMakeCommand', 'output_stream': 'stdout'},
|
||||||
|
\ {'callback': 'ale_linters#c#clang#GetCommand'}
|
||||||
|
\ ],
|
||||||
\ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
|
\ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
|
||||||
\})
|
\})
|
||||||
|
|||||||
31
ale_linters/c/flawfinder.vim
Normal file
31
ale_linters/c/flawfinder.vim
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
" Author: Christian Gibbons <cgibbons@gmu.edu>
|
||||||
|
" Description: flawfinder linter for c files
|
||||||
|
|
||||||
|
call ale#Set('c_flawfinder_executable', 'flawfinder')
|
||||||
|
call ale#Set('c_flawfinder_options', '')
|
||||||
|
call ale#Set('c_flawfinder_minlevel', 1)
|
||||||
|
call ale#Set('c_flawfinder_error_severity', 6)
|
||||||
|
|
||||||
|
function! ale_linters#c#flawfinder#GetExecutable(buffer) abort
|
||||||
|
return ale#Var(a:buffer, 'c_flawfinder_executable')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#c#flawfinder#GetCommand(buffer) abort
|
||||||
|
|
||||||
|
" Set the minimum vulnerability level for flawfinder to bother with
|
||||||
|
let l:minlevel = ' --minlevel=' . ale#Var(a:buffer, 'c_flawfinder_minlevel')
|
||||||
|
|
||||||
|
return ale#Escape(ale_linters#c#flawfinder#GetExecutable(a:buffer))
|
||||||
|
\ . ' -CDQS'
|
||||||
|
\ . ale#Var(a:buffer, 'c_flawfinder_options')
|
||||||
|
\ . l:minlevel
|
||||||
|
\ . ' %t'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('c', {
|
||||||
|
\ 'name': 'flawfinder',
|
||||||
|
\ 'output_stream': 'stdout',
|
||||||
|
\ 'executable_callback': 'ale_linters#c#flawfinder#GetExecutable',
|
||||||
|
\ 'command_callback': 'ale_linters#c#flawfinder#GetCommand',
|
||||||
|
\ 'callback': 'ale#handlers#flawfinder#HandleFlawfinderFormat',
|
||||||
|
\})
|
||||||
@@ -8,15 +8,15 @@ function! ale_linters#c#gcc#GetExecutable(buffer) abort
|
|||||||
return ale#Var(a:buffer, 'c_gcc_executable')
|
return ale#Var(a:buffer, 'c_gcc_executable')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! ale_linters#c#gcc#GetCommand(buffer) abort
|
function! ale_linters#c#gcc#GetCommand(buffer, output) abort
|
||||||
let l:paths = ale#c#FindLocalHeaderPaths(a:buffer)
|
let l:cflags = ale#c#GetCFlags(a:buffer, a:output)
|
||||||
|
|
||||||
" -iquote with the directory the file is in makes #include work for
|
" -iquote with the directory the file is in makes #include work for
|
||||||
" headers in the same directory.
|
" headers in the same directory.
|
||||||
return ale#Escape(ale_linters#c#gcc#GetExecutable(a:buffer))
|
return ale#Escape(ale_linters#c#gcc#GetExecutable(a:buffer))
|
||||||
\ . ' -S -x c -fsyntax-only '
|
\ . ' -S -x c -fsyntax-only '
|
||||||
\ . '-iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h')) . ' '
|
\ . '-iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h')) . ' '
|
||||||
\ . ale#c#IncludeOptions(l:paths)
|
\ . l:cflags
|
||||||
\ . ale#Var(a:buffer, 'c_gcc_options') . ' -'
|
\ . ale#Var(a:buffer, 'c_gcc_options') . ' -'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@@ -24,6 +24,9 @@ call ale#linter#Define('c', {
|
|||||||
\ 'name': 'gcc',
|
\ 'name': 'gcc',
|
||||||
\ 'output_stream': 'stderr',
|
\ 'output_stream': 'stderr',
|
||||||
\ 'executable_callback': 'ale_linters#c#gcc#GetExecutable',
|
\ 'executable_callback': 'ale_linters#c#gcc#GetExecutable',
|
||||||
\ 'command_callback': 'ale_linters#c#gcc#GetCommand',
|
\ 'command_chain': [
|
||||||
|
\ {'callback': 'ale#c#GetMakeCommand', 'output_stream': 'stdout'},
|
||||||
|
\ {'callback': 'ale_linters#c#gcc#GetCommand'}
|
||||||
|
\ ],
|
||||||
\ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
|
\ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
|
||||||
\})
|
\})
|
||||||
|
|||||||
@@ -8,15 +8,15 @@ function! ale_linters#cpp#clang#GetExecutable(buffer) abort
|
|||||||
return ale#Var(a:buffer, 'cpp_clang_executable')
|
return ale#Var(a:buffer, 'cpp_clang_executable')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! ale_linters#cpp#clang#GetCommand(buffer) abort
|
function! ale_linters#cpp#clang#GetCommand(buffer, output) abort
|
||||||
let l:paths = ale#c#FindLocalHeaderPaths(a:buffer)
|
let l:cflags = ale#c#GetCFlags(a:buffer, a:output)
|
||||||
|
|
||||||
" -iquote with the directory the file is in makes #include work for
|
" -iquote with the directory the file is in makes #include work for
|
||||||
" headers in the same directory.
|
" headers in the same directory.
|
||||||
return ale#Escape(ale_linters#cpp#clang#GetExecutable(a:buffer))
|
return ale#Escape(ale_linters#cpp#clang#GetExecutable(a:buffer))
|
||||||
\ . ' -S -x c++ -fsyntax-only '
|
\ . ' -S -x c++ -fsyntax-only '
|
||||||
\ . '-iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h')) . ' '
|
\ . '-iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h')) . ' '
|
||||||
\ . ale#c#IncludeOptions(l:paths)
|
\ . l:cflags
|
||||||
\ . ale#Var(a:buffer, 'cpp_clang_options') . ' -'
|
\ . ale#Var(a:buffer, 'cpp_clang_options') . ' -'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@@ -24,6 +24,9 @@ call ale#linter#Define('cpp', {
|
|||||||
\ 'name': 'clang',
|
\ 'name': 'clang',
|
||||||
\ 'output_stream': 'stderr',
|
\ 'output_stream': 'stderr',
|
||||||
\ 'executable_callback': 'ale_linters#cpp#clang#GetExecutable',
|
\ 'executable_callback': 'ale_linters#cpp#clang#GetExecutable',
|
||||||
\ 'command_callback': 'ale_linters#cpp#clang#GetCommand',
|
\ 'command_chain': [
|
||||||
|
\ {'callback': 'ale#c#GetMakeCommand', 'output_stream': 'stdout'},
|
||||||
|
\ {'callback': 'ale_linters#cpp#clang#GetCommand'},
|
||||||
|
\ ],
|
||||||
\ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
|
\ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
|
||||||
\})
|
\})
|
||||||
|
|||||||
@@ -24,9 +24,9 @@ function! ale_linters#cpp#clangcheck#GetCommand(buffer) abort
|
|||||||
" detected.
|
" detected.
|
||||||
return ale#Escape(ale_linters#cpp#clangcheck#GetExecutable(a:buffer))
|
return ale#Escape(ale_linters#cpp#clangcheck#GetExecutable(a:buffer))
|
||||||
\ . ' -analyze %s'
|
\ . ' -analyze %s'
|
||||||
|
\ . (empty(l:build_dir) ? ' -extra-arg -Xclang -extra-arg -analyzer-output=text' : '')
|
||||||
\ . (!empty(l:user_options) ? ' ' . l:user_options : '')
|
\ . (!empty(l:user_options) ? ' ' . l:user_options : '')
|
||||||
\ . (!empty(l:build_dir) ? ' -p ' . ale#Escape(l:build_dir) : '')
|
\ . (!empty(l:build_dir) ? ' -p ' . ale#Escape(l:build_dir) : '')
|
||||||
\ . (empty(l:build_dir) ? ' -extra-arg -Xanalyzer -extra-arg -analyzer-output=text' : '')
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
call ale#linter#Define('cpp', {
|
call ale#linter#Define('cpp', {
|
||||||
|
|||||||
31
ale_linters/cpp/flawfinder.vim
Normal file
31
ale_linters/cpp/flawfinder.vim
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
" Author: Christian Gibbons <cgibbons@gmu.edu>
|
||||||
|
" Description: flawfinder linter for c++ files
|
||||||
|
|
||||||
|
call ale#Set('cpp_flawfinder_executable', 'flawfinder')
|
||||||
|
call ale#Set('cpp_flawfinder_options', '')
|
||||||
|
call ale#Set('cpp_flawfinder_minlevel', 1)
|
||||||
|
call ale#Set('c_flawfinder_error_severity', 6)
|
||||||
|
|
||||||
|
function! ale_linters#cpp#flawfinder#GetExecutable(buffer) abort
|
||||||
|
return ale#Var(a:buffer, 'cpp_flawfinder_executable')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#cpp#flawfinder#GetCommand(buffer) abort
|
||||||
|
|
||||||
|
" Set the minimum vulnerability level for flawfinder to bother with
|
||||||
|
let l:minlevel = ' --minlevel=' . ale#Var(a:buffer, 'cpp_flawfinder_minlevel')
|
||||||
|
|
||||||
|
return ale#Escape(ale_linters#cpp#flawfinder#GetExecutable(a:buffer))
|
||||||
|
\ . ' -CDQS'
|
||||||
|
\ . ale#Var(a:buffer, 'cpp_flawfinder_options')
|
||||||
|
\ . l:minlevel
|
||||||
|
\ . ' %t'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('cpp', {
|
||||||
|
\ 'name': 'flawfinder',
|
||||||
|
\ 'output_stream': 'stdout',
|
||||||
|
\ 'executable_callback': 'ale_linters#cpp#flawfinder#GetExecutable',
|
||||||
|
\ 'command_callback': 'ale_linters#cpp#flawfinder#GetCommand',
|
||||||
|
\ 'callback': 'ale#handlers#flawfinder#HandleFlawfinderFormat',
|
||||||
|
\})
|
||||||
@@ -8,22 +8,26 @@ function! ale_linters#cpp#gcc#GetExecutable(buffer) abort
|
|||||||
return ale#Var(a:buffer, 'cpp_gcc_executable')
|
return ale#Var(a:buffer, 'cpp_gcc_executable')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! ale_linters#cpp#gcc#GetCommand(buffer) abort
|
function! ale_linters#cpp#gcc#GetCommand(buffer, output) abort
|
||||||
let l:paths = ale#c#FindLocalHeaderPaths(a:buffer)
|
let l:cflags = ale#c#GetCFlags(a:buffer, a:output)
|
||||||
|
|
||||||
" -iquote with the directory the file is in makes #include work for
|
" -iquote with the directory the file is in makes #include work for
|
||||||
" headers in the same directory.
|
" headers in the same directory.
|
||||||
return ale#Escape(ale_linters#cpp#gcc#GetExecutable(a:buffer))
|
return ale#Escape(ale_linters#cpp#gcc#GetExecutable(a:buffer))
|
||||||
\ . ' -S -x c++ -fsyntax-only '
|
\ . ' -S -x c++ -fsyntax-only '
|
||||||
\ . '-iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h')) . ' '
|
\ . '-iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h')) . ' '
|
||||||
\ . ale#c#IncludeOptions(l:paths)
|
\ . l:cflags
|
||||||
\ . ale#Var(a:buffer, 'cpp_gcc_options') . ' -'
|
\ . ale#Var(a:buffer, 'cpp_gcc_options') . ' -'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
call ale#linter#Define('cpp', {
|
call ale#linter#Define('cpp', {
|
||||||
\ 'name': 'g++',
|
\ 'name': 'gcc',
|
||||||
|
\ 'aliases': ['g++'],
|
||||||
\ 'output_stream': 'stderr',
|
\ 'output_stream': 'stderr',
|
||||||
\ 'executable_callback': 'ale_linters#cpp#gcc#GetExecutable',
|
\ 'executable_callback': 'ale_linters#cpp#gcc#GetExecutable',
|
||||||
\ 'command_callback': 'ale_linters#cpp#gcc#GetCommand',
|
\ 'command_chain': [
|
||||||
|
\ {'callback': 'ale#c#GetMakeCommand', 'output_stream': 'stdout'},
|
||||||
|
\ {'callback': 'ale_linters#cpp#gcc#GetCommand'},
|
||||||
|
\ ],
|
||||||
\ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
|
\ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
|
||||||
\})
|
\})
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ function! s:GetWorkingDirectory(buffer) abort
|
|||||||
return l:working_directory
|
return l:working_directory
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return fnamemodify(bufname(a:buffer), ':p:h')
|
return expand('#' . a:buffer . ':p:h')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! ale_linters#cs#mcsc#GetCommand(buffer) abort
|
function! ale_linters#cs#mcsc#GetCommand(buffer) abort
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
call ale#Set('css_stylelint_executable', 'stylelint')
|
call ale#Set('css_stylelint_executable', 'stylelint')
|
||||||
call ale#Set('css_stylelint_options', '')
|
call ale#Set('css_stylelint_options', '')
|
||||||
call ale#Set('css_stylelint_use_global', 0)
|
call ale#Set('css_stylelint_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||||
|
|
||||||
function! ale_linters#css#stylelint#GetExecutable(buffer) abort
|
function! ale_linters#css#stylelint#GetExecutable(buffer) abort
|
||||||
return ale#node#FindExecutable(a:buffer, 'css_stylelint', [
|
return ale#node#FindExecutable(a:buffer, 'css_stylelint', [
|
||||||
|
|||||||
45
ale_linters/cucumber/cucumber.vim
Normal file
45
ale_linters/cucumber/cucumber.vim
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
" Author: Eddie Lebow https://github.com/elebow
|
||||||
|
" Description: Cucumber, a BDD test tool
|
||||||
|
|
||||||
|
function! ale_linters#cucumber#cucumber#GetCommand(buffer) abort
|
||||||
|
let l:features_dir = ale#path#FindNearestDirectory(a:buffer, 'features')
|
||||||
|
|
||||||
|
if !empty(l:features_dir)
|
||||||
|
let l:features_arg = '-r ' . ale#Escape(l:features_dir)
|
||||||
|
else
|
||||||
|
let l:features_arg = ''
|
||||||
|
endif
|
||||||
|
|
||||||
|
return 'cucumber --dry-run --quiet --strict --format=json '
|
||||||
|
\ . l:features_arg . ' %t'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#cucumber#cucumber#Handle(buffer, lines) abort
|
||||||
|
try
|
||||||
|
let l:json = ale#util#FuzzyJSONDecode(a:lines, {})[0]
|
||||||
|
catch
|
||||||
|
return []
|
||||||
|
endtry
|
||||||
|
|
||||||
|
let l:output = []
|
||||||
|
for l:element in get(l:json, 'elements', [])
|
||||||
|
for l:step in l:element['steps']
|
||||||
|
if l:step['result']['status'] is# 'undefined'
|
||||||
|
call add(l:output, {
|
||||||
|
\ 'lnum': l:step['line'],
|
||||||
|
\ 'code': 'E',
|
||||||
|
\ 'text': 'Undefined step'
|
||||||
|
\})
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
endfor
|
||||||
|
|
||||||
|
return l:output
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('cucumber', {
|
||||||
|
\ 'name': 'cucumber',
|
||||||
|
\ 'executable': 'cucumber',
|
||||||
|
\ 'command_callback': 'ale_linters#cucumber#cucumber#GetCommand',
|
||||||
|
\ 'callback': 'ale_linters#cucumber#cucumber#Handle'
|
||||||
|
\})
|
||||||
@@ -46,7 +46,7 @@ function! ale_linters#d#dmd#DMDCommand(buffer, dub_output) abort
|
|||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
return 'dmd '. join(l:import_list) . ' -o- -vcolumns -c %t'
|
return 'dmd '. join(l:import_list) . ' -o- -wi -vcolumns -c %t'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! ale_linters#d#dmd#Handle(buffer, lines) abort
|
function! ale_linters#d#dmd#Handle(buffer, lines) abort
|
||||||
|
|||||||
@@ -7,10 +7,6 @@ function! ale_linters#dart#language_server#GetExecutable(buffer) abort
|
|||||||
return ale#Var(a:buffer, 'dart_language_server_executable')
|
return ale#Var(a:buffer, 'dart_language_server_executable')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! ale_linters#dart#language_server#GetLanguage(buffer) abort
|
|
||||||
return 'dart'
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! ale_linters#dart#language_server#GetProjectRoot(buffer) abort
|
function! ale_linters#dart#language_server#GetProjectRoot(buffer) abort
|
||||||
" Note: pub only looks for pubspec.yaml, there's no point in adding
|
" Note: pub only looks for pubspec.yaml, there's no point in adding
|
||||||
" support for pubspec.yml
|
" support for pubspec.yml
|
||||||
@@ -24,7 +20,6 @@ call ale#linter#Define('dart', {
|
|||||||
\ 'lsp': 'stdio',
|
\ 'lsp': 'stdio',
|
||||||
\ 'executable_callback': 'ale_linters#dart#language_server#GetExecutable',
|
\ 'executable_callback': 'ale_linters#dart#language_server#GetExecutable',
|
||||||
\ 'command_callback': 'ale_linters#dart#language_server#GetExecutable',
|
\ 'command_callback': 'ale_linters#dart#language_server#GetExecutable',
|
||||||
\ 'language_callback': 'ale_linters#dart#language_server#GetLanguage',
|
\ 'language': 'dart',
|
||||||
\ 'project_root_callback': 'ale_linters#dart#language_server#GetProjectRoot',
|
\ 'project_root_callback': 'ale_linters#dart#language_server#GetProjectRoot',
|
||||||
\})
|
\})
|
||||||
|
|
||||||
|
|||||||
@@ -2,31 +2,51 @@
|
|||||||
|
|
||||||
" always, yes, never
|
" always, yes, never
|
||||||
call ale#Set('dockerfile_hadolint_use_docker', 'never')
|
call ale#Set('dockerfile_hadolint_use_docker', 'never')
|
||||||
call ale#Set('dockerfile_hadolint_docker_image', 'lukasmartinelli/hadolint')
|
call ale#Set('dockerfile_hadolint_docker_image', 'hadolint/hadolint')
|
||||||
|
|
||||||
function! ale_linters#dockerfile#hadolint#Handle(buffer, lines) abort
|
function! ale_linters#dockerfile#hadolint#Handle(buffer, lines) abort
|
||||||
" Matches patterns line the following:
|
" Matches patterns line the following:
|
||||||
"
|
"
|
||||||
" stdin:19: F: Pipe chain should start with a raw value.
|
" /dev/stdin:19 DL3001 Pipe chain should start with a raw value.
|
||||||
let l:pattern = '\v^/dev/stdin:?(\d+)? (\S+) (.+)$'
|
" /dev/stdin:19:3 unexpected thing
|
||||||
|
let l:pattern = '\v^/dev/stdin:(\d+):?(\d+)? ((DL|SC)(\d+) )?(.+)$'
|
||||||
let l:output = []
|
let l:output = []
|
||||||
|
|
||||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||||
let l:lnum = 0
|
let l:lnum = 0
|
||||||
|
let l:colnum = 0
|
||||||
|
|
||||||
if l:match[1] isnot# ''
|
if l:match[1] isnot# ''
|
||||||
let l:lnum = l:match[1] + 0
|
let l:lnum = l:match[1] + 0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if l:match[2] isnot# ''
|
||||||
|
let l:colnum = l:match[2] + 0
|
||||||
|
endif
|
||||||
|
|
||||||
let l:type = 'W'
|
let l:type = 'W'
|
||||||
let l:text = l:match[3]
|
let l:text = l:match[6]
|
||||||
|
let l:detail = l:match[6]
|
||||||
|
let l:domain = 'https://github.com/hadolint/hadolint/wiki/'
|
||||||
|
|
||||||
|
if l:match[4] is# 'SC'
|
||||||
|
let l:domain = 'https://github.com/koalaman/shellcheck/wiki/'
|
||||||
|
endif
|
||||||
|
|
||||||
|
if l:match[5] isnot# ''
|
||||||
|
let l:code = l:match[4] . l:match[5]
|
||||||
|
let l:link = ' ( ' . l:domain . l:code . ' )'
|
||||||
|
let l:detail = l:code . l:link . "\n\n" . l:detail
|
||||||
|
else
|
||||||
|
let l:type = 'E'
|
||||||
|
endif
|
||||||
|
|
||||||
call add(l:output, {
|
call add(l:output, {
|
||||||
\ 'lnum': l:lnum,
|
\ 'lnum': l:lnum,
|
||||||
\ 'col': 0,
|
\ 'col': l:colnum,
|
||||||
\ 'type': l:type,
|
\ 'type': l:type,
|
||||||
\ 'text': l:text,
|
\ 'text': l:text,
|
||||||
\ 'nr': l:match[2],
|
\ 'detail': l:detail
|
||||||
\})
|
\})
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,6 @@ endfunction
|
|||||||
call ale#linter#Define('elixir', {
|
call ale#linter#Define('elixir', {
|
||||||
\ 'name': 'credo',
|
\ 'name': 'credo',
|
||||||
\ 'executable': 'mix',
|
\ 'executable': 'mix',
|
||||||
\ 'command': 'mix credo suggest --format=flycheck --read-from-stdin %s',
|
\ 'command': 'mix help credo && mix credo suggest --format=flycheck --read-from-stdin %s',
|
||||||
\ 'callback': 'ale_linters#elixir#credo#Handle',
|
\ 'callback': 'ale_linters#elixir#credo#Handle',
|
||||||
\})
|
\})
|
||||||
|
|||||||
34
ale_linters/elixir/dialyxir.vim
Normal file
34
ale_linters/elixir/dialyxir.vim
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
" Author: Fran C. - https://github.com/franciscoj
|
||||||
|
" Description: Add dialyzer support for elixir through dialyxir
|
||||||
|
" https://github.com/jeremyjh/dialyxir
|
||||||
|
|
||||||
|
function! ale_linters#elixir#dialyxir#Handle(buffer, lines) abort
|
||||||
|
" Matches patterns line the following:
|
||||||
|
"
|
||||||
|
" lib/filename.ex:19: Function fname/1 has no local return
|
||||||
|
let l:pattern = '\v(.+):(\d+): (.+)$'
|
||||||
|
let l:output = []
|
||||||
|
let l:type = 'W'
|
||||||
|
|
||||||
|
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||||
|
if bufname(a:buffer) == l:match[1]
|
||||||
|
call add(l:output, {
|
||||||
|
\ 'bufnr': a:buffer,
|
||||||
|
\ 'lnum': l:match[2] + 0,
|
||||||
|
\ 'col': 0,
|
||||||
|
\ 'type': l:type,
|
||||||
|
\ 'text': l:match[3],
|
||||||
|
\})
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
|
||||||
|
return l:output
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('elixir', {
|
||||||
|
\ 'name': 'dialyxir',
|
||||||
|
\ 'executable': 'mix',
|
||||||
|
\ 'command': 'mix dialyzer',
|
||||||
|
\ 'callback': 'ale_linters#elixir#dialyxir#Handle',
|
||||||
|
\})
|
||||||
|
|
||||||
@@ -32,7 +32,7 @@ endfunction
|
|||||||
call ale#linter#Define('elixir', {
|
call ale#linter#Define('elixir', {
|
||||||
\ 'name': 'dogma',
|
\ 'name': 'dogma',
|
||||||
\ 'executable': 'mix',
|
\ 'executable': 'mix',
|
||||||
\ 'command': 'mix dogma %s --format=flycheck',
|
\ 'command': 'mix help dogma && mix dogma %s --format=flycheck',
|
||||||
\ 'lint_file': 1,
|
\ 'lint_file': 1,
|
||||||
\ 'callback': 'ale_linters#elixir#dogma#Handle',
|
\ 'callback': 'ale_linters#elixir#dogma#Handle',
|
||||||
\})
|
\})
|
||||||
|
|||||||
@@ -1,45 +1,26 @@
|
|||||||
" Author: buffalocoder - https://github.com/buffalocoder, soywod - https://github.com/soywod
|
" Author: buffalocoder - https://github.com/buffalocoder, soywod - https://github.com/soywod, hecrj - https://github.com/hecrj
|
||||||
" Description: Elm linting in Ale. Closely follows the Syntastic checker in https://github.com/ElmCast/elm-vim.
|
" Description: Elm linting in Ale. Closely follows the Syntastic checker in https://github.com/ElmCast/elm-vim.
|
||||||
|
|
||||||
call ale#Set('elm_make_executable', 'elm-make')
|
call ale#Set('elm_make_executable', 'elm')
|
||||||
call ale#Set('elm_make_use_global', 0)
|
call ale#Set('elm_make_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||||
|
|
||||||
function! ale_linters#elm#make#GetExecutable(buffer) abort
|
function! ale_linters#elm#make#GetExecutable(buffer) abort
|
||||||
return ale#node#FindExecutable(a:buffer, 'elm_make', [
|
return ale#node#FindExecutable(a:buffer, 'elm_make', [
|
||||||
\ 'node_modules/.bin/elm-make',
|
\ 'node_modules/.bin/elm',
|
||||||
\])
|
\])
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! ale_linters#elm#make#Handle(buffer, lines) abort
|
function! ale_linters#elm#make#Handle(buffer, lines) abort
|
||||||
let l:output = []
|
let l:output = []
|
||||||
let l:is_windows = has('win32')
|
|
||||||
let l:temp_dir = l:is_windows ? $TMP : $TMPDIR
|
|
||||||
let l:unparsed_lines = []
|
let l:unparsed_lines = []
|
||||||
|
|
||||||
for l:line in a:lines
|
for l:line in a:lines
|
||||||
if l:line[0] is# '['
|
if l:line[0] is# '{'
|
||||||
let l:errors = json_decode(l:line)
|
" Elm 0.19
|
||||||
|
call ale_linters#elm#make#HandleElm019Line(l:line, l:output)
|
||||||
for l:error in l:errors
|
elseif l:line[0] is# '['
|
||||||
" Check if file is from the temp directory.
|
" Elm 0.18
|
||||||
" Filters out any errors not related to the buffer.
|
call ale_linters#elm#make#HandleElm018Line(l:line, l:output)
|
||||||
if l:is_windows
|
|
||||||
let l:file_is_buffer = l:error.file[0:len(l:temp_dir) - 1] is? l:temp_dir
|
|
||||||
else
|
|
||||||
let l:file_is_buffer = l:error.file[0:len(l:temp_dir) - 1] is# l:temp_dir
|
|
||||||
endif
|
|
||||||
|
|
||||||
if l:file_is_buffer
|
|
||||||
call add(l:output, {
|
|
||||||
\ 'lnum': l:error.region.start.line,
|
|
||||||
\ 'col': l:error.region.start.column,
|
|
||||||
\ 'end_lnum': l:error.region.end.line,
|
|
||||||
\ 'end_col': l:error.region.end.column,
|
|
||||||
\ 'type': (l:error.type is? 'error') ? 'E' : 'W',
|
|
||||||
\ 'text': l:error.overview,
|
|
||||||
\ 'detail': l:error.overview . "\n\n" . l:error.details
|
|
||||||
\})
|
|
||||||
endif
|
|
||||||
endfor
|
|
||||||
elseif l:line isnot# 'Successfully generated /dev/null'
|
elseif l:line isnot# 'Successfully generated /dev/null'
|
||||||
call add(l:unparsed_lines, l:line)
|
call add(l:unparsed_lines, l:line)
|
||||||
endif
|
endif
|
||||||
@@ -57,23 +38,142 @@ function! ale_linters#elm#make#Handle(buffer, lines) abort
|
|||||||
return l:output
|
return l:output
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#elm#make#HandleElm019Line(line, output) abort
|
||||||
|
let l:report = json_decode(a:line)
|
||||||
|
|
||||||
|
if l:report.type is? 'error'
|
||||||
|
" General problem
|
||||||
|
let l:details = ale_linters#elm#make#ParseMessage(l:report.message)
|
||||||
|
|
||||||
|
if empty(l:report.path)
|
||||||
|
let l:report.path = 'Elm'
|
||||||
|
endif
|
||||||
|
|
||||||
|
if ale_linters#elm#make#FileIsBuffer(l:report.path)
|
||||||
|
call add(a:output, {
|
||||||
|
\ 'lnum': 1,
|
||||||
|
\ 'type': 'E',
|
||||||
|
\ 'text': l:details,
|
||||||
|
\})
|
||||||
|
else
|
||||||
|
call add(a:output, {
|
||||||
|
\ 'lnum': 1,
|
||||||
|
\ 'type': 'E',
|
||||||
|
\ 'text': l:report.path .' - '. l:details,
|
||||||
|
\ 'detail': l:report.path ." ----------\n\n". l:details,
|
||||||
|
\})
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
" Compilation errors
|
||||||
|
for l:error in l:report.errors
|
||||||
|
let l:file_is_buffer = ale_linters#elm#make#FileIsBuffer(l:error.path)
|
||||||
|
|
||||||
|
for l:problem in l:error.problems
|
||||||
|
let l:details = ale_linters#elm#make#ParseMessage(l:problem.message)
|
||||||
|
|
||||||
|
if l:file_is_buffer
|
||||||
|
" Buffer module has problems
|
||||||
|
call add(a:output, {
|
||||||
|
\ 'lnum': l:problem.region.start.line,
|
||||||
|
\ 'col': l:problem.region.start.column,
|
||||||
|
\ 'end_lnum': l:problem.region.end.line,
|
||||||
|
\ 'end_col': l:problem.region.end.column,
|
||||||
|
\ 'type': 'E',
|
||||||
|
\ 'text': l:details,
|
||||||
|
\})
|
||||||
|
else
|
||||||
|
" Imported module has problems
|
||||||
|
let l:location = l:error.path .':'. l:problem.region.start.line
|
||||||
|
call add(a:output, {
|
||||||
|
\ 'lnum': 1,
|
||||||
|
\ 'type': 'E',
|
||||||
|
\ 'text': l:location .' - '. l:details,
|
||||||
|
\ 'detail': l:location ." ----------\n\n". l:details,
|
||||||
|
\})
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
endfor
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#elm#make#HandleElm018Line(line, output) abort
|
||||||
|
let l:errors = json_decode(a:line)
|
||||||
|
|
||||||
|
for l:error in l:errors
|
||||||
|
let l:file_is_buffer = ale_linters#elm#make#FileIsBuffer(l:error.file)
|
||||||
|
|
||||||
|
if l:file_is_buffer
|
||||||
|
" Current buffer has problems
|
||||||
|
call add(a:output, {
|
||||||
|
\ 'lnum': l:error.region.start.line,
|
||||||
|
\ 'col': l:error.region.start.column,
|
||||||
|
\ 'end_lnum': l:error.region.end.line,
|
||||||
|
\ 'end_col': l:error.region.end.column,
|
||||||
|
\ 'type': (l:error.type is? 'error') ? 'E' : 'W',
|
||||||
|
\ 'text': l:error.overview,
|
||||||
|
\ 'detail': l:error.overview . "\n\n" . l:error.details
|
||||||
|
\})
|
||||||
|
elseif l:error.type is? 'error'
|
||||||
|
" Imported module has errors
|
||||||
|
let l:location = l:error.file .':'. l:error.region.start.line
|
||||||
|
|
||||||
|
call add(a:output, {
|
||||||
|
\ 'lnum': 1,
|
||||||
|
\ 'type': 'E',
|
||||||
|
\ 'text': l:location .' - '. l:error.overview,
|
||||||
|
\ 'detail': l:location ." ----------\n\n". l:error.overview . "\n\n" . l:error.details
|
||||||
|
\})
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#elm#make#FileIsBuffer(path) abort
|
||||||
|
let l:is_windows = has('win32')
|
||||||
|
let l:temp_dir = l:is_windows ? $TMP : $TMPDIR
|
||||||
|
|
||||||
|
if has('win32')
|
||||||
|
return a:path[0:len(l:temp_dir) - 1] is? l:temp_dir
|
||||||
|
else
|
||||||
|
return a:path[0:len(l:temp_dir) - 1] is# l:temp_dir
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#elm#make#ParseMessage(message) abort
|
||||||
|
return join(map(copy(a:message), 'ale_linters#elm#make#ParseMessageItem(v:val)'), '')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#elm#make#ParseMessageItem(item) abort
|
||||||
|
if type(a:item) == type('')
|
||||||
|
return a:item
|
||||||
|
else
|
||||||
|
return a:item.string
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
" Return the command to execute the linter in the projects directory.
|
" Return the command to execute the linter in the projects directory.
|
||||||
" If it doesn't, then this will fail when imports are needed.
|
" If it doesn't, then this will fail when imports are needed.
|
||||||
function! ale_linters#elm#make#GetCommand(buffer) abort
|
function! ale_linters#elm#make#GetCommand(buffer) abort
|
||||||
let l:elm_package = ale#path#FindNearestFile(a:buffer, 'elm-package.json')
|
let l:elm_json = ale#path#FindNearestFile(a:buffer, 'elm.json')
|
||||||
let l:elm_exe = ale_linters#elm#make#GetExecutable(a:buffer)
|
let l:elm_exe = ale_linters#elm#make#GetExecutable(a:buffer)
|
||||||
if empty(l:elm_package)
|
|
||||||
|
if empty(l:elm_json)
|
||||||
|
" Fallback to Elm 0.18
|
||||||
|
let l:elm_json = ale#path#FindNearestFile(a:buffer, 'elm-package.json')
|
||||||
|
endif
|
||||||
|
|
||||||
|
if empty(l:elm_json)
|
||||||
let l:dir_set_cmd = ''
|
let l:dir_set_cmd = ''
|
||||||
else
|
else
|
||||||
let l:root_dir = fnamemodify(l:elm_package, ':p:h')
|
let l:root_dir = fnamemodify(l:elm_json, ':p:h')
|
||||||
let l:dir_set_cmd = 'cd ' . ale#Escape(l:root_dir) . ' && '
|
let l:dir_set_cmd = 'cd ' . ale#Escape(l:root_dir) . ' && '
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" The elm-make compiler, at the time of this writing, uses '/dev/null' as
|
" The elm compiler, at the time of this writing, uses '/dev/null' as
|
||||||
" a sort of flag to tell the compiler not to generate an output file,
|
" a sort of flag to tell the compiler not to generate an output file,
|
||||||
" which is why this is hard coded here. It does not use NUL on Windows.
|
" which is why this is hard coded here.
|
||||||
" Source: https://github.com/elm-lang/elm-make/blob/master/src/Flags.hs
|
" Source: https://github.com/elm-lang/elm-compiler/blob/19d5a769b30ec0b2fc4475985abb4cd94cd1d6c3/builder/src/Generate/Output.hs#L253
|
||||||
let l:elm_cmd = ale#Escape(l:elm_exe)
|
let l:elm_cmd = ale#Escape(l:elm_exe)
|
||||||
|
\ . ' make'
|
||||||
\ . ' --report=json'
|
\ . ' --report=json'
|
||||||
\ . ' --output=/dev/null'
|
\ . ' --output=/dev/null'
|
||||||
|
|
||||||
|
|||||||
35
ale_linters/eruby/erubi.vim
Normal file
35
ale_linters/eruby/erubi.vim
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
" Author: Eddie Lebow https://github.com/elebow
|
||||||
|
" Description: eruby checker using `erubi`
|
||||||
|
|
||||||
|
function! ale_linters#eruby#erubi#CheckErubi(buffer) abort
|
||||||
|
return 'ruby -r erubi/capture_end -e ' . ale#Escape('""')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#eruby#erubi#GetCommand(buffer, check_erubi_output) abort
|
||||||
|
let l:rails_root = ale#ruby#FindRailsRoot(a:buffer)
|
||||||
|
|
||||||
|
if (!empty(a:check_erubi_output))
|
||||||
|
" The empty command in CheckErubi returns nothing if erubi runs and
|
||||||
|
" emits an error if erubi is not present
|
||||||
|
return ''
|
||||||
|
endif
|
||||||
|
|
||||||
|
if empty(l:rails_root)
|
||||||
|
return 'ruby -r erubi/capture_end -e ' . ale#Escape('puts Erubi::CaptureEndEngine.new($stdin.read).src') . '< %t | ruby -c'
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Rails-flavored eRuby does not comply with the standard as understood by
|
||||||
|
" Erubi, so we'll have to do some substitution. This does not reduce the
|
||||||
|
" effectiveness of the linter---the translated code is still evaluated.
|
||||||
|
return 'ruby -r erubi/capture_end -e ' . ale#Escape('puts Erubi::CaptureEndEngine.new($stdin.read.gsub(%{<%=},%{<%}), nil, %{-}).src') . '< %t | ruby -c'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('eruby', {
|
||||||
|
\ 'name': 'erubi',
|
||||||
|
\ 'executable': 'ruby',
|
||||||
|
\ 'command_chain': [
|
||||||
|
\ {'callback': 'ale_linters#eruby#erubi#CheckErubi'},
|
||||||
|
\ {'callback': 'ale_linters#eruby#erubi#GetCommand', 'output_stream': 'stderr'},
|
||||||
|
\ ],
|
||||||
|
\ 'callback': 'ale#handlers#ruby#HandleSyntaxErrors',
|
||||||
|
\})
|
||||||
67
ale_linters/fish/fish.vim
Normal file
67
ale_linters/fish/fish.vim
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
" Author: Niraj Thapaliya - https://github.com/nthapaliya
|
||||||
|
" Description: Lints fish files using fish -n
|
||||||
|
|
||||||
|
function! ale_linters#fish#fish#Handle(buffer, lines) abort
|
||||||
|
" Matches patterns such as:
|
||||||
|
"
|
||||||
|
" home/.config/fish/functions/foo.fish (line 1): Missing end to balance this function definition
|
||||||
|
" function foo
|
||||||
|
" ^
|
||||||
|
"
|
||||||
|
" OR, patterns such as:
|
||||||
|
"
|
||||||
|
" Unsupported use of '||'. In fish, please use 'COMMAND; or COMMAND'.
|
||||||
|
" /tmp/vLz620o/258/test.fish (line 2): if set -q SSH_CLIENT || set -q SSH_TTY
|
||||||
|
" ^
|
||||||
|
"
|
||||||
|
" fish -n can return errors in either format.
|
||||||
|
let l:pattern = '^\(.* (line \(\d\+\)): \)\(.*\)$'
|
||||||
|
let l:column_pattern = '^ *\^'
|
||||||
|
let l:output = []
|
||||||
|
let l:column_offset = 0
|
||||||
|
let l:last_line_with_message = ''
|
||||||
|
|
||||||
|
for l:line in a:lines
|
||||||
|
" Look for error lines first.
|
||||||
|
let l:match = matchlist(l:line, l:pattern)
|
||||||
|
|
||||||
|
if !empty(l:match)
|
||||||
|
if !empty(l:last_line_with_message)
|
||||||
|
let l:text = l:last_line_with_message
|
||||||
|
else
|
||||||
|
let l:text = l:match[3]
|
||||||
|
endif
|
||||||
|
|
||||||
|
let l:column_offset = len(l:match[1])
|
||||||
|
|
||||||
|
let l:last_line_with_message = ''
|
||||||
|
call add(l:output, {
|
||||||
|
\ 'col': 0,
|
||||||
|
\ 'lnum': str2nr(l:match[2]),
|
||||||
|
\ 'text': l:text,
|
||||||
|
\})
|
||||||
|
else
|
||||||
|
" Look for column markers like ' ^' second.
|
||||||
|
" The column index will be set according to how long the line is.
|
||||||
|
let l:column_match = matchstr(l:line, l:column_pattern)
|
||||||
|
|
||||||
|
if !empty(l:column_match) && !empty(l:output)
|
||||||
|
let l:output[-1].col = len(l:column_match) - l:column_offset
|
||||||
|
let l:last_line_with_message = ''
|
||||||
|
else
|
||||||
|
let l:last_line_with_message = l:line
|
||||||
|
let l:column_offset = 0
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
|
||||||
|
return l:output
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('fish', {
|
||||||
|
\ 'name': 'fish',
|
||||||
|
\ 'output_stream': 'stderr',
|
||||||
|
\ 'executable': 'fish',
|
||||||
|
\ 'command': 'fish -n %t',
|
||||||
|
\ 'callback': 'ale_linters#fish#fish#Handle',
|
||||||
|
\})
|
||||||
9
ale_linters/fountain/proselint.vim
Normal file
9
ale_linters/fountain/proselint.vim
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
" Author: Jansen Mitchell https://github.com/JansenMitchell
|
||||||
|
" Description: proselint for Fountain files
|
||||||
|
|
||||||
|
call ale#linter#Define('fountain', {
|
||||||
|
\ 'name': 'proselint',
|
||||||
|
\ 'executable': 'proselint',
|
||||||
|
\ 'command': 'proselint %t',
|
||||||
|
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
||||||
|
\})
|
||||||
52
ale_linters/gitcommit/gitlint.vim
Normal file
52
ale_linters/gitcommit/gitlint.vim
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
" Author: Nick Yamane <nick.diego@gmail.com>
|
||||||
|
" Description: gitlint for git commit message files
|
||||||
|
|
||||||
|
let g:ale_gitcommit_gitlint_executable =
|
||||||
|
\ get(g:, 'ale_gitcommit_gitlint_executable', 'gitlint')
|
||||||
|
let g:ale_gitcommit_gitlint_options = get(g:, 'ale_gitcommit_gitlint_options', '')
|
||||||
|
let g:ale_gitcommit_gitlint_use_global = get(g:, 'ale_gitcommit_gitlint_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||||
|
|
||||||
|
|
||||||
|
function! ale_linters#gitcommit#gitlint#GetExecutable(buffer) abort
|
||||||
|
return ale#python#FindExecutable(a:buffer, 'gitcommit_gitlint', ['gitlint'])
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#gitcommit#gitlint#GetCommand(buffer) abort
|
||||||
|
let l:options = ale#Var(a:buffer, 'gitcommit_gitlint_options')
|
||||||
|
let l:executable = ale_linters#gitcommit#gitlint#GetExecutable(a:buffer)
|
||||||
|
return ale#Escape(l:executable)
|
||||||
|
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||||
|
\ . ' lint'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
function! ale_linters#gitcommit#gitlint#Handle(buffer, lines) abort
|
||||||
|
" Matches patterns line the following:
|
||||||
|
let l:pattern = '\v^(\d+): (\w+) (.*)$'
|
||||||
|
let l:output = []
|
||||||
|
|
||||||
|
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||||
|
let l:code = l:match[2]
|
||||||
|
|
||||||
|
let l:item = {
|
||||||
|
\ 'lnum': l:match[1] + 0,
|
||||||
|
\ 'text': l:match[3],
|
||||||
|
\ 'code': l:code,
|
||||||
|
\ 'type': 'E',
|
||||||
|
\}
|
||||||
|
|
||||||
|
call add(l:output, l:item)
|
||||||
|
endfor
|
||||||
|
|
||||||
|
return l:output
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
call ale#linter#Define('gitcommit', {
|
||||||
|
\ 'name': 'gitlint',
|
||||||
|
\ 'output_stream': 'stderr',
|
||||||
|
\ 'executable_callback': 'ale_linters#gitcommit#gitlint#GetExecutable',
|
||||||
|
\ 'command_callback': 'ale_linters#gitcommit#gitlint#GetCommand',
|
||||||
|
\ 'callback': 'ale_linters#gitcommit#gitlint#Handle',
|
||||||
|
\})
|
||||||
|
|
||||||
@@ -18,10 +18,6 @@ function! ale_linters#glsl#glslls#GetCommand(buffer) abort
|
|||||||
return ale#Escape(l:executable) . l:logfile_args . ' --stdin'
|
return ale#Escape(l:executable) . l:logfile_args . ' --stdin'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! ale_linters#glsl#glslls#GetLanguage(buffer) abort
|
|
||||||
return 'glsl'
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! ale_linters#glsl#glslls#GetProjectRoot(buffer) abort
|
function! ale_linters#glsl#glslls#GetProjectRoot(buffer) abort
|
||||||
let l:project_root = ale#c#FindProjectRoot(a:buffer)
|
let l:project_root = ale#c#FindProjectRoot(a:buffer)
|
||||||
|
|
||||||
@@ -33,6 +29,6 @@ call ale#linter#Define('glsl', {
|
|||||||
\ 'lsp': 'stdio',
|
\ 'lsp': 'stdio',
|
||||||
\ 'executable_callback': 'ale_linters#glsl#glslls#GetExecutable',
|
\ 'executable_callback': 'ale_linters#glsl#glslls#GetExecutable',
|
||||||
\ 'command_callback': 'ale_linters#glsl#glslls#GetCommand',
|
\ 'command_callback': 'ale_linters#glsl#glslls#GetCommand',
|
||||||
\ 'language_callback': 'ale_linters#glsl#glslls#GetLanguage',
|
\ 'language': 'glsl',
|
||||||
\ 'project_root_callback': 'ale_linters#glsl#glslls#GetProjectRoot',
|
\ 'project_root_callback': 'ale_linters#glsl#glslls#GetProjectRoot',
|
||||||
\})
|
\})
|
||||||
|
|||||||
@@ -1,9 +1,14 @@
|
|||||||
" Author: Joshua Rubin <joshua@rubixconsulting.com>, Ben Reedy <https://github.com/breed808>,
|
" Author: Joshua Rubin <joshua@rubixconsulting.com>, Ben Reedy <https://github.com/breed808>,
|
||||||
" Jeff Willette <jrwillette88@gmail.com>
|
" Jeff Willette <jrwillette88@gmail.com>
|
||||||
" Description: go build for Go files
|
" Description: go build for Go files
|
||||||
|
|
||||||
" inspired by work from dzhou121 <dzhou121@gmail.com>
|
" inspired by work from dzhou121 <dzhou121@gmail.com>
|
||||||
|
|
||||||
|
call ale#Set('go_gobuild_options', '')
|
||||||
|
|
||||||
|
function! ale_linters#go#gobuild#ResetEnv() abort
|
||||||
|
unlet! s:go_env
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! ale_linters#go#gobuild#GoEnv(buffer) abort
|
function! ale_linters#go#gobuild#GoEnv(buffer) abort
|
||||||
if exists('s:go_env')
|
if exists('s:go_env')
|
||||||
return ''
|
return ''
|
||||||
@@ -13,6 +18,8 @@ function! ale_linters#go#gobuild#GoEnv(buffer) abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! ale_linters#go#gobuild#GetCommand(buffer, goenv_output) abort
|
function! ale_linters#go#gobuild#GetCommand(buffer, goenv_output) abort
|
||||||
|
let l:options = ale#Var(a:buffer, 'go_gobuild_options')
|
||||||
|
|
||||||
if !exists('s:go_env')
|
if !exists('s:go_env')
|
||||||
let s:go_env = {
|
let s:go_env = {
|
||||||
\ 'GOPATH': a:goenv_output[0],
|
\ 'GOPATH': a:goenv_output[0],
|
||||||
@@ -20,10 +27,16 @@ function! ale_linters#go#gobuild#GetCommand(buffer, goenv_output) abort
|
|||||||
\}
|
\}
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
let l:gopath_env_command = has('win32')
|
||||||
|
\ ? 'set GOPATH=' . ale#Escape(s:go_env.GOPATH) . ' && '
|
||||||
|
\ : 'GOPATH=' . ale#Escape(s:go_env.GOPATH) . ' '
|
||||||
|
|
||||||
" Run go test in local directory with relative path
|
" Run go test in local directory with relative path
|
||||||
return 'GOPATH=' . s:go_env.GOPATH
|
return l:gopath_env_command
|
||||||
\ . ' cd ' . fnamemodify(bufname(a:buffer), ':.:h')
|
\ . ale#path#BufferCdString(a:buffer)
|
||||||
\ . ' && go test -c -o /dev/null ./'
|
\ . 'go test'
|
||||||
|
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||||
|
\ . ' -c -o /dev/null ./'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! ale_linters#go#gobuild#GetMatches(lines) abort
|
function! ale_linters#go#gobuild#GetMatches(lines) abort
|
||||||
|
|||||||
@@ -1,11 +1,15 @@
|
|||||||
" Author: Ben Reedy <https://github.com/breed808>
|
" Author: Ben Reedy <https://github.com/breed808>
|
||||||
" Description: gosimple for Go files
|
" Description: gosimple for Go files
|
||||||
|
|
||||||
|
function! ale_linters#go#gosimple#GetCommand(buffer) abort
|
||||||
|
return ale#path#BufferCdString(a:buffer) . ' gosimple .'
|
||||||
|
endfunction
|
||||||
|
|
||||||
call ale#linter#Define('go', {
|
call ale#linter#Define('go', {
|
||||||
\ 'name': 'gosimple',
|
\ 'name': 'gosimple',
|
||||||
\ 'executable': 'gosimple',
|
\ 'executable': 'gosimple',
|
||||||
\ 'command': 'gosimple %s',
|
\ 'command_callback': 'ale_linters#go#gosimple#GetCommand',
|
||||||
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
\ 'callback': 'ale#handlers#go#Handler',
|
||||||
\ 'output_stream': 'both',
|
\ 'output_stream': 'both',
|
||||||
\ 'lint_file': 1,
|
\ 'lint_file': 1,
|
||||||
\})
|
\})
|
||||||
|
|||||||
20
ale_linters/go/gotype.vim
Normal file
20
ale_linters/go/gotype.vim
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
" Author: Jelte Fennema <github-public@jeltef.nl>
|
||||||
|
" Description: gotype for Go files
|
||||||
|
|
||||||
|
function! ale_linters#go#gotype#GetCommand(buffer) abort
|
||||||
|
if expand('#' . a:buffer . ':p') =~# '_test\.go$'
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
return ale#path#BufferCdString(a:buffer) . ' gotype .'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('go', {
|
||||||
|
\ 'name': 'gotype',
|
||||||
|
\ 'output_stream': 'stderr',
|
||||||
|
\ 'executable': 'gotype',
|
||||||
|
\ 'command_callback': 'ale_linters#go#gotype#GetCommand',
|
||||||
|
\ 'callback': 'ale#handlers#go#Handler',
|
||||||
|
\ 'lint_file': 1,
|
||||||
|
\})
|
||||||
@@ -1,10 +1,18 @@
|
|||||||
" Author: neersighted <bjorn@neersighted.com>
|
" Author: neersighted <bjorn@neersighted.com>
|
||||||
" Description: go vet for Go files
|
" Description: go vet for Go files
|
||||||
|
"
|
||||||
|
" Author: John Eikenberry <jae@zhar.net>
|
||||||
|
" Description: updated to work with go1.10
|
||||||
|
|
||||||
|
function! ale_linters#go#govet#GetCommand(buffer) abort
|
||||||
|
return ale#path#BufferCdString(a:buffer) . ' go vet .'
|
||||||
|
endfunction
|
||||||
|
|
||||||
call ale#linter#Define('go', {
|
call ale#linter#Define('go', {
|
||||||
\ 'name': 'go vet',
|
\ 'name': 'go vet',
|
||||||
\ 'output_stream': 'stderr',
|
\ 'output_stream': 'stderr',
|
||||||
\ 'executable': 'go',
|
\ 'executable': 'go',
|
||||||
\ 'command': 'go vet %t',
|
\ 'command_callback': 'ale_linters#go#govet#GetCommand',
|
||||||
\ 'callback': 'ale#handlers#unix#HandleAsError',
|
\ 'callback': 'ale#handlers#go#Handler',
|
||||||
|
\ 'lint_file': 1,
|
||||||
\})
|
\})
|
||||||
|
|||||||
@@ -1,11 +1,33 @@
|
|||||||
" Author: Ben Reedy <https://github.com/breed808>
|
" Author: Ben Reedy <https://github.com/breed808>
|
||||||
" Description: staticcheck for Go files
|
" Description: staticcheck for Go files
|
||||||
|
|
||||||
|
call ale#Set('go_staticcheck_options', '')
|
||||||
|
call ale#Set('go_staticcheck_lint_package', 0)
|
||||||
|
|
||||||
|
function! ale_linters#go#staticcheck#GetCommand(buffer) abort
|
||||||
|
let l:filename = expand('#' . a:buffer . ':t')
|
||||||
|
let l:options = ale#Var(a:buffer, 'go_staticcheck_options')
|
||||||
|
let l:lint_package = ale#Var(a:buffer, 'go_staticcheck_lint_package')
|
||||||
|
|
||||||
|
" BufferCdString is used so that we can be sure the paths output from
|
||||||
|
" staticcheck can be calculated to absolute paths in the Handler
|
||||||
|
if l:lint_package
|
||||||
|
return ale#path#BufferCdString(a:buffer)
|
||||||
|
\ . 'staticcheck'
|
||||||
|
\ . (!empty(l:options) ? ' ' . l:options : '') . ' .'
|
||||||
|
endif
|
||||||
|
|
||||||
|
return ale#path#BufferCdString(a:buffer)
|
||||||
|
\ . 'staticcheck'
|
||||||
|
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||||
|
\ . ' ' . ale#Escape(l:filename)
|
||||||
|
endfunction
|
||||||
|
|
||||||
call ale#linter#Define('go', {
|
call ale#linter#Define('go', {
|
||||||
\ 'name': 'staticcheck',
|
\ 'name': 'staticcheck',
|
||||||
\ 'executable': 'staticcheck',
|
\ 'executable': 'staticcheck',
|
||||||
\ 'command': 'staticcheck %s',
|
\ 'command_callback': 'ale_linters#go#staticcheck#GetCommand',
|
||||||
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
\ 'callback': 'ale#handlers#go#Handler',
|
||||||
\ 'output_stream': 'both',
|
\ 'output_stream': 'both',
|
||||||
\ 'lint_file': 1,
|
\ 'lint_file': 1,
|
||||||
\})
|
\})
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
" Description: Ember-template-lint for checking Handlebars files
|
" Description: Ember-template-lint for checking Handlebars files
|
||||||
|
|
||||||
call ale#Set('handlebars_embertemplatelint_executable', 'ember-template-lint')
|
call ale#Set('handlebars_embertemplatelint_executable', 'ember-template-lint')
|
||||||
call ale#Set('handlebars_embertemplatelint_use_global', 0)
|
call ale#Set('handlebars_embertemplatelint_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||||
|
|
||||||
function! ale_linters#handlebars#embertemplatelint#GetExecutable(buffer) abort
|
function! ale_linters#handlebars#embertemplatelint#GetExecutable(buffer) abort
|
||||||
return ale#node#FindExecutable(a:buffer, 'handlebars_embertemplatelint', [
|
return ale#node#FindExecutable(a:buffer, 'handlebars_embertemplatelint', [
|
||||||
|
|||||||
@@ -1,10 +1,18 @@
|
|||||||
" Author: w0rp <devw0rp@gmail.com>
|
" Author: w0rp <devw0rp@gmail.com>
|
||||||
" Description: ghc for Haskell files
|
" Description: ghc for Haskell files
|
||||||
|
|
||||||
|
call ale#Set('haskell_ghc_options', '-fno-code -v0')
|
||||||
|
|
||||||
|
function! ale_linters#haskell#ghc#GetCommand(buffer) abort
|
||||||
|
return 'ghc '
|
||||||
|
\ . ale#Var(a:buffer, 'haskell_ghc_options')
|
||||||
|
\ . ' %t'
|
||||||
|
endfunction
|
||||||
|
|
||||||
call ale#linter#Define('haskell', {
|
call ale#linter#Define('haskell', {
|
||||||
\ 'name': 'ghc',
|
\ 'name': 'ghc',
|
||||||
\ 'output_stream': 'stderr',
|
\ 'output_stream': 'stderr',
|
||||||
\ 'executable': 'ghc',
|
\ 'executable': 'ghc',
|
||||||
\ 'command': 'ghc -fno-code -v0 %t',
|
\ 'command_callback': 'ale_linters#haskell#ghc#GetCommand',
|
||||||
\ 'callback': 'ale#handlers#haskell#HandleGHCFormat',
|
\ 'callback': 'ale#handlers#haskell#HandleGHCFormat',
|
||||||
\})
|
\})
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
" Description: hdevtools for Haskell files
|
" Description: hdevtools for Haskell files
|
||||||
|
|
||||||
call ale#Set('haskell_hdevtools_executable', 'hdevtools')
|
call ale#Set('haskell_hdevtools_executable', 'hdevtools')
|
||||||
call ale#Set('haskell_hdevtools_options', '-g -Wall')
|
call ale#Set('haskell_hdevtools_options', get(g:, 'hdevtools_options', '-g -Wall'))
|
||||||
|
|
||||||
function! ale_linters#haskell#hdevtools#GetExecutable(buffer) abort
|
function! ale_linters#haskell#hdevtools#GetExecutable(buffer) abort
|
||||||
return ale#Var(a:buffer, 'haskell_hdevtools_executable')
|
return ale#Var(a:buffer, 'haskell_hdevtools_executable')
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
" Author: KabbAmine <amine.kabb@gmail.com>, deathmaz <00maz1987@gmail.com>, diartyz <diartyz@gmail.com>
|
" Author: KabbAmine <amine.kabb@gmail.com>, deathmaz <00maz1987@gmail.com>, diartyz <diartyz@gmail.com>
|
||||||
" Description: HTMLHint for checking html files
|
" Description: HTMLHint for checking html files
|
||||||
|
|
||||||
call ale#Set('html_htmlhint_options', '--format=unix')
|
call ale#Set('html_htmlhint_options', '')
|
||||||
call ale#Set('html_htmlhint_executable', 'htmlhint')
|
call ale#Set('html_htmlhint_executable', 'htmlhint')
|
||||||
call ale#Set('html_htmlhint_use_global', 0)
|
call ale#Set('html_htmlhint_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||||
|
|
||||||
function! ale_linters#html#htmlhint#GetExecutable(buffer) abort
|
function! ale_linters#html#htmlhint#GetExecutable(buffer) abort
|
||||||
return ale#node#FindExecutable(a:buffer, 'html_htmlhint', [
|
return ale#node#FindExecutable(a:buffer, 'html_htmlhint', [
|
||||||
@@ -12,9 +12,22 @@ function! ale_linters#html#htmlhint#GetExecutable(buffer) abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! ale_linters#html#htmlhint#GetCommand(buffer) abort
|
function! ale_linters#html#htmlhint#GetCommand(buffer) abort
|
||||||
return ale_linters#html#htmlhint#GetExecutable(a:buffer)
|
let l:options = ale#Var(a:buffer, 'html_htmlhint_options')
|
||||||
\ . ' ' . ale#Var(a:buffer, 'html_htmlhint_options')
|
let l:config = l:options !~# '--config'
|
||||||
\ . ' %t'
|
\ ? ale#path#FindNearestFile(a:buffer, '.htmlhintrc')
|
||||||
|
\ : ''
|
||||||
|
|
||||||
|
if !empty(l:config)
|
||||||
|
let l:options .= ' --config ' . ale#Escape(l:config)
|
||||||
|
endif
|
||||||
|
|
||||||
|
if !empty(l:options)
|
||||||
|
let l:options = substitute(l:options, '--format=unix', '', '')
|
||||||
|
endif
|
||||||
|
|
||||||
|
return ale#Escape(ale_linters#html#htmlhint#GetExecutable(a:buffer))
|
||||||
|
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||||
|
\ . ' --format=unix %t'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
call ale#linter#Define('html', {
|
call ale#linter#Define('html', {
|
||||||
|
|||||||
@@ -3,11 +3,19 @@
|
|||||||
|
|
||||||
" CLI options
|
" CLI options
|
||||||
let g:ale_html_tidy_executable = get(g:, 'ale_html_tidy_executable', 'tidy')
|
let g:ale_html_tidy_executable = get(g:, 'ale_html_tidy_executable', 'tidy')
|
||||||
|
" remove in 2.0
|
||||||
" Look for the old _args variable first.
|
" Look for the old _args variable first.
|
||||||
|
let s:deprecation_warning_echoed = 0
|
||||||
let s:default_options = get(g:, 'ale_html_tidy_args', '-q -e -language en')
|
let s:default_options = get(g:, 'ale_html_tidy_args', '-q -e -language en')
|
||||||
let g:ale_html_tidy_options = get(g:, 'ale_html_tidy_options', s:default_options)
|
let g:ale_html_tidy_options = get(g:, 'ale_html_tidy_options', s:default_options)
|
||||||
|
|
||||||
function! ale_linters#html#tidy#GetCommand(buffer) abort
|
function! ale_linters#html#tidy#GetCommand(buffer) abort
|
||||||
|
" remove in 2.0
|
||||||
|
if exists('g:ale_html_tidy_args') && !s:deprecation_warning_echoed
|
||||||
|
execute 'echom ''Rename your g:ale_html_tidy_args setting to g:ale_html_tidy_options instead. Support for this will removed in ALE 2.0.'''
|
||||||
|
let s:deprecation_warning_echoed = 1
|
||||||
|
endif
|
||||||
|
|
||||||
" Specify file encoding in options
|
" Specify file encoding in options
|
||||||
" (Idea taken from https://github.com/scrooloose/syntastic/blob/master/syntax_checkers/html/tidy.vim)
|
" (Idea taken from https://github.com/scrooloose/syntastic/blob/master/syntax_checkers/html/tidy.vim)
|
||||||
let l:file_encoding = get({
|
let l:file_encoding = get({
|
||||||
@@ -25,8 +33,16 @@ function! ale_linters#html#tidy#GetCommand(buffer) abort
|
|||||||
\ 'utf-8': '-utf8',
|
\ 'utf-8': '-utf8',
|
||||||
\ }, &fileencoding, '-utf8')
|
\ }, &fileencoding, '-utf8')
|
||||||
|
|
||||||
|
" On macOS, old tidy (released on 31 Oct 2006) is installed. It does not
|
||||||
|
" consider HTML5 so we should avoid it.
|
||||||
|
let l:executable = ale#Var(a:buffer, 'html_tidy_executable')
|
||||||
|
if has('mac') && l:executable is# 'tidy' && exists('*exepath')
|
||||||
|
\ && exepath(l:executable) is# '/usr/bin/tidy'
|
||||||
|
return ''
|
||||||
|
endif
|
||||||
|
|
||||||
return printf('%s %s %s -',
|
return printf('%s %s %s -',
|
||||||
\ ale#Var(a:buffer, 'html_tidy_executable'),
|
\ l:executable,
|
||||||
\ ale#Var(a:buffer, 'html_tidy_options'),
|
\ ale#Var(a:buffer, 'html_tidy_options'),
|
||||||
\ l:file_encoding
|
\ l:file_encoding
|
||||||
\)
|
\)
|
||||||
|
|||||||
@@ -3,8 +3,9 @@
|
|||||||
|
|
||||||
let s:classpath_sep = has('unix') ? ':' : ';'
|
let s:classpath_sep = has('unix') ? ':' : ';'
|
||||||
|
|
||||||
let g:ale_java_javac_options = get(g:, 'ale_java_javac_options', '')
|
call ale#Set('java_javac_executable', 'javac')
|
||||||
let g:ale_java_javac_classpath = get(g:, 'ale_java_javac_classpath', '')
|
call ale#Set('java_javac_options', '')
|
||||||
|
call ale#Set('java_javac_classpath', '')
|
||||||
|
|
||||||
function! ale_linters#java#javac#GetImportPaths(buffer) abort
|
function! ale_linters#java#javac#GetImportPaths(buffer) abort
|
||||||
let l:pom_path = ale#path#FindNearestFile(a:buffer, 'pom.xml')
|
let l:pom_path = ale#path#FindNearestFile(a:buffer, 'pom.xml')
|
||||||
@@ -35,6 +36,10 @@ function! s:BuildClassPathOption(buffer, import_paths) abort
|
|||||||
\ : ''
|
\ : ''
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#java#javac#GetExecutable(buffer) abort
|
||||||
|
return ale#Var(a:buffer, 'java_javac_executable')
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! ale_linters#java#javac#GetCommand(buffer, import_paths) abort
|
function! ale_linters#java#javac#GetCommand(buffer, import_paths) abort
|
||||||
let l:cp_option = s:BuildClassPathOption(a:buffer, a:import_paths)
|
let l:cp_option = s:BuildClassPathOption(a:buffer, a:import_paths)
|
||||||
let l:sp_option = ''
|
let l:sp_option = ''
|
||||||
@@ -72,11 +77,13 @@ function! ale_linters#java#javac#GetCommand(buffer, import_paths) abort
|
|||||||
|
|
||||||
" Create .class files in a temporary directory, which we will delete later.
|
" Create .class files in a temporary directory, which we will delete later.
|
||||||
let l:class_file_directory = ale#engine#CreateDirectory(a:buffer)
|
let l:class_file_directory = ale#engine#CreateDirectory(a:buffer)
|
||||||
|
let l:executable = ale_linters#java#javac#GetExecutable(a:buffer)
|
||||||
|
|
||||||
" Always run javac from the directory the file is in, so we can resolve
|
" Always run javac from the directory the file is in, so we can resolve
|
||||||
" relative paths correctly.
|
" relative paths correctly.
|
||||||
return ale#path#BufferCdString(a:buffer)
|
return ale#path#BufferCdString(a:buffer)
|
||||||
\ . 'javac -Xlint'
|
\ . ale#Escape(l:executable)
|
||||||
|
\ . ' -Xlint'
|
||||||
\ . ' ' . l:cp_option
|
\ . ' ' . l:cp_option
|
||||||
\ . ' ' . l:sp_option
|
\ . ' ' . l:sp_option
|
||||||
\ . ' -d ' . ale#Escape(l:class_file_directory)
|
\ . ' -d ' . ale#Escape(l:class_file_directory)
|
||||||
@@ -119,7 +126,7 @@ endfunction
|
|||||||
|
|
||||||
call ale#linter#Define('java', {
|
call ale#linter#Define('java', {
|
||||||
\ 'name': 'javac',
|
\ 'name': 'javac',
|
||||||
\ 'executable': 'javac',
|
\ 'executable_callback': 'ale_linters#java#javac#GetExecutable',
|
||||||
\ 'command_chain': [
|
\ 'command_chain': [
|
||||||
\ {'callback': 'ale_linters#java#javac#GetImportPaths', 'output_stream': 'stdout'},
|
\ {'callback': 'ale_linters#java#javac#GetImportPaths', 'output_stream': 'stdout'},
|
||||||
\ {'callback': 'ale_linters#java#javac#GetCommand', 'output_stream': 'stderr'},
|
\ {'callback': 'ale_linters#java#javac#GetCommand', 'output_stream': 'stderr'},
|
||||||
|
|||||||
36
ale_linters/java/pmd.vim
Normal file
36
ale_linters/java/pmd.vim
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
" Author: Johannes Wienke <languitar@semipol.de>
|
||||||
|
" Description: PMD for Java files
|
||||||
|
|
||||||
|
function! ale_linters#java#pmd#Handle(buffer, lines) abort
|
||||||
|
let l:pattern = '"\(\d\+\)",".\+","\(.\+\)","\(\d\+\)","\(\d\+\)","\(.\+\)","\(.\+\)","\(.\+\)"$'
|
||||||
|
let l:output = []
|
||||||
|
|
||||||
|
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||||
|
call add(l:output, {
|
||||||
|
\ 'type': 'W',
|
||||||
|
\ 'lnum': l:match[4] + 0,
|
||||||
|
\ 'text': l:match[5],
|
||||||
|
\ 'code': l:match[6] . ' - ' . l:match[7],
|
||||||
|
\})
|
||||||
|
endfor
|
||||||
|
|
||||||
|
return l:output
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#java#pmd#GetCommand(buffer) abort
|
||||||
|
return 'pmd '
|
||||||
|
\ . ale#Var(a:buffer, 'java_pmd_options')
|
||||||
|
\ . ' -f csv'
|
||||||
|
\ . ' -d %t'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
if !exists('g:ale_java_pmd_options')
|
||||||
|
let g:ale_java_pmd_options = '-R category/java/bestpractices.xml'
|
||||||
|
endif
|
||||||
|
|
||||||
|
call ale#linter#Define('java', {
|
||||||
|
\ 'name': 'pmd',
|
||||||
|
\ 'executable': 'pmd',
|
||||||
|
\ 'command_callback': 'ale_linters#java#pmd#GetCommand',
|
||||||
|
\ 'callback': 'ale_linters#java#pmd#Handle',
|
||||||
|
\})
|
||||||
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
call ale#linter#Define('javascript', {
|
call ale#linter#Define('javascript', {
|
||||||
\ 'name': 'eslint',
|
\ 'name': 'eslint',
|
||||||
|
\ 'output_stream': 'both',
|
||||||
\ 'executable_callback': 'ale#handlers#eslint#GetExecutable',
|
\ 'executable_callback': 'ale#handlers#eslint#GetExecutable',
|
||||||
\ 'command_callback': 'ale#handlers#eslint#GetCommand',
|
\ 'command_callback': 'ale#handlers#eslint#GetCommand',
|
||||||
\ 'callback': 'ale#handlers#eslint#Handle',
|
\ 'callback': 'ale#handlers#eslint#Handle',
|
||||||
|
|||||||
@@ -4,7 +4,8 @@
|
|||||||
|
|
||||||
call ale#Set('javascript_flow_executable', 'flow')
|
call ale#Set('javascript_flow_executable', 'flow')
|
||||||
call ale#Set('javascript_flow_use_home_config', 0)
|
call ale#Set('javascript_flow_use_home_config', 0)
|
||||||
call ale#Set('javascript_flow_use_global', 0)
|
call ale#Set('javascript_flow_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||||
|
call ale#Set('javascript_flow_use_respect_pragma', 1)
|
||||||
|
|
||||||
function! ale_linters#javascript#flow#GetExecutable(buffer) abort
|
function! ale_linters#javascript#flow#GetExecutable(buffer) abort
|
||||||
let l:flow_config = ale#path#FindNearestFile(a:buffer, '.flowconfig')
|
let l:flow_config = ale#path#FindNearestFile(a:buffer, '.flowconfig')
|
||||||
@@ -47,8 +48,8 @@ function! ale_linters#javascript#flow#GetCommand(buffer, version_lines) abort
|
|||||||
|
|
||||||
" If we can parse the version number, then only use --respect-pragma
|
" If we can parse the version number, then only use --respect-pragma
|
||||||
" if the version is >= 0.36.0, which added the argument.
|
" if the version is >= 0.36.0, which added the argument.
|
||||||
let l:use_respect_pragma = empty(l:version)
|
let l:use_respect_pragma = ale#Var(a:buffer, 'javascript_flow_use_respect_pragma')
|
||||||
\ || ale#semver#GTE(l:version, [0, 36])
|
\ && (empty(l:version) || ale#semver#GTE(l:version, [0, 36]))
|
||||||
|
|
||||||
return ale#Escape(l:executable)
|
return ale#Escape(l:executable)
|
||||||
\ . ' check-contents'
|
\ . ' check-contents'
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
" Description: jscs for JavaScript files
|
" Description: jscs for JavaScript files
|
||||||
|
|
||||||
call ale#Set('javascript_jscs_executable', 'jscs')
|
call ale#Set('javascript_jscs_executable', 'jscs')
|
||||||
call ale#Set('javascript_jscs_use_global', 0)
|
call ale#Set('javascript_jscs_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||||
|
|
||||||
function! ale_linters#javascript#jscs#GetExecutable(buffer) abort
|
function! ale_linters#javascript#jscs#GetExecutable(buffer) abort
|
||||||
return ale#node#FindExecutable(a:buffer, 'javascript_jscs', [
|
return ale#node#FindExecutable(a:buffer, 'javascript_jscs', [
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
" Description: JSHint for Javascript files
|
" Description: JSHint for Javascript files
|
||||||
|
|
||||||
call ale#Set('javascript_jshint_executable', 'jshint')
|
call ale#Set('javascript_jshint_executable', 'jshint')
|
||||||
call ale#Set('javascript_jshint_use_global', 0)
|
call ale#Set('javascript_jshint_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||||
|
|
||||||
function! ale_linters#javascript#jshint#GetExecutable(buffer) abort
|
function! ale_linters#javascript#jshint#GetExecutable(buffer) abort
|
||||||
return ale#node#FindExecutable(a:buffer, 'javascript_jshint', [
|
return ale#node#FindExecutable(a:buffer, 'javascript_jshint', [
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
" Description: standardjs for JavaScript files
|
" Description: standardjs for JavaScript files
|
||||||
|
|
||||||
call ale#Set('javascript_standard_executable', 'standard')
|
call ale#Set('javascript_standard_executable', 'standard')
|
||||||
call ale#Set('javascript_standard_use_global', 0)
|
call ale#Set('javascript_standard_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||||
call ale#Set('javascript_standard_options', '')
|
call ale#Set('javascript_standard_options', '')
|
||||||
|
|
||||||
function! ale_linters#javascript#standard#GetExecutable(buffer) abort
|
function! ale_linters#javascript#standard#GetExecutable(buffer) abort
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
" Description: xo for JavaScript files
|
" Description: xo for JavaScript files
|
||||||
|
|
||||||
call ale#Set('javascript_xo_executable', 'xo')
|
call ale#Set('javascript_xo_executable', 'xo')
|
||||||
call ale#Set('javascript_xo_use_global', 0)
|
call ale#Set('javascript_xo_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||||
call ale#Set('javascript_xo_options', '')
|
call ale#Set('javascript_xo_options', '')
|
||||||
|
|
||||||
function! ale_linters#javascript#xo#GetExecutable(buffer) abort
|
function! ale_linters#javascript#xo#GetExecutable(buffer) abort
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
call ale#Set('less_lessc_executable', 'lessc')
|
call ale#Set('less_lessc_executable', 'lessc')
|
||||||
call ale#Set('less_lessc_options', '')
|
call ale#Set('less_lessc_options', '')
|
||||||
call ale#Set('less_lessc_use_global', 0)
|
call ale#Set('less_lessc_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||||
|
|
||||||
function! ale_linters#less#lessc#GetExecutable(buffer) abort
|
function! ale_linters#less#lessc#GetExecutable(buffer) abort
|
||||||
return ale#node#FindExecutable(a:buffer, 'less_lessc', [
|
return ale#node#FindExecutable(a:buffer, 'less_lessc', [
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
call ale#Set('less_stylelint_executable', 'stylelint')
|
call ale#Set('less_stylelint_executable', 'stylelint')
|
||||||
call ale#Set('less_stylelint_options', '')
|
call ale#Set('less_stylelint_options', '')
|
||||||
call ale#Set('less_stylelint_use_global', 0)
|
call ale#Set('less_stylelint_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||||
|
|
||||||
function! ale_linters#less#stylelint#GetExecutable(buffer) abort
|
function! ale_linters#less#stylelint#GetExecutable(buffer) abort
|
||||||
return ale#node#FindExecutable(a:buffer, 'less_stylelint', [
|
return ale#node#FindExecutable(a:buffer, 'less_stylelint', [
|
||||||
|
|||||||
40
ale_linters/lua/luac.vim
Normal file
40
ale_linters/lua/luac.vim
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
" Author: Jon Xie https://github.com/xiejiangzhi
|
||||||
|
" Description: luac linter for lua files
|
||||||
|
|
||||||
|
call ale#Set('lua_luac_executable', 'luac')
|
||||||
|
|
||||||
|
function! ale_linters#lua#luac#GetExecutable(buffer) abort
|
||||||
|
return ale#Var(a:buffer, 'lua_luac_executable')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#lua#luac#GetCommand(buffer) abort
|
||||||
|
let l:executable = ale_linters#lua#luac#GetExecutable(a:buffer)
|
||||||
|
return ale#Escape(l:executable) . ' -p - '
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#lua#luac#Handle(buffer, lines) abort
|
||||||
|
" Matches patterns line the following:
|
||||||
|
"
|
||||||
|
" luac: stdin:5: '=' expected near ')'
|
||||||
|
" luac: stdin:8: ')' expected (to close '(' at line 6) near '123'
|
||||||
|
let l:pattern = '\v^.*:(\d+): (.+)$'
|
||||||
|
let l:output = []
|
||||||
|
|
||||||
|
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||||
|
call add(l:output, {
|
||||||
|
\ 'lnum': l:match[1] + 0,
|
||||||
|
\ 'type': 'E',
|
||||||
|
\ 'text': l:match[2],
|
||||||
|
\})
|
||||||
|
endfor
|
||||||
|
|
||||||
|
return l:output
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('lua', {
|
||||||
|
\ 'name': 'luac',
|
||||||
|
\ 'executable_callback': 'ale_linters#lua#luac#GetExecutable',
|
||||||
|
\ 'command_callback': 'ale_linters#lua#luac#GetCommand',
|
||||||
|
\ 'output_stream': 'stderr',
|
||||||
|
\ 'callback': 'ale_linters#lua#luac#Handle',
|
||||||
|
\})
|
||||||
11
ale_linters/markdown/markdownlint.vim
Normal file
11
ale_linters/markdown/markdownlint.vim
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
" Author: Ty-Lucas Kelley <tylucaskelley@gmail.com>
|
||||||
|
" Description: Adds support for markdownlint
|
||||||
|
|
||||||
|
call ale#linter#Define('markdown', {
|
||||||
|
\ 'name': 'markdownlint',
|
||||||
|
\ 'executable': 'markdownlint',
|
||||||
|
\ 'lint_file': 1,
|
||||||
|
\ 'output_stream': 'both',
|
||||||
|
\ 'command': 'markdownlint %s',
|
||||||
|
\ 'callback': 'ale#handlers#markdownlint#Handle'
|
||||||
|
\ })
|
||||||
@@ -1,5 +1,24 @@
|
|||||||
" Author: Steve Dignam <steve@dignam.xyz>
|
" Author: Steve Dignam <steve@dignam.xyz>, Josh Leeb-du Toit <joshleeb.com>
|
||||||
" Description: Support for mdl, a markdown linter
|
" Description: Support for mdl, a markdown linter.
|
||||||
|
|
||||||
|
call ale#Set('markdown_mdl_executable', 'mdl')
|
||||||
|
call ale#Set('markdown_mdl_options', '')
|
||||||
|
|
||||||
|
function! ale_linters#markdown#mdl#GetExecutable(buffer) abort
|
||||||
|
return ale#Var(a:buffer, 'markdown_mdl_executable')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#markdown#mdl#GetCommand(buffer) abort
|
||||||
|
let l:executable = ale_linters#markdown#mdl#GetExecutable(a:buffer)
|
||||||
|
let l:exec_args = l:executable =~? 'bundle$'
|
||||||
|
\ ? ' exec mdl'
|
||||||
|
\ : ''
|
||||||
|
|
||||||
|
let l:options = ale#Var(a:buffer, 'markdown_mdl_options')
|
||||||
|
|
||||||
|
return ale#Escape(l:executable) . l:exec_args
|
||||||
|
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! ale_linters#markdown#mdl#Handle(buffer, lines) abort
|
function! ale_linters#markdown#mdl#Handle(buffer, lines) abort
|
||||||
" matches: '(stdin):173: MD004 Unordered list style'
|
" matches: '(stdin):173: MD004 Unordered list style'
|
||||||
@@ -19,7 +38,7 @@ endfunction
|
|||||||
|
|
||||||
call ale#linter#Define('markdown', {
|
call ale#linter#Define('markdown', {
|
||||||
\ 'name': 'mdl',
|
\ 'name': 'mdl',
|
||||||
\ 'executable': 'mdl',
|
\ 'executable_callback': 'ale_linters#markdown#mdl#GetExecutable',
|
||||||
\ 'command': 'mdl',
|
\ 'command_callback': 'ale_linters#markdown#mdl#GetCommand',
|
||||||
\ 'callback': 'ale_linters#markdown#mdl#Handle'
|
\ 'callback': 'ale_linters#markdown#mdl#Handle'
|
||||||
\})
|
\})
|
||||||
|
|||||||
@@ -1,18 +1,24 @@
|
|||||||
" Author rhysd https://rhysd.github.io/
|
" Author rhysd https://rhysd.github.io/, Dirk Roorda (dirkroorda), Adrián González Rus (@adrigzr)
|
||||||
" Description: remark-lint for Markdown files
|
" Description: remark-lint for Markdown files
|
||||||
|
|
||||||
function! ale_linters#markdown#remark_lint#Handle(buffer, lines) abort
|
function! ale_linters#markdown#remark_lint#Handle(buffer, lines) abort
|
||||||
" matches: ' 1:4 warning Incorrect list-item indent: add 1 space list-item-indent remark-lint'
|
" matches: ' 1:4 warning Incorrect list-item indent: add 1 space list-item-indent remark-lint'
|
||||||
let l:pattern = '^ \+\(\d\+\):\(\d\+\) \(warning\|error\) \(.\+\)$'
|
" matches: ' 18:71-19:1 error Missing new line after list item list-item-spacing remark-lint',
|
||||||
|
let l:pattern = '^ \+\(\d\+\):\(\d\+\)\(-\(\d\+\):\(\d\+\)\)\? \(warning\|error\) \(.\+\)$'
|
||||||
let l:output = []
|
let l:output = []
|
||||||
|
|
||||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||||
call add(l:output, {
|
let l:item = {
|
||||||
\ 'lnum': l:match[1] + 0,
|
\ 'lnum': l:match[1] + 0,
|
||||||
\ 'col': l:match[2] + 0,
|
\ 'col': l:match[2] + 0,
|
||||||
\ 'type': l:match[3] is# 'error' ? 'E' : 'W',
|
\ 'type': l:match[6] is# 'error' ? 'E' : 'W',
|
||||||
\ 'text': l:match[4],
|
\ 'text': l:match[7],
|
||||||
\})
|
\}
|
||||||
|
if l:match[3] isnot# ''
|
||||||
|
let l:item.end_lnum = l:match[4] + 0
|
||||||
|
let l:item.end_col = l:match[5] + 0
|
||||||
|
endif
|
||||||
|
call add(l:output, l:item)
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
return l:output
|
return l:output
|
||||||
|
|||||||
9
ale_linters/markdown/textlint.vim
Normal file
9
ale_linters/markdown/textlint.vim
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
" Author: tokida https://rouger.info, Yasuhiro Kiyota <yasuhiroki.duck@gmail.com>
|
||||||
|
" Description: textlint, a proofreading tool (https://textlint.github.io/)
|
||||||
|
|
||||||
|
call ale#linter#Define('markdown', {
|
||||||
|
\ 'name': 'textlint',
|
||||||
|
\ 'executable_callback': 'ale#handlers#textlint#GetExecutable',
|
||||||
|
\ 'command_callback': 'ale#handlers#textlint#GetCommand',
|
||||||
|
\ 'callback': 'ale#handlers#textlint#HandleTextlintOutput',
|
||||||
|
\})
|
||||||
45
ale_linters/mercury/mmc.vim
Normal file
45
ale_linters/mercury/mmc.vim
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
" Author: stewy33 <slocumstewy@gmail.com>
|
||||||
|
" Description: Lints mercury files using mmc
|
||||||
|
|
||||||
|
call ale#Set('mercury_mmc_executable', 'mmc')
|
||||||
|
call ale#Set('mercury_mmc_options', '--make --output-compile-error-lines 100')
|
||||||
|
|
||||||
|
function! ale_linters#mercury#mmc#GetExecutable(buffer) abort
|
||||||
|
return ale#Var(a:buffer, 'mercury_mmc_executable')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#mercury#mmc#GetCommand(buffer) abort
|
||||||
|
let l:module_name = expand('#' . a:buffer . ':t:r')
|
||||||
|
|
||||||
|
return ale#path#BufferCdString(a:buffer)
|
||||||
|
\ . ale_linters#mercury#mmc#GetExecutable(a:buffer)
|
||||||
|
\ . ' --errorcheck-only '
|
||||||
|
\ . ale#Var(a:buffer, 'mercury_mmc_options')
|
||||||
|
\ . ' ' . l:module_name
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#mercury#mmc#Handle(buffer, lines) abort
|
||||||
|
" output format
|
||||||
|
" <filename>:<line>: <issue type>: <message>
|
||||||
|
let l:pattern = '\v^\w+\.m:(\d+):\s+([W|w]arning|.*[E|e]rror.*): (.*)'
|
||||||
|
let l:output = []
|
||||||
|
|
||||||
|
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||||
|
call add(l:output, {
|
||||||
|
\ 'lnum': substitute(l:match[1], '\v^0*', '', '') + 0,
|
||||||
|
\ 'type': l:match[2][0] =~? 'W' ? 'W' : 'E',
|
||||||
|
\ 'text': l:match[2] . ': ' . l:match[3]
|
||||||
|
\})
|
||||||
|
endfor
|
||||||
|
|
||||||
|
return l:output
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('mercury', {
|
||||||
|
\ 'name': 'mmc',
|
||||||
|
\ 'output_stream': 'stderr',
|
||||||
|
\ 'executable_callback': 'ale_linters#mercury#mmc#GetExecutable',
|
||||||
|
\ 'command_callback': 'ale_linters#mercury#mmc#GetCommand',
|
||||||
|
\ 'callback': 'ale_linters#mercury#mmc#Handle',
|
||||||
|
\ 'lint_file': 1,
|
||||||
|
\})
|
||||||
50
ale_linters/nasm/nasm.vim
Normal file
50
ale_linters/nasm/nasm.vim
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
" Author: Oyvind Ingvaldsen <oyvind.ingvaldsen@gmail.com>
|
||||||
|
" Description: NASM linter for asmsyntax nasm.
|
||||||
|
|
||||||
|
call ale#Set('nasm_nasm_executable', 'nasm')
|
||||||
|
call ale#Set('nasm_nasm_options', '')
|
||||||
|
|
||||||
|
function! ale_linters#nasm#nasm#GetExecutable(buffer) abort
|
||||||
|
return ale#Var(a:buffer, 'nasm_nasm_executable')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#nasm#nasm#GetOptions(buffer) abort
|
||||||
|
return ale#Var(a:buffer, 'nasm_nasm_options')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#nasm#nasm#GetCommand(buffer) abort
|
||||||
|
" Note that NASM require a trailing slash to the -I option.
|
||||||
|
let l:executable = ale#Escape(ale_linters#nasm#nasm#GetExecutable(a:buffer))
|
||||||
|
let l:separator = has('win32') ? '\' : '/'
|
||||||
|
let l:path = ale#Escape(fnamemodify(bufname(a:buffer), ':p:h') . l:separator)
|
||||||
|
let l:options = ale_linters#nasm#nasm#GetOptions(a:buffer)
|
||||||
|
|
||||||
|
return l:executable
|
||||||
|
\ . ' -X gnu'
|
||||||
|
\ . ' -I ' . l:path
|
||||||
|
\ . ' ' . l:options
|
||||||
|
\ . ' %s'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#nasm#nasm#Handle(buffer, lines) abort
|
||||||
|
" Note that we treat 'fatal' as errors.
|
||||||
|
let l:pattern = '^.\+:\(\d\+\): \([^:]\+\): \(.\+\)$'
|
||||||
|
let l:output = []
|
||||||
|
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||||
|
call add(l:output, {
|
||||||
|
\ 'lnum': l:match[1] + 0,
|
||||||
|
\ 'type': l:match[2] =~? 'error\|fatal' ? 'E' : 'W',
|
||||||
|
\ 'text': l:match[3],
|
||||||
|
\})
|
||||||
|
endfor
|
||||||
|
return l:output
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('nasm', {
|
||||||
|
\ 'name': 'nasm',
|
||||||
|
\ 'executable': 'nasm',
|
||||||
|
\ 'output_stream': 'stderr',
|
||||||
|
\ 'lint_file': 1,
|
||||||
|
\ 'command_callback': 'ale_linters#nasm#nasm#GetCommand',
|
||||||
|
\ 'callback': 'ale_linters#nasm#nasm#Handle',
|
||||||
|
\})
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
" Description: A language server for OCaml
|
" Description: A language server for OCaml
|
||||||
|
|
||||||
call ale#Set('ocaml_ols_executable', 'ocaml-language-server')
|
call ale#Set('ocaml_ols_executable', 'ocaml-language-server')
|
||||||
call ale#Set('ocaml_ols_use_global', 0)
|
call ale#Set('ocaml_ols_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||||
|
|
||||||
call ale#linter#Define('ocaml', {
|
call ale#linter#Define('ocaml', {
|
||||||
\ 'name': 'ols',
|
\ 'name': 'ols',
|
||||||
|
|||||||
@@ -27,12 +27,20 @@ function! ale_linters#perl#perl#Handle(buffer, lines) abort
|
|||||||
let l:output = []
|
let l:output = []
|
||||||
let l:basename = expand('#' . a:buffer . ':t')
|
let l:basename = expand('#' . a:buffer . ':t')
|
||||||
|
|
||||||
|
let l:type = 'E'
|
||||||
|
if a:lines[-1] =~# 'syntax OK'
|
||||||
|
let l:type = 'W'
|
||||||
|
endif
|
||||||
|
|
||||||
|
let l:seen = {}
|
||||||
|
|
||||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||||
let l:line = l:match[3]
|
let l:line = l:match[3]
|
||||||
|
let l:file = l:match[2]
|
||||||
let l:text = l:match[1]
|
let l:text = l:match[1]
|
||||||
let l:type = 'E'
|
|
||||||
|
|
||||||
if ale#path#IsBufferPath(a:buffer, l:match[2])
|
if ale#path#IsBufferPath(a:buffer, l:file)
|
||||||
|
\ && !has_key(l:seen,l:line)
|
||||||
\ && (
|
\ && (
|
||||||
\ l:text isnot# 'BEGIN failed--compilation aborted'
|
\ l:text isnot# 'BEGIN failed--compilation aborted'
|
||||||
\ || empty(l:output)
|
\ || empty(l:output)
|
||||||
@@ -43,6 +51,8 @@ function! ale_linters#perl#perl#Handle(buffer, lines) abort
|
|||||||
\ 'text': l:text,
|
\ 'text': l:text,
|
||||||
\ 'type': l:type,
|
\ 'type': l:type,
|
||||||
\})
|
\})
|
||||||
|
|
||||||
|
let l:seen[l:line] = 1
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
|
|||||||
@@ -18,9 +18,9 @@ function! ale_linters#perl#perlcritic#GetExecutable(buffer) abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! ale_linters#perl#perlcritic#GetProfile(buffer) abort
|
function! ale_linters#perl#perlcritic#GetProfile(buffer) abort
|
||||||
|
|
||||||
" first see if we've been overridden
|
" first see if we've been overridden
|
||||||
let l:profile = ale#Var(a:buffer, 'perl_perlcritic_profile')
|
let l:profile = ale#Var(a:buffer, 'perl_perlcritic_profile')
|
||||||
|
|
||||||
if l:profile is? ''
|
if l:profile is? ''
|
||||||
return ''
|
return ''
|
||||||
endif
|
endif
|
||||||
@@ -31,6 +31,7 @@ endfunction
|
|||||||
|
|
||||||
function! ale_linters#perl#perlcritic#GetCommand(buffer) abort
|
function! ale_linters#perl#perlcritic#GetCommand(buffer) abort
|
||||||
let l:critic_verbosity = '%l:%c %m\n'
|
let l:critic_verbosity = '%l:%c %m\n'
|
||||||
|
|
||||||
if ale#Var(a:buffer, 'perl_perlcritic_showrules')
|
if ale#Var(a:buffer, 'perl_perlcritic_showrules')
|
||||||
let l:critic_verbosity = '%l:%c %m [%p]\n'
|
let l:critic_verbosity = '%l:%c %m [%p]\n'
|
||||||
endif
|
endif
|
||||||
@@ -38,17 +39,11 @@ function! ale_linters#perl#perlcritic#GetCommand(buffer) abort
|
|||||||
let l:profile = ale_linters#perl#perlcritic#GetProfile(a:buffer)
|
let l:profile = ale_linters#perl#perlcritic#GetProfile(a:buffer)
|
||||||
let l:options = ale#Var(a:buffer, 'perl_perlcritic_options')
|
let l:options = ale#Var(a:buffer, 'perl_perlcritic_options')
|
||||||
|
|
||||||
let l:command = ale#Escape(ale_linters#perl#perlcritic#GetExecutable(a:buffer))
|
return ale#Escape(ale_linters#perl#perlcritic#GetExecutable(a:buffer))
|
||||||
\ . " --verbose '". l:critic_verbosity . "' --nocolor"
|
\ . ' --verbose ' . ale#Escape(l:critic_verbosity)
|
||||||
|
\ . ' --nocolor'
|
||||||
if l:profile isnot? ''
|
\ . (!empty(l:profile) ? ' --profile ' . ale#Escape(l:profile) : '')
|
||||||
let l:command .= ' --profile ' . ale#Escape(l:profile)
|
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||||
endif
|
|
||||||
if l:options isnot? ''
|
|
||||||
let l:command .= ' ' . l:options
|
|
||||||
endif
|
|
||||||
|
|
||||||
return l:command
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
" Description: PHP Language server integration for ALE
|
" Description: PHP Language server integration for ALE
|
||||||
|
|
||||||
call ale#Set('php_langserver_executable', 'php-language-server.php')
|
call ale#Set('php_langserver_executable', 'php-language-server.php')
|
||||||
call ale#Set('php_langserver_use_global', 0)
|
call ale#Set('php_langserver_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||||
|
|
||||||
function! ale_linters#php#langserver#GetExecutable(buffer) abort
|
function! ale_linters#php#langserver#GetExecutable(buffer) abort
|
||||||
return ale#node#FindExecutable(a:buffer, 'php_langserver', [
|
return ale#node#FindExecutable(a:buffer, 'php_langserver', [
|
||||||
@@ -14,10 +14,6 @@ function! ale_linters#php#langserver#GetCommand(buffer) abort
|
|||||||
return 'php ' . ale#Escape(ale_linters#php#langserver#GetExecutable(a:buffer))
|
return 'php ' . ale#Escape(ale_linters#php#langserver#GetExecutable(a:buffer))
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! ale_linters#php#langserver#GetLanguage(buffer) abort
|
|
||||||
return 'php'
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! ale_linters#php#langserver#GetProjectRoot(buffer) abort
|
function! ale_linters#php#langserver#GetProjectRoot(buffer) abort
|
||||||
let l:git_path = ale#path#FindNearestDirectory(a:buffer, '.git')
|
let l:git_path = ale#path#FindNearestDirectory(a:buffer, '.git')
|
||||||
|
|
||||||
@@ -29,6 +25,6 @@ call ale#linter#Define('php', {
|
|||||||
\ 'lsp': 'stdio',
|
\ 'lsp': 'stdio',
|
||||||
\ 'executable_callback': 'ale_linters#php#langserver#GetExecutable',
|
\ 'executable_callback': 'ale_linters#php#langserver#GetExecutable',
|
||||||
\ 'command_callback': 'ale_linters#php#langserver#GetCommand',
|
\ 'command_callback': 'ale_linters#php#langserver#GetCommand',
|
||||||
\ 'language_callback': 'ale_linters#php#langserver#GetLanguage',
|
\ 'language': 'php',
|
||||||
\ 'project_root_callback': 'ale_linters#php#langserver#GetProjectRoot',
|
\ 'project_root_callback': 'ale_linters#php#langserver#GetProjectRoot',
|
||||||
\})
|
\})
|
||||||
|
|||||||
@@ -1,28 +1,65 @@
|
|||||||
" Author: diegoholiveira <https://github.com/diegoholiveira>
|
" Author: diegoholiveira <https://github.com/diegoholiveira>, haginaga <https://github.com/haginaga>
|
||||||
" Description: static analyzer for PHP
|
" Description: static analyzer for PHP
|
||||||
|
|
||||||
" Define the minimum severity
|
" Define the minimum severity
|
||||||
let g:ale_php_phan_minimum_severity = get(g:, 'ale_php_phan_minimum_severity', 0)
|
let g:ale_php_phan_minimum_severity = get(g:, 'ale_php_phan_minimum_severity', 0)
|
||||||
|
|
||||||
|
let g:ale_php_phan_executable = get(g:, 'ale_php_phan_executable', 'phan')
|
||||||
|
let g:ale_php_phan_use_client = get(g:, 'ale_php_phan_use_client', 0)
|
||||||
|
|
||||||
|
function! ale_linters#php#phan#GetExecutable(buffer) abort
|
||||||
|
let l:executable = ale#Var(a:buffer, 'php_phan_executable')
|
||||||
|
|
||||||
|
if ale#Var(a:buffer, 'php_phan_use_client') == 1 && l:executable is# 'phan'
|
||||||
|
let l:executable = 'phan_client'
|
||||||
|
endif
|
||||||
|
|
||||||
|
return l:executable
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! ale_linters#php#phan#GetCommand(buffer) abort
|
function! ale_linters#php#phan#GetCommand(buffer) abort
|
||||||
return 'phan -y '
|
if ale#Var(a:buffer, 'php_phan_use_client') == 1
|
||||||
\ . ale#Var(a:buffer, 'php_phan_minimum_severity')
|
let l:args = '-l '
|
||||||
\ . ' %s'
|
\ . ' %s'
|
||||||
|
else
|
||||||
|
let l:args = '-y '
|
||||||
|
\ . ale#Var(a:buffer, 'php_phan_minimum_severity')
|
||||||
|
\ . ' %s'
|
||||||
|
endif
|
||||||
|
|
||||||
|
let l:executable = ale_linters#php#phan#GetExecutable(a:buffer)
|
||||||
|
|
||||||
|
return ale#Escape(l:executable) . ' ' . l:args
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! ale_linters#php#phan#Handle(buffer, lines) abort
|
function! ale_linters#php#phan#Handle(buffer, lines) abort
|
||||||
" Matches against lines like the following:
|
" Matches against lines like the following:
|
||||||
"
|
if ale#Var(a:buffer, 'php_phan_use_client') == 1
|
||||||
" /path/to/some-filename.php:18 ERRORTYPE message
|
" Phan error: ERRORTYPE: message in /path/to/some-filename.php on line nnn
|
||||||
let l:pattern = '^.*:\(\d\+\)\s\(\w\+\)\s\(.\+\)$'
|
let l:pattern = '^Phan error: \(\w\+\): \(.\+\) in \(.\+\) on line \(\d\+\)$'
|
||||||
|
else
|
||||||
|
" /path/to/some-filename.php:18 ERRORTYPE message
|
||||||
|
let l:pattern = '^.*:\(\d\+\)\s\(\w\+\)\s\(.\+\)$'
|
||||||
|
endif
|
||||||
|
|
||||||
let l:output = []
|
let l:output = []
|
||||||
|
|
||||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||||
call add(l:output, {
|
if ale#Var(a:buffer, 'php_phan_use_client') == 1
|
||||||
\ 'lnum': l:match[1] + 0,
|
let l:dict = {
|
||||||
\ 'text': l:match[3],
|
\ 'lnum': l:match[4] + 0,
|
||||||
\ 'type': 'W',
|
\ 'text': l:match[2],
|
||||||
\})
|
\ 'type': 'W',
|
||||||
|
\}
|
||||||
|
else
|
||||||
|
let l:dict = {
|
||||||
|
\ 'lnum': l:match[1] + 0,
|
||||||
|
\ 'text': l:match[3],
|
||||||
|
\ 'type': 'W',
|
||||||
|
\}
|
||||||
|
endif
|
||||||
|
|
||||||
|
call add(l:output, l:dict)
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
return l:output
|
return l:output
|
||||||
@@ -30,7 +67,7 @@ endfunction
|
|||||||
|
|
||||||
call ale#linter#Define('php', {
|
call ale#linter#Define('php', {
|
||||||
\ 'name': 'phan',
|
\ 'name': 'phan',
|
||||||
\ 'executable': 'phan',
|
\ 'executable_callback': 'ale_linters#php#phan#GetExecutable',
|
||||||
\ 'command_callback': 'ale_linters#php#phan#GetCommand',
|
\ 'command_callback': 'ale_linters#php#phan#GetCommand',
|
||||||
\ 'callback': 'ale_linters#php#phan#Handle',
|
\ 'callback': 'ale_linters#php#phan#Handle',
|
||||||
\})
|
\})
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
let g:ale_php_phpcs_standard = get(g:, 'ale_php_phpcs_standard', '')
|
let g:ale_php_phpcs_standard = get(g:, 'ale_php_phpcs_standard', '')
|
||||||
|
|
||||||
call ale#Set('php_phpcs_executable', 'phpcs')
|
call ale#Set('php_phpcs_executable', 'phpcs')
|
||||||
call ale#Set('php_phpcs_use_global', 0)
|
call ale#Set('php_phpcs_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||||
|
|
||||||
function! ale_linters#php#phpcs#GetExecutable(buffer) abort
|
function! ale_linters#php#phpcs#GetExecutable(buffer) abort
|
||||||
return ale#node#FindExecutable(a:buffer, 'php_phpcs', [
|
return ale#node#FindExecutable(a:buffer, 'php_phpcs', [
|
||||||
|
|||||||
11
ale_linters/po/alex.vim
Normal file
11
ale_linters/po/alex.vim
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
" Author: Cian Butler https://github.com/butlerx
|
||||||
|
" Description: alex for PO files
|
||||||
|
|
||||||
|
call ale#linter#Define('po', {
|
||||||
|
\ 'name': 'alex',
|
||||||
|
\ 'executable': 'alex',
|
||||||
|
\ 'command': 'alex %s -t',
|
||||||
|
\ 'output_stream': 'stderr',
|
||||||
|
\ 'callback': 'ale#handlers#alex#Handle',
|
||||||
|
\ 'lint_file': 1,
|
||||||
|
\})
|
||||||
30
ale_linters/po/msgfmt.vim
Normal file
30
ale_linters/po/msgfmt.vim
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
" Author: Cian Butler https://github.com/butlerx
|
||||||
|
" Description: msgfmt for PO files
|
||||||
|
|
||||||
|
function! ale_linters#po#msgfmt#Handle(buffer, lines) abort
|
||||||
|
let l:results = ale#handlers#unix#HandleAsWarning(a:buffer, a:lines)
|
||||||
|
let l:index = 0
|
||||||
|
|
||||||
|
for l:item in l:results
|
||||||
|
if l:index > 0 && l:item.text =~? 'this is the location of the first definition'
|
||||||
|
let l:last_item = l:results[l:index - 1]
|
||||||
|
|
||||||
|
if l:last_item.text =~? 'duplicate message definition'
|
||||||
|
let l:last_item.text = 'duplicate of message at line ' . l:item.lnum
|
||||||
|
let l:item.text = 'first location of duplicate of message at line ' . l:last_item.lnum
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
let l:index += 1
|
||||||
|
endfor
|
||||||
|
|
||||||
|
return l:results
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('po', {
|
||||||
|
\ 'name': 'msgfmt',
|
||||||
|
\ 'executable': 'msgfmt',
|
||||||
|
\ 'output_stream': 'stderr',
|
||||||
|
\ 'command': 'msgfmt --statistics --output-file=- %t',
|
||||||
|
\ 'callback': 'ale_linters#po#msgfmt#Handle',
|
||||||
|
\})
|
||||||
9
ale_linters/po/proselint.vim
Normal file
9
ale_linters/po/proselint.vim
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
" Author: Cian Butler https://github.com/butlerx
|
||||||
|
" Description: proselint for PO files
|
||||||
|
|
||||||
|
call ale#linter#Define('po', {
|
||||||
|
\ 'name': 'proselint',
|
||||||
|
\ 'executable': 'proselint',
|
||||||
|
\ 'command': 'proselint %t',
|
||||||
|
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
||||||
|
\})
|
||||||
9
ale_linters/po/write-good.vim
Normal file
9
ale_linters/po/write-good.vim
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
" Author: Cian Butler https://github.com/butlerx
|
||||||
|
" Description: write-good for PO files
|
||||||
|
|
||||||
|
call ale#linter#Define('po', {
|
||||||
|
\ 'name': 'write-good',
|
||||||
|
\ 'executable_callback': 'ale#handlers#writegood#GetExecutable',
|
||||||
|
\ 'command_callback': 'ale#handlers#writegood#GetCommand',
|
||||||
|
\ 'callback': 'ale#handlers#writegood#Handle',
|
||||||
|
\})
|
||||||
21
ale_linters/pony/ponyc.vim
Normal file
21
ale_linters/pony/ponyc.vim
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
" Description: ponyc linter for pony files
|
||||||
|
|
||||||
|
call ale#Set('pony_ponyc_executable', 'ponyc')
|
||||||
|
call ale#Set('pony_ponyc_options', '--pass paint')
|
||||||
|
|
||||||
|
function! ale_linters#pony#ponyc#GetExecutable(buffer) abort
|
||||||
|
return ale#Var(a:buffer, 'pony_ponyc_executable')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#pony#ponyc#GetCommand(buffer) abort
|
||||||
|
return ale#Escape(ale_linters#pony#ponyc#GetExecutable(a:buffer))
|
||||||
|
\ . ' ' . ale#Var(a:buffer, 'pony_ponyc_options')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('pony', {
|
||||||
|
\ 'name': 'ponyc',
|
||||||
|
\ 'output_stream': 'stderr',
|
||||||
|
\ 'executable_callback': 'ale_linters#pony#ponyc#GetExecutable',
|
||||||
|
\ 'command_callback': 'ale_linters#pony#ponyc#GetCommand',
|
||||||
|
\ 'callback': 'ale#handlers#pony#HandlePonycFormat',
|
||||||
|
\})
|
||||||
@@ -1,12 +1,20 @@
|
|||||||
" Author: Jeff Willette <jrwillette88@gmail.com>
|
" Author: Jeff Willette <jrwillette88@gmail.com>
|
||||||
" Description: run the protoc-gen-lint plugin for the protoc binary
|
" Description: run the protoc-gen-lint plugin for the protoc binary
|
||||||
|
|
||||||
|
call ale#Set('proto_protoc_gen_lint_options', '')
|
||||||
|
|
||||||
function! ale_linters#proto#protoc_gen_lint#GetCommand(buffer) abort
|
function! ale_linters#proto#protoc_gen_lint#GetCommand(buffer) abort
|
||||||
let l:dirname = expand('#' . a:buffer . ':p:h')
|
let l:dirname = expand('#' . a:buffer . ':p:h')
|
||||||
|
|
||||||
return 'protoc'
|
let l:options = ['-I ' . ale#Escape(l:dirname)]
|
||||||
\ . ' -I ' . ale#Escape(l:dirname)
|
|
||||||
\ . ' --lint_out=. ' . '%s'
|
if !empty(ale#Var(a:buffer, 'proto_protoc_gen_lint_options'))
|
||||||
|
let l:options += [ale#Var(a:buffer, 'proto_protoc_gen_lint_options')]
|
||||||
|
endif
|
||||||
|
|
||||||
|
let l:options += ['--lint_out=. ' . '%s']
|
||||||
|
|
||||||
|
return 'protoc' . ' ' . join(l:options)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
call ale#linter#Define('proto', {
|
call ale#linter#Define('proto', {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
call ale#Set('pug_puglint_options', '')
|
call ale#Set('pug_puglint_options', '')
|
||||||
call ale#Set('pug_puglint_executable', 'pug-lint')
|
call ale#Set('pug_puglint_executable', 'pug-lint')
|
||||||
call ale#Set('pug_puglint_use_global', 0)
|
call ale#Set('pug_puglint_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||||
|
|
||||||
function! ale_linters#pug#puglint#GetExecutable(buffer) abort
|
function! ale_linters#pug#puglint#GetExecutable(buffer) abort
|
||||||
return ale#node#FindExecutable(a:buffer, 'pug_puglint', [
|
return ale#node#FindExecutable(a:buffer, 'pug_puglint', [
|
||||||
|
|||||||
@@ -1,14 +1,15 @@
|
|||||||
" Author: w0rp <devw0rp@gmail.com>
|
" Author: w0rp <devw0rp@gmail.com>
|
||||||
" Description: flake8 for python files
|
" Description: flake8 for python files
|
||||||
|
|
||||||
let g:ale_python_flake8_executable =
|
" remove in 2.0
|
||||||
\ get(g:, 'ale_python_flake8_executable', 'flake8')
|
|
||||||
|
|
||||||
" Support an old setting as a fallback.
|
" Support an old setting as a fallback.
|
||||||
|
let s:deprecation_warning_echoed = 0
|
||||||
let s:default_options = get(g:, 'ale_python_flake8_args', '')
|
let s:default_options = get(g:, 'ale_python_flake8_args', '')
|
||||||
let g:ale_python_flake8_options =
|
|
||||||
\ get(g:, 'ale_python_flake8_options', s:default_options)
|
call ale#Set('python_flake8_executable', 'flake8')
|
||||||
let g:ale_python_flake8_use_global = get(g:, 'ale_python_flake8_use_global', 0)
|
call ale#Set('python_flake8_options', s:default_options)
|
||||||
|
call ale#Set('python_flake8_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||||
|
call ale#Set('python_flake8_change_directory', 1)
|
||||||
|
|
||||||
function! s:UsingModule(buffer) abort
|
function! s:UsingModule(buffer) abort
|
||||||
return ale#Var(a:buffer, 'python_flake8_options') =~# ' *-m flake8'
|
return ale#Var(a:buffer, 'python_flake8_options') =~# ' *-m flake8'
|
||||||
@@ -39,6 +40,15 @@ function! ale_linters#python#flake8#VersionCheck(buffer) abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! ale_linters#python#flake8#GetCommand(buffer, version_output) abort
|
function! ale_linters#python#flake8#GetCommand(buffer, version_output) abort
|
||||||
|
" remove in 2.0
|
||||||
|
if exists('g:ale_python_flake8_args') && !s:deprecation_warning_echoed
|
||||||
|
execute 'echom ''Rename your g:ale_python_flake8_args setting to g:ale_python_flake8_options instead. Support for this will removed in ALE 2.0.'''
|
||||||
|
let s:deprecation_warning_echoed = 1
|
||||||
|
endif
|
||||||
|
|
||||||
|
let l:cd_string = ale#Var(a:buffer, 'python_flake8_change_directory')
|
||||||
|
\ ? ale#path#BufferCdString(a:buffer)
|
||||||
|
\ : ''
|
||||||
let l:executable = ale_linters#python#flake8#GetExecutable(a:buffer)
|
let l:executable = ale_linters#python#flake8#GetExecutable(a:buffer)
|
||||||
let l:version = ale#semver#GetVersion(l:executable, a:version_output)
|
let l:version = ale#semver#GetVersion(l:executable, a:version_output)
|
||||||
|
|
||||||
@@ -50,7 +60,8 @@ function! ale_linters#python#flake8#GetCommand(buffer, version_output) abort
|
|||||||
|
|
||||||
let l:options = ale#Var(a:buffer, 'python_flake8_options')
|
let l:options = ale#Var(a:buffer, 'python_flake8_options')
|
||||||
|
|
||||||
return ale#Escape(l:executable)
|
return l:cd_string
|
||||||
|
\ . ale#Escape(l:executable)
|
||||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||||
\ . ' --format=default'
|
\ . ' --format=default'
|
||||||
\ . l:display_name_args . ' -'
|
\ . l:display_name_args . ' -'
|
||||||
@@ -105,11 +116,16 @@ function! ale_linters#python#flake8#Handle(buffer, lines) abort
|
|||||||
\ 'type': 'W',
|
\ 'type': 'W',
|
||||||
\}
|
\}
|
||||||
|
|
||||||
if l:code[:0] is# 'F' || l:code is# 'E999'
|
if l:code[:0] is# 'F'
|
||||||
let l:item.type = 'E'
|
if l:code isnot# 'F401'
|
||||||
|
let l:item.type = 'E'
|
||||||
|
endif
|
||||||
elseif l:code[:0] is# 'E'
|
elseif l:code[:0] is# 'E'
|
||||||
let l:item.type = 'E'
|
let l:item.type = 'E'
|
||||||
let l:item.sub_type = 'style'
|
|
||||||
|
if l:code isnot# 'E999' && l:code isnot# 'E112'
|
||||||
|
let l:item.sub_type = 'style'
|
||||||
|
endif
|
||||||
elseif l:code[:0] is# 'W'
|
elseif l:code[:0] is# 'W'
|
||||||
let l:item.sub_type = 'style'
|
let l:item.sub_type = 'style'
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
" Author: Keith Smiley <k@keith.so>, w0rp <devw0rp@gmail.com>
|
" Author: Keith Smiley <k@keith.so>, w0rp <devw0rp@gmail.com>
|
||||||
" Description: mypy support for optional python typechecking
|
" Description: mypy support for optional python typechecking
|
||||||
|
|
||||||
let g:ale_python_mypy_executable =
|
call ale#Set('python_mypy_executable', 'mypy')
|
||||||
\ get(g:, 'ale_python_mypy_executable', 'mypy')
|
call ale#Set('python_mypy_ignore_invalid_syntax', 0)
|
||||||
let g:ale_python_mypy_options = get(g:, 'ale_python_mypy_options', '')
|
call ale#Set('python_mypy_options', '')
|
||||||
let g:ale_python_mypy_use_global = get(g:, 'ale_python_mypy_use_global', 0)
|
call ale#Set('python_mypy_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||||
|
|
||||||
function! ale_linters#python#mypy#GetExecutable(buffer) abort
|
function! ale_linters#python#mypy#GetExecutable(buffer) abort
|
||||||
return ale#python#FindExecutable(a:buffer, 'python_mypy', ['mypy'])
|
return ale#python#FindExecutable(a:buffer, 'python_mypy', ['mypy'])
|
||||||
@@ -45,6 +45,12 @@ function! ale_linters#python#mypy#Handle(buffer, lines) abort
|
|||||||
let l:output = []
|
let l:output = []
|
||||||
|
|
||||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||||
|
" Skip invalid syntax errors if the option is on.
|
||||||
|
if l:match[5] is# 'invalid syntax'
|
||||||
|
\&& ale#Var(a:buffer, 'python_mypy_ignore_invalid_syntax')
|
||||||
|
continue
|
||||||
|
endif
|
||||||
|
|
||||||
call add(l:output, {
|
call add(l:output, {
|
||||||
\ 'filename': ale#path#GetAbsPath(l:dir, l:match[1]),
|
\ 'filename': ale#path#GetAbsPath(l:dir, l:match[1]),
|
||||||
\ 'lnum': l:match[2] + 0,
|
\ 'lnum': l:match[2] + 0,
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ let g:ale_python_prospector_executable =
|
|||||||
let g:ale_python_prospector_options =
|
let g:ale_python_prospector_options =
|
||||||
\ get(g:, 'ale_python_prospector_options', '')
|
\ get(g:, 'ale_python_prospector_options', '')
|
||||||
|
|
||||||
let g:ale_python_prospector_use_global = get(g:, 'ale_python_prospector_use_global', 0)
|
let g:ale_python_prospector_use_global = get(g:, 'ale_python_prospector_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||||
|
|
||||||
function! ale_linters#python#prospector#GetExecutable(buffer) abort
|
function! ale_linters#python#prospector#GetExecutable(buffer) abort
|
||||||
return ale#python#FindExecutable(a:buffer, 'python_prospector', ['prospector'])
|
return ale#python#FindExecutable(a:buffer, 'python_prospector', ['prospector'])
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
call ale#Set('python_pycodestyle_executable', 'pycodestyle')
|
call ale#Set('python_pycodestyle_executable', 'pycodestyle')
|
||||||
call ale#Set('python_pycodestyle_options', '')
|
call ale#Set('python_pycodestyle_options', '')
|
||||||
call ale#Set('python_pycodestyle_use_global', 0)
|
call ale#Set('python_pycodestyle_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||||
|
|
||||||
function! ale_linters#python#pycodestyle#GetExecutable(buffer) abort
|
function! ale_linters#python#pycodestyle#GetExecutable(buffer) abort
|
||||||
return ale#python#FindExecutable(a:buffer, 'python_pycodestyle', ['pycodestyle'])
|
return ale#python#FindExecutable(a:buffer, 'python_pycodestyle', ['pycodestyle'])
|
||||||
@@ -44,8 +44,8 @@ function! ale_linters#python#pycodestyle#Handle(buffer, lines) abort
|
|||||||
\ 'code': l:match[4],
|
\ 'code': l:match[4],
|
||||||
\}
|
\}
|
||||||
|
|
||||||
" E999 is not a style error, it's a syntax error.
|
" E999 and E112 are syntax errors.
|
||||||
if l:match[4] is# 'E999'
|
if l:match[4] is# 'E999' || l:match[4] is# 'E112'
|
||||||
unlet l:item.sub_type
|
unlet l:item.sub_type
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
" Description: pyflakes for python files
|
" Description: pyflakes for python files
|
||||||
|
|
||||||
call ale#Set('python_pyflakes_executable', 'pyflakes')
|
call ale#Set('python_pyflakes_executable', 'pyflakes')
|
||||||
call ale#Set('python_pyflakes_use_global', 0)
|
call ale#Set('python_pyflakes_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||||
|
|
||||||
function! ale_linters#python#pyflakes#GetExecutable(buffer) abort
|
function! ale_linters#python#pyflakes#GetExecutable(buffer) abort
|
||||||
return ale#python#FindExecutable(a:buffer, 'python_pyflakes', ['pyflakes'])
|
return ale#python#FindExecutable(a:buffer, 'python_pyflakes', ['pyflakes'])
|
||||||
|
|||||||
@@ -1,20 +1,22 @@
|
|||||||
" Author: keith <k@keith.so>
|
" Author: keith <k@keith.so>
|
||||||
" Description: pylint for python files
|
" Description: pylint for python files
|
||||||
|
|
||||||
let g:ale_python_pylint_executable =
|
call ale#Set('python_pylint_executable', 'pylint')
|
||||||
\ get(g:, 'ale_python_pylint_executable', 'pylint')
|
call ale#Set('python_pylint_options', '')
|
||||||
|
call ale#Set('python_pylint_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||||
let g:ale_python_pylint_options =
|
call ale#Set('python_pylint_change_directory', 1)
|
||||||
\ get(g:, 'ale_python_pylint_options', '')
|
|
||||||
|
|
||||||
let g:ale_python_pylint_use_global = get(g:, 'ale_python_pylint_use_global', 0)
|
|
||||||
|
|
||||||
function! ale_linters#python#pylint#GetExecutable(buffer) abort
|
function! ale_linters#python#pylint#GetExecutable(buffer) abort
|
||||||
return ale#python#FindExecutable(a:buffer, 'python_pylint', ['pylint'])
|
return ale#python#FindExecutable(a:buffer, 'python_pylint', ['pylint'])
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! ale_linters#python#pylint#GetCommand(buffer) abort
|
function! ale_linters#python#pylint#GetCommand(buffer) abort
|
||||||
return ale#Escape(ale_linters#python#pylint#GetExecutable(a:buffer))
|
let l:cd_string = ale#Var(a:buffer, 'python_pylint_change_directory')
|
||||||
|
\ ? ale#path#BufferCdString(a:buffer)
|
||||||
|
\ : ''
|
||||||
|
|
||||||
|
return l:cd_string
|
||||||
|
\ . ale#Escape(ale_linters#python#pylint#GetExecutable(a:buffer))
|
||||||
\ . ' ' . ale#Var(a:buffer, 'python_pylint_options')
|
\ . ' ' . ale#Var(a:buffer, 'python_pylint_options')
|
||||||
\ . ' --output-format text --msg-template="{path}:{line}:{column}: {msg_id} ({symbol}) {msg}" --reports n'
|
\ . ' --output-format text --msg-template="{path}:{line}:{column}: {msg_id} ({symbol}) {msg}" --reports n'
|
||||||
\ . ' %s'
|
\ . ' %s'
|
||||||
@@ -24,7 +26,7 @@ function! ale_linters#python#pylint#Handle(buffer, lines) abort
|
|||||||
" Matches patterns like the following:
|
" Matches patterns like the following:
|
||||||
"
|
"
|
||||||
" test.py:4:4: W0101 (unreachable) Unreachable code
|
" test.py:4:4: W0101 (unreachable) Unreachable code
|
||||||
let l:pattern = '\v^[^:]+:(\d+):(\d+): ([[:alnum:]]+) \(([^(]*)\) (.*)$'
|
let l:pattern = '\v^[a-zA-Z]?:?[^:]+:(\d+):(\d+): ([[:alnum:]]+) \(([^(]*)\) (.*)$'
|
||||||
let l:output = []
|
let l:output = []
|
||||||
|
|
||||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
" Description: A language server for Python
|
" Description: A language server for Python
|
||||||
|
|
||||||
call ale#Set('python_pyls_executable', 'pyls')
|
call ale#Set('python_pyls_executable', 'pyls')
|
||||||
call ale#Set('python_pyls_use_global', 0)
|
call ale#Set('python_pyls_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||||
|
|
||||||
function! ale_linters#python#pyls#GetExecutable(buffer) abort
|
function! ale_linters#python#pyls#GetExecutable(buffer) abort
|
||||||
return ale#python#FindExecutable(a:buffer, 'python_pyls', ['pyls'])
|
return ale#python#FindExecutable(a:buffer, 'python_pyls', ['pyls'])
|
||||||
@@ -14,15 +14,12 @@ function! ale_linters#python#pyls#GetCommand(buffer) abort
|
|||||||
return ale#Escape(l:executable)
|
return ale#Escape(l:executable)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! ale_linters#python#pyls#GetLanguage(buffer) abort
|
|
||||||
return 'python'
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
call ale#linter#Define('python', {
|
call ale#linter#Define('python', {
|
||||||
\ 'name': 'pyls',
|
\ 'name': 'pyls',
|
||||||
\ 'lsp': 'stdio',
|
\ 'lsp': 'stdio',
|
||||||
\ 'executable_callback': 'ale_linters#python#pyls#GetExecutable',
|
\ 'executable_callback': 'ale_linters#python#pyls#GetExecutable',
|
||||||
\ 'command_callback': 'ale_linters#python#pyls#GetCommand',
|
\ 'command_callback': 'ale_linters#python#pyls#GetCommand',
|
||||||
\ 'language_callback': 'ale_linters#python#pyls#GetLanguage',
|
\ 'language': 'python',
|
||||||
\ 'project_root_callback': 'ale#python#FindProjectRoot',
|
\ 'project_root_callback': 'ale#python#FindProjectRoot',
|
||||||
|
\ 'completion_filter': 'ale#completion#python#CompletionItemFilter',
|
||||||
\})
|
\})
|
||||||
|
|||||||
40
ale_linters/qml/qmlfmt.vim
Normal file
40
ale_linters/qml/qmlfmt.vim
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
" Author: pylipp (www.github.com/pylipp)
|
||||||
|
" Description: qmlfmt for QML files
|
||||||
|
|
||||||
|
let g:ale_qml_qmlfmt_executable = get(g:, 'ale_qml_qmlfmt_executable', 'qmlfmt')
|
||||||
|
|
||||||
|
function! ale_linters#qml#qmlfmt#GetExecutable(buffer) abort
|
||||||
|
return ale#Var(a:buffer, 'qml_qmlfmt_executable')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#qml#qmlfmt#GetCommand(buffer) abort
|
||||||
|
return ale#Escape(ale_linters#qml#qmlfmt#GetExecutable(a:buffer))
|
||||||
|
\ . ' -e'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Find lines like
|
||||||
|
" Error:11:1: Expected token `}'
|
||||||
|
function! ale_linters#qml#qmlfmt#Handle(buffer, lines) abort
|
||||||
|
let l:pattern = '\v^(Error|Warning):(\d+):(\d+): (.+)$'
|
||||||
|
let l:output = []
|
||||||
|
|
||||||
|
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||||
|
let l:item = {
|
||||||
|
\ 'lnum': l:match[2] + 0,
|
||||||
|
\ 'col': l:match[3] + 0,
|
||||||
|
\ 'text': l:match[4],
|
||||||
|
\ 'type': l:match[1] is# 'Warning' ? 'W' : 'E',
|
||||||
|
\}
|
||||||
|
call add(l:output, l:item)
|
||||||
|
endfor
|
||||||
|
|
||||||
|
return l:output
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('qml', {
|
||||||
|
\ 'name': 'qmlfmt',
|
||||||
|
\ 'output_stream': 'stderr',
|
||||||
|
\ 'executable_callback': 'ale_linters#qml#qmlfmt#GetExecutable',
|
||||||
|
\ 'command_callback': 'ale_linters#qml#qmlfmt#GetCommand',
|
||||||
|
\ 'callback': 'ale_linters#qml#qmlfmt#Handle',
|
||||||
|
\})
|
||||||
29
ale_linters/qml/qmllint.vim
Normal file
29
ale_linters/qml/qmllint.vim
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
" Author: pylipp (www.github.com/pylipp)
|
||||||
|
" Description: qmllint for QML files
|
||||||
|
|
||||||
|
" Find lines like
|
||||||
|
" /home/foo_user42/code-base/qml/Screen.qml:11 : Expected token `}'
|
||||||
|
function! ale_linters#qml#qmllint#Handle(buffer, lines) abort
|
||||||
|
let l:pattern = '\v^[/_-a-zA-z0-9\. ]+:(\d+) : (.*)$'
|
||||||
|
let l:output = []
|
||||||
|
|
||||||
|
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||||
|
let l:item = {
|
||||||
|
\ 'lnum': l:match[1] + 0,
|
||||||
|
\ 'col': 0,
|
||||||
|
\ 'text': l:match[2],
|
||||||
|
\ 'type': 'E',
|
||||||
|
\}
|
||||||
|
call add(l:output, l:item)
|
||||||
|
endfor
|
||||||
|
|
||||||
|
return l:output
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('qml', {
|
||||||
|
\ 'name': 'qmllint',
|
||||||
|
\ 'output_stream': 'stderr',
|
||||||
|
\ 'executable': 'qmllint',
|
||||||
|
\ 'command': 'qmllint %t',
|
||||||
|
\ 'callback': 'ale_linters#qml#qmllint#Handle',
|
||||||
|
\})
|
||||||
@@ -1,14 +1,29 @@
|
|||||||
" Author: Michel Lang <michellang@gmail.com>, w0rp <devw0rp@gmail.com>
|
" Author: Michel Lang <michellang@gmail.com>, w0rp <devw0rp@gmail.com>,
|
||||||
|
" Fenner Macrae <fmacrae.dev@gmail.com>
|
||||||
" Description: This file adds support for checking R code with lintr.
|
" Description: This file adds support for checking R code with lintr.
|
||||||
|
|
||||||
let g:ale_r_lintr_options =
|
let g:ale_r_lintr_options = get(g:, 'ale_r_lintr_options', 'with_defaults()')
|
||||||
\ get(g:, 'ale_r_lintr_options', 'lintr::with_defaults()')
|
|
||||||
" A reasonable alternative default:
|
" A reasonable alternative default:
|
||||||
" \ get(g:, 'ale_r_lintr_options', 'lintr::with_defaults(object_usage_linter = NULL)')
|
" get(g:, 'ale_r_lintr_options', 'with_defaults(object_usage_linter = NULL)')
|
||||||
|
|
||||||
|
|
||||||
|
let g:ale_r_lintr_lint_package = get(g:, 'ale_r_lintr_lint_package', 0)
|
||||||
|
|
||||||
function! ale_linters#r#lintr#GetCommand(buffer) abort
|
function! ale_linters#r#lintr#GetCommand(buffer) abort
|
||||||
|
if ale#Var(a:buffer, 'r_lintr_lint_package')
|
||||||
|
let l:lint_cmd = 'lint_package(cache = FALSE, linters = '
|
||||||
|
\ . ale#Var(a:buffer, 'r_lintr_options') . ')'
|
||||||
|
else
|
||||||
|
let l:lint_cmd = 'lint(cache = FALSE, commandArgs(TRUE), '
|
||||||
|
\ . ale#Var(a:buffer, 'r_lintr_options') . ')'
|
||||||
|
endif
|
||||||
|
|
||||||
|
let l:cmd_string = 'suppressPackageStartupMessages(library(lintr));'
|
||||||
|
\ . l:lint_cmd
|
||||||
|
|
||||||
return ale#path#BufferCdString(a:buffer)
|
return ale#path#BufferCdString(a:buffer)
|
||||||
\ . 'Rscript -e ' . ale#Escape('lintr::lint(commandArgs(TRUE)[1], eval(parse(text = commandArgs(TRUE)[2])))') . ' %t' . ' ' . ale#Escape(ale#Var(a:buffer, 'r_lintr_options'))
|
\ . 'Rscript -e '
|
||||||
|
\ . ale#Escape(l:cmd_string) . ' %t'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
call ale#linter#Define('r', {
|
call ale#linter#Define('r', {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
" Description: A language server for Reason
|
" Description: A language server for Reason
|
||||||
|
|
||||||
call ale#Set('reason_ols_executable', 'ocaml-language-server')
|
call ale#Set('reason_ols_executable', 'ocaml-language-server')
|
||||||
call ale#Set('reason_ols_use_global', 0)
|
call ale#Set('reason_ols_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||||
|
|
||||||
call ale#linter#Define('reason', {
|
call ale#linter#Define('reason', {
|
||||||
\ 'name': 'ols',
|
\ 'name': 'ols',
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
" Author: Daniel Schemala <istjanichtzufassen@gmail.com>
|
" Author: Daniel Schemala <istjanichtzufassen@gmail.com>,
|
||||||
|
" Ivan Petkov <ivanppetkov@gmail.com>
|
||||||
" Description: rustc invoked by cargo for rust files
|
" Description: rustc invoked by cargo for rust files
|
||||||
|
|
||||||
call ale#Set('rust_cargo_use_check', 1)
|
call ale#Set('rust_cargo_use_check', 1)
|
||||||
call ale#Set('rust_cargo_check_all_targets', 0)
|
call ale#Set('rust_cargo_check_all_targets', 0)
|
||||||
|
call ale#Set('rust_cargo_default_feature_behavior', 'default')
|
||||||
|
call ale#Set('rust_cargo_include_features', '')
|
||||||
|
|
||||||
function! ale_linters#rust#cargo#GetCargoExecutable(bufnr) abort
|
function! ale_linters#rust#cargo#GetCargoExecutable(bufnr) abort
|
||||||
if ale#path#FindNearestFile(a:bufnr, 'Cargo.toml') isnot# ''
|
if ale#path#FindNearestFile(a:bufnr, 'Cargo.toml') isnot# ''
|
||||||
@@ -29,10 +32,27 @@ function! ale_linters#rust#cargo#GetCommand(buffer, version_output) abort
|
|||||||
\ && ale#Var(a:buffer, 'rust_cargo_check_all_targets')
|
\ && ale#Var(a:buffer, 'rust_cargo_check_all_targets')
|
||||||
\ && ale#semver#GTE(l:version, [0, 22, 0])
|
\ && ale#semver#GTE(l:version, [0, 22, 0])
|
||||||
|
|
||||||
|
let l:include_features = ale#Var(a:buffer, 'rust_cargo_include_features')
|
||||||
|
if !empty(l:include_features)
|
||||||
|
let l:include_features = ' --features ' . ale#Escape(l:include_features)
|
||||||
|
endif
|
||||||
|
|
||||||
|
let l:default_feature_behavior = ale#Var(a:buffer, 'rust_cargo_default_feature_behavior')
|
||||||
|
if l:default_feature_behavior is# 'all'
|
||||||
|
let l:include_features = ''
|
||||||
|
let l:default_feature = ' --all-features'
|
||||||
|
elseif l:default_feature_behavior is# 'none'
|
||||||
|
let l:default_feature = ' --no-default-features'
|
||||||
|
else
|
||||||
|
let l:default_feature = ''
|
||||||
|
endif
|
||||||
|
|
||||||
return 'cargo '
|
return 'cargo '
|
||||||
\ . (l:use_check ? 'check' : 'build')
|
\ . (l:use_check ? 'check' : 'build')
|
||||||
\ . (l:use_all_targets ? ' --all-targets' : '')
|
\ . (l:use_all_targets ? ' --all-targets' : '')
|
||||||
\ . ' --frozen --message-format=json -q'
|
\ . ' --frozen --message-format=json -q'
|
||||||
|
\ . l:default_feature
|
||||||
|
\ . l:include_features
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
call ale#linter#Define('rust', {
|
call ale#linter#Define('rust', {
|
||||||
|
|||||||
@@ -12,12 +12,11 @@ function! ale_linters#rust#rls#GetCommand(buffer) abort
|
|||||||
let l:executable = ale_linters#rust#rls#GetExecutable(a:buffer)
|
let l:executable = ale_linters#rust#rls#GetExecutable(a:buffer)
|
||||||
let l:toolchain = ale#Var(a:buffer, 'rust_rls_toolchain')
|
let l:toolchain = ale#Var(a:buffer, 'rust_rls_toolchain')
|
||||||
|
|
||||||
return ale#Escape(l:executable)
|
if empty(l:toolchain)
|
||||||
\ . ' +' . ale#Escape(l:toolchain)
|
return ale#Escape(l:executable)
|
||||||
endfunction
|
else
|
||||||
|
return ale#Escape(l:executable) . ' +' . ale#Escape(l:toolchain)
|
||||||
function! ale_linters#rust#rls#GetLanguage(buffer) abort
|
endif
|
||||||
return 'rust'
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! ale_linters#rust#rls#GetProjectRoot(buffer) abort
|
function! ale_linters#rust#rls#GetProjectRoot(buffer) abort
|
||||||
@@ -31,6 +30,6 @@ call ale#linter#Define('rust', {
|
|||||||
\ 'lsp': 'stdio',
|
\ 'lsp': 'stdio',
|
||||||
\ 'executable_callback': 'ale_linters#rust#rls#GetExecutable',
|
\ 'executable_callback': 'ale_linters#rust#rls#GetExecutable',
|
||||||
\ 'command_callback': 'ale_linters#rust#rls#GetCommand',
|
\ 'command_callback': 'ale_linters#rust#rls#GetCommand',
|
||||||
\ 'language_callback': 'ale_linters#rust#rls#GetLanguage',
|
\ 'language': 'rust',
|
||||||
\ 'project_root_callback': 'ale_linters#rust#rls#GetProjectRoot',
|
\ 'project_root_callback': 'ale_linters#rust#rls#GetProjectRoot',
|
||||||
\})
|
\})
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
" Author: KabbAmine - https://github.com/KabbAmine
|
" Author: KabbAmine - https://github.com/KabbAmine,
|
||||||
|
" Ben Falconer <ben@falconers.me.uk>
|
||||||
|
|
||||||
call ale#linter#Define('sass', {
|
call ale#linter#Define('sass', {
|
||||||
\ 'name': 'sasslint',
|
\ 'name': 'sasslint',
|
||||||
\ 'executable': 'sass-lint',
|
\ 'executable': 'sass-lint',
|
||||||
\ 'command': 'sass-lint -v -q -f compact %t',
|
\ 'command_callback': 'ale#handlers#sasslint#GetCommand',
|
||||||
\ 'callback': 'ale#handlers#css#HandleCSSLintFormat',
|
\ 'callback': 'ale#handlers#css#HandleCSSLintFormat',
|
||||||
\})
|
\})
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
" Author: diartyz <diartyz@gmail.com>
|
" Author: diartyz <diartyz@gmail.com>
|
||||||
|
|
||||||
call ale#Set('sass_stylelint_executable', 'stylelint')
|
call ale#Set('sass_stylelint_executable', 'stylelint')
|
||||||
call ale#Set('sass_stylelint_use_global', 0)
|
call ale#Set('sass_stylelint_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||||
|
|
||||||
function! ale_linters#sass#stylelint#GetExecutable(buffer) abort
|
function! ale_linters#sass#stylelint#GetExecutable(buffer) abort
|
||||||
return ale#node#FindExecutable(a:buffer, 'sass_stylelint', [
|
return ale#node#FindExecutable(a:buffer, 'sass_stylelint', [
|
||||||
|
|||||||
29
ale_linters/scala/fsc.vim
Normal file
29
ale_linters/scala/fsc.vim
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
" Author: Nils Leuzinger - https://github.com/PawkyPenguin
|
||||||
|
" Description: Basic scala support using fsc
|
||||||
|
"
|
||||||
|
function! ale_linters#scala#fsc#GetExecutable(buffer) abort
|
||||||
|
if index(split(getbufvar(a:buffer, '&filetype'), '\.'), 'sbt') >= 0
|
||||||
|
" Don't check sbt files
|
||||||
|
return ''
|
||||||
|
endif
|
||||||
|
|
||||||
|
return 'fsc'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#scala#fsc#GetCommand(buffer) abort
|
||||||
|
let l:executable = ale_linters#scala#fsc#GetExecutable(a:buffer)
|
||||||
|
|
||||||
|
if empty(l:executable)
|
||||||
|
return ''
|
||||||
|
endif
|
||||||
|
|
||||||
|
return ale#Escape(l:executable) . ' -Ystop-after:parser %t'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('scala', {
|
||||||
|
\ 'name': 'fsc',
|
||||||
|
\ 'executable_callback': 'ale_linters#scala#fsc#GetExecutable',
|
||||||
|
\ 'command_callback': 'ale_linters#scala#fsc#GetCommand',
|
||||||
|
\ 'callback': 'ale#handlers#scala#HandleScalacLintFormat',
|
||||||
|
\ 'output_stream': 'stderr',
|
||||||
|
\})
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
function! ale_linters#scala#scalac#GetExecutable(buffer) abort
|
function! ale_linters#scala#scalac#GetExecutable(buffer) abort
|
||||||
if index(split(getbufvar(a:buffer, '&filetype'), '\.'), 'sbt') >= 0
|
if index(split(getbufvar(a:buffer, '&filetype'), '\.'), 'sbt') >= 0
|
||||||
" Don't check sbt files with scalac.
|
" Don't check sbt files
|
||||||
return ''
|
return ''
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -21,45 +21,10 @@ function! ale_linters#scala#scalac#GetCommand(buffer) abort
|
|||||||
return ale#Escape(l:executable) . ' -Ystop-after:parser %t'
|
return ale#Escape(l:executable) . ' -Ystop-after:parser %t'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! ale_linters#scala#scalac#Handle(buffer, lines) abort
|
|
||||||
" Matches patterns line the following:
|
|
||||||
"
|
|
||||||
" /var/folders/5q/20rgxx3x1s34g3m14n5bq0x80000gn/T/vv6pSsy/0:26: error: expected class or object definition
|
|
||||||
let l:pattern = '^.\+:\(\d\+\): \(\w\+\): \(.\+\)'
|
|
||||||
let l:output = []
|
|
||||||
let l:ln = 0
|
|
||||||
|
|
||||||
for l:line in a:lines
|
|
||||||
let l:ln = l:ln + 1
|
|
||||||
let l:match = matchlist(l:line, l:pattern)
|
|
||||||
|
|
||||||
if len(l:match) == 0
|
|
||||||
continue
|
|
||||||
endif
|
|
||||||
|
|
||||||
let l:text = l:match[3]
|
|
||||||
let l:type = l:match[2] is# 'error' ? 'E' : 'W'
|
|
||||||
let l:col = 0
|
|
||||||
|
|
||||||
if l:ln + 1 < len(a:lines)
|
|
||||||
let l:col = stridx(a:lines[l:ln + 1], '^')
|
|
||||||
endif
|
|
||||||
|
|
||||||
call add(l:output, {
|
|
||||||
\ 'lnum': l:match[1] + 0,
|
|
||||||
\ 'col': l:col + 1,
|
|
||||||
\ 'text': l:text,
|
|
||||||
\ 'type': l:type,
|
|
||||||
\})
|
|
||||||
endfor
|
|
||||||
|
|
||||||
return l:output
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
call ale#linter#Define('scala', {
|
call ale#linter#Define('scala', {
|
||||||
\ 'name': 'scalac',
|
\ 'name': 'scalac',
|
||||||
\ 'executable_callback': 'ale_linters#scala#scalac#GetExecutable',
|
\ 'executable_callback': 'ale_linters#scala#scalac#GetExecutable',
|
||||||
\ 'command_callback': 'ale_linters#scala#scalac#GetCommand',
|
\ 'command_callback': 'ale_linters#scala#scalac#GetCommand',
|
||||||
\ 'callback': 'ale_linters#scala#scalac#Handle',
|
\ 'callback': 'ale#handlers#scala#HandleScalacLintFormat',
|
||||||
\ 'output_stream': 'stderr',
|
\ 'output_stream': 'stderr',
|
||||||
\})
|
\})
|
||||||
|
|||||||
@@ -1,8 +1,18 @@
|
|||||||
" Author: KabbAmine - https://github.com/KabbAmine
|
" Author: KabbAmine - https://github.com/KabbAmine, Ben Falconer
|
||||||
|
" <ben@falconers.me.uk>
|
||||||
|
|
||||||
|
function! ale_linters#scss#sasslint#GetCommand(buffer) abort
|
||||||
|
return ale#path#BufferCdString(a:buffer)
|
||||||
|
\ . ale#Escape('sass-lint')
|
||||||
|
\ . ' -v'
|
||||||
|
\ . ' -q'
|
||||||
|
\ . ' -f compact'
|
||||||
|
\ . ' %t'
|
||||||
|
endfunction
|
||||||
|
|
||||||
call ale#linter#Define('scss', {
|
call ale#linter#Define('scss', {
|
||||||
\ 'name': 'sasslint',
|
\ 'name': 'sasslint',
|
||||||
\ 'executable': 'sass-lint',
|
\ 'executable': 'sass-lint',
|
||||||
\ 'command': 'sass-lint -v -q -f compact %t',
|
\ 'command_callback': 'ale_linters#scss#sasslint#GetCommand',
|
||||||
\ 'callback': 'ale#handlers#css#HandleCSSLintFormat',
|
\ 'callback': 'ale#handlers#css#HandleCSSLintFormat',
|
||||||
\})
|
\})
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
" Author: diartyz <diartyz@gmail.com>
|
" Author: diartyz <diartyz@gmail.com>
|
||||||
|
|
||||||
call ale#Set('scss_stylelint_executable', 'stylelint')
|
call ale#Set('scss_stylelint_executable', 'stylelint')
|
||||||
call ale#Set('scss_stylelint_use_global', 0)
|
call ale#Set('scss_stylelint_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||||
|
|
||||||
function! ale_linters#scss#stylelint#GetExecutable(buffer) abort
|
function! ale_linters#scss#stylelint#GetExecutable(buffer) abort
|
||||||
return ale#node#FindExecutable(a:buffer, 'scss_stylelint', [
|
return ale#node#FindExecutable(a:buffer, 'scss_stylelint', [
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
call ale#Set('stylus_stylelint_executable', 'stylelint')
|
call ale#Set('stylus_stylelint_executable', 'stylelint')
|
||||||
call ale#Set('stylus_stylelint_options', '')
|
call ale#Set('stylus_stylelint_options', '')
|
||||||
call ale#Set('stylus_stylelint_use_global', 0)
|
call ale#Set('stylus_stylelint_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||||
|
|
||||||
function! ale_linters#stylus#stylelint#GetExecutable(buffer) abort
|
function! ale_linters#stylus#stylelint#GetExecutable(buffer) abort
|
||||||
return ale#node#FindExecutable(a:buffer, 'stylus_stylelint', [
|
return ale#node#FindExecutable(a:buffer, 'stylus_stylelint', [
|
||||||
|
|||||||
9
ale_linters/text/textlint.vim
Normal file
9
ale_linters/text/textlint.vim
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
" Author: Yasuhiro Kiyota <yasuhiroki.duck@gmail.com>
|
||||||
|
" Description: textlint, a proofreading tool (https://textlint.github.io/)
|
||||||
|
|
||||||
|
call ale#linter#Define('text', {
|
||||||
|
\ 'name': 'textlint',
|
||||||
|
\ 'executable_callback': 'ale#handlers#textlint#GetExecutable',
|
||||||
|
\ 'command_callback': 'ale#handlers#textlint#GetCommand',
|
||||||
|
\ 'callback': 'ale#handlers#textlint#HandleTextlintOutput',
|
||||||
|
\})
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
call ale#Set('typescript_tslint_executable', 'tslint')
|
call ale#Set('typescript_tslint_executable', 'tslint')
|
||||||
call ale#Set('typescript_tslint_config_path', '')
|
call ale#Set('typescript_tslint_config_path', '')
|
||||||
call ale#Set('typescript_tslint_rules_dir', '')
|
call ale#Set('typescript_tslint_rules_dir', '')
|
||||||
call ale#Set('typescript_tslint_use_global', 0)
|
call ale#Set('typescript_tslint_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||||
call ale#Set('typescript_tslint_ignore_empty_files', 0)
|
call ale#Set('typescript_tslint_ignore_empty_files', 0)
|
||||||
|
|
||||||
function! ale_linters#typescript#tslint#GetExecutable(buffer) abort
|
function! ale_linters#typescript#tslint#GetExecutable(buffer) abort
|
||||||
@@ -70,7 +70,7 @@ function! ale_linters#typescript#tslint#GetCommand(buffer) abort
|
|||||||
\ : ''
|
\ : ''
|
||||||
|
|
||||||
return ale#path#BufferCdString(a:buffer)
|
return ale#path#BufferCdString(a:buffer)
|
||||||
\ . ale_linters#typescript#tslint#GetExecutable(a:buffer)
|
\ . ale#Escape(ale_linters#typescript#tslint#GetExecutable(a:buffer))
|
||||||
\ . ' --format json'
|
\ . ' --format json'
|
||||||
\ . l:tslint_config_option
|
\ . l:tslint_config_option
|
||||||
\ . l:tslint_rules_option
|
\ . l:tslint_rules_option
|
||||||
|
|||||||
@@ -3,17 +3,13 @@
|
|||||||
|
|
||||||
call ale#Set('typescript_tsserver_executable', 'tsserver')
|
call ale#Set('typescript_tsserver_executable', 'tsserver')
|
||||||
call ale#Set('typescript_tsserver_config_path', '')
|
call ale#Set('typescript_tsserver_config_path', '')
|
||||||
call ale#Set('typescript_tsserver_use_global', 0)
|
call ale#Set('typescript_tsserver_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||||
|
|
||||||
" These functions need to be defined just to comply with the API for LSP.
|
" These functions need to be defined just to comply with the API for LSP.
|
||||||
function! ale_linters#typescript#tsserver#GetProjectRoot(buffer) abort
|
function! ale_linters#typescript#tsserver#GetProjectRoot(buffer) abort
|
||||||
return ''
|
return ''
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! ale_linters#typescript#tsserver#GetLanguage(buffer) abort
|
|
||||||
return ''
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! ale_linters#typescript#tsserver#GetExecutable(buffer) abort
|
function! ale_linters#typescript#tsserver#GetExecutable(buffer) abort
|
||||||
return ale#node#FindExecutable(a:buffer, 'typescript_tsserver', [
|
return ale#node#FindExecutable(a:buffer, 'typescript_tsserver', [
|
||||||
\ 'node_modules/.bin/tsserver',
|
\ 'node_modules/.bin/tsserver',
|
||||||
@@ -26,5 +22,5 @@ call ale#linter#Define('typescript', {
|
|||||||
\ 'executable_callback': 'ale_linters#typescript#tsserver#GetExecutable',
|
\ 'executable_callback': 'ale_linters#typescript#tsserver#GetExecutable',
|
||||||
\ 'command_callback': 'ale_linters#typescript#tsserver#GetExecutable',
|
\ 'command_callback': 'ale_linters#typescript#tsserver#GetExecutable',
|
||||||
\ 'project_root_callback': 'ale_linters#typescript#tsserver#GetProjectRoot',
|
\ 'project_root_callback': 'ale_linters#typescript#tsserver#GetProjectRoot',
|
||||||
\ 'language_callback': 'ale_linters#typescript#tsserver#GetLanguage',
|
\ 'language': '',
|
||||||
\})
|
\})
|
||||||
|
|||||||
@@ -2,31 +2,38 @@
|
|||||||
" Description: This file adds support for checking Vim code with Vint.
|
" Description: This file adds support for checking Vim code with Vint.
|
||||||
|
|
||||||
" This flag can be used to change enable/disable style issues.
|
" This flag can be used to change enable/disable style issues.
|
||||||
let g:ale_vim_vint_show_style_issues =
|
call ale#Set('vim_vint_show_style_issues', 1)
|
||||||
\ get(g:, 'ale_vim_vint_show_style_issues', 1)
|
call ale#Set('vim_vint_executable', 'vint')
|
||||||
let s:enable_neovim = has('nvim') ? ' --enable-neovim ' : ''
|
let s:enable_neovim = has('nvim') ? ' --enable-neovim' : ''
|
||||||
let s:format = '-f "{file_path}:{line_number}:{column_number}: {severity}: {description} (see {reference})"'
|
let s:format = '-f "{file_path}:{line_number}:{column_number}: {severity}: {description} (see {reference})"'
|
||||||
|
|
||||||
|
function! ale_linters#vim#vint#GetExecutable(buffer) abort
|
||||||
|
return ale#Var(a:buffer, 'vim_vint_executable')
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! ale_linters#vim#vint#VersionCommand(buffer) abort
|
function! ale_linters#vim#vint#VersionCommand(buffer) abort
|
||||||
|
let l:executable = ale_linters#vim#vint#GetExecutable(a:buffer)
|
||||||
|
|
||||||
" Check the Vint version if we haven't checked it already.
|
" Check the Vint version if we haven't checked it already.
|
||||||
return !ale#semver#HasVersion('vint')
|
return !ale#semver#HasVersion(l:executable)
|
||||||
\ ? 'vint --version'
|
\ ? ale#Escape(l:executable) . ' --version'
|
||||||
\ : ''
|
\ : ''
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! ale_linters#vim#vint#GetCommand(buffer, version_output) abort
|
function! ale_linters#vim#vint#GetCommand(buffer, version_output) abort
|
||||||
let l:version = ale#semver#GetVersion('vint', a:version_output)
|
let l:executable = ale_linters#vim#vint#GetExecutable(a:buffer)
|
||||||
|
let l:version = ale#semver#GetVersion(l:executable, a:version_output)
|
||||||
|
|
||||||
let l:can_use_no_color_flag = empty(l:version)
|
let l:can_use_no_color_flag = empty(l:version)
|
||||||
\ || ale#semver#GTE(l:version, [0, 3, 7])
|
\ || ale#semver#GTE(l:version, [0, 3, 7])
|
||||||
|
|
||||||
let l:warning_flag = ale#Var(a:buffer, 'vim_vint_show_style_issues') ? '-s' : '-w'
|
let l:warning_flag = ale#Var(a:buffer, 'vim_vint_show_style_issues') ? '-s' : '-w'
|
||||||
|
|
||||||
return 'vint '
|
return ale#Escape(l:executable)
|
||||||
\ . l:warning_flag . ' '
|
\ . ' ' . l:warning_flag
|
||||||
\ . (l:can_use_no_color_flag ? '--no-color ' : '')
|
\ . (l:can_use_no_color_flag ? ' --no-color' : '')
|
||||||
\ . s:enable_neovim
|
\ . s:enable_neovim
|
||||||
\ . s:format
|
\ . ' ' . s:format
|
||||||
\ . ' %t'
|
\ . ' %t'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@@ -58,7 +65,7 @@ endfunction
|
|||||||
|
|
||||||
call ale#linter#Define('vim', {
|
call ale#linter#Define('vim', {
|
||||||
\ 'name': 'vint',
|
\ 'name': 'vint',
|
||||||
\ 'executable': 'vint',
|
\ 'executable_callback': 'ale_linters#vim#vint#GetExecutable',
|
||||||
\ 'command_chain': [
|
\ 'command_chain': [
|
||||||
\ {'callback': 'ale_linters#vim#vint#VersionCommand', 'output_stream': 'stderr'},
|
\ {'callback': 'ale_linters#vim#vint#VersionCommand', 'output_stream': 'stderr'},
|
||||||
\ {'callback': 'ale_linters#vim#vint#GetCommand', 'output_stream': 'stdout'},
|
\ {'callback': 'ale_linters#vim#vint#GetCommand', 'output_stream': 'stdout'},
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
" Description: This file adds support for linting Swagger / OpenAPI documents using swaglint
|
" Description: This file adds support for linting Swagger / OpenAPI documents using swaglint
|
||||||
|
|
||||||
call ale#Set('yaml_swaglint_executable', 'swaglint')
|
call ale#Set('yaml_swaglint_executable', 'swaglint')
|
||||||
call ale#Set('yaml_swaglint_use_global', 0)
|
call ale#Set('yaml_swaglint_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||||
|
|
||||||
function! ale_linters#yaml#swaglint#GetExecutable(buffer) abort
|
function! ale_linters#yaml#swaglint#GetExecutable(buffer) abort
|
||||||
return ale#node#FindExecutable(a:buffer, 'yaml_swaglint', [
|
return ale#node#FindExecutable(a:buffer, 'yaml_swaglint', [
|
||||||
|
|||||||
@@ -2,6 +2,11 @@
|
|||||||
" Description: Primary code path for the plugin
|
" Description: Primary code path for the plugin
|
||||||
" Manages execution of linters when requested by autocommands
|
" Manages execution of linters when requested by autocommands
|
||||||
|
|
||||||
|
" Strings used for severity in the echoed message
|
||||||
|
let g:ale_echo_msg_error_str = get(g:, 'ale_echo_msg_error_str', 'Error')
|
||||||
|
let g:ale_echo_msg_info_str = get(g:, 'ale_echo_msg_info_str', 'Info')
|
||||||
|
let g:ale_echo_msg_warning_str = get(g:, 'ale_echo_msg_warning_str', 'Warning')
|
||||||
|
|
||||||
let s:lint_timer = -1
|
let s:lint_timer = -1
|
||||||
let s:queued_buffer_number = -1
|
let s:queued_buffer_number = -1
|
||||||
let s:should_lint_file_for_buffer = {}
|
let s:should_lint_file_for_buffer = {}
|
||||||
@@ -32,8 +37,8 @@ function! ale#CallWithCooldown(timestamp_key, func, arglist) abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Return 1 if a file is too large for ALE to handle.
|
" Return 1 if a file is too large for ALE to handle.
|
||||||
function! ale#FileTooLarge() abort
|
function! ale#FileTooLarge(buffer) abort
|
||||||
let l:max = ale#Var(bufnr(''), 'maximum_file_size')
|
let l:max = getbufvar(a:buffer, 'ale_maximum_file_size', get(g:, 'ale_maximum_file_size', 0))
|
||||||
|
|
||||||
return l:max > 0 ? (line2byte(line('$') + 1) > l:max) : 0
|
return l:max > 0 ? (line2byte(line('$') + 1) > l:max) : 0
|
||||||
endfunction
|
endfunction
|
||||||
@@ -46,39 +51,47 @@ function! ale#ShouldDoNothing(buffer) abort
|
|||||||
" The checks are split into separate if statements to make it possible to
|
" The checks are split into separate if statements to make it possible to
|
||||||
" profile each check individually with Vim's profiling tools.
|
" profile each check individually with Vim's profiling tools.
|
||||||
|
|
||||||
|
" Do nothing if ALE is disabled.
|
||||||
|
if !getbufvar(a:buffer, 'ale_enabled', get(g:, 'ale_enabled', 0))
|
||||||
|
return 1
|
||||||
|
endif
|
||||||
|
|
||||||
" Don't perform any checks when newer NeoVim versions are exiting.
|
" Don't perform any checks when newer NeoVim versions are exiting.
|
||||||
if get(v:, 'exiting', v:null) isnot v:null
|
if get(v:, 'exiting', v:null) isnot v:null
|
||||||
return 1
|
return 1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Do nothing for blacklisted files
|
let l:filetype = getbufvar(a:buffer, '&filetype')
|
||||||
if index(g:ale_filetype_blacklist, getbufvar(a:buffer, '&filetype')) >= 0
|
|
||||||
|
" Do nothing when there's no filetype.
|
||||||
|
if l:filetype is# ''
|
||||||
return 1
|
return 1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Do nothing if running from command mode
|
" Do nothing for blacklisted files.
|
||||||
|
if index(get(g:, 'ale_filetype_blacklist', []), l:filetype) >= 0
|
||||||
|
return 1
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Do nothing if running from command mode.
|
||||||
if s:getcmdwintype_exists && !empty(getcmdwintype())
|
if s:getcmdwintype_exists && !empty(getcmdwintype())
|
||||||
return 1
|
return 1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let l:filename = fnamemodify(bufname(a:buffer), ':t')
|
let l:filename = fnamemodify(bufname(a:buffer), ':t')
|
||||||
|
|
||||||
|
" Do nothing for directories.
|
||||||
if l:filename is# '.'
|
if l:filename is# '.'
|
||||||
return 1
|
return 1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Do nothing if running in the sandbox
|
" Do nothing if running in the sandbox.
|
||||||
if ale#util#InSandbox()
|
if ale#util#InSandbox()
|
||||||
return 1
|
return 1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Do nothing if ALE is disabled.
|
|
||||||
if !ale#Var(a:buffer, 'enabled')
|
|
||||||
return 1
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Do nothing if the file is too large.
|
" Do nothing if the file is too large.
|
||||||
if ale#FileTooLarge()
|
if ale#FileTooLarge(a:buffer)
|
||||||
return 1
|
return 1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|||||||
77
autoload/ale/autocmd.vim
Normal file
77
autoload/ale/autocmd.vim
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
function! ale#autocmd#InitAuGroups() abort
|
||||||
|
" This value used to be a Boolean as a Number, and is now a String.
|
||||||
|
let l:text_changed = '' . g:ale_lint_on_text_changed
|
||||||
|
|
||||||
|
augroup ALEPatternOptionsGroup
|
||||||
|
autocmd!
|
||||||
|
autocmd BufEnter,BufRead * call ale#pattern_options#SetOptions(str2nr(expand('<abuf>')))
|
||||||
|
augroup END
|
||||||
|
|
||||||
|
augroup ALERunOnTextChangedGroup
|
||||||
|
autocmd!
|
||||||
|
if g:ale_enabled
|
||||||
|
if l:text_changed is? 'always' || l:text_changed is# '1'
|
||||||
|
autocmd TextChanged,TextChangedI * call ale#Queue(g:ale_lint_delay)
|
||||||
|
elseif l:text_changed is? 'normal'
|
||||||
|
autocmd TextChanged * call ale#Queue(g:ale_lint_delay)
|
||||||
|
elseif l:text_changed is? 'insert'
|
||||||
|
autocmd TextChangedI * call ale#Queue(g:ale_lint_delay)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
augroup END
|
||||||
|
|
||||||
|
augroup ALERunOnEnterGroup
|
||||||
|
autocmd!
|
||||||
|
if g:ale_enabled
|
||||||
|
" Handle everything that needs to happen when buffers are entered.
|
||||||
|
autocmd BufEnter * call ale#events#EnterEvent(str2nr(expand('<abuf>')))
|
||||||
|
endif
|
||||||
|
if g:ale_enabled && g:ale_lint_on_enter
|
||||||
|
autocmd BufWinEnter,BufRead * call ale#Queue(0, 'lint_file', str2nr(expand('<abuf>')))
|
||||||
|
" Track when the file is changed outside of Vim.
|
||||||
|
autocmd FileChangedShellPost * call ale#events#FileChangedEvent(str2nr(expand('<abuf>')))
|
||||||
|
endif
|
||||||
|
augroup END
|
||||||
|
|
||||||
|
augroup ALERunOnFiletypeChangeGroup
|
||||||
|
autocmd!
|
||||||
|
if g:ale_enabled && g:ale_lint_on_filetype_changed
|
||||||
|
" Only start linting if the FileType actually changes after
|
||||||
|
" opening a buffer. The FileType will fire when buffers are opened.
|
||||||
|
autocmd FileType * call ale#events#FileTypeEvent(
|
||||||
|
\ str2nr(expand('<abuf>')),
|
||||||
|
\ expand('<amatch>')
|
||||||
|
\)
|
||||||
|
endif
|
||||||
|
augroup END
|
||||||
|
|
||||||
|
augroup ALERunOnSaveGroup
|
||||||
|
autocmd!
|
||||||
|
autocmd BufWritePost * call ale#events#SaveEvent(str2nr(expand('<abuf>')))
|
||||||
|
augroup END
|
||||||
|
|
||||||
|
augroup ALERunOnInsertLeave
|
||||||
|
autocmd!
|
||||||
|
if g:ale_enabled && g:ale_lint_on_insert_leave
|
||||||
|
autocmd InsertLeave * call ale#Queue(0)
|
||||||
|
endif
|
||||||
|
augroup END
|
||||||
|
|
||||||
|
augroup ALECursorGroup
|
||||||
|
autocmd!
|
||||||
|
if g:ale_enabled && g:ale_echo_cursor
|
||||||
|
autocmd CursorMoved,CursorHold * call ale#cursor#EchoCursorWarningWithDelay()
|
||||||
|
" Look for a warning to echo as soon as we leave Insert mode.
|
||||||
|
" The script's position variable used when moving the cursor will
|
||||||
|
" not be changed here.
|
||||||
|
autocmd InsertLeave * call ale#cursor#EchoCursorWarning()
|
||||||
|
endif
|
||||||
|
augroup END
|
||||||
|
|
||||||
|
if !g:ale_enabled
|
||||||
|
augroup! ALERunOnTextChangedGroup
|
||||||
|
augroup! ALERunOnEnterGroup
|
||||||
|
augroup! ALERunOnInsertLeave
|
||||||
|
augroup! ALECursorGroup
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
@@ -2,10 +2,31 @@
|
|||||||
" Description: balloonexpr support for ALE.
|
" Description: balloonexpr support for ALE.
|
||||||
|
|
||||||
function! ale#balloon#MessageForPos(bufnr, lnum, col) abort
|
function! ale#balloon#MessageForPos(bufnr, lnum, col) abort
|
||||||
|
" Don't show balloons if they are disabled, or linting is disabled.
|
||||||
|
if !ale#Var(a:bufnr, 'set_balloons')
|
||||||
|
\|| !g:ale_enabled
|
||||||
|
\|| !getbufvar(a:bufnr, 'ale_enabled', 1)
|
||||||
|
return ''
|
||||||
|
endif
|
||||||
|
|
||||||
let l:loclist = get(g:ale_buffer_info, a:bufnr, {'loclist': []}).loclist
|
let l:loclist = get(g:ale_buffer_info, a:bufnr, {'loclist': []}).loclist
|
||||||
let l:index = ale#util#BinarySearch(l:loclist, a:bufnr, a:lnum, a:col)
|
let l:index = ale#util#BinarySearch(l:loclist, a:bufnr, a:lnum, a:col)
|
||||||
|
|
||||||
return l:index >= 0 ? l:loclist[l:index].text : ''
|
" Show the diagnostics message if found, 'Hover' output otherwise
|
||||||
|
if l:index >= 0
|
||||||
|
return l:loclist[l:index].text
|
||||||
|
elseif exists('*balloon_show') || getbufvar(
|
||||||
|
\ a:bufnr,
|
||||||
|
\ 'ale_set_balloons_legacy_echo',
|
||||||
|
\ get(g:, 'ale_set_balloons_legacy_echo', 0)
|
||||||
|
\)
|
||||||
|
" Request LSP/tsserver hover information, but only if this version of
|
||||||
|
" Vim supports the balloon_show function, or if we turned a legacy
|
||||||
|
" setting on.
|
||||||
|
call ale#hover#Show(a:bufnr, a:lnum, a:col, {'called_from_balloonexpr': 1})
|
||||||
|
endif
|
||||||
|
|
||||||
|
return ''
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! ale#balloon#Expr() abort
|
function! ale#balloon#Expr() abort
|
||||||
@@ -13,9 +34,22 @@ function! ale#balloon#Expr() abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! ale#balloon#Disable() abort
|
function! ale#balloon#Disable() abort
|
||||||
set noballooneval
|
set noballooneval noballoonevalterm
|
||||||
|
set balloonexpr=
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! ale#balloon#Enable() abort
|
function! ale#balloon#Enable() abort
|
||||||
set ballooneval balloonexpr=ale#balloon#Expr()
|
if !has('balloon_eval') && !has('balloon_eval_term')
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
if has('balloon_eval')
|
||||||
|
set ballooneval
|
||||||
|
endif
|
||||||
|
|
||||||
|
if has('balloon_eval_term')
|
||||||
|
set balloonevalterm
|
||||||
|
endif
|
||||||
|
|
||||||
|
set balloonexpr=ale#balloon#Expr()
|
||||||
endfunction
|
endfunction
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
" Author: gagbo <gagbobada@gmail.com>, w0rp <devw0rp@gmail.com>
|
" Author: gagbo <gagbobada@gmail.com>, w0rp <devw0rp@gmail.com>, roel0 <postelmansroel@gmail.com>
|
||||||
" Description: Functions for integrating with C-family linters.
|
" Description: Functions for integrating with C-family linters.
|
||||||
|
|
||||||
|
call ale#Set('c_parse_makefile', 0)
|
||||||
let s:sep = has('win32') ? '\' : '/'
|
let s:sep = has('win32') ? '\' : '/'
|
||||||
|
|
||||||
function! ale#c#FindProjectRoot(buffer) abort
|
function! ale#c#FindProjectRoot(buffer) abort
|
||||||
@@ -22,6 +23,88 @@ function! ale#c#FindProjectRoot(buffer) abort
|
|||||||
return ''
|
return ''
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! ale#c#ParseCFlagsToList(path_prefix, cflags) abort
|
||||||
|
let l:cflags_list = []
|
||||||
|
let l:previous_options = []
|
||||||
|
|
||||||
|
for l:option in a:cflags
|
||||||
|
call add(l:previous_options, l:option)
|
||||||
|
" Check if cflag contained a '-' and should not have been splitted
|
||||||
|
let l:option_list = split(l:option, '\zs')
|
||||||
|
if l:option_list[-1] isnot# ' '
|
||||||
|
continue
|
||||||
|
endif
|
||||||
|
|
||||||
|
let l:option = join(l:previous_options, '-')
|
||||||
|
let l:previous_options = []
|
||||||
|
|
||||||
|
let l:option = '-' . substitute(l:option, '^\s*\(.\{-}\)\s*$', '\1', '')
|
||||||
|
|
||||||
|
" Fix relative paths if needed
|
||||||
|
if stridx(l:option, '-I') >= 0 &&
|
||||||
|
\ stridx(l:option, '-I' . s:sep) < 0
|
||||||
|
let l:rel_path = join(split(l:option, '\zs')[2:], '')
|
||||||
|
let l:rel_path = substitute(l:rel_path, '"', '', 'g')
|
||||||
|
let l:rel_path = substitute(l:rel_path, '''', '', 'g')
|
||||||
|
let l:option = ale#Escape('-I' . a:path_prefix .
|
||||||
|
\ s:sep . l:rel_path)
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Parse the cflag
|
||||||
|
if stridx(l:option, '-I') >= 0 ||
|
||||||
|
\ stridx(l:option, '-D') >= 0
|
||||||
|
if index(l:cflags_list, l:option) < 0
|
||||||
|
call add(l:cflags_list, l:option)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
|
||||||
|
return l:cflags_list
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale#c#ParseCFlags(buffer, stdout_make) abort
|
||||||
|
if !g:ale_c_parse_makefile
|
||||||
|
return []
|
||||||
|
endif
|
||||||
|
|
||||||
|
let l:buffer_filename = expand('#' . a:buffer . ':t')
|
||||||
|
let l:cflags = []
|
||||||
|
for l:lines in split(a:stdout_make, '\\n')
|
||||||
|
if stridx(l:lines, l:buffer_filename) >= 0
|
||||||
|
let l:cflags = split(l:lines, '-')
|
||||||
|
break
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
|
||||||
|
let l:makefile_path = ale#path#FindNearestFile(a:buffer, 'Makefile')
|
||||||
|
return ale#c#ParseCFlagsToList(fnamemodify(l:makefile_path, ':p:h'), l:cflags)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale#c#GetCFlags(buffer, output) abort
|
||||||
|
let l:cflags = ' '
|
||||||
|
|
||||||
|
if g:ale_c_parse_makefile && !empty(a:output)
|
||||||
|
let l:cflags = join(ale#c#ParseCFlags(a:buffer, join(a:output, '\n')), ' ') . ' '
|
||||||
|
endif
|
||||||
|
|
||||||
|
if l:cflags is# ' '
|
||||||
|
let l:cflags = ale#c#IncludeOptions(ale#c#FindLocalHeaderPaths(a:buffer))
|
||||||
|
endif
|
||||||
|
|
||||||
|
return l:cflags
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale#c#GetMakeCommand(buffer) abort
|
||||||
|
if g:ale_c_parse_makefile
|
||||||
|
let l:makefile_path = ale#path#FindNearestFile(a:buffer, 'Makefile')
|
||||||
|
if !empty(l:makefile_path)
|
||||||
|
return 'cd '. fnamemodify(l:makefile_path, ':p:h') . ' && make -n'
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
return ''
|
||||||
|
endfunction
|
||||||
|
|
||||||
" Given a buffer number, search for a project root, and output a List
|
" Given a buffer number, search for a project root, and output a List
|
||||||
" of directories to include based on some heuristics.
|
" of directories to include based on some heuristics.
|
||||||
"
|
"
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
" Author: w0rp <devw0rp@gmail.com>
|
" Author: w0rp <devw0rp@gmail.com>
|
||||||
" Description: Completion support for LSP linters
|
" Description: Completion support for LSP linters
|
||||||
|
|
||||||
|
let g:ale_completion_delay = get(g:, 'ale_completion_delay', 100)
|
||||||
|
let g:ale_completion_excluded_words = get(g:, 'ale_completion_excluded_words', [])
|
||||||
|
let g:ale_completion_max_suggestions = get(g:, 'ale_completion_max_suggestions', 50)
|
||||||
|
|
||||||
let s:timer_id = -1
|
let s:timer_id = -1
|
||||||
let s:last_done_pos = []
|
let s:last_done_pos = []
|
||||||
|
|
||||||
@@ -28,6 +32,8 @@ let s:LSP_COMPLETION_REFERENCE_KIND = 18
|
|||||||
" the insert cursor is. If one of these matches, we'll check for completions.
|
" the insert cursor is. If one of these matches, we'll check for completions.
|
||||||
let s:should_complete_map = {
|
let s:should_complete_map = {
|
||||||
\ '<default>': '\v[a-zA-Z$_][a-zA-Z$_0-9]*$|\.$',
|
\ '<default>': '\v[a-zA-Z$_][a-zA-Z$_0-9]*$|\.$',
|
||||||
|
\ 'typescript': '\v[a-zA-Z$_][a-zA-Z$_0-9]*$|\.$|''$|"$',
|
||||||
|
\ 'rust': '\v[a-zA-Z$_][a-zA-Z$_0-9]*$|\.$|::$',
|
||||||
\}
|
\}
|
||||||
|
|
||||||
" Regular expressions for finding the start column to replace with completion.
|
" Regular expressions for finding the start column to replace with completion.
|
||||||
@@ -38,6 +44,8 @@ let s:omni_start_map = {
|
|||||||
" A map of exact characters for triggering LSP completions.
|
" A map of exact characters for triggering LSP completions.
|
||||||
let s:trigger_character_map = {
|
let s:trigger_character_map = {
|
||||||
\ '<default>': ['.'],
|
\ '<default>': ['.'],
|
||||||
|
\ 'typescript': ['.', '''', '"'],
|
||||||
|
\ 'rust': ['.', '::'],
|
||||||
\}
|
\}
|
||||||
|
|
||||||
function! s:GetFiletypeValue(map, filetype) abort
|
function! s:GetFiletypeValue(map, filetype) abort
|
||||||
@@ -74,33 +82,49 @@ function! ale#completion#GetTriggerCharacter(filetype, prefix) abort
|
|||||||
return ''
|
return ''
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! ale#completion#Filter(suggestions, prefix) abort
|
function! ale#completion#Filter(buffer, suggestions, prefix) abort
|
||||||
|
let l:excluded_words = ale#Var(a:buffer, 'completion_excluded_words')
|
||||||
|
|
||||||
" For completing...
|
" For completing...
|
||||||
" foo.
|
" foo.
|
||||||
" ^
|
" ^
|
||||||
" We need to include all of the given suggestions.
|
" We need to include all of the given suggestions.
|
||||||
if a:prefix is# '.'
|
if a:prefix is# '.'
|
||||||
return a:suggestions
|
let l:filtered_suggestions = a:suggestions
|
||||||
|
else
|
||||||
|
let l:filtered_suggestions = []
|
||||||
|
|
||||||
|
" Filter suggestions down to those starting with the prefix we used for
|
||||||
|
" finding suggestions in the first place.
|
||||||
|
"
|
||||||
|
" Some completion tools will include suggestions which don't even start
|
||||||
|
" with the characters we have already typed.
|
||||||
|
for l:item in a:suggestions
|
||||||
|
" A List of String values or a List of completion item Dictionaries
|
||||||
|
" is accepted here.
|
||||||
|
let l:word = type(l:item) == type('') ? l:item : l:item.word
|
||||||
|
|
||||||
|
" Add suggestions if the suggestion starts with a case-insensitive
|
||||||
|
" match for the prefix.
|
||||||
|
if l:word[: len(a:prefix) - 1] is? a:prefix
|
||||||
|
call add(l:filtered_suggestions, l:item)
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let l:filtered_suggestions = []
|
if !empty(l:excluded_words)
|
||||||
|
" Copy the List if needed. We don't want to modify the argument.
|
||||||
" Filter suggestions down to those starting with the prefix we used for
|
" We shouldn't make a copy if we don't need to.
|
||||||
" finding suggestions in the first place.
|
if l:filtered_suggestions is a:suggestions
|
||||||
"
|
let l:filtered_suggestions = copy(a:suggestions)
|
||||||
" Some completion tools will include suggestions which don't even start
|
|
||||||
" with the characters we have already typed.
|
|
||||||
for l:item in a:suggestions
|
|
||||||
" A List of String values or a List of completion item Dictionaries
|
|
||||||
" is accepted here.
|
|
||||||
let l:word = type(l:item) == type('') ? l:item : l:item.word
|
|
||||||
|
|
||||||
" Add suggestions if the suggestion starts with a case-insensitive
|
|
||||||
" match for the prefix.
|
|
||||||
if l:word[: len(a:prefix) - 1] is? a:prefix
|
|
||||||
call add(l:filtered_suggestions, l:item)
|
|
||||||
endif
|
endif
|
||||||
endfor
|
|
||||||
|
" Remove suggestions with words in the exclusion List.
|
||||||
|
call filter(
|
||||||
|
\ l:filtered_suggestions,
|
||||||
|
\ 'index(l:excluded_words, type(v:val) is type('''') ? v:val : v:val.word) < 0',
|
||||||
|
\)
|
||||||
|
endif
|
||||||
|
|
||||||
return l:filtered_suggestions
|
return l:filtered_suggestions
|
||||||
endfunction
|
endfunction
|
||||||
@@ -178,7 +202,9 @@ function! ale#completion#ParseTSServerCompletions(response) abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! ale#completion#ParseTSServerCompletionEntryDetails(response) abort
|
function! ale#completion#ParseTSServerCompletionEntryDetails(response) abort
|
||||||
|
let l:buffer = bufnr('')
|
||||||
let l:results = []
|
let l:results = []
|
||||||
|
let l:names_with_details = []
|
||||||
|
|
||||||
for l:suggestion in a:response.body
|
for l:suggestion in a:response.body
|
||||||
let l:displayParts = []
|
let l:displayParts = []
|
||||||
@@ -212,10 +238,44 @@ function! ale#completion#ParseTSServerCompletionEntryDetails(response) abort
|
|||||||
\})
|
\})
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
|
let l:names = getbufvar(l:buffer, 'ale_tsserver_completion_names', [])
|
||||||
|
|
||||||
|
if !empty(l:names) && len(l:names) != len(l:results)
|
||||||
|
let l:names_with_details = map(copy(l:results), 'v:val.word')
|
||||||
|
let l:missing_names = filter(
|
||||||
|
\ copy(l:names),
|
||||||
|
\ 'index(l:names_with_details, v:val) < 0',
|
||||||
|
\)
|
||||||
|
|
||||||
|
for l:name in l:missing_names
|
||||||
|
call add(l:results, {
|
||||||
|
\ 'word': l:name,
|
||||||
|
\ 'kind': 'v',
|
||||||
|
\ 'icase': 1,
|
||||||
|
\ 'menu': '',
|
||||||
|
\ 'info': '',
|
||||||
|
\})
|
||||||
|
endfor
|
||||||
|
endif
|
||||||
|
|
||||||
return l:results
|
return l:results
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! ale#completion#NullFilter(buffer, item) abort
|
||||||
|
return 1
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! ale#completion#ParseLSPCompletions(response) abort
|
function! ale#completion#ParseLSPCompletions(response) abort
|
||||||
|
let l:buffer = bufnr('')
|
||||||
|
let l:info = get(b:, 'ale_completion_info', {})
|
||||||
|
let l:Filter = get(l:info, 'completion_filter', v:null)
|
||||||
|
|
||||||
|
if l:Filter is v:null
|
||||||
|
let l:Filter = function('ale#completion#NullFilter')
|
||||||
|
else
|
||||||
|
let l:Filter = ale#util#GetFunction(l:Filter)
|
||||||
|
endif
|
||||||
|
|
||||||
let l:item_list = []
|
let l:item_list = []
|
||||||
|
|
||||||
if type(get(a:response, 'result')) is type([])
|
if type(get(a:response, 'result')) is type([])
|
||||||
@@ -228,6 +288,16 @@ function! ale#completion#ParseLSPCompletions(response) abort
|
|||||||
let l:results = []
|
let l:results = []
|
||||||
|
|
||||||
for l:item in l:item_list
|
for l:item in l:item_list
|
||||||
|
if !call(l:Filter, [l:buffer, l:item])
|
||||||
|
continue
|
||||||
|
endif
|
||||||
|
|
||||||
|
let l:word = matchstr(l:item.label, '\v^[^(]+')
|
||||||
|
|
||||||
|
if empty(l:word)
|
||||||
|
continue
|
||||||
|
endif
|
||||||
|
|
||||||
" See :help complete-items for Vim completion kinds
|
" See :help complete-items for Vim completion kinds
|
||||||
if l:item.kind is s:LSP_COMPLETION_METHOD_KIND
|
if l:item.kind is s:LSP_COMPLETION_METHOD_KIND
|
||||||
let l:kind = 'm'
|
let l:kind = 'm'
|
||||||
@@ -244,14 +314,18 @@ function! ale#completion#ParseLSPCompletions(response) abort
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
call add(l:results, {
|
call add(l:results, {
|
||||||
\ 'word': l:item.label,
|
\ 'word': l:word,
|
||||||
\ 'kind': l:kind,
|
\ 'kind': l:kind,
|
||||||
\ 'icase': 1,
|
\ 'icase': 1,
|
||||||
\ 'menu': l:item.detail,
|
\ 'menu': l:item.detail,
|
||||||
\ 'info': l:item.documentation,
|
\ 'info': get(l:item, 'documentation', ''),
|
||||||
\})
|
\})
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
|
if has_key(l:info, 'prefix')
|
||||||
|
return ale#completion#Filter(l:buffer, l:results, l:info.prefix)
|
||||||
|
endif
|
||||||
|
|
||||||
return l:results
|
return l:results
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@@ -264,19 +338,25 @@ function! ale#completion#HandleTSServerResponse(conn_id, response) abort
|
|||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
let l:buffer = bufnr('')
|
||||||
let l:command = get(a:response, 'command', '')
|
let l:command = get(a:response, 'command', '')
|
||||||
|
|
||||||
if l:command is# 'completions'
|
if l:command is# 'completions'
|
||||||
let l:names = ale#completion#Filter(
|
let l:names = ale#completion#Filter(
|
||||||
|
\ l:buffer,
|
||||||
\ ale#completion#ParseTSServerCompletions(a:response),
|
\ ale#completion#ParseTSServerCompletions(a:response),
|
||||||
\ b:ale_completion_info.prefix,
|
\ b:ale_completion_info.prefix,
|
||||||
\)[: g:ale_completion_max_suggestions - 1]
|
\)[: g:ale_completion_max_suggestions - 1]
|
||||||
|
|
||||||
|
" We need to remember some names for tsserver, as it doesn't send
|
||||||
|
" details back for everything we send.
|
||||||
|
call setbufvar(l:buffer, 'ale_tsserver_completion_names', l:names)
|
||||||
|
|
||||||
if !empty(l:names)
|
if !empty(l:names)
|
||||||
let b:ale_completion_info.request_id = ale#lsp#Send(
|
let b:ale_completion_info.request_id = ale#lsp#Send(
|
||||||
\ b:ale_completion_info.conn_id,
|
\ b:ale_completion_info.conn_id,
|
||||||
\ ale#lsp#tsserver_message#CompletionEntryDetails(
|
\ ale#lsp#tsserver_message#CompletionEntryDetails(
|
||||||
\ bufnr(''),
|
\ l:buffer,
|
||||||
\ b:ale_completion_info.line,
|
\ b:ale_completion_info.line,
|
||||||
\ b:ale_completion_info.column,
|
\ b:ale_completion_info.column,
|
||||||
\ l:names,
|
\ l:names,
|
||||||
@@ -349,6 +429,10 @@ function! s:GetLSPCompletions(linter) abort
|
|||||||
if l:request_id
|
if l:request_id
|
||||||
let b:ale_completion_info.conn_id = l:id
|
let b:ale_completion_info.conn_id = l:id
|
||||||
let b:ale_completion_info.request_id = l:request_id
|
let b:ale_completion_info.request_id = l:request_id
|
||||||
|
|
||||||
|
if has_key(a:linter, 'completion_filter')
|
||||||
|
let b:ale_completion_info.completion_filter = a:linter.completion_filter
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@@ -378,10 +462,7 @@ function! ale#completion#GetCompletions() abort
|
|||||||
|
|
||||||
for l:linter in ale#linter#Get(&filetype)
|
for l:linter in ale#linter#Get(&filetype)
|
||||||
if !empty(l:linter.lsp)
|
if !empty(l:linter.lsp)
|
||||||
if l:linter.lsp is# 'tsserver'
|
call s:GetLSPCompletions(l:linter)
|
||||||
\|| get(g:, 'ale_completion_experimental_lsp_support', 0)
|
|
||||||
call s:GetLSPCompletions(l:linter)
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
endfunction
|
endfunction
|
||||||
|
|||||||
3
autoload/ale/completion/python.vim
Normal file
3
autoload/ale/completion/python.vim
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
function! ale#completion#python#CompletionItemFilter(buffer, item) abort
|
||||||
|
return a:item.label !~# '\v^__[a-z_]+__'
|
||||||
|
endfunction
|
||||||
@@ -1,6 +1,11 @@
|
|||||||
" Author: w0rp <devw0rp@gmail.com>
|
" Author: w0rp <devw0rp@gmail.com>
|
||||||
" Description: Echoes lint message for the current line, if any
|
" Description: Echoes lint message for the current line, if any
|
||||||
|
|
||||||
|
" Controls the milliseconds delay before echoing a message.
|
||||||
|
let g:ale_echo_delay = get(g:, 'ale_echo_delay', 10)
|
||||||
|
" A string format for the echoed message.
|
||||||
|
let g:ale_echo_msg_format = get(g:, 'ale_echo_msg_format', '%code: %%s')
|
||||||
|
|
||||||
let s:cursor_timer = -1
|
let s:cursor_timer = -1
|
||||||
let s:last_pos = [0, 0, 0]
|
let s:last_pos = [0, 0, 0]
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user