mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-07 05:04:28 +08:00
Compare commits
161 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0c17ba2a0f | ||
|
|
2dbfbe7b02 | ||
|
|
ceb2e8d350 | ||
|
|
96d84aec8f | ||
|
|
143c3cd09f | ||
|
|
8e7e810db6 | ||
|
|
aa5c82b171 | ||
|
|
560749cf9e | ||
|
|
1900b76005 | ||
|
|
a59f5776fa | ||
|
|
169a6e26b2 | ||
|
|
e82bcdb8a6 | ||
|
|
a6c6e24d61 | ||
|
|
9d50a06d48 | ||
|
|
d50e603177 | ||
|
|
b278927102 | ||
|
|
6bbbb9456c | ||
|
|
e5b920e387 | ||
|
|
993f02ad80 | ||
|
|
213a901ccd | ||
|
|
4025030d86 | ||
|
|
532686102e | ||
|
|
3c067941f1 | ||
|
|
f09e6d638f | ||
|
|
ddb3e6d57a | ||
|
|
cbf0568061 | ||
|
|
a4a4bba884 | ||
|
|
f9e99d81a4 | ||
|
|
1a13963f0d | ||
|
|
0b163ec656 | ||
|
|
b7fcec4d17 | ||
|
|
fba4cfeae9 | ||
|
|
87743faf2a | ||
|
|
24e26b419a | ||
|
|
dbe9352935 | ||
|
|
56e67c5811 | ||
|
|
21ac9bdcaf | ||
|
|
f1f2a22228 | ||
|
|
a55b8d10b0 | ||
|
|
0868cb769d | ||
|
|
7f1c411b5e | ||
|
|
b01470cbbc | ||
|
|
5c86ffd321 | ||
|
|
43d7e8fde9 | ||
|
|
f380d8508e | ||
|
|
c48106f484 | ||
|
|
96e25d471c | ||
|
|
9e09b7ca35 | ||
|
|
b4513fc4b0 | ||
|
|
78af99c256 | ||
|
|
44070d8a45 | ||
|
|
99e9417ef9 | ||
|
|
bfba216e61 | ||
|
|
f00435e356 | ||
|
|
150015d0dc | ||
|
|
8bbf1425bf | ||
|
|
f516cac47c | ||
|
|
169e4b67d3 | ||
|
|
6e7b7b23e5 | ||
|
|
97ed25a8bf | ||
|
|
0948dcc435 | ||
|
|
395aba19c3 | ||
|
|
b3adf241c3 | ||
|
|
91bb948b90 | ||
|
|
a97ef49c51 | ||
|
|
6e4dccc0e0 | ||
|
|
0ae4ea23c8 | ||
|
|
68ac4d1095 | ||
|
|
f64f0bb48c | ||
|
|
df72c5f1c1 | ||
|
|
9ba2d209a8 | ||
|
|
e0fe97e0a8 | ||
|
|
7b62a15739 | ||
|
|
580bd36773 | ||
|
|
7086769289 | ||
|
|
f1d5bcbf98 | ||
|
|
f8beaa9e3e | ||
|
|
a9333c2866 | ||
|
|
0ed4a5bbcc | ||
|
|
044c762c85 | ||
|
|
d476578a40 | ||
|
|
8f2e1c393f | ||
|
|
43b04d4e5b | ||
|
|
87f125ddcf | ||
|
|
24486fa628 | ||
|
|
fddbfdef12 | ||
|
|
a746ea2bfc | ||
|
|
c1f0956d9b | ||
|
|
3d016f1697 | ||
|
|
8e3bf10592 | ||
|
|
8bf5d144ed | ||
|
|
244c5a8ce5 | ||
|
|
ea01cc708b | ||
|
|
ed26ddc09c | ||
|
|
ee3142b601 | ||
|
|
79f02fce69 | ||
|
|
d4ce201cc2 | ||
|
|
cc5ad6491f | ||
|
|
09e43ab16b | ||
|
|
339930ad68 | ||
|
|
b6112aedc3 | ||
|
|
6212d9a515 | ||
|
|
192f211a0e | ||
|
|
aef11cc0d2 | ||
|
|
1980245b94 | ||
|
|
261c29c3d0 | ||
|
|
228aee71a5 | ||
|
|
b7169c33e7 | ||
|
|
aa015ec4db | ||
|
|
3c85c7ef65 | ||
|
|
adc038f327 | ||
|
|
c4eca7c417 | ||
|
|
c253fb72e3 | ||
|
|
9d7c48038c | ||
|
|
08d141edfb | ||
|
|
1f26fc4013 | ||
|
|
f526fc68d1 | ||
|
|
3afff5a24c | ||
|
|
707b539969 | ||
|
|
2600524274 | ||
|
|
81d0eccfab | ||
|
|
7c10249c52 | ||
|
|
c2f7b379ee | ||
|
|
774c02552f | ||
|
|
aba4160553 | ||
|
|
795122a042 | ||
|
|
18ec66bd21 | ||
|
|
935a132d8f | ||
|
|
b78ee18898 | ||
|
|
4cd20b821f | ||
|
|
a366d325a7 | ||
|
|
f82ab76833 | ||
|
|
61a0716837 | ||
|
|
02fdfcda58 | ||
|
|
ad8b260519 | ||
|
|
faaa11567a | ||
|
|
88ffdb4736 | ||
|
|
4923d48d53 | ||
|
|
764da48c57 | ||
|
|
c467db3ed9 | ||
|
|
484a70f0c0 | ||
|
|
9cdd8b67b2 | ||
|
|
5323f000aa | ||
|
|
04b25c8ee2 | ||
|
|
4179177830 | ||
|
|
a034364994 | ||
|
|
cc114e2d0a | ||
|
|
a88a6d5285 | ||
|
|
c898d5d130 | ||
|
|
db003a4361 | ||
|
|
6167f75628 | ||
|
|
a56e801567 | ||
|
|
e9086dd55c | ||
|
|
63c66dc5d2 | ||
|
|
634bf73f52 | ||
|
|
0702e4699e | ||
|
|
cc84c19451 | ||
|
|
fc94fd4deb | ||
|
|
8faa11752c | ||
|
|
7179f92e44 | ||
|
|
212e3b0b2f |
45
README.md
45
README.md
@@ -7,7 +7,7 @@ ALE (Asynchronous Lint Engine) is a plugin for providing linting 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.">
|
||||
|
||||
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
|
||||
@@ -97,10 +97,10 @@ formatting.
|
||||
| Awk | [gawk](https://www.gnu.org/software/gawk/)|
|
||||
| Bash | [language-server](https://github.com/mads-hartmann/bash-language-server), shell [-n flag](https://www.gnu.org/software/bash/manual/bash.html#index-set), [shellcheck](https://www.shellcheck.net/), [shfmt](https://github.com/mvdan/sh) |
|
||||
| Bourne Shell | shell [-n flag](http://linux.die.net/man/1/sh), [shellcheck](https://www.shellcheck.net/), [shfmt](https://github.com/mvdan/sh) |
|
||||
| C | [cppcheck](http://cppcheck.sourceforge.net), [cpplint](https://github.com/google/styleguide/tree/gh-pages/cpplint), [clang](http://clang.llvm.org/), [clangd](https://clang.llvm.org/extra/clangd.html), [clangtidy](http://clang.llvm.org/extra/clang-tidy/) !!, [clang-format](https://clang.llvm.org/docs/ClangFormat.html), [cquery](https://github.com/cquery-project/cquery), [flawfinder](https://www.dwheeler.com/flawfinder/), [gcc](https://gcc.gnu.org/) |
|
||||
| C++ (filetype cpp) | [clang](http://clang.llvm.org/), [clangcheck](http://clang.llvm.org/docs/ClangCheck.html) !!, [clangtidy](http://clang.llvm.org/extra/clang-tidy/) !!, [clang-format](https://clang.llvm.org/docs/ClangFormat.html), [cppcheck](http://cppcheck.sourceforge.net), [cpplint](https://github.com/google/styleguide/tree/gh-pages/cpplint) !!, [cquery](https://github.com/cquery-project/cquery), [flawfinder](https://www.dwheeler.com/flawfinder/), [gcc](https://gcc.gnu.org/) |
|
||||
| C | [cppcheck](http://cppcheck.sourceforge.net), [cpplint](https://github.com/google/styleguide/tree/gh-pages/cpplint), [clang](http://clang.llvm.org/), [clangd](https://clang.llvm.org/extra/clangd.html), [clangtidy](http://clang.llvm.org/extra/clang-tidy/) !!, [clang-format](https://clang.llvm.org/docs/ClangFormat.html), [cquery](https://github.com/cquery-project/cquery), [flawfinder](https://www.dwheeler.com/flawfinder/), [gcc](https://gcc.gnu.org/), [uncrustify](https://github.com/uncrustify/uncrustify) |
|
||||
| C++ (filetype cpp) | [clang](http://clang.llvm.org/), [clangd](https://clang.llvm.org/extra/clangd.html), [clangcheck](http://clang.llvm.org/docs/ClangCheck.html) !!, [clangtidy](http://clang.llvm.org/extra/clang-tidy/) !!, [clang-format](https://clang.llvm.org/docs/ClangFormat.html), [clazy](https://github.com/KDE/clazy) !!, [cppcheck](http://cppcheck.sourceforge.net), [cpplint](https://github.com/google/styleguide/tree/gh-pages/cpplint) !!, [cquery](https://github.com/cquery-project/cquery), [flawfinder](https://www.dwheeler.com/flawfinder/), [gcc](https://gcc.gnu.org/), [uncrustify](https://github.com/uncrustify/uncrustify) |
|
||||
| CUDA | [nvcc](http://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/index.html) |
|
||||
| C# | [mcs](http://www.mono-project.com/docs/about-mono/languages/csharp/) see:`help ale-cs-mcs` for details, [mcsc](http://www.mono-project.com/docs/about-mono/languages/csharp/) !! see:`help ale-cs-mcsc` for details and configuration|
|
||||
| C# | [mcs](http://www.mono-project.com/docs/about-mono/languages/csharp/) see:`help ale-cs-mcs` for details, [mcsc](http://www.mono-project.com/docs/about-mono/languages/csharp/) !! see:`help ale-cs-mcsc` for details and configuration, [uncrustify](https://github.com/uncrustify/uncrustify) |
|
||||
| Chef | [foodcritic](http://www.foodcritic.io/) |
|
||||
| Clojure | [joker](https://github.com/candid82/joker) |
|
||||
| CloudFormation | [cfn-python-lint](https://github.com/awslabs/cfn-python-lint) |
|
||||
@@ -110,7 +110,7 @@ formatting.
|
||||
| CSS | [csslint](http://csslint.net/), [prettier](https://github.com/prettier/prettier), [stylelint](https://github.com/stylelint/stylelint) |
|
||||
| Cucumber | [cucumber](https://cucumber.io/) |
|
||||
| Cython (pyrex filetype) | [cython](http://cython.org/) |
|
||||
| D | [dmd](https://dlang.org/dmd-linux.html) |
|
||||
| D | [dmd](https://dlang.org/dmd-linux.html), [uncrustify](https://github.com/uncrustify/uncrustify) |
|
||||
| Dafny | [dafny](https://rise4fun.com/Dafny) !! |
|
||||
| Dart | [dartanalyzer](https://github.com/dart-lang/sdk/tree/master/pkg/analyzer_cli) !!, [language_server](https://github.com/natebosch/dart_language_server), [dartfmt](https://github.com/dart-lang/sdk/tree/master/utils/dartfmt) |
|
||||
| Dockerfile | [hadolint](https://github.com/hadolint/hadolint) |
|
||||
@@ -124,17 +124,18 @@ formatting.
|
||||
| FusionScript | [fusion-lint](https://github.com/RyanSquared/fusionscript) |
|
||||
| Git Commit Messages | [gitlint](https://github.com/jorisroovers/gitlint) |
|
||||
| GLSL | [glslang](https://github.com/KhronosGroup/glslang), [glslls](https://github.com/svenstaro/glsl-language-server) |
|
||||
| Go | [gofmt](https://golang.org/cmd/gofmt/), [goimports](https://godoc.org/golang.org/x/tools/cmd/goimports), [go vet](https://golang.org/cmd/vet/) !!, [golint](https://godoc.org/github.com/golang/lint), [gotype](https://godoc.org/golang.org/x/tools/cmd/gotype) !!, [gometalinter](https://github.com/alecthomas/gometalinter) !!, [go build](https://golang.org/cmd/go/) !!, [gosimple](https://github.com/dominikh/go-tools/tree/master/cmd/gosimple) !!, [staticcheck](https://github.com/dominikh/go-tools/tree/master/cmd/staticcheck) !! |
|
||||
| Go | [gofmt](https://golang.org/cmd/gofmt/), [goimports](https://godoc.org/golang.org/x/tools/cmd/goimports), [go mod](https://golang.org/cmd/go/) !!, [go vet](https://golang.org/cmd/vet/) !!, [golint](https://godoc.org/github.com/golang/lint), [gotype](https://godoc.org/golang.org/x/tools/cmd/gotype) !!, [gometalinter](https://github.com/alecthomas/gometalinter) !!, [go build](https://golang.org/cmd/go/) !!, [gosimple](https://github.com/dominikh/go-tools/tree/master/cmd/gosimple) !!, [staticcheck](https://github.com/dominikh/go-tools/tree/master/cmd/staticcheck) !!, [golangserver](https://github.com/sourcegraph/go-langserver), [golangci-lint](https://github.com/golangci/golangci-lint) !! |
|
||||
| GraphQL | [eslint](http://eslint.org/), [gqlint](https://github.com/happylinks/gqlint), [prettier](https://github.com/prettier/prettier) |
|
||||
| Hack | [hack](http://hacklang.org/), [hackfmt](https://github.com/facebook/hhvm/tree/master/hphp/hack/hackfmt), [hhast](https://github.com/hhvm/hhast) (disabled by default; see `:help ale-integration-hack`) |
|
||||
| Haml | [haml-lint](https://github.com/brigade/haml-lint) |
|
||||
| Handlebars | [ember-template-lint](https://github.com/rwjblue/ember-template-lint) |
|
||||
| Haskell | [brittany](https://github.com/lspitzner/brittany), [ghc](https://www.haskell.org/ghc/), [cabal-ghc](https://www.haskell.org/cabal/), [stack-ghc](https://haskellstack.org/), [stack-build](https://haskellstack.org/) !!, [ghc-mod](https://github.com/DanielG/ghc-mod), [stack-ghc-mod](https://github.com/DanielG/ghc-mod), [hlint](https://hackage.haskell.org/package/hlint), [hdevtools](https://hackage.haskell.org/package/hdevtools), [hfmt](https://github.com/danstiner/hfmt), [hie](https://github.com/haskell/haskell-ide-engine) |
|
||||
| Haskell | [brittany](https://github.com/lspitzner/brittany), [ghc](https://www.haskell.org/ghc/), [cabal-ghc](https://www.haskell.org/cabal/), [stylish-haskell](https://github.com/jaspervdj/stylish-haskell), [stack-ghc](https://haskellstack.org/), [stack-build](https://haskellstack.org/) !!, [ghc-mod](https://github.com/DanielG/ghc-mod), [stack-ghc-mod](https://github.com/DanielG/ghc-mod), [hlint](https://hackage.haskell.org/package/hlint), [hdevtools](https://hackage.haskell.org/package/hdevtools), [hfmt](https://github.com/danstiner/hfmt), [hie](https://github.com/haskell/haskell-ide-engine) |
|
||||
| HTML | [alex](https://github.com/wooorm/alex) !!, [HTMLHint](http://htmlhint.com/), [proselint](http://proselint.com/), [tidy](http://www.html-tidy.org/), [write-good](https://github.com/btford/write-good) |
|
||||
| Idris | [idris](http://www.idris-lang.org/) |
|
||||
| Java | [checkstyle](http://checkstyle.sourceforge.net), [javac](http://www.oracle.com/technetwork/java/javase/downloads/index.html), [google-java-format](https://github.com/google/google-java-format), [PMD](https://pmd.github.io/) |
|
||||
| Java | [checkstyle](http://checkstyle.sourceforge.net), [javac](http://www.oracle.com/technetwork/java/javase/downloads/index.html), [google-java-format](https://github.com/google/google-java-format), [PMD](https://pmd.github.io/), [javalsp](https://github.com/georgewfraser/vscode-javac), [uncrustify](https://github.com/uncrustify/uncrustify) |
|
||||
| JavaScript | [eslint](http://eslint.org/), [flow](https://flowtype.org/), [jscs](http://jscs.info/), [jshint](http://jshint.com/), [prettier](https://github.com/prettier/prettier), [prettier-eslint](https://github.com/prettier/prettier-eslint-cli), [prettier-standard](https://github.com/sheerun/prettier-standard), [standard](http://standardjs.com/), [xo](https://github.com/sindresorhus/xo)
|
||||
| JSON | [fixjson](https://github.com/rhysd/fixjson), [jsonlint](http://zaa.ch/jsonlint/), [jq](https://stedolan.github.io/jq/), [prettier](https://github.com/prettier/prettier) |
|
||||
| Julia | [languageserver](https://github.com/JuliaEditorSupport/LanguageServer.jl) |
|
||||
| Kotlin | [kotlinc](https://kotlinlang.org) !!, [ktlint](https://ktlint.github.io) !!, [languageserver](https://github.com/fwcd/KotlinLanguageServer) see `:help ale-integration-kotlin` for configuration instructions |
|
||||
| LaTeX | [alex](https://github.com/wooorm/alex) !!, [chktex](http://www.nongnu.org/chktex/), [lacheck](https://www.ctan.org/pkg/lacheck), [proselint](http://proselint.com/), [redpen](http://redpen.cc/), [vale](https://github.com/ValeLint/vale), [write-good](https://github.com/btford/write-good) |
|
||||
| Less | [lessc](https://www.npmjs.com/package/less), [prettier](https://github.com/prettier/prettier), [stylelint](https://github.com/stylelint/stylelint) |
|
||||
@@ -149,9 +150,10 @@ formatting.
|
||||
| Nim | [nim check](https://nim-lang.org/docs/nimc.html) !! |
|
||||
| nix | [nix-instantiate](http://nixos.org/nix/manual/#sec-nix-instantiate) |
|
||||
| nroff | [alex](https://github.com/wooorm/alex) !!, [proselint](http://proselint.com/), [write-good](https://github.com/btford/write-good)|
|
||||
| Objective-C | [clang](http://clang.llvm.org/) |
|
||||
| Objective-C++ | [clang](http://clang.llvm.org/) |
|
||||
| OCaml | [merlin](https://github.com/the-lambda-church/merlin) see `:help ale-ocaml-merlin` for configuration instructions, [ols](https://github.com/freebroccolo/ocaml-language-server) |
|
||||
| Objective-C | [clang](http://clang.llvm.org/), [clangd](https://clang.llvm.org/extra/clangd.html), [uncrustify](https://github.com/uncrustify/uncrustify) |
|
||||
| Objective-C++ | [clang](http://clang.llvm.org/), [clangd](https://clang.llvm.org/extra/clangd.html), [uncrustify](https://github.com/uncrustify/uncrustify) |
|
||||
| OCaml | [merlin](https://github.com/the-lambda-church/merlin) see `:help ale-ocaml-merlin` for configuration instructions, [ols](https://github.com/freebroccolo/ocaml-language-server), [ocamlformat](https://github.com/ocaml-ppx/ocamlformat) |
|
||||
| Pawn | [uncrustify](https://github.com/uncrustify/uncrustify) |
|
||||
| Perl | [perl -c](https://perl.org/), [perl-critic](https://metacpan.org/pod/Perl::Critic), [perltidy](https://metacpan.org/pod/distribution/Perl-Tidy/bin/perltidy) |
|
||||
| PHP | [langserver](https://github.com/felixfbecker/php-language-server), [phan](https://github.com/phan/phan) see `:help ale-php-phan` to instructions, [php -l](https://secure.php.net/), [phpcs](https://github.com/squizlabs/PHP_CodeSniffer), [phpmd](https://phpmd.org), [phpstan](https://github.com/phpstan/phpstan), [phpcbf](https://github.com/squizlabs/PHP_CodeSniffer), [php-cs-fixer](http://cs.sensiolabs.org/) |
|
||||
| PO | [alex](https://github.com/wooorm/alex) !!, [msgfmt](https://www.gnu.org/software/gettext/manual/html_node/msgfmt-Invocation.html), [proselint](http://proselint.com/), [write-good](https://github.com/btford/write-good) |
|
||||
@@ -160,23 +162,23 @@ formatting.
|
||||
| proto | [protoc-gen-lint](https://github.com/ckaznocha/protoc-gen-lint) |
|
||||
| Pug | [pug-lint](https://github.com/pugjs/pug-lint) |
|
||||
| Puppet | [languageserver](https://github.com/lingua-pupuli/puppet-editor-services), [puppet](https://puppet.com), [puppet-lint](https://puppet-lint.com) |
|
||||
| Python | [autopep8](https://github.com/hhatto/autopep8), [black](https://github.com/ambv/black), [flake8](http://flake8.pycqa.org/en/latest/), [isort](https://github.com/timothycrosley/isort), [mypy](http://mypy-lang.org/), [prospector](http://github.com/landscapeio/prospector), [pycodestyle](https://github.com/PyCQA/pycodestyle), [pyls](https://github.com/palantir/python-language-server), [pyre](https://github.com/facebook/pyre-check), [pylint](https://www.pylint.org/) !!, [vulture](https://github.com/jendrikseipp/vulture) !!, [yapf](https://github.com/google/yapf) |
|
||||
| Python | [autopep8](https://github.com/hhatto/autopep8), [black](https://github.com/ambv/black), [flake8](http://flake8.pycqa.org/en/latest/), [isort](https://github.com/timothycrosley/isort), [mypy](http://mypy-lang.org/), [prospector](https://github.com/PyCQA/prospector), [pycodestyle](https://github.com/PyCQA/pycodestyle), [pyls](https://github.com/palantir/python-language-server), [pyre](https://github.com/facebook/pyre-check), [pylint](https://www.pylint.org/) !!, [vulture](https://github.com/jendrikseipp/vulture) !!, [yapf](https://github.com/google/yapf) |
|
||||
| QML | [qmlfmt](https://github.com/jesperhh/qmlfmt), [qmllint](https://github.com/qt/qtdeclarative/tree/5.11/tools/qmllint) |
|
||||
| R | [lintr](https://github.com/jimhester/lintr) |
|
||||
| ReasonML | [merlin](https://github.com/the-lambda-church/merlin) see `:help ale-reasonml-ols` for configuration instructions, [ols](https://github.com/freebroccolo/ocaml-language-server), [refmt](https://github.com/reasonml/reason-cli) |
|
||||
| reStructuredText | [alex](https://github.com/wooorm/alex) !!, [proselint](http://proselint.com/), [redpen](http://redpen.cc/), [rstcheck](https://github.com/myint/rstcheck), [vale](https://github.com/ValeLint/vale), [write-good](https://github.com/btford/write-good) |
|
||||
| Re:VIEW | [redpen](http://redpen.cc/) |
|
||||
| RPM spec | [rpmlint](https://github.com/rpm-software-management/rpmlint) (disabled by default; see `:help ale-integration-spec`) |
|
||||
| Ruby | [brakeman](http://brakemanscanner.org/) !!, [rails_best_practices](https://github.com/flyerhzm/rails_best_practices) !!, [reek](https://github.com/troessner/reek), [rubocop](https://github.com/bbatsov/rubocop), [ruby](https://www.ruby-lang.org), [rufo](https://github.com/ruby-formatter/rufo) |
|
||||
| Ruby | [brakeman](http://brakemanscanner.org/) !!, [rails_best_practices](https://github.com/flyerhzm/rails_best_practices) !!, [reek](https://github.com/troessner/reek), [rubocop](https://github.com/bbatsov/rubocop), [ruby](https://www.ruby-lang.org), [rufo](https://github.com/ruby-formatter/rufo), [solargraph](https://solargraph.org) |
|
||||
| Rust | cargo !! (see `:help ale-integration-rust` for configuration instructions), [rls](https://github.com/rust-lang-nursery/rls), [rustc](https://www.rust-lang.org/), [rustfmt](https://github.com/rust-lang-nursery/rustfmt) |
|
||||
| SASS | [sass-lint](https://www.npmjs.com/package/sass-lint), [stylelint](https://github.com/stylelint/stylelint) |
|
||||
| SCSS | [prettier](https://github.com/prettier/prettier), [sass-lint](https://www.npmjs.com/package/sass-lint), [scss-lint](https://github.com/brigade/scss-lint), [stylelint](https://github.com/stylelint/stylelint) |
|
||||
| Scala | [fsc](https://www.scala-lang.org/old/sites/default/files/linuxsoft_archives/docu/files/tools/fsc.html), [scalac](http://scala-lang.org), [scalafmt](https://scalameta.org/scalafmt/), [scalastyle](http://www.scalastyle.org) |
|
||||
| Scala | [fsc](https://www.scala-lang.org/old/sites/default/files/linuxsoft_archives/docu/files/tools/fsc.html), [sbtserver](https://www.scala-sbt.org/1.x/docs/sbt-server.html), [scalac](http://scala-lang.org), [scalafmt](https://scalameta.org/scalafmt/), [scalastyle](http://www.scalastyle.org)|
|
||||
| Slim | [slim-lint](https://github.com/sds/slim-lint) |
|
||||
| SML | [smlnj](http://www.smlnj.org/) |
|
||||
| Solidity | [solhint](https://github.com/protofire/solhint), [solium](https://github.com/duaraghav8/Solium) |
|
||||
| Stylus | [stylelint](https://github.com/stylelint/stylelint) |
|
||||
| SQL | [sqlint](https://github.com/purcell/sqlint) |
|
||||
| SQL | [sqlint](https://github.com/purcell/sqlint), [sqlfmt](https://github.com/jackc/sqlfmt) |
|
||||
| Swift | [swiftlint](https://github.com/realm/SwiftLint), [swiftformat](https://github.com/nicklockwood/SwiftFormat) |
|
||||
| Tcl | [nagelfar](http://nagelfar.sourceforge.net) !! |
|
||||
| Terraform | [tflint](https://github.com/wata727/tflint) |
|
||||
@@ -184,13 +186,14 @@ formatting.
|
||||
| Text^ | [alex](https://github.com/wooorm/alex) !!, [proselint](http://proselint.com/), [redpen](http://redpen.cc/), [textlint](https://textlint.github.io/), [vale](https://github.com/ValeLint/vale), [write-good](https://github.com/btford/write-good) |
|
||||
| Thrift | [thrift](http://thrift.apache.org/) |
|
||||
| TypeScript | [eslint](http://eslint.org/), [prettier](https://github.com/prettier/prettier), [tslint](https://github.com/palantir/tslint), tsserver, typecheck |
|
||||
| VALA | [uncrustify](https://github.com/uncrustify/uncrustify) |
|
||||
| Verilog | [iverilog](https://github.com/steveicarus/iverilog), [verilator](http://www.veripool.org/projects/verilator/wiki/Intro) |
|
||||
| Vim | [vint](https://github.com/Kuniwak/vint) |
|
||||
| Vim help^ | [alex](https://github.com/wooorm/alex) !!, [proselint](http://proselint.com/), [write-good](https://github.com/btford/write-good) |
|
||||
| Vue | [prettier](https://github.com/prettier/prettier), [vls](https://github.com/vuejs/vetur/tree/master/server) |
|
||||
| XHTML | [alex](https://github.com/wooorm/alex) !!, [proselint](http://proselint.com/), [write-good](https://github.com/btford/write-good) |
|
||||
| XML | [xmllint](http://xmlsoft.org/xmllint.html) |
|
||||
| YAML | [swaglint](https://github.com/byCedric/swaglint), [yamllint](https://yamllint.readthedocs.io/) |
|
||||
| YAML | [prettier](https://github.com/prettier/prettier), [swaglint](https://github.com/byCedric/swaglint), [yamllint](https://yamllint.readthedocs.io/) |
|
||||
| YANG | [yang-lsp](https://github.com/theia-ide/yang-lsp) |
|
||||
|
||||
<a name="usage"></a>
|
||||
@@ -231,12 +234,18 @@ let b:ale_fixers = ['prettier', 'eslint']
|
||||
let b:ale_fixers = {'javascript': ['prettier', 'eslint']}
|
||||
```
|
||||
|
||||
You can also configure your fixers from vimrc using `g:ale_fixers`, before
|
||||
or after ALE has been loaded.
|
||||
You can also configure your fixers from vimrc using `g:ale_fixers`, before or
|
||||
after ALE has been loaded.
|
||||
|
||||
A `*` in place of the filetype will apply a List of fixers to all files which
|
||||
do not match some filetype in the Dictionary.
|
||||
|
||||
Note that using a plain List for `g:ale_fixers` is not supported.
|
||||
|
||||
```vim
|
||||
" In ~/.vim/vimrc, or somewhere similar.
|
||||
let g:ale_fixers = {
|
||||
\ '*': ['remove_trailing_lines', 'trim_whitespace'],
|
||||
\ 'javascript': ['eslint'],
|
||||
\}
|
||||
```
|
||||
|
||||
@@ -16,10 +16,12 @@ function! ale_linters#apiblueprint#drafter#HandleErrors(buffer, lines) abort
|
||||
\ 'lnum': l:match[3] + 0,
|
||||
\ 'col': l:match[4] + 0,
|
||||
\}
|
||||
|
||||
if l:match[5] isnot# ''
|
||||
let l:item.end_lnum = l:match[6] + 0
|
||||
let l:item.end_col = l:match[7] + 0
|
||||
endif
|
||||
|
||||
call add(l:output, l:item)
|
||||
endfor
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ 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
|
||||
|
||||
|
||||
@@ -16,27 +16,9 @@ call ale#Set('c_clangtidy_checks', ['*'])
|
||||
call ale#Set('c_clangtidy_options', '')
|
||||
call ale#Set('c_build_dir', '')
|
||||
|
||||
function! s:GetBuildDirectory(buffer) abort
|
||||
" Don't include build directory for header files, as compile_commands.json
|
||||
" files don't consider headers to be translation units, and provide no
|
||||
" commands for compiling header files.
|
||||
if expand('#' . a:buffer) =~# '\v\.(h|hpp)$'
|
||||
return ''
|
||||
endif
|
||||
|
||||
let l:build_dir = ale#Var(a:buffer, 'c_build_dir')
|
||||
|
||||
" c_build_dir has the priority if defined
|
||||
if !empty(l:build_dir)
|
||||
return l:build_dir
|
||||
endif
|
||||
|
||||
return ale#path#Dirname(ale#c#FindCompileCommands(a:buffer))
|
||||
endfunction
|
||||
|
||||
function! ale_linters#c#clangtidy#GetCommand(buffer) abort
|
||||
let l:checks = join(ale#Var(a:buffer, 'c_clangtidy_checks'), ',')
|
||||
let l:build_dir = s:GetBuildDirectory(a:buffer)
|
||||
let l:build_dir = ale#c#GetBuildDirectory(a:buffer)
|
||||
|
||||
" Get the extra options if we couldn't find a build directory.
|
||||
let l:options = empty(l:build_dir)
|
||||
|
||||
@@ -6,6 +6,11 @@ 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')
|
||||
|
||||
if empty(l:project_root)
|
||||
let l:project_root = ale#path#FindNearestFile(a:buffer, '.cquery')
|
||||
endif
|
||||
|
||||
return !empty(l:project_root) ? fnamemodify(l:project_root, ':h') : ''
|
||||
endfunction
|
||||
|
||||
|
||||
@@ -9,9 +9,11 @@ function! ale_linters#clojure#joker#HandleJokerFormat(buffer, lines) abort
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
let l:type = 'E'
|
||||
|
||||
if l:match[4] is? 'Parse warning'
|
||||
let l:type = 'W'
|
||||
endif
|
||||
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[1] + 0,
|
||||
\ 'col': l:match[2] + 0,
|
||||
|
||||
23
ale_linters/cpp/clangd.vim
Normal file
23
ale_linters/cpp/clangd.vim
Normal file
@@ -0,0 +1,23 @@
|
||||
" Author: Andrey Melentyev <andrey.melentyev@protonmail.com>
|
||||
" Description: Clangd language server
|
||||
|
||||
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
|
||||
|
||||
function! ale_linters#cpp#clangd#GetCommand(buffer) abort
|
||||
return '%e' . ale#Pad(ale#Var(a:buffer, 'cpp_clangd_options'))
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('cpp', {
|
||||
\ 'name': 'clangd',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable_callback': ale#VarFunc('cpp_clangd_executable'),
|
||||
\ 'command_callback': 'ale_linters#cpp#clangd#GetCommand',
|
||||
\ 'project_root_callback': 'ale_linters#cpp#clangd#GetProjectRoot',
|
||||
\})
|
||||
@@ -10,27 +10,9 @@ call ale#Set('cpp_clangtidy_checks', ['*'])
|
||||
call ale#Set('cpp_clangtidy_options', '')
|
||||
call ale#Set('c_build_dir', '')
|
||||
|
||||
function! s:GetBuildDirectory(buffer) abort
|
||||
" Don't include build directory for header files, as compile_commands.json
|
||||
" files don't consider headers to be translation units, and provide no
|
||||
" commands for compiling header files.
|
||||
if expand('#' . a:buffer) =~# '\v\.(h|hpp)$'
|
||||
return ''
|
||||
endif
|
||||
|
||||
let l:build_dir = ale#Var(a:buffer, 'c_build_dir')
|
||||
|
||||
" c_build_dir has the priority if defined
|
||||
if !empty(l:build_dir)
|
||||
return l:build_dir
|
||||
endif
|
||||
|
||||
return ale#path#Dirname(ale#c#FindCompileCommands(a:buffer))
|
||||
endfunction
|
||||
|
||||
function! ale_linters#cpp#clangtidy#GetCommand(buffer) abort
|
||||
let l:checks = join(ale#Var(a:buffer, 'cpp_clangtidy_checks'), ',')
|
||||
let l:build_dir = s:GetBuildDirectory(a:buffer)
|
||||
let l:build_dir = ale#c#GetBuildDirectory(a:buffer)
|
||||
|
||||
" Get the extra options if we couldn't find a build directory.
|
||||
let l:options = empty(l:build_dir)
|
||||
|
||||
32
ale_linters/cpp/clazy.vim
Normal file
32
ale_linters/cpp/clazy.vim
Normal file
@@ -0,0 +1,32 @@
|
||||
" Description: clazy linter for cpp files (clang-based and Qt-oriented)
|
||||
|
||||
call ale#Set('cpp_clazy_executable', 'clazy-standalone')
|
||||
" Set this option to check the checks clazy will apply.
|
||||
call ale#Set('cpp_clazy_checks', ['level1'])
|
||||
" Set this option to manually set some options for clazy.
|
||||
" This will disable compile_commands.json detection.
|
||||
call ale#Set('cpp_clazy_options', '')
|
||||
call ale#Set('c_build_dir', '')
|
||||
|
||||
function! ale_linters#cpp#clazy#GetCommand(buffer) abort
|
||||
let l:checks = join(ale#Var(a:buffer, 'cpp_clazy_checks'), ',')
|
||||
let l:build_dir = ale#c#GetBuildDirectory(a:buffer)
|
||||
|
||||
" Get the extra options if we couldn't find a build directory.
|
||||
let l:options = ale#Var(a:buffer, 'cpp_clazy_options')
|
||||
|
||||
return '%e'
|
||||
\ . (!empty(l:checks) ? ' -checks=' . ale#Escape(l:checks) : '')
|
||||
\ . (!empty(l:build_dir) ? ' -p ' . ale#Escape(l:build_dir) : '')
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
\ . ' %s'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('cpp', {
|
||||
\ 'name': 'clazy',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable_callback': ale#VarFunc('cpp_clazy_executable'),
|
||||
\ 'command_callback': 'ale_linters#cpp#clazy#GetCommand',
|
||||
\ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
||||
@@ -7,6 +7,10 @@ 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')
|
||||
|
||||
if empty(l:project_root)
|
||||
let l:project_root = ale#path#FindNearestFile(a:buffer, '.cquery')
|
||||
endif
|
||||
|
||||
return !empty(l:project_root) ? fnamemodify(l:project_root, ':h') : ''
|
||||
endfunction
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ function! ale_linters#cucumber#cucumber#Handle(buffer, lines) abort
|
||||
endtry
|
||||
|
||||
let l:output = []
|
||||
|
||||
for l:element in get(l:json, 'elements', [])
|
||||
for l:step in l:element['steps']
|
||||
if l:step['result']['status'] is# 'undefined'
|
||||
|
||||
@@ -8,7 +8,6 @@ function! ale_linters#cuda#nvcc#GetCommand(buffer) abort
|
||||
" Unused: use ale#util#nul_file
|
||||
" let l:output_file = ale#util#Tempname() . '.ii'
|
||||
" call ale#engine#ManageFile(a:buffer, l:output_file)
|
||||
|
||||
return '%e -cuda'
|
||||
\ . ale#Pad(ale#c#IncludeOptions(ale#c#FindLocalHeaderPaths(a:buffer)))
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'cuda_nvcc_options'))
|
||||
@@ -23,7 +22,6 @@ function! ale_linters#cuda#nvcc#HandleNVCCFormat(buffer, lines) abort
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
|
||||
let l:item = {
|
||||
\ 'lnum': str2nr(l:match[2]),
|
||||
\ 'type': l:match[4] =~# 'error' ? 'E' : 'W',
|
||||
|
||||
@@ -13,6 +13,7 @@ function! ale_linters#dafny#dafny#Handle(buffer, lines) abort
|
||||
\ 'type': l:match[4] =~# '^Error' ? 'E' : 'W'
|
||||
\ })
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
|
||||
@@ -15,6 +15,6 @@ call ale#linter#Define('dart', {
|
||||
\ 'name': 'language_server',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable_callback': ale#VarFunc('dart_language_server_executable'),
|
||||
\ 'command_callback': 'ale_linters#dart#language_server#GetExecutable',
|
||||
\ 'command': '%e',
|
||||
\ 'project_root_callback': 'ale_linters#dart#language_server#GetProjectRoot',
|
||||
\})
|
||||
|
||||
@@ -82,9 +82,11 @@ endfunction
|
||||
|
||||
function! ale_linters#dockerfile#hadolint#GetCommand(buffer) abort
|
||||
let l:command = ale_linters#dockerfile#hadolint#GetExecutable(a:buffer)
|
||||
|
||||
if l:command is# 'docker'
|
||||
return 'docker run --rm -i ' . ale#Var(a:buffer, 'dockerfile_hadolint_docker_image')
|
||||
endif
|
||||
|
||||
return 'hadolint -'
|
||||
endfunction
|
||||
|
||||
|
||||
@@ -29,9 +29,16 @@ function! ale_linters#elixir#credo#Handle(buffer, lines) abort
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
function! ale_linters#elixir#credo#GetCommand(buffer) abort
|
||||
let l:project_root = ale#handlers#elixir#FindMixProjectRoot(a:buffer)
|
||||
|
||||
return ale#path#CdString(l:project_root)
|
||||
\ . ' mix help credo && mix credo suggest --format=flycheck --read-from-stdin %s'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('elixir', {
|
||||
\ 'name': 'credo',
|
||||
\ 'executable': 'mix',
|
||||
\ 'command': 'mix help credo && mix credo suggest --format=flycheck --read-from-stdin %s',
|
||||
\ 'command_callback': 'ale_linters#elixir#credo#GetCommand',
|
||||
\ 'callback': 'ale_linters#elixir#credo#Handle',
|
||||
\})
|
||||
|
||||
@@ -25,10 +25,17 @@ function! ale_linters#elixir#dialyxir#Handle(buffer, lines) abort
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
function! ale_linters#elixir#dialyxir#GetCommand(buffer) abort
|
||||
let l:project_root = ale#handlers#elixir#FindMixProjectRoot(a:buffer)
|
||||
|
||||
return ale#path#CdString(l:project_root)
|
||||
\ . ' mix help dialyzer && mix dialyzer'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('elixir', {
|
||||
\ 'name': 'dialyxir',
|
||||
\ 'executable': 'mix',
|
||||
\ 'command': 'mix help dialyzer && mix dialyzer',
|
||||
\ 'command_callback': 'ale_linters#elixir#dialyxir#GetCommand',
|
||||
\ 'callback': 'ale_linters#elixir#dialyxir#Handle',
|
||||
\})
|
||||
|
||||
|
||||
@@ -29,10 +29,17 @@ function! ale_linters#elixir#dogma#Handle(buffer, lines) abort
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
function! ale_linters#elixir#dogma#GetCommand(buffer) abort
|
||||
let l:project_root = ale#handlers#elixir#FindMixProjectRoot(a:buffer)
|
||||
|
||||
return ale#path#CdString(l:project_root)
|
||||
\ . ' mix help dogma && mix dogma %s --format=flycheck'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('elixir', {
|
||||
\ 'name': 'dogma',
|
||||
\ 'executable': 'mix',
|
||||
\ 'command': 'mix help dogma && mix dogma %s --format=flycheck',
|
||||
\ 'command_callback': 'ale_linters#elixir#dogma#GetCommand',
|
||||
\ 'lint_file': 1,
|
||||
\ 'callback': 'ale_linters#elixir#dogma#Handle',
|
||||
\})
|
||||
|
||||
@@ -10,7 +10,6 @@ function! ale_linters#elixir#mix#Handle(buffer, lines) abort
|
||||
"
|
||||
" TODO: Warning format
|
||||
" warning: variable "foobar" does not exist and is being expanded to "foobar()", please use parentheses to remove the ambiguity or change the variable name
|
||||
|
||||
let l:pattern = '\v\(([^\)]+Error)\) ([^:]+):([^:]+): (.+)$'
|
||||
let l:output = []
|
||||
|
||||
@@ -30,16 +29,8 @@ function! ale_linters#elixir#mix#Handle(buffer, lines) abort
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
function! ale_linters#elixir#mix#FindProjectRoot(buffer) abort
|
||||
let l:mix_file = ale#path#FindNearestFile(a:buffer, 'mix.exs')
|
||||
if !empty(l:mix_file)
|
||||
return fnamemodify(l:mix_file, ':p:h')
|
||||
endif
|
||||
return '.'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#elixir#mix#GetCommand(buffer) abort
|
||||
let l:project_root = ale_linters#elixir#mix#FindProjectRoot(a:buffer)
|
||||
let l:project_root = ale#handlers#elixir#FindMixProjectRoot(a:buffer)
|
||||
|
||||
let l:temp_dir = ale#engine#CreateDirectory(a:buffer)
|
||||
|
||||
@@ -48,8 +39,8 @@ function! ale_linters#elixir#mix#GetCommand(buffer) abort
|
||||
\ : 'MIX_BUILD_PATH=' . ale#Escape(l:temp_dir)
|
||||
|
||||
return ale#path#CdString(l:project_root)
|
||||
\ . l:mix_build_path
|
||||
\ . ' mix compile %s'
|
||||
\ . l:mix_build_path
|
||||
\ . ' mix compile %s'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('elixir', {
|
||||
|
||||
@@ -23,8 +23,10 @@ function! ale_linters#gitcommit#gitlint#Handle(buffer, lines) abort
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
let l:code = l:match[2]
|
||||
|
||||
if l:code is# 'T2' && !ale#Var(a:buffer, 'warn_about_trailing_whitespace')
|
||||
continue
|
||||
if !ale#Var(a:buffer, 'warn_about_trailing_whitespace')
|
||||
if l:code is# 'T2' || l:code is# 'B2'
|
||||
continue
|
||||
endif
|
||||
endif
|
||||
|
||||
let l:item = {
|
||||
|
||||
@@ -3,38 +3,15 @@
|
||||
" Description: go build for Go files
|
||||
" inspired by work from dzhou121 <dzhou121@gmail.com>
|
||||
|
||||
call ale#Set('go_go_executable', 'go')
|
||||
call ale#Set('go_gobuild_options', '')
|
||||
|
||||
function! ale_linters#go#gobuild#ResetEnv() abort
|
||||
unlet! s:go_env
|
||||
endfunction
|
||||
|
||||
function! ale_linters#go#gobuild#GoEnv(buffer) abort
|
||||
if exists('s:go_env')
|
||||
return ''
|
||||
endif
|
||||
|
||||
return 'go env GOPATH GOROOT'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#go#gobuild#GetCommand(buffer, goenv_output) abort
|
||||
function! ale_linters#go#gobuild#GetCommand(buffer) abort
|
||||
let l:options = ale#Var(a:buffer, 'go_gobuild_options')
|
||||
|
||||
if !exists('s:go_env')
|
||||
let s:go_env = {
|
||||
\ 'GOPATH': a:goenv_output[0],
|
||||
\ 'GOROOT': a:goenv_output[1],
|
||||
\}
|
||||
endif
|
||||
|
||||
let l:gopath_env_command = has('win32')
|
||||
\ ? 'set GOPATH=' . ale#Escape(s:go_env.GOPATH) . ' && '
|
||||
\ : 'GOPATH=' . ale#Escape(s:go_env.GOPATH) . ' '
|
||||
|
||||
" Run go test in local directory with relative path
|
||||
return l:gopath_env_command
|
||||
\ . ale#path#BufferCdString(a:buffer)
|
||||
\ . 'go test'
|
||||
return ale#path#BufferCdString(a:buffer)
|
||||
\ . ale#Var(a:buffer, 'go_go_executable') . ' test'
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
\ . ' -c -o /dev/null ./'
|
||||
endfunction
|
||||
@@ -45,7 +22,6 @@ function! ale_linters#go#gobuild#GetMatches(lines) abort
|
||||
" file.go:27: missing argument for Printf("%s"): format reads arg 2, have only 1 args
|
||||
" file.go:53:10: if block ends with a return statement, so drop this else and outdent its block (move short variable declaration to its own line if necessary)
|
||||
" file.go:5:2: expected declaration, found 'STRING' "log"
|
||||
|
||||
" go test returns relative paths so use tail of filename as part of pattern matcher
|
||||
let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):?(\d+)?:? (.+)$'
|
||||
|
||||
@@ -72,11 +48,9 @@ endfunction
|
||||
call ale#linter#Define('go', {
|
||||
\ 'name': 'gobuild',
|
||||
\ 'aliases': ['go build'],
|
||||
\ 'executable': 'go',
|
||||
\ 'command_chain': [
|
||||
\ {'callback': 'ale_linters#go#gobuild#GoEnv', 'output_stream': 'stdout'},
|
||||
\ {'callback': 'ale_linters#go#gobuild#GetCommand', 'output_stream': 'stderr'},
|
||||
\ ],
|
||||
\ 'executable_callback': ale#VarFunc('go_go_executable'),
|
||||
\ 'command_callback': 'ale_linters#go#gobuild#GetCommand',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'callback': 'ale_linters#go#gobuild#Handler',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
||||
|
||||
56
ale_linters/go/golangci_lint.vim
Normal file
56
ale_linters/go/golangci_lint.vim
Normal file
@@ -0,0 +1,56 @@
|
||||
" Author: Sascha Grunert <mail@saschagrunert.de>
|
||||
" Description: Adds support of golangci-lint
|
||||
|
||||
call ale#Set('go_golangci_lint_options', '--enable-all')
|
||||
call ale#Set('go_golangci_lint_executable', 'golangci-lint')
|
||||
call ale#Set('go_golangci_lint_package', 0)
|
||||
|
||||
function! ale_linters#go#golangci_lint#GetCommand(buffer) abort
|
||||
let l:filename = expand('#' . a:buffer . ':t')
|
||||
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)
|
||||
\ . '%e run '
|
||||
\ . l:options
|
||||
endif
|
||||
|
||||
return ale#path#BufferCdString(a:buffer)
|
||||
\ . '%e run '
|
||||
\ . ale#Escape(l:filename)
|
||||
\ . ' ' . l:options
|
||||
endfunction
|
||||
|
||||
function! ale_linters#go#golangci_lint#GetMatches(lines) abort
|
||||
let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):?(\d+)?:?:?:?\s\*?(.+)$'
|
||||
|
||||
return ale#util#GetMatches(a:lines, l:pattern)
|
||||
endfunction
|
||||
|
||||
function! ale_linters#go#golangci_lint#Handler(buffer, lines) abort
|
||||
let l:dir = expand('#' . a:buffer . ':p:h')
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale_linters#go#golangci_lint#GetMatches(a:lines)
|
||||
" l:match[1] will already be an absolute path, output from
|
||||
" golangci_lint
|
||||
call add(l:output, {
|
||||
\ 'filename': ale#path#GetAbsPath(l:dir, l:match[1]),
|
||||
\ 'lnum': l:match[2] + 0,
|
||||
\ 'col': l:match[3] + 0,
|
||||
\ 'type': 'E',
|
||||
\ 'text': l:match[4],
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('go', {
|
||||
\ 'name': 'golangci-lint',
|
||||
\ 'executable_callback': ale#VarFunc('go_golangci_lint_executable'),
|
||||
\ 'command_callback': 'ale_linters#go#golangci_lint#GetCommand',
|
||||
\ 'callback': 'ale_linters#go#golangci_lint#Handler',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
||||
@@ -4,15 +4,23 @@
|
||||
" Author: John Eikenberry <jae@zhar.net>
|
||||
" Description: updated to work with go1.10
|
||||
|
||||
call ale#Set('go_go_executable', 'go')
|
||||
call ale#Set('go_govet_options', '')
|
||||
|
||||
function! ale_linters#go#govet#GetCommand(buffer) abort
|
||||
return ale#path#BufferCdString(a:buffer) . ' go vet .'
|
||||
let l:options = ale#Var(a:buffer, 'go_govet_options')
|
||||
|
||||
return ale#path#BufferCdString(a:buffer) . ' '
|
||||
\ . ale#Var(a:buffer, 'go_go_executable') . ' vet '
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
\ . ' .'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('go', {
|
||||
\ 'name': 'govet',
|
||||
\ 'aliases': ['go vet'],
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': 'go',
|
||||
\ 'executable_callback': ale#VarFunc('go_go_executable'),
|
||||
\ 'command_callback': 'ale_linters#go#govet#GetCommand',
|
||||
\ 'callback': 'ale#handlers#go#Handler',
|
||||
\ 'lint_file': 1,
|
||||
|
||||
28
ale_linters/go/langserver.vim
Normal file
28
ale_linters/go/langserver.vim
Normal file
@@ -0,0 +1,28 @@
|
||||
" Author: Horacio Sanson <https://github.com/hsanson>
|
||||
" Description: Support for go-langserver https://github.com/sourcegraph/go-langserver
|
||||
|
||||
call ale#Set('go_langserver_executable', 'go-langserver')
|
||||
call ale#Set('go_langserver_options', '')
|
||||
|
||||
function! ale_linters#go#langserver#GetCommand(buffer) abort
|
||||
let l:executable = [ale#Escape(ale#Var(a:buffer, 'go_langserver_executable'))]
|
||||
let l:options = ale#Var(a:buffer, 'go_langserver_options')
|
||||
let l:options = substitute(l:options, '-gocodecompletion', '', 'g')
|
||||
let l:options = filter(split(l:options, ' '), 'empty(v:val) != 1')
|
||||
|
||||
if(ale#Var(a:buffer, 'completion_enabled') == 1)
|
||||
call add(l:options, '-gocodecompletion')
|
||||
endif
|
||||
|
||||
let l:options = uniq(sort(l:options))
|
||||
|
||||
return join(extend(l:executable, l:options), ' ')
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('go', {
|
||||
\ 'name': 'golangserver',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable_callback': ale#VarFunc('go_langserver_executable'),
|
||||
\ 'command_callback': 'ale_linters#go#langserver#GetCommand',
|
||||
\ 'project_root_callback': 'ale#go#FindProjectRoot',
|
||||
\})
|
||||
27
ale_linters/html/stylelint.vim
Normal file
27
ale_linters/html/stylelint.vim
Normal file
@@ -0,0 +1,27 @@
|
||||
" Author: Filipe Kiss <hello@filipekiss.com.br> http://github.com/filipekiss
|
||||
|
||||
call ale#Set('html_stylelint_executable', 'stylelint')
|
||||
call ale#Set('html_stylelint_options', '')
|
||||
call ale#Set('html_stylelint_use_global', 0)
|
||||
|
||||
function! ale_linters#html#stylelint#GetExecutable(buffer) abort
|
||||
return ale#node#FindExecutable(a:buffer, 'html_stylelint', [
|
||||
\ 'node_modules/.bin/stylelint',
|
||||
\])
|
||||
endfunction
|
||||
|
||||
function! ale_linters#html#stylelint#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#html#stylelint#GetExecutable(a:buffer)
|
||||
let l:options = ale#Var(a:buffer, 'html_stylelint_options')
|
||||
|
||||
return ale#Escape(l:executable)
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
\ . ' --stdin-filename %s'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('html', {
|
||||
\ 'name': 'stylelint',
|
||||
\ 'executable_callback': 'ale_linters#html#stylelint#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#html#stylelint#GetCommand',
|
||||
\ 'callback': 'ale#handlers#css#HandleStyleLintFormat',
|
||||
\})
|
||||
@@ -25,6 +25,7 @@ function! ale_linters#html#tidy#GetCommand(buffer) abort
|
||||
" On macOS, old tidy (released on 31 Oct 2006) is installed. It does not
|
||||
" consider HTML5 so we should avoid it.
|
||||
let l:executable = ale#Var(a:buffer, 'html_tidy_executable')
|
||||
|
||||
if has('mac') && l:executable is# 'tidy' && exists('*exepath')
|
||||
\ && exepath(l:executable) is# '/usr/bin/tidy'
|
||||
return ''
|
||||
@@ -40,7 +41,6 @@ endfunction
|
||||
function! ale_linters#html#tidy#Handle(buffer, lines) abort
|
||||
" Matches patterns lines like the following:
|
||||
" line 7 column 5 - Warning: missing </title> before </head>
|
||||
|
||||
let l:pattern = '^line \(\d\+\) column \(\d\+\) - \(Warning\|Error\): \(.\+\)$'
|
||||
let l:output = []
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ endfunction
|
||||
|
||||
function! ale_linters#idris#idris#Handle(buffer, lines) abort
|
||||
" This was copied almost verbatim from ale#handlers#haskell#HandleGHCFormat
|
||||
|
||||
"
|
||||
" Look for lines like the following:
|
||||
" foo.idr:2:6:When checking right hand side of main with expected type
|
||||
" bar.idr:11:11-13:
|
||||
@@ -30,6 +30,7 @@ function! ale_linters#idris#idris#Handle(buffer, lines) abort
|
||||
else
|
||||
let l:corrected_lines[-1] .= l:line
|
||||
endif
|
||||
|
||||
let l:corrected_lines[-1] = substitute(l:corrected_lines[-1], '\s\+', ' ', 'g')
|
||||
endif
|
||||
endfor
|
||||
|
||||
@@ -16,6 +16,7 @@ function! ale_linters#java#javac#GetImportPaths(buffer) abort
|
||||
endif
|
||||
|
||||
let l:classpath_command = ale#gradle#BuildClasspathCommand(a:buffer)
|
||||
|
||||
if !empty(l:classpath_command)
|
||||
return l:classpath_command
|
||||
endif
|
||||
@@ -90,7 +91,6 @@ function! ale_linters#java#javac#Handle(buffer, lines) abort
|
||||
"
|
||||
" Main.java:13: warning: [deprecation] donaught() in Testclass has been deprecated
|
||||
" Main.java:16: error: ';' expected
|
||||
|
||||
let l:directory = expand('#' . a:buffer . ':p:h')
|
||||
let l:pattern = '\v^(.*):(\d+): (.+):(.+)$'
|
||||
let l:col_pattern = '\v^(\s*\^)$'
|
||||
|
||||
23
ale_linters/java/javalsp.vim
Normal file
23
ale_linters/java/javalsp.vim
Normal file
@@ -0,0 +1,23 @@
|
||||
" 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_jar', 'javacs.jar')
|
||||
|
||||
function! ale_linters#java#javalsp#Executable(buffer) abort
|
||||
return 'java'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#java#javalsp#Command(buffer) abort
|
||||
let l:jar = ale#Var(a:buffer, 'java_javalsp_jar')
|
||||
|
||||
return ale#Escape('java -cp ' . l:jar . ' -Xverify:none org.javacs.Main')
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('java', {
|
||||
\ 'name': 'javalsp',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable_callback': 'ale_linters#java#javalsp#Executable',
|
||||
\ 'command_callback': 'ale_linters#java#javalsp#Command',
|
||||
\ 'language': 'java',
|
||||
\ 'project_root_callback': 'ale#java#FindProjectRoot',
|
||||
\})
|
||||
@@ -91,7 +91,6 @@ function! s:GetDetails(error) abort
|
||||
let l:detail = ''
|
||||
|
||||
for l:extra_error in a:error.extra
|
||||
|
||||
if has_key(l:extra_error, 'message')
|
||||
for l:extra_message in l:extra_error.message
|
||||
let l:detail = s:ExtraErrorMsg(l:detail, l:extra_message.descr)
|
||||
@@ -105,7 +104,6 @@ function! s:GetDetails(error) abort
|
||||
endfor
|
||||
endfor
|
||||
endif
|
||||
|
||||
endfor
|
||||
|
||||
return l:detail
|
||||
@@ -161,7 +159,6 @@ function! ale_linters#javascript#flow#Handle(buffer, lines) abort
|
||||
endif
|
||||
|
||||
call add(l:output, l:errorToAdd)
|
||||
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
function! ale_linters#json#jsonlint#Handle(buffer, lines) abort
|
||||
" Matches patterns like the following:
|
||||
" line 2, col 15, found: 'STRING' - expected: 'EOF', '}', ',', ']'.
|
||||
|
||||
let l:pattern = '^line \(\d\+\), col \(\d*\), \(.\+\)$'
|
||||
let l:output = []
|
||||
|
||||
|
||||
21
ale_linters/julia/languageserver.vim
Normal file
21
ale_linters/julia/languageserver.vim
Normal file
@@ -0,0 +1,21 @@
|
||||
" Author: Bartolomeo Stellato <bartolomeo.stellato@gmail.com>
|
||||
" Description: A language server for Julia
|
||||
|
||||
" Set julia executable variable
|
||||
call ale#Set('julia_executable', 'julia')
|
||||
|
||||
function! ale_linters#julia#languageserver#GetCommand(buffer) abort
|
||||
let l:julia_executable = ale#Var(a:buffer, 'julia_executable')
|
||||
let l:cmd_string = 'using LanguageServer; server = LanguageServer.LanguageServerInstance(isdefined(Base, :stdin) ? stdin : STDIN, isdefined(Base, :stdout) ? stdout : STDOUT, false); server.runlinter = true; run(server);'
|
||||
|
||||
return ale#Escape(l:julia_executable) . ' --startup-file=no --history-file=no -e ' . ale#Escape(l:cmd_string)
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('julia', {
|
||||
\ 'name': 'languageserver',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable_callback': ale#VarFunc('julia_executable'),
|
||||
\ 'command_callback': 'ale_linters#julia#languageserver#GetCommand',
|
||||
\ 'language': 'julia',
|
||||
\ 'project_root_callback': 'ale#julia#FindProjectRoot',
|
||||
\})
|
||||
@@ -17,12 +17,14 @@ function! ale_linters#kotlin#kotlinc#GetImportPaths(buffer) abort
|
||||
return ''
|
||||
else
|
||||
let l:pom_path = ale#path#FindNearestFile(a:buffer, 'pom.xml')
|
||||
|
||||
if !empty(l:pom_path) && executable('mvn')
|
||||
return ale#path#CdString(fnamemodify(l:pom_path, ':h'))
|
||||
\ . 'mvn dependency:build-classpath'
|
||||
endif
|
||||
|
||||
let l:classpath_command = ale#gradle#BuildClasspathCommand(a:buffer)
|
||||
|
||||
if !empty(l:classpath_command)
|
||||
return l:classpath_command
|
||||
endif
|
||||
@@ -78,12 +80,13 @@ function! ale_linters#kotlin#kotlinc#GetCommand(buffer, import_paths) abort
|
||||
endif
|
||||
|
||||
let l:fname = ''
|
||||
|
||||
if ale#Var(a:buffer, 'kotlin_kotlinc_sourcepath') isnot# ''
|
||||
let l:fname .= expand(ale#Var(a:buffer, 'kotlin_kotlinc_sourcepath'), 1) . ' '
|
||||
else
|
||||
" Find the src directory for files in this project.
|
||||
|
||||
let l:project_root = ale#gradle#FindProjectRoot(a:buffer)
|
||||
|
||||
if !empty(l:project_root)
|
||||
let l:src_dir = l:project_root
|
||||
else
|
||||
@@ -93,6 +96,7 @@ function! ale_linters#kotlin#kotlinc#GetCommand(buffer, import_paths) abort
|
||||
|
||||
let l:fname .= expand(l:src_dir, 1) . ' '
|
||||
endif
|
||||
|
||||
let l:fname .= ale#Escape(expand('#' . a:buffer . ':p'))
|
||||
let l:command .= l:kotlinc_opts . ' ' . l:fname
|
||||
|
||||
@@ -124,6 +128,7 @@ function! ale_linters#kotlin#kotlinc#Handle(buffer, lines) abort
|
||||
if l:buf_abspath isnot# l:curbuf_abspath
|
||||
continue
|
||||
endif
|
||||
|
||||
let l:type_marker_str = l:type is# 'warning' ? 'W' : 'E'
|
||||
|
||||
call add(l:output, {
|
||||
|
||||
@@ -23,7 +23,7 @@ call ale#linter#Define('kotlin', {
|
||||
\ 'name': 'languageserver',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable_callback': ale#VarFunc('kotlin_languageserver_executable'),
|
||||
\ 'command_callback': '%e',
|
||||
\ 'command': '%e',
|
||||
\ 'language': 'kotlin',
|
||||
\ 'project_root_callback': 'ale_linters#kotlin#languageserver#GetProjectRoot',
|
||||
\})
|
||||
|
||||
@@ -13,6 +13,7 @@ function! ale_linters#make#checkmake#Handle(buffer, lines) abort
|
||||
\ 'text': l:match[3],
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
|
||||
@@ -24,10 +24,12 @@ function! ale_linters#markdown#remark_lint#Handle(buffer, lines) abort
|
||||
\ 'type': l:match[6] is# 'error' ? 'E' : 'W',
|
||||
\ 'text': l:match[7],
|
||||
\}
|
||||
|
||||
if l:match[3] isnot# ''
|
||||
let l:item.end_lnum = l:match[4] + 0
|
||||
let l:item.end_col = l:match[5] + 0
|
||||
endif
|
||||
|
||||
call add(l:output, l:item)
|
||||
endfor
|
||||
|
||||
|
||||
@@ -8,10 +8,12 @@ function! ale_linters#nasm#nasm#GetCommand(buffer) abort
|
||||
" Note that NASM requires a trailing slash for the -I option.
|
||||
let l:separator = has('win32') ? '\' : '/'
|
||||
let l:path = fnamemodify(bufname(a:buffer), ':p:h') . l:separator
|
||||
let l:output_null = has('win32') ? 'NUL' : '/dev/null'
|
||||
|
||||
return '%e -X gnu -I ' . ale#Escape(l:path)
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'nasm_nasm_options'))
|
||||
\ . ' %s'
|
||||
\ . ' -o ' . l:output_null
|
||||
endfunction
|
||||
|
||||
function! ale_linters#nasm#nasm#Handle(buffer, lines) abort
|
||||
|
||||
23
ale_linters/objc/clangd.vim
Normal file
23
ale_linters/objc/clangd.vim
Normal file
@@ -0,0 +1,23 @@
|
||||
" Author: Andrey Melentyev <andrey.melentyev@protonmail.com>
|
||||
" Description: Clangd language server
|
||||
|
||||
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
|
||||
|
||||
call ale#linter#Define('objc', {
|
||||
\ 'name': 'clangd',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable_callback': ale#VarFunc('objc_clangd_executable'),
|
||||
\ 'command_callback': 'ale_linters#objc#clangd#GetCommand',
|
||||
\ 'project_root_callback': 'ale_linters#objc#clangd#GetProjectRoot',
|
||||
\})
|
||||
23
ale_linters/objcpp/clangd.vim
Normal file
23
ale_linters/objcpp/clangd.vim
Normal file
@@ -0,0 +1,23 @@
|
||||
" Author: Andrey Melentyev <andrey.melentyev@protonmail.com>
|
||||
" Description: Clangd language server
|
||||
|
||||
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
|
||||
|
||||
call ale#linter#Define('objcpp', {
|
||||
\ 'name': 'clangd',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable_callback': ale#VarFunc('objcpp_clangd_executable'),
|
||||
\ 'command_callback': 'ale_linters#objcpp#clangd#GetCommand',
|
||||
\ 'project_root_callback': 'ale_linters#objcpp#clangd#GetProjectRoot',
|
||||
\})
|
||||
@@ -14,11 +14,16 @@ let s:begin_failed_skip_pattern = '\v' . join([
|
||||
\], '|')
|
||||
|
||||
function! ale_linters#perl#perl#Handle(buffer, lines) abort
|
||||
if empty(a:lines)
|
||||
return []
|
||||
endif
|
||||
|
||||
let l:pattern = '\(.\+\) at \(.\+\) line \(\d\+\)'
|
||||
let l:output = []
|
||||
let l:basename = expand('#' . a:buffer . ':t')
|
||||
|
||||
let l:type = 'E'
|
||||
|
||||
if a:lines[-1] =~# 'syntax OK'
|
||||
let l:type = 'W'
|
||||
endif
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
let g:ale_php_phpcs_standard = get(g:, 'ale_php_phpcs_standard', '')
|
||||
|
||||
call ale#Set('php_phpcs_options', '')
|
||||
call ale#Set('php_phpcs_executable', 'phpcs')
|
||||
call ale#Set('php_phpcs_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
|
||||
@@ -11,8 +12,11 @@ function! ale_linters#php#phpcs#GetCommand(buffer) abort
|
||||
let l:standard_option = !empty(l:standard)
|
||||
\ ? '--standard=' . 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)
|
||||
return '%e -s --report=emacs --stdin-path=%s'
|
||||
\ . ale#Pad(l:standard_option)
|
||||
\ . ale#Pad(l:options)
|
||||
endfunction
|
||||
|
||||
function! ale_linters#php#phpcs#Handle(buffer, lines) abort
|
||||
|
||||
@@ -8,6 +8,7 @@ function! ale_linters#puppet#languageserver#GetProjectRoot(buffer) abort
|
||||
" there's no requirement to have it, so fall back to the other possible
|
||||
" Puppet module directories
|
||||
let l:root_path = ale#path#FindNearestFile(a:buffer, 'metadata.json')
|
||||
|
||||
if !empty(l:root_path)
|
||||
return fnamemodify(l:root_path, ':h')
|
||||
endif
|
||||
@@ -17,6 +18,7 @@ function! ale_linters#puppet#languageserver#GetProjectRoot(buffer) abort
|
||||
\ 'templates',
|
||||
\]
|
||||
let l:root_path = ale#path#FindNearestDirectory(a:buffer, l:test_path)
|
||||
|
||||
if !empty(l:root_path)
|
||||
return fnamemodify(l:root_path, ':h:h')
|
||||
endif
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
" Author: Alexander Olofsson <alexander.olofsson@liu.se>
|
||||
|
||||
call ale#Set('puppet_puppet_executable', 'puppet')
|
||||
call ale#Set('puppet_puppet_options', '')
|
||||
|
||||
function! ale_linters#puppet#puppet#Handle(buffer, lines) abort
|
||||
" Matches patterns like the following:
|
||||
" Error: Could not parse for environment production: Syntax error at ':' at /root/puppetcode/modules/nginx/manifests/init.pp:43:12
|
||||
" Error: Could not parse for environment production: Syntax error at '='; expected '}' at /root/puppetcode/modules/pancakes/manifests/init.pp:5"
|
||||
" Error: Could not parse for environment production: Syntax error at 'parameter1' (file: /tmp/modules/mariadb/manifests/slave.pp, line: 4, column: 5)
|
||||
|
||||
let l:pattern = '^Error: .*: \(.\+\) \((file:\|at\) .\+\.pp\(, line: \|:\)\(\d\+\)\(, column: \|:\)\=\(\d*\)'
|
||||
let l:output = []
|
||||
|
||||
@@ -20,10 +22,16 @@ function! ale_linters#puppet#puppet#Handle(buffer, lines) abort
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
function! ale_linters#puppet#puppet#GetCommand(buffer) abort
|
||||
return '%e parser validate --color=false '
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'puppet_puppet_options'))
|
||||
\ . ' %t'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('puppet', {
|
||||
\ 'name': 'puppet',
|
||||
\ 'executable': 'puppet',
|
||||
\ 'executable_callback': ale#VarFunc('puppet_puppet_executable'),
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'command': 'puppet parser validate --color=false %t',
|
||||
\ 'command_callback': 'ale_linters#puppet#puppet#GetCommand',
|
||||
\ 'callback': 'ale_linters#puppet#puppet#Handle',
|
||||
\})
|
||||
|
||||
@@ -5,12 +5,18 @@ call ale#Set('python_flake8_executable', 'flake8')
|
||||
call ale#Set('python_flake8_options', '')
|
||||
call ale#Set('python_flake8_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
call ale#Set('python_flake8_change_directory', 1)
|
||||
call ale#Set('python_flake8_auto_pipenv', 0)
|
||||
|
||||
function! s:UsingModule(buffer) abort
|
||||
return ale#Var(a:buffer, 'python_flake8_options') =~# ' *-m flake8'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#python#flake8#GetExecutable(buffer) abort
|
||||
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_flake8_auto_pipenv'))
|
||||
\ && ale#python#PipenvPresent(a:buffer)
|
||||
return 'pipenv'
|
||||
endif
|
||||
|
||||
if !s:UsingModule(a:buffer)
|
||||
return ale#python#FindExecutable(a:buffer, 'python_flake8', ['flake8'])
|
||||
endif
|
||||
|
||||
@@ -5,8 +5,14 @@ call ale#Set('python_mypy_executable', 'mypy')
|
||||
call ale#Set('python_mypy_ignore_invalid_syntax', 0)
|
||||
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)
|
||||
|
||||
function! ale_linters#python#mypy#GetExecutable(buffer) abort
|
||||
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_mypy_auto_pipenv'))
|
||||
\ && ale#python#PipenvPresent(a:buffer)
|
||||
return 'pipenv'
|
||||
endif
|
||||
|
||||
return ale#python#FindExecutable(a:buffer, 'python_mypy', ['mypy'])
|
||||
endfunction
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
" Author: chocoelho <carlospecter@gmail.com>
|
||||
" Description: prospector linter python files
|
||||
|
||||
call ale#Set('python_prospector_auto_pipenv', 0)
|
||||
|
||||
let g:ale_python_prospector_executable =
|
||||
\ get(g:, 'ale_python_prospector_executable', 'prospector')
|
||||
|
||||
@@ -10,6 +12,11 @@ let g:ale_python_prospector_options =
|
||||
let g:ale_python_prospector_use_global = get(g:, 'ale_python_prospector_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
|
||||
function! ale_linters#python#prospector#GetExecutable(buffer) abort
|
||||
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_prospector_auto_pipenv'))
|
||||
\ && ale#python#PipenvPresent(a:buffer)
|
||||
return 'pipenv'
|
||||
endif
|
||||
|
||||
return ale#python#FindExecutable(a:buffer, 'python_prospector', ['prospector'])
|
||||
endfunction
|
||||
|
||||
|
||||
@@ -4,8 +4,14 @@
|
||||
call ale#Set('python_pycodestyle_executable', 'pycodestyle')
|
||||
call ale#Set('python_pycodestyle_options', '')
|
||||
call ale#Set('python_pycodestyle_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
call ale#Set('python_pycodestyle_auto_pipenv', 0)
|
||||
|
||||
function! ale_linters#python#pycodestyle#GetExecutable(buffer) abort
|
||||
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pycodestyle_auto_pipenv'))
|
||||
\ && ale#python#PipenvPresent(a:buffer)
|
||||
return 'pipenv'
|
||||
endif
|
||||
|
||||
return ale#python#FindExecutable(a:buffer, 'python_pycodestyle', ['pycodestyle'])
|
||||
endfunction
|
||||
|
||||
|
||||
@@ -3,8 +3,14 @@
|
||||
|
||||
call ale#Set('python_pyflakes_executable', 'pyflakes')
|
||||
call ale#Set('python_pyflakes_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
call ale#Set('python_pyflakes_auto_pipenv', 0)
|
||||
|
||||
function! ale_linters#python#pyflakes#GetExecutable(buffer) abort
|
||||
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pyflakes_auto_pipenv'))
|
||||
\ && ale#python#PipenvPresent(a:buffer)
|
||||
return 'pipenv'
|
||||
endif
|
||||
|
||||
return ale#python#FindExecutable(a:buffer, 'python_pyflakes', ['pyflakes'])
|
||||
endfunction
|
||||
|
||||
|
||||
@@ -5,8 +5,14 @@ call ale#Set('python_pylint_executable', 'pylint')
|
||||
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)
|
||||
|
||||
function! ale_linters#python#pylint#GetExecutable(buffer) abort
|
||||
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pylint_auto_pipenv'))
|
||||
\ && ale#python#PipenvPresent(a:buffer)
|
||||
return 'pipenv'
|
||||
endif
|
||||
|
||||
return ale#python#FindExecutable(a:buffer, 'python_pylint', ['pylint'])
|
||||
endfunction
|
||||
|
||||
|
||||
@@ -3,8 +3,14 @@
|
||||
|
||||
call ale#Set('python_pyls_executable', 'pyls')
|
||||
call ale#Set('python_pyls_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
call ale#Set('python_pyls_auto_pipenv', 0)
|
||||
|
||||
function! ale_linters#python#pyls#GetExecutable(buffer) abort
|
||||
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pyls_auto_pipenv'))
|
||||
\ && ale#python#PipenvPresent(a:buffer)
|
||||
return 'pipenv'
|
||||
endif
|
||||
|
||||
return ale#python#FindExecutable(a:buffer, 'python_pyls', ['pyls'])
|
||||
endfunction
|
||||
|
||||
|
||||
@@ -3,8 +3,14 @@
|
||||
|
||||
call ale#Set('python_pyre_executable', 'pyre')
|
||||
call ale#Set('python_pyre_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
call ale#Set('python_pyre_auto_pipenv', 0)
|
||||
|
||||
function! ale_linters#python#pyre#GetExecutable(buffer) abort
|
||||
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pyre_auto_pipenv'))
|
||||
\ && ale#python#PipenvPresent(a:buffer)
|
||||
return 'pipenv'
|
||||
endif
|
||||
|
||||
return ale#python#FindExecutable(a:buffer, 'python_pyre', ['pyre'])
|
||||
endfunction
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ function! ale_linters#rst#rstcheck#Handle(buffer, lines) abort
|
||||
let l:pattern = '\v^(.+):(\d*): \(([a-zA-Z]*)/\d*\) (.+)$'
|
||||
let l:dir = expand('#' . a:buffer . ':p:h')
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'filename': ale#path#GetAbsPath(l:dir, l:match[1]),
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
" Author: Eddie Lebow https://github.com/elebow
|
||||
" Description: Brakeman, a static analyzer for Rails security
|
||||
|
||||
let g:ale_ruby_brakeman_options =
|
||||
\ get(g:, 'ale_ruby_brakeman_options', '')
|
||||
call ale#Set('ruby_brakeman_options', '')
|
||||
call ale#Set('ruby_brakeman_executable', 'brakeman')
|
||||
call ale#Set('ruby_brakeman_options', '')
|
||||
|
||||
function! ale_linters#ruby#brakeman#Handle(buffer, lines) abort
|
||||
let l:output = []
|
||||
@@ -33,14 +34,17 @@ function! ale_linters#ruby#brakeman#GetCommand(buffer) abort
|
||||
return ''
|
||||
endif
|
||||
|
||||
return 'brakeman -f json -q '
|
||||
let l:executable = ale#Var(a:buffer, 'ruby_brakeman_executable')
|
||||
|
||||
return ale#handlers#ruby#EscapeExecutable(l:executable, 'brakeman')
|
||||
\ . ' -f json -q '
|
||||
\ . ale#Var(a:buffer, 'ruby_brakeman_options')
|
||||
\ . ' -p ' . ale#Escape(l:rails_root)
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('ruby', {
|
||||
\ 'name': 'brakeman',
|
||||
\ 'executable': 'brakeman',
|
||||
\ 'executable_callback': ale#VarFunc('ruby_brakeman_executable'),
|
||||
\ 'command_callback': 'ale_linters#ruby#brakeman#GetCommand',
|
||||
\ 'callback': 'ale_linters#ruby#brakeman#Handle',
|
||||
\ 'lint_file': 1,
|
||||
|
||||
@@ -22,26 +22,18 @@ function! ale_linters#ruby#rails_best_practices#Handle(buffer, lines) abort
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
function! ale_linters#ruby#rails_best_practices#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'ruby_rails_best_practices_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#ruby#rails_best_practices#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#ruby#rails_best_practices#GetExecutable(a:buffer)
|
||||
let l:exec_args = l:executable =~? 'bundle$'
|
||||
\ ? ' exec rails_best_practices'
|
||||
\ : ''
|
||||
|
||||
let l:rails_root = ale#ruby#FindRailsRoot(a:buffer)
|
||||
|
||||
if l:rails_root is? ''
|
||||
return ''
|
||||
endif
|
||||
|
||||
let l:executable = ale#Var(a:buffer, 'ruby_rails_best_practices_executable')
|
||||
let l:output_file = ale#Has('win32') ? '%t ' : '/dev/stdout '
|
||||
let l:cat_file = ale#Has('win32') ? '; type %t' : ''
|
||||
|
||||
return ale#Escape(l:executable) . l:exec_args
|
||||
return ale#handlers#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)
|
||||
@@ -50,7 +42,7 @@ endfunction
|
||||
|
||||
call ale#linter#Define('ruby', {
|
||||
\ 'name': 'rails_best_practices',
|
||||
\ 'executable_callback': 'ale_linters#ruby#rails_best_practices#GetExecutable',
|
||||
\ 'executable_callback': ale#VarFunc('ruby_rails_best_practices_executable'),
|
||||
\ 'command_callback': 'ale_linters#ruby#rails_best_practices#GetCommand',
|
||||
\ 'callback': 'ale_linters#ruby#rails_best_practices#Handle',
|
||||
\ 'lint_file': 1,
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
|
||||
call ale#Set('ruby_reek_show_context', 0)
|
||||
call ale#Set('ruby_reek_show_wiki_link', 0)
|
||||
call ale#Set('ruby_reek_options', '')
|
||||
call ale#Set('ruby_reek_executable', 'reek')
|
||||
|
||||
function! ale_linters#ruby#reek#VersionCheck(buffer) abort
|
||||
" If we have previously stored the version number in a cache, then
|
||||
@@ -12,18 +14,23 @@ function! ale_linters#ruby#reek#VersionCheck(buffer) abort
|
||||
return ''
|
||||
endif
|
||||
|
||||
return 'reek --version'
|
||||
let l:executable = ale#Var(a:buffer, 'ruby_reek_executable')
|
||||
|
||||
return ale#handlers#ruby#EscapeExecutable(l:executable, 'reek')
|
||||
\ . ' --version'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#ruby#reek#GetCommand(buffer, version_output) abort
|
||||
let l:version = ale#semver#GetVersion('reek', a:version_output)
|
||||
let l:executable = ale#Var(a:buffer, 'ruby_reek_executable')
|
||||
|
||||
" Tell reek what the filename is if the version of reek is new enough.
|
||||
let l:display_name_args = ale#semver#GTE(l:version, [5, 0, 0])
|
||||
\ ? ' --stdin-filename %s'
|
||||
\ : ''
|
||||
|
||||
return 'reek -f json --no-progress --no-color'
|
||||
return ale#handlers#ruby#EscapeExecutable(l:executable, 'reek')
|
||||
\ . ' -f json --no-progress --no-color'
|
||||
\ . l:display_name_args
|
||||
endfunction
|
||||
|
||||
@@ -62,7 +69,7 @@ endfunction
|
||||
|
||||
call ale#linter#Define('ruby', {
|
||||
\ 'name': 'reek',
|
||||
\ 'executable': 'reek',
|
||||
\ 'executable_callback': ale#VarFunc('ruby_reek_executable'),
|
||||
\ 'command_chain': [
|
||||
\ {'callback': 'ale_linters#ruby#reek#VersionCheck'},
|
||||
\ {'callback': 'ale_linters#ruby#reek#GetCommand'},
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
" Author: ynonp - https://github.com/ynonp, Eddie Lebow https://github.com/elebow
|
||||
" Description: RuboCop, a code style analyzer for Ruby files
|
||||
|
||||
function! ale_linters#ruby#rubocop#GetCommand(buffer) abort
|
||||
let l:executable = ale#handlers#rubocop#GetExecutable(a:buffer)
|
||||
let l:exec_args = l:executable =~? 'bundle$'
|
||||
\ ? ' exec rubocop'
|
||||
\ : ''
|
||||
call ale#Set('ruby_rubocop_executable', 'rubocop')
|
||||
call ale#Set('ruby_rubocop_options', '')
|
||||
|
||||
return ale#Escape(l:executable) . l:exec_args
|
||||
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')
|
||||
\ . ' --format json --force-exclusion '
|
||||
\ . ale#Var(a:buffer, 'ruby_rubocop_options')
|
||||
\ . ' --stdin ' . ale#Escape(expand('#' . a:buffer . ':p'))
|
||||
@@ -55,7 +55,7 @@ endfunction
|
||||
|
||||
call ale#linter#Define('ruby', {
|
||||
\ 'name': 'rubocop',
|
||||
\ 'executable_callback': 'ale#handlers#rubocop#GetExecutable',
|
||||
\ 'executable_callback': ale#VarFunc('ruby_rubocop_executable'),
|
||||
\ 'command_callback': 'ale_linters#ruby#rubocop#GetCommand',
|
||||
\ 'callback': 'ale_linters#ruby#rubocop#Handle',
|
||||
\})
|
||||
|
||||
20
ale_linters/ruby/solargraph.vim
Normal file
20
ale_linters/ruby/solargraph.vim
Normal file
@@ -0,0 +1,20 @@
|
||||
" Author: Horacio Sanson - https://github.com/hsanson
|
||||
" Description: Solargraph Language Server https://solargraph.org/
|
||||
"
|
||||
" Author: Devon Meunier <devon.meunier@gmail.com>
|
||||
" Description: updated to use stdio
|
||||
|
||||
call ale#Set('ruby_solargraph_executable', 'solargraph')
|
||||
|
||||
function! ale_linters#ruby#solargraph#GetCommand(buffer) abort
|
||||
return '%e' . ale#Pad('stdio')
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('ruby', {
|
||||
\ 'name': 'solargraph',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'language': 'ruby',
|
||||
\ 'executable_callback': ale#VarFunc('ruby_solargraph_executable'),
|
||||
\ 'command_callback': 'ale_linters#ruby#solargraph#GetCommand',
|
||||
\ 'project_root_callback': 'ale#ruby#FindProjectRoot',
|
||||
\})
|
||||
@@ -42,6 +42,7 @@ function! ale_linters#rust#cargo#GetCommand(buffer, version_output) abort
|
||||
\ && ale#semver#GTE(l:version, [0, 22, 0])
|
||||
|
||||
let l:include_features = ale#Var(a:buffer, 'rust_cargo_include_features')
|
||||
|
||||
if !empty(l:include_features)
|
||||
let l:include_features = ' --features ' . ale#Escape(l:include_features)
|
||||
endif
|
||||
@@ -59,6 +60,7 @@ function! ale_linters#rust#cargo#GetCommand(buffer, version_output) abort
|
||||
endif
|
||||
|
||||
let l:default_feature_behavior = ale#Var(a:buffer, 'rust_cargo_default_feature_behavior')
|
||||
|
||||
if l:default_feature_behavior is# 'all'
|
||||
let l:include_features = ''
|
||||
let l:default_feature = ' --all-features'
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
" Author: Daniel Schemala <istjanichtzufassen@gmail.com>
|
||||
" Description: rustc for rust files
|
||||
|
||||
call ale#Set('rust_rustc_options', '-Z no-trans')
|
||||
call ale#Set('rust_rustc_options', '-Z no-codegen')
|
||||
|
||||
function! ale_linters#rust#rustc#RustcCommand(buffer) abort
|
||||
" Try to guess the library search path. If the project is managed by cargo,
|
||||
|
||||
31
ale_linters/scala/sbtserver.vim
Normal file
31
ale_linters/scala/sbtserver.vim
Normal file
@@ -0,0 +1,31 @@
|
||||
" Author: ophirr33 <coghlan.ty@gmail.com>
|
||||
" Description: TCP lsp client for sbt Server
|
||||
|
||||
call ale#Set('scala_sbtserver_address', '127.0.0.1:4273')
|
||||
call ale#Set('scala_sbtserver_project_root', '')
|
||||
|
||||
function! ale_linters#scala#sbtserver#GetProjectRoot(buffer) abort
|
||||
let l:project_root = ale#Var(a:buffer, 'scala_sbtserver_project_root')
|
||||
|
||||
if l:project_root is? ''
|
||||
let l:project_root = ale#path#FindNearestFile(a:buffer, 'build.sbt')
|
||||
|
||||
return !empty(l:project_root) ? fnamemodify(l:project_root, ':h') : ''
|
||||
endif
|
||||
|
||||
return l:project_root
|
||||
endfunction
|
||||
|
||||
function! ale_linters#scala#sbtserver#GetAddress(buffer) abort
|
||||
let l:address = ale#Var(a:buffer, 'scala_sbtserver_address')
|
||||
|
||||
return l:address
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('scala', {
|
||||
\ 'name': 'sbtserver',
|
||||
\ 'lsp': 'socket',
|
||||
\ 'address_callback': 'ale_linters#scala#sbtserver#GetAddress',
|
||||
\ 'language': 'scala',
|
||||
\ 'project_root_callback': 'ale_linters#scala#sbtserver#GetProjectRoot',
|
||||
\})
|
||||
@@ -53,12 +53,14 @@ function! ale_linters#scala#scalastyle#GetCommand(buffer) abort
|
||||
\ 'scalastyle_config.xml',
|
||||
\ 'scalastyle-config.xml'
|
||||
\]
|
||||
|
||||
for l:config in l:potential_configs
|
||||
let l:scalastyle_config = ale#path#ResolveLocalPath(
|
||||
\ a:buffer,
|
||||
\ l:config,
|
||||
\ ''
|
||||
\)
|
||||
|
||||
if !empty(l:scalastyle_config)
|
||||
break
|
||||
endif
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
function! ale_linters#sml#smlnj_cm#GetCommand(buffer) abort
|
||||
let l:cmfile = ale#handlers#sml#GetCmFile(a:buffer)
|
||||
|
||||
return 'sml -m ' . l:cmfile . ' < /dev/null'
|
||||
endfunction
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
function! ale_linters#solidity#solhint#Handle(buffer, lines) abort
|
||||
" Matches patterns like the following:
|
||||
" /path/to/file/file.sol: line 1, col 10, Error - 'addOne' is defined but never used. (no-unused-vars)
|
||||
|
||||
let l:pattern = '\v^[^:]+: line (\d+), col (\d+), (Error|Warning) - (.*) \((.*)\)$'
|
||||
let l:output = []
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@ function! ale_linters#tcl#nagelfar#Handle(buffer, lines) abort
|
||||
" Line 5: W Found constant "bepa" which is also a variable.
|
||||
" Line 13: E Wrong number of arguments (3) to "set"
|
||||
" Line 93: N Close brace not aligned with line 90 (4 0)
|
||||
|
||||
let l:pattern = '^Line\s\+\([0-9]\+\): \([NEW]\) \(.*\)$'
|
||||
let l:output = []
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@ function! ale_linters#terraform#tflint#GetCommand(buffer) abort
|
||||
endif
|
||||
|
||||
let l:opts = ale#Var(a:buffer, 'terraform_tflint_options')
|
||||
|
||||
if !empty(l:opts)
|
||||
let l:cmd .= ' ' . l:opts
|
||||
endif
|
||||
|
||||
@@ -8,7 +8,6 @@ function! ale_linters#tex#lacheck#Handle(buffer, lines) abort
|
||||
"
|
||||
" "book.tex", line 37: possible unwanted space at "{"
|
||||
" "book.tex", line 38: missing `\ ' after "etc."
|
||||
|
||||
let l:pattern = '^".\+", line \(\d\+\): \(.\+\)$'
|
||||
let l:output = []
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
call ale#Set('thrift_thrift_executable', 'thrift')
|
||||
call ale#Set('thrift_thrift_generators', ['cpp'])
|
||||
call ale#Set('thrift_thrift_includes', [])
|
||||
call ale#Set('thrift_thrift_includes', ['.'])
|
||||
call ale#Set('thrift_thrift_options', '-strict')
|
||||
|
||||
function! ale_linters#thrift#thrift#GetCommand(buffer) abort
|
||||
@@ -42,12 +42,14 @@ function! ale_linters#thrift#thrift#Handle(buffer, lines) abort
|
||||
let l:line = a:lines[l:index]
|
||||
|
||||
let l:match = matchlist(l:line, l:pattern)
|
||||
|
||||
if empty(l:match)
|
||||
let l:index += 1
|
||||
continue
|
||||
endif
|
||||
|
||||
let l:severity = l:match[1]
|
||||
|
||||
if l:severity is# 'WARNING'
|
||||
let l:type = 'W'
|
||||
else
|
||||
@@ -57,6 +59,7 @@ function! ale_linters#thrift#thrift#Handle(buffer, lines) abort
|
||||
" If our text looks like "(last token was ';')", the *next* line
|
||||
" should contain a more descriptive error message.
|
||||
let l:text = l:match[4]
|
||||
|
||||
if l:text =~# '\(last token was .*\)'
|
||||
let l:index += 1
|
||||
let l:text = get(a:lines, l:index, 'Unknown error ' . l:text)
|
||||
|
||||
@@ -25,7 +25,13 @@ endfunction
|
||||
function! ale_linters#vim#ale_custom_linting_rules#GetCommand(buffer) abort
|
||||
let l:dir = s:GetALEProjectDir(a:buffer)
|
||||
|
||||
return ale#path#CdString(l:dir) . '%e .'
|
||||
let l:temp_dir = ale#engine#CreateDirectory(a:buffer)
|
||||
let l:temp_file = l:temp_dir . '/example.vim'
|
||||
|
||||
let l:lines = getbufline(a:buffer, 1, '$')
|
||||
call ale#util#Writefile(a:buffer, l:lines, l:temp_file)
|
||||
|
||||
return ale#path#CdString(l:dir) . '%e ' . ale#Escape(l:temp_dir)
|
||||
endfunction
|
||||
|
||||
function! ale_linters#vim#ale_custom_linting_rules#Handle(buffer, lines) abort
|
||||
@@ -34,15 +40,17 @@ function! ale_linters#vim#ale_custom_linting_rules#Handle(buffer, lines) abort
|
||||
let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+) (.+)$'
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
let l:filename = ale#path#GetAbsPath(l:dir, l:match[1])
|
||||
|
||||
if bufnr(l:filename) is a:buffer
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[2],
|
||||
\ 'text': l:match[3],
|
||||
\ 'type': 'W',
|
||||
\})
|
||||
" Ignore trailing whitespace errors if we've turned them off.
|
||||
if !ale#Var(a:buffer, 'warn_about_trailing_whitespace')
|
||||
\&& l:match[3] is# 'Trailing whitespace'
|
||||
continue
|
||||
endif
|
||||
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[2],
|
||||
\ 'text': l:match[3],
|
||||
\ 'type': 'W',
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
@@ -53,5 +61,5 @@ call ale#linter#Define('vim', {
|
||||
\ 'executable_callback': 'ale_linters#vim#ale_custom_linting_rules#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#vim#ale_custom_linting_rules#GetCommand',
|
||||
\ 'callback': 'ale_linters#vim#ale_custom_linting_rules#Handle',
|
||||
\ 'lint_file': 1,
|
||||
\ 'read_buffer': 0,
|
||||
\})
|
||||
|
||||
@@ -25,9 +25,9 @@ function! ale_linters#xml#xmllint#Handle(buffer, lines) abort
|
||||
let l:output = []
|
||||
|
||||
for l:line in a:lines
|
||||
|
||||
" Parse error/warning lines
|
||||
let l:match_message = matchlist(l:line, l:pattern_message)
|
||||
|
||||
if !empty(l:match_message)
|
||||
let l:line = l:match_message[2] + 0
|
||||
let l:type = l:match_message[4] =~? 'warning' ? 'W' : 'E'
|
||||
@@ -44,13 +44,13 @@ function! ale_linters#xml#xmllint#Handle(buffer, lines) abort
|
||||
|
||||
" Parse column position
|
||||
let l:match_column_token = matchlist(l:line, l:pattern_column_token)
|
||||
|
||||
if !empty(l:output) && !empty(l:match_column_token)
|
||||
let l:previous = l:output[len(l:output) - 1]
|
||||
let l:previous['col'] = len(l:match_column_token[0])
|
||||
|
||||
continue
|
||||
endif
|
||||
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
|
||||
@@ -2,6 +2,7 @@ call ale#Set('yang_lsp_executable', 'yang-language-server')
|
||||
|
||||
function! ale_linters#yang#yang_lsp#GetProjectRoot(buffer) abort
|
||||
let l:project_root = ale#path#FindNearestFile(a:buffer, 'yang.settings')
|
||||
|
||||
return !empty(l:project_root) ? fnamemodify(l:project_root, ':h') : ''
|
||||
endfunction
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ let s:getcmdwintype_exists = exists('*getcmdwintype')
|
||||
function! ale#ShouldDoNothing(buffer) abort
|
||||
" The checks are split into separate if statements to make it possible to
|
||||
" profile each check individually with Vim's profiling tools.
|
||||
|
||||
"
|
||||
" Do nothing if ALE is disabled.
|
||||
if !getbufvar(a:buffer, 'ale_enabled', get(g:, 'ale_enabled', 0))
|
||||
return 1
|
||||
@@ -62,6 +62,11 @@ function! ale#ShouldDoNothing(buffer) abort
|
||||
return 1
|
||||
endif
|
||||
|
||||
" Don't start linting and so on when an operator is pending.
|
||||
if ale#util#Mode(1) is# 'no'
|
||||
return 1
|
||||
endif
|
||||
|
||||
" Do nothing if running in the sandbox.
|
||||
if ale#util#InSandbox()
|
||||
return 1
|
||||
|
||||
@@ -101,6 +101,14 @@ function! ale#assert#LSPProject(expected_root) abort
|
||||
AssertEqual a:expected_root, l:root
|
||||
endfunction
|
||||
|
||||
function! ale#assert#LSPAddress(expected_address) abort
|
||||
let l:buffer = bufnr('')
|
||||
let l:linter = s:GetLinter()
|
||||
let l:address = ale#util#GetFunction(l:linter.address_callback)(l:buffer)
|
||||
|
||||
AssertEqual a:expected_address, l:address
|
||||
endfunction
|
||||
|
||||
" A dummy function for making sure this module is loaded.
|
||||
function! ale#assert#SetUpLinterTest(filetype, name) abort
|
||||
" Set up a marker so ALE doesn't create real random temporary filenames.
|
||||
@@ -141,6 +149,7 @@ function! ale#assert#SetUpLinterTest(filetype, name) abort
|
||||
command! -nargs=+ AssertLSPOptions :call ale#assert#LSPOptions(<args>)
|
||||
command! -nargs=+ AssertLSPLanguage :call ale#assert#LSPLanguage(<args>)
|
||||
command! -nargs=+ AssertLSPProject :call ale#assert#LSPProject(<args>)
|
||||
command! -nargs=+ AssertLSPAddress :call ale#assert#LSPAddress(<args>)
|
||||
endfunction
|
||||
|
||||
function! ale#assert#TearDownLinterTest() abort
|
||||
@@ -171,6 +180,10 @@ function! ale#assert#TearDownLinterTest() abort
|
||||
delcommand AssertLSPProject
|
||||
endif
|
||||
|
||||
if exists(':AssertLSPAddress')
|
||||
delcommand AssertLSPAddress
|
||||
endif
|
||||
|
||||
if exists('g:dir')
|
||||
call ale#test#RestoreDirectory()
|
||||
endif
|
||||
|
||||
@@ -8,6 +8,25 @@ let s:sep = has('win32') ? '\' : '/'
|
||||
" Set just so tests can override it.
|
||||
let g:__ale_c_project_filenames = ['.git/HEAD', 'configure', 'Makefile', 'CMakeLists.txt']
|
||||
|
||||
function! ale#c#GetBuildDirectory(buffer) abort
|
||||
" Don't include build directory for header files, as compile_commands.json
|
||||
" files don't consider headers to be translation units, and provide no
|
||||
" commands for compiling header files.
|
||||
if expand('#' . a:buffer) =~# '\v\.(h|hpp)$'
|
||||
return ''
|
||||
endif
|
||||
|
||||
let l:build_dir = ale#Var(a:buffer, 'c_build_dir')
|
||||
|
||||
" c_build_dir has the priority if defined
|
||||
if !empty(l:build_dir)
|
||||
return l:build_dir
|
||||
endif
|
||||
|
||||
return ale#path#Dirname(ale#c#FindCompileCommands(a:buffer))
|
||||
endfunction
|
||||
|
||||
|
||||
function! ale#c#FindProjectRoot(buffer) abort
|
||||
for l:project_filename in g:__ale_c_project_filenames
|
||||
let l:full_path = ale#path#FindNearestFile(a:buffer, l:project_filename)
|
||||
@@ -35,7 +54,8 @@ function! ale#c#ParseCFlags(path_prefix, cflag_line) abort
|
||||
call add(l:previous_options, l:option)
|
||||
" Check if cflag contained a '-' and should not have been splitted
|
||||
let l:option_list = split(l:option, '\zs')
|
||||
if l:option_list[-1] isnot# ' '
|
||||
|
||||
if len(l:option_list) > 0 && l:option_list[-1] isnot# ' '
|
||||
continue
|
||||
endif
|
||||
|
||||
|
||||
@@ -39,10 +39,14 @@ let s:LSP_COMPLETION_COLOR_KIND = 16
|
||||
let s:LSP_COMPLETION_FILE_KIND = 17
|
||||
let s:LSP_COMPLETION_REFERENCE_KIND = 18
|
||||
|
||||
let s:lisp_regex = '\v[a-zA-Z_\-][a-zA-Z_\-0-9]*$'
|
||||
|
||||
" Regular expressions for checking the characters in the line before where
|
||||
" the insert cursor is. If one of these matches, we'll check for completions.
|
||||
let s:should_complete_map = {
|
||||
\ '<default>': '\v[a-zA-Z$_][a-zA-Z$_0-9]*$|\.$',
|
||||
\ 'clojure': s:lisp_regex,
|
||||
\ 'lisp': s:lisp_regex,
|
||||
\ 'typescript': '\v[a-zA-Z$_][a-zA-Z$_0-9]*$|\.$|''$|"$',
|
||||
\ 'rust': '\v[a-zA-Z$_][a-zA-Z$_0-9]*$|\.$|::$',
|
||||
\}
|
||||
@@ -75,6 +79,7 @@ endfunction
|
||||
" Check if we should look for completions for a language.
|
||||
function! ale#completion#GetPrefix(filetype, line, column) abort
|
||||
let l:regex = s:GetFiletypeValue(s:should_complete_map, a:filetype)
|
||||
|
||||
" The column we're using completions for is where we are inserting text,
|
||||
" like so:
|
||||
" abc
|
||||
@@ -93,14 +98,15 @@ function! ale#completion#GetTriggerCharacter(filetype, prefix) abort
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
function! ale#completion#Filter(buffer, suggestions, prefix) abort
|
||||
function! ale#completion#Filter(buffer, filetype, suggestions, prefix) abort
|
||||
let l:excluded_words = ale#Var(a:buffer, 'completion_excluded_words')
|
||||
let l:triggers = s:GetFiletypeValue(s:trigger_character_map, a:filetype)
|
||||
|
||||
" For completing...
|
||||
" foo.
|
||||
" ^
|
||||
" We need to include all of the given suggestions.
|
||||
if a:prefix is# '.'
|
||||
if index(l:triggers, a:prefix) >= 0
|
||||
let l:filtered_suggestions = a:suggestions
|
||||
else
|
||||
let l:filtered_suggestions = []
|
||||
@@ -259,7 +265,7 @@ function! ale#completion#ParseTSServerCompletionEntryDetails(response) abort
|
||||
call add(l:documentationParts, l:part.text)
|
||||
endfor
|
||||
|
||||
if l:suggestion.kind is# 'clasName'
|
||||
if l:suggestion.kind is# 'className'
|
||||
let l:kind = 'f'
|
||||
elseif l:suggestion.kind is# 'parameterName'
|
||||
let l:kind = 'f'
|
||||
@@ -354,17 +360,23 @@ function! ale#completion#ParseLSPCompletions(response) abort
|
||||
let l:kind = 'v'
|
||||
endif
|
||||
|
||||
let l:doc = get(l:item, 'documentation', '')
|
||||
|
||||
if type(l:doc) is v:t_dict && has_key(l:doc, 'value')
|
||||
let l:doc = l:doc.value
|
||||
endif
|
||||
|
||||
call add(l:results, {
|
||||
\ 'word': l:word,
|
||||
\ 'kind': l:kind,
|
||||
\ 'icase': 1,
|
||||
\ 'menu': get(l:item, 'detail', ''),
|
||||
\ 'info': get(l:item, 'documentation', ''),
|
||||
\ 'info': (type(l:doc) is v:t_string ? l:doc : ''),
|
||||
\})
|
||||
endfor
|
||||
|
||||
if has_key(l:info, 'prefix')
|
||||
return ale#completion#Filter(l:buffer, l:results, l:info.prefix)
|
||||
return ale#completion#Filter(l:buffer, &filetype, l:results, l:info.prefix)
|
||||
endif
|
||||
|
||||
return l:results
|
||||
@@ -385,6 +397,7 @@ function! ale#completion#HandleTSServerResponse(conn_id, response) abort
|
||||
if l:command is# 'completions'
|
||||
let l:names = ale#completion#Filter(
|
||||
\ l:buffer,
|
||||
\ &filetype,
|
||||
\ ale#completion#ParseTSServerCompletions(a:response),
|
||||
\ b:ale_completion_info.prefix,
|
||||
\)[: g:ale_completion_max_suggestions - 1]
|
||||
@@ -424,6 +437,58 @@ function! ale#completion#HandleLSPResponse(conn_id, response) abort
|
||||
\)
|
||||
endfunction
|
||||
|
||||
function! s:OnReady(linter, lsp_details, ...) abort
|
||||
let l:buffer = a:lsp_details.buffer
|
||||
let l:id = a:lsp_details.connection_id
|
||||
|
||||
" If we have sent a completion request already, don't send another.
|
||||
if b:ale_completion_info.request_id
|
||||
return
|
||||
endif
|
||||
|
||||
let l:Callback = a:linter.lsp is# 'tsserver'
|
||||
\ ? function('ale#completion#HandleTSServerResponse')
|
||||
\ : function('ale#completion#HandleLSPResponse')
|
||||
call ale#lsp#RegisterCallback(l:id, l:Callback)
|
||||
|
||||
if a:linter.lsp is# 'tsserver'
|
||||
let l:message = ale#lsp#tsserver_message#Completions(
|
||||
\ l:buffer,
|
||||
\ b:ale_completion_info.line,
|
||||
\ b:ale_completion_info.column,
|
||||
\ b:ale_completion_info.prefix,
|
||||
\)
|
||||
else
|
||||
" Send a message saying the buffer has changed first, otherwise
|
||||
" completions won't know what text is nearby.
|
||||
call ale#lsp#NotifyForChanges(l:id, l:buffer)
|
||||
|
||||
" For LSP completions, we need to clamp the column to the length of
|
||||
" the line. python-language-server and perhaps others do not implement
|
||||
" this correctly.
|
||||
let l:message = ale#lsp#message#Completion(
|
||||
\ l:buffer,
|
||||
\ b:ale_completion_info.line,
|
||||
\ min([
|
||||
\ b:ale_completion_info.line_length,
|
||||
\ b:ale_completion_info.column,
|
||||
\ ]),
|
||||
\ ale#completion#GetTriggerCharacter(&filetype, b:ale_completion_info.prefix),
|
||||
\)
|
||||
endif
|
||||
|
||||
let l:request_id = ale#lsp#Send(l:id, l:message)
|
||||
|
||||
if l:request_id
|
||||
let b:ale_completion_info.conn_id = l:id
|
||||
let b:ale_completion_info.request_id = l:request_id
|
||||
|
||||
if has_key(a:linter, 'completion_filter')
|
||||
let b:ale_completion_info.completion_filter = a:linter.completion_filter
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:GetLSPCompletions(linter) abort
|
||||
let l:buffer = bufnr('')
|
||||
let l:lsp_details = ale#lsp_linter#StartLSP(l:buffer, a:linter)
|
||||
@@ -433,58 +498,10 @@ function! s:GetLSPCompletions(linter) abort
|
||||
endif
|
||||
|
||||
let l:id = l:lsp_details.connection_id
|
||||
let l:root = l:lsp_details.project_root
|
||||
|
||||
function! OnReady(...) abort closure
|
||||
" If we have sent a completion request already, don't send another.
|
||||
if b:ale_completion_info.request_id
|
||||
return
|
||||
endif
|
||||
let l:OnReady = function('s:OnReady', [a:linter, l:lsp_details])
|
||||
|
||||
let l:Callback = a:linter.lsp is# 'tsserver'
|
||||
\ ? function('ale#completion#HandleTSServerResponse')
|
||||
\ : function('ale#completion#HandleLSPResponse')
|
||||
call ale#lsp#RegisterCallback(l:id, l:Callback)
|
||||
|
||||
if a:linter.lsp is# 'tsserver'
|
||||
let l:message = ale#lsp#tsserver_message#Completions(
|
||||
\ l:buffer,
|
||||
\ b:ale_completion_info.line,
|
||||
\ b:ale_completion_info.column,
|
||||
\ b:ale_completion_info.prefix,
|
||||
\)
|
||||
else
|
||||
" Send a message saying the buffer has changed first, otherwise
|
||||
" completions won't know what text is nearby.
|
||||
call ale#lsp#NotifyForChanges(l:id, l:root, l:buffer)
|
||||
|
||||
" For LSP completions, we need to clamp the column to the length of
|
||||
" the line. python-language-server and perhaps others do not implement
|
||||
" this correctly.
|
||||
let l:message = ale#lsp#message#Completion(
|
||||
\ l:buffer,
|
||||
\ b:ale_completion_info.line,
|
||||
\ min([
|
||||
\ b:ale_completion_info.line_length,
|
||||
\ b:ale_completion_info.column,
|
||||
\ ]),
|
||||
\ ale#completion#GetTriggerCharacter(&filetype, b:ale_completion_info.prefix),
|
||||
\)
|
||||
endif
|
||||
|
||||
let l:request_id = ale#lsp#Send(l:id, l:message, l:lsp_details.project_root)
|
||||
|
||||
if l:request_id
|
||||
let b:ale_completion_info.conn_id = l:id
|
||||
let b:ale_completion_info.request_id = l:request_id
|
||||
|
||||
if has_key(a:linter, 'completion_filter')
|
||||
let b:ale_completion_info.completion_filter = a:linter.completion_filter
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
|
||||
call ale#lsp#WaitForCapability(l:id, l:root, 'completion', function('OnReady'))
|
||||
call ale#lsp#WaitForCapability(l:id, 'completion', l:OnReady)
|
||||
endfunction
|
||||
|
||||
function! ale#completion#GetCompletions() abort
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
scriptencoding utf-8
|
||||
" Author: w0rp <devw0rp@gmail.com>
|
||||
" Author: João Paulo S. de Souza <joao.paulo.silvasouza@hotmail.com>
|
||||
" Description: Echoes lint message for the current line, if any
|
||||
|
||||
" Controls the milliseconds delay before echoing a message.
|
||||
@@ -24,7 +26,20 @@ function! ale#cursor#TruncatedEcho(original_message) abort
|
||||
|
||||
" The message is truncated and saved to the history.
|
||||
setlocal shortmess+=T
|
||||
exec "norm! :echomsg l:message\n"
|
||||
|
||||
try
|
||||
exec "norm! :echomsg l:message\n"
|
||||
catch /^Vim\%((\a\+)\)\=:E523/
|
||||
" Fallback into manual truncate (#1987)
|
||||
let l:winwidth = winwidth(0)
|
||||
|
||||
if l:winwidth < strdisplaywidth(l:message)
|
||||
" Truncate message longer than window width with trailing '...'
|
||||
let l:message = l:message[:l:winwidth - 4] . '...'
|
||||
endif
|
||||
|
||||
exec 'echomsg l:message'
|
||||
endtry
|
||||
|
||||
" Reset the cursor position if we moved off the end of the line.
|
||||
" Using :norm and :echomsg can move the cursor off the end of the
|
||||
@@ -37,12 +52,11 @@ function! ale#cursor#TruncatedEcho(original_message) abort
|
||||
endtry
|
||||
endfunction
|
||||
|
||||
function! s:FindItemAtCursor() abort
|
||||
let l:buf = bufnr('')
|
||||
let l:info = get(g:ale_buffer_info, l:buf, {})
|
||||
function! s:FindItemAtCursor(buffer) abort
|
||||
let l:info = get(g:ale_buffer_info, a:buffer, {})
|
||||
let l:loclist = get(l:info, 'loclist', [])
|
||||
let l:pos = getcurpos()
|
||||
let l:index = ale#util#BinarySearch(l:loclist, l:buf, l:pos[1], l:pos[2])
|
||||
let l:index = ale#util#BinarySearch(l:loclist, a:buffer, l:pos[1], l:pos[2])
|
||||
let l:loc = l:index >= 0 ? l:loclist[l:index] : {}
|
||||
|
||||
return [l:info, l:loc]
|
||||
@@ -56,42 +70,55 @@ function! s:StopCursorTimer() abort
|
||||
endfunction
|
||||
|
||||
function! ale#cursor#EchoCursorWarning(...) abort
|
||||
if !g:ale_echo_cursor
|
||||
let l:buffer = bufnr('')
|
||||
|
||||
if !g:ale_echo_cursor && !g:ale_cursor_detail
|
||||
return
|
||||
endif
|
||||
|
||||
" Only echo the warnings in normal mode, otherwise we will get problems.
|
||||
if mode() isnot# 'n'
|
||||
if mode(1) isnot# 'n'
|
||||
return
|
||||
endif
|
||||
|
||||
if ale#ShouldDoNothing(bufnr(''))
|
||||
if ale#ShouldDoNothing(l:buffer)
|
||||
return
|
||||
endif
|
||||
|
||||
let l:buffer = bufnr('')
|
||||
let [l:info, l:loc] = s:FindItemAtCursor()
|
||||
let [l:info, l:loc] = s:FindItemAtCursor(l:buffer)
|
||||
|
||||
if !empty(l:loc)
|
||||
let l:format = ale#Var(l:buffer, 'echo_msg_format')
|
||||
let l:msg = ale#GetLocItemMessage(l:loc, l:format)
|
||||
call ale#cursor#TruncatedEcho(l:msg)
|
||||
let l:info.echoed = 1
|
||||
elseif get(l:info, 'echoed')
|
||||
" We'll only clear the echoed message when moving off errors once,
|
||||
" so we don't continually clear the echo line.
|
||||
execute 'echo'
|
||||
let l:info.echoed = 0
|
||||
if g:ale_echo_cursor
|
||||
if !empty(l:loc)
|
||||
let l:format = ale#Var(l:buffer, 'echo_msg_format')
|
||||
let l:msg = ale#GetLocItemMessage(l:loc, l:format)
|
||||
call ale#cursor#TruncatedEcho(l:msg)
|
||||
let l:info.echoed = 1
|
||||
elseif get(l:info, 'echoed')
|
||||
" We'll only clear the echoed message when moving off errors once,
|
||||
" so we don't continually clear the echo line.
|
||||
execute 'echo'
|
||||
let l:info.echoed = 0
|
||||
endif
|
||||
endif
|
||||
|
||||
if g:ale_cursor_detail
|
||||
if !empty(l:loc)
|
||||
call s:ShowCursorDetailForItem(l:loc, {'stay_here': 1})
|
||||
else
|
||||
call ale#preview#CloseIfTypeMatches('ale-preview')
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! ale#cursor#EchoCursorWarningWithDelay() abort
|
||||
if !g:ale_echo_cursor
|
||||
let l:buffer = bufnr('')
|
||||
|
||||
if !g:ale_echo_cursor && !g:ale_cursor_detail
|
||||
return
|
||||
endif
|
||||
|
||||
" Only echo the warnings in normal mode, otherwise we will get problems.
|
||||
if mode() isnot# 'n'
|
||||
if mode(1) isnot# 'n'
|
||||
return
|
||||
endif
|
||||
|
||||
@@ -104,7 +131,7 @@ function! ale#cursor#EchoCursorWarningWithDelay() abort
|
||||
" we should echo something. Otherwise we can end up doing processing
|
||||
" the echo message far too frequently.
|
||||
if l:pos != s:last_pos
|
||||
let l:delay = ale#Var(bufnr(''), 'echo_delay')
|
||||
let l:delay = ale#Var(l:buffer, 'echo_delay')
|
||||
|
||||
let s:last_pos = l:pos
|
||||
let s:cursor_timer = timer_start(
|
||||
@@ -114,24 +141,37 @@ function! ale#cursor#EchoCursorWarningWithDelay() abort
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:ShowCursorDetailForItem(loc, options) abort
|
||||
let l:stay_here = get(a:options, 'stay_here', 0)
|
||||
|
||||
let s:last_detailed_line = line('.')
|
||||
let l:message = get(a:loc, 'detail', a:loc.text)
|
||||
let l:lines = split(l:message, "\n")
|
||||
call ale#preview#Show(l:lines, {'stay_here': l:stay_here})
|
||||
|
||||
" Clear the echo message if we manually displayed details.
|
||||
if !l:stay_here
|
||||
execute 'echo'
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! ale#cursor#ShowCursorDetail() abort
|
||||
let l:buffer = bufnr('')
|
||||
|
||||
" Only echo the warnings in normal mode, otherwise we will get problems.
|
||||
if mode() isnot# 'n'
|
||||
return
|
||||
endif
|
||||
|
||||
if ale#ShouldDoNothing(bufnr(''))
|
||||
if ale#ShouldDoNothing(l:buffer)
|
||||
return
|
||||
endif
|
||||
|
||||
call s:StopCursorTimer()
|
||||
|
||||
let [l:info, l:loc] = s:FindItemAtCursor()
|
||||
let [l:info, l:loc] = s:FindItemAtCursor(l:buffer)
|
||||
|
||||
if !empty(l:loc)
|
||||
let l:message = get(l:loc, 'detail', l:loc.text)
|
||||
|
||||
call ale#preview#Show(split(l:message, "\n"))
|
||||
execute 'echo'
|
||||
call s:ShowCursorDetailForItem(l:loc, {'stay_here': 0})
|
||||
endif
|
||||
endfunction
|
||||
|
||||
@@ -49,7 +49,7 @@ function! ale#definition#HandleLSPResponse(conn_id, response) abort
|
||||
for l:item in l:result
|
||||
let l:filename = ale#path#FromURI(l:item.uri)
|
||||
let l:line = l:item.range.start.line + 1
|
||||
let l:column = l:item.range.start.character
|
||||
let l:column = l:item.range.start.character + 1
|
||||
|
||||
call ale#util#Open(l:filename, l:line, l:column, l:options)
|
||||
break
|
||||
@@ -57,6 +57,39 @@ function! ale#definition#HandleLSPResponse(conn_id, response) abort
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:OnReady(linter, lsp_details, line, column, options, ...) abort
|
||||
let l:buffer = a:lsp_details.buffer
|
||||
let l:id = a:lsp_details.connection_id
|
||||
|
||||
let l:Callback = a:linter.lsp is# 'tsserver'
|
||||
\ ? function('ale#definition#HandleTSServerResponse')
|
||||
\ : function('ale#definition#HandleLSPResponse')
|
||||
call ale#lsp#RegisterCallback(l:id, l:Callback)
|
||||
|
||||
if a:linter.lsp is# 'tsserver'
|
||||
let l:message = ale#lsp#tsserver_message#Definition(
|
||||
\ l:buffer,
|
||||
\ a:line,
|
||||
\ a:column
|
||||
\)
|
||||
else
|
||||
" Send a message saying the buffer has changed first, or the
|
||||
" definition position probably won't make sense.
|
||||
call ale#lsp#NotifyForChanges(l:id, l:buffer)
|
||||
|
||||
" For LSP completions, we need to clamp the column to the length of
|
||||
" the line. python-language-server and perhaps others do not implement
|
||||
" this correctly.
|
||||
let l:message = ale#lsp#message#Definition(l:buffer, a:line, a:column)
|
||||
endif
|
||||
|
||||
let l:request_id = ale#lsp#Send(l:id, l:message)
|
||||
|
||||
let s:go_to_definition_map[l:request_id] = {
|
||||
\ 'open_in_tab': get(a:options, 'open_in_tab', 0),
|
||||
\}
|
||||
endfunction
|
||||
|
||||
function! s:GoToLSPDefinition(linter, options) abort
|
||||
let l:buffer = bufnr('')
|
||||
let [l:line, l:column] = getcurpos()[1:2]
|
||||
@@ -71,39 +104,10 @@ function! s:GoToLSPDefinition(linter, options) abort
|
||||
endif
|
||||
|
||||
let l:id = l:lsp_details.connection_id
|
||||
let l:root = l:lsp_details.project_root
|
||||
|
||||
function! OnReady(...) abort closure
|
||||
let l:Callback = a:linter.lsp is# 'tsserver'
|
||||
\ ? function('ale#definition#HandleTSServerResponse')
|
||||
\ : function('ale#definition#HandleLSPResponse')
|
||||
call ale#lsp#RegisterCallback(l:id, l:Callback)
|
||||
|
||||
if a:linter.lsp is# 'tsserver'
|
||||
let l:message = ale#lsp#tsserver_message#Definition(
|
||||
\ l:buffer,
|
||||
\ l:line,
|
||||
\ l:column
|
||||
\)
|
||||
else
|
||||
" Send a message saying the buffer has changed first, or the
|
||||
" definition position probably won't make sense.
|
||||
call ale#lsp#NotifyForChanges(l:id, l:root, l:buffer)
|
||||
|
||||
" For LSP completions, we need to clamp the column to the length of
|
||||
" the line. python-language-server and perhaps others do not implement
|
||||
" this correctly.
|
||||
let l:message = ale#lsp#message#Definition(l:buffer, l:line, l:column)
|
||||
endif
|
||||
|
||||
let l:request_id = ale#lsp#Send(l:id, l:message, l:lsp_details.project_root)
|
||||
|
||||
let s:go_to_definition_map[l:request_id] = {
|
||||
\ 'open_in_tab': get(a:options, 'open_in_tab', 0),
|
||||
\}
|
||||
endfunction
|
||||
|
||||
call ale#lsp#WaitForCapability(l:id, l:root, 'definition', function('OnReady'))
|
||||
call ale#lsp#WaitForCapability(l:id, 'definition', function('s:OnReady', [
|
||||
\ a:linter, l:lsp_details, l:line, l:column, a:options
|
||||
\]))
|
||||
endfunction
|
||||
|
||||
function! ale#definition#GoTo(options) abort
|
||||
|
||||
@@ -18,6 +18,22 @@ if !has_key(s:, 'executable_cache_map')
|
||||
let s:executable_cache_map = {}
|
||||
endif
|
||||
|
||||
|
||||
function! ale#engine#CleanupEveryBuffer() abort
|
||||
for l:key in keys(g:ale_buffer_info)
|
||||
" The key could be a filename or a buffer number, so try and
|
||||
" convert it to a number. We need a number for the other
|
||||
" functions.
|
||||
let l:buffer = str2nr(l:key)
|
||||
|
||||
if l:buffer > 0
|
||||
" Stop all jobs and clear the results for everything, and delete
|
||||
" all of the data we stored for the buffer.
|
||||
call ale#engine#Cleanup(l:buffer)
|
||||
endif
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
function! ale#engine#ResetExecutableCache() abort
|
||||
let s:executable_cache_map = {}
|
||||
endfunction
|
||||
@@ -231,6 +247,7 @@ function! s:HandleExit(job_id, exit_code) abort
|
||||
|
||||
if l:next_chain_index < len(get(l:linter, 'command_chain', []))
|
||||
call s:InvokeChain(l:buffer, l:executable, l:linter, l:next_chain_index, l:output)
|
||||
|
||||
return
|
||||
endif
|
||||
|
||||
@@ -595,9 +612,8 @@ function! ale#engine#ProcessChain(buffer, linter, chain_index, input) abort
|
||||
\)
|
||||
endif
|
||||
|
||||
" If we have a command to run, execute that.
|
||||
if !empty(l:command)
|
||||
" We hit a command to run, so we'll execute that
|
||||
|
||||
" The chain item can override the output_stream option.
|
||||
if has_key(l:chain_item, 'output_stream')
|
||||
let l:output_stream = l:chain_item.output_stream
|
||||
|
||||
@@ -131,13 +131,17 @@ function! ale#events#Init() abort
|
||||
autocmd InsertLeave * call ale#Queue(0)
|
||||
endif
|
||||
|
||||
if g:ale_echo_cursor
|
||||
if g:ale_echo_cursor || g:ale_cursor_detail
|
||||
autocmd CursorMoved,CursorHold * if exists('*ale#engine#Cleanup') | call ale#cursor#EchoCursorWarningWithDelay() | endif
|
||||
" Look for a warning to echo as soon as we leave Insert mode.
|
||||
" The script's position variable used when moving the cursor will
|
||||
" not be changed here.
|
||||
autocmd InsertLeave * if exists('*ale#engine#Cleanup') | call ale#cursor#EchoCursorWarning() | endif
|
||||
endif
|
||||
|
||||
if g:ale_close_preview_on_insert
|
||||
autocmd InsertEnter * if exists('*ale#preview#CloseIfTypeMatches') | call ale#preview#CloseIfTypeMatches('ale-preview') | endif
|
||||
endif
|
||||
endif
|
||||
augroup END
|
||||
endfunction
|
||||
|
||||
@@ -30,7 +30,14 @@ function! ale#fix#ApplyQueuedFixes() abort
|
||||
call winrestview(l:save)
|
||||
endif
|
||||
|
||||
call setline(1, l:data.output)
|
||||
" If the file is in DOS mode, we have to remove carriage returns from
|
||||
" the ends of lines before calling setline(), or we will see them
|
||||
" twice.
|
||||
let l:lines_to_set = getbufvar(l:buffer, '&fileformat') is# 'dos'
|
||||
\ ? map(copy(l:data.output), 'substitute(v:val, ''\r\+$'', '''', '''')')
|
||||
\ : l:data.output
|
||||
|
||||
call setline(1, l:lines_to_set)
|
||||
|
||||
if l:data.should_save
|
||||
if empty(&buftype)
|
||||
@@ -71,6 +78,7 @@ function! ale#fix#ApplyFixes(buffer, output) abort
|
||||
if l:data.lines_before != l:lines
|
||||
call remove(g:ale_fix_buffer_data, a:buffer)
|
||||
execute 'echoerr ''The file was changed before fixing finished'''
|
||||
|
||||
return
|
||||
endif
|
||||
endif
|
||||
|
||||
@@ -145,6 +145,11 @@ let s:default_registry = {
|
||||
\ 'suggested_filetypes': ['go'],
|
||||
\ 'description': 'Fix Go files imports with goimports.',
|
||||
\ },
|
||||
\ 'gomod': {
|
||||
\ 'function': 'ale#fixers#gomod#Fix',
|
||||
\ 'suggested_filetypes': ['gomod'],
|
||||
\ 'description': 'Fix Go module files with go mod edit -fmt.',
|
||||
\ },
|
||||
\ 'tslint': {
|
||||
\ 'function': 'ale#fixers#tslint#Fix',
|
||||
\ 'suggested_filetypes': ['typescript'],
|
||||
@@ -170,6 +175,21 @@ let s:default_registry = {
|
||||
\ 'suggested_filetypes': ['haskell'],
|
||||
\ 'description': 'Fix Haskell files with brittany.',
|
||||
\ },
|
||||
\ 'hlint': {
|
||||
\ 'function': 'ale#fixers#hlint#Fix',
|
||||
\ 'suggested_filetypes': ['haskell'],
|
||||
\ 'description': 'Refactor Haskell files with hlint.',
|
||||
\ },
|
||||
\ 'stylish-haskell': {
|
||||
\ 'function': 'ale#fixers#stylish_haskell#Fix',
|
||||
\ 'suggested_filetypes': ['haskell'],
|
||||
\ 'description': 'Refactor Haskell files with stylish-haskell.',
|
||||
\ },
|
||||
\ 'ocamlformat': {
|
||||
\ 'function': 'ale#fixers#ocamlformat#Fix',
|
||||
\ 'suggested_filetypes': ['ocaml'],
|
||||
\ 'description': 'Fix OCaml files with ocamlformat.',
|
||||
\ },
|
||||
\ 'refmt': {
|
||||
\ 'function': 'ale#fixers#refmt#Fix',
|
||||
\ 'suggested_filetypes': ['reason'],
|
||||
@@ -180,6 +200,11 @@ let s:default_registry = {
|
||||
\ 'suggested_filetypes': ['sh'],
|
||||
\ 'description': 'Fix sh files with shfmt.',
|
||||
\ },
|
||||
\ 'sqlfmt': {
|
||||
\ 'function': 'ale#fixers#sqlfmt#Fix',
|
||||
\ 'suggested_filetypes': ['sql'],
|
||||
\ 'description': 'Fix SQL files with sqlfmt.',
|
||||
\ },
|
||||
\ 'google_java_format': {
|
||||
\ 'function': 'ale#fixers#google_java_format#Fix',
|
||||
\ 'suggested_filetypes': ['java'],
|
||||
@@ -215,6 +240,16 @@ let s:default_registry = {
|
||||
\ 'suggested_filetypes': ['dart'],
|
||||
\ 'description': 'Fix Dart files with dartfmt.',
|
||||
\ },
|
||||
\ 'xmllint': {
|
||||
\ 'function': 'ale#fixers#xmllint#Fix',
|
||||
\ 'suggested_filetypes': ['xml'],
|
||||
\ 'description': 'Fix XML files with xmllint.',
|
||||
\ },
|
||||
\ 'uncrustify': {
|
||||
\ 'function': 'ale#fixers#uncrustify#Fix',
|
||||
\ 'suggested_filetypes': ['c', 'cpp', 'cs', 'objc', 'objcpp', 'd', 'java', 'p', 'vala' ],
|
||||
\ 'description': 'Fix C, C++, C#, ObjectiveC, ObjectiveC++, D, Java, Pawn, and VALA files with uncrustify.',
|
||||
\ },
|
||||
\}
|
||||
|
||||
" Reset the function registry to the default entries.
|
||||
@@ -243,7 +278,7 @@ endfunction
|
||||
" (name, func, filetypes, desc, aliases)
|
||||
function! ale#fix#registry#Add(name, func, filetypes, desc, ...) abort
|
||||
" This command will throw from the sandbox.
|
||||
let &equalprg=&equalprg
|
||||
let &l:equalprg=&l:equalprg
|
||||
|
||||
if type(a:name) isnot v:t_string
|
||||
throw '''name'' must be a String'
|
||||
|
||||
@@ -25,7 +25,7 @@ endfunction
|
||||
function! ale#fixers#eslint#ProcessEslintDOutput(buffer, output) abort
|
||||
" If the output is an error message, don't use it.
|
||||
for l:line in a:output[:10]
|
||||
if l:line =~# '^Error:'
|
||||
if l:line =~# '\v^Error:|^Could not connect'
|
||||
return []
|
||||
endif
|
||||
endfor
|
||||
|
||||
@@ -17,6 +17,7 @@ function! ale#fixers#fixjson#Fix(buffer) abort
|
||||
let l:command = l:executable . ' --stdin-filename ' . l:filename
|
||||
|
||||
let l:options = ale#Var(a:buffer, 'json_fixjson_options')
|
||||
|
||||
if l:options isnot# ''
|
||||
let l:command .= ' ' . l:options
|
||||
endif
|
||||
|
||||
@@ -6,13 +6,28 @@ function! ale#fixers#generic_python#AddLinesBeforeControlStatements(buffer, line
|
||||
let l:new_lines = []
|
||||
let l:last_indent_size = 0
|
||||
let l:last_line_is_blank = 0
|
||||
let l:in_docstring = 0
|
||||
|
||||
for l:line in a:lines
|
||||
let l:indent_size = len(matchstr(l:line, '^ *'))
|
||||
|
||||
if !l:in_docstring
|
||||
" Make sure it is not just a single line docstring and then verify
|
||||
" it's starting a new docstring
|
||||
if match(l:line, '\v^ *("""|'''''').*("""|'''''')') == -1
|
||||
\&& match(l:line, '\v^ *("""|'''''')') >= 0
|
||||
let l:in_docstring = 1
|
||||
endif
|
||||
else
|
||||
if match(l:line, '\v^ *.*("""|'''''')') >= 0
|
||||
let l:in_docstring = 0
|
||||
endif
|
||||
endif
|
||||
|
||||
if !l:last_line_is_blank
|
||||
\&& !l:in_docstring
|
||||
\&& l:indent_size <= l:last_indent_size
|
||||
\&& match(l:line, '\v^ *(return|if|for|while|break|continue)') >= 0
|
||||
\&& match(l:line, '\v^ *(return|if|for|while|break|continue)(\(| |$)') >= 0
|
||||
call add(l:new_lines, '')
|
||||
endif
|
||||
|
||||
|
||||
10
autoload/ale/fixers/gomod.vim
Normal file
10
autoload/ale/fixers/gomod.vim
Normal file
@@ -0,0 +1,10 @@
|
||||
call ale#Set('go_go_executable', 'go')
|
||||
|
||||
function! ale#fixers#gomod#Fix(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'go_go_executable')
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable) . ' mod edit -fmt %t',
|
||||
\ 'read_temporary_file': 1,
|
||||
\}
|
||||
endfunction
|
||||
@@ -1,13 +1,13 @@
|
||||
" Author: butlerx <butlerx@notthe,cloud>
|
||||
" Description: Integration of Google-java-format with ALE.
|
||||
|
||||
call ale#Set('google_java_format_executable', 'google-java-format')
|
||||
call ale#Set('google_java_format_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
call ale#Set('google_java_format_options', '')
|
||||
call ale#Set('java_google_java_format_executable', 'google-java-format')
|
||||
call ale#Set('java_google_java_format_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
call ale#Set('java_google_java_format_options', '')
|
||||
|
||||
function! ale#fixers#google_java_format#Fix(buffer) abort
|
||||
let l:options = ale#Var(a:buffer, 'google_java_format_options')
|
||||
let l:executable = ale#Var(a:buffer, 'google_java_format_executable')
|
||||
let l:options = ale#Var(a:buffer, 'java_google_java_format_options')
|
||||
let l:executable = ale#Var(a:buffer, 'java_google_java_format_executable')
|
||||
|
||||
if !executable(l:executable)
|
||||
return 0
|
||||
|
||||
16
autoload/ale/fixers/hlint.vim
Normal file
16
autoload/ale/fixers/hlint.vim
Normal file
@@ -0,0 +1,16 @@
|
||||
" Author: eborden <evan@evan-borden.com>
|
||||
" Description: Integration of hlint refactor with ALE.
|
||||
"
|
||||
call ale#Set('haskell_hlint_executable', 'hlint')
|
||||
|
||||
function! ale#fixers#hlint#Fix(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'haskell_hlint_executable')
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable)
|
||||
\ . ' --refactor'
|
||||
\ . ' --refactor-options="--inplace"'
|
||||
\ . ' %t',
|
||||
\ 'read_temporary_file': 1,
|
||||
\}
|
||||
endfunction
|
||||
@@ -1,15 +1,16 @@
|
||||
" Author: Jeff Willette <jrwillette88@gmail.com>
|
||||
" Description: Integration of importjs with ALE.
|
||||
|
||||
call ale#Set('js_importjs_executable', 'importjs')
|
||||
call ale#Set('javascript_importjs_executable', 'importjs')
|
||||
|
||||
function! ale#fixers#importjs#ProcessOutput(buffer, output) abort
|
||||
let l:result = ale#util#FuzzyJSONDecode(a:output, [])
|
||||
|
||||
return split(get(l:result, 'fileContent', ''), "\n")
|
||||
endfunction
|
||||
|
||||
function! ale#fixers#importjs#Fix(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'js_importjs_executable')
|
||||
let l:executable = ale#Var(a:buffer, 'javascript_importjs_executable')
|
||||
|
||||
if !executable(l:executable)
|
||||
return 0
|
||||
|
||||
18
autoload/ale/fixers/ocamlformat.vim
Normal file
18
autoload/ale/fixers/ocamlformat.vim
Normal file
@@ -0,0 +1,18 @@
|
||||
" Author: Stephen Lumenta <@sbl>
|
||||
" Description: Integration of ocamlformat with ALE.
|
||||
|
||||
call ale#Set('ocaml_ocamlformat_executable', 'ocamlformat')
|
||||
call ale#Set('ocaml_ocamlformat_options', '')
|
||||
|
||||
function! ale#fixers#ocamlformat#Fix(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'ocaml_ocamlformat_executable')
|
||||
let l:options = ale#Var(a:buffer, 'ocaml_ocamlformat_options')
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable)
|
||||
\ . (empty(l:options) ? '' : ' ' . l:options)
|
||||
\ . ' --inplace'
|
||||
\ . ' %t',
|
||||
\ 'read_temporary_file': 1,
|
||||
\}
|
||||
endfunction
|
||||
@@ -14,6 +14,7 @@ endfunction
|
||||
|
||||
function! ale#fixers#php_cs_fixer#Fix(buffer) abort
|
||||
let l:executable = ale#fixers#php_cs_fixer#GetExecutable(a:buffer)
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable)
|
||||
\ . ' ' . ale#Var(a:buffer, 'php_cs_fixer_options')
|
||||
|
||||
@@ -18,6 +18,7 @@ function! ale#fixers#phpcbf#Fix(buffer) abort
|
||||
let l:standard_option = !empty(l:standard)
|
||||
\ ? '--standard=' . l:standard
|
||||
\ : ''
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable) . ' --stdin-path=%s ' . l:standard_option . ' -'
|
||||
\}
|
||||
|
||||
@@ -27,6 +27,17 @@ function! ale#fixers#prettier#Fix(buffer) abort
|
||||
\}
|
||||
endfunction
|
||||
|
||||
function! ale#fixers#prettier#ProcessPrettierDOutput(buffer, output) abort
|
||||
" If the output is an error message, don't use it.
|
||||
for l:line in a:output[:10]
|
||||
if l:line =~# '^\w*Error:'
|
||||
return []
|
||||
endif
|
||||
endfor
|
||||
|
||||
return a:output
|
||||
endfunction
|
||||
|
||||
function! ale#fixers#prettier#ApplyFixForVersion(buffer, version_output) abort
|
||||
let l:executable = ale#fixers#prettier#GetExecutable(a:buffer)
|
||||
let l:options = ale#Var(a:buffer, 'javascript_prettier_options')
|
||||
@@ -62,6 +73,17 @@ function! ale#fixers#prettier#ApplyFixForVersion(buffer, version_output) abort
|
||||
let l:options = (!empty(l:options) ? l:options . ' ' : '') . '--parser ' . l:parser
|
||||
endif
|
||||
|
||||
" Special error handling needed for prettier_d
|
||||
if l:executable =~# 'prettier_d$'
|
||||
return {
|
||||
\ 'command': ale#path#BufferCdString(a:buffer)
|
||||
\ . ale#Escape(l:executable)
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
\ . ' --stdin-filepath %s --stdin',
|
||||
\ 'process_with': 'ale#fixers#prettier#ProcessPrettierDOutput',
|
||||
\}
|
||||
endif
|
||||
|
||||
" 1.4.0 is the first version with --stdin-filepath
|
||||
if ale#semver#GTE(l:version, [1, 4, 0])
|
||||
return {
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
if !exists('g:ale_puppet_puppetlint_executable')
|
||||
let g:ale_puppet_puppetlint_executable = 'puppet-lint'
|
||||
endif
|
||||
|
||||
if !exists('g:ale_puppet_puppetlint_options')
|
||||
let g:ale_puppet_puppetlint_options = ''
|
||||
endif
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
call ale#Set('ruby_rubocop_options', '')
|
||||
call ale#Set('ruby_rubocop_executable', 'rubocop')
|
||||
|
||||
function! ale#fixers#rubocop#GetCommand(buffer) abort
|
||||
let l:executable = ale#handlers#rubocop#GetExecutable(a:buffer)
|
||||
let l:exec_args = l:executable =~? 'bundle$'
|
||||
\ ? ' exec rubocop'
|
||||
\ : ''
|
||||
let l:executable = ale#Var(a:buffer, 'ruby_rubocop_executable')
|
||||
let l:config = ale#path#FindNearestFile(a:buffer, '.rubocop.yml')
|
||||
let l:options = ale#Var(a:buffer, 'ruby_rubocop_options')
|
||||
|
||||
return ale#Escape(l:executable) . l:exec_args
|
||||
return ale#handlers#ruby#EscapeExecutable(l:executable, 'rubocop')
|
||||
\ . (!empty(l:config) ? ' --config ' . ale#Escape(l:config) : '')
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
\ . ' --auto-correct %t'
|
||||
|
||||
endfunction
|
||||
|
||||
function! ale#fixers#rubocop#Fix(buffer) abort
|
||||
|
||||
@@ -15,7 +15,6 @@ function! ale#fixers#scalafmt#GetCommand(buffer) abort
|
||||
return ale#Escape(l:executable) . l:exec_args
|
||||
\ . (empty(l:options) ? '' : ' ' . l:options)
|
||||
\ . ' %t'
|
||||
|
||||
endfunction
|
||||
|
||||
function! ale#fixers#scalafmt#Fix(buffer) abort
|
||||
|
||||
@@ -5,13 +5,27 @@ scriptencoding utf-8
|
||||
call ale#Set('sh_shfmt_executable', 'shfmt')
|
||||
call ale#Set('sh_shfmt_options', '')
|
||||
|
||||
function! s:DefaultOption(buffer) abort
|
||||
if getbufvar(a:buffer, '&expandtab') == 0
|
||||
" Tab is used by default
|
||||
return ''
|
||||
endif
|
||||
|
||||
let l:tabsize = getbufvar(a:buffer, '&shiftwidth')
|
||||
|
||||
if l:tabsize == 0
|
||||
let l:tabsize = getbufvar(a:buffer, '&tabstop')
|
||||
endif
|
||||
|
||||
return ' -i ' . l:tabsize
|
||||
endfunction
|
||||
|
||||
function! ale#fixers#shfmt#Fix(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'sh_shfmt_executable')
|
||||
let l:options = ale#Var(a:buffer, 'sh_shfmt_options')
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable)
|
||||
\ . (empty(l:options) ? '' : ' ' . l:options)
|
||||
\ . (empty(l:options) ? s:DefaultOption(a:buffer) : ' ' . l:options)
|
||||
\}
|
||||
|
||||
endfunction
|
||||
|
||||
13
autoload/ale/fixers/sqlfmt.vim
Normal file
13
autoload/ale/fixers/sqlfmt.vim
Normal file
@@ -0,0 +1,13 @@
|
||||
call ale#Set('sql_sqlfmt_executable', 'sqlfmt')
|
||||
call ale#Set('sql_sqlfmt_options', '')
|
||||
|
||||
function! ale#fixers#sqlfmt#Fix(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'sql_sqlfmt_executable')
|
||||
let l:options = ale#Var(a:buffer, 'sql_sqlfmt_options')
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable)
|
||||
\ . ' -w'
|
||||
\ . (empty(l:options) ? '' : ' ' . l:options),
|
||||
\}
|
||||
endfunction
|
||||
15
autoload/ale/fixers/stylish_haskell.vim
Normal file
15
autoload/ale/fixers/stylish_haskell.vim
Normal file
@@ -0,0 +1,15 @@
|
||||
" Author: eborden <evan@evan-borden.com>
|
||||
" Description: Integration of stylish-haskell formatting with ALE.
|
||||
"
|
||||
call ale#Set('haskell_stylish_haskell_executable', 'stylish-haskell')
|
||||
|
||||
function! ale#fixers#stylish_haskell#Fix(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'haskell_stylish_haskell_executable')
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable)
|
||||
\ . ' --inplace'
|
||||
\ . ' %t',
|
||||
\ 'read_temporary_file': 1,
|
||||
\}
|
||||
endfunction
|
||||
16
autoload/ale/fixers/uncrustify.vim
Normal file
16
autoload/ale/fixers/uncrustify.vim
Normal file
@@ -0,0 +1,16 @@
|
||||
" Author: Derek P Sifford <dereksifford@gmail.com>
|
||||
" Description: Fixer for C, C++, C#, ObjectiveC, D, Java, Pawn, and VALA.
|
||||
|
||||
call ale#Set('c_uncrustify_executable', 'uncrustify')
|
||||
call ale#Set('c_uncrustify_options', '')
|
||||
|
||||
function! ale#fixers#uncrustify#Fix(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'c_uncrustify_executable')
|
||||
let l:options = ale#Var(a:buffer, 'c_uncrustify_options')
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable)
|
||||
\ . ' --no-backup'
|
||||
\ . (empty(l:options) ? '' : ' ' . l:options)
|
||||
\}
|
||||
endfunction
|
||||
29
autoload/ale/fixers/xmllint.vim
Normal file
29
autoload/ale/fixers/xmllint.vim
Normal file
@@ -0,0 +1,29 @@
|
||||
" Author: Cyril Roelandt <tipecaml@gmail.com>
|
||||
" Description: Integration of xmllint with ALE.
|
||||
|
||||
call ale#Set('xml_xmllint_executable', 'xmllint')
|
||||
call ale#Set('xml_xmllint_options', '')
|
||||
call ale#Set('xml_xmllint_indentsize', 2)
|
||||
|
||||
function! ale#fixers#xmllint#Fix(buffer) abort
|
||||
let l:executable = ale#Escape(ale#Var(a:buffer, 'xml_xmllint_executable'))
|
||||
let l:filename = ale#Escape(bufname(a:buffer))
|
||||
let l:command = l:executable . ' --format ' . l:filename
|
||||
|
||||
let l:indent = ale#Var(a:buffer, 'xml_xmllint_indentsize')
|
||||
|
||||
if l:indent isnot# ''
|
||||
let l:env = ale#Env('XMLLINT_INDENT', repeat(' ', l:indent))
|
||||
let l:command = l:env . l:command
|
||||
endif
|
||||
|
||||
let l:options = ale#Var(a:buffer, 'xml_xmllint_options')
|
||||
|
||||
if l:options isnot# ''
|
||||
let l:command .= ' ' . l:options
|
||||
endif
|
||||
|
||||
return {
|
||||
\ 'command': l:command
|
||||
\}
|
||||
endfunction
|
||||
27
autoload/ale/go.vim
Normal file
27
autoload/ale/go.vim
Normal file
@@ -0,0 +1,27 @@
|
||||
" Author: Horacio Sanson https://github.com/hsanson
|
||||
" Description: Functions for integrating with Go tools
|
||||
|
||||
" Find the nearest dir listed in GOPATH and assume it the root of the go
|
||||
" project.
|
||||
function! ale#go#FindProjectRoot(buffer) abort
|
||||
let l:sep = has('win32') ? ';' : ':'
|
||||
|
||||
let l:filename = ale#path#Simplify(expand('#' . a:buffer . ':p'))
|
||||
|
||||
for l:name in split($GOPATH, l:sep)
|
||||
let l:path_dir = ale#path#Simplify(l:name)
|
||||
|
||||
" Use the directory from GOPATH if the current filename starts with it.
|
||||
if l:filename[: len(l:path_dir) - 1] is? l:path_dir
|
||||
return l:path_dir
|
||||
endif
|
||||
endfor
|
||||
|
||||
let l:default_go_path = ale#path#Simplify(expand('~/go'))
|
||||
|
||||
if isdirectory(l:default_go_path)
|
||||
return l:default_go_path
|
||||
endif
|
||||
|
||||
return ''
|
||||
endfunction
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user