mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-06 20:54:26 +08:00
Compare commits
440 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
26e61fad69 | ||
|
|
d8143885a4 | ||
|
|
1428c7b29e | ||
|
|
7265ceb6d0 | ||
|
|
7ff87a942b | ||
|
|
0b5d72fecd | ||
|
|
e61e1147b0 | ||
|
|
ff6bfc3d37 | ||
|
|
3635285c02 | ||
|
|
3b4193175e | ||
|
|
69d96aa9d9 | ||
|
|
c2b01f0e28 | ||
|
|
ca97f32258 | ||
|
|
70005134e5 | ||
|
|
65bea1a5cb | ||
|
|
716f9a9bbb | ||
|
|
f67cb56e5e | ||
|
|
3f34265151 | ||
|
|
d4e1c57026 | ||
|
|
76cd6b0f92 | ||
|
|
47d941b491 | ||
|
|
36e5337e30 | ||
|
|
60d683da3b | ||
|
|
d2934ba017 | ||
|
|
36b50058bb | ||
|
|
3281321d5c | ||
|
|
e0181f8832 | ||
|
|
64b9a2708d | ||
|
|
1f9ac1c6dc | ||
|
|
93a13d7353 | ||
|
|
00eee550ea | ||
|
|
198361bc0d | ||
|
|
dc054f30c8 | ||
|
|
16cd59805b | ||
|
|
82f734a7c2 | ||
|
|
6087765cad | ||
|
|
58404b5b83 | ||
|
|
852a6a1753 | ||
|
|
9edefa724b | ||
|
|
fa19bca80e | ||
|
|
302ce71931 | ||
|
|
bbe5153fcb | ||
|
|
46d7ee564f | ||
|
|
8f7ccdc5e9 | ||
|
|
634c81fd46 | ||
|
|
8012809c3f | ||
|
|
d6d2a0c770 | ||
|
|
07ee4d39c5 | ||
|
|
4afbf2f25d | ||
|
|
72d2c55479 | ||
|
|
57eba1afac | ||
|
|
8c4c8dfd97 | ||
|
|
0cb432cb82 | ||
|
|
874c98b96d | ||
|
|
7a4f5cefba | ||
|
|
6ad8836c68 | ||
|
|
8148a67b37 | ||
|
|
25e457595a | ||
|
|
493705336c | ||
|
|
4cbe16197c | ||
|
|
9ee57d4362 | ||
|
|
715733f44d | ||
|
|
5f84325cd8 | ||
|
|
d8195e9276 | ||
|
|
5f95d032ee | ||
|
|
31715ff227 | ||
|
|
b91d82bfaa | ||
|
|
9005a62dc2 | ||
|
|
7665559d0e | ||
|
|
66a8df081e | ||
|
|
b76165abf6 | ||
|
|
abad8e474b | ||
|
|
f09cc26f87 | ||
|
|
e2a67812de | ||
|
|
e6ee613e00 | ||
|
|
6637de46c2 | ||
|
|
5985f8bd63 | ||
|
|
977921461d | ||
|
|
0b5fcbad1f | ||
|
|
db6b1b5ecc | ||
|
|
a273b9cf4a | ||
|
|
f11f6a2195 | ||
|
|
bde9b1cfcd | ||
|
|
5eefe544ed | ||
|
|
dfbb387cc7 | ||
|
|
2d9380d75c | ||
|
|
e259dd525f | ||
|
|
9a0b604a99 | ||
|
|
47eb3dd0c0 | ||
|
|
af8c8516d1 | ||
|
|
0d4dfb61dc | ||
|
|
463deedc29 | ||
|
|
40890cfcf3 | ||
|
|
ea91209a66 | ||
|
|
cf5120ba75 | ||
|
|
79e9ae4550 | ||
|
|
9017d3ef9c | ||
|
|
67d0ccc398 | ||
|
|
9c797961fa | ||
|
|
c06467438d | ||
|
|
5e69aaf4c2 | ||
|
|
9125ec8739 | ||
|
|
99e64ed084 | ||
|
|
8698c44e2a | ||
|
|
b27df1b169 | ||
|
|
dfe9b7cc26 | ||
|
|
e5a4c82917 | ||
|
|
f4070f6c43 | ||
|
|
fedd3de59f | ||
|
|
4b53d88cb8 | ||
|
|
29d0987859 | ||
|
|
d74db90550 | ||
|
|
b24fd13423 | ||
|
|
81cb40ce4b | ||
|
|
f5c289dce6 | ||
|
|
7c5825ecbc | ||
|
|
01219f0308 | ||
|
|
af1643a948 | ||
|
|
5a1505ad62 | ||
|
|
31d6f72abf | ||
|
|
e19b8c05cd | ||
|
|
c8c142b881 | ||
|
|
a1fab59811 | ||
|
|
d488198c9c | ||
|
|
a62f26434a | ||
|
|
35f51221f1 | ||
|
|
3fe2223a48 | ||
|
|
e8de12c9f0 | ||
|
|
95b8689835 | ||
|
|
f932211309 | ||
|
|
6d88801789 | ||
|
|
59b34dd017 | ||
|
|
f2b231dd76 | ||
|
|
8fda1cebff | ||
|
|
8097d51e33 | ||
|
|
06082ef377 | ||
|
|
d3a3f4011b | ||
|
|
cebbb67ea6 | ||
|
|
32b784219b | ||
|
|
7795898841 | ||
|
|
06a97a8541 | ||
|
|
0fa2d18230 | ||
|
|
d0e87c0df4 | ||
|
|
89fa43551f | ||
|
|
98b0dcd7d6 | ||
|
|
b96574e5b5 | ||
|
|
a486aa1d24 | ||
|
|
7c2f5e83ab | ||
|
|
618f2d71fc | ||
|
|
889e6338fe | ||
|
|
62602569b3 | ||
|
|
41ff80dc9e | ||
|
|
6746eaeaa0 | ||
|
|
d7dbc8f2cf | ||
|
|
e329413a31 | ||
|
|
e6241ee0d2 | ||
|
|
07c11e4e7f | ||
|
|
ab8e043353 | ||
|
|
e6946de98a | ||
|
|
6ab264ff0f | ||
|
|
d93512fe60 | ||
|
|
7b38e97943 | ||
|
|
f5e44415e8 | ||
|
|
e3784c4c4e | ||
|
|
b531a4e0b3 | ||
|
|
dd6bd6f0fe | ||
|
|
529f57a66f | ||
|
|
b8949aaac3 | ||
|
|
dc42c0f948 | ||
|
|
41ed10be4e | ||
|
|
34431d885b | ||
|
|
61cfb3fefb | ||
|
|
321ee6d26b | ||
|
|
58b7c281c5 | ||
|
|
a6c59faa0f | ||
|
|
3e8c8d3ccb | ||
|
|
b66d202c1d | ||
|
|
05ba522c9a | ||
|
|
34f2943fdd | ||
|
|
84a455185c | ||
|
|
fbe7cea91c | ||
|
|
cda46636f4 | ||
|
|
2e323b529d | ||
|
|
bd1f7e1420 | ||
|
|
6e18c03d80 | ||
|
|
9f814a8ce9 | ||
|
|
67ee2b9586 | ||
|
|
7d7ddf22d3 | ||
|
|
2b12c8ccbf | ||
|
|
5fcb24bb3e | ||
|
|
cf47bda024 | ||
|
|
da262f40dd | ||
|
|
6aeb462171 | ||
|
|
442fb2d22f | ||
|
|
08a5bfcaa9 | ||
|
|
73812c3e41 | ||
|
|
91636cff06 | ||
|
|
d787369f37 | ||
|
|
c4bdf165ca | ||
|
|
ddb559b3be | ||
|
|
ee62cc6898 | ||
|
|
219fb5873c | ||
|
|
b62e306222 | ||
|
|
5388ff1d54 | ||
|
|
266fa1c0a4 | ||
|
|
b70eeaadb4 | ||
|
|
74a43755c6 | ||
|
|
58e8d32d79 | ||
|
|
8aa1578605 | ||
|
|
501af8dd8b | ||
|
|
b1810b2752 | ||
|
|
f89b49a014 | ||
|
|
28c93ab185 | ||
|
|
ab0bf61512 | ||
|
|
9ee8067df6 | ||
|
|
20cc6d3e05 | ||
|
|
dd1e1025b8 | ||
|
|
3ae01ba249 | ||
|
|
9c7673e6c9 | ||
|
|
8f5ecf0120 | ||
|
|
d1c56769b7 | ||
|
|
b1230873b6 | ||
|
|
4fe7402e89 | ||
|
|
e47c1965a6 | ||
|
|
c675212ddd | ||
|
|
d25711a516 | ||
|
|
aae6d30b1e | ||
|
|
bafa1c619d | ||
|
|
240bb8abae | ||
|
|
36a50111b9 | ||
|
|
abb38955d3 | ||
|
|
fa5aecc250 | ||
|
|
6e6ad2e430 | ||
|
|
79dde5f0e5 | ||
|
|
6c47d7fc35 | ||
|
|
a5240009ba | ||
|
|
46ab7c5904 | ||
|
|
8700586890 | ||
|
|
221aceb6db | ||
|
|
49db8210f6 | ||
|
|
89f7292138 | ||
|
|
6feeca793a | ||
|
|
53b0e6c37d | ||
|
|
a3521de64e | ||
|
|
e52388b8b1 | ||
|
|
0843efc7a5 | ||
|
|
65ba4b85ec | ||
|
|
bf0d0597cb | ||
|
|
9ad8fd6a1b | ||
|
|
d2c3141f26 | ||
|
|
418f8a6fed | ||
|
|
9c48c584a9 | ||
|
|
38a55fa9fe | ||
|
|
4e1c46947d | ||
|
|
e0f8304860 | ||
|
|
f5a908bf99 | ||
|
|
f2e52b9432 | ||
|
|
40bf6e6b5c | ||
|
|
c5a4bbf8b0 | ||
|
|
1c71da5624 | ||
|
|
701c1e4f17 | ||
|
|
15f23532b7 | ||
|
|
3acfa0813e | ||
|
|
e0871be22b | ||
|
|
6e28eec243 | ||
|
|
86205967ea | ||
|
|
eb6a7b7516 | ||
|
|
0135fb3ad3 | ||
|
|
80ab12c7b6 | ||
|
|
ce91972c94 | ||
|
|
168768b326 | ||
|
|
8b46fa3ee7 | ||
|
|
22e7a6f6c2 | ||
|
|
1ba1a9ef0e | ||
|
|
fea666bd27 | ||
|
|
730752523b | ||
|
|
d9bad6c0b8 | ||
|
|
b41eecd31b | ||
|
|
e84c9b300b | ||
|
|
efa95e2657 | ||
|
|
56641e0230 | ||
|
|
507f164a09 | ||
|
|
92d515c211 | ||
|
|
59829bc194 | ||
|
|
d9931b9891 | ||
|
|
3aa58ca179 | ||
|
|
5826b4927c | ||
|
|
6eb68b4507 | ||
|
|
3c799abb44 | ||
|
|
3b8fb39b4a | ||
|
|
3e4b8ea466 | ||
|
|
7b78f2b846 | ||
|
|
e7317e05ea | ||
|
|
381fff0e4c | ||
|
|
5ce97f8cdb | ||
|
|
42a1fc2d29 | ||
|
|
bb7481effb | ||
|
|
7d4a83ecd4 | ||
|
|
eb6015c6fd | ||
|
|
4496c9b3c1 | ||
|
|
4129c356e8 | ||
|
|
c6a5cbb3c7 | ||
|
|
a76f056bd9 | ||
|
|
a730a6d5d5 | ||
|
|
79d1b99067 | ||
|
|
135de34d22 | ||
|
|
5542db1507 | ||
|
|
3321685940 | ||
|
|
7053d468cc | ||
|
|
27146ade32 | ||
|
|
4f02edc3f8 | ||
|
|
166435dbf1 | ||
|
|
ca0cdd26fc | ||
|
|
6b819dd74a | ||
|
|
90b1ea230d | ||
|
|
67d7caee30 | ||
|
|
bc0abc3b96 | ||
|
|
181bc69c8c | ||
|
|
47ad24c221 | ||
|
|
8d8b295ef5 | ||
|
|
bb08b81bf7 | ||
|
|
36c35d840b | ||
|
|
88fa0b9294 | ||
|
|
1a9b8a58c7 | ||
|
|
33b4a90507 | ||
|
|
85b3a4a5c6 | ||
|
|
092748caac | ||
|
|
2f13c2d263 | ||
|
|
b41836130c | ||
|
|
5a8ba75265 | ||
|
|
67d49c75a8 | ||
|
|
0427ee84b4 | ||
|
|
f6ae056d02 | ||
|
|
3e3801e81e | ||
|
|
89db85121c | ||
|
|
26e5948617 | ||
|
|
42f5e8c62c | ||
|
|
28819eedd3 | ||
|
|
937138dad4 | ||
|
|
143af2b9fd | ||
|
|
781bf1502f | ||
|
|
5e64acc6ab | ||
|
|
4ee28d3129 | ||
|
|
9d908ecc66 | ||
|
|
3b7c86e401 | ||
|
|
57736cdccc | ||
|
|
57b9d8bc0e | ||
|
|
652d991077 | ||
|
|
e6745a3811 | ||
|
|
e5ea809094 | ||
|
|
8cb6d043b4 | ||
|
|
8c76b88392 | ||
|
|
975cc7af8f | ||
|
|
d0f2a0ae94 | ||
|
|
9b89ec3d86 | ||
|
|
4234d39d87 | ||
|
|
381fe1badf | ||
|
|
07b596efb5 | ||
|
|
70604828fa | ||
|
|
ab7e5b264f | ||
|
|
c88ebc5e70 | ||
|
|
42cbff29f8 | ||
|
|
bf17bbf898 | ||
|
|
aa047b5ba3 | ||
|
|
6b919e88be | ||
|
|
bfc79bd2aa | ||
|
|
fb6fd80bd2 | ||
|
|
7943bfab96 | ||
|
|
3303f596e5 | ||
|
|
df90725c85 | ||
|
|
edd3114394 | ||
|
|
f0152bca98 | ||
|
|
afa20d96ca | ||
|
|
79e42fed14 | ||
|
|
f444abdfe6 | ||
|
|
722c3e8dae | ||
|
|
bff3d253e9 | ||
|
|
77c5802fc7 | ||
|
|
a223253f35 | ||
|
|
d390abd721 | ||
|
|
53db52e713 | ||
|
|
63abd2dfef | ||
|
|
5f64f8dc57 | ||
|
|
c10da0e390 | ||
|
|
548ee56f40 | ||
|
|
e6ba936a0c | ||
|
|
7f0954b89e | ||
|
|
c6aae3bcfc | ||
|
|
4c6f67a3d0 | ||
|
|
5d65f93033 | ||
|
|
eae124e8ce | ||
|
|
114198e082 | ||
|
|
2f3bce5a1d | ||
|
|
b34274ab10 | ||
|
|
69b7ec1c4c | ||
|
|
737ed31de5 | ||
|
|
46c743a247 | ||
|
|
01331266a8 | ||
|
|
ce0b14979e | ||
|
|
893ac34cca | ||
|
|
c36f3e78e4 | ||
|
|
2303b05baa | ||
|
|
fcc2c3ba71 | ||
|
|
2eb68f6d23 | ||
|
|
104980e40b | ||
|
|
5bbce34605 | ||
|
|
9e95032b30 | ||
|
|
59f8c35a2f | ||
|
|
24d277384c | ||
|
|
3a010f68b8 | ||
|
|
23a8208498 | ||
|
|
7f31065fce | ||
|
|
61c1ddd904 | ||
|
|
99361b2ca9 | ||
|
|
495bce32e9 | ||
|
|
f0f0cc3c18 | ||
|
|
784d1a9a62 | ||
|
|
6428162f79 | ||
|
|
2ed53108c4 | ||
|
|
751838621a | ||
|
|
d7395906ba | ||
|
|
fb7099d440 | ||
|
|
df806c511c | ||
|
|
4b6691f602 | ||
|
|
d4841cedf2 | ||
|
|
c820089c44 | ||
|
|
f02e2ec54c | ||
|
|
4813165614 | ||
|
|
16b43a5708 | ||
|
|
2ef3f9806c | ||
|
|
2e8c8085a6 | ||
|
|
042b351b7a | ||
|
|
81423701b0 | ||
|
|
abcefe7a6e | ||
|
|
864d0861e4 | ||
|
|
9a0ece1ecb | ||
|
|
6d14dc0ac0 | ||
|
|
1427a090df | ||
|
|
8b0879212f | ||
|
|
c7292ce892 |
@@ -5,6 +5,11 @@ clone_depth: 10
|
||||
# Use the directory C:\testplugin so test directories will mostly work.
|
||||
clone_folder: C:\testplugin
|
||||
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
- /v\d+\.\d+\.(x|\d+)/
|
||||
|
||||
# Cache the vim and vader directories between builds.
|
||||
cache:
|
||||
- C:\vim -> .appveyor.yml
|
||||
|
||||
1
.github/ISSUE_TEMPLATE/report-a-bug.md
vendored
1
.github/ISSUE_TEMPLATE/report-a-bug.md
vendored
@@ -1,5 +1,6 @@
|
||||
---
|
||||
name: Report a bug
|
||||
labels: bug
|
||||
about: Report a bug with ALE.
|
||||
|
||||
---
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
---
|
||||
name: Suggest a new linter or fixer
|
||||
labels: new tool
|
||||
about: Suggest a new tool ALE can officially integrate with.
|
||||
|
||||
---
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
---
|
||||
name: Suggest an improvement
|
||||
labels: enhancement
|
||||
about: Suggest some way to improve ALE, or add a new feature.
|
||||
|
||||
---
|
||||
|
||||
@@ -3,6 +3,10 @@ sudo: required
|
||||
services:
|
||||
- docker
|
||||
language: generic
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
- /^v\d+\.\d+\.(x|\d+)$/
|
||||
env:
|
||||
- OPTIONS=--vim-80-only
|
||||
- OPTIONS=--vim-81-only
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
FROM tweekmonster/vim-testbed:latest
|
||||
|
||||
RUN install_vim -tag v8.0.0027 -build \
|
||||
-tag v8.1.0204 -build \
|
||||
-tag v8.1.0519 -build \
|
||||
-tag neovim:v0.2.0 -build \
|
||||
-tag neovim:v0.3.0 -build
|
||||
-tag neovim:v0.3.5 -build
|
||||
|
||||
ENV PACKAGES="\
|
||||
bash \
|
||||
|
||||
2
LICENSE
2
LICENSE
@@ -1,4 +1,4 @@
|
||||
Copyright (c) 2016-2018, w0rp <devw0rp@gmail.com>
|
||||
Copyright (c) 2016-2019, w0rp <devw0rp@gmail.com>
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
||||
80
README.md
80
README.md
@@ -1,13 +1,13 @@
|
||||
# Asynchronous Lint Engine [](https://travis-ci.org/w0rp/ale) [](https://ci.appveyor.com/project/w0rp/ale) [](https://gitter.im/vim-ale/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
# Asynchronous Lint Engine [](https://travis-ci.com/dense-analysis/ale) [](https://ci.appveyor.com/project/dense-analysis/ale) [](https://gitter.im/vim-ale/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
|
||||
|
||||

|
||||

|
||||
|
||||
ALE (Asynchronous Lint Engine) is a plugin for providing linting (checking
|
||||
syntax and semantics) in NeoVim 0.2.0+ and Vim 8 while you edit your text files,
|
||||
ALE (Asynchronous Lint Engine) is a plugin providing linting (syntax checking
|
||||
and semantic errors) in NeoVim 0.2.0+ and Vim 8 while you edit your text files,
|
||||
and acts as a Vim [Language Server Protocol](https://langserver.org/) client.
|
||||
|
||||
<img src="img/example.gif?raw=true" alt="A linting example with the darkspectrum color scheme in GVim." title="A linting example with the darkspectrum color scheme in GVim.">
|
||||
<img src="https://user-images.githubusercontent.com/3518142/59195938-3a81b100-8b85-11e9-8e8d-6a601b1db908.gif" alt="A linting example with the darkspectrum color scheme in GVim." title="A linting example with the darkspectrum color scheme in GVim.">
|
||||
|
||||
ALE makes use of NeoVim and Vim 8 job control functions and timers to
|
||||
run linters on the contents of text buffers and return errors as
|
||||
@@ -26,7 +26,7 @@ features, including:
|
||||
|
||||
* Diagnostics (via Language Server Protocol linters)
|
||||
* Go To Definition (`:ALEGoToDefinition`)
|
||||
* Completion (`let g:ale_completion_enabled = 1` before ALE is loaded)
|
||||
* Completion (Built in completion support, or with Deoplete)
|
||||
* Finding references (`:ALEFindReferences`)
|
||||
* Hover information (`:ALEHover`)
|
||||
* Symbol search (`:ALESymbolSearch`)
|
||||
@@ -35,6 +35,10 @@ If you don't care about Language Server Protocol, ALE won't load any of the code
|
||||
for working with it unless needed. One of ALE's general missions is that you
|
||||
won't pay for the features that you don't use.
|
||||
|
||||
**Help Wanted:** If you would like to help maintain this plugin by managing the
|
||||
many issues and pull requests that are submitted, please send the author an
|
||||
email at [dev@w0rp.com](mailto:dev@w0rp.com?subject=Helping%20with%20ALE).
|
||||
|
||||
If you enjoy this plugin, feel free to contribute or check out the author's
|
||||
other content at [w0rp.com](https://w0rp.com).
|
||||
|
||||
@@ -159,12 +163,44 @@ ALE offers some support for completion via hijacking of omnicompletion while you
|
||||
type. All of ALE's completion information must come from Language Server
|
||||
Protocol linters, or from `tsserver` for TypeScript.
|
||||
|
||||
ALE integrates with [Deoplete](https://github.com/Shougo/deoplete.nvim) as a
|
||||
completion source, named `'ale'`. You can configure Deoplete to only use ALE as
|
||||
the source of completion information, or mix it with other sources.
|
||||
|
||||
```vim
|
||||
" Use ALE and also some plugin 'foobar' as completion sources for all code.
|
||||
call deoplete#custom#option('sources', {
|
||||
\ '_': ['ale', 'foobar'],
|
||||
\})
|
||||
```
|
||||
|
||||
ALE also offers its own automatic completion support, which does not require any
|
||||
other plugins, and can be enabled by changing a setting before ALE is loaded.
|
||||
|
||||
```vim
|
||||
" Enable completion where available.
|
||||
" This setting must be set before ALE is loaded.
|
||||
"
|
||||
" You should not turn this setting on if you wish to use ALE as a completion
|
||||
" source for other completion plugins, like Deoplete.
|
||||
let g:ale_completion_enabled = 1
|
||||
```
|
||||
|
||||
ALE provides an omni-completion function you can use for triggering
|
||||
completion manually with `<C-x><C-o>`.
|
||||
|
||||
```vim
|
||||
set omnifunc=ale#completion#OmniFunc
|
||||
```
|
||||
|
||||
When working with TypeScript files, ALE supports automatic imports from
|
||||
external modules. This behavior is disabled by default and can be enabled by
|
||||
setting:
|
||||
|
||||
```vim
|
||||
let g:ale_completion_tsserver_autoimport = 1
|
||||
```
|
||||
|
||||
See `:help ale-completion` for more information.
|
||||
|
||||
<a name="usage-go-to-definition"></a>
|
||||
@@ -234,14 +270,14 @@ any other tools. Simply clone the plugin into your `pack` directory.
|
||||
|
||||
```bash
|
||||
mkdir -p ~/.vim/pack/git-plugins/start
|
||||
git clone https://github.com/w0rp/ale.git ~/.vim/pack/git-plugins/start/ale
|
||||
git clone --depth 1 https://github.com/dense-analysis/ale.git ~/.vim/pack/git-plugins/start/ale
|
||||
```
|
||||
|
||||
#### NeoVim on Unix
|
||||
|
||||
```bash
|
||||
mkdir -p ~/.local/share/nvim/site/pack/git-plugins/start
|
||||
git clone https://github.com/w0rp/ale.git ~/.local/share/nvim/site/pack/git-plugins/start/ale
|
||||
git clone --depth 1 https://github.com/dense-analysis/ale.git ~/.local/share/nvim/site/pack/git-plugins/start/ale
|
||||
```
|
||||
|
||||
#### Vim 8 on Windows
|
||||
@@ -249,7 +285,7 @@ git clone https://github.com/w0rp/ale.git ~/.local/share/nvim/site/pack/git-plug
|
||||
```bash
|
||||
# Run these commands in the "Git for Windows" Bash terminal
|
||||
mkdir -p ~/vimfiles/pack/git-plugins/start
|
||||
git clone https://github.com/w0rp/ale.git ~/vimfiles/pack/git-plugins/start/ale
|
||||
git clone --depth 1 https://github.com/dense-analysis/ale.git ~/vimfiles/pack/git-plugins/start/ale
|
||||
```
|
||||
|
||||
#### Generating Vim help files
|
||||
@@ -280,7 +316,7 @@ You can run the following commands in your terminal to do so:
|
||||
|
||||
```bash
|
||||
cd ~/.vim/bundle
|
||||
git clone https://github.com/w0rp/ale.git
|
||||
git clone https://github.com/dense-analysis/ale.git
|
||||
```
|
||||
|
||||
<a name="installation-with-vundle"></a>
|
||||
@@ -291,7 +327,7 @@ You can install this plugin using [Vundle](https://github.com/VundleVim/Vundle.v
|
||||
by using the path on GitHub for this repository.
|
||||
|
||||
```vim
|
||||
Plugin 'w0rp/ale'
|
||||
Plugin 'dense-analysis/ale'
|
||||
```
|
||||
|
||||
See the Vundle documentation for more information.
|
||||
@@ -305,7 +341,7 @@ by adding the GitHub path for this repository to your `~/.vimrc`
|
||||
and running `:PlugInstall`.
|
||||
|
||||
```vim
|
||||
Plug 'w0rp/ale'
|
||||
Plug 'dense-analysis/ale'
|
||||
```
|
||||
|
||||
<a name="contributing"></a>
|
||||
@@ -313,14 +349,14 @@ Plug 'w0rp/ale'
|
||||
## 4. Contributing
|
||||
|
||||
If you would like to see support for more languages and tools, please
|
||||
[create an issue](https://github.com/w0rp/ale/issues)
|
||||
or [create a pull request](https://github.com/w0rp/ale/pulls).
|
||||
[create an issue](https://github.com/dense-analysis/ale/issues)
|
||||
or [create a pull request](https://github.com/dense-analysis/ale/pulls).
|
||||
If your tool can read from stdin or you have code to suggest which is good,
|
||||
support can be happily added for it.
|
||||
|
||||
If you are interested in the general direction of the project, check out the
|
||||
[wiki home page](https://github.com/w0rp/ale/wiki). The wiki includes a
|
||||
Roadmap for the future, and more.
|
||||
[wiki home page](https://github.com/dense-analysis/ale/wiki). The wiki includes
|
||||
a Roadmap for the future, and more.
|
||||
|
||||
If you'd liked to discuss the project more directly, check out the `#vim-ale` channel
|
||||
on Freenode. Web chat is available [here](https://webchat.freenode.net/?channels=vim-ale).
|
||||
@@ -517,7 +553,7 @@ let g:ale_echo_msg_format = '[%linter%] %s [%severity%]'
|
||||
|
||||
Will give you:
|
||||
|
||||

|
||||

|
||||
|
||||
See `:help g:ale_echo_msg_format` for more information.
|
||||
|
||||
@@ -572,6 +608,7 @@ options off.
|
||||
```vim
|
||||
" Write this in your vimrc file
|
||||
let g:ale_lint_on_text_changed = 'never'
|
||||
let g:ale_lint_on_insert_leave = 0
|
||||
" You can disable this option too
|
||||
" if you don't want linters to run on opening a file
|
||||
let g:ale_lint_on_enter = 0
|
||||
@@ -698,11 +735,10 @@ while you type. ALE uses a timeout which is cancelled and reset every time you
|
||||
type, and this delay can be increased so linters are run less often. See
|
||||
`:help g:ale_lint_delay` for more information.
|
||||
|
||||
If you don't wish to run linters while you type, you can disable that
|
||||
behaviour. Set `g:ale_lint_on_text_changed` to `never` or `normal`. You won't
|
||||
get as frequent error checking, but ALE shouldn't block your ability to edit a
|
||||
document after you save a file, so the asynchronous nature of the plugin will
|
||||
still be an advantage.
|
||||
If you don't wish to run linters while you type, you can disable that behaviour.
|
||||
Set `g:ale_lint_on_text_changed` to `never`. You won't get as frequent error
|
||||
checking, but ALE shouldn't block your ability to edit a document after you save
|
||||
a file, so the asynchronous nature of the plugin will still be an advantage.
|
||||
|
||||
If you are still concerned, you can turn the automatic linting off altogether,
|
||||
including the option `g:ale_lint_on_enter`, and you can run ALE manually with
|
||||
|
||||
@@ -5,7 +5,10 @@ call ale#Set('asm_gcc_executable', 'gcc')
|
||||
call ale#Set('asm_gcc_options', '-Wall')
|
||||
|
||||
function! ale_linters#asm#gcc#GetCommand(buffer) abort
|
||||
return '%e -x assembler -fsyntax-only '
|
||||
" `-o /dev/null` or `-o null` is needed to catch all errors,
|
||||
" -fsyntax-only doesn't catch everything.
|
||||
return '%e -x assembler'
|
||||
\ . ' -o ' . g:ale#util#nul_file
|
||||
\ . '-iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h'))
|
||||
\ . ' ' . ale#Var(a:buffer, 'asm_gcc_options') . ' -'
|
||||
endfunction
|
||||
|
||||
4
ale_linters/bats/shellcheck.vim
Normal file
4
ale_linters/bats/shellcheck.vim
Normal file
@@ -0,0 +1,4 @@
|
||||
" Author: Ian2020 <https://github.com/Ian2020>
|
||||
" Description: shellcheck linter for bats scripts.
|
||||
|
||||
call ale#handlers#shellcheck#DefineLinter('bats')
|
||||
@@ -3,15 +3,14 @@
|
||||
|
||||
call ale#Set('c_clangd_executable', 'clangd')
|
||||
call ale#Set('c_clangd_options', '')
|
||||
|
||||
function! ale_linters#c#clangd#GetProjectRoot(buffer) abort
|
||||
let l:project_root = ale#path#FindNearestFile(a:buffer, 'compile_commands.json')
|
||||
|
||||
return !empty(l:project_root) ? fnamemodify(l:project_root, ':h') : ''
|
||||
endfunction
|
||||
call ale#Set('c_build_dir', '')
|
||||
|
||||
function! ale_linters#c#clangd#GetCommand(buffer) abort
|
||||
return '%e' . ale#Pad(ale#Var(a:buffer, 'c_clangd_options'))
|
||||
let l:build_dir = ale#c#GetBuildDirectory(a:buffer)
|
||||
|
||||
return '%e'
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'c_clangd_options'))
|
||||
\ . (!empty(l:build_dir) ? ' -compile-commands-dir=' . ale#Escape(l:build_dir) : '')
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('c', {
|
||||
@@ -19,5 +18,5 @@ call ale#linter#Define('c', {
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': {b -> ale#Var(b, 'c_clangd_executable')},
|
||||
\ 'command': function('ale_linters#c#clangd#GetCommand'),
|
||||
\ 'project_root': function('ale_linters#c#clangd#GetProjectRoot'),
|
||||
\ 'project_root': function('ale#c#FindProjectRoot'),
|
||||
\})
|
||||
|
||||
@@ -11,22 +11,32 @@ call ale#Set('c_clangtidy_executable', 'clang-tidy')
|
||||
" http://clang.llvm.org/extra/clang-tidy/checks/list.html
|
||||
|
||||
call ale#Set('c_clangtidy_checks', [])
|
||||
" Set this option to manually set some options for clang-tidy.
|
||||
" Set this option to manually set some options for clang-tidy to use as compile
|
||||
" flags.
|
||||
" This will disable compile_commands.json detection.
|
||||
call ale#Set('c_clangtidy_options', '')
|
||||
" Set this option to manually set options for clang-tidy directly.
|
||||
call ale#Set('c_clangtidy_extra_options', '')
|
||||
call ale#Set('c_build_dir', '')
|
||||
|
||||
function! ale_linters#c#clangtidy#GetCommand(buffer) abort
|
||||
function! ale_linters#c#clangtidy#GetCommand(buffer, output) abort
|
||||
let l:checks = join(ale#Var(a:buffer, 'c_clangtidy_checks'), ',')
|
||||
let l:build_dir = ale#c#GetBuildDirectory(a:buffer)
|
||||
let l:options = ''
|
||||
|
||||
" Get the extra options if we couldn't find a build directory.
|
||||
let l:options = empty(l:build_dir)
|
||||
\ ? ale#Var(a:buffer, 'c_clangtidy_options')
|
||||
\ : ''
|
||||
if empty(l:build_dir)
|
||||
let l:options = ale#Var(a:buffer, 'c_clangtidy_options')
|
||||
let l:cflags = ale#c#GetCFlags(a:buffer, a:output)
|
||||
let l:options .= !empty(l:options) ? ale#Pad(l:cflags) : l:cflags
|
||||
endif
|
||||
|
||||
" Get the options to pass directly to clang-tidy
|
||||
let l:extra_options = ale#Var(a:buffer, 'c_clangtidy_extra_options')
|
||||
|
||||
return '%e'
|
||||
\ . (!empty(l:checks) ? ' -checks=' . ale#Escape(l:checks) : '')
|
||||
\ . (!empty(l:extra_options) ? ' ' . ale#Escape(l:extra_options) : '')
|
||||
\ . ' %s'
|
||||
\ . (!empty(l:build_dir) ? ' -p ' . ale#Escape(l:build_dir) : '')
|
||||
\ . (!empty(l:options) ? ' -- ' . l:options : '')
|
||||
@@ -36,7 +46,7 @@ call ale#linter#Define('c', {
|
||||
\ 'name': 'clangtidy',
|
||||
\ 'output_stream': 'stdout',
|
||||
\ 'executable': {b -> ale#Var(b, 'c_clangtidy_executable')},
|
||||
\ 'command': function('ale_linters#c#clangtidy#GetCommand'),
|
||||
\ 'command': {b -> ale#c#RunMakeCommand(b, function('ale_linters#c#clangtidy#GetCommand'))},
|
||||
\ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
||||
|
||||
@@ -5,23 +5,17 @@ call ale#Set('c_cppcheck_executable', 'cppcheck')
|
||||
call ale#Set('c_cppcheck_options', '--enable=style')
|
||||
|
||||
function! ale_linters#c#cppcheck#GetCommand(buffer) abort
|
||||
" Search upwards from the file for compile_commands.json.
|
||||
"
|
||||
" If we find it, we'll `cd` to where the compile_commands.json file is,
|
||||
" then use the file to set up import paths, etc.
|
||||
let l:compile_commmands_path = ale#path#FindNearestFile(a:buffer, 'compile_commands.json')
|
||||
|
||||
let l:cd_command = !empty(l:compile_commmands_path)
|
||||
\ ? ale#path#CdString(fnamemodify(l:compile_commmands_path, ':h'))
|
||||
\ : ''
|
||||
let l:compile_commands_option = !empty(l:compile_commmands_path)
|
||||
\ ? '--project=compile_commands.json '
|
||||
let l:cd_command = ale#handlers#cppcheck#GetCdCommand(a:buffer)
|
||||
let l:compile_commands_option = ale#handlers#cppcheck#GetCompileCommandsOptions(a:buffer)
|
||||
let l:buffer_path_include = empty(l:compile_commands_option)
|
||||
\ ? ale#handlers#cppcheck#GetBufferPathIncludeOptions(a:buffer)
|
||||
\ : ''
|
||||
|
||||
return l:cd_command
|
||||
\ . '%e -q --language=c '
|
||||
\ . l:compile_commands_option
|
||||
\ . ale#Var(a:buffer, 'c_cppcheck_options')
|
||||
\ . '%e -q --language=c'
|
||||
\ . ale#Pad(l:compile_commands_option)
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'c_cppcheck_options'))
|
||||
\ . l:buffer_path_include
|
||||
\ . ' %t'
|
||||
endfunction
|
||||
|
||||
|
||||
@@ -5,13 +5,15 @@ call ale#Set('c_cquery_executable', 'cquery')
|
||||
call ale#Set('c_cquery_cache_directory', expand('~/.cache/cquery'))
|
||||
|
||||
function! ale_linters#c#cquery#GetProjectRoot(buffer) abort
|
||||
let l:project_root = ale#path#FindNearestFile(a:buffer, 'compile_commands.json')
|
||||
" Try to find cquery configuration files first.
|
||||
let l:config = ale#path#FindNearestFile(a:buffer, '.cquery')
|
||||
|
||||
if empty(l:project_root)
|
||||
let l:project_root = ale#path#FindNearestFile(a:buffer, '.cquery')
|
||||
if !empty(l:config)
|
||||
return fnamemodify(l:config, ':h')
|
||||
endif
|
||||
|
||||
return !empty(l:project_root) ? fnamemodify(l:project_root, ':h') : ''
|
||||
" Fall back on default project root detection.
|
||||
return ale#c#FindProjectRoot(a:buffer)
|
||||
endfunction
|
||||
|
||||
function! ale_linters#c#cquery#GetInitializationOptions(buffer) abort
|
||||
|
||||
@@ -9,7 +9,11 @@ function! ale_linters#c#gcc#GetCommand(buffer, output) abort
|
||||
|
||||
" -iquote with the directory the file is in makes #include work for
|
||||
" headers in the same directory.
|
||||
return '%e -S -x c -fsyntax-only'
|
||||
"
|
||||
" `-o /dev/null` or `-o null` is needed to catch all errors,
|
||||
" -fsyntax-only doesn't catch everything.
|
||||
return '%e -S -x c'
|
||||
\ . ' -o ' . g:ale#util#nul_file
|
||||
\ . ' -iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h'))
|
||||
\ . ale#Pad(l:cflags)
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'c_gcc_options')) . ' -'
|
||||
|
||||
54
ale_linters/chef/cookstyle.vim
Normal file
54
ale_linters/chef/cookstyle.vim
Normal file
@@ -0,0 +1,54 @@
|
||||
" Author: Raphael Hoegger - https://github.com/pfuender
|
||||
" Description: Cookstyle (RuboCop based), a code style analyzer for Ruby files
|
||||
|
||||
call ale#Set('chef_cookstyle_executable', 'cookstyle')
|
||||
call ale#Set('chef_cookstyle_options', '')
|
||||
|
||||
function! ale_linters#chef#cookstyle#GetCommand(buffer) abort
|
||||
let l:options = ale#Var(a:buffer, 'chef_cookstyle_options')
|
||||
|
||||
return '%e' . ale#Pad(escape(l:options, '~')) . ' --force-exclusion --format json --stdin ' . ' %s'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#chef#cookstyle#Handle(buffer, lines) abort
|
||||
if len(a:lines) == 0
|
||||
return []
|
||||
endif
|
||||
|
||||
let l:errors = ale#util#FuzzyJSONDecode(a:lines[0], {})
|
||||
|
||||
if !has_key(l:errors, 'summary')
|
||||
\|| l:errors['summary']['offense_count'] == 0
|
||||
\|| empty(l:errors['files'])
|
||||
return []
|
||||
endif
|
||||
|
||||
let l:output = []
|
||||
|
||||
for l:error in l:errors['files'][0]['offenses']
|
||||
let l:start_col = str2nr(l:error['location']['start_column'])
|
||||
let l:end_col = str2nr(l:error['location']['last_column'])
|
||||
|
||||
if !l:end_col
|
||||
let l:end_col = l:start_col + 1
|
||||
endif
|
||||
|
||||
call add(l:output, {
|
||||
\ 'lnum': str2nr(l:error['location']['line']),
|
||||
\ 'col': l:start_col,
|
||||
\ 'end_col': l:end_col,
|
||||
\ 'code': l:error['cop_name'],
|
||||
\ 'text': l:error['message'],
|
||||
\ 'type': l:error['severity'] is? 'convention' ? 'W' : 'E',
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('chef', {
|
||||
\ 'name': 'cookstyle',
|
||||
\ 'executable': {b -> ale#Var(b, 'chef_cookstyle_executable')},
|
||||
\ 'command': function('ale_linters#chef#cookstyle#GetCommand'),
|
||||
\ 'callback': 'ale_linters#chef#cookstyle#Handle',
|
||||
\})
|
||||
34
ale_linters/clojure/clj_kondo.vim
Normal file
34
ale_linters/clojure/clj_kondo.vim
Normal file
@@ -0,0 +1,34 @@
|
||||
" Author: Masashi Iizuka <liquidz.uo@gmail.com>
|
||||
" Description: linter for clojure using clj-kondo https://github.com/borkdude/clj-kondo
|
||||
|
||||
function! ale_linters#clojure#clj_kondo#HandleCljKondoFormat(buffer, lines) abort
|
||||
" output format
|
||||
" <filename>:<line>:<column>: <issue type>: <message>
|
||||
let l:pattern = '\v^[a-zA-Z]?:?[^:]+:(\d+):(\d+):? ((Exception|error|warning): ?(.+))$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
let l:type = 'E'
|
||||
|
||||
if l:match[4] is? 'warning'
|
||||
let l:type = 'W'
|
||||
endif
|
||||
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[1] + 0,
|
||||
\ 'col': l:match[2] + 0,
|
||||
\ 'text': l:match[3],
|
||||
\ 'type': l:type,
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('clojure', {
|
||||
\ 'name': 'clj-kondo',
|
||||
\ 'output_stream': 'stdout',
|
||||
\ 'executable': 'clj-kondo',
|
||||
\ 'command': 'clj-kondo --cache --lint %t',
|
||||
\ 'callback': 'ale_linters#clojure#clj_kondo#HandleCljKondoFormat',
|
||||
\})
|
||||
@@ -12,14 +12,15 @@ function! ale_linters#cpp#clangcheck#GetCommand(buffer) abort
|
||||
let l:build_dir = ale#Var(a:buffer, 'c_build_dir')
|
||||
|
||||
if empty(l:build_dir)
|
||||
let l:build_dir = ale#path#Dirname(ale#c#FindCompileCommands(a:buffer))
|
||||
let [l:root, l:json_file] = ale#c#FindCompileCommands(a:buffer)
|
||||
let l:build_dir = ale#path#Dirname(l:json_file)
|
||||
endif
|
||||
|
||||
" The extra arguments in the command are used to prevent .plist files from
|
||||
" being generated. These are only added if no build directory can be
|
||||
" detected.
|
||||
return '%e -analyze %s'
|
||||
\ . (empty(l:build_dir) ? ' -extra-arg -Xclang -extra-arg -analyzer-output=text' : '')
|
||||
\ . (empty(l:build_dir) ? ' --extra-arg=-Xclang --extra-arg=-analyzer-output=text --extra-arg=-fno-color-diagnostics': '')
|
||||
\ . ale#Pad(l:user_options)
|
||||
\ . (!empty(l:build_dir) ? ' -p ' . ale#Escape(l:build_dir) : '')
|
||||
endfunction
|
||||
|
||||
@@ -3,15 +3,14 @@
|
||||
|
||||
call ale#Set('cpp_clangd_executable', 'clangd')
|
||||
call ale#Set('cpp_clangd_options', '')
|
||||
|
||||
function! ale_linters#cpp#clangd#GetProjectRoot(buffer) abort
|
||||
let l:project_root = ale#path#FindNearestFile(a:buffer, 'compile_commands.json')
|
||||
|
||||
return !empty(l:project_root) ? fnamemodify(l:project_root, ':h') : ''
|
||||
endfunction
|
||||
call ale#Set('c_build_dir', '')
|
||||
|
||||
function! ale_linters#cpp#clangd#GetCommand(buffer) abort
|
||||
return '%e' . ale#Pad(ale#Var(a:buffer, 'cpp_clangd_options'))
|
||||
let l:build_dir = ale#c#GetBuildDirectory(a:buffer)
|
||||
|
||||
return '%e'
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'cpp_clangd_options'))
|
||||
\ . (!empty(l:build_dir) ? ' -compile-commands-dir=' . ale#Escape(l:build_dir) : '')
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('cpp', {
|
||||
@@ -19,5 +18,5 @@ call ale#linter#Define('cpp', {
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': {b -> ale#Var(b, 'cpp_clangd_executable')},
|
||||
\ 'command': function('ale_linters#cpp#clangd#GetCommand'),
|
||||
\ 'project_root': function('ale_linters#cpp#clangd#GetProjectRoot'),
|
||||
\ 'project_root': function('ale#c#FindProjectRoot'),
|
||||
\})
|
||||
|
||||
@@ -5,22 +5,32 @@
|
||||
call ale#Set('cpp_clangtidy_executable', 'clang-tidy')
|
||||
" Set this option to check the checks clang-tidy will apply.
|
||||
call ale#Set('cpp_clangtidy_checks', [])
|
||||
" Set this option to manually set some options for clang-tidy.
|
||||
" Set this option to manually set some options for clang-tidy to use as compile
|
||||
" flags.
|
||||
" This will disable compile_commands.json detection.
|
||||
call ale#Set('cpp_clangtidy_options', '')
|
||||
" Set this option to manually set options for clang-tidy directly.
|
||||
call ale#Set('cpp_clangtidy_extra_options', '')
|
||||
call ale#Set('c_build_dir', '')
|
||||
|
||||
function! ale_linters#cpp#clangtidy#GetCommand(buffer) abort
|
||||
function! ale_linters#cpp#clangtidy#GetCommand(buffer, output) abort
|
||||
let l:checks = join(ale#Var(a:buffer, 'cpp_clangtidy_checks'), ',')
|
||||
let l:build_dir = ale#c#GetBuildDirectory(a:buffer)
|
||||
let l:options = ''
|
||||
|
||||
" Get the extra options if we couldn't find a build directory.
|
||||
let l:options = empty(l:build_dir)
|
||||
\ ? ale#Var(a:buffer, 'cpp_clangtidy_options')
|
||||
\ : ''
|
||||
if empty(l:build_dir)
|
||||
let l:options = ale#Var(a:buffer, 'cpp_clangtidy_options')
|
||||
let l:cflags = ale#c#GetCFlags(a:buffer, a:output)
|
||||
let l:options .= !empty(l:options) ? ale#Pad(l:cflags) : l:cflags
|
||||
endif
|
||||
|
||||
" Get the options to pass directly to clang-tidy
|
||||
let l:extra_options = ale#Var(a:buffer, 'cpp_clangtidy_extra_options')
|
||||
|
||||
return '%e'
|
||||
\ . (!empty(l:checks) ? ' -checks=' . ale#Escape(l:checks) : '')
|
||||
\ . (!empty(l:extra_options) ? ' ' . ale#Escape(l:extra_options) : '')
|
||||
\ . ' %s'
|
||||
\ . (!empty(l:build_dir) ? ' -p ' . ale#Escape(l:build_dir) : '')
|
||||
\ . (!empty(l:options) ? ' -- ' . l:options : '')
|
||||
@@ -30,7 +40,7 @@ call ale#linter#Define('cpp', {
|
||||
\ 'name': 'clangtidy',
|
||||
\ 'output_stream': 'stdout',
|
||||
\ 'executable': {b -> ale#Var(b, 'cpp_clangtidy_executable')},
|
||||
\ 'command': function('ale_linters#cpp#clangtidy#GetCommand'),
|
||||
\ 'command': {b -> ale#c#RunMakeCommand(b, function('ale_linters#cpp#clangtidy#GetCommand'))},
|
||||
\ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
||||
|
||||
@@ -5,23 +5,17 @@ call ale#Set('cpp_cppcheck_executable', 'cppcheck')
|
||||
call ale#Set('cpp_cppcheck_options', '--enable=style')
|
||||
|
||||
function! ale_linters#cpp#cppcheck#GetCommand(buffer) abort
|
||||
" Search upwards from the file for compile_commands.json.
|
||||
"
|
||||
" If we find it, we'll `cd` to where the compile_commands.json file is,
|
||||
" then use the file to set up import paths, etc.
|
||||
let l:compile_commmands_path = ale#path#FindNearestFile(a:buffer, 'compile_commands.json')
|
||||
|
||||
let l:cd_command = !empty(l:compile_commmands_path)
|
||||
\ ? ale#path#CdString(fnamemodify(l:compile_commmands_path, ':h'))
|
||||
\ : ''
|
||||
let l:compile_commands_option = !empty(l:compile_commmands_path)
|
||||
\ ? '--project=compile_commands.json '
|
||||
let l:cd_command = ale#handlers#cppcheck#GetCdCommand(a:buffer)
|
||||
let l:compile_commands_option = ale#handlers#cppcheck#GetCompileCommandsOptions(a:buffer)
|
||||
let l:buffer_path_include = empty(l:compile_commands_option)
|
||||
\ ? ale#handlers#cppcheck#GetBufferPathIncludeOptions(a:buffer)
|
||||
\ : ''
|
||||
|
||||
return l:cd_command
|
||||
\ . '%e -q --language=c++ '
|
||||
\ . l:compile_commands_option
|
||||
\ . ale#Var(a:buffer, 'cpp_cppcheck_options')
|
||||
\ . '%e -q --language=c++'
|
||||
\ . ale#Pad(l:compile_commands_option)
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'cpp_cppcheck_options'))
|
||||
\ . l:buffer_path_include
|
||||
\ . ' %t'
|
||||
endfunction
|
||||
|
||||
|
||||
@@ -5,13 +5,15 @@ call ale#Set('cpp_cquery_executable', 'cquery')
|
||||
call ale#Set('cpp_cquery_cache_directory', expand('~/.cache/cquery'))
|
||||
|
||||
function! ale_linters#cpp#cquery#GetProjectRoot(buffer) abort
|
||||
let l:project_root = ale#path#FindNearestFile(a:buffer, 'compile_commands.json')
|
||||
" Try to find cquery configuration files first.
|
||||
let l:config = ale#path#FindNearestFile(a:buffer, '.cquery')
|
||||
|
||||
if empty(l:project_root)
|
||||
let l:project_root = ale#path#FindNearestFile(a:buffer, '.cquery')
|
||||
if !empty(l:config)
|
||||
return fnamemodify(l:config, ':h')
|
||||
endif
|
||||
|
||||
return !empty(l:project_root) ? fnamemodify(l:project_root, ':h') : ''
|
||||
" Fall back on default project root detection.
|
||||
return ale#c#FindProjectRoot(a:buffer)
|
||||
endfunction
|
||||
|
||||
function! ale_linters#cpp#cquery#GetInitializationOptions(buffer) abort
|
||||
|
||||
@@ -9,7 +9,11 @@ function! ale_linters#cpp#gcc#GetCommand(buffer, output) abort
|
||||
|
||||
" -iquote with the directory the file is in makes #include work for
|
||||
" headers in the same directory.
|
||||
return '%e -S -x c++ -fsyntax-only'
|
||||
"
|
||||
" `-o /dev/null` or `-o null` is needed to catch all errors,
|
||||
" -fsyntax-only doesn't catch everything.
|
||||
return '%e -S -x c++'
|
||||
\ . ' -o ' . g:ale#util#nul_file
|
||||
\ . ' -iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h'))
|
||||
\ . ale#Pad(l:cflags)
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'cpp_gcc_options')) . ' -'
|
||||
|
||||
@@ -5,6 +5,10 @@ function! ale_linters#crystal#crystal#Handle(buffer, lines) abort
|
||||
let l:output = []
|
||||
|
||||
for l:error in ale#util#FuzzyJSONDecode(a:lines, [])
|
||||
if !has_key(l:error, 'file')
|
||||
continue
|
||||
endif
|
||||
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:error.line + 0,
|
||||
\ 'col': l:error.column + 0,
|
||||
|
||||
95
ale_linters/cs/csc.vim
Normal file
95
ale_linters/cs/csc.vim
Normal file
@@ -0,0 +1,95 @@
|
||||
call ale#Set('cs_csc_options', '')
|
||||
call ale#Set('cs_csc_source', '')
|
||||
call ale#Set('cs_csc_assembly_path', [])
|
||||
call ale#Set('cs_csc_assemblies', [])
|
||||
|
||||
function! s:GetWorkingDirectory(buffer) abort
|
||||
let l:working_directory = ale#Var(a:buffer, 'cs_csc_source')
|
||||
|
||||
if !empty(l:working_directory)
|
||||
return l:working_directory
|
||||
endif
|
||||
|
||||
return expand('#' . a:buffer . ':p:h')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#cs#csc#GetCommand(buffer) abort
|
||||
" Pass assembly paths via the -lib: parameter.
|
||||
let l:path_list = ale#Var(a:buffer, 'cs_csc_assembly_path')
|
||||
|
||||
let l:lib_option = !empty(l:path_list)
|
||||
\ ? '/lib:' . join(map(copy(l:path_list), 'ale#Escape(v:val)'), ',')
|
||||
\ : ''
|
||||
|
||||
" Pass paths to DLL files via the -r: parameter.
|
||||
let l:assembly_list = ale#Var(a:buffer, 'cs_csc_assemblies')
|
||||
|
||||
let l:r_option = !empty(l:assembly_list)
|
||||
\ ? '/r:' . join(map(copy(l:assembly_list), 'ale#Escape(v:val)'), ',')
|
||||
\ : ''
|
||||
|
||||
" register temporary module target file with ale
|
||||
" register temporary module target file with ALE.
|
||||
let l:out = ale#command#CreateFile(a:buffer)
|
||||
|
||||
" The code is compiled as a module and the output is redirected to a
|
||||
" temporary file.
|
||||
return ale#path#CdString(s:GetWorkingDirectory(a:buffer))
|
||||
\ . 'csc /unsafe'
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'cs_csc_options'))
|
||||
\ . ale#Pad(l:lib_option)
|
||||
\ . ale#Pad(l:r_option)
|
||||
\ . ' /out:' . l:out
|
||||
\ . ' /t:module'
|
||||
\ . ' /recurse:' . ale#Escape('*.cs')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#cs#csc#Handle(buffer, lines) abort
|
||||
" Look for lines like the following.
|
||||
"
|
||||
" Tests.cs(12,29): error CSXXXX: ; expected
|
||||
"
|
||||
" NOTE: pattern also captures file name as linter compiles all
|
||||
" files within the source tree rooted at the specified source
|
||||
" path and not just the file loaded in the buffer
|
||||
let l:patterns = [
|
||||
\ '^\v(.+\.cs)\((\d+),(\d+)\)\:\s+([^ ]+)\s+([cC][sS][^ ]+):\s(.+)$',
|
||||
\ '^\v([^ ]+)\s+([Cc][sS][^ ]+):\s+(.+)$',
|
||||
\]
|
||||
let l:output = []
|
||||
|
||||
let l:dir = s:GetWorkingDirectory(a:buffer)
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:patterns)
|
||||
if len(l:match) > 6 && strlen(l:match[5]) > 2 && l:match[5][:1] is? 'CS'
|
||||
call add(l:output, {
|
||||
\ 'filename': ale#path#GetAbsPath(l:dir, l:match[1]),
|
||||
\ 'lnum': l:match[2] + 0,
|
||||
\ 'col': l:match[3] + 0,
|
||||
\ 'type': l:match[4] is# 'error' ? 'E' : 'W',
|
||||
\ 'code': l:match[5],
|
||||
\ 'text': l:match[6] ,
|
||||
\})
|
||||
elseif strlen(l:match[2]) > 2 && l:match[2][:1] is? 'CS'
|
||||
call add(l:output, {
|
||||
\ 'filename':'<csc>',
|
||||
\ 'lnum': -1,
|
||||
\ 'col': -1,
|
||||
\ 'type': l:match[1] is# 'error' ? 'E' : 'W',
|
||||
\ 'code': l:match[2],
|
||||
\ 'text': l:match[3],
|
||||
\})
|
||||
endif
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('cs',{
|
||||
\ 'name': 'csc',
|
||||
\ 'output_stream': 'stdout',
|
||||
\ 'executable': 'csc',
|
||||
\ 'command': function('ale_linters#cs#csc#GetCommand'),
|
||||
\ 'callback': 'ale_linters#cs#csc#Handle',
|
||||
\ 'lint_file': 1
|
||||
\})
|
||||
@@ -52,20 +52,34 @@ function! ale_linters#cs#mcsc#Handle(buffer, lines) abort
|
||||
" NOTE: pattern also captures file name as linter compiles all
|
||||
" files within the source tree rooted at the specified source
|
||||
" path and not just the file loaded in the buffer
|
||||
let l:pattern = '^\v(.+\.cs)\((\d+),(\d+)\)\: ([^ ]+) ([^ ]+): (.+)$'
|
||||
let l:patterns = [
|
||||
\ '^\v(.+\.cs)\((\d+),(\d+)\)\:\s+([^ ]+)\s+([cC][sS][^ ]+):\s(.+)$',
|
||||
\ '^\v([^ ]+)\s+([Cc][sS][^ ]+):\s+(.+)$',
|
||||
\]
|
||||
let l:output = []
|
||||
|
||||
let l:dir = s:GetWorkingDirectory(a:buffer)
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'filename': ale#path#GetAbsPath(l:dir, l:match[1]),
|
||||
\ 'lnum': l:match[2] + 0,
|
||||
\ 'col': l:match[3] + 0,
|
||||
\ 'type': l:match[4] is# 'error' ? 'E' : 'W',
|
||||
\ 'code': l:match[5],
|
||||
\ 'text': l:match[6],
|
||||
\})
|
||||
for l:match in ale#util#GetMatches(a:lines, l:patterns)
|
||||
if len(l:match) > 6 && strlen(l:match[5]) > 2 && l:match[5][:1] is? 'CS'
|
||||
call add(l:output, {
|
||||
\ 'filename': ale#path#GetAbsPath(l:dir, l:match[1]),
|
||||
\ 'lnum': l:match[2] + 0,
|
||||
\ 'col': l:match[3] + 0,
|
||||
\ 'type': l:match[4] is# 'error' ? 'E' : 'W',
|
||||
\ 'code': l:match[5],
|
||||
\ 'text': l:match[6] ,
|
||||
\})
|
||||
elseif strlen(l:match[2]) > 2 && l:match[2][:1] is? 'CS'
|
||||
call add(l:output, {
|
||||
\ 'filename':'<mcs>',
|
||||
\ 'lnum': -1,
|
||||
\ 'col': -1,
|
||||
\ 'type': l:match[1] is# 'error' ? 'E' : 'W',
|
||||
\ 'code': l:match[2],
|
||||
\ 'text': l:match[3],
|
||||
\})
|
||||
endif
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
|
||||
9
ale_linters/css/fecs.vim
Normal file
9
ale_linters/css/fecs.vim
Normal file
@@ -0,0 +1,9 @@
|
||||
" Author: harttle <yangjvn@126.com>
|
||||
" Description: fecs for CSS files
|
||||
|
||||
call ale#linter#Define('css', {
|
||||
\ 'name': 'fecs',
|
||||
\ 'executable': function('ale#handlers#fecs#GetExecutable'),
|
||||
\ 'command': function('ale#handlers#fecs#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#fecs#Handle',
|
||||
\})
|
||||
40
ale_linters/elm/elm_ls.vim
Normal file
40
ale_linters/elm/elm_ls.vim
Normal file
@@ -0,0 +1,40 @@
|
||||
" Author: antew - https://github.com/antew
|
||||
" Description: elm-language-server integration for elm (diagnostics, formatting, and more)
|
||||
|
||||
call ale#Set('elm_ls_executable', 'elm-language-server')
|
||||
call ale#Set('elm_ls_use_global', get(g:, 'ale_use_global_executables', 1))
|
||||
|
||||
" elm-language-server will search for local and global binaries, if empty
|
||||
call ale#Set('elm_ls_elm_path', '')
|
||||
call ale#Set('elm_ls_elm_format_path', '')
|
||||
call ale#Set('elm_ls_elm_test_path', '')
|
||||
call ale#Set('elm_ls_elm_analyse_trigger', 'change')
|
||||
|
||||
function! elm_ls#GetRootDir(buffer) abort
|
||||
let l:elm_json = ale#path#FindNearestFile(a:buffer, 'elm.json')
|
||||
|
||||
return !empty(l:elm_json) ? fnamemodify(l:elm_json, ':p:h') : ''
|
||||
endfunction
|
||||
|
||||
function! elm_ls#GetOptions(buffer) abort
|
||||
return {
|
||||
\ 'elmPath': ale#Var(a:buffer, 'elm_ls_elm_path'),
|
||||
\ 'elmFormatPath': ale#Var(a:buffer, 'elm_ls_elm_format_path'),
|
||||
\ 'elmTestPath': ale#Var(a:buffer, 'elm_ls_elm_test_path'),
|
||||
\ 'elmAnalyseTrigger': ale#Var(a:buffer, 'elm_ls_elm_analyse_trigger'),
|
||||
\}
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('elm', {
|
||||
\ 'name': 'elm_ls',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': {b -> ale#node#FindExecutable(b, 'elm_ls', [
|
||||
\ 'node_modules/.bin/elm-language-server',
|
||||
\ 'node_modules/.bin/elm-lsp',
|
||||
\ 'elm-lsp'
|
||||
\ ])},
|
||||
\ 'command': '%e --stdio',
|
||||
\ 'project_root': function('elm_ls#GetRootDir'),
|
||||
\ 'language': 'elm',
|
||||
\ 'initialization_options': function('elm_ls#GetOptions')
|
||||
\})
|
||||
@@ -1,22 +0,0 @@
|
||||
" Author: antew - https://github.com/antew
|
||||
" Description: LSP integration for elm, currently supports diagnostics (linting)
|
||||
|
||||
call ale#Set('elm_lsp_executable', 'elm-lsp')
|
||||
call ale#Set('elm_lsp_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
|
||||
function! elm_lsp#GetRootDir(buffer) abort
|
||||
let l:elm_json = ale#path#FindNearestFile(a:buffer, 'elm.json')
|
||||
|
||||
return !empty(l:elm_json) ? fnamemodify(l:elm_json, ':p:h') : ''
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('elm', {
|
||||
\ 'name': 'elm_lsp',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': {b -> ale#node#FindExecutable(b, 'elm_lsp', [
|
||||
\ 'node_modules/.bin/elm-lsp',
|
||||
\ ])},
|
||||
\ 'command': '%e --stdio',
|
||||
\ 'project_root': function('elm_lsp#GetRootDir'),
|
||||
\ 'language': 'elm'
|
||||
\})
|
||||
93
ale_linters/erlang/dialyzer.vim
Normal file
93
ale_linters/erlang/dialyzer.vim
Normal file
@@ -0,0 +1,93 @@
|
||||
" Author: Autoine Gagne - https://github.com/AntoineGagne
|
||||
" Description: Define a checker that runs dialyzer on Erlang files.
|
||||
|
||||
let g:ale_erlang_dialyzer_executable =
|
||||
\ get(g:, 'ale_erlang_dialyzer_executable', 'dialyzer')
|
||||
let g:ale_erlang_dialyzer_plt_file =
|
||||
\ get(g:, 'ale_erlang_dialyzer_plt_file', '')
|
||||
let g:ale_erlang_dialyzer_rebar3_profile =
|
||||
\ get(g:, 'ale_erlang_dialyzer_rebar3_profile', 'default')
|
||||
|
||||
function! ale_linters#erlang#dialyzer#GetRebar3Profile(buffer) abort
|
||||
return ale#Var(a:buffer, 'erlang_dialyzer_rebar3_profile')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#erlang#dialyzer#FindPlt(buffer) abort
|
||||
let l:plt_file = ''
|
||||
let l:rebar3_profile = ale_linters#erlang#dialyzer#GetRebar3Profile(a:buffer)
|
||||
let l:plt_file_directory = ale#path#FindNearestDirectory(a:buffer, '_build/' . l:rebar3_profile)
|
||||
|
||||
if !empty(l:plt_file_directory)
|
||||
let l:plt_file = globpath(l:plt_file_directory, '*_plt', 0, 1)
|
||||
endif
|
||||
|
||||
if !empty(l:plt_file)
|
||||
return l:plt_file[0]
|
||||
endif
|
||||
|
||||
if !empty($REBAR_PLT_DIR)
|
||||
return expand('$REBAR_PLT_DIR/dialyzer/plt')
|
||||
endif
|
||||
|
||||
return expand('$HOME/.dialyzer_plt')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#erlang#dialyzer#GetPlt(buffer) abort
|
||||
let l:plt_file = ale#Var(a:buffer, 'erlang_dialyzer_plt_file')
|
||||
|
||||
if !empty(l:plt_file)
|
||||
return l:plt_file
|
||||
endif
|
||||
|
||||
return ale_linters#erlang#dialyzer#FindPlt(a:buffer)
|
||||
endfunction
|
||||
|
||||
function! ale_linters#erlang#dialyzer#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'erlang_dialyzer_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#erlang#dialyzer#GetCommand(buffer) abort
|
||||
let l:command = ale#Escape(ale_linters#erlang#dialyzer#GetExecutable(a:buffer))
|
||||
\ . ' -n'
|
||||
\ . ' --plt ' . ale#Escape(ale_linters#erlang#dialyzer#GetPlt(a:buffer))
|
||||
\ . ' -Wunmatched_returns'
|
||||
\ . ' -Werror_handling'
|
||||
\ . ' -Wrace_conditions'
|
||||
\ . ' -Wunderspecs'
|
||||
\ . ' %s'
|
||||
|
||||
return l:command
|
||||
endfunction
|
||||
|
||||
function! ale_linters#erlang#dialyzer#Handle(buffer, lines) abort
|
||||
" Match patterns like the following:
|
||||
"
|
||||
" erl_tidy_prv_fmt.erl:3: Callback info about the provider behaviour is not available
|
||||
let l:pattern = '^\S\+:\(\d\+\): \(.\+\)$'
|
||||
let l:output = []
|
||||
|
||||
for l:line in a:lines
|
||||
let l:match = matchlist(l:line, l:pattern)
|
||||
|
||||
if len(l:match) != 0
|
||||
let l:code = l:match[2]
|
||||
|
||||
call add(l:output, {
|
||||
\ 'lnum': str2nr(l:match[1]),
|
||||
\ 'lcol': 0,
|
||||
\ 'text': l:code,
|
||||
\ 'type': 'W'
|
||||
\})
|
||||
endif
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('erlang', {
|
||||
\ 'name': 'dialyzer',
|
||||
\ 'executable': function('ale_linters#erlang#dialyzer#GetExecutable'),
|
||||
\ 'command': function('ale_linters#erlang#dialyzer#GetCommand'),
|
||||
\ 'callback': function('ale_linters#erlang#dialyzer#Handle'),
|
||||
\ 'lint_file': 1
|
||||
\})
|
||||
@@ -8,7 +8,7 @@ call ale#Set('eruby_ruumba_options', '')
|
||||
function! ale_linters#eruby#ruumba#GetCommand(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'eruby_ruumba_executable')
|
||||
|
||||
return ale#handlers#ruby#EscapeExecutable(l:executable, 'ruumba')
|
||||
return ale#ruby#EscapeExecutable(l:executable, 'ruumba')
|
||||
\ . ' --format json --force-exclusion '
|
||||
\ . ale#Var(a:buffer, 'eruby_ruumba_options')
|
||||
\ . ' --stdin ' . ale#Escape(expand('#' . a:buffer . ':p'))
|
||||
|
||||
@@ -5,11 +5,13 @@ call ale#Set('go_bingo_executable', 'bingo')
|
||||
call ale#Set('go_bingo_options', '--mode stdio')
|
||||
|
||||
function! ale_linters#go#bingo#GetCommand(buffer) abort
|
||||
return '%e' . ale#Pad(ale#Var(a:buffer, 'go_bingo_options'))
|
||||
return ale#go#EnvString(a:buffer) . '%e' . ale#Pad(ale#Var(a:buffer, 'go_bingo_options'))
|
||||
endfunction
|
||||
|
||||
function! ale_linters#go#bingo#FindProjectRoot(buffer) abort
|
||||
let l:project_root = ale#path#FindNearestFile(a:buffer, 'go.mod')
|
||||
let l:go_modules_off = ale#Var(a:buffer, 'go_go111module') is# 'off'
|
||||
let l:project_root = l:go_modules_off ?
|
||||
\ '' : ale#path#FindNearestFile(a:buffer, 'go.mod')
|
||||
let l:mods = ':h'
|
||||
|
||||
if empty(l:project_root)
|
||||
|
||||
@@ -11,6 +11,7 @@ function! ale_linters#go#gobuild#GetCommand(buffer) abort
|
||||
|
||||
" Run go test in local directory with relative path
|
||||
return ale#path#BufferCdString(a:buffer)
|
||||
\ . ale#go#EnvString(a:buffer)
|
||||
\ . ale#Var(a:buffer, 'go_go_executable') . ' test'
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
\ . ' -c -o /dev/null ./'
|
||||
|
||||
@@ -1,10 +1,16 @@
|
||||
" Author: neersighted <bjorn@neersighted.com>
|
||||
" Description: gofmt for Go files
|
||||
|
||||
function! ale_linters#go#gofmt#GetCommand(buffer) abort
|
||||
return ale#go#EnvString(a:buffer)
|
||||
\ . '%e -e %t'
|
||||
endfunction
|
||||
|
||||
|
||||
call ale#linter#Define('go', {
|
||||
\ 'name': 'gofmt',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': 'gofmt',
|
||||
\ 'command': 'gofmt -e %t',
|
||||
\ 'command': function('ale_linters#go#gofmt#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#unix#HandleAsError',
|
||||
\})
|
||||
|
||||
@@ -10,13 +10,16 @@ function! ale_linters#go#golangci_lint#GetCommand(buffer) abort
|
||||
let l:options = ale#Var(a:buffer, 'go_golangci_lint_options')
|
||||
let l:lint_package = ale#Var(a:buffer, 'go_golangci_lint_package')
|
||||
|
||||
|
||||
if l:lint_package
|
||||
return ale#path#BufferCdString(a:buffer)
|
||||
\ . ale#go#EnvString(a:buffer)
|
||||
\ . '%e run '
|
||||
\ . l:options
|
||||
endif
|
||||
|
||||
return ale#path#BufferCdString(a:buffer)
|
||||
\ . ale#go#EnvString(a:buffer)
|
||||
\ . '%e run '
|
||||
\ . ale#Escape(l:filename)
|
||||
\ . ' ' . l:options
|
||||
|
||||
@@ -7,7 +7,7 @@ call ale#Set('go_golint_options', '')
|
||||
function! ale_linters#go#golint#GetCommand(buffer) abort
|
||||
let l:options = ale#Var(a:buffer, 'go_golint_options')
|
||||
|
||||
return '%e'
|
||||
return ale#go#EnvString(a:buffer) . '%e'
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
\ . ' %t'
|
||||
endfunction
|
||||
|
||||
@@ -14,11 +14,13 @@ function! ale_linters#go#gometalinter#GetCommand(buffer) abort
|
||||
" be calculated to absolute paths in the Handler
|
||||
if l:lint_package
|
||||
return ale#path#BufferCdString(a:buffer)
|
||||
\ . ale#go#EnvString(a:buffer)
|
||||
\ . '%e'
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '') . ' .'
|
||||
endif
|
||||
|
||||
return ale#path#BufferCdString(a:buffer)
|
||||
\ . ale#go#EnvString(a:buffer)
|
||||
\ . '%e'
|
||||
\ . ' --include=' . ale#Escape(ale#util#EscapePCRE(l:filename))
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '') . ' .'
|
||||
|
||||
34
ale_linters/go/gopls.vim
Normal file
34
ale_linters/go/gopls.vim
Normal file
@@ -0,0 +1,34 @@
|
||||
" Author: w0rp <devw0rp@gmail.com>
|
||||
" Author: Jerko Steiner <https://github.com/jeremija>
|
||||
" Description: https://github.com/saibing/gopls
|
||||
|
||||
call ale#Set('go_gopls_executable', 'gopls')
|
||||
call ale#Set('go_gopls_options', '--mode stdio')
|
||||
|
||||
function! ale_linters#go#gopls#GetCommand(buffer) abort
|
||||
return ale#go#EnvString(a:buffer)
|
||||
\ . '%e'
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'go_gopls_options'))
|
||||
endfunction
|
||||
|
||||
function! ale_linters#go#gopls#FindProjectRoot(buffer) abort
|
||||
let l:go_modules_off = ale#Var(a:buffer, 'go_go111module') is# 'off'
|
||||
let l:project_root = l:go_modules_off ?
|
||||
\ '' : ale#path#FindNearestFile(a:buffer, 'go.mod')
|
||||
let l:mods = ':h'
|
||||
|
||||
if empty(l:project_root)
|
||||
let l:project_root = ale#path#FindNearestDirectory(a:buffer, '.git')
|
||||
let l:mods = ':h:h'
|
||||
endif
|
||||
|
||||
return !empty(l:project_root) ? fnamemodify(l:project_root, l:mods) : ''
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('go', {
|
||||
\ 'name': 'gopls',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': {b -> ale#Var(b, 'go_gopls_executable')},
|
||||
\ 'command': function('ale_linters#go#gopls#GetCommand'),
|
||||
\ 'project_root': function('ale_linters#go#gopls#FindProjectRoot'),
|
||||
\})
|
||||
@@ -2,7 +2,8 @@
|
||||
" Description: gosimple for Go files
|
||||
|
||||
function! ale_linters#go#gosimple#GetCommand(buffer) abort
|
||||
return ale#path#BufferCdString(a:buffer) . ' gosimple .'
|
||||
return ale#path#BufferCdString(a:buffer) . ' '
|
||||
\ . ale#go#EnvString(a:buffer) . 'gosimple .'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('go', {
|
||||
|
||||
@@ -6,7 +6,8 @@ function! ale_linters#go#gotype#GetCommand(buffer) abort
|
||||
return ''
|
||||
endif
|
||||
|
||||
return ale#path#BufferCdString(a:buffer) . ' gotype -e .'
|
||||
return ale#path#BufferCdString(a:buffer) . ' '
|
||||
\ . ale#go#EnvString(a:buffer) . 'gotype -e .'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('go', {
|
||||
|
||||
@@ -11,6 +11,7 @@ function! ale_linters#go#govet#GetCommand(buffer) abort
|
||||
let l:options = ale#Var(a:buffer, 'go_govet_options')
|
||||
|
||||
return ale#path#BufferCdString(a:buffer) . ' '
|
||||
\ . ale#go#EnvString(a:buffer)
|
||||
\ . ale#Var(a:buffer, 'go_go_executable') . ' vet '
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
\ . ' .'
|
||||
|
||||
@@ -15,8 +15,9 @@ function! ale_linters#go#langserver#GetCommand(buffer) abort
|
||||
endif
|
||||
|
||||
let l:options = uniq(sort(l:options))
|
||||
let l:env = ale#go#EnvString(a:buffer)
|
||||
|
||||
return join(extend(l:executable, l:options), ' ')
|
||||
return l:env . join(extend(l:executable, l:options), ' ')
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('go', {
|
||||
|
||||
21
ale_linters/go/revive.vim
Normal file
21
ale_linters/go/revive.vim
Normal file
@@ -0,0 +1,21 @@
|
||||
" Author: Penghui Liao <liaoishere@gmail.com>
|
||||
" Description: Adds support for revive
|
||||
|
||||
call ale#Set('go_revive_executable', 'revive')
|
||||
call ale#Set('go_revive_options', '')
|
||||
|
||||
function! ale_linters#go#revive#GetCommand(buffer) abort
|
||||
let l:options = ale#Var(a:buffer, 'go_revive_options')
|
||||
|
||||
return ale#go#EnvString(a:buffer) . '%e'
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
\ . ' %t'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('go', {
|
||||
\ 'name': 'revive',
|
||||
\ 'output_stream': 'both',
|
||||
\ 'executable': {b -> ale#Var(b, 'go_revive_executable')},
|
||||
\ 'command': function('ale_linters#go#revive#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
||||
\})
|
||||
@@ -8,17 +8,18 @@ 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')
|
||||
let l:env = ale#go#EnvString(a:buffer)
|
||||
|
||||
" 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'
|
||||
\ . l:env . 'staticcheck'
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '') . ' .'
|
||||
endif
|
||||
|
||||
return ale#path#BufferCdString(a:buffer)
|
||||
\ . 'staticcheck'
|
||||
\ . l:env . 'staticcheck'
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
\ . ' ' . ale#Escape(l:filename)
|
||||
endfunction
|
||||
|
||||
@@ -5,5 +5,5 @@ call ale#linter#Define('graphql', {
|
||||
\ 'name': 'eslint',
|
||||
\ 'executable': function('ale#handlers#eslint#GetExecutable'),
|
||||
\ 'command': function('ale#handlers#eslint#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#eslint#Handle',
|
||||
\ 'callback': 'ale#handlers#eslint#HandleJSON',
|
||||
\})
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
call ale#Set('haskell_cabal_ghc_options', '-fno-code -v0')
|
||||
|
||||
function! ale_linters#haskell#cabal_ghc#GetCommand(buffer) abort
|
||||
return 'cabal exec -- ghc '
|
||||
return ale#path#BufferCdString(a:buffer)
|
||||
\ . 'cabal exec -- ghc '
|
||||
\ . ale#Var(a:buffer, 'haskell_cabal_ghc_options')
|
||||
\ . ' %t'
|
||||
endfunction
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
call ale#Set('haskell_stack_ghc_options', '-fno-code -v0')
|
||||
|
||||
function! ale_linters#haskell#stack_ghc#GetCommand(buffer) abort
|
||||
return ale#handlers#haskell#GetStackExecutable(a:buffer)
|
||||
return ale#path#BufferCdString(a:buffer)
|
||||
\ . ale#handlers#haskell#GetStackExecutable(a:buffer)
|
||||
\ . ' ghc -- '
|
||||
\ . ale#Var(a:buffer, 'haskell_stack_ghc_options')
|
||||
\ . ' %t'
|
||||
|
||||
9
ale_linters/html/fecs.vim
Normal file
9
ale_linters/html/fecs.vim
Normal file
@@ -0,0 +1,9 @@
|
||||
" Author: harttle <yangjvn@126.com>
|
||||
" Description: fecs for HTMl files
|
||||
|
||||
call ale#linter#Define('html', {
|
||||
\ 'name': 'fecs',
|
||||
\ 'executable': function('ale#handlers#fecs#GetExecutable'),
|
||||
\ 'command': function('ale#handlers#fecs#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#fecs#Handle',
|
||||
\})
|
||||
35
ale_linters/ink/ls.vim
Normal file
35
ale_linters/ink/ls.vim
Normal file
@@ -0,0 +1,35 @@
|
||||
" Author: Andreww Hayworth <ahayworth@gmail.com>
|
||||
" Description: Integrate ALE with ink-language-server
|
||||
|
||||
call ale#Set('ink_ls_executable', 'ink-language-server')
|
||||
call ale#Set('ink_ls_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
call ale#Set('ink_ls_initialization_options', {})
|
||||
|
||||
function! ale_linters#ink#ls#GetExecutable(buffer) abort
|
||||
return ale#node#FindExecutable(a:buffer, 'ink_ls', [
|
||||
\ 'ink-language-server',
|
||||
\ 'node_modules/.bin/ink-language-server',
|
||||
\])
|
||||
endfunction
|
||||
|
||||
function! ale_linters#ink#ls#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#ink#ls#GetExecutable(a:buffer)
|
||||
|
||||
return ale#Escape(l:executable) . ' --stdio'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#ink#ls#FindProjectRoot(buffer) abort
|
||||
let l:main_file = get(ale#Var(a:buffer, 'ink_ls_initialization_options'), 'mainStoryPath', 'main.ink')
|
||||
let l:config = ale#path#ResolveLocalPath(a:buffer, l:main_file, expand('#' . a:buffer . ':p'))
|
||||
|
||||
return ale#path#Dirname(l:config)
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('ink', {
|
||||
\ 'name': 'ink-language-server',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': function('ale_linters#ink#ls#GetExecutable'),
|
||||
\ 'command': function('ale_linters#ink#ls#GetCommand'),
|
||||
\ 'project_root': function('ale_linters#ink#ls#FindProjectRoot'),
|
||||
\ 'initialization_options': {b -> ale#Var(b, 'ink_ls_initialization_options')},
|
||||
\})
|
||||
@@ -1,6 +1,10 @@
|
||||
" Author: Devon Meunier <devon.meunier@gmail.com>
|
||||
" Description: checkstyle for Java files
|
||||
|
||||
call ale#Set('java_checkstyle_executable', 'checkstyle')
|
||||
call ale#Set('java_checkstyle_config', '/google_checks.xml')
|
||||
call ale#Set('java_checkstyle_options', '')
|
||||
|
||||
function! ale_linters#java#checkstyle#Handle(buffer, lines) abort
|
||||
let l:output = []
|
||||
|
||||
@@ -17,6 +21,10 @@ function! ale_linters#java#checkstyle#Handle(buffer, lines) abort
|
||||
\})
|
||||
endfor
|
||||
|
||||
if !empty(l:output)
|
||||
return l:output
|
||||
endif
|
||||
|
||||
" old checkstyle versions
|
||||
let l:pattern = '\v(.+):(\d+): ([^:]+): (.+)$'
|
||||
|
||||
@@ -31,19 +39,32 @@ function! ale_linters#java#checkstyle#Handle(buffer, lines) abort
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
function! s:GetConfig(buffer, config) abort
|
||||
if ale#path#IsAbsolute(a:config)
|
||||
return a:config
|
||||
endif
|
||||
|
||||
let s:file = ale#path#FindNearestFile(a:buffer, a:config)
|
||||
|
||||
return !empty(s:file) ? s:file : a:config
|
||||
endfunction
|
||||
|
||||
function! ale_linters#java#checkstyle#GetCommand(buffer) abort
|
||||
return 'checkstyle '
|
||||
\ . ale#Var(a:buffer, 'java_checkstyle_options')
|
||||
let l:options = ale#Var(a:buffer, 'java_checkstyle_options')
|
||||
let l:config_option = ale#Var(a:buffer, 'java_checkstyle_config')
|
||||
let l:config = l:options !~# '\v(^| )-c' && !empty(l:config_option)
|
||||
\ ? s:GetConfig(a:buffer, l:config_option)
|
||||
\ : ''
|
||||
|
||||
return '%e'
|
||||
\ . ale#Pad(l:options)
|
||||
\ . (!empty(l:config) ? ' -c ' . ale#Escape(l:config) : '')
|
||||
\ . ' %s'
|
||||
endfunction
|
||||
|
||||
if !exists('g:ale_java_checkstyle_options')
|
||||
let g:ale_java_checkstyle_options = '-c /google_checks.xml'
|
||||
endif
|
||||
|
||||
call ale#linter#Define('java', {
|
||||
\ 'name': 'checkstyle',
|
||||
\ 'executable': 'checkstyle',
|
||||
\ 'executable': {b -> ale#Var(b, 'java_checkstyle_executable')},
|
||||
\ 'command': function('ale_linters#java#checkstyle#GetCommand'),
|
||||
\ 'callback': 'ale_linters#java#checkstyle#Handle',
|
||||
\ 'lint_file': 1,
|
||||
|
||||
180
ale_linters/java/eclipselsp.vim
Normal file
180
ale_linters/java/eclipselsp.vim
Normal file
@@ -0,0 +1,180 @@
|
||||
" Author: Horacio Sanson <https://github.com/hsanson>
|
||||
" Description: Support for the Eclipse language server https://github.com/eclipse/eclipse.jdt.ls
|
||||
|
||||
let s:version_cache = {}
|
||||
|
||||
call ale#Set('java_eclipselsp_path', ale#path#Simplify($HOME . '/eclipse.jdt.ls'))
|
||||
call ale#Set('java_eclipselsp_config_path', '')
|
||||
call ale#Set('java_eclipselsp_workspace_path', '')
|
||||
call ale#Set('java_eclipselsp_executable', 'java')
|
||||
call ale#Set('java_eclipselsp_javaagent', '')
|
||||
|
||||
function! ale_linters#java#eclipselsp#Executable(buffer) abort
|
||||
return ale#Var(a:buffer, 'java_eclipselsp_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#java#eclipselsp#TargetPath(buffer) abort
|
||||
return ale#Var(a:buffer, 'java_eclipselsp_path')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#java#eclipselsp#JarPath(buffer) abort
|
||||
let l:path = ale_linters#java#eclipselsp#TargetPath(a:buffer)
|
||||
|
||||
" Search jar file within repository path when manually built using mvn
|
||||
let l:repo_path = l:path . '/org.eclipse.jdt.ls.product/target/repository'
|
||||
let l:files = globpath(l:repo_path, '**/plugins/org.eclipse.equinox.launcher_\d\.\d\.\d\d\d\.*\.jar', 1, 1)
|
||||
|
||||
if len(l:files) == 1
|
||||
return l:files[0]
|
||||
endif
|
||||
|
||||
" Search jar file within VSCode extensions folder.
|
||||
let l:files = globpath(l:path, '**/plugins/org.eclipse.equinox.launcher_\d\.\d\.\d\d\d\.*\.jar', 1, 1)
|
||||
|
||||
if len(l:files) == 1
|
||||
return l:files[0]
|
||||
endif
|
||||
|
||||
" Search jar file within system package path
|
||||
let l:files = globpath('/usr/share/java/jdtls/plugins', 'org.eclipse.equinox.launcher_\d\.\d\.\d\d\d\.*\.jar', 1, 1)
|
||||
|
||||
if len(l:files) == 1
|
||||
return l:files[0]
|
||||
endif
|
||||
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
function! ale_linters#java#eclipselsp#ConfigurationPath(buffer) abort
|
||||
let l:path = fnamemodify(ale_linters#java#eclipselsp#JarPath(a:buffer), ':p:h:h')
|
||||
let l:config_path = ale#Var(a:buffer, 'java_eclipselsp_config_path')
|
||||
|
||||
if !empty(l:config_path)
|
||||
return ale#path#Simplify(l:config_path)
|
||||
endif
|
||||
|
||||
if has('win32')
|
||||
let l:path = l:path . '/config_win'
|
||||
elseif has('macunix')
|
||||
let l:path = l:path . '/config_mac'
|
||||
else
|
||||
let l:path = l:path . '/config_linux'
|
||||
endif
|
||||
|
||||
return ale#path#Simplify(l:path)
|
||||
endfunction
|
||||
|
||||
function! ale_linters#java#eclipselsp#VersionCheck(version_lines) abort
|
||||
return s:GetVersion('', a:version_lines)
|
||||
endfunction
|
||||
|
||||
function! s:GetVersion(executable, version_lines) abort
|
||||
let l:version = []
|
||||
|
||||
for l:line in a:version_lines
|
||||
let l:match = matchlist(l:line, '\(\d\+\)\.\(\d\+\)\.\(\d\+\)')
|
||||
|
||||
if !empty(l:match)
|
||||
let l:version = [l:match[1] + 0, l:match[2] + 0, l:match[3] + 0]
|
||||
let s:version_cache[a:executable] = l:version
|
||||
break
|
||||
endif
|
||||
endfor
|
||||
|
||||
return l:version
|
||||
endfunction
|
||||
|
||||
function! ale_linters#java#eclipselsp#CommandWithVersion(buffer, version_lines, meta) abort
|
||||
let l:executable = ale_linters#java#eclipselsp#Executable(a:buffer)
|
||||
let l:version = s:GetVersion(l:executable, a:version_lines)
|
||||
|
||||
return ale_linters#java#eclipselsp#Command(a:buffer, l:version)
|
||||
endfunction
|
||||
|
||||
function! ale_linters#java#eclipselsp#WorkspacePath(buffer) abort
|
||||
let l:wspath = ale#Var(a:buffer, 'java_eclipselsp_workspace_path')
|
||||
|
||||
if !empty(l:wspath)
|
||||
return l:wspath
|
||||
endif
|
||||
|
||||
return ale#path#Dirname(ale#java#FindProjectRoot(a:buffer))
|
||||
endfunction
|
||||
|
||||
function! ale_linters#java#eclipselsp#Javaagent(buffer) abort
|
||||
let l:rets = []
|
||||
let l:raw = ale#Var(a:buffer, 'java_eclipselsp_javaagent')
|
||||
|
||||
if empty(l:raw)
|
||||
return ''
|
||||
endif
|
||||
|
||||
let l:jars = split(l:raw)
|
||||
|
||||
for l:jar in l:jars
|
||||
call add(l:rets, ale#Escape('-javaagent:' . l:jar))
|
||||
endfor
|
||||
|
||||
return join(l:rets, ' ')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#java#eclipselsp#Command(buffer, version) abort
|
||||
let l:path = ale#Var(a:buffer, 'java_eclipselsp_path')
|
||||
|
||||
let l:executable = ale_linters#java#eclipselsp#Executable(a:buffer)
|
||||
|
||||
let l:cmd = [ ale#Escape(l:executable),
|
||||
\ ale_linters#java#eclipselsp#Javaagent(a:buffer),
|
||||
\ '-Declipse.application=org.eclipse.jdt.ls.core.id1',
|
||||
\ '-Dosgi.bundles.defaultStartLevel=4',
|
||||
\ '-Declipse.product=org.eclipse.jdt.ls.core.product',
|
||||
\ '-Dlog.level=ALL',
|
||||
\ '-noverify',
|
||||
\ '-Xmx1G',
|
||||
\ '-jar',
|
||||
\ ale#Escape(ale_linters#java#eclipselsp#JarPath(a:buffer)),
|
||||
\ '-configuration',
|
||||
\ ale#Escape(ale_linters#java#eclipselsp#ConfigurationPath(a:buffer)),
|
||||
\ '-data',
|
||||
\ ale#Escape(ale_linters#java#eclipselsp#WorkspacePath(a:buffer))
|
||||
\ ]
|
||||
|
||||
if ale#semver#GTE(a:version, [1, 9])
|
||||
call add(l:cmd, '--add-modules=ALL-SYSTEM')
|
||||
call add(l:cmd, '--add-opens java.base/java.util=ALL-UNNAMED')
|
||||
call add(l:cmd, '--add-opens java.base/java.lang=ALL-UNNAMED')
|
||||
endif
|
||||
|
||||
return join(l:cmd, ' ')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#java#eclipselsp#RunWithVersionCheck(buffer) abort
|
||||
let l:executable = ale_linters#java#eclipselsp#Executable(a:buffer)
|
||||
|
||||
if empty(l:executable)
|
||||
return ''
|
||||
endif
|
||||
|
||||
let l:cache = s:version_cache
|
||||
|
||||
if has_key(s:version_cache, l:executable)
|
||||
return ale_linters#java#eclipselsp#Command(a:buffer, s:version_cache[l:executable])
|
||||
endif
|
||||
|
||||
let l:command = ale#Escape(l:executable) . ' -version'
|
||||
|
||||
return ale#command#Run(
|
||||
\ a:buffer,
|
||||
\ l:command,
|
||||
\ function('ale_linters#java#eclipselsp#CommandWithVersion')
|
||||
\)
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('java', {
|
||||
\ 'name': 'eclipselsp',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': function('ale_linters#java#eclipselsp#Executable'),
|
||||
\ 'command': function('ale_linters#java#eclipselsp#RunWithVersionCheck'),
|
||||
\ 'language': 'java',
|
||||
\ 'project_root': function('ale#java#FindProjectRoot'),
|
||||
\})
|
||||
@@ -6,6 +6,7 @@ let s:classpath_sep = has('unix') ? ':' : ';'
|
||||
call ale#Set('java_javac_executable', 'javac')
|
||||
call ale#Set('java_javac_options', '')
|
||||
call ale#Set('java_javac_classpath', '')
|
||||
call ale#Set('java_javac_sourcepath', '')
|
||||
|
||||
function! ale_linters#java#javac#RunWithImportPaths(buffer) abort
|
||||
let l:command = ''
|
||||
@@ -21,6 +22,11 @@ function! ale_linters#java#javac#RunWithImportPaths(buffer) abort
|
||||
let l:command = ale#gradle#BuildClasspathCommand(a:buffer)
|
||||
endif
|
||||
|
||||
" Try to use Ant if Gradle and Maven aren't available
|
||||
if empty(l:command)
|
||||
let l:command = ale#ant#BuildClasspathCommand(a:buffer)
|
||||
endif
|
||||
|
||||
if empty(l:command)
|
||||
return ale_linters#java#javac#GetCommand(a:buffer, [], {})
|
||||
endif
|
||||
@@ -35,10 +41,15 @@ endfunction
|
||||
function! s:BuildClassPathOption(buffer, import_paths) abort
|
||||
" Filter out lines like [INFO], etc.
|
||||
let l:class_paths = filter(a:import_paths[:], 'v:val !~# ''[''')
|
||||
call extend(
|
||||
\ l:class_paths,
|
||||
\ split(ale#Var(a:buffer, 'java_javac_classpath'), s:classpath_sep),
|
||||
\)
|
||||
let l:cls_path = ale#Var(a:buffer, 'java_javac_classpath')
|
||||
|
||||
if !empty(l:cls_path) && type(l:cls_path) is v:t_string
|
||||
call extend(l:class_paths, split(l:cls_path, s:classpath_sep))
|
||||
endif
|
||||
|
||||
if !empty(l:cls_path) && type(l:cls_path) is v:t_list
|
||||
call extend(l:class_paths, l:cls_path)
|
||||
endif
|
||||
|
||||
return !empty(l:class_paths)
|
||||
\ ? '-cp ' . ale#Escape(join(l:class_paths, s:classpath_sep))
|
||||
@@ -74,6 +85,27 @@ function! ale_linters#java#javac#GetCommand(buffer, import_paths, meta) abort
|
||||
endif
|
||||
endif
|
||||
|
||||
let l:source_paths = []
|
||||
let l:source_path = ale#Var(a:buffer, 'java_javac_sourcepath')
|
||||
|
||||
if !empty(l:source_path) && type(l:source_path) is v:t_string
|
||||
let l:source_paths = split(l:source_path, s:classpath_sep)
|
||||
endif
|
||||
|
||||
if !empty(l:source_path) && type(l:source_path) is v:t_list
|
||||
let l:source_paths = l:source_path
|
||||
endif
|
||||
|
||||
if !empty(l:source_paths)
|
||||
for l:path in l:source_paths
|
||||
let l:sp_path = ale#path#FindNearestDirectory(a:buffer, l:path)
|
||||
|
||||
if !empty(l:sp_path)
|
||||
call add(l:sp_dirs, l:sp_path)
|
||||
endif
|
||||
endfor
|
||||
endif
|
||||
|
||||
if !empty(l:sp_dirs)
|
||||
let l:sp_option = '-sourcepath '
|
||||
\ . ale#Escape(join(l:sp_dirs, s:classpath_sep))
|
||||
|
||||
@@ -1,16 +1,47 @@
|
||||
" Author: Horacio Sanson <https://github.com/hsanson>
|
||||
" Description: Support for the Java language server https://github.com/georgewfraser/vscode-javac
|
||||
|
||||
call ale#Set('java_javalsp_executable', 'java')
|
||||
call ale#Set('java_javalsp_executable', '')
|
||||
call ale#Set('java_javalsp_config', {})
|
||||
|
||||
function! ale_linters#java#javalsp#Executable(buffer) abort
|
||||
return ale#Var(a:buffer, 'java_javalsp_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#java#javalsp#Config(buffer) abort
|
||||
let l:defaults = { 'java': { 'classPath': [], 'externalDependencies': [] } }
|
||||
let l:config = ale#Var(a:buffer, 'java_javalsp_config')
|
||||
|
||||
" Ensure the config dictionary contains both classPath and
|
||||
" externalDependencies keys to avoid a NPE crash on Java Language Server.
|
||||
call extend(l:config, l:defaults, 'keep')
|
||||
call extend(l:config['java'], l:defaults['java'], 'keep')
|
||||
|
||||
return l:config
|
||||
endfunction
|
||||
|
||||
function! ale_linters#java#javalsp#Command(buffer) abort
|
||||
let l:executable = ale_linters#java#javalsp#Executable(a:buffer)
|
||||
|
||||
return ale#Escape(l:executable) . ' -Xverify:none -m javacs/org.javacs.Main'
|
||||
if fnamemodify(l:executable, ':t') is# 'java'
|
||||
" For backward compatibility.
|
||||
let l:cmd = [
|
||||
\ ale#Escape(l:executable),
|
||||
\ '--add-exports jdk.compiler/com.sun.tools.javac.api=javacs',
|
||||
\ '--add-exports jdk.compiler/com.sun.tools.javac.code=javacs',
|
||||
\ '--add-exports jdk.compiler/com.sun.tools.javac.comp=javacs',
|
||||
\ '--add-exports jdk.compiler/com.sun.tools.javac.main=javacs',
|
||||
\ '--add-exports jdk.compiler/com.sun.tools.javac.tree=javacs',
|
||||
\ '--add-exports jdk.compiler/com.sun.tools.javac.model=javacs',
|
||||
\ '--add-exports jdk.compiler/com.sun.tools.javac.util=javacs',
|
||||
\ '--add-opens jdk.compiler/com.sun.tools.javac.api=javacs',
|
||||
\ '-m javacs/org.javacs.Main',
|
||||
\]
|
||||
|
||||
return join(l:cmd, ' ')
|
||||
else
|
||||
return ale#Escape(l:executable)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('java', {
|
||||
@@ -20,4 +51,5 @@ call ale#linter#Define('java', {
|
||||
\ 'command': function('ale_linters#java#javalsp#Command'),
|
||||
\ 'language': 'java',
|
||||
\ 'project_root': function('ale#java#FindProjectRoot'),
|
||||
\ 'lsp_config': function('ale_linters#java#javalsp#Config')
|
||||
\})
|
||||
|
||||
@@ -6,5 +6,5 @@ call ale#linter#Define('javascript', {
|
||||
\ 'output_stream': 'both',
|
||||
\ 'executable': function('ale#handlers#eslint#GetExecutable'),
|
||||
\ 'command': function('ale#handlers#eslint#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#eslint#Handle',
|
||||
\ 'callback': 'ale#handlers#eslint#HandleJSON',
|
||||
\})
|
||||
|
||||
10
ale_linters/javascript/fecs.vim
Normal file
10
ale_linters/javascript/fecs.vim
Normal file
@@ -0,0 +1,10 @@
|
||||
" Author: harttle <yangjvn@126.com>
|
||||
" Description: fecs for JavaScript files
|
||||
|
||||
call ale#linter#Define('javascript', {
|
||||
\ 'name': 'fecs',
|
||||
\ 'executable': function('ale#handlers#fecs#GetExecutable'),
|
||||
\ 'command': function('ale#handlers#fecs#GetCommand'),
|
||||
\ 'read_buffer': 0,
|
||||
\ 'callback': 'ale#handlers#fecs#Handle',
|
||||
\})
|
||||
0
ale_linters/javascript/flow.vim
Executable file → Normal file
0
ale_linters/javascript/flow.vim
Executable file → Normal file
@@ -7,7 +7,9 @@ call ale#Set('javascript_standard_options', '')
|
||||
|
||||
function! ale_linters#javascript#standard#GetExecutable(buffer) abort
|
||||
return ale#node#FindExecutable(a:buffer, 'javascript_standard', [
|
||||
\ 'node_modules/standardx/bin/cmd.js',
|
||||
\ 'node_modules/standard/bin/cmd.js',
|
||||
\ 'node_modules/semistandard/bin/cmd.js',
|
||||
\ 'node_modules/.bin/standard',
|
||||
\])
|
||||
endfunction
|
||||
|
||||
@@ -14,7 +14,7 @@ endfunction
|
||||
function! ale_linters#javascript#xo#GetCommand(buffer) abort
|
||||
return ale#Escape(ale_linters#javascript#xo#GetExecutable(a:buffer))
|
||||
\ . ' ' . ale#Var(a:buffer, 'javascript_xo_options')
|
||||
\ . ' --reporter unix --stdin --stdin-filename %s'
|
||||
\ . ' --reporter json --stdin --stdin-filename %s'
|
||||
endfunction
|
||||
|
||||
" xo uses eslint and the output format is the same
|
||||
@@ -22,5 +22,5 @@ call ale#linter#Define('javascript', {
|
||||
\ 'name': 'xo',
|
||||
\ 'executable': function('ale_linters#javascript#xo#GetExecutable'),
|
||||
\ 'command': function('ale_linters#javascript#xo#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#eslint#Handle',
|
||||
\ 'callback': 'ale#handlers#eslint#HandleJSON',
|
||||
\})
|
||||
|
||||
@@ -174,6 +174,7 @@ endfunction
|
||||
call ale#linter#Define('kotlin', {
|
||||
\ 'name': 'kotlinc',
|
||||
\ 'executable': 'kotlinc',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'command': function('ale_linters#kotlin#kotlinc#RunWithImportPaths'),
|
||||
\ 'callback': 'ale_linters#kotlin#kotlinc#Handle',
|
||||
\ 'lint_file': 1,
|
||||
|
||||
0
ale_linters/less/lessc.vim
Executable file → Normal file
0
ale_linters/less/lessc.vim
Executable file → Normal file
@@ -17,18 +17,17 @@ function! ale_linters#markdown#mdl#GetCommand(buffer) abort
|
||||
let l:options = ale#Var(a:buffer, 'markdown_mdl_options')
|
||||
|
||||
return ale#Escape(l:executable) . l:exec_args
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
\ . ' -j' . (!empty(l:options) ? ' ' . l:options : '')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#markdown#mdl#Handle(buffer, lines) abort
|
||||
" matches: '(stdin):173: MD004 Unordered list style'
|
||||
let l:pattern = ':\(\d*\): \(.*\)$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
for l:error in ale#util#FuzzyJSONDecode(a:lines, [])
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[1] + 0,
|
||||
\ 'text': l:match[2],
|
||||
\ 'lnum': l:error['line'],
|
||||
\ 'code': l:error['rule'] . '/' . join(l:error['aliases'], '/'),
|
||||
\ 'text': l:error['description'],
|
||||
\ 'type': 'W',
|
||||
\})
|
||||
endfor
|
||||
|
||||
@@ -1,6 +1,15 @@
|
||||
" Author: Baabelfish
|
||||
" Description: Typechecking for nim files
|
||||
|
||||
let s:end_col_patterns = [
|
||||
\ '\v''([^'']+)'' is declared but not used.*',
|
||||
\ '\videntifier expected, but found ''([^'']+)''',
|
||||
\ '\vimported and not used: ''([^'']+)''.*',
|
||||
\ '\vundeclared identifier: ''([^'']+)''',
|
||||
\ '\v''([^'']+)'' cannot be assigned to',
|
||||
\ '\vredefinition of ''([^'']+)'';',
|
||||
\]
|
||||
|
||||
function! ale_linters#nim#nimcheck#Handle(buffer, lines) abort
|
||||
let l:buffer_filename = fnamemodify(bufname(a:buffer), ':p:t')
|
||||
let l:pattern = '^\(.\+\.nim\)(\(\d\+\), \(\d\+\)) \(.\+\)'
|
||||
@@ -43,6 +52,11 @@ function! ale_linters#nim#nimcheck#Handle(buffer, lines) abort
|
||||
let l:item.code = l:code_match[2]
|
||||
endif
|
||||
|
||||
" Find position end_col.
|
||||
for l:col_match in ale#util#GetMatches(l:item.text, s:end_col_patterns)
|
||||
let l:item.end_col = l:item.col + len(l:col_match[1]) - 1
|
||||
endfor
|
||||
|
||||
call add(l:output, l:item)
|
||||
endfor
|
||||
|
||||
|
||||
33
ale_linters/nim/nimlsp.vim
Normal file
33
ale_linters/nim/nimlsp.vim
Normal file
@@ -0,0 +1,33 @@
|
||||
" Author: jeremija <https://github.com/jeremija>
|
||||
" Description: Support for nimlsp (language server for nim)
|
||||
|
||||
call ale#Set('nim_nimlsp_nim_sources', '')
|
||||
|
||||
function! ale_linters#nim#nimlsp#GetProjectRoot(buffer) abort
|
||||
let l:project_root = ale#path#FindNearestDirectory(a:buffer, '.git')
|
||||
|
||||
if !empty(l:project_root)
|
||||
return fnamemodify(l:project_root, ':h:h')
|
||||
endif
|
||||
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
function! ale_linters#nim#nimlsp#GetCommand(buffer) abort
|
||||
let l:nim_sources = ale#Var(a:buffer, 'nim_nimlsp_nim_sources')
|
||||
|
||||
if !empty(l:nim_sources)
|
||||
let l:nim_sources = ale#Escape(l:nim_sources)
|
||||
endif
|
||||
|
||||
return '%e' . ale#Pad(l:nim_sources)
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('nim', {
|
||||
\ 'name': 'nimlsp',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': 'nimlsp',
|
||||
\ 'command': function('ale_linters#nim#nimlsp#GetCommand'),
|
||||
\ 'language': 'nim',
|
||||
\ 'project_root': function('ale_linters#nim#nimlsp#GetProjectRoot'),
|
||||
\})
|
||||
@@ -4,12 +4,6 @@
|
||||
call ale#Set('objc_clangd_executable', 'clangd')
|
||||
call ale#Set('objc_clangd_options', '')
|
||||
|
||||
function! ale_linters#objc#clangd#GetProjectRoot(buffer) abort
|
||||
let l:project_root = ale#path#FindNearestFile(a:buffer, 'compile_commands.json')
|
||||
|
||||
return !empty(l:project_root) ? fnamemodify(l:project_root, ':h') : ''
|
||||
endfunction
|
||||
|
||||
function! ale_linters#objc#clangd#GetCommand(buffer) abort
|
||||
return '%e' . ale#Pad(ale#Var(a:buffer, 'objc_clangd_options'))
|
||||
endfunction
|
||||
@@ -19,5 +13,5 @@ call ale#linter#Define('objc', {
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': {b -> ale#Var(b, 'objc_clangd_executable')},
|
||||
\ 'command': function('ale_linters#objc#clangd#GetCommand'),
|
||||
\ 'project_root': function('ale_linters#objc#clangd#GetProjectRoot'),
|
||||
\ 'project_root': function('ale#c#FindProjectRoot'),
|
||||
\})
|
||||
|
||||
@@ -4,12 +4,6 @@
|
||||
call ale#Set('objcpp_clangd_executable', 'clangd')
|
||||
call ale#Set('objcpp_clangd_options', '')
|
||||
|
||||
function! ale_linters#objcpp#clangd#GetProjectRoot(buffer) abort
|
||||
let l:project_root = ale#path#FindNearestFile(a:buffer, 'compile_commands.json')
|
||||
|
||||
return !empty(l:project_root) ? fnamemodify(l:project_root, ':h') : ''
|
||||
endfunction
|
||||
|
||||
function! ale_linters#objcpp#clangd#GetCommand(buffer) abort
|
||||
return '%e' . ale#Pad(ale#Var(a:buffer, 'objcpp_clangd_options'))
|
||||
endfunction
|
||||
@@ -19,5 +13,5 @@ call ale#linter#Define('objcpp', {
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': {b -> ale#Var(b, 'objcpp_clangd_executable')},
|
||||
\ 'command': function('ale_linters#objcpp#clangd#GetCommand'),
|
||||
\ 'project_root': function('ale_linters#objcpp#clangd#GetProjectRoot'),
|
||||
\ 'project_root': function('ale#c#FindProjectRoot'),
|
||||
\})
|
||||
|
||||
@@ -10,13 +10,13 @@ call ale#Set('php_phpcs_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
function! ale_linters#php#phpcs#GetCommand(buffer) abort
|
||||
let l:standard = ale#Var(a:buffer, 'php_phpcs_standard')
|
||||
let l:standard_option = !empty(l:standard)
|
||||
\ ? '--standard=' . l:standard
|
||||
\ ? '--standard=' . ale#Escape(l:standard)
|
||||
\ : ''
|
||||
let l:options = ale#Var(a:buffer, 'php_phpcs_options')
|
||||
|
||||
return '%e -s --report=emacs --stdin-path=%s'
|
||||
\ . ale#Pad(l:standard_option)
|
||||
\ . ale#Pad(l:options)
|
||||
return ale#path#BufferCdString(a:buffer)
|
||||
\ . '%e -s --report=emacs --stdin-path=%s'
|
||||
\ . ale#Pad(l:standard_option)
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'php_phpcs_options'))
|
||||
endfunction
|
||||
|
||||
function! ale_linters#php#phpcs#Handle(buffer, lines) abort
|
||||
@@ -36,6 +36,7 @@ function! ale_linters#php#phpcs#Handle(buffer, lines) abort
|
||||
\ 'col': l:match[2] + 0,
|
||||
\ 'text': l:text,
|
||||
\ 'type': l:type is# 'error' ? 'E' : 'W',
|
||||
\ 'sub_type': 'style',
|
||||
\})
|
||||
endfor
|
||||
|
||||
|
||||
@@ -3,23 +3,42 @@
|
||||
|
||||
" Set to change the ruleset
|
||||
let g:ale_php_phpstan_executable = get(g:, 'ale_php_phpstan_executable', 'phpstan')
|
||||
let g:ale_php_phpstan_level = get(g:, 'ale_php_phpstan_level', '4')
|
||||
let g:ale_php_phpstan_level = get(g:, 'ale_php_phpstan_level', '')
|
||||
let g:ale_php_phpstan_configuration = get(g:, 'ale_php_phpstan_configuration', '')
|
||||
let g:ale_php_phpstan_autoload = get(g:, 'ale_php_phpstan_autoload', '')
|
||||
|
||||
function! ale_linters#php#phpstan#GetCommand(buffer, version) abort
|
||||
let l:configuration = ale#Var(a:buffer, 'php_phpstan_configuration')
|
||||
let l:configuration_option = !empty(l:configuration)
|
||||
\ ? ' -c ' . l:configuration
|
||||
\ ? ' -c ' . ale#Escape(l:configuration)
|
||||
\ : ''
|
||||
|
||||
let l:autoload = ale#Var(a:buffer, 'php_phpstan_autoload')
|
||||
let l:autoload_option = !empty(l:autoload)
|
||||
\ ? ' -a ' . ale#Escape(l:autoload)
|
||||
\ : ''
|
||||
|
||||
let l:level = ale#Var(a:buffer, 'php_phpstan_level')
|
||||
let l:config_file_exists = ale#path#FindNearestFile(a:buffer, 'phpstan.neon')
|
||||
|
||||
if empty(l:level) && empty(l:config_file_exists)
|
||||
" if no configuration file is found, then use 4 as a default level
|
||||
let l:level = '4'
|
||||
endif
|
||||
|
||||
let l:level_option = !empty(l:level)
|
||||
\ ? ' -l ' . ale#Escape(l:level)
|
||||
\ : ''
|
||||
|
||||
let l:error_format = ale#semver#GTE(a:version, [0, 10, 3])
|
||||
\ ? ' --error-format raw'
|
||||
\ : ' --errorFormat raw'
|
||||
|
||||
return '%e analyze -l'
|
||||
\ . ale#Var(a:buffer, 'php_phpstan_level')
|
||||
return '%e analyze --no-progress'
|
||||
\ . l:error_format
|
||||
\ . l:configuration_option
|
||||
\ . l:autoload_option
|
||||
\ . l:level_option
|
||||
\ . ' %s'
|
||||
endfunction
|
||||
|
||||
@@ -35,7 +54,7 @@ function! ale_linters#php#phpstan#Handle(buffer, lines) abort
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[2] + 0,
|
||||
\ 'text': l:match[3],
|
||||
\ 'type': 'W',
|
||||
\ 'type': 'E',
|
||||
\})
|
||||
endfor
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
" Author: Matt Brown <https://github.com/muglug>
|
||||
" Description: plugin for Psalm, static analyzer for PHP
|
||||
|
||||
call ale#Set('psalm_langserver_executable', 'psalm-language-server')
|
||||
call ale#Set('psalm_langserver_executable', 'psalm')
|
||||
call ale#Set('psalm_langserver_options', '')
|
||||
call ale#Set('psalm_langserver_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
|
||||
function! ale_linters#php#psalm#GetProjectRoot(buffer) abort
|
||||
@@ -10,12 +11,16 @@ function! ale_linters#php#psalm#GetProjectRoot(buffer) abort
|
||||
return !empty(l:git_path) ? fnamemodify(l:git_path, ':h:h') : ''
|
||||
endfunction
|
||||
|
||||
function! ale_linters#php#psalm#GetCommand(buffer) abort
|
||||
return '%e --language-server' . ale#Pad(ale#Var(a:buffer, 'psalm_langserver_options'))
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('php', {
|
||||
\ 'name': 'psalm',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': {b -> ale#node#FindExecutable(b, 'psalm_langserver', [
|
||||
\ 'vendor/bin/psalm-language-server',
|
||||
\ 'vendor/bin/psalm',
|
||||
\ ])},
|
||||
\ 'command': '%e',
|
||||
\ 'command': function('ale_linters#php#psalm#GetCommand'),
|
||||
\ 'project_root': function('ale_linters#php#psalm#GetProjectRoot'),
|
||||
\})
|
||||
|
||||
100
ale_linters/powershell/powershell.vim
Normal file
100
ale_linters/powershell/powershell.vim
Normal file
@@ -0,0 +1,100 @@
|
||||
" Author: Jesse Harris - https://github.com/zigford
|
||||
" Description: This file adds support for powershell scripts synatax errors
|
||||
|
||||
call ale#Set('powershell_powershell_executable', 'pwsh')
|
||||
|
||||
function! ale_linters#powershell#powershell#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'powershell_powershell_executable')
|
||||
endfunction
|
||||
|
||||
" Some powershell magic to show syntax errors without executing the script
|
||||
" thanks to keith hill:
|
||||
" https://rkeithhill.wordpress.com/2007/10/30/powershell-quicktip-preparsing-scripts-to-check-for-syntax-errors/
|
||||
function! ale_linters#powershell#powershell#GetCommand(buffer) abort
|
||||
let l:script = ['Param($Script);
|
||||
\ $ErrorView = "Normal";
|
||||
\ trap {$_;continue} & {
|
||||
\ $Contents = Get-Content -Path $Script;
|
||||
\ $Contents = [string]::Join([Environment]::NewLine, $Contents);
|
||||
\ [void]$ExecutionContext.InvokeCommand.NewScriptBlock($Contents);
|
||||
\ };']
|
||||
|
||||
return ale#powershell#RunPowerShell(
|
||||
\ a:buffer, 'powershell_powershell', l:script)
|
||||
endfunction
|
||||
|
||||
" Parse powershell error output using regex into a list of dicts
|
||||
function! ale_linters#powershell#powershell#Handle(buffer, lines) abort
|
||||
let l:output = []
|
||||
" Our 3 patterns we need to scrape the data for the dicts
|
||||
let l:patterns = [
|
||||
\ '\v^At line:(\d+) char:(\d+)',
|
||||
\ '\v^(At|\+| )@!.*',
|
||||
\ '\vFullyQualifiedErrorId : (\w+)',
|
||||
\]
|
||||
|
||||
let l:matchcount = 0
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:patterns)
|
||||
" We want to work with 3 matches per syntax error
|
||||
let l:matchcount = l:matchcount + 1
|
||||
|
||||
if l:matchcount == 1 || str2nr(l:match[1])
|
||||
" First match consists of 2 capture groups, and
|
||||
" can capture the line and col
|
||||
if exists('l:item')
|
||||
" We may be here because the last syntax
|
||||
" didn't emit a code, and so only had 2
|
||||
" matches
|
||||
call add(l:output, l:item)
|
||||
let l:matchcount = 1
|
||||
endif
|
||||
|
||||
" If the match is 0, it was a failed match
|
||||
" probably due to an unexpected token which
|
||||
" contained a newline. Reset matchcount. to
|
||||
" continue to the next match
|
||||
if !empty(l:match[1])
|
||||
let l:item = {
|
||||
\ 'lnum': str2nr(l:match[1]),
|
||||
\ 'col': str2nr(l:match[2]),
|
||||
\ 'type': 'E',
|
||||
\}
|
||||
else
|
||||
let l:matchcount = 0
|
||||
endif
|
||||
elseif l:matchcount == 2
|
||||
" Second match[0] grabs the full line in order
|
||||
" to handles the text
|
||||
let l:item['text'] = l:match[0]
|
||||
else
|
||||
" Final match handles the code, however
|
||||
" powershell only emits 1 code for all errors
|
||||
" so, we get the final code on the last error
|
||||
" and loop over the previously added items to
|
||||
" append the code we now know
|
||||
call add(l:output, l:item)
|
||||
unlet l:item
|
||||
|
||||
if len(l:match[1]) > 0
|
||||
for l:i in l:output
|
||||
let l:i['code'] = l:match[1]
|
||||
endfor
|
||||
endif
|
||||
|
||||
" Reset the matchcount so we can begin gathering
|
||||
" matches for the next syntax error
|
||||
let l:matchcount = 0
|
||||
endif
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('powershell', {
|
||||
\ 'name': 'powershell',
|
||||
\ 'executable': function('ale_linters#powershell#powershell#GetExecutable'),
|
||||
\ 'command': function('ale_linters#powershell#powershell#GetCommand'),
|
||||
\ 'output_stream': 'stdout',
|
||||
\ 'callback': 'ale_linters#powershell#powershell#Handle',
|
||||
\})
|
||||
@@ -13,37 +13,6 @@ function! ale_linters#powershell#psscriptanalyzer#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'powershell_psscriptanalyzer_executable')
|
||||
endfunction
|
||||
|
||||
" Write a powershell script to a temp file for execution
|
||||
" return the command used to execute it
|
||||
function! s:TemporaryPSScript(buffer, input) abort
|
||||
let l:filename = 'script.ps1'
|
||||
" Create a temp dir to house our temp .ps1 script
|
||||
" a temp dir is needed as powershell needs the .ps1
|
||||
" extension
|
||||
let l:tempdir = ale#util#Tempname() . (has('win32') ? '\' : '/')
|
||||
let l:tempscript = l:tempdir . l:filename
|
||||
" Create the temporary directory for the file, unreadable by 'other'
|
||||
" users.
|
||||
call mkdir(l:tempdir, '', 0750)
|
||||
" Automatically delete the directory later.
|
||||
call ale#command#ManageDirectory(a:buffer, l:tempdir)
|
||||
" Write the script input out to a file.
|
||||
call ale#util#Writefile(a:buffer, a:input, l:tempscript)
|
||||
|
||||
return l:tempscript
|
||||
endfunction
|
||||
|
||||
function! ale_linters#powershell#psscriptanalyzer#RunPowerShell(buffer, command) abort
|
||||
let l:executable = ale_linters#powershell#psscriptanalyzer#GetExecutable(
|
||||
\ a:buffer)
|
||||
let l:tempscript = s:TemporaryPSScript(a:buffer, a:command)
|
||||
|
||||
return ale#Escape(l:executable)
|
||||
\ . ' -Exe Bypass -NoProfile -File '
|
||||
\ . ale#Escape(l:tempscript)
|
||||
\ . ' %t'
|
||||
endfunction
|
||||
|
||||
" Run Invoke-ScriptAnalyzer and output each linting message as 4 seperate lines
|
||||
" for each parsing
|
||||
function! ale_linters#powershell#psscriptanalyzer#GetCommand(buffer) abort
|
||||
@@ -60,8 +29,10 @@ function! ale_linters#powershell#psscriptanalyzer#GetCommand(buffer) abort
|
||||
\ $_.Message;
|
||||
\ $_.RuleName}']
|
||||
|
||||
return ale_linters#powershell#psscriptanalyzer#RunPowerShell(
|
||||
\ a:buffer, l:script)
|
||||
return ale#powershell#RunPowerShell(
|
||||
\ a:buffer,
|
||||
\ 'powershell_psscriptanalyzer',
|
||||
\ l:script)
|
||||
endfunction
|
||||
|
||||
" add every 4 lines to an item(Dict) and every item to a list
|
||||
@@ -98,8 +69,8 @@ endfunction
|
||||
|
||||
call ale#linter#Define('powershell', {
|
||||
\ 'name': 'psscriptanalyzer',
|
||||
\ 'executable_callback': 'ale_linters#powershell#psscriptanalyzer#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#powershell#psscriptanalyzer#GetCommand',
|
||||
\ 'executable': function('ale_linters#powershell#psscriptanalyzer#GetExecutable'),
|
||||
\ 'command': function('ale_linters#powershell#psscriptanalyzer#GetCommand'),
|
||||
\ 'output_stream': 'stdout',
|
||||
\ 'callback': 'ale_linters#powershell#psscriptanalyzer#Handle',
|
||||
\})
|
||||
|
||||
@@ -31,6 +31,20 @@ function! ale_linters#pug#puglint#GetCommand(buffer) abort
|
||||
\ . ' -r inline %t'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#pug#puglint#Handle(buffer, lines) abort
|
||||
for l:line in a:lines[:10]
|
||||
if l:line =~# '^SyntaxError: '
|
||||
return [{
|
||||
\ 'lnum': 1,
|
||||
\ 'text': 'puglint configuration error (type :ALEDetail for more information)',
|
||||
\ 'detail': join(a:lines, "\n"),
|
||||
\}]
|
||||
endif
|
||||
endfor
|
||||
|
||||
return ale#handlers#unix#HandleAsError(a:buffer, a:lines)
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('pug', {
|
||||
\ 'name': 'puglint',
|
||||
\ 'executable': {b -> ale#node#FindExecutable(b, 'pug_puglint', [
|
||||
@@ -38,5 +52,5 @@ call ale#linter#Define('pug', {
|
||||
\ ])},
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'command': function('ale_linters#pug#puglint#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#unix#HandleAsError',
|
||||
\ 'callback': 'ale_linters#pug#puglint#Handle',
|
||||
\})
|
||||
|
||||
49
ale_linters/purescript/ls.vim
Normal file
49
ale_linters/purescript/ls.vim
Normal file
@@ -0,0 +1,49 @@
|
||||
" Author: Drew Olson <drew@drewolson.org>
|
||||
" Description: Integrate ALE with purescript-language-server.
|
||||
|
||||
call ale#Set('purescript_ls_executable', 'purescript-language-server')
|
||||
call ale#Set('purescript_ls_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
call ale#Set('purescript_ls_config', {})
|
||||
|
||||
function! ale_linters#purescript#ls#GetExecutable(buffer) abort
|
||||
return ale#node#FindExecutable(a:buffer, 'purescript_ls', [
|
||||
\ 'node_modules/.bin/purescript-language-server',
|
||||
\])
|
||||
endfunction
|
||||
|
||||
function! ale_linters#purescript#ls#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#purescript#ls#GetExecutable(a:buffer)
|
||||
|
||||
return ale#Escape(l:executable) . ' --stdio'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#purescript#ls#FindProjectRoot(buffer) abort
|
||||
let l:config = ale#path#FindNearestFile(a:buffer, 'bower.json')
|
||||
|
||||
if !empty(l:config)
|
||||
return fnamemodify(l:config, ':h')
|
||||
endif
|
||||
|
||||
let l:config = ale#path#FindNearestFile(a:buffer, 'psc-package.json')
|
||||
|
||||
if !empty(l:config)
|
||||
return fnamemodify(l:config, ':h')
|
||||
endif
|
||||
|
||||
let l:config = ale#path#FindNearestFile(a:buffer, 'spago.dhall')
|
||||
|
||||
if !empty(l:config)
|
||||
return fnamemodify(l:config, ':h')
|
||||
endif
|
||||
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('purescript', {
|
||||
\ 'name': 'purescript-language-server',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': function('ale_linters#purescript#ls#GetExecutable'),
|
||||
\ 'command': function('ale_linters#purescript#ls#GetCommand'),
|
||||
\ 'project_root': function('ale_linters#purescript#ls#FindProjectRoot'),
|
||||
\ 'lsp_config': {b -> ale#Var(b, 'purescript_ls_config')},
|
||||
\})
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
call ale#Set('python_mypy_executable', 'mypy')
|
||||
call ale#Set('python_mypy_ignore_invalid_syntax', 0)
|
||||
call ale#Set('python_mypy_show_notes', 1)
|
||||
call ale#Set('python_mypy_options', '')
|
||||
call ale#Set('python_mypy_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
call ale#Set('python_mypy_auto_pipenv', 0)
|
||||
@@ -18,6 +19,15 @@ endfunction
|
||||
|
||||
" The directory to change to before running mypy
|
||||
function! s:GetDir(buffer) abort
|
||||
" If we find a directory with "mypy.ini" in it use that,
|
||||
" else try and find the "python project" root, or failing
|
||||
" that, run from the same folder as the current file
|
||||
for l:path in ale#path#Upwards(expand('#' . a:buffer . ':p:h'))
|
||||
if filereadable(l:path . '/mypy.ini')
|
||||
return l:path
|
||||
endif
|
||||
endfor
|
||||
|
||||
let l:project_root = ale#python#FindProjectRoot(a:buffer)
|
||||
|
||||
return !empty(l:project_root)
|
||||
@@ -51,7 +61,16 @@ function! ale_linters#python#mypy#Handle(buffer, lines) abort
|
||||
" Lines like these should be ignored below:
|
||||
"
|
||||
" file.py:4: note: (Stub files are from https://github.com/python/typeshed)
|
||||
let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):?(\d+)?: (error|warning): (.+)$'
|
||||
|
||||
let l:types = 'error|warning'
|
||||
|
||||
if ale#Var(a:buffer, 'python_mypy_show_notes')
|
||||
let l:types = 'error|warning|note'
|
||||
endif
|
||||
|
||||
let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):?(\d+)?: ('
|
||||
\ . l:types
|
||||
\ . '): (.+)$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
@@ -65,7 +84,7 @@ function! ale_linters#python#mypy#Handle(buffer, lines) abort
|
||||
\ 'filename': ale#path#GetAbsPath(l:dir, l:match[1]),
|
||||
\ 'lnum': l:match[2] + 0,
|
||||
\ 'col': l:match[3] + 0,
|
||||
\ 'type': l:match[4] is# 'error' ? 'E' : 'W',
|
||||
\ 'type': l:match[4] is# 'error' ? 'E' : (l:match[4] is# 'note' ? 'I': 'W'),
|
||||
\ 'text': l:match[5],
|
||||
\})
|
||||
endfor
|
||||
@@ -78,4 +97,5 @@ call ale#linter#Define('python', {
|
||||
\ 'executable': function('ale_linters#python#mypy#GetExecutable'),
|
||||
\ 'command': function('ale_linters#python#mypy#GetCommand'),
|
||||
\ 'callback': 'ale_linters#python#mypy#Handle',
|
||||
\ 'output_stream': 'both'
|
||||
\})
|
||||
|
||||
@@ -6,6 +6,7 @@ call ale#Set('python_pylint_options', '')
|
||||
call ale#Set('python_pylint_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
call ale#Set('python_pylint_change_directory', 1)
|
||||
call ale#Set('python_pylint_auto_pipenv', 0)
|
||||
call ale#Set('python_pylint_use_msg_id', 0)
|
||||
|
||||
function! ale_linters#python#pylint#GetExecutable(buffer) abort
|
||||
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pylint_auto_pipenv'))
|
||||
@@ -64,11 +65,17 @@ function! ale_linters#python#pylint#Handle(buffer, lines) abort
|
||||
continue
|
||||
endif
|
||||
|
||||
if ale#Var(a:buffer, 'python_pylint_use_msg_id') is# 1
|
||||
let l:code_out = l:code
|
||||
else
|
||||
let l:code_out = l:match[4]
|
||||
endif
|
||||
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[1] + 0,
|
||||
\ 'col': l:match[2] + 1,
|
||||
\ 'text': l:match[5],
|
||||
\ 'code': l:match[4],
|
||||
\ 'code': l:code_out,
|
||||
\ 'type': l:code[:0] is# 'E' ? 'E' : 'W',
|
||||
\})
|
||||
endfor
|
||||
|
||||
23
ale_linters/reason/ls.vim
Normal file
23
ale_linters/reason/ls.vim
Normal file
@@ -0,0 +1,23 @@
|
||||
" Author: David Buchan-Swanson <github@deecewan.com>
|
||||
" Description: Integrate ALE with reason-language-server.
|
||||
|
||||
call ale#Set('reason_ls_executable', '')
|
||||
|
||||
function! ale_linters#reason#ls#FindProjectRoot(buffer) abort
|
||||
let l:reason_config = ale#path#FindNearestFile(a:buffer, 'bsconfig.json')
|
||||
|
||||
if !empty(l:reason_config)
|
||||
return fnamemodify(l:reason_config, ':h')
|
||||
endif
|
||||
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('reason', {
|
||||
\ 'name': 'reason-language-server',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': {buffer -> ale#Var(buffer, 'reason_ls_executable')},
|
||||
\ 'command': '%e',
|
||||
\ 'project_root': function('ale_linters#reason#ls#FindProjectRoot'),
|
||||
\ 'language': 'reason',
|
||||
\})
|
||||
@@ -36,7 +36,7 @@ function! ale_linters#ruby#brakeman#GetCommand(buffer) abort
|
||||
|
||||
let l:executable = ale#Var(a:buffer, 'ruby_brakeman_executable')
|
||||
|
||||
return ale#handlers#ruby#EscapeExecutable(l:executable, 'brakeman')
|
||||
return ale#ruby#EscapeExecutable(l:executable, 'brakeman')
|
||||
\ . ' -f json -q '
|
||||
\ . ale#Var(a:buffer, 'ruby_brakeman_options')
|
||||
\ . ' -p ' . ale#Escape(l:rails_root)
|
||||
|
||||
42
ale_linters/ruby/debride.vim
Normal file
42
ale_linters/ruby/debride.vim
Normal file
@@ -0,0 +1,42 @@
|
||||
" Author: Eddie Lebow https://github.com/elebow
|
||||
" Description: debride, a dead method detector for Ruby files
|
||||
|
||||
call ale#Set('ruby_debride_executable', 'debride')
|
||||
call ale#Set('ruby_debride_options', '')
|
||||
|
||||
function! ale_linters#ruby#debride#GetCommand(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'ruby_debride_executable')
|
||||
|
||||
return ale#ruby#EscapeExecutable(l:executable, 'debride')
|
||||
\ . ale#Var(a:buffer, 'ruby_debride_options')
|
||||
\ . ' %s'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#ruby#debride#HandleOutput(buffer, lines) abort
|
||||
let l:output = []
|
||||
|
||||
for l:line in a:lines
|
||||
if l:line !~# '^ '
|
||||
continue
|
||||
endif
|
||||
|
||||
let l:elements = split(l:line)
|
||||
let l:method_name = l:elements[0]
|
||||
let l:lnum = split(l:elements[1], ':')[1]
|
||||
|
||||
call add(l:output, {
|
||||
\ 'lnum': 0 + l:lnum,
|
||||
\ 'text': 'Possible unused method: ' . l:method_name,
|
||||
\ 'type': 'W',
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('ruby', {
|
||||
\ 'name': 'debride',
|
||||
\ 'executable': {b -> ale#Var(b, 'ruby_debride_executable')},
|
||||
\ 'command': function('ale_linters#ruby#debride#GetCommand'),
|
||||
\ 'callback': 'ale_linters#ruby#debride#HandleOutput',
|
||||
\})
|
||||
@@ -33,7 +33,7 @@ function! ale_linters#ruby#rails_best_practices#GetCommand(buffer) abort
|
||||
let l:output_file = has('win32') ? '%t ' : '/dev/stdout '
|
||||
let l:cat_file = has('win32') ? '; type %t' : ''
|
||||
|
||||
return ale#handlers#ruby#EscapeExecutable(l:executable, 'rails_best_practices')
|
||||
return ale#ruby#EscapeExecutable(l:executable, 'rails_best_practices')
|
||||
\ . ' --silent -f json --output-file ' . l:output_file
|
||||
\ . ale#Var(a:buffer, 'ruby_rails_best_practices_options')
|
||||
\ . ale#Escape(l:rails_root)
|
||||
|
||||
@@ -14,7 +14,7 @@ function! ale_linters#ruby#reek#GetCommand(buffer, version) abort
|
||||
\ ? ' --stdin-filename %s'
|
||||
\ : ''
|
||||
|
||||
return ale#handlers#ruby#EscapeExecutable(l:executable, 'reek')
|
||||
return ale#ruby#EscapeExecutable(l:executable, 'reek')
|
||||
\ . ' -f json --no-progress --no-color --force-exclusion'
|
||||
\ . l:display_name_args
|
||||
endfunction
|
||||
|
||||
@@ -7,7 +7,7 @@ call ale#Set('ruby_rubocop_options', '')
|
||||
function! ale_linters#ruby#rubocop#GetCommand(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'ruby_rubocop_executable')
|
||||
|
||||
return ale#handlers#ruby#EscapeExecutable(l:executable, 'rubocop')
|
||||
return ale#ruby#EscapeExecutable(l:executable, 'rubocop')
|
||||
\ . ' --format json --force-exclusion '
|
||||
\ . ale#Var(a:buffer, 'ruby_rubocop_options')
|
||||
\ . ' --stdin ' . ale#Escape(expand('#' . a:buffer . ':p'))
|
||||
|
||||
23
ale_linters/ruby/sorbet.vim
Normal file
23
ale_linters/ruby/sorbet.vim
Normal file
@@ -0,0 +1,23 @@
|
||||
call ale#Set('ruby_sorbet_executable', 'srb')
|
||||
call ale#Set('ruby_sorbet_options', '')
|
||||
|
||||
function! ale_linters#ruby#sorbet#GetCommand(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'ruby_sorbet_executable')
|
||||
let l:options = ale#Var(a:buffer, 'ruby_sorbet_options')
|
||||
|
||||
return ale#ruby#EscapeExecutable(l:executable, 'srb')
|
||||
\ . ' tc'
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
\ . ' --lsp --disable-watchman'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('ruby', {
|
||||
\ 'name': 'sorbet',
|
||||
\ 'aliases': ['srb'],
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'language': 'ruby',
|
||||
\ 'executable': {b -> ale#Var(b, 'ruby_sorbet_executable')},
|
||||
\ 'command': function('ale_linters#ruby#sorbet#GetCommand'),
|
||||
\ 'project_root': function('ale#ruby#FindProjectRoot')
|
||||
\})
|
||||
|
||||
@@ -8,7 +8,7 @@ call ale#Set('ruby_standardrb_options', '')
|
||||
function! ale_linters#ruby#standardrb#GetCommand(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'ruby_standardrb_executable')
|
||||
|
||||
return ale#handlers#ruby#EscapeExecutable(l:executable, 'standardrb')
|
||||
return ale#ruby#EscapeExecutable(l:executable, 'standardrb')
|
||||
\ . ' --format json --force-exclusion '
|
||||
\ . ale#Var(a:buffer, 'ruby_standardrb_options')
|
||||
\ . ' --stdin ' . ale#Escape(expand('#' . a:buffer . ':p'))
|
||||
|
||||
24
ale_linters/rust/analyzer.vim
Normal file
24
ale_linters/rust/analyzer.vim
Normal file
@@ -0,0 +1,24 @@
|
||||
" Author: Jon Gjengset <jon@thesquareplanet.com>
|
||||
" Description: The next generation language server for Rust
|
||||
|
||||
call ale#Set('rust_analyzer_executable', 'rust-analyzer')
|
||||
call ale#Set('rust_analyzer_config', {})
|
||||
|
||||
function! ale_linters#rust#analyzer#GetCommand(buffer) abort
|
||||
return '%e'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#rust#analyzer#GetProjectRoot(buffer) abort
|
||||
let l:cargo_file = ale#path#FindNearestFile(a:buffer, 'Cargo.toml')
|
||||
|
||||
return !empty(l:cargo_file) ? fnamemodify(l:cargo_file, ':h') : ''
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('rust', {
|
||||
\ 'name': 'analyzer',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'lsp_config': {b -> ale#Var(b, 'rust_analyzer_config')},
|
||||
\ 'executable': {b -> ale#Var(b, 'rust_analyzer_executable')},
|
||||
\ 'command': function('ale_linters#rust#analyzer#GetCommand'),
|
||||
\ 'project_root': function('ale_linters#rust#analyzer#GetProjectRoot'),
|
||||
\})
|
||||
@@ -25,14 +25,11 @@ endfunction
|
||||
function! ale_linters#rust#cargo#GetCommand(buffer, version) abort
|
||||
let l:use_check = ale#Var(a:buffer, 'rust_cargo_use_check')
|
||||
\ && ale#semver#GTE(a:version, [0, 17, 0])
|
||||
let l:use_all_targets = l:use_check
|
||||
\ && ale#Var(a:buffer, 'rust_cargo_check_all_targets')
|
||||
let l:use_all_targets = ale#Var(a:buffer, 'rust_cargo_check_all_targets')
|
||||
\ && ale#semver#GTE(a:version, [0, 22, 0])
|
||||
let l:use_examples = l:use_check
|
||||
\ && ale#Var(a:buffer, 'rust_cargo_check_examples')
|
||||
let l:use_examples = ale#Var(a:buffer, 'rust_cargo_check_examples')
|
||||
\ && ale#semver#GTE(a:version, [0, 22, 0])
|
||||
let l:use_tests = l:use_check
|
||||
\ && ale#Var(a:buffer, 'rust_cargo_check_tests')
|
||||
let l:use_tests = ale#Var(a:buffer, 'rust_cargo_check_tests')
|
||||
\ && ale#semver#GTE(a:version, [0, 22, 0])
|
||||
|
||||
let l:include_features = ale#Var(a:buffer, 'rust_cargo_include_features')
|
||||
@@ -69,7 +66,15 @@ function! ale_linters#rust#cargo#GetCommand(buffer, version) abort
|
||||
|
||||
if ale#Var(a:buffer, 'rust_cargo_use_clippy')
|
||||
let l:subcommand = 'clippy'
|
||||
let l:clippy_options = ' ' . ale#Var(a:buffer, 'rust_cargo_clippy_options')
|
||||
let l:clippy_options = ale#Var(a:buffer, 'rust_cargo_clippy_options')
|
||||
|
||||
if l:clippy_options =~# '^-- '
|
||||
let l:clippy_options = join(split(l:clippy_options, '-- '))
|
||||
endif
|
||||
|
||||
if l:clippy_options isnot# ''
|
||||
let l:clippy_options = ' -- ' . l:clippy_options
|
||||
endif
|
||||
endif
|
||||
|
||||
return l:nearest_cargo_prefix . 'cargo '
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
" Description: A language server for Rust
|
||||
|
||||
call ale#Set('rust_rls_executable', 'rls')
|
||||
call ale#Set('rust_rls_toolchain', 'nightly')
|
||||
call ale#Set('rust_rls_toolchain', '')
|
||||
call ale#Set('rust_rls_config', {})
|
||||
|
||||
function! ale_linters#rust#rls#GetCommand(buffer) abort
|
||||
|
||||
50
ale_linters/scala/metals.vim
Normal file
50
ale_linters/scala/metals.vim
Normal file
@@ -0,0 +1,50 @@
|
||||
" Author: Jeffrey Lau - https://github.com/zoonfafer
|
||||
" Description: Metals Language Server for Scala https://scalameta.org/metals/
|
||||
|
||||
call ale#Set('scala_metals_executable', 'metals-vim')
|
||||
call ale#Set('scala_metals_project_root', '')
|
||||
|
||||
function! ale_linters#scala#metals#GetProjectRoot(buffer) abort
|
||||
let l:project_root = ale#Var(a:buffer, 'scala_metals_project_root')
|
||||
|
||||
if !empty(l:project_root)
|
||||
return l:project_root
|
||||
endif
|
||||
|
||||
let l:potential_roots = [
|
||||
\ 'build.sc',
|
||||
\ 'build.sbt',
|
||||
\ '.bloop',
|
||||
\ '.metals',
|
||||
\]
|
||||
|
||||
for l:root in l:potential_roots
|
||||
let l:project_root = ale#path#ResolveLocalPath(
|
||||
\ a:buffer,
|
||||
\ l:root,
|
||||
\ ''
|
||||
\)
|
||||
|
||||
if !empty(l:project_root)
|
||||
return fnamemodify(
|
||||
\ l:project_root,
|
||||
\ ':h',
|
||||
\)
|
||||
endif
|
||||
endfor
|
||||
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
function! ale_linters#scala#metals#GetCommand(buffer) abort
|
||||
return '%e' . ale#Pad('stdio')
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('scala', {
|
||||
\ 'name': 'metals',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'language': 'scala',
|
||||
\ 'executable': {b -> ale#Var(b, 'scala_metals_executable')},
|
||||
\ 'command': function('ale_linters#scala#metals#GetCommand'),
|
||||
\ 'project_root': function('ale_linters#scala#metals#GetProjectRoot'),
|
||||
\})
|
||||
@@ -34,8 +34,10 @@ function! ale_linters#sh#shell#Handle(buffer, lines) abort
|
||||
" Matches patterns line the following:
|
||||
"
|
||||
" bash: line 13: syntax error near unexpected token `d'
|
||||
" bash:行0: 未预期的符号“done”附近有语法错误
|
||||
" bash: 列 90: 尋找匹配的「"」時遇到了未預期的檔案結束符
|
||||
" sh: 11: Syntax error: "(" unexpected
|
||||
let l:pattern = '\v(line |: ?)(\d+): (.+)$'
|
||||
let l:pattern = '\v([^:]+:\D*)(\d+): (.+)$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
|
||||
@@ -1,103 +1,4 @@
|
||||
" Author: w0rp <devw0rp@gmail.com>
|
||||
" Description: This file adds support for using the shellcheck linter with
|
||||
" shell scripts.
|
||||
" Description: shellcheck linter for shell scripts.
|
||||
|
||||
" This global variable can be set with a string of comma-separated error
|
||||
" codes to exclude from shellcheck. For example:
|
||||
"
|
||||
" let g:ale_sh_shellcheck_exclusions = 'SC2002,SC2004'
|
||||
call ale#Set('sh_shellcheck_exclusions', get(g:, 'ale_linters_sh_shellcheck_exclusions', ''))
|
||||
call ale#Set('sh_shellcheck_executable', 'shellcheck')
|
||||
call ale#Set('sh_shellcheck_dialect', 'auto')
|
||||
call ale#Set('sh_shellcheck_options', '')
|
||||
|
||||
function! ale_linters#sh#shellcheck#GetDialectArgument(buffer) abort
|
||||
let l:shell_type = ale#handlers#sh#GetShellType(a:buffer)
|
||||
|
||||
if !empty(l:shell_type)
|
||||
" Use the dash dialect for /bin/ash, etc.
|
||||
if l:shell_type is# 'ash'
|
||||
return 'dash'
|
||||
endif
|
||||
|
||||
return l:shell_type
|
||||
endif
|
||||
|
||||
" If there's no hashbang, try using Vim's buffer variables.
|
||||
if getbufvar(a:buffer, 'is_bash', 0)
|
||||
return 'bash'
|
||||
elseif getbufvar(a:buffer, 'is_sh', 0)
|
||||
return 'sh'
|
||||
elseif getbufvar(a:buffer, 'is_kornshell', 0)
|
||||
return 'ksh'
|
||||
endif
|
||||
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
function! ale_linters#sh#shellcheck#GetCommand(buffer, version) abort
|
||||
let l:options = ale#Var(a:buffer, 'sh_shellcheck_options')
|
||||
let l:exclude_option = ale#Var(a:buffer, 'sh_shellcheck_exclusions')
|
||||
let l:dialect = ale#Var(a:buffer, 'sh_shellcheck_dialect')
|
||||
let l:external_option = ale#semver#GTE(a:version, [0, 4, 0]) ? ' -x' : ''
|
||||
|
||||
if l:dialect is# 'auto'
|
||||
let l:dialect = ale_linters#sh#shellcheck#GetDialectArgument(a:buffer)
|
||||
endif
|
||||
|
||||
return ale#path#BufferCdString(a:buffer)
|
||||
\ . '%e'
|
||||
\ . (!empty(l:dialect) ? ' -s ' . l:dialect : '')
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
\ . (!empty(l:exclude_option) ? ' -e ' . l:exclude_option : '')
|
||||
\ . l:external_option
|
||||
\ . ' -f gcc -'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#sh#shellcheck#Handle(buffer, lines) abort
|
||||
let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):(\d+)?:? ([^:]+): (.+) \[([^\]]+)\]$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
if l:match[4] is# 'error'
|
||||
let l:type = 'E'
|
||||
elseif l:match[4] is# 'note'
|
||||
let l:type = 'I'
|
||||
else
|
||||
let l:type = 'W'
|
||||
endif
|
||||
|
||||
let l:item = {
|
||||
\ 'lnum': str2nr(l:match[2]),
|
||||
\ 'type': l:type,
|
||||
\ 'text': l:match[5],
|
||||
\ 'code': l:match[6],
|
||||
\}
|
||||
|
||||
if !empty(l:match[3])
|
||||
let l:item.col = str2nr(l:match[3])
|
||||
endif
|
||||
|
||||
" If the filename is something like <stdin>, <nofile> or -, then
|
||||
" this is an error for the file we checked.
|
||||
if l:match[1] isnot# '-' && l:match[1][0] isnot# '<'
|
||||
let l:item['filename'] = l:match[1]
|
||||
endif
|
||||
|
||||
call add(l:output, l:item)
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('sh', {
|
||||
\ 'name': 'shellcheck',
|
||||
\ 'executable': {buffer -> ale#Var(buffer, 'sh_shellcheck_executable')},
|
||||
\ 'command': {buffer -> ale#semver#RunWithVersionCheck(
|
||||
\ buffer,
|
||||
\ ale#Var(buffer, 'sh_shellcheck_executable'),
|
||||
\ '%e --version',
|
||||
\ function('ale_linters#sh#shellcheck#GetCommand'),
|
||||
\ )},
|
||||
\ 'callback': 'ale_linters#sh#shellcheck#Handle',
|
||||
\})
|
||||
call ale#handlers#shellcheck#DefineLinter('sh')
|
||||
|
||||
35
ale_linters/solidity/solc.vim
Normal file
35
ale_linters/solidity/solc.vim
Normal file
@@ -0,0 +1,35 @@
|
||||
" Author: Karl Bartel <karl42@gmail.com> - http://karl.berlin/
|
||||
" Description: Report solc compiler errors in Solidity code
|
||||
|
||||
call ale#Set('solidity_solc_options', '')
|
||||
|
||||
function! ale_linters#solidity#solc#Handle(buffer, lines) abort
|
||||
" Matches patterns like the following:
|
||||
" /path/to/file/file.sol:1:10: Error: Identifier not found or not unique.
|
||||
let l:pattern = '\v^[^:]+:(\d+):(\d+): (Error|Warning): (.*)$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
let l:isError = l:match[3] is? 'error'
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[1] + 0,
|
||||
\ 'col': l:match[2] + 0,
|
||||
\ 'text': l:match[4],
|
||||
\ 'type': l:isError ? 'E' : 'W',
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
function! ale_linters#solidity#solc#GetCommand(buffer) abort
|
||||
return 'solc' . ale#Pad(ale#Var(a:buffer, 'solidity_solc_options')) . ' %s'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('solidity', {
|
||||
\ 'name': 'solc',
|
||||
\ 'executable': 'solc',
|
||||
\ 'command': function('ale_linters#solidity#solc#GetCommand'),
|
||||
\ 'callback': 'ale_linters#solidity#solc#Handle',
|
||||
\ 'output_stream': 'stderr',
|
||||
\})
|
||||
13
ale_linters/swift/sourcekitlsp.vim
Normal file
13
ale_linters/swift/sourcekitlsp.vim
Normal file
@@ -0,0 +1,13 @@
|
||||
" Author: Dan Loman <https://github.com/namolnad>
|
||||
" Description: Support for sourcekit-lsp https://github.com/apple/sourcekit-lsp
|
||||
|
||||
call ale#Set('sourcekit_lsp_executable', 'sourcekit-lsp')
|
||||
|
||||
call ale#linter#Define('swift', {
|
||||
\ 'name': 'sourcekitlsp',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': {b -> ale#Var(b, 'sourcekit_lsp_executable')},
|
||||
\ 'command': '%e',
|
||||
\ 'project_root': function('ale#swift#FindProjectRoot'),
|
||||
\ 'language': 'swift',
|
||||
\})
|
||||
49
ale_linters/terraform/terraform.vim
Normal file
49
ale_linters/terraform/terraform.vim
Normal file
@@ -0,0 +1,49 @@
|
||||
" Author: Keith Maxwell <keith.maxwell@gmail.com>
|
||||
" Description: terraform fmt to check for errors
|
||||
|
||||
call ale#Set('terraform_terraform_executable', 'terraform')
|
||||
|
||||
function! ale_linters#terraform#terraform#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'terraform_terraform_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#terraform#terraform#GetCommand(buffer) abort
|
||||
return ale#Escape(ale_linters#terraform#terraform#GetExecutable(a:buffer))
|
||||
\ . ' fmt -no-color --check=true -'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#terraform#terraform#Handle(buffer, lines) abort
|
||||
let l:head = '^Error running fmt: In <standard input>: '
|
||||
let l:output = []
|
||||
let l:patterns = [
|
||||
\ l:head.'At \(\d\+\):\(\d\+\): \(.*\)$',
|
||||
\ l:head.'\(.*\)$'
|
||||
\]
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:patterns)
|
||||
if len(l:match[2]) > 0
|
||||
call add(l:output, {
|
||||
\ 'lnum': str2nr(l:match[1]),
|
||||
\ 'col': str2nr(l:match[2]),
|
||||
\ 'text': l:match[3],
|
||||
\ 'type': 'E',
|
||||
\})
|
||||
else
|
||||
call add(l:output, {
|
||||
\ 'lnum': line('$'),
|
||||
\ 'text': l:match[1],
|
||||
\ 'type': 'E',
|
||||
\})
|
||||
endif
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('terraform', {
|
||||
\ 'name': 'terraform',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': function('ale_linters#terraform#terraform#GetExecutable'),
|
||||
\ 'command': function('ale_linters#terraform#terraform#GetCommand'),
|
||||
\ 'callback': 'ale_linters#terraform#terraform#Handle',
|
||||
\})
|
||||
25
ale_linters/terraform/terraform_lsp.vim
Normal file
25
ale_linters/terraform/terraform_lsp.vim
Normal file
@@ -0,0 +1,25 @@
|
||||
" Author: OJFord <dev@ojford.com>
|
||||
" Description: terraform-lsp integration for ALE (cf. https://github.com/juliosueiras/terraform-lsp)
|
||||
|
||||
call ale#Set('terraform_langserver_executable', 'terraform-lsp')
|
||||
call ale#Set('terraform_langserver_options', '')
|
||||
|
||||
function! ale_linters#terraform#terraform_lsp#GetCommand(buffer) abort
|
||||
return '%e'
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'terraform_langserver_options'))
|
||||
endfunction
|
||||
|
||||
function! ale_linters#terraform#terraform_lsp#GetProjectRoot(buffer) abort
|
||||
let l:tf_dir = ale#path#FindNearestDirectory(a:buffer, '.terraform')
|
||||
|
||||
return !empty(l:tf_dir) ? fnamemodify(l:tf_dir, ':h:h') : ''
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('terraform', {
|
||||
\ 'name': 'terraform_lsp',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': {b -> ale#Var(b, 'terraform_langserver_executable')},
|
||||
\ 'command': function('ale_linters#terraform#terraform_lsp#GetCommand'),
|
||||
\ 'project_root': function('ale_linters#terraform#terraform_lsp#GetProjectRoot'),
|
||||
\ 'language': 'terraform',
|
||||
\})
|
||||
@@ -9,23 +9,69 @@ call ale#Set('terraform_tflint_executable', 'tflint')
|
||||
|
||||
function! ale_linters#terraform#tflint#Handle(buffer, lines) abort
|
||||
let l:output = []
|
||||
let l:pattern = '\v^(.*):(\d+),(\d+)-(\d+)?,?(\d+): (.{-1,}); (.+)$'
|
||||
let l:json = ale#util#FuzzyJSONDecode(a:lines, {})
|
||||
|
||||
for l:error in ale#util#FuzzyJSONDecode(a:lines, [])
|
||||
if l:error.type is# 'ERROR'
|
||||
let l:type = 'E'
|
||||
elseif l:error.type is# 'NOTICE'
|
||||
let l:type = 'I'
|
||||
else
|
||||
let l:type = 'W'
|
||||
endif
|
||||
" This is a rough test for tflint's output format
|
||||
" On versions prior to 0.11 it outputs all errors as a single level list
|
||||
if type(l:json) is v:t_list
|
||||
for l:error in l:json
|
||||
if l:error.type is# 'ERROR'
|
||||
let l:type = 'E'
|
||||
elseif l:error.type is# 'NOTICE'
|
||||
let l:type = 'I'
|
||||
else
|
||||
let l:type = 'W'
|
||||
endif
|
||||
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:error.line,
|
||||
\ 'text': l:error.message,
|
||||
\ 'type': l:type,
|
||||
\ 'code': l:error.detector,
|
||||
\})
|
||||
endfor
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:error.line,
|
||||
\ 'text': l:error.message,
|
||||
\ 'type': l:type,
|
||||
\ 'code': l:error.detector,
|
||||
\})
|
||||
endfor
|
||||
else
|
||||
for l:error in get(l:json, 'errors', [])
|
||||
for l:match in ale#util#GetMatches(l:error.message, [l:pattern])
|
||||
if l:match[4] is# ''
|
||||
let l:match[4] = l:match[2]
|
||||
endif
|
||||
|
||||
call add(l:output, {
|
||||
\ 'filename': l:match[1],
|
||||
\ 'lnum': str2nr(l:match[2]),
|
||||
\ 'col': str2nr(l:match[3]),
|
||||
\ 'end_lnum': str2nr(l:match[4]),
|
||||
\ 'end_col': str2nr(l:match[5]),
|
||||
\ 'text': l:match[7],
|
||||
\ 'code': l:match[6],
|
||||
\ 'type': 'E',
|
||||
\})
|
||||
endfor
|
||||
endfor
|
||||
|
||||
for l:error in get(l:json, 'issues', [])
|
||||
if l:error.rule.severity is# 'ERROR'
|
||||
let l:type = 'E'
|
||||
elseif l:error.rule.severity is# 'NOTICE'
|
||||
let l:type = 'I'
|
||||
else
|
||||
let l:type = 'W'
|
||||
endif
|
||||
|
||||
call add(l:output, {
|
||||
\ 'filename': l:error.range.filename,
|
||||
\ 'lnum': l:error.range.start.line,
|
||||
\ 'col': l:error.range.start.column,
|
||||
\ 'end_lnum': l:error.range.end.line,
|
||||
\ 'end_col': l:error.range.end.column,
|
||||
\ 'text': l:error.message,
|
||||
\ 'code': l:error.rule.name,
|
||||
\ 'type': l:type,
|
||||
\})
|
||||
endfor
|
||||
endif
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
21
ale_linters/tex/texlab.vim
Normal file
21
ale_linters/tex/texlab.vim
Normal file
@@ -0,0 +1,21 @@
|
||||
" Author: Ricardo Liang <ricardoliang@gmail.com>
|
||||
" Description: Texlab language server (Rust rewrite)
|
||||
|
||||
call ale#Set('tex_texlab_executable', 'texlab')
|
||||
call ale#Set('tex_texlab_options', '')
|
||||
|
||||
function! ale_linters#tex#texlab#GetProjectRoot(buffer) abort
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
function! ale_linters#tex#texlab#GetCommand(buffer) abort
|
||||
return '%e' . ale#Pad(ale#Var(a:buffer, 'tex_texlab_options'))
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('tex', {
|
||||
\ 'name': 'texlab',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': {b -> ale#Var(b, 'tex_texlab_executable')},
|
||||
\ 'command': function('ale_linters#tex#texlab#GetCommand'),
|
||||
\ 'project_root': function('ale_linters#tex#texlab#GetProjectRoot'),
|
||||
\})
|
||||
@@ -5,5 +5,5 @@ call ale#linter#Define('typescript', {
|
||||
\ 'name': 'eslint',
|
||||
\ 'executable': function('ale#handlers#eslint#GetExecutable'),
|
||||
\ 'command': function('ale#handlers#eslint#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#eslint#Handle',
|
||||
\ 'callback': 'ale#handlers#eslint#HandleJSON',
|
||||
\})
|
||||
|
||||
31
ale_linters/typescript/standard.vim
Normal file
31
ale_linters/typescript/standard.vim
Normal file
@@ -0,0 +1,31 @@
|
||||
" Author: Ahmed El Gabri <@ahmedelgabri>
|
||||
" Description: standardjs for typescript files
|
||||
|
||||
call ale#Set('typescript_standard_executable', 'standard')
|
||||
call ale#Set('typescript_standard_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
call ale#Set('typescript_standard_options', '')
|
||||
|
||||
function! ale_linters#typescript#standard#GetExecutable(buffer) abort
|
||||
return ale#node#FindExecutable(a:buffer, 'typescript_standard', [
|
||||
\ 'node_modules/standardx/bin/cmd.js',
|
||||
\ 'node_modules/standard/bin/cmd.js',
|
||||
\ 'node_modules/.bin/standard',
|
||||
\])
|
||||
endfunction
|
||||
|
||||
function! ale_linters#typescript#standard#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#typescript#standard#GetExecutable(a:buffer)
|
||||
let l:options = ale#Var(a:buffer, 'typescript_standard_options')
|
||||
|
||||
return ale#node#Executable(a:buffer, l:executable)
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
\ . ' --stdin %s'
|
||||
endfunction
|
||||
|
||||
" standard uses eslint and the output format is the same
|
||||
call ale#linter#Define('typescript', {
|
||||
\ 'name': 'standard',
|
||||
\ 'executable': function('ale_linters#typescript#standard#GetExecutable'),
|
||||
\ 'command': function('ale_linters#typescript#standard#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#eslint#Handle',
|
||||
\})
|
||||
23
ale_linters/typescript/xo.vim
Normal file
23
ale_linters/typescript/xo.vim
Normal file
@@ -0,0 +1,23 @@
|
||||
call ale#Set('typescript_xo_executable', 'xo')
|
||||
call ale#Set('typescript_xo_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
call ale#Set('typescript_xo_options', '')
|
||||
|
||||
function! ale_linters#typescript#xo#GetExecutable(buffer) abort
|
||||
return ale#node#FindExecutable(a:buffer, 'typescript_xo', [
|
||||
\ 'node_modules/.bin/xo',
|
||||
\])
|
||||
endfunction
|
||||
|
||||
function! ale_linters#typescript#xo#GetCommand(buffer) abort
|
||||
return ale#Escape(ale_linters#typescript#xo#GetExecutable(a:buffer))
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'typescript_xo_options'))
|
||||
\ . ' --reporter json --stdin --stdin-filename %s'
|
||||
endfunction
|
||||
|
||||
" xo uses eslint and the output format is the same
|
||||
call ale#linter#Define('typescript', {
|
||||
\ 'name': 'xo',
|
||||
\ 'executable': function('ale_linters#typescript#xo#GetExecutable'),
|
||||
\ 'command': function('ale_linters#typescript#xo#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#eslint#HandleJSON',
|
||||
\})
|
||||
@@ -28,21 +28,30 @@ function! ale_linters#verilog#verilator#Handle(buffer, lines) abort
|
||||
" %Warning-UNDRIVEN: test.v:3: Signal is not driven: clk
|
||||
" %Warning-UNUSED: test.v:4: Signal is not used: dout
|
||||
" %Warning-BLKSEQ: test.v:10: Blocking assignments (=) in sequential (flop or latch) block; suggest delayed assignments (<=).
|
||||
let l:pattern = '^%\(Warning\|Error\)[^:]*:\([^:]\+\):\(\d\+\): \(.\+\)$'
|
||||
" Since version 4.032 (04/2020) verilator linter messages also contain the column number,
|
||||
" and look like:
|
||||
" %Error: /tmp/test.sv:3:1: syntax error, unexpected endmodule, expecting ';'
|
||||
"
|
||||
" to stay compatible with old versions of the tool, the column number is
|
||||
" optional in the researched pattern
|
||||
let l:pattern = '^%\(Warning\|Error\)[^:]*:\([^:]\+\):\(\d\+\):\(\d\+\)\?:\? \(.\+\)$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
let l:line = l:match[3] + 0
|
||||
let l:type = l:match[1] is# 'Error' ? 'E' : 'W'
|
||||
let l:text = l:match[4]
|
||||
let l:item = {
|
||||
\ 'lnum': str2nr(l:match[3]),
|
||||
\ 'text': l:match[5],
|
||||
\ 'type': l:match[1] is# 'Error' ? 'E' : 'W',
|
||||
\}
|
||||
|
||||
if !empty(l:match[4])
|
||||
let l:item.col = str2nr(l:match[4])
|
||||
endif
|
||||
|
||||
let l:file = l:match[2]
|
||||
|
||||
if l:file =~# '_verilator_linted.v'
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:line,
|
||||
\ 'text': l:text,
|
||||
\ 'type': l:type,
|
||||
\})
|
||||
call add(l:output, l:item)
|
||||
endif
|
||||
endfor
|
||||
|
||||
|
||||
@@ -24,6 +24,20 @@ function! ale_linters#verilog#vlog#Handle(buffer, lines) abort
|
||||
\})
|
||||
endfor
|
||||
|
||||
"Matches patterns like the following:
|
||||
"** Warning: (vlog-2623) add.v(7): Undefined variable: C.
|
||||
"** Error: (vlog-13294) file.v(1): Identifier must be declared with a port mode: C.
|
||||
" let l:pattern = '^**\s\(\w*\):[a-zA-Z0-9\-\.\_\/ ]\+(\(\d\+\)):\s\+\(.*\)'
|
||||
let l:pattern = '^**\s\(\w*\):\s\([^)]*)\)[a-zA-Z0-9\-\.\_\/ ]\+(\(\d\+\)):\s\+\(.*\)'
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[3] + 0,
|
||||
\ 'type': l:match[1] is? 'Error' ? 'E' : 'W',
|
||||
\ 'text': l:match[2] . ' ' . l:match[4],
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
|
||||
61
ale_linters/vim/vimls.vim
Normal file
61
ale_linters/vim/vimls.vim
Normal file
@@ -0,0 +1,61 @@
|
||||
" Author: Jeffrey Lau - https://github.com/zoonfafer
|
||||
" Description: Vim Language Server integration for ALE
|
||||
|
||||
call ale#Set('vim_vimls_executable', 'vim-language-server')
|
||||
call ale#Set('vim_vimls_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
call ale#Set('vim_vimls_config', {})
|
||||
|
||||
function! ale_linters#vim#vimls#GetProjectRoot(buffer) abort
|
||||
let l:trigger_file_candidates = [
|
||||
\ '.vimrc',
|
||||
\ 'init.vim',
|
||||
\]
|
||||
|
||||
for l:candidate in l:trigger_file_candidates
|
||||
let l:trigger_file = fnamemodify(bufname(a:buffer), ':t')
|
||||
|
||||
if l:trigger_file is# l:candidate
|
||||
return fnamemodify(
|
||||
\ bufname(a:buffer),
|
||||
\ ':h',
|
||||
\)
|
||||
endif
|
||||
endfor
|
||||
|
||||
let l:trigger_dir_candidates = [
|
||||
\ 'autoload',
|
||||
\ 'plugin',
|
||||
\ '.git',
|
||||
\]
|
||||
|
||||
let l:path_upwards = ale#path#Upwards(fnamemodify(bufname(a:buffer), ':p:h'))
|
||||
|
||||
for l:path in l:path_upwards
|
||||
for l:candidate in l:trigger_dir_candidates
|
||||
let l:trigger_dir = ale#path#Simplify(
|
||||
\ l:path . '/' . l:candidate,
|
||||
\)
|
||||
|
||||
if isdirectory(l:trigger_dir)
|
||||
return fnamemodify(
|
||||
\ l:trigger_dir,
|
||||
\ ':p:h:h',
|
||||
\)
|
||||
endif
|
||||
endfor
|
||||
endfor
|
||||
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('vim', {
|
||||
\ 'name': 'vimls',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'lsp_config': {b -> ale#Var(b, 'vim_vimls_config')},
|
||||
\ 'executable': {b -> ale#node#FindExecutable(b, 'vim_vimls', [
|
||||
\ 'node_modules/.bin/vim-language-server',
|
||||
\ ])},
|
||||
\ 'command': '%e --stdio',
|
||||
\ 'language': 'vim',
|
||||
\ 'project_root': function('ale_linters#vim#vimls#GetProjectRoot'),
|
||||
\})
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user