mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-06 20:54:26 +08:00
Compare commits
253 Commits
v3.3.x
...
lsp-diagno
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e1c8d665d6 | ||
|
|
fe50a711cb | ||
|
|
19e1b5a9d3 | ||
|
|
33a902f489 | ||
|
|
a1c57918ef | ||
|
|
1aae83497d | ||
|
|
f4af0dc84b | ||
|
|
7f43666fb3 | ||
|
|
bcd1a12949 | ||
|
|
53f036fe9f | ||
|
|
3dfebe45c6 | ||
|
|
964e0a2e39 | ||
|
|
ee975196ff | ||
|
|
3f7ea86ae1 | ||
|
|
dd8d7cb4b4 | ||
|
|
8216ee4a65 | ||
|
|
9a251b2865 | ||
|
|
61a1fcc92f | ||
|
|
c9eb8f9d15 | ||
|
|
7fcc0548b0 | ||
|
|
9ce2c29df1 | ||
|
|
59c996c5b8 | ||
|
|
c4cedeea3f | ||
|
|
f3b6269388 | ||
|
|
47f1f49655 | ||
|
|
fe6a91fb92 | ||
|
|
995d78435a | ||
|
|
1c91102112 | ||
|
|
8506d0d1ae | ||
|
|
15bf26632c | ||
|
|
1acd964a2b | ||
|
|
07b0496f6d | ||
|
|
61191dd4bf | ||
|
|
e4a2bff0f2 | ||
|
|
a49943aa62 | ||
|
|
564369db58 | ||
|
|
92753662a7 | ||
|
|
b26608681d | ||
|
|
f0c8eb4fa8 | ||
|
|
0f71d4c494 | ||
|
|
3611c32d60 | ||
|
|
a6db6c95a6 | ||
|
|
7882fb9811 | ||
|
|
e319d48941 | ||
|
|
d38a3f7739 | ||
|
|
699c0dbe80 | ||
|
|
ce2b002c03 | ||
|
|
e5d6d94f71 | ||
|
|
62af9f2650 | ||
|
|
305e1c2fb1 | ||
|
|
6c337ad19c | ||
|
|
83ec182bdf | ||
|
|
3ca2a9ea3c | ||
|
|
0551602b19 | ||
|
|
c9df465148 | ||
|
|
d69f8fed73 | ||
|
|
e82fd24943 | ||
|
|
5b2e69ae61 | ||
|
|
6e4f01f6d1 | ||
|
|
65b49c1b81 | ||
|
|
0ef2c455ee | ||
|
|
9d30fb2f59 | ||
|
|
1e1604be56 | ||
|
|
defb0ea336 | ||
|
|
5cc6b933b1 | ||
|
|
898638abe5 | ||
|
|
4fca3824cc | ||
|
|
d82d968f8a | ||
|
|
9854e19fa9 | ||
|
|
02eb9984b1 | ||
|
|
0b4c665840 | ||
|
|
2e5f135836 | ||
|
|
a7ef1817b7 | ||
|
|
954682108d | ||
|
|
48d73c87c3 | ||
|
|
5c635d5038 | ||
|
|
3220b94d20 | ||
|
|
a35fa4d732 | ||
|
|
a0ad5f938a | ||
|
|
ed0b036220 | ||
|
|
e09520e2d7 | ||
|
|
f4bc3c2711 | ||
|
|
5606606b32 | ||
|
|
f2aef2f510 | ||
|
|
0cd64c87bf | ||
|
|
c7c41e1574 | ||
|
|
adaa7f6f62 | ||
|
|
c88bddfa83 | ||
|
|
70eeae54fb | ||
|
|
d19b238aa2 | ||
|
|
adee52fba0 | ||
|
|
7516e2e484 | ||
|
|
6db58b3379 | ||
|
|
b6b9612691 | ||
|
|
6c10a519f1 | ||
|
|
712b4b3a97 | ||
|
|
831f739340 | ||
|
|
8f9197b79b | ||
|
|
5a8287e676 | ||
|
|
4d132b3ffa | ||
|
|
b01c0b23bb | ||
|
|
24a937e04f | ||
|
|
8d199d8c10 | ||
|
|
9b8413a825 | ||
|
|
00dcf52d6f | ||
|
|
9cc8383fe9 | ||
|
|
b74cd02648 | ||
|
|
5e8904cd3d | ||
|
|
f38a802172 | ||
|
|
52c6146751 | ||
|
|
1c5b84f375 | ||
|
|
8b8ddea6e5 | ||
|
|
38c31302da | ||
|
|
506d392f6a | ||
|
|
6fd9f3c54f | ||
|
|
1b24bd3f5f | ||
|
|
8922478a83 | ||
|
|
531970533a | ||
|
|
94f764631d | ||
|
|
3dbf0b2202 | ||
|
|
17cca243e3 | ||
|
|
d63f5e6a77 | ||
|
|
ebc6718c0a | ||
|
|
32e6fc5975 | ||
|
|
562680e786 | ||
|
|
143074a780 | ||
|
|
9a23ec1f60 | ||
|
|
ecc796b3d7 | ||
|
|
71718722b2 | ||
|
|
32ee7039d0 | ||
|
|
fc45a935bf | ||
|
|
1ccd99e113 | ||
|
|
5cddc4c8e1 | ||
|
|
50e237facd | ||
|
|
901d3ff8dd | ||
|
|
53b01d6a54 | ||
|
|
bd9fc580a1 | ||
|
|
dca621b675 | ||
|
|
e412fa34ff | ||
|
|
ae1d051504 | ||
|
|
4b11cf21dc | ||
|
|
cf270a1ada | ||
|
|
1799f8bec6 | ||
|
|
be69af2705 | ||
|
|
9092af9ad6 | ||
|
|
ac615e7f65 | ||
|
|
1bf445c6d5 | ||
|
|
385dc4130c | ||
|
|
61892e8586 | ||
|
|
92267a14ba | ||
|
|
7b56ddc3f6 | ||
|
|
65f0fd0d6a | ||
|
|
a16f060481 | ||
|
|
0a135456a6 | ||
|
|
d2c2bbf2dc | ||
|
|
79a2dc2d8a | ||
|
|
e4411276a5 | ||
|
|
dadc778451 | ||
|
|
dd3abf1ad9 | ||
|
|
bf55175b69 | ||
|
|
e5816964d1 | ||
|
|
89428cb957 | ||
|
|
0d07f4dba6 | ||
|
|
bf8e7f6368 | ||
|
|
752acbe79b | ||
|
|
9713faf192 | ||
|
|
d52c3db238 | ||
|
|
99a33d8d3f | ||
|
|
108e858d61 | ||
|
|
14350dbb0d | ||
|
|
551fbcfb09 | ||
|
|
8ba7ae818c | ||
|
|
64ddf457e1 | ||
|
|
59e455b4d8 | ||
|
|
ea27441834 | ||
|
|
3bedafc29a | ||
|
|
115ad17ace | ||
|
|
d1bac104a1 | ||
|
|
fe38101db7 | ||
|
|
951b280bd5 | ||
|
|
15cbc0e912 | ||
|
|
af42e0b510 | ||
|
|
0bc2ea0800 | ||
|
|
18cd44c57d | ||
|
|
1174b3b81e | ||
|
|
b216892f0c | ||
|
|
481c5cccbf | ||
|
|
93a4f70414 | ||
|
|
3d10770387 | ||
|
|
f34016a552 | ||
|
|
969f7b080f | ||
|
|
7ba88ad343 | ||
|
|
32e1417d98 | ||
|
|
1084152a11 | ||
|
|
29e5ffe35a | ||
|
|
21f1ab6ffc | ||
|
|
5ab35a7a30 | ||
|
|
c0eff9f2f1 | ||
|
|
7021ed0c68 | ||
|
|
a46121a532 | ||
|
|
5c803fb970 | ||
|
|
9fe9f11521 | ||
|
|
61248e1453 | ||
|
|
fdadaed2ba | ||
|
|
93100159a2 | ||
|
|
57254db9ef | ||
|
|
b0ba31f88e | ||
|
|
41e12fd640 | ||
|
|
7dbd3c96ac | ||
|
|
fbae1bc193 | ||
|
|
e1a0781f9d | ||
|
|
011e4f6590 | ||
|
|
f04887740d | ||
|
|
007c5b1152 | ||
|
|
16f5a1915b | ||
|
|
aca71daa2e | ||
|
|
39c76cf6af | ||
|
|
d5a3da19d4 | ||
|
|
40c1b17e2f | ||
|
|
96f0bf7172 | ||
|
|
bb691d6dee | ||
|
|
6ae26df22b | ||
|
|
c8e9146049 | ||
|
|
c3f9bccb8c | ||
|
|
ab7757b532 | ||
|
|
9c45358aab | ||
|
|
f78e9d634f | ||
|
|
ae2d47ba83 | ||
|
|
2a24b4e0d1 | ||
|
|
4c162877e2 | ||
|
|
6ff1f0b200 | ||
|
|
f2a21c960a | ||
|
|
da5fa17df1 | ||
|
|
e1ae009bac | ||
|
|
45a3e3f574 | ||
|
|
98f466f9ce | ||
|
|
599f7b1eda | ||
|
|
116d713f63 | ||
|
|
0af4899605 | ||
|
|
65088b59b7 | ||
|
|
b6f6d84c25 | ||
|
|
26c79014f5 | ||
|
|
69c1dc8b5f | ||
|
|
0f51c3b01b | ||
|
|
5c703f4e4b | ||
|
|
4872ce2ab4 | ||
|
|
1ee863002a | ||
|
|
ef6715ee41 | ||
|
|
457e0a50f1 | ||
|
|
a18472cc58 | ||
|
|
98b2ef438e | ||
|
|
fe61e00040 | ||
|
|
3cb4f33a9a |
@@ -10,6 +10,20 @@ branches:
|
||||
- master
|
||||
- /v\d+\.\d+\.(x|\d+)/
|
||||
|
||||
# Skip running Windows tests if we only change files that can't impact
|
||||
# Windows tests.
|
||||
skip_commits:
|
||||
files:
|
||||
- '.github/**/*'
|
||||
- .gitattributes
|
||||
- Dockerfile
|
||||
- README.md
|
||||
- doc/*
|
||||
- lua/*
|
||||
- run-tests
|
||||
- supported-tools.md
|
||||
- syntax/*
|
||||
|
||||
# Cache the vim and vader directories between builds.
|
||||
cache:
|
||||
- C:\vim -> .appveyor.yml
|
||||
|
||||
@@ -12,3 +12,7 @@ insert_final_newline = true
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.vader]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
2
.github/ISSUE_TEMPLATE/report-a-bug.md
vendored
2
.github/ISSUE_TEMPLATE/report-a-bug.md
vendored
@@ -42,7 +42,7 @@ Are you having trouble configuring ALE? Try asking for help on [Stack Exchange](
|
||||
### :ALEInfo
|
||||
<details>
|
||||
<summary>Expand</summary>
|
||||
<!-- Paste the output of :ALEInfo here. Try :ALEInfoToClipboard -->
|
||||
<!-- Paste the output of :ALEInfo here. Try :ALEInfo -clipboard -->
|
||||
<!-- Make sure to run :ALEInfo from the buffer where the bug occurred. -->
|
||||
<!-- Read the output. You might figure out what went wrong yourself. -->
|
||||
</details>
|
||||
|
||||
7
.github/workflows/main.yml
vendored
7
.github/workflows/main.yml
vendored
@@ -13,7 +13,7 @@ jobs:
|
||||
build_image:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v4
|
||||
- name: Build docker run image
|
||||
shell: bash
|
||||
env:
|
||||
@@ -28,10 +28,11 @@ jobs:
|
||||
vim-version:
|
||||
- '--vim-80-only'
|
||||
- '--vim-90-only'
|
||||
- '--neovim-02-only'
|
||||
- '--neovim-07-only'
|
||||
- '--neovim-08-only'
|
||||
- '--lua-only'
|
||||
- '--linters-only'
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v4
|
||||
- name: Run tests
|
||||
run: ./run-tests -v ${{ matrix.vim-version }}
|
||||
|
||||
19
.luarc.json
Normal file
19
.luarc.json
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"$schema": "https://raw.githubusercontent.com/LuaLS/vscode-lua/master/setting/schema.json",
|
||||
"diagnostics.globals": [
|
||||
"vim"
|
||||
],
|
||||
"workspace.ignoreDir": [
|
||||
"test"
|
||||
],
|
||||
"workspace.library": [
|
||||
"/usr/share/nvim/runtime/lua"
|
||||
],
|
||||
"runtime.pathStrict": true,
|
||||
"runtime.path": [
|
||||
"lua/?.lua",
|
||||
"lua/?/init.lua"
|
||||
],
|
||||
"runtime.version": "LuaJIT",
|
||||
"hint.enable": false
|
||||
}
|
||||
15
Dockerfile
15
Dockerfile
@@ -1,11 +1,11 @@
|
||||
FROM testbed/vim:24
|
||||
ARG TESTBED_VIM_VERSION=24
|
||||
|
||||
RUN install_vim -tag v8.0.0027 -build \
|
||||
-tag v9.0.0133 -build \
|
||||
-tag neovim:v0.2.0 -build \
|
||||
-tag neovim:v0.8.0 -build
|
||||
FROM testbed/vim:${TESTBED_VIM_VERSION}
|
||||
|
||||
ENV PACKAGES="\
|
||||
lua5.1 \
|
||||
lua5.1-dev \
|
||||
lua5.1-busted \
|
||||
bash \
|
||||
git \
|
||||
python2 \
|
||||
@@ -17,6 +17,11 @@ ENV PACKAGES="\
|
||||
RUN apk --update add $PACKAGES && \
|
||||
rm -rf /var/cache/apk/* /tmp/* /var/tmp/*
|
||||
|
||||
RUN install_vim -tag v8.0.0027 -build \
|
||||
-tag v9.0.0297 -build \
|
||||
-tag neovim:v0.7.0 -build \
|
||||
-tag neovim:v0.8.0 -build
|
||||
|
||||
RUN pip install vim-vint==0.3.21
|
||||
|
||||
RUN git clone https://github.com/junegunn/vader.vim vader && \
|
||||
|
||||
2
LICENSE
2
LICENSE
@@ -1,4 +1,4 @@
|
||||
Copyright (c) 2016-2020, w0rp <devw0rp@gmail.com>
|
||||
Copyright (c) 2016-2023, Dense Analysis
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
||||
662
README.md
662
README.md
@@ -1,15 +1,16 @@
|
||||
# Asynchronous Lint Engine [](https://github.com/dense-analysis/ale/actions?query=event%3Apush+workflow%3ACI+branch%3Amaster++) [](https://ci.appveyor.com/project/dense-analysis/ale) [](https://discord.gg/5zFD6pQxDk)
|
||||
# Asynchronous Lint Engine
|
||||
|
||||
[](https://www.vim.org/) [](https://neovim.io/) [](https://github.com/dense-analysis/ale/actions?query=event%3Apush+workflow%3ACI+branch%3Amaster++) [](https://ci.appveyor.com/project/dense-analysis/ale) [](https://discord.gg/5zFD6pQxDk)
|
||||
|
||||

|
||||
|
||||
ALE (Asynchronous Lint Engine) is a plugin providing linting (syntax checking
|
||||
and semantic errors) in NeoVim 0.2.0+ and Vim 8 while you edit your text files,
|
||||
and semantic errors) in Neovim 0.7.0+ and Vim 8.0+ while you edit your text files,
|
||||
and acts as a Vim [Language Server Protocol](https://langserver.org/) client.
|
||||
|
||||
<img src="https://user-images.githubusercontent.com/3518142/59195938-3a81b100-8b85-11e9-8e8d-6a601b1db908.gif" alt="A linting example with the darkspectrum color scheme in GVim." title="A linting example with the darkspectrum color scheme in GVim.">
|
||||
<video autoplay="true" muted="true" loop="true" controls="false" src="https://user-images.githubusercontent.com/3518142/210141215-8f2ff760-6a87-4704-a11e-c109b8e9ec41.mp4" title="An example showing what ALE can do."></video>
|
||||
|
||||
ALE makes use of NeoVim and Vim 8 job control functions and timers to
|
||||
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
|
||||
text is changed in Vim. This allows for displaying warnings and
|
||||
errors in files being edited in Vim before files have been saved
|
||||
@@ -42,63 +43,35 @@ email at [dev@w0rp.com](mailto:dev@w0rp.com?subject=Helping%20with%20ALE).
|
||||
If you enjoy this plugin, feel free to contribute or check out the author's
|
||||
other content at [w0rp.com](https://w0rp.com).
|
||||
|
||||
## Table of Contents
|
||||
## Why ALE?
|
||||
|
||||
1. [Supported Languages and Tools](#supported-languages)
|
||||
2. [Usage](#usage)
|
||||
1. [Linting](#usage-linting)
|
||||
2. [Fixing](#usage-fixing)
|
||||
3. [Completion](#usage-completion)
|
||||
4. [Go To Definition](#usage-go-to-definition)
|
||||
5. [Find References](#usage-find-references)
|
||||
6. [Hovering](#usage-hover)
|
||||
7. [Symbol Search](#usage-symbol-search)
|
||||
8. [Refactoring: Rename, Actions](#usage-refactoring)
|
||||
3. [Installation](#installation)
|
||||
1. [Installation with Vim package management](#standard-installation)
|
||||
2. [Installation with Pathogen](#installation-with-pathogen)
|
||||
3. [Installation with Vundle](#installation-with-vundle)
|
||||
4. [Installation with Vim-Plug](#installation-with-vim-plug)
|
||||
4. [Contributing](#contributing)
|
||||
5. [FAQ](#faq)
|
||||
1. [How do I disable particular linters?](#faq-disable-linters)
|
||||
2. [How can I see what ALE has configured for the current file?](#faq-get-info)
|
||||
3. [How can I use ALE and coc.nvim together?](#faq-coc-nvim)
|
||||
4. [How can I keep the sign gutter open?](#faq-keep-signs)
|
||||
5. [How can I change the signs ALE uses?](#faq-change-signs)
|
||||
6. [How can I change or disable the highlights ALE uses?](#faq-change-highlights)
|
||||
7. [How can I show errors or warnings in my statusline?](#faq-statusline)
|
||||
8. [How can I show errors or warnings in my lightline?](#faq-lightline)
|
||||
9. [How can I change the format for echo messages?](#faq-echo-format)
|
||||
10. [How can I execute some code when ALE starts or stops linting?](#faq-autocmd)
|
||||
11. [How can I navigate between errors quickly?](#faq-navigation)
|
||||
12. [How can I run linters only when I save files?](#faq-lint-on-save)
|
||||
13. [How can I use the quickfix list instead of the loclist?](#faq-quickfix)
|
||||
14. [How can I check JSX files with both stylelint and eslint?](#faq-jsx-stylelint-eslint)
|
||||
15. [How can I check Vue files with ESLint?](#faq-vue-eslint)
|
||||
16. [Will this plugin eat all of my laptop battery power?](#faq-my-battery-is-sad)
|
||||
17. [How can I configure my C or C++ project?](#faq-c-configuration)
|
||||
18. [How can I configure ALE differently for different buffers?](#faq-buffer-configuration)
|
||||
19. [How can I configure the height of the list in which ALE displays errors?](#faq-list-window-height)
|
||||
20. [How can I run linters or fixers via Docker or a VM?](#faq-vm)
|
||||
21. [How can I change the borders for floating preview windows?](#faq-window-borders)
|
||||
22. [How can I use ALE and vim-lsp together?](#faq-vim-lsp)
|
||||
ALE has been around for many years, and there are many ways to run asynchronous
|
||||
linting and fixing of code in Vim. ALE offers the following.
|
||||
|
||||
<a name="supported-languages"></a>
|
||||
* No dependencies for ALE itself
|
||||
* Lightweight plugin architecture (No JavaScript or Python required)
|
||||
* Low memory footprint
|
||||
* Runs virtually everywhere, including remote shells, and in `git commit`
|
||||
* Out of the box support for running particular linters and language servers
|
||||
* Near-zero configuration with custom code for better defaults
|
||||
* Highly customizable and well-documented (`:help ale-options`)
|
||||
* Breaking changes for the plugin are extremely rare
|
||||
* Integrates with Neovim's LSP client (0.8+) and diagnostics (0.7+)
|
||||
* Support for older Vim and Neovim versions
|
||||
* Windows support
|
||||
* Well-integrated with other plugins
|
||||
|
||||
## 1. Supported Languages and Tools
|
||||
## Supported Languages and Tools
|
||||
|
||||
ALE supports a wide variety of languages and tools. See the
|
||||
[full list](supported-tools.md) in the
|
||||
[Supported Languages and Tools](supported-tools.md) page.
|
||||
|
||||
<a name="usage"></a>
|
||||
|
||||
## 2. Usage
|
||||
## Usage
|
||||
|
||||
<a name="usage-linting"></a>
|
||||
|
||||
### 2.i Linting
|
||||
### Linting
|
||||
|
||||
Once this plugin is installed, while editing your files in supported
|
||||
languages and tools which have been correctly installed,
|
||||
@@ -114,7 +87,7 @@ ale-integration-options` for options specified to particular linters.
|
||||
|
||||
<a name="usage-fixing"></a>
|
||||
|
||||
### 2.ii Fixing
|
||||
### Fixing
|
||||
|
||||
ALE can fix files with the `ALEFix` command. Functions need to be configured
|
||||
either in each buffer with a `b:ale_fixers`, or globally with `g:ale_fixers`.
|
||||
@@ -162,12 +135,18 @@ See `:help ale-fix` for complete information on how to fix files with ALE.
|
||||
|
||||
<a name="usage-completion"></a>
|
||||
|
||||
### 2.iii Completion
|
||||
### Completion
|
||||
|
||||
ALE offers some support for completion via hijacking of omnicompletion while you
|
||||
type. All of ALE's completion information must come from Language Server
|
||||
Protocol linters, or from `tsserver` for TypeScript.
|
||||
|
||||
When running ALE in Neovim 0.8+, ALE will integrate with Neovim's LSP client by
|
||||
default, and any auto-completion plugin that uses the native LSP client will
|
||||
work when ALE runs language servers.
|
||||
[nvim-cmp](https://github.com/hrsh7th/nvim-cmp) is recommended as a
|
||||
completion plugin worth trying in Neovim.
|
||||
|
||||
ALE integrates with [Deoplete](https://github.com/Shougo/deoplete.nvim) as a
|
||||
completion source, named `'ale'`. You can configure Deoplete to only use ALE as
|
||||
the source of completion information, or mix it with other sources.
|
||||
@@ -210,17 +189,18 @@ LSP servers (e.g. eclipselsp). See `:help ale-completion` for more information.
|
||||
|
||||
<a name="usage-go-to-definition"></a>
|
||||
|
||||
### 2.iv Go To Definition
|
||||
### Go To Definition
|
||||
|
||||
ALE supports jumping to the definition of words under your cursor with the
|
||||
`:ALEGoToDefinition` command using any enabled Language Server Protocol linters
|
||||
and `tsserver`.
|
||||
and `tsserver`. In Neovim 0.8+, you can also use Neovim's built in `gd` keybind
|
||||
and more.
|
||||
|
||||
See `:help ale-go-to-definition` for more information.
|
||||
|
||||
<a name="usage-find-references"></a>
|
||||
|
||||
### 2.v Find References
|
||||
### Find References
|
||||
|
||||
ALE supports finding references for words under your cursor with the
|
||||
`:ALEFindReferences` command using any enabled Language Server Protocol linters
|
||||
@@ -230,7 +210,7 @@ See `:help ale-find-references` for more information.
|
||||
|
||||
<a name="usage-hover"></a>
|
||||
|
||||
### 2.vi Hovering
|
||||
### Hovering
|
||||
|
||||
ALE supports "hover" information for printing brief information about symbols at
|
||||
the cursor taken from Language Server Protocol linters and `tsserver` with the
|
||||
@@ -247,7 +227,7 @@ See `:help ale-hover` for more information.
|
||||
|
||||
<a name="usage-symbol-search"></a>
|
||||
|
||||
### 2.vii Symbol Search
|
||||
### Symbol Search
|
||||
|
||||
ALE supports searching for workspace symbols via Language Server Protocol
|
||||
linters with the `ALESymbolSearch` command.
|
||||
@@ -259,9 +239,9 @@ See `:help ale-symbol-search` for more information.
|
||||
|
||||
<a name="usage-refactoring"></a>
|
||||
|
||||
### 2.viii Refactoring: Rename, Actions
|
||||
### Refactoring: Rename, Actions
|
||||
|
||||
ALE supports renaming symbols in symbols in code such as variables or class
|
||||
ALE supports renaming symbols in code such as variables or class
|
||||
names with the `ALERename` command.
|
||||
|
||||
`ALEFileRename` will rename file and fix import paths (tsserver
|
||||
@@ -272,38 +252,31 @@ range selection, such as automatically fixing errors.
|
||||
|
||||
See `:help ale-refactor` for more information.
|
||||
|
||||
<a name="installation"></a>
|
||||
## Installation
|
||||
|
||||
## 3. Installation
|
||||
Add ALE to your runtime path in the usual ways.
|
||||
|
||||
To install this plugin, you should use one of the following methods.
|
||||
For Windows users, replace usage of the Unix `~/.vim` directory with
|
||||
`%USERPROFILE%\vimfiles`, or another directory if you have configured
|
||||
Vim differently. On Windows, your `~/.vimrc` file will be similarly
|
||||
stored in `%USERPROFILE%\_vimrc`.
|
||||
If you have trouble reading `:help ale`, try the following.
|
||||
|
||||
<a name="standard-installation"></a>
|
||||
```vim
|
||||
packloadall | silent! helptags ALL
|
||||
```
|
||||
|
||||
### 3.i. Installation with Vim package management
|
||||
|
||||
In Vim 8 and NeoVim, you can install plugins easily without needing to use
|
||||
any other tools. Simply clone the plugin into your `pack` directory.
|
||||
|
||||
#### Vim 8 on Unix
|
||||
#### Vim `packload`:
|
||||
|
||||
```bash
|
||||
mkdir -p ~/.vim/pack/git-plugins/start
|
||||
git clone --depth 1 https://github.com/dense-analysis/ale.git ~/.vim/pack/git-plugins/start/ale
|
||||
```
|
||||
|
||||
#### NeoVim on Unix
|
||||
#### Neovim `packload`:
|
||||
|
||||
```bash
|
||||
mkdir -p ~/.local/share/nvim/site/pack/git-plugins/start
|
||||
git clone --depth 1 https://github.com/dense-analysis/ale.git ~/.local/share/nvim/site/pack/git-plugins/start/ale
|
||||
```
|
||||
|
||||
#### Vim 8 on Windows
|
||||
#### Windows `packload`:
|
||||
|
||||
```bash
|
||||
# Run these commands in the "Git for Windows" Bash terminal
|
||||
@@ -311,70 +284,42 @@ mkdir -p ~/vimfiles/pack/git-plugins/start
|
||||
git clone --depth 1 https://github.com/dense-analysis/ale.git ~/vimfiles/pack/git-plugins/start/ale
|
||||
```
|
||||
|
||||
#### Generating Vim help files
|
||||
|
||||
You can add the following line to your vimrc files to generate documentation
|
||||
tags automatically, if you don't have something similar already, so you can use
|
||||
the `:help` command to consult ALE's online documentation:
|
||||
|
||||
```vim
|
||||
" Put these lines at the very end of your vimrc file.
|
||||
|
||||
" Load all plugins now.
|
||||
" Plugins need to be added to runtimepath before helptags can be generated.
|
||||
packloadall
|
||||
" Load all of the helptags now, after plugins have been loaded.
|
||||
" All messages and errors will be ignored.
|
||||
silent! helptags ALL
|
||||
```
|
||||
|
||||
<a name="installation-with-pathogen"></a>
|
||||
|
||||
### 3.ii. Installation with Pathogen
|
||||
|
||||
To install this module with [Pathogen](https://github.com/tpope/vim-pathogen),
|
||||
you should clone this repository to your bundle directory, and ensure
|
||||
you have the line `execute pathogen#infect()` in your `~/.vimrc` file.
|
||||
You can run the following commands in your terminal to do so:
|
||||
|
||||
```bash
|
||||
cd ~/.vim/bundle
|
||||
git clone https://github.com/dense-analysis/ale.git
|
||||
```
|
||||
|
||||
<a name="installation-with-vundle"></a>
|
||||
|
||||
### 3.iii. Installation with Vundle
|
||||
|
||||
You can install this plugin using [Vundle](https://github.com/VundleVim/Vundle.vim)
|
||||
by adding the GitHub path for this repository to your `~/.vimrc`:
|
||||
|
||||
```vim
|
||||
Plugin 'dense-analysis/ale'
|
||||
```
|
||||
|
||||
Then run the command `:PluginInstall` in Vim.
|
||||
|
||||
See the Vundle documentation for more information.
|
||||
|
||||
<a name="installation-with-vim-plug"></a>
|
||||
|
||||
### 3.iv. Installation with Vim-Plug
|
||||
|
||||
You can install this plugin using [Vim-Plug](https://github.com/junegunn/vim-plug)
|
||||
by adding the GitHub path for this repository to your `~/.vimrc`:
|
||||
#### [vim-plug](https://github.com/junegunn/vim-plug)
|
||||
|
||||
```vim
|
||||
Plug 'dense-analysis/ale'
|
||||
```
|
||||
|
||||
Then run the command `:PlugInstall` in Vim.
|
||||
#### [Vundle](https://github.com/VundleVim/Vundle.vim)
|
||||
|
||||
See the Vim-Plug documentation for more information.
|
||||
```vim
|
||||
Plugin 'dense-analysis/ale'
|
||||
```
|
||||
|
||||
<a name="contributing"></a>
|
||||
#### [Pathogen](https://github.com/tpope/vim-pathogen)
|
||||
```vim
|
||||
git clone https://github.com/dense-analysis/ale ~/.vim/bundle/ale
|
||||
```
|
||||
|
||||
## 4. Contributing
|
||||
#### [lazy.nvim](https://github.com/folke/lazy.nvim)
|
||||
```lua
|
||||
{
|
||||
'dense-analysis/ale',
|
||||
config = function()
|
||||
-- Configuration goes here.
|
||||
local g = vim.g
|
||||
|
||||
g.ale_ruby_rubocop_auto_correct_all = 1
|
||||
|
||||
g.ale_linters = {
|
||||
ruby = {'rubocop', 'ruby'},
|
||||
lua = {'lua_language_server'}
|
||||
}
|
||||
end
|
||||
}
|
||||
```
|
||||
|
||||
## Contributing
|
||||
|
||||
If you would like to see support for more languages and tools, please
|
||||
[create an issue](https://github.com/dense-analysis/ale/issues)
|
||||
@@ -389,13 +334,11 @@ a Roadmap for the future, and more.
|
||||
If you'd liked to discuss ALE and more check out the Dense Analysis Discord
|
||||
server here: https://discord.gg/5zFD6pQxDk
|
||||
|
||||
<a name="faq"></a>
|
||||
|
||||
## 5. FAQ
|
||||
## FAQ
|
||||
|
||||
<a name="faq-disable-linters"></a>
|
||||
|
||||
### 5.i. How do I disable particular linters?
|
||||
### How do I disable particular linters?
|
||||
|
||||
By default, all available tools for all supported languages will be run. If you
|
||||
want to only select a subset of the tools, you can define `b:ale_linters` for a
|
||||
@@ -441,9 +384,24 @@ This plugin will look for linters in the [`ale_linters`](ale_linters) directory.
|
||||
Each directory within corresponds to a particular filetype in Vim, and each file
|
||||
in each directory corresponds to the name of a particular linter.
|
||||
|
||||
### How do I disable a particular warning or error?
|
||||
|
||||
Warnings and errors should be configured in project configuration files for the
|
||||
relevant tools. ALE supports disabling only warnings relating to trailing
|
||||
whitespace, which Vim users often fix automatically.
|
||||
|
||||
```vim
|
||||
" Disable whitespace warnings
|
||||
let g:ale_warn_about_trailing_whitespace = 0
|
||||
```
|
||||
|
||||
Users generally should not ignore warnings or errors in projects by changing
|
||||
settings in their own editor. Instead, configure tools appropriately so any
|
||||
other user of the same project will see the same problems.
|
||||
|
||||
<a name="faq-get-info"></a>
|
||||
|
||||
### 5.ii. How can I see what ALE has configured for the current file?
|
||||
### How can I see what ALE has configured for the current file?
|
||||
|
||||
Run the following to see what is currently configured:
|
||||
|
||||
@@ -451,57 +409,26 @@ Run the following to see what is currently configured:
|
||||
:ALEInfo
|
||||
```
|
||||
|
||||
<a name="faq-coc-nvim"></a>
|
||||
### How can I disable virtual text appearing at ends of lines?
|
||||
|
||||
### 5.iii. How can I use ALE and coc.nvim together?
|
||||
|
||||
[coc.nvim](https://github.com/neoclide/coc.nvim) is a popular Vim plugin written
|
||||
in TypeScript and dependent on the [npm](https://www.npmjs.com/) ecosystem for
|
||||
providing full IDE features to Vim. Both ALE and coc.nvim implement
|
||||
[Language Server Protocol](https://microsoft.github.io/language-server-protocol/)
|
||||
(LSP) clients for supporting diagnostics (linting with a live server), and other
|
||||
features like auto-completion, and others listed above.
|
||||
|
||||
ALE is primarily focused on integrating with external programs through virtually
|
||||
any means, provided the plugin remains almost entirely written in Vim script.
|
||||
coc.nvim is primarily focused on bringing IDE features to Vim. If you want to
|
||||
run external programs on your files to check for errors, and also use the most
|
||||
advanced IDE features, you might want to use both plugins at the same time.
|
||||
|
||||
The easiest way to get both plugins to work together is to configure coc.nvim to
|
||||
send diagnostics to ALE, so ALE controls how all problems are presented to you,
|
||||
and to disable all LSP features in ALE, so ALE doesn't try to provide LSP
|
||||
features already provided by coc.nvim, such as auto-completion.
|
||||
|
||||
1. Open your coc.nvim configuration file with `:CocConfig` and add
|
||||
`"diagnostic.displayByAle": true` to your settings.
|
||||
2. Add `let g:ale_disable_lsp = 1` to your vimrc file, before plugins are
|
||||
loaded.
|
||||
|
||||
You can also use `b:ale_disable_lsp` in your ftplugin files to enable or disable
|
||||
LSP features in ALE for different filetypes. After you configure coc.nvim and
|
||||
ALE this way, you can further configure how problems appear to you by using all
|
||||
of the settings mentioned in ALE's help file, including how often diagnostics
|
||||
are requested. See `:help ale-lint`.
|
||||
|
||||
The integration between ALE and coc.nvim works using an API ALE offers for
|
||||
letting any other plugin integrate with ALE. If you are interested in writing a
|
||||
similar integration, see `:help ale-lint-other-sources`.
|
||||
|
||||
<a name="faq-keep-signs"></a>
|
||||
|
||||
### 5.iv. How can I keep the sign gutter open?
|
||||
|
||||
You can keep the sign gutter open at all times by setting the
|
||||
`g:ale_sign_column_always` to 1
|
||||
By default, ALE displays errors and warnings with virtual text. The problems ALE
|
||||
shows appear with comment-like syntax after every problem found. You can set ALE
|
||||
to only show problems where the cursor currently lies like so.
|
||||
|
||||
```vim
|
||||
let g:ale_sign_column_always = 1
|
||||
let g:ale_virtualtext_cursor = 'current'
|
||||
```
|
||||
|
||||
If you want to disable virtual text completely, apply the following.
|
||||
|
||||
```vim
|
||||
let g:ale_virtualtext_cursor = 'disabled'
|
||||
```
|
||||
|
||||
<a name="faq-keep-signs"></a>
|
||||
<a name="faq-change-signs"></a>
|
||||
|
||||
### 5.v. How can I change the signs ALE uses?
|
||||
### How can I customise signs?
|
||||
|
||||
Use these options to specify what text should be used for signs:
|
||||
|
||||
@@ -519,9 +446,15 @@ highlight clear ALEErrorSign
|
||||
highlight clear ALEWarningSign
|
||||
```
|
||||
|
||||
You can configure the sign gutter open at all times, if you wish.
|
||||
|
||||
```vim
|
||||
let g:ale_sign_column_always = 1
|
||||
```
|
||||
|
||||
<a name="faq-change-highlights"></a>
|
||||
|
||||
### 5.vi. How can I change or disable the highlights ALE uses?
|
||||
### How can I change or disable the highlights ALE uses?
|
||||
|
||||
ALE's highlights problems with highlight groups which link to `SpellBad`,
|
||||
`SpellCap`, `error`, and `todo` groups by default. The characters that are
|
||||
@@ -545,9 +478,51 @@ highlight ALEWarning ctermbg=DarkMagenta
|
||||
|
||||
See `:help ale-highlights` for more information.
|
||||
|
||||
<a name="faq-statusline"></a>
|
||||
<a name="faq-echo-format"></a>
|
||||
|
||||
### 5.vii. How can I show errors or warnings in my statusline?
|
||||
### How can I change the format for echo messages?
|
||||
|
||||
There are 3 global options that allow customizing the echoed message.
|
||||
|
||||
- `g:ale_echo_msg_format` where:
|
||||
* `%s` is the error message itself
|
||||
* `%...code...%` is an optional error code, and most characters can be
|
||||
written between the `%` characters.
|
||||
* `%linter%` is the linter name
|
||||
* `%severity%` is the severity type
|
||||
- `g:ale_echo_msg_error_str` is the string used for error severity.
|
||||
- `g:ale_echo_msg_warning_str` is the string used for warning severity.
|
||||
|
||||
So for example this:
|
||||
|
||||
```vim
|
||||
let g:ale_echo_msg_error_str = 'E'
|
||||
let g:ale_echo_msg_warning_str = 'W'
|
||||
let g:ale_echo_msg_format = '[%linter%] %s [%severity%]'
|
||||
```
|
||||
|
||||
Will give you:
|
||||
|
||||

|
||||
|
||||
See `:help g:ale_echo_msg_format` for more information.
|
||||
|
||||
<a name="faq-statusline"></a>
|
||||
<a name="faq-lightline"></a>
|
||||
|
||||
### How can I customise the statusline?
|
||||
|
||||
#### lightline
|
||||
|
||||
[lightline](https://github.com/itchyny/lightline.vim) does not have built-in
|
||||
support for ALE, nevertheless there is a plugin that adds this functionality:
|
||||
[maximbaz/lightline-ale](https://github.com/maximbaz/lightline-ale).
|
||||
|
||||
For more information, check out the sources of that plugin,
|
||||
`:help ale#statusline#Count()` and
|
||||
[lightline documentation](https://github.com/itchyny/lightline.vim#advanced-configuration).
|
||||
|
||||
#### vim-airline
|
||||
|
||||
[vim-airline](https://github.com/vim-airline/vim-airline) integrates with ALE
|
||||
for displaying error information in the status bar. If you want to see the
|
||||
@@ -559,9 +534,10 @@ The airline extension can be enabled by adding the following to your vimrc:
|
||||
let g:airline#extensions#ale#enabled = 1
|
||||
```
|
||||
|
||||
If you don't want to use vim-airline, you can implement your own statusline
|
||||
function without adding any other plugins. ALE provides some functions to
|
||||
assist in this endeavour, including:
|
||||
#### Custom statusline
|
||||
|
||||
You can implement your own statusline function without adding any other plugins.
|
||||
ALE provides some functions to assist in this endeavour, including:
|
||||
|
||||
* `ale#statusline#Count`: Which returns the number of problems found by ALE
|
||||
for a specified buffer.
|
||||
@@ -594,47 +570,136 @@ set statusline=%{LinterStatus()}
|
||||
See `:help ale#statusline#Count()` or `:help ale#statusline#FirstProblem()`
|
||||
for more information.
|
||||
|
||||
<a name="faq-lightline"></a>
|
||||
<a name="faq-window-borders"></a>
|
||||
|
||||
### 5.viii. How can I show errors or warnings in my lightline?
|
||||
### How can I change the borders for floating preview windows?
|
||||
|
||||
[lightline](https://github.com/itchyny/lightline.vim) does not have built-in
|
||||
support for ALE, nevertheless there is a plugin that adds this functionality: [maximbaz/lightline-ale](https://github.com/maximbaz/lightline-ale).
|
||||
Borders for floating preview windows are enabled by default. You can use the
|
||||
`g:ale_floating_window_border` setting to configure them.
|
||||
|
||||
For more information, check out the sources of that plugin, `:help ale#statusline#Count()` and [lightline documentation](https://github.com/itchyny/lightline.vim#advanced-configuration).
|
||||
|
||||
<a name="faq-echo-format"></a>
|
||||
|
||||
### 5.ix. How can I change the format for echo messages?
|
||||
|
||||
There are 3 global options that allow customizing the echoed message.
|
||||
|
||||
- `g:ale_echo_msg_format` where:
|
||||
* `%s` is the error message itself
|
||||
* `%...code...%` is an optional error code, and most characters can be
|
||||
written between the `%` characters.
|
||||
* `%linter%` is the linter name
|
||||
* `%severity%` is the severity type
|
||||
- `g:ale_echo_msg_error_str` is the string used for error severity.
|
||||
- `g:ale_echo_msg_warning_str` is the string used for warning severity.
|
||||
|
||||
So for example this:
|
||||
You could disable the border with an empty list.
|
||||
|
||||
```vim
|
||||
let g:ale_echo_msg_error_str = 'E'
|
||||
let g:ale_echo_msg_warning_str = 'W'
|
||||
let g:ale_echo_msg_format = '[%linter%] %s [%severity%]'
|
||||
let g:ale_floating_window_border = []
|
||||
```
|
||||
|
||||
Will give you:
|
||||
If the terminal supports Unicode, you might try setting the value like below, to
|
||||
make it look nicer.
|
||||
|
||||

|
||||
```vim
|
||||
let g:ale_floating_window_border = ['│', '─', '╭', '╮', '╯', '╰', '│', '─']
|
||||
```
|
||||
|
||||
See `:help g:ale_echo_msg_format` for more information.
|
||||
Since vim's default uses nice Unicode characters when possible, you can trick
|
||||
ale into using that default with
|
||||
|
||||
```vim
|
||||
let g:ale_floating_window_border = repeat([''], 8)
|
||||
```
|
||||
|
||||
<a name="faq-my-battery-is-sad"></a>
|
||||
|
||||
### Will this plugin eat all of my laptop battery power?
|
||||
|
||||
ALE takes advantage of the power of various tools to check your code. This of
|
||||
course means that CPU time will be used to continuously check your code. If you
|
||||
are concerned about the CPU time ALE will spend, which will of course imply
|
||||
some cost to battery life, you can adjust your settings to make your CPU do
|
||||
less work.
|
||||
|
||||
First, consider increasing the delay before which ALE will run any linters
|
||||
while you type. ALE uses a timeout which is cancelled and reset every time you
|
||||
type, and this delay can be increased so linters are run less often. See
|
||||
`:help g:ale_lint_delay` for more information.
|
||||
|
||||
If you don't wish to run linters while you type, you can disable that behavior.
|
||||
Set `g:ale_lint_on_text_changed` to `never`. You won't get as frequent error
|
||||
checking, but ALE shouldn't block your ability to edit a document after you save
|
||||
a file, so the asynchronous nature of the plugin will still be an advantage.
|
||||
|
||||
If you are still concerned, you can turn the automatic linting off altogether,
|
||||
including the option `g:ale_lint_on_enter`, and you can run ALE manually with
|
||||
`:ALELint`.
|
||||
|
||||
<a name="faq-coc-nvim"></a>
|
||||
<a name="faq-vim-lsp"></a>
|
||||
|
||||
### How can I use ALE with other LSP clients?
|
||||
|
||||
ALE offers an API for letting any other plugin integrate with ALE. If you are
|
||||
interested in writing an integration, see `:help ale-lint-other-sources`.
|
||||
|
||||
If you're running ALE in Neovim with
|
||||
[nvim-lspconfig](https://github.com/neovim/nvim-lspconfig) for configuring
|
||||
particular language servers, ALE will automatically disable its LSP
|
||||
functionality for any language servers configured with nvim-lspconfig by
|
||||
default. The following setting is applied by default:
|
||||
|
||||
```vim
|
||||
let g:ale_disable_lsp = 'auto'
|
||||
```
|
||||
|
||||
If you are running ALE in combination with another LSP client, you may wish to
|
||||
disable ALE's LSP functionality entirely. You can change the setting to `1` to
|
||||
always disable all LSP functionality.
|
||||
|
||||
```vim
|
||||
let g:ale_disable_lsp = 1
|
||||
```
|
||||
|
||||
You can also use `b:ale_disable_lsp` in your ftplugin files to enable or disable
|
||||
LSP features in ALE for different filetypes.
|
||||
|
||||
#### Neovim Diagnostics
|
||||
|
||||
If you are running Neovim 0.7 or later, you can make ALE display errors and
|
||||
warnings via the Neovim diagnostics API.
|
||||
|
||||
```vim
|
||||
let g:ale_use_neovim_diagnostics_api = 1
|
||||
```
|
||||
|
||||
<!-- We could expand this section to say a little more. -->
|
||||
|
||||
#### coc.nvim
|
||||
|
||||
[coc.nvim](https://github.com/neoclide/coc.nvim) is a popular Vim plugin written
|
||||
in TypeScript and dependent on the [npm](https://www.npmjs.com/) ecosystem for
|
||||
providing full IDE features to Vim. Both ALE and coc.nvim implement
|
||||
[Language Server Protocol](https://microsoft.github.io/language-server-protocol/)
|
||||
(LSP) clients for supporting diagnostics (linting with a live server), and other
|
||||
features like auto-completion, and others listed above.
|
||||
|
||||
ALE is primarily focused on integrating with external programs through virtually
|
||||
any means, provided the plugin remains almost entirely written in Vim script.
|
||||
coc.nvim is primarily focused on bringing IDE features to Vim. If you want to
|
||||
run external programs on your files to check for errors, and also use the most
|
||||
advanced IDE features, you might want to use both plugins at the same time.
|
||||
|
||||
The easiest way to get both plugins to work together is to configure coc.nvim to
|
||||
send diagnostics to ALE, so ALE controls how all problems are presented to you,
|
||||
and to disable all LSP features in ALE, so ALE doesn't try to provide LSP
|
||||
features already provided by coc.nvim, such as auto-completion.
|
||||
|
||||
Open your coc.nvim configuration file with `:CocConfig` and add
|
||||
`"diagnostic.displayByAle": true` to your settings.
|
||||
|
||||
#### vim-lsp
|
||||
|
||||
[vim-lsp](https://github.com/prabirshrestha/vim-lsp) is a popular plugin as
|
||||
implementation of Language Server Protocol (LSP) client for Vim. It provides
|
||||
all the LSP features including auto completion, diagnostics, go to definitions,
|
||||
etc.
|
||||
|
||||
[vim-lsp-ale](https://github.com/rhysd/vim-lsp-ale) is a bridge plugin to solve
|
||||
the problem when using both ALE and vim-lsp. With the plugin, diagnostics are
|
||||
provided by vim-lsp and ALE can handle all the errors. Please read
|
||||
[vim-lsp-ale's documentation](https://github.com/rhysd/vim-lsp-ale/blob/master/doc/vim-lsp-ale.txt)
|
||||
for more details.
|
||||
|
||||
<a name="faq-autocmd"></a>
|
||||
|
||||
### 5.x. How can I execute some code when ALE starts or stops linting?
|
||||
### How can I execute some code when ALE starts or stops linting?
|
||||
|
||||
ALE runs its own [autocmd](http://vimdoc.sourceforge.net/htmldoc/autocmd.html)
|
||||
events when a lint or fix cycle are started and stopped. There is also an event
|
||||
@@ -657,7 +722,7 @@ augroup END
|
||||
|
||||
<a name="faq-navigation"></a>
|
||||
|
||||
### 5.xi. How can I navigate between errors quickly?
|
||||
### How can I navigate between errors quickly?
|
||||
|
||||
ALE offers some commands with `<Plug>` keybinds for moving between warnings and
|
||||
errors quickly. You can map the keys Ctrl+j and Ctrl+k to moving between errors
|
||||
@@ -673,12 +738,11 @@ For more information, consult the online documentation with
|
||||
|
||||
<a name="faq-lint-on-save"></a>
|
||||
|
||||
### 5.xii. How can I run linters only when I save files?
|
||||
### How can I run linters only when I save files?
|
||||
|
||||
ALE offers an option `g:ale_lint_on_save` for enabling running the linters
|
||||
when files are saved. This option is enabled by default. If you only
|
||||
wish to run linters when files are saved, you can turn the other
|
||||
options off.
|
||||
ALE offers an option `g:ale_lint_on_save` for enabling running the linters when
|
||||
files are saved. This option is enabled by default. If you only wish to run
|
||||
linters when files are saved, you can turn the other options off.
|
||||
|
||||
```vim
|
||||
" Write this in your vimrc file
|
||||
@@ -689,16 +753,16 @@ let g:ale_lint_on_insert_leave = 0
|
||||
let g:ale_lint_on_enter = 0
|
||||
```
|
||||
|
||||
If for whatever reason you don't wish to run linters again when you save
|
||||
files, you can set `g:ale_lint_on_save` to `0`.
|
||||
If for whatever reason you don't wish to run linters again when you save files,
|
||||
you can set `g:ale_lint_on_save` to `0`.
|
||||
|
||||
<a name="faq-quickfix"></a>
|
||||
|
||||
### 5.xiii. How can I use the quickfix list instead of the loclist?
|
||||
### How can I use the quickfix list instead of the loclist?
|
||||
|
||||
The quickfix list can be enabled by turning the `g:ale_set_quickfix`
|
||||
option on. If you wish to also disable the loclist, you can disable
|
||||
the `g:ale_set_loclist` option.
|
||||
The quickfix list can be enabled by turning the `g:ale_set_quickfix` option on.
|
||||
If you wish to also disable the loclist, you can disable the `g:ale_set_loclist`
|
||||
option.
|
||||
|
||||
```vim
|
||||
" Write this in your vimrc file
|
||||
@@ -706,10 +770,10 @@ let g:ale_set_loclist = 0
|
||||
let g:ale_set_quickfix = 1
|
||||
```
|
||||
|
||||
If you wish to show Vim windows for the loclist or quickfix items
|
||||
when a file contains warnings or errors, `g:ale_open_list` can be
|
||||
set to `1`. `g:ale_keep_list_window_open` can be set to `1`
|
||||
if you wish to keep the window open even after errors disappear.
|
||||
If you wish to show Vim windows for the loclist or quickfix items when a file
|
||||
contains warnings or errors, `g:ale_open_list` can be set to `1`.
|
||||
`g:ale_keep_list_window_open` can be set to `1` if you wish to keep the window
|
||||
open even after errors disappear.
|
||||
|
||||
```vim
|
||||
let g:ale_open_list = 1
|
||||
@@ -722,12 +786,11 @@ let g:ale_keep_list_window_open = 1
|
||||
You can also set `let g:ale_list_vertical = 1` to open the windows vertically
|
||||
instead of the default horizontally.
|
||||
|
||||
### Why isn't ALE checking my filetype?
|
||||
|
||||
<a name="faq-jsx-stylelint-eslint"></a>
|
||||
|
||||
### 5.xiv. How can I check JSX files with both stylelint and eslint?
|
||||
|
||||
If you configure ALE options correctly in your vimrc file, and install
|
||||
the right tools, you can check JSX files with stylelint and eslint.
|
||||
#### stylelint for JSX
|
||||
|
||||
First, install eslint and install stylelint with
|
||||
[stylelint-processor-styled-components](https://github.com/styled-components/stylelint-processor-styled-components).
|
||||
@@ -766,7 +829,7 @@ no linter will be run twice for the same file.
|
||||
|
||||
<a name="faq-vue-eslint"></a>
|
||||
|
||||
### 5.xv. How can I check Vue files with ESLint?
|
||||
#### Checking Vue with ESLint
|
||||
|
||||
To check Vue files with ESLint, your ESLint project configuration file must be
|
||||
configured to use the [Vue plugin](https://github.com/vuejs/eslint-plugin-vue).
|
||||
@@ -795,33 +858,9 @@ let g:ale_linter_aliases = {'vue': ['vue', 'javascript']}
|
||||
let g:ale_linters = {'vue': ['eslint', 'vls']}
|
||||
```
|
||||
|
||||
<a name="faq-my-battery-is-sad"></a>
|
||||
|
||||
### 5.xvi. Will this plugin eat all of my laptop battery power?
|
||||
|
||||
ALE takes advantage of the power of various tools to check your code. This of
|
||||
course means that CPU time will be used to continuously check your code. If you
|
||||
are concerned about the CPU time ALE will spend, which will of course imply
|
||||
some cost to battery life, you can adjust your settings to make your CPU do
|
||||
less work.
|
||||
|
||||
First, consider increasing the delay before which ALE will run any linters
|
||||
while you type. ALE uses a timeout which is cancelled and reset every time you
|
||||
type, and this delay can be increased so linters are run less often. See
|
||||
`:help g:ale_lint_delay` for more information.
|
||||
|
||||
If you don't wish to run linters while you type, you can disable that behavior.
|
||||
Set `g:ale_lint_on_text_changed` to `never`. You won't get as frequent error
|
||||
checking, but ALE shouldn't block your ability to edit a document after you save
|
||||
a file, so the asynchronous nature of the plugin will still be an advantage.
|
||||
|
||||
If you are still concerned, you can turn the automatic linting off altogether,
|
||||
including the option `g:ale_lint_on_enter`, and you can run ALE manually with
|
||||
`:ALELint`.
|
||||
|
||||
<a name="faq-c-configuration"></a>
|
||||
|
||||
### 5.xvii. How can I configure my C or C++ project?
|
||||
### How can I configure my C or C++ project?
|
||||
|
||||
The structure of C and C++ projects varies wildly from project to project, with
|
||||
many different build tools being used for building them, and many different
|
||||
@@ -852,60 +891,9 @@ You can also configure ALE to automatically run `make -n` to run dry runs on
|
||||
`Makefile`s to discover compiler flags. This can execute arbitrary code, so the
|
||||
option is disabled by default. See `:help g:ale_c_parse_makefile`.
|
||||
|
||||
You may also configure buffer-local settings for linters with project-specific
|
||||
vimrc files. [local_vimrc](https://github.com/LucHermitte/local_vimrc) can be
|
||||
used for executing local vimrc files which can be shared in your project.
|
||||
|
||||
<a name="faq-buffer-configuration"></a>
|
||||
|
||||
### 5.xviii. How can I configure ALE differently for different buffers?
|
||||
|
||||
ALE offers various ways to configure which linters or fixers are run, and
|
||||
other settings. For the majority of ALE's settings, they can either be
|
||||
configured globally with a `g:` variable prefix, or for a specific buffer
|
||||
with a `b:` variable prefix. For example, you can configure a Python ftplugin
|
||||
file like so.
|
||||
|
||||
```vim
|
||||
" In ~/.vim/ftplugin/python.vim
|
||||
|
||||
" Check Python files with flake8 and pylint.
|
||||
let b:ale_linters = ['flake8', 'pylint']
|
||||
" Fix Python files with autopep8 and yapf.
|
||||
let b:ale_fixers = ['autopep8', 'yapf']
|
||||
" Disable warnings about trailing whitespace for Python files.
|
||||
let b:ale_warn_about_trailing_whitespace = 0
|
||||
```
|
||||
|
||||
For configuring files based on regular expression patterns matched against the
|
||||
absolute path to a file, you can use `g:ale_pattern_options`.
|
||||
|
||||
```vim
|
||||
" Do not lint or fix minified files.
|
||||
let g:ale_pattern_options = {
|
||||
\ '\.min\.js$': {'ale_linters': [], 'ale_fixers': []},
|
||||
\ '\.min\.css$': {'ale_linters': [], 'ale_fixers': []},
|
||||
\}
|
||||
" If you configure g:ale_pattern_options outside of vimrc, you need this.
|
||||
let g:ale_pattern_options_enabled = 1
|
||||
```
|
||||
|
||||
Buffer-local variables for settings always override the global settings.
|
||||
|
||||
<a name="faq-list-window-height"></a>
|
||||
|
||||
### 5.xix. How can I configure the height of the list in which ALE displays errors?
|
||||
|
||||
To set a default height for the error list, use the `g:ale_list_window_size` variable.
|
||||
|
||||
```vim
|
||||
" Show 5 lines of errors (default: 10)
|
||||
let g:ale_list_window_size = 5
|
||||
```
|
||||
|
||||
<a name="faq-vm"></a>
|
||||
|
||||
### 5.xx. How can I run linters or fixers via Docker or a VM?
|
||||
### How can I run linters or fixers via Docker or a VM?
|
||||
|
||||
ALE supports running linters or fixers via Docker, virtual machines, or in
|
||||
combination with any remote machine with a different file system, so long as the
|
||||
@@ -913,51 +901,3 @@ tools are well-integrated with ALE, and ALE is properly configured to run the
|
||||
correct commands and map filename paths between different file systems. See
|
||||
`:help ale-lint-other-machines` for the full documentation on how to configure
|
||||
ALE to support this.
|
||||
|
||||
<a name="faq-window-borders"></a>
|
||||
|
||||
### 5.xxi. How can I change the borders for floating preview windows?
|
||||
|
||||
Borders for floating preview windows are enabled by default. You can use the
|
||||
`g:ale_floating_window_border` setting to configure them.
|
||||
|
||||
You could disable the border with an empty list.
|
||||
|
||||
```vim
|
||||
let g:ale_floating_window_border = []
|
||||
```
|
||||
|
||||
If the terminal supports Unicode, you might try setting the value like below, to
|
||||
make it look nicer.
|
||||
|
||||
```vim
|
||||
let g:ale_floating_window_border = ['│', '─', '╭', '╮', '╯', '╰', '│', '─']
|
||||
```
|
||||
|
||||
Since vim's default uses nice unicode characters when possible, you can trick
|
||||
ale into using that default with
|
||||
|
||||
```vim
|
||||
let g:ale_floating_window_border = repeat([''], 8)
|
||||
```
|
||||
|
||||
<a name="faq-vim-lsp"></a>
|
||||
|
||||
### 5.xxii. How can I use ALE and vim-lsp together?
|
||||
|
||||
[vim-lsp](https://github.com/prabirshrestha/vim-lsp) is a popular plugin as
|
||||
implementation of Language Server Protocol (LSP) client for Vim. It provides
|
||||
all the LSP features including auto completion, diagnostics, go to definitions,
|
||||
etc.
|
||||
|
||||
ALE also provides LSP support for diagnostics. When you use both ALE and
|
||||
vim-lsp, one option is disabling ALE's LSP support by
|
||||
`let g:ale_disable_lsp = 1`. However ALE provides integration of external
|
||||
programs. Showing errors from language servers by vim-lsp and showing errors
|
||||
from other external programs by ALE are confusing and problematic.
|
||||
|
||||
[vim-lsp-ale](https://github.com/rhysd/vim-lsp-ale) is a bridge plugin to solve
|
||||
the problem when using both ALE and vim-lsp. With the plugin, diagnostics are
|
||||
provided by vim-lsp and ALE can handle all the errors. Please read
|
||||
[vim-lsp-ale's documentation](https://github.com/rhysd/vim-lsp-ale/blob/master/doc/vim-lsp-ale.txt)
|
||||
for more details.
|
||||
|
||||
@@ -29,10 +29,20 @@ function! ale_linters#ansible#ansible_lint#Handle(buffer, version, lines) abort
|
||||
|
||||
for l:issue in l:linter_issues
|
||||
if ale#path#IsBufferPath(a:buffer, l:issue.location.path)
|
||||
if exists('l:issue.location.positions')
|
||||
let l:coord_keyname = 'positions'
|
||||
else
|
||||
let l:coord_keyname = 'lines'
|
||||
endif
|
||||
|
||||
let l:column_member = printf(
|
||||
\ 'l:issue.location.%s.begin.column', l:coord_keyname
|
||||
\)
|
||||
|
||||
call add(l:output, {
|
||||
\ 'lnum': exists('l:issue.location.lines.begin.column') ? l:issue.location.lines.begin.line :
|
||||
\ l:issue.location.lines.begin,
|
||||
\ 'col': exists('l:issue.location.lines.begin.column') ? l:issue.location.lines.begin.column : 0,
|
||||
\ 'lnum': exists(l:column_member) ? l:issue.location[l:coord_keyname].begin.line :
|
||||
\ l:issue.location[l:coord_keyname].begin,
|
||||
\ 'col': exists(l:column_member) ? l:issue.location[l:coord_keyname].begin.column : 0,
|
||||
\ 'text': l:issue.check_name,
|
||||
\ 'detail': l:issue.description,
|
||||
\ 'code': l:issue.severity,
|
||||
|
||||
@@ -4,17 +4,17 @@
|
||||
call ale#Set('ansible_language_server_executable', 'ansible-language-server')
|
||||
call ale#Set('ansible_language_server_config', {})
|
||||
|
||||
function! ale_linters#ansible#ansible_language_server#Executable(buffer) abort
|
||||
function! ale_linters#ansible#language_server#Executable(buffer) abort
|
||||
return ale#Var(a:buffer, 'ansible_language_server_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#ansible#ansible_language_server#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#ansible#ansible_language_server#Executable(a:buffer)
|
||||
function! ale_linters#ansible#language_server#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#ansible#language_server#Executable(a:buffer)
|
||||
|
||||
return ale#Escape(l:executable) . ' --stdio'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#ansible#ansible_language_server#FindProjectRoot(buffer) abort
|
||||
function! ale_linters#ansible#language_server#FindProjectRoot(buffer) abort
|
||||
let l:dir = fnamemodify(
|
||||
\ ale#path#FindNearestFile(a:buffer, 'ansible.cfg'),
|
||||
\ ':h'
|
||||
@@ -37,10 +37,11 @@ function! ale_linters#ansible#ansible_language_server#FindProjectRoot(buffer) ab
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('ansible', {
|
||||
\ 'name': 'ansible-language-server',
|
||||
\ 'name': 'language_server',
|
||||
\ 'aliases': ['ansible_language_server', 'ansible-language-server'],
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': function('ale_linters#ansible#ansible_language_server#Executable'),
|
||||
\ 'command': function('ale_linters#ansible#ansible_language_server#GetCommand'),
|
||||
\ 'project_root': function('ale_linters#ansible#ansible_language_server#FindProjectRoot'),
|
||||
\ 'executable': function('ale_linters#ansible#language_server#Executable'),
|
||||
\ 'command': function('ale_linters#ansible#language_server#GetCommand'),
|
||||
\ 'project_root': function('ale_linters#ansible#language_server#FindProjectRoot'),
|
||||
\ 'lsp_config': {b -> ale#Var(b, 'ansible_language_server_config')}
|
||||
\})
|
||||
37
ale_linters/asm/llvm_mc.vim
Normal file
37
ale_linters/asm/llvm_mc.vim
Normal file
@@ -0,0 +1,37 @@
|
||||
" Author: uidops <uidops@protonmail.com>
|
||||
" Description: llvm-mc linter for asm files
|
||||
|
||||
call ale#Set('asm_llvm_mc_executable', 'llvm-mc')
|
||||
call ale#Set('asm_llvm_mc_options', '')
|
||||
|
||||
function! ale_linters#asm#llvm_mc#GetCommand(buffer) abort
|
||||
return '%e --assemble'
|
||||
\ . ' --filetype=asm'
|
||||
\ . ' -o ' . g:ale#util#nul_file
|
||||
\ . ' ' . ale#Var(a:buffer, 'asm_llvm_mc_options')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#asm#llvm_mc#Handle(buffer, lines) abort
|
||||
let l:pattern = '^.\+:\(\d\+\):\(\d\+\): \([^:]\+\): \(.\+\)$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[1] + 0,
|
||||
\ 'col': l:match[2] + 0,
|
||||
\ 'type': l:match[3] =~? 'error' ? 'E' : 'W',
|
||||
\ 'text': l:match[4],
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('asm', {
|
||||
\ 'name': 'llvm_mc',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': {b -> ale#Var(b, 'asm_llvm_mc_executable')},
|
||||
\ 'command': function('ale_linters#asm#llvm_mc#GetCommand'),
|
||||
\ 'callback': 'ale_linters#asm#llvm_mc#Handle',
|
||||
\})
|
||||
|
||||
11
ale_linters/astro/eslint.vim
Normal file
11
ale_linters/astro/eslint.vim
Normal file
@@ -0,0 +1,11 @@
|
||||
" Author: Hyuksang Kwon <gwonhyuksang@gmail.com>
|
||||
" Description: eslint for astro files
|
||||
|
||||
call ale#linter#Define('astro', {
|
||||
\ 'name': 'eslint',
|
||||
\ 'output_stream': 'both',
|
||||
\ 'executable': function('ale#handlers#eslint#GetExecutable'),
|
||||
\ 'cwd': function('ale#handlers#eslint#GetCwd'),
|
||||
\ 'command': function('ale#handlers#eslint#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#eslint#HandleJSON',
|
||||
\})
|
||||
69
ale_linters/bicep/az_bicep.vim
Normal file
69
ale_linters/bicep/az_bicep.vim
Normal file
@@ -0,0 +1,69 @@
|
||||
" Author: Carl Smedstad <carl.smedstad at protonmail dot com>
|
||||
" Description: az_bicep for bicep files
|
||||
|
||||
let g:ale_bicep_az_bicep_executable =
|
||||
\ get(g:, 'ale_bicep_az_bicep_executable', 'az')
|
||||
|
||||
let g:ale_bicep_az_bicep_options =
|
||||
\ get(g:, 'ale_bicep_az_bicep_options', '')
|
||||
|
||||
function! ale_linters#bicep#az_bicep#Executable(buffer) abort
|
||||
return ale#Var(a:buffer, 'bicep_az_bicep_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#bicep#az_bicep#Command(buffer) abort
|
||||
let l:executable = ale_linters#bicep#az_bicep#Executable(a:buffer)
|
||||
let l:options = ale#Var(a:buffer, 'bicep_az_bicep_options')
|
||||
|
||||
if has('win32')
|
||||
let l:nullfile = 'NUL'
|
||||
else
|
||||
let l:nullfile = '/dev/null'
|
||||
endif
|
||||
|
||||
return ale#Escape(l:executable)
|
||||
\ . ' bicep build --outfile '
|
||||
\ . l:nullfile
|
||||
\ . ' --file '
|
||||
\ . '%s '
|
||||
\ . l:options
|
||||
endfunction
|
||||
|
||||
function! ale_linters#bicep#az_bicep#Handle(buffer, lines) abort
|
||||
let l:pattern = '\v^([A-Z]+)?(:\s)?(.*)\((\d+),(\d+)\)\s:\s([a-zA-Z]*)\s([-a-zA-Z0-9]*):\s(.*)'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
if l:match[1] is# 'ERROR'
|
||||
let l:type = 'E'
|
||||
elseif l:match[1] is# 'WARNING'
|
||||
let l:type = 'W'
|
||||
elseif l:match[6] is# 'Error'
|
||||
let l:type = 'E'
|
||||
elseif l:match[6] is# 'Warning'
|
||||
let l:type = 'W'
|
||||
else
|
||||
let l:type = 'I'
|
||||
endif
|
||||
|
||||
call add(l:output, {
|
||||
\ 'filename': l:match[3],
|
||||
\ 'lnum': l:match[4] + 0,
|
||||
\ 'col': l:match[5] + 0,
|
||||
\ 'type': l:type,
|
||||
\ 'code': l:match[7],
|
||||
\ 'text': l:match[8],
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('bicep', {
|
||||
\ 'name': 'az_bicep',
|
||||
\ 'executable': function('ale_linters#bicep#az_bicep#Executable'),
|
||||
\ 'command': function('ale_linters#bicep#az_bicep#Command'),
|
||||
\ 'callback': 'ale_linters#bicep#az_bicep#Handle',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
||||
@@ -30,24 +30,25 @@ function! ale_linters#bicep#bicep#Command(buffer) abort
|
||||
endfunction
|
||||
|
||||
function! ale_linters#bicep#bicep#Handle(buffer, lines) abort
|
||||
let l:pattern = '\v^.*\((\d+),(\d+)\)\s:\s([a-zA-Z]*)\s([-a-zA-Z0-9]*):\s(.*)'
|
||||
let l:pattern = '\v^(.*)\((\d+),(\d+)\)\s:\s([a-zA-Z]*)\s([-a-zA-Z0-9]*):\s(.*)'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
if l:match[3] is# 'Error'
|
||||
if l:match[4] is# 'Error'
|
||||
let l:type = 'E'
|
||||
elseif l:match[3] is# 'Warning'
|
||||
elseif l:match[4] is# 'Warning'
|
||||
let l:type = 'W'
|
||||
else
|
||||
let l:type = 'I'
|
||||
endif
|
||||
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[1] + 0,
|
||||
\ 'col': l:match[2] + 0,
|
||||
\ 'filename': l:match[1],
|
||||
\ 'lnum': l:match[2] + 0,
|
||||
\ 'col': l:match[3] + 0,
|
||||
\ 'type': l:type,
|
||||
\ 'code': l:match[4],
|
||||
\ 'text': l:match[5],
|
||||
\ 'code': l:match[5],
|
||||
\ 'text': l:match[6],
|
||||
\})
|
||||
endfor
|
||||
|
||||
|
||||
40
ale_linters/bzl/buildifier.vim
Normal file
40
ale_linters/bzl/buildifier.vim
Normal file
@@ -0,0 +1,40 @@
|
||||
" Author: Chuck Grindel <chuck.grindel@gmail.com>
|
||||
" Description: Bazel Starlark lint support using buildifier.
|
||||
|
||||
function! ale_linters#bzl#buildifier#GetCommand(buffer) abort
|
||||
let l:executable = ale#Escape(ale#fixers#buildifier#GetExecutable(a:buffer))
|
||||
let l:options = ale#Var(a:buffer, 'bazel_buildifier_options')
|
||||
let l:filename = ale#Escape(bufname(a:buffer))
|
||||
|
||||
let l:command = l:executable . ' -mode check -lint warn -path %s'
|
||||
|
||||
if l:options isnot# ''
|
||||
let l:command .= ' ' . l:options
|
||||
endif
|
||||
|
||||
return l:command
|
||||
endfunction
|
||||
|
||||
function! ale_linters#bzl#buildifier#Handle(buffer, lines) abort
|
||||
let l:pattern = '\v^[^:]+:(\d+):(\d+)?:?\s+(syntax error near)?(.+)$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[1] + 0,
|
||||
\ 'col': l:match[2] + 0,
|
||||
\ 'text': l:match[3] . l:match[4],
|
||||
\ 'type': l:match[3] is# 'syntax error near' ? 'E' : 'W',
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('bzl', {
|
||||
\ 'name': 'buildifier',
|
||||
\ 'output_stream': 'both',
|
||||
\ 'executable': function('ale#fixers#buildifier#GetExecutable'),
|
||||
\ 'command': function('ale_linters#bzl#buildifier#GetCommand'),
|
||||
\ 'callback': function('ale_linters#bzl#buildifier#Handle'),
|
||||
\})
|
||||
38
ale_linters/c/clangcheck.vim
Normal file
38
ale_linters/c/clangcheck.vim
Normal file
@@ -0,0 +1,38 @@
|
||||
" Author: gagbo <gagbobada@gmail.com>
|
||||
" : luibo <ng.akhoa98@gmail.com>
|
||||
" : Jorengarenar <jorengarenar@outlook.com>
|
||||
" Description: clang-check linter for C files
|
||||
" modified from cpp/clangcheck.vim to match for C
|
||||
|
||||
call ale#Set('c_clangcheck_executable', 'clang-check')
|
||||
call ale#Set('c_clangcheck_options', '')
|
||||
call ale#Set('c_build_dir', '')
|
||||
|
||||
function! ale_linters#c#clangcheck#GetCommand(buffer) abort
|
||||
let l:user_options = ale#Var(a:buffer, 'c_clangcheck_options')
|
||||
|
||||
" Try to find compilation database to link automatically
|
||||
let l:build_dir = ale#Var(a:buffer, 'c_build_dir')
|
||||
|
||||
if empty(l:build_dir)
|
||||
let [l:root, l:json_file] = ale#c#FindCompileCommands(a:buffer)
|
||||
let l:build_dir = ale#path#Dirname(l:json_file)
|
||||
endif
|
||||
|
||||
" The extra arguments in the command are used to prevent .plist files from
|
||||
" being generated. These are only added if no build directory can be
|
||||
" detected.
|
||||
return '%e -analyze %s'
|
||||
\ . (empty(l:build_dir) ? ' --extra-arg=-Xclang --extra-arg=-analyzer-output=text --extra-arg=-fno-color-diagnostics': '')
|
||||
\ . ale#Pad(l:user_options)
|
||||
\ . (!empty(l:build_dir) ? ' -p ' . ale#Escape(l:build_dir) : '')
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('c', {
|
||||
\ 'name': 'clangcheck',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': {b -> ale#Var(b, 'c_clangcheck_executable')},
|
||||
\ 'command': function('ale_linters#c#clangcheck#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
||||
22
ale_linters/c3/c3lsp.vim
Normal file
22
ale_linters/c3/c3lsp.vim
Normal file
@@ -0,0 +1,22 @@
|
||||
" Author: Koni Marti <koni.marti@gmail.com>
|
||||
" Description: A Language Server implementation for C3
|
||||
|
||||
call ale#Set('c3_c3lsp_executable', 'c3lsp')
|
||||
call ale#Set('c3_c3lsp_options', '')
|
||||
call ale#Set('c3_c3lsp_init_options', {})
|
||||
|
||||
function! ale_linters#c3#c3lsp#GetCommand(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'c3_c3lsp_executable')
|
||||
|
||||
return ale#Escape(l:executable) . ale#Pad(ale#Var(a:buffer, 'c3_c3lsp_options'))
|
||||
endfunction
|
||||
|
||||
|
||||
call ale#linter#Define('c3', {
|
||||
\ 'name': 'c3lsp',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': {b -> ale#Var(b, 'c3_c3lsp_executable')},
|
||||
\ 'command': function('ale_linters#c3#c3lsp#GetCommand'),
|
||||
\ 'project_root': function('ale#handlers#c3lsp#GetProjectRoot'),
|
||||
\ 'lsp_config': {b -> ale#handlers#c3lsp#GetInitOpts(b, 'c3_c3lsp_init_options')},
|
||||
\})
|
||||
31
ale_linters/cairo/scarb.vim
Normal file
31
ale_linters/cairo/scarb.vim
Normal file
@@ -0,0 +1,31 @@
|
||||
" Author: 0xhyoga <0xhyoga@gmx.com>,
|
||||
" Description: scarb for cairo files
|
||||
|
||||
function! ale_linters#cairo#scarb#GetScarbExecutable(bufnr) abort
|
||||
if ale#path#FindNearestFile(a:bufnr, 'Scarb.toml') isnot# ''
|
||||
return 'scarb'
|
||||
else
|
||||
" if there is no Scarb.toml file, we don't use scarb even if it exists,
|
||||
" so we return '', because executable('') apparently always fails
|
||||
return ''
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! ale_linters#cairo#scarb#GetCommand(buffer, version) abort
|
||||
return 'scarb build'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('cairo', {
|
||||
\ 'name': 'scarb',
|
||||
\ 'executable': function('ale_linters#cairo#scarb#GetScarbExecutable'),
|
||||
\ 'command': {buffer -> ale#semver#RunWithVersionCheck(
|
||||
\ buffer,
|
||||
\ ale_linters#cairo#scarb#GetScarbExecutable(buffer),
|
||||
\ '%e --version',
|
||||
\ function('ale_linters#cairo#scarb#GetCommand'),
|
||||
\ )},
|
||||
\ 'callback': 'ale#handlers#cairo#HandleCairoErrors',
|
||||
\ 'output_stream': 'both',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
||||
|
||||
54
ale_linters/cairo/sierra.vim
Normal file
54
ale_linters/cairo/sierra.vim
Normal file
@@ -0,0 +1,54 @@
|
||||
" Author: 0xHyoga <0xHyoga@gmx.com>
|
||||
" Description: Report Starknet compile to sierra errors in cairo 1.0 code
|
||||
|
||||
call ale#Set('cairo_sierra_executable', 'starknet-compile')
|
||||
call ale#Set('cairo_sierra_options', '')
|
||||
|
||||
function! ale_linters#cairo#sierra#Handle(buffer, lines) abort
|
||||
" Matches patterns like the following:
|
||||
" Error: Expected ';' but got '('
|
||||
" --> /path/to/file/file.cairo:1:10:)
|
||||
let l:pattern = '\v(error|warning): (.*)$'
|
||||
let l:line_and_column_pattern = '\v\.cairo:(\d+):(\d+)'
|
||||
let l:output = []
|
||||
|
||||
for l:line in a:lines
|
||||
let l:match = matchlist(l:line, l:pattern)
|
||||
|
||||
if len(l:match) == 0
|
||||
let l:match = matchlist(l:line, l:line_and_column_pattern)
|
||||
|
||||
if len(l:match) > 0
|
||||
let l:index = len(l:output) - 1
|
||||
let l:output[l:index]['lnum'] = l:match[1] + 0
|
||||
let l:output[l:index]['col'] = l:match[2] + 0
|
||||
endif
|
||||
else
|
||||
let l:isError = l:match[1] is? 'Error'
|
||||
|
||||
call add(l:output, {
|
||||
\ 'lnum': 0,
|
||||
\ 'col': 0,
|
||||
\ 'text': l:match[2],
|
||||
\ 'type': l:isError ? 'E' : 'W',
|
||||
\})
|
||||
endif
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
function! ale_linters#cairo#sierra#GetCommand(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'cairo_sierra_executable')
|
||||
|
||||
return l:executable . ale#Pad(ale#Var(a:buffer, 'cairo_sierra_options')) . ' %s'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('cairo', {
|
||||
\ 'name': 'sierra',
|
||||
\ 'executable': {b -> ale#Var(b, 'cairo_sierra_executable')},
|
||||
\ 'command': function('ale_linters#cairo#sierra#GetCommand'),
|
||||
\ 'callback': 'ale_linters#cairo#sierra#Handle',
|
||||
\ 'output_stream': 'stderr',
|
||||
\})
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
" Author: 0xHyoga <0xHyoga@gmx.com>
|
||||
" Description: Report starknet-compile errors in cairo code
|
||||
" Description: Report starknet-compile errors in cairo code (pre-starknet
|
||||
" 1.0). This is deprecated but kept for backwards compatability.
|
||||
|
||||
call ale#Set('cairo_starknet_executable', 'starknet-compile')
|
||||
call ale#Set('cairo_starknet_options', '')
|
||||
@@ -35,3 +36,4 @@ call ale#linter#Define('cairo', {
|
||||
\ 'callback': 'ale_linters#cairo#starknet#Handle',
|
||||
\ 'output_stream': 'stderr',
|
||||
\})
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ function! ale_linters#cmake#cmake_lint#Command(buffer) abort
|
||||
let l:executable = ale_linters#cmake#cmake_lint#Executable(a:buffer)
|
||||
let l:options = ale#Var(a:buffer, 'cmake_cmake_lint_options')
|
||||
|
||||
return ale#Escape(l:executable) . ' ' . l:options . ' %t'
|
||||
return ale#Escape(l:executable) . ' ' . l:options . ' %s'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#cmake#cmake_lint#Handle(buffer, lines) abort
|
||||
|
||||
@@ -11,6 +11,7 @@ endfunction
|
||||
|
||||
call ale#linter#Define('css', {
|
||||
\ 'name': 'stylelint',
|
||||
\ 'output_stream': 'both',
|
||||
\ 'executable': {b -> ale#path#FindExecutable(b, 'css_stylelint', [
|
||||
\ 'node_modules/.bin/stylelint',
|
||||
\ ])},
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
" Author: Taylor Blau <me@ttaylorr.com>
|
||||
call ale#Set('dafny_dafny_timelimit', 10)
|
||||
|
||||
function! ale_linters#dafny#dafny#Handle(buffer, lines) abort
|
||||
let l:pattern = '\v(.*)\((\d+),(\d+)\): (.*): (.*)'
|
||||
@@ -31,7 +32,6 @@ function! ale_linters#dafny#dafny#GetCommand(buffer) abort
|
||||
return printf('dafny %%s /compile:0 /timeLimit:%d', ale#Var(a:buffer, 'dafny_dafny_timelimit'))
|
||||
endfunction
|
||||
|
||||
call ale#Set('dafny_dafny_timelimit', 10)
|
||||
call ale#linter#Define('dafny', {
|
||||
\ 'name': 'dafny',
|
||||
\ 'executable': 'dafny',
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
" Author: Nelson Yeung <nelsyeung@gmail.com>
|
||||
" Description: Check Dart files with dart analysis server LSP
|
||||
|
||||
call ale#Set('dart_analysis_server_enable_language_server', 1)
|
||||
call ale#Set('dart_analysis_server_executable', 'dart')
|
||||
|
||||
function! ale_linters#dart#analysis_server#GetProjectRoot(buffer) abort
|
||||
@@ -12,12 +13,19 @@ function! ale_linters#dart#analysis_server#GetProjectRoot(buffer) abort
|
||||
endfunction
|
||||
|
||||
function! ale_linters#dart#analysis_server#GetCommand(buffer) abort
|
||||
let l:language_server = ale#Var(a:buffer, 'dart_analysis_server_enable_language_server')
|
||||
let l:executable = ale#Var(a:buffer, 'dart_analysis_server_executable')
|
||||
let l:dart = resolve(exepath(l:executable))
|
||||
|
||||
return '%e '
|
||||
let l:output = '%e '
|
||||
\ . fnamemodify(l:dart, ':h') . '/snapshots/analysis_server.dart.snapshot'
|
||||
\ . ' --lsp'
|
||||
|
||||
" Enable new language-server command
|
||||
if l:language_server == 1
|
||||
let l:output = '%e language-server --protocol=lsp'
|
||||
endif
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('dart', {
|
||||
|
||||
69
ale_linters/dockerfile/dockerlinter.vim
Normal file
69
ale_linters/dockerfile/dockerlinter.vim
Normal file
@@ -0,0 +1,69 @@
|
||||
" Author: Shad
|
||||
" Description: dockerlinter linter for dockerfile
|
||||
|
||||
call ale#Set('dockerfile_dockerlinter_executable', 'dockerlinter')
|
||||
call ale#Set('dockerfile_dockerlinter_options', '')
|
||||
|
||||
function! ale_linters#dockerfile#dockerlinter#GetType(type) abort
|
||||
if a:type is? 'error'
|
||||
return 'E'
|
||||
elseif a:type is? 'warning'
|
||||
return 'W'
|
||||
endif
|
||||
|
||||
return 'I'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#dockerfile#dockerlinter#Handle(buffer, lines) abort
|
||||
try
|
||||
let l:data = json_decode(join(a:lines, ''))
|
||||
catch
|
||||
return []
|
||||
endtry
|
||||
|
||||
if empty(l:data)
|
||||
" Should never happen, but it's better to be on the safe side
|
||||
return []
|
||||
endif
|
||||
|
||||
let l:messages = []
|
||||
|
||||
for l:object in l:data
|
||||
let l:line = get(l:object, 'lineNumber', -1)
|
||||
let l:message = l:object['message']
|
||||
let l:type = l:object['level']
|
||||
let l:detail = l:message
|
||||
let l:code = l:object['code']
|
||||
|
||||
if l:code =~# '^SC'
|
||||
let l:link = 'https://www.shellcheck.net/wiki/' . l:code
|
||||
else
|
||||
let l:link = 'https://github.com/buddy-works/dockerfile-linter/blob/master/Rules.md#' . l:code
|
||||
endif
|
||||
|
||||
let l:detail = l:message . "\n\n" . l:link
|
||||
|
||||
call add(l:messages, {
|
||||
\ 'lnum': l:line,
|
||||
\ 'code': l:code,
|
||||
\ 'text': l:message,
|
||||
\ 'type': ale_linters#dockerfile#dockerlinter#GetType(l:type),
|
||||
\ 'detail': l:detail,
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:messages
|
||||
endfunction
|
||||
|
||||
function! ale_linters#dockerfile#dockerlinter#GetCommand(buffer) abort
|
||||
return '%e' . ale#Pad(ale#Var(a:buffer, 'dockerfile_dockerlinter_options'))
|
||||
\ . ' -j -f'
|
||||
\ . ' %t'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('dockerfile', {
|
||||
\ 'name': 'dockerlinter',
|
||||
\ 'executable': {b -> ale#Var(b, 'dockerfile_dockerlinter_executable')},
|
||||
\ 'command': function('ale_linters#dockerfile#dockerlinter#GetCommand'),
|
||||
\ 'callback': 'ale_linters#dockerfile#dockerlinter#Handle',
|
||||
\})
|
||||
@@ -1,5 +1,5 @@
|
||||
" Author: Jon Parise <jon@indelible.org>
|
||||
" Description: ElixirLS integration (https://github.com/JakeBecker/elixir-ls)
|
||||
" Description: ElixirLS integration (https://github.com/elixir-lsp/elixir-ls)
|
||||
|
||||
call ale#Set('elixir_elixir_ls_release', 'elixir-ls')
|
||||
call ale#Set('elixir_elixir_ls_config', {})
|
||||
@@ -12,7 +12,8 @@ function! ale_linters#elixir#elixir_ls#GetExecutable(buffer) abort
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('elixir', {
|
||||
\ 'name': 'elixir-ls',
|
||||
\ 'name': 'elixir_ls',
|
||||
\ 'aliases': ['elixir-ls', 'elixirls'],
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': function('ale_linters#elixir#elixir_ls#GetExecutable'),
|
||||
\ 'command': function('ale_linters#elixir#elixir_ls#GetExecutable'),
|
||||
|
||||
19
ale_linters/elixir/lexical.vim
Normal file
19
ale_linters/elixir/lexical.vim
Normal file
@@ -0,0 +1,19 @@
|
||||
" Author: Axel Clark <axelclark@pm.me>
|
||||
" Description: Lexical integration (https://github.com/lexical-lsp/lexical)
|
||||
|
||||
call ale#Set('elixir_lexical_release', 'lexical')
|
||||
|
||||
function! ale_linters#elixir#lexical#GetExecutable(buffer) abort
|
||||
let l:dir = ale#path#Simplify(ale#Var(a:buffer, 'elixir_lexical_release'))
|
||||
let l:cmd = has('win32') ? '\start_lexical.bat' : '/start_lexical.sh'
|
||||
|
||||
return l:dir . l:cmd
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('elixir', {
|
||||
\ 'name': 'lexical',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': function('ale_linters#elixir#lexical#GetExecutable'),
|
||||
\ 'command': function('ale_linters#elixir#lexical#GetExecutable'),
|
||||
\ 'project_root': function('ale#handlers#elixir#FindMixUmbrellaRoot'),
|
||||
\})
|
||||
@@ -10,13 +10,13 @@ call ale#Set('elm_ls_elm_format_path', '')
|
||||
call ale#Set('elm_ls_elm_test_path', '')
|
||||
call ale#Set('elm_ls_elm_analyse_trigger', 'change')
|
||||
|
||||
function! elm_ls#GetRootDir(buffer) abort
|
||||
function! ale_linters#elm#ls#GetProjectRoot(buffer) abort
|
||||
let l:elm_json = ale#path#FindNearestFile(a:buffer, 'elm.json')
|
||||
|
||||
return !empty(l:elm_json) ? fnamemodify(l:elm_json, ':p:h') : ''
|
||||
endfunction
|
||||
|
||||
function! elm_ls#GetOptions(buffer) abort
|
||||
function! ale_linters#elm#ls#GetInitializationOptions(buffer) abort
|
||||
return {
|
||||
\ 'elmPath': ale#Var(a:buffer, 'elm_ls_elm_path'),
|
||||
\ 'elmFormatPath': ale#Var(a:buffer, 'elm_ls_elm_format_path'),
|
||||
@@ -26,7 +26,8 @@ function! elm_ls#GetOptions(buffer) abort
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('elm', {
|
||||
\ 'name': 'elm_ls',
|
||||
\ 'name': 'ls',
|
||||
\ 'aliases': ['elm_ls'],
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': {b -> ale#path#FindExecutable(b, 'elm_ls', [
|
||||
\ 'node_modules/.bin/elm-language-server',
|
||||
@@ -34,7 +35,7 @@ call ale#linter#Define('elm', {
|
||||
\ 'elm-lsp'
|
||||
\ ])},
|
||||
\ 'command': '%e --stdio',
|
||||
\ 'project_root': function('elm_ls#GetRootDir'),
|
||||
\ 'project_root': function('ale_linters#elm#ls#GetProjectRoot'),
|
||||
\ 'language': 'elm',
|
||||
\ 'initialization_options': function('elm_ls#GetOptions')
|
||||
\ 'initialization_options': function('ale_linters#elm#ls#GetInitializationOptions')
|
||||
\})
|
||||
@@ -26,9 +26,27 @@ function! s:AbbreviateMessage(text) abort
|
||||
endfunction
|
||||
|
||||
function! s:GetCommand(buffer) abort
|
||||
let l:file = ale#Escape(expand('#' . a:buffer . ':.'))
|
||||
let l:cwd = s:GetCwd(a:buffer)
|
||||
|
||||
return '%e rock --output-format=parsable ' . l:file
|
||||
let l:file = !empty(l:cwd)
|
||||
\ ? expand('#' . a:buffer . ':p')[len(l:cwd) + 1:]
|
||||
\ : expand('#' . a:buffer . ':.')
|
||||
|
||||
return '%e rock --output-format=parsable ' . ale#Escape(l:file)
|
||||
endfunction
|
||||
|
||||
function! s:GetCwd(buffer) abort
|
||||
let l:markers = ['elvis.config', 'rebar.lock', 'erlang.mk']
|
||||
|
||||
for l:path in ale#path#Upwards(expand('#' . a:buffer . ':p:h'))
|
||||
for l:marker in l:markers
|
||||
if filereadable(l:path . '/' . l:marker)
|
||||
return l:path
|
||||
endif
|
||||
endfor
|
||||
endfor
|
||||
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('erlang', {
|
||||
@@ -36,5 +54,6 @@ call ale#linter#Define('erlang', {
|
||||
\ 'callback': 'ale_linters#erlang#elvis#Handle',
|
||||
\ 'executable': {b -> ale#Var(b, 'erlang_elvis_executable')},
|
||||
\ 'command': function('s:GetCommand'),
|
||||
\ 'cwd': function('s:GetCwd'),
|
||||
\ 'lint_file': 1,
|
||||
\})
|
||||
|
||||
@@ -21,7 +21,14 @@ function! s:GetCommand(buffer) abort
|
||||
endfunction
|
||||
|
||||
function! s:FindProjectRoot(buffer) abort
|
||||
let l:markers = ['_build/', 'erlang_ls.config', 'rebar.lock']
|
||||
let l:markers = [
|
||||
\ '_checkouts/',
|
||||
\ '_build/',
|
||||
\ 'deps/',
|
||||
\ 'erlang_ls.config',
|
||||
\ 'rebar.lock',
|
||||
\ 'erlang.mk',
|
||||
\]
|
||||
|
||||
" This is a way to find Erlang/OTP root (the one that is managed
|
||||
" by kerl or asdf). Useful if :ALEGoToDefinition takes us there.
|
||||
@@ -46,4 +53,5 @@ call ale#linter#Define('erlang', {
|
||||
\ 'command': function('s:GetCommand'),
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'project_root': function('s:FindProjectRoot'),
|
||||
\ 'aliases': ['erlang-ls'],
|
||||
\})
|
||||
|
||||
@@ -3,29 +3,13 @@
|
||||
|
||||
call ale#Set('erlang_syntaxerl_executable', 'syntaxerl')
|
||||
|
||||
function! ale_linters#erlang#syntaxerl#RunHelpCommand(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'erlang_syntaxerl_executable')
|
||||
|
||||
return ale#command#Run(
|
||||
\ a:buffer,
|
||||
\ ale#Escape(l:executable) . ' -h',
|
||||
\ function('ale_linters#erlang#syntaxerl#GetCommand'),
|
||||
\)
|
||||
endfunction
|
||||
|
||||
function! ale_linters#erlang#syntaxerl#GetCommand(buffer, output, meta) abort
|
||||
let l:use_b_option = match(a:output, '\C\V-b, --base\>') > -1
|
||||
|
||||
return '%e' . (l:use_b_option ? ' -b %s %t' : ' %t')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#erlang#syntaxerl#Handle(buffer, lines) abort
|
||||
let l:pattern = '\v\C:(\d+):( warning:)? (.+)'
|
||||
let l:loclist = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:loclist, {
|
||||
\ 'lnum': l:match[1] + 0,
|
||||
\ 'lnum': str2nr(l:match[1]),
|
||||
\ 'text': l:match[3],
|
||||
\ 'type': empty(l:match[2]) ? 'E' : 'W',
|
||||
\})
|
||||
@@ -34,9 +18,27 @@ function! ale_linters#erlang#syntaxerl#Handle(buffer, lines) abort
|
||||
return l:loclist
|
||||
endfunction
|
||||
|
||||
function! s:GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'erlang_syntaxerl_executable')
|
||||
endfunction
|
||||
|
||||
function! s:GetCommand(buffer) abort
|
||||
let l:Callback = function('s:GetCommandFromHelpOutput')
|
||||
|
||||
return ale#command#Run(a:buffer, '%e -h', l:Callback, {
|
||||
\ 'executable': s:GetExecutable(a:buffer),
|
||||
\})
|
||||
endfunction
|
||||
|
||||
function! s:GetCommandFromHelpOutput(buffer, output, metadata) abort
|
||||
let l:has_b_option = match(a:output, '\V\C-b, --base\>') > -1
|
||||
|
||||
return l:has_b_option ? '%e -b %s %t' : '%e %t'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('erlang', {
|
||||
\ 'name': 'syntaxerl',
|
||||
\ 'executable': {b -> ale#Var(b, 'erlang_syntaxerl_executable')},
|
||||
\ 'command': {b -> ale_linters#erlang#syntaxerl#RunHelpCommand(b)},
|
||||
\ 'callback': 'ale_linters#erlang#syntaxerl#Handle',
|
||||
\ 'executable': function('s:GetExecutable'),
|
||||
\ 'command': function('s:GetCommand'),
|
||||
\})
|
||||
|
||||
@@ -11,7 +11,7 @@ function! ale_linters#eruby#erb#GetCommand(buffer) abort
|
||||
" Rails-flavored eRuby does not comply with the standard as understood by
|
||||
" ERB, so we'll have to do some substitution. This does not reduce the
|
||||
" effectiveness of the linter—the translated code is still evaluated.
|
||||
return 'ruby -r erb -e ' . ale#Escape('puts ERB.new($stdin.read.gsub(%{<%=},%{<%}), nil, %{-}).src') . '< %t | ruby -c'
|
||||
return 'ruby -r erb -e ' . ale#Escape('puts ERB.new($stdin.read.gsub(%{<%=},%{<%}), trim_mode: %{-}).src') . '< %t | ruby -c'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('eruby', {
|
||||
|
||||
@@ -12,6 +12,7 @@ endfunction
|
||||
|
||||
call ale#linter#Define('fortran', {
|
||||
\ 'name': 'language_server',
|
||||
\ 'aliases': ['fortls'],
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': {b -> ale#Var(b, 'fortran_language_server_executable')},
|
||||
\ 'command': '%e',
|
||||
|
||||
18
ale_linters/gleam/gleamlsp.vim
Normal file
18
ale_linters/gleam/gleamlsp.vim
Normal file
@@ -0,0 +1,18 @@
|
||||
" Author: Jonathan Palardt https://github.com/jpalardy
|
||||
" Description: Support for Gleam Language Server
|
||||
|
||||
call ale#Set('gleam_gleamlsp_executable', 'gleam')
|
||||
|
||||
function! ale_linters#gleam#gleamlsp#GetProjectRoot(buffer) abort
|
||||
let l:gleam_toml = ale#path#FindNearestFile(a:buffer, 'gleam.toml')
|
||||
|
||||
return !empty(l:gleam_toml) ? fnamemodify(l:gleam_toml, ':p:h') : ''
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('gleam', {
|
||||
\ 'name': 'gleamlsp',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': {buffer -> ale#Var(buffer, 'gleam_gleamlsp_executable')},
|
||||
\ 'command': '%e lsp',
|
||||
\ 'project_root': function('ale_linters#gleam#gleamlsp#GetProjectRoot'),
|
||||
\})
|
||||
6
ale_linters/glimmer/embertemplatelint.vim
Normal file
6
ale_linters/glimmer/embertemplatelint.vim
Normal file
@@ -0,0 +1,6 @@
|
||||
" Author: Sam Saffron <sam.saffron@gmail.com>
|
||||
" Description: Ember-template-lint for checking GJS (Glimmer JS) files
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
call ale#handlers#embertemplatelint#DefineLinter('glimmer')
|
||||
@@ -17,13 +17,15 @@ function! ale_linters#glsl#glslang#Handle(buffer, lines) abort
|
||||
" Matches patterns like the following:
|
||||
"
|
||||
" ERROR: 0:5: 'foo' : undeclared identifier
|
||||
let l:pattern = '^\(.\+\): \(\d\+\):\(\d\+\): \(.\+\)'
|
||||
" or when using options like -V or -G or --target-env
|
||||
" ERROR: filename:5: 'foo' : undeclared identifier
|
||||
let l:pattern = '^\(.\+\): \(.\+\):\(\d\+\): \(.\+\)'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'lnum': str2nr(l:match[3]),
|
||||
\ 'col': str2nr(l:match[2]),
|
||||
\ 'col' : 0,
|
||||
\ 'text': l:match[4],
|
||||
\ 'type': l:match[1] is# 'ERROR' ? 'E' : 'W',
|
||||
\})
|
||||
|
||||
@@ -6,16 +6,6 @@
|
||||
call ale#Set('go_go_executable', 'go')
|
||||
call ale#Set('go_gobuild_options', '')
|
||||
|
||||
function! ale_linters#go#gobuild#GetCommand(buffer) abort
|
||||
let l:options = ale#Var(a:buffer, 'go_gobuild_options')
|
||||
|
||||
" Run go test in local directory with relative path
|
||||
return ale#go#EnvString(a:buffer)
|
||||
\ . ale#Var(a:buffer, 'go_go_executable') . ' test'
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
\ . ' -c -o /dev/null ./'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#go#gobuild#GetMatches(lines) abort
|
||||
" Matches patterns like the following:
|
||||
"
|
||||
@@ -50,7 +40,12 @@ call ale#linter#Define('go', {
|
||||
\ 'aliases': ['go build'],
|
||||
\ 'executable': {b -> ale#Var(b, 'go_go_executable')},
|
||||
\ 'cwd': '%s:h',
|
||||
\ 'command': function('ale_linters#go#gobuild#GetCommand'),
|
||||
\ 'command': {b ->
|
||||
\ ale#go#EnvString(b)
|
||||
\ . ale#Escape(ale#Var(b, 'go_go_executable')) . ' test'
|
||||
\ . ale#Pad(ale#Var(b, 'go_gobuild_options'))
|
||||
\ . ' -c -o /dev/null ./'
|
||||
\ },
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'callback': 'ale_linters#go#gobuild#Handler',
|
||||
\ 'lint_file': 1,
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
" 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_options', '')
|
||||
call ale#Set('go_golangci_lint_executable', 'golangci-lint')
|
||||
call ale#Set('go_golangci_lint_package', 0)
|
||||
call ale#Set('go_golangci_lint_package', 1)
|
||||
|
||||
function! ale_linters#go#golangci_lint#GetCommand(buffer) abort
|
||||
let l:filename = expand('#' . a:buffer . ':t')
|
||||
@@ -15,39 +15,41 @@ function! ale_linters#go#golangci_lint#GetCommand(buffer) abort
|
||||
return ale#go#EnvString(a:buffer)
|
||||
\ . '%e run '
|
||||
\ . l:options
|
||||
\ . ' --out-format=json'
|
||||
\ . ' --show-stats=0'
|
||||
endif
|
||||
|
||||
return ale#go#EnvString(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\*?(.+)\s+\((.+)\)$'
|
||||
|
||||
return ale#util#GetMatches(a:lines, l:pattern)
|
||||
\ . ' --out-format=json'
|
||||
\ . ' --show-stats=0'
|
||||
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)
|
||||
if l:match[5] is# 'typecheck'
|
||||
let l:matches = ale#util#FuzzyJSONDecode(a:lines, [])
|
||||
|
||||
if empty(l:matches)
|
||||
return []
|
||||
endif
|
||||
|
||||
for l:match in l:matches['Issues']
|
||||
if l:match['FromLinter'] is# 'typecheck'
|
||||
let l:msg_type = 'E'
|
||||
else
|
||||
let l:msg_type = 'W'
|
||||
endif
|
||||
|
||||
" 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,
|
||||
\ 'filename': ale#path#GetAbsPath(l:dir, fnamemodify(l:match['Pos']['Filename'], ':t')),
|
||||
\ 'lnum': l:match['Pos']['Line'] + 0,
|
||||
\ 'col': l:match['Pos']['Column'] + 0,
|
||||
\ 'type': l:msg_type,
|
||||
\ 'text': l:match[4] . ' (' . l:match[5] . ')',
|
||||
\ 'text': match['FromLinter'] . ' - ' . l:match['Text'],
|
||||
\})
|
||||
endfor
|
||||
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
" Author: neersighted <bjorn@neersighted.com>
|
||||
" Description: golint for Go files
|
||||
|
||||
call ale#Set('go_golint_executable', 'golint')
|
||||
call ale#Set('go_golint_options', '')
|
||||
|
||||
function! ale_linters#go#golint#GetCommand(buffer) abort
|
||||
let l:options = ale#Var(a:buffer, 'go_golint_options')
|
||||
|
||||
return ale#go#EnvString(a:buffer) . '%e'
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
\ . ' %t'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('go', {
|
||||
\ 'name': 'golint',
|
||||
\ 'output_stream': 'both',
|
||||
\ 'executable': {b -> ale#Var(b, 'go_golint_executable')},
|
||||
\ 'command': function('ale_linters#go#golint#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
||||
\})
|
||||
@@ -1,58 +0,0 @@
|
||||
" Author: Ben Reedy <https://github.com/breed808>, Jeff Willette <jrwillette88@gmail.com>
|
||||
" Description: Adds support for the gometalinter suite for Go files
|
||||
|
||||
call ale#Set('go_gometalinter_options', '')
|
||||
call ale#Set('go_gometalinter_executable', 'gometalinter')
|
||||
call ale#Set('go_gometalinter_lint_package', 0)
|
||||
|
||||
function! ale_linters#go#gometalinter#GetCommand(buffer) abort
|
||||
let l:filename = expand('#' . a:buffer . ':t')
|
||||
let l:options = ale#Var(a:buffer, 'go_gometalinter_options')
|
||||
let l:lint_package = ale#Var(a:buffer, 'go_gometalinter_lint_package')
|
||||
|
||||
" BufferCdString is used so that we can be sure the paths output from gometalinter can
|
||||
" be calculated to absolute paths in the Handler
|
||||
if l:lint_package
|
||||
return ale#go#EnvString(a:buffer)
|
||||
\ . '%e'
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '') . ' .'
|
||||
endif
|
||||
|
||||
return ale#go#EnvString(a:buffer)
|
||||
\ . '%e'
|
||||
\ . ' --include=' . ale#Escape(ale#util#EscapePCRE(l:filename))
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '') . ' .'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#go#gometalinter#GetMatches(lines) abort
|
||||
let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):?(\d+)?:?:?(warning|error):?\s\*?(.+)$'
|
||||
|
||||
return ale#util#GetMatches(a:lines, l:pattern)
|
||||
endfunction
|
||||
|
||||
function! ale_linters#go#gometalinter#Handler(buffer, lines) abort
|
||||
let l:dir = expand('#' . a:buffer . ':p:h')
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale_linters#go#gometalinter#GetMatches(a:lines)
|
||||
" l:match[1] will already be an absolute path, output from gometalinter
|
||||
call add(l:output, {
|
||||
\ 'filename': ale#path#GetAbsPath(l:dir, l:match[1]),
|
||||
\ 'lnum': l:match[2] + 0,
|
||||
\ 'col': l:match[3] + 0,
|
||||
\ 'type': tolower(l:match[4]) is# 'warning' ? 'W' : 'E',
|
||||
\ 'text': l:match[5],
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('go', {
|
||||
\ 'name': 'gometalinter',
|
||||
\ 'executable': {b -> ale#Var(b, 'go_gometalinter_executable')},
|
||||
\ 'cwd': '%s:h',
|
||||
\ 'command': function('ale_linters#go#gometalinter#GetCommand'),
|
||||
\ 'callback': 'ale_linters#go#gometalinter#Handler',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
||||
@@ -1,28 +1,21 @@
|
||||
" Author: neersighted <bjorn@neersighted.com>
|
||||
" Author: neersighted <bjorn@neersighted.com>, John Eikenberry <jae@zhar.net>
|
||||
" Description: go vet for Go files
|
||||
"
|
||||
" 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
|
||||
let l:options = ale#Var(a:buffer, 'go_govet_options')
|
||||
|
||||
return ale#go#EnvString(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': {b -> ale#Var(b, 'go_go_executable')},
|
||||
\ 'cwd': '%s:h',
|
||||
\ 'command': function('ale_linters#go#govet#GetCommand'),
|
||||
\ 'command': {b ->
|
||||
\ ale#go#EnvString(b)
|
||||
\ . '%e vet'
|
||||
\ . ale#Pad(ale#Var(b, 'go_govet_options'))
|
||||
\ . ' .'
|
||||
\ },
|
||||
\ 'callback': 'ale#handlers#go#Handler',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
||||
|
||||
12
ale_linters/gohtmltmpl/djlint.vim
Normal file
12
ale_linters/gohtmltmpl/djlint.vim
Normal file
@@ -0,0 +1,12 @@
|
||||
" Author: Adrian Vollmer <computerfluesterer@protonmail.com>
|
||||
" Description: djlint for Django HTML template files
|
||||
|
||||
call ale#Set('html_djlint_executable', 'djlint')
|
||||
call ale#Set('html_djlint_options', '')
|
||||
|
||||
call ale#linter#Define('gohtmltmpl', {
|
||||
\ 'name': 'djlint',
|
||||
\ 'executable': function('ale#handlers#djlint#GetExecutable'),
|
||||
\ 'command': function('ale#handlers#djlint#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#djlint#Handle',
|
||||
\})
|
||||
46
ale_linters/groovy/npmgroovylint.vim
Normal file
46
ale_linters/groovy/npmgroovylint.vim
Normal file
@@ -0,0 +1,46 @@
|
||||
" Author: lucas-str <lucas.sturelle@ik.me>
|
||||
" Description: Integration of npm-groovy-lint for Groovy files.
|
||||
|
||||
call ale#Set('groovy_npmgroovylint_executable', 'npm-groovy-lint')
|
||||
call ale#Set('groovy_npmgroovylint_options', '--loglevel warning')
|
||||
|
||||
function! ale_linters#groovy#npmgroovylint#GetCommand(buffer) abort
|
||||
let l:options = ale#Var(a:buffer, 'groovy_npmgroovylint_options')
|
||||
|
||||
return '%e --failon none --output json'
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
\ . ' %t'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#groovy#npmgroovylint#Handle(buffer, lines) abort
|
||||
let l:output = []
|
||||
let l:json = ale#util#FuzzyJSONDecode(a:lines, {})
|
||||
|
||||
for [l:filename, l:file] in items(get(l:json, 'files', {}))
|
||||
for l:error in get(l:file, 'errors', [])
|
||||
let l:output_line = {
|
||||
\ 'filename': l:filename,
|
||||
\ 'lnum': l:error.line,
|
||||
\ 'text': l:error.msg,
|
||||
\ 'type': toupper(l:error.severity[0]),
|
||||
\}
|
||||
|
||||
if has_key(l:error, 'range')
|
||||
let l:output_line.col = l:error.range.start.character
|
||||
let l:output_line.end_col = l:error.range.end.character
|
||||
let l:output_line.end_lnum = l:error.range.end.line
|
||||
endif
|
||||
|
||||
call add(l:output, l:output_line)
|
||||
endfor
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('groovy', {
|
||||
\ 'name': 'npm-groovy-lint',
|
||||
\ 'executable': {b -> ale#Var(b, 'groovy_npmgroovylint_executable')},
|
||||
\ 'command': function('ale_linters#groovy#npmgroovylint#GetCommand'),
|
||||
\ 'callback': 'ale_linters#groovy#npmgroovylint#Handle',
|
||||
\})
|
||||
12
ale_linters/handlebars/djlint.vim
Normal file
12
ale_linters/handlebars/djlint.vim
Normal file
@@ -0,0 +1,12 @@
|
||||
" Author: Adrian Vollmer <computerfluesterer@protonmail.com>
|
||||
" Description: djlint for Django HTML template files
|
||||
|
||||
call ale#Set('html_djlint_executable', 'djlint')
|
||||
call ale#Set('html_djlint_options', '')
|
||||
|
||||
call ale#linter#Define('handlebars', {
|
||||
\ 'name': 'djlint',
|
||||
\ 'executable': function('ale#handlers#djlint#GetExecutable'),
|
||||
\ 'command': function('ale#handlers#djlint#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#djlint#Handle',
|
||||
\})
|
||||
@@ -1,67 +1,6 @@
|
||||
" Author: Adrian Zalewski <aazalewski@hotmail.com>
|
||||
" Description: Ember-template-lint for checking Handlebars files
|
||||
|
||||
call ale#Set('handlebars_embertemplatelint_executable', 'ember-template-lint')
|
||||
call ale#Set('handlebars_embertemplatelint_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
scriptencoding utf-8
|
||||
|
||||
function! ale_linters#handlebars#embertemplatelint#GetExecutable(buffer) abort
|
||||
return ale#path#FindExecutable(a:buffer, 'handlebars_embertemplatelint', [
|
||||
\ 'node_modules/.bin/ember-template-lint',
|
||||
\])
|
||||
endfunction
|
||||
|
||||
function! ale_linters#handlebars#embertemplatelint#GetCommand(buffer, version) abort
|
||||
if ale#semver#GTE(a:version, [4, 0, 0])
|
||||
" --json was removed in favor of --format=json in ember-template-lint@4.0.0
|
||||
return '%e --format=json --filename %s'
|
||||
endif
|
||||
|
||||
if ale#semver#GTE(a:version, [1, 6, 0])
|
||||
" Reading from stdin was introduced in ember-template-lint@1.6.0
|
||||
return '%e --json --filename %s'
|
||||
endif
|
||||
|
||||
return '%e --json %t'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#handlebars#embertemplatelint#GetCommandWithVersionCheck(buffer) abort
|
||||
return ale#semver#RunWithVersionCheck(
|
||||
\ a:buffer,
|
||||
\ ale_linters#handlebars#embertemplatelint#GetExecutable(a:buffer),
|
||||
\ '%e --version',
|
||||
\ function('ale_linters#handlebars#embertemplatelint#GetCommand'),
|
||||
\)
|
||||
endfunction
|
||||
|
||||
function! ale_linters#handlebars#embertemplatelint#Handle(buffer, lines) abort
|
||||
let l:output = []
|
||||
let l:json = ale#util#FuzzyJSONDecode(a:lines, {})
|
||||
|
||||
for l:error in get(values(l:json), 0, [])
|
||||
if has_key(l:error, 'fatal')
|
||||
call add(l:output, {
|
||||
\ 'lnum': get(l:error, 'line', 1),
|
||||
\ 'col': get(l:error, 'column', 1),
|
||||
\ 'text': l:error.message,
|
||||
\ 'type': l:error.severity == 1 ? 'W' : 'E',
|
||||
\})
|
||||
else
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:error.line,
|
||||
\ 'col': l:error.column,
|
||||
\ 'text': l:error.rule . ': ' . l:error.message,
|
||||
\ 'type': l:error.severity == 1 ? 'W' : 'E',
|
||||
\})
|
||||
endif
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('handlebars', {
|
||||
\ 'name': 'embertemplatelint',
|
||||
\ 'aliases': ['ember-template-lint'],
|
||||
\ 'executable': function('ale_linters#handlebars#embertemplatelint#GetExecutable'),
|
||||
\ 'command': function('ale_linters#handlebars#embertemplatelint#GetCommandWithVersionCheck'),
|
||||
\ 'callback': 'ale_linters#handlebars#embertemplatelint#Handle',
|
||||
\})
|
||||
call ale#handlers#embertemplatelint#DefineLinter('handlebars')
|
||||
|
||||
@@ -16,8 +16,9 @@ function! ale_linters#haskell#hls#FindRootFile(buffer) abort
|
||||
|
||||
for l:path in ale#path#Upwards(expand('#' . a:buffer . ':p:h'))
|
||||
for l:root_file in l:serach_root_files
|
||||
if filereadable(l:path . l:root_file)
|
||||
return l:path
|
||||
if filereadable(l:path . '/' . l:root_file)
|
||||
" Add on / so fnamemodify(..., ':h') below keeps the path.
|
||||
return l:path . '/'
|
||||
endif
|
||||
endfor
|
||||
endfor
|
||||
|
||||
@@ -48,7 +48,7 @@ endfunction
|
||||
|
||||
call ale#linter#Define('html', {
|
||||
\ 'name': 'angular',
|
||||
\ 'aliases': ['angular-language-server'],
|
||||
\ 'aliases': ['angular-language-server', 'angularls'],
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': function('ale_linters#html#angular#GetExecutable'),
|
||||
\ 'command': function('ale_linters#html#angular#GetCommand'),
|
||||
|
||||
14
ale_linters/html/djlint.vim
Normal file
14
ale_linters/html/djlint.vim
Normal file
@@ -0,0 +1,14 @@
|
||||
" Author: Vivian De Smedt <vds2212@gmail.com>
|
||||
" Description: Adds support for djlint
|
||||
|
||||
call ale#Set('html_djlint_executable', 'djlint')
|
||||
call ale#Set('html_djlint_options', '')
|
||||
|
||||
call ale#linter#Define('html', {
|
||||
\ 'name': 'djlint',
|
||||
\ 'executable': function('ale#handlers#djlint#GetExecutable'),
|
||||
\ 'command': function('ale#handlers#djlint#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#djlint#Handle',
|
||||
\})
|
||||
|
||||
" vim:ts=4:sw=4:et:
|
||||
12
ale_linters/html/eslint.vim
Normal file
12
ale_linters/html/eslint.vim
Normal file
@@ -0,0 +1,12 @@
|
||||
" Author: Victor Ananyev <vindex10@gmail.com>
|
||||
" Description: eslint for js snippets in HTML files
|
||||
|
||||
|
||||
call ale#linter#Define('html', {
|
||||
\ 'name': 'eslint',
|
||||
\ 'output_stream': 'both',
|
||||
\ 'executable': function('ale#handlers#eslint#GetExecutable'),
|
||||
\ 'cwd': function('ale#handlers#eslint#GetCwd'),
|
||||
\ 'command': function('ale#handlers#eslint#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#eslint#HandleJSON',
|
||||
\ })
|
||||
@@ -21,6 +21,7 @@ endfunction
|
||||
|
||||
call ale#linter#Define('html', {
|
||||
\ 'name': 'stylelint',
|
||||
\ 'output_stream': 'both',
|
||||
\ 'executable': function('ale_linters#html#stylelint#GetExecutable'),
|
||||
\ 'command': function('ale_linters#html#stylelint#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#css#HandleStyleLintFormat',
|
||||
|
||||
12
ale_linters/htmlangular/djlint.vim
Normal file
12
ale_linters/htmlangular/djlint.vim
Normal file
@@ -0,0 +1,12 @@
|
||||
" Author: Adrian Vollmer <computerfluesterer@protonmail.com>
|
||||
" Description: djlint for Django HTML template files
|
||||
|
||||
call ale#Set('html_djlint_executable', 'djlint')
|
||||
call ale#Set('html_djlint_options', '')
|
||||
|
||||
call ale#linter#Define('htmlangular', {
|
||||
\ 'name': 'djlint',
|
||||
\ 'executable': function('ale#handlers#djlint#GetExecutable'),
|
||||
\ 'command': function('ale#handlers#djlint#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#djlint#Handle',
|
||||
\})
|
||||
12
ale_linters/htmldjango/djlint.vim
Normal file
12
ale_linters/htmldjango/djlint.vim
Normal file
@@ -0,0 +1,12 @@
|
||||
" Author: Adrian Vollmer <computerfluesterer@protonmail.com>
|
||||
" Description: djlint for Django HTML template files
|
||||
|
||||
call ale#Set('html_djlint_executable', 'djlint')
|
||||
call ale#Set('html_djlint_options', '')
|
||||
|
||||
call ale#linter#Define('htmldjango', {
|
||||
\ 'name': 'djlint',
|
||||
\ 'executable': function('ale#handlers#djlint#GetExecutable'),
|
||||
\ 'command': function('ale#handlers#djlint#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#djlint#Handle',
|
||||
\})
|
||||
69
ale_linters/hurl/hurlfmt.vim
Normal file
69
ale_linters/hurl/hurlfmt.vim
Normal file
@@ -0,0 +1,69 @@
|
||||
" Description: Hurl linter using hurlfmt --check.
|
||||
" https://hurl.dev/
|
||||
|
||||
call ale#Set('hurl_hurlfmt_executable', 'hurlfmt')
|
||||
|
||||
function! ale_linters#hurl#hurlfmt#GetCommand(buffer) abort
|
||||
return '%e'
|
||||
\ . ' --check --no-color '
|
||||
endfunction
|
||||
|
||||
function! ale_linters#hurl#hurlfmt#HandleOutput(buffer, lines) abort
|
||||
" Matches patterns:
|
||||
"
|
||||
" error: Parsing space
|
||||
" --> test.hurl:11:48
|
||||
" |
|
||||
" 8 | header "Content-Type"= "application/json; charset=utf-8"
|
||||
" | ^ expecting a space
|
||||
" |
|
||||
"
|
||||
" error: Parsing URL
|
||||
" --> test.hurl:11:48
|
||||
" |
|
||||
" 11 | PUT https://jsonplaceholder.typicode.com/posts/{post_id}}
|
||||
" | ^ illegal character <{>
|
||||
" |
|
||||
"
|
||||
" Note: hurlfmt seems to report always the first error only so we assume
|
||||
" there is only one error to make parsing easier.
|
||||
let l:output = []
|
||||
|
||||
if empty(a:lines)
|
||||
return l:output
|
||||
endif
|
||||
|
||||
let l:pattern = '\v(error|warning): (.+) --\> (.+):(\d+):(\d+) .+ \^ (.+) |'
|
||||
let l:lines = join(a:lines, ' ')
|
||||
|
||||
for l:match in ale#util#GetMatches(l:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'bufnr': a:buffer,
|
||||
\ 'lnum': match[4] + 0,
|
||||
\ 'col': match[5] + 0,
|
||||
\ 'end_col': match[5] + 0,
|
||||
\ 'text': match[2] . ' : ' . match[6],
|
||||
\ 'type': (match[1] is# 'error') ? 'E' : 'W'
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
function! ale_linters#hurl#hurlfmt#GetType(severity) abort
|
||||
if a:severity is? 'convention'
|
||||
\|| a:severity is? 'warning'
|
||||
\|| a:severity is? 'refactor'
|
||||
return 'W'
|
||||
endif
|
||||
|
||||
return 'E'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('hurl', {
|
||||
\ 'name': 'hurlfmt',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': {b -> ale#Var(b, 'hurl_hurlfmt_executable')},
|
||||
\ 'command': function('ale_linters#hurl#hurlfmt#GetCommand'),
|
||||
\ 'callback': 'ale_linters#hurl#hurlfmt#HandleOutput',
|
||||
\})
|
||||
@@ -46,6 +46,7 @@ endfunction
|
||||
|
||||
call ale#linter#Define('java', {
|
||||
\ 'name': 'javalsp',
|
||||
\ 'aliases': ['java_language_server'],
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': function('ale_linters#java#javalsp#Executable'),
|
||||
\ 'command': function('ale_linters#java#javalsp#Command'),
|
||||
|
||||
11
ale_linters/javascript/biome.vim
Normal file
11
ale_linters/javascript/biome.vim
Normal file
@@ -0,0 +1,11 @@
|
||||
" Author: Filip Gospodinov <f@gospodinov.ch>
|
||||
" Description: biome for JavaScript files
|
||||
|
||||
call ale#linter#Define('javascript', {
|
||||
\ 'name': 'biome',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'language': function('ale#handlers#biome#GetLanguage'),
|
||||
\ 'executable': function('ale#handlers#biome#GetExecutable'),
|
||||
\ 'command': '%e lsp-proxy',
|
||||
\ 'project_root': function('ale#handlers#biome#GetProjectRoot'),
|
||||
\})
|
||||
@@ -17,7 +17,8 @@ function! ale_linters#javascript#flow_ls#FindProjectRoot(buffer) abort
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('javascript', {
|
||||
\ 'name': 'flow-language-server',
|
||||
\ 'name': 'flow_ls',
|
||||
\ 'aliaes': ['flow-language-server'],
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': {b -> ale#path#FindExecutable(b, 'javascript_flow_ls', [
|
||||
\ 'node_modules/.bin/flow',
|
||||
|
||||
12
ale_linters/jinja/djlint.vim
Normal file
12
ale_linters/jinja/djlint.vim
Normal file
@@ -0,0 +1,12 @@
|
||||
" Author: Adrian Vollmer <computerfluesterer@protonmail.com>
|
||||
" Description: djlint for Django HTML template files
|
||||
|
||||
call ale#Set('html_djlint_executable', 'djlint')
|
||||
call ale#Set('html_djlint_options', '')
|
||||
|
||||
call ale#linter#Define('jinja', {
|
||||
\ 'name': 'djlint',
|
||||
\ 'executable': function('ale#handlers#djlint#GetExecutable'),
|
||||
\ 'command': function('ale#handlers#djlint#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#djlint#Handle',
|
||||
\})
|
||||
10
ale_linters/json/biome.vim
Normal file
10
ale_linters/json/biome.vim
Normal file
@@ -0,0 +1,10 @@
|
||||
" Description: biome for json files
|
||||
|
||||
call ale#linter#Define('json', {
|
||||
\ 'name': 'biome',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'language': function('ale#handlers#biome#GetLanguage'),
|
||||
\ 'executable': function('ale#handlers#biome#GetExecutable'),
|
||||
\ 'command': '%e lsp-proxy',
|
||||
\ 'project_root': function('ale#handlers#biome#GetProjectRoot'),
|
||||
\})
|
||||
@@ -5,7 +5,7 @@ call ale#Set('json_jq_filters', '.')
|
||||
|
||||
" Matches patterns like the following:
|
||||
" parse error: Expected another key-value pair at line 4, column 3
|
||||
let s:pattern = '^parse error: \(.\+\) at line \(\d\+\), column \(\d\+\)$'
|
||||
let s:pattern = 'parse error: \(.\+\) at line \(\d\+\), column \(\d\+\)$'
|
||||
|
||||
function! ale_linters#json#jq#Handle(buffer, lines) abort
|
||||
return ale#util#MapMatches(a:lines, s:pattern, {match -> {
|
||||
|
||||
@@ -1,6 +1,22 @@
|
||||
" Author: Dalius Dobravolskas <dalius.dobravolskas@gmail.com>
|
||||
" Description: VSCode json language server
|
||||
|
||||
call ale#Set('json_vscodejson_executable', '<auto>')
|
||||
|
||||
function! ale_linters#json#vscodejson#GetExecutable(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'json_vscodejson_executable')
|
||||
|
||||
if l:executable is# '<auto>'
|
||||
if ale#engine#IsExecutable(a:buffer, 'vscode-json-languageserver')
|
||||
let l:executable = 'vscode-json-languageserver'
|
||||
else
|
||||
let l:executable = 'vscode-json-language-server'
|
||||
endif
|
||||
endif
|
||||
|
||||
return l:executable
|
||||
endfunction
|
||||
|
||||
function! ale_linters#json#vscodejson#GetProjectRoot(buffer) abort
|
||||
let l:git_path = ale#path#FindNearestDirectory(a:buffer, '.git')
|
||||
|
||||
@@ -10,7 +26,7 @@ endfunction
|
||||
call ale#linter#Define('json', {
|
||||
\ 'name': 'vscodejson',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': 'vscode-json-language-server',
|
||||
\ 'executable': function('ale_linters#json#vscodejson#GetExecutable'),
|
||||
\ 'command': '%e --stdio',
|
||||
\ 'project_root': function('ale_linters#json#vscodejson#GetProjectRoot'),
|
||||
\})
|
||||
|
||||
10
ale_linters/jsonc/biome.vim
Normal file
10
ale_linters/jsonc/biome.vim
Normal file
@@ -0,0 +1,10 @@
|
||||
" Description: biome for jsonc files
|
||||
|
||||
call ale#linter#Define('jsonc', {
|
||||
\ 'name': 'biome',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'language': function('ale#handlers#biome#GetLanguage'),
|
||||
\ 'executable': function('ale#handlers#biome#GetExecutable'),
|
||||
\ 'command': '%e lsp-proxy',
|
||||
\ 'project_root': function('ale#handlers#biome#GetProjectRoot'),
|
||||
\})
|
||||
@@ -13,6 +13,7 @@ endfunction
|
||||
|
||||
call ale#linter#Define('julia', {
|
||||
\ 'name': 'languageserver',
|
||||
\ 'aliases': ['julials'],
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': {b -> ale#Var(b, 'julia_executable')},
|
||||
\ 'command': function('ale_linters#julia#languageserver#GetCommand'),
|
||||
|
||||
@@ -21,6 +21,7 @@ endfunction
|
||||
|
||||
call ale#linter#Define('kotlin', {
|
||||
\ 'name': 'languageserver',
|
||||
\ 'aliaes': ['kotlin_language_server'],
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': {b -> ale#Var(b, 'kotlin_languageserver_executable')},
|
||||
\ 'command': '%e',
|
||||
|
||||
@@ -12,6 +12,7 @@ endfunction
|
||||
|
||||
call ale#linter#Define('less', {
|
||||
\ 'name': 'stylelint',
|
||||
\ 'output_stream': 'both',
|
||||
\ 'executable': {b -> ale#path#FindExecutable(b, 'less_stylelint', [
|
||||
\ 'node_modules/.bin/stylelint',
|
||||
\ ])},
|
||||
|
||||
15
ale_linters/lua/lua_language_server.vim
Normal file
15
ale_linters/lua/lua_language_server.vim
Normal file
@@ -0,0 +1,15 @@
|
||||
" Author: w0rp <dev@w0rp.com>
|
||||
" Description: lua-language-server integration (https://github.com/LuaLS/lua-language-server)
|
||||
|
||||
call ale#Set('lua_language_server_executable', 'lua-language-server')
|
||||
call ale#Set('lua_language_server_config', {})
|
||||
|
||||
call ale#linter#Define('lua', {
|
||||
\ 'name': 'lua_language_server',
|
||||
\ 'aliases': ['lua-language-server', 'lua_ls'],
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': {b -> ale#Var(b, 'lua_language_server_executable')},
|
||||
\ 'command': '%e',
|
||||
\ 'project_root': function('ale#lua#FindProjectRoot'),
|
||||
\ 'lsp_config': {b -> ale#Var(b, 'lua_language_server_config')},
|
||||
\})
|
||||
@@ -4,8 +4,43 @@
|
||||
call ale#Set('lua_luacheck_executable', 'luacheck')
|
||||
call ale#Set('lua_luacheck_options', '')
|
||||
|
||||
function! s:IsInRuntimepath(buffer) abort
|
||||
let l:runtimepath_dirs = split(&runtimepath, ',')
|
||||
|
||||
for l:dir in ale#path#Upwards(expand('#' . a:buffer . ':p:h'))
|
||||
for l:runtime_dir in l:runtimepath_dirs
|
||||
if l:dir is# l:runtime_dir
|
||||
return 1
|
||||
endif
|
||||
endfor
|
||||
endfor
|
||||
|
||||
return 0
|
||||
endfunction
|
||||
|
||||
function! ale_linters#lua#luacheck#GetCommand(buffer) abort
|
||||
return '%e' . ale#Pad(ale#Var(a:buffer, 'lua_luacheck_options'))
|
||||
let l:options = ale#Var(a:buffer, 'lua_luacheck_options')
|
||||
|
||||
" Add `--globals vim` by default if the file is in runtimepath.
|
||||
if l:options !~# '--globals'
|
||||
let l:in_runtime = getbufvar(a:buffer, 'ale_in_runtimepath', v:null)
|
||||
|
||||
if l:in_runtime is v:null
|
||||
let l:in_runtime = s:IsInRuntimepath(a:buffer)
|
||||
" Save the result of check this buffer so we only check once.
|
||||
call setbufvar(a:buffer, 'ale_in_runtimepath', l:in_runtime)
|
||||
endif
|
||||
|
||||
if l:in_runtime
|
||||
if !empty(l:options)
|
||||
let l:options .= ' '
|
||||
endif
|
||||
|
||||
let l:options .= '--globals vim'
|
||||
endif
|
||||
endif
|
||||
|
||||
return '%e' . ale#Pad(l:options)
|
||||
\ . ' --formatter plain --codes --filename %s -'
|
||||
endfunction
|
||||
|
||||
|
||||
35
ale_linters/markdown/marksman.vim
Normal file
35
ale_linters/markdown/marksman.vim
Normal file
@@ -0,0 +1,35 @@
|
||||
" Author: Peter Benjamin <petermbenjamin@gmail.com>
|
||||
" Description: Write Markdown with code assist and intelligence in the comfort of your favourite editor.
|
||||
|
||||
call ale#Set('markdown_marksman_executable', 'marksman')
|
||||
|
||||
function! ale_linters#markdown#marksman#GetCommand(buffer) abort
|
||||
return '%e server'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#markdown#marksman#GetProjectRoot(buffer) abort
|
||||
" Find nearest .marksman.toml
|
||||
let l:marksman_toml = ale#path#FindNearestFile(a:buffer, '.marksman.toml')
|
||||
|
||||
if !empty(l:marksman_toml)
|
||||
return fnamemodify(l:marksman_toml, ':h')
|
||||
endif
|
||||
|
||||
" Find nearest .git/ directory
|
||||
let l:project_root = finddir('.git/..', expand('#' . a:buffer . '...').';')
|
||||
|
||||
if !empty(l:project_root)
|
||||
return l:project_root
|
||||
endif
|
||||
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('markdown', {
|
||||
\ 'name': 'marksman',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': {b -> ale#Var(b, 'markdown_marksman_executable')},
|
||||
\ 'command': function('ale_linters#markdown#marksman#GetCommand'),
|
||||
\ 'project_root': function('ale_linters#markdown#marksman#GetProjectRoot'),
|
||||
\ 'initialization_options': {},
|
||||
\})
|
||||
73
ale_linters/markdown/pymarkdown.vim
Normal file
73
ale_linters/markdown/pymarkdown.vim
Normal file
@@ -0,0 +1,73 @@
|
||||
|
||||
call ale#Set('markdown_pymarkdown_executable', 'pymarkdown')
|
||||
call ale#Set('markdown_pymarkdown_options', '')
|
||||
call ale#Set('markdown_pymarkdown_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
call ale#Set('markdown_pymarkdown_auto_pipenv', 0)
|
||||
call ale#Set('markdown_pymarkdown_auto_poetry', 0)
|
||||
call ale#Set('markdown_pymarkdown_auto_uv', 0)
|
||||
|
||||
function! ale_linters#markdown#pymarkdown#GetExecutable(buffer) abort
|
||||
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'markdown_pymarkdown_auto_pipenv'))
|
||||
\ && ale#python#PipenvPresent(a:buffer)
|
||||
return 'pipenv'
|
||||
endif
|
||||
|
||||
if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'markdown_pymarkdown_auto_poetry'))
|
||||
\ && ale#python#PoetryPresent(a:buffer)
|
||||
return 'poetry'
|
||||
endif
|
||||
|
||||
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'markdown_pymarkdown_auto_uv'))
|
||||
\ && ale#python#UvPresent(a:buffer)
|
||||
return 'uv'
|
||||
endif
|
||||
|
||||
return ale#python#FindExecutable(a:buffer, 'markdown_pymarkdown', ['pymarkdown'])
|
||||
endfunction
|
||||
|
||||
function! ale_linters#markdown#pymarkdown#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#markdown#pymarkdown#GetExecutable(a:buffer)
|
||||
|
||||
let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
|
||||
\ ? ' run pymarkdown'
|
||||
\ : ''
|
||||
|
||||
return ale#Escape(l:executable) . l:exec_args
|
||||
\ . ' '
|
||||
\ . ale#Var(a:buffer, 'markdown_pymarkdown_options')
|
||||
\ . 'scan-stdin'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#markdown#pymarkdown#Handle(buffer, lines) abort
|
||||
let l:pattern = '\v^(\S*):(\d+):(\d+): ([A-Z]+\d+): (.*)$'
|
||||
let l:output = []
|
||||
" lines are formatted as follows:
|
||||
" sample.md:1:1: MD022: Headings should be surrounded by blank lines. [Expected: 1; Actual: 0; Below] (blanks-around-headings,blanks-around-headers)
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
if(l:match[4] is# 'MD009')
|
||||
\&& !ale#Var(a:buffer, 'warn_about_trailing_whitespace')
|
||||
" Skip warnings for trailing whitespace if the option is off.
|
||||
continue
|
||||
endif
|
||||
|
||||
let l:item = {
|
||||
\ 'lnum': l:match[2] + 0,
|
||||
\ 'col': l:match[3] + 0,
|
||||
\ 'type': l:match[4][0],
|
||||
\ 'text': l:match[5],
|
||||
\ 'code': l:match[4],
|
||||
\}
|
||||
|
||||
call add(l:output, l:item)
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('markdown', {
|
||||
\ 'name': 'pymarkdown',
|
||||
\ 'executable': function('ale_linters#markdown#pymarkdown#GetExecutable'),
|
||||
\ 'command': function('ale_linters#markdown#pymarkdown#GetCommand'),
|
||||
\ 'callback': 'ale_linters#markdown#pymarkdown#Handle',
|
||||
\})
|
||||
13
ale_linters/nix/deadnix.vim
Normal file
13
ale_linters/nix/deadnix.vim
Normal file
@@ -0,0 +1,13 @@
|
||||
call ale#Set('nix_deadnix_executable', 'deadnix')
|
||||
call ale#Set('nix_deadnix_options', '')
|
||||
|
||||
function! ale_linters#nix#deadnix#GetCommand(buffer) abort
|
||||
return '%e -o json' . ale#Pad(ale#Var(a:buffer, 'nix_deadnix_options')) . ' -- %t'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('nix', {
|
||||
\ 'name': 'deadnix',
|
||||
\ 'executable': {b -> ale#Var(b, 'nix_deadnix_executable')},
|
||||
\ 'command': function('ale_linters#nix#deadnix#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#deadnix#Handle',
|
||||
\})
|
||||
@@ -5,10 +5,10 @@
|
||||
function! ale_linters#nix#nix#Command(buffer, output, meta) abort
|
||||
let l:version = a:output[0][22:]
|
||||
|
||||
if l:version =~# '^\(2.[4-9]\|2.[1-9][0-9]\+\|3\).*'
|
||||
return 'nix-instantiate --log-format internal-json --parse -'
|
||||
else
|
||||
if l:version =~# '^\(1\|2.[0-3]\.\).*'
|
||||
return 'nix-instantiate --parse -'
|
||||
else
|
||||
return 'nix-instantiate --log-format internal-json --parse -'
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ endfunction
|
||||
|
||||
call ale#linter#Define('nix', {
|
||||
\ 'name': 'rnix_lsp',
|
||||
\ 'aliases': ['rnix'],
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': 'rnix-lsp',
|
||||
\ 'command': '%e',
|
||||
|
||||
12
ale_linters/nunjucks/djlint.vim
Normal file
12
ale_linters/nunjucks/djlint.vim
Normal file
@@ -0,0 +1,12 @@
|
||||
" Author: Adrian Vollmer <computerfluesterer@protonmail.com>
|
||||
" Description: djlint for Django HTML template files
|
||||
|
||||
call ale#Set('html_djlint_executable', 'djlint')
|
||||
call ale#Set('html_djlint_options', '')
|
||||
|
||||
call ale#linter#Define('nunjucks', {
|
||||
\ 'name': 'djlint',
|
||||
\ 'executable': function('ale#handlers#djlint#GetExecutable'),
|
||||
\ 'command': function('ale#handlers#djlint#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#djlint#Handle',
|
||||
\})
|
||||
@@ -6,6 +6,7 @@ call ale#Set('ocaml_ols_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
|
||||
call ale#linter#Define('ocaml', {
|
||||
\ 'name': 'ols',
|
||||
\ 'aliases': ['ocaml-language-server'],
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': function('ale#handlers#ols#GetExecutable'),
|
||||
\ 'command': function('ale#handlers#ols#GetCommand'),
|
||||
|
||||
19
ale_linters/odin/ols.vim
Normal file
19
ale_linters/odin/ols.vim
Normal file
@@ -0,0 +1,19 @@
|
||||
" Author: Benjamin Block <https://github.com/benjamindblock>
|
||||
" Description: A language server for Odin.
|
||||
|
||||
function! ale_linters#odin#ols#GetProjectRoot(buffer) abort
|
||||
return fnamemodify('', ':h')
|
||||
endfunction
|
||||
|
||||
call ale#Set('odin_ols_executable', 'ols')
|
||||
call ale#Set('odin_ols_config', {})
|
||||
|
||||
call ale#linter#Define('odin', {
|
||||
\ 'name': 'ols',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'language': 'odin',
|
||||
\ 'lsp_config': {b -> ale#Var(b, 'odin_ols_config')},
|
||||
\ 'executable': {b -> ale#Var(b, 'odin_ols_executable')},
|
||||
\ 'command': '%e',
|
||||
\ 'project_root': function('ale_linters#odin#ols#GetProjectRoot'),
|
||||
\})
|
||||
@@ -7,9 +7,9 @@ let g:ale_php_phpmd_executable = get(g:, 'ale_php_phpmd_executable', 'phpmd')
|
||||
let g:ale_php_phpmd_ruleset = get(g:, 'ale_php_phpmd_ruleset', 'cleancode,codesize,controversial,design,naming,unusedcode')
|
||||
|
||||
function! ale_linters#php#phpmd#GetCommand(buffer) abort
|
||||
return '%e %s text'
|
||||
return '%e %t text'
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'php_phpmd_ruleset'))
|
||||
\ . ' --ignore-violations-on-exit %t'
|
||||
\ . ' --ignore-violations-on-exit'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#php#phpmd#Handle(buffer, lines) abort
|
||||
|
||||
@@ -22,14 +22,12 @@ function! ale_linters#php#phpstan#GetCommand(buffer, version) abort
|
||||
|
||||
let l:memory_limit = ale#Var(a:buffer, 'php_phpstan_memory_limit')
|
||||
let l:memory_limit_option = !empty(l:memory_limit)
|
||||
\ ? ' --memory-limit ' . ale#Escape(l:memory_limit)
|
||||
\ ? ' --memory-limit=' . ale#Escape(l:memory_limit)
|
||||
\ : ''
|
||||
|
||||
let l:level = ale#Var(a:buffer, 'php_phpstan_level')
|
||||
let l:config_file_exists = ale#path#FindNearestFile(a:buffer, 'phpstan.neon')
|
||||
let l:dist_config_file_exists = ale#path#FindNearestFile(a:buffer, 'phpstan.neon.dist')
|
||||
|
||||
if empty(l:level) && empty(l:config_file_exists) && empty(l:dist_config_file_exists)
|
||||
if empty(l:level) && empty(ale_linters#php#phpstan#FindConfigFile(a:buffer))
|
||||
" if no configuration file is found, then use 4 as a default level
|
||||
let l:level = '4'
|
||||
endif
|
||||
@@ -59,17 +57,35 @@ function! ale_linters#php#phpstan#Handle(buffer, lines) abort
|
||||
return l:output
|
||||
endif
|
||||
|
||||
for l:err in l:res.files[expand('#' . a:buffer .':p')].messages
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:err.line,
|
||||
\ 'text': l:err.message,
|
||||
\ 'type': 'E',
|
||||
\})
|
||||
for l:key in keys(l:res.files)
|
||||
for l:err in l:res.files[l:key].messages
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:err.line,
|
||||
\ 'text': l:err.message,
|
||||
\ 'type': 'E',
|
||||
\})
|
||||
endfor
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
function! ale_linters#php#phpstan#GetCwd(buffer) abort
|
||||
let l:result = ale#path#Dirname(ale_linters#php#phpstan#FindConfigFile(a:buffer))
|
||||
|
||||
return empty(l:result) ? v:null : l:result
|
||||
endfunction
|
||||
|
||||
function! ale_linters#php#phpstan#FindConfigFile(buffer) abort
|
||||
let l:result = ale#path#FindNearestFile(a:buffer, 'phpstan.neon')
|
||||
|
||||
if empty(l:result)
|
||||
let l:result = ale#path#FindNearestFile(a:buffer, 'phpstan.neon.dist')
|
||||
endif
|
||||
|
||||
return l:result
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('php', {
|
||||
\ 'name': 'phpstan',
|
||||
\ 'executable': {buffer -> ale#path#FindExecutable(buffer, 'php_phpstan', [
|
||||
@@ -86,4 +102,5 @@ call ale#linter#Define('php', {
|
||||
\ function('ale_linters#php#phpstan#GetCommand'),
|
||||
\ )},
|
||||
\ 'callback': 'ale_linters#php#phpstan#Handle',
|
||||
\ 'cwd': function('ale_linters#php#phpstan#GetCwd'),
|
||||
\})
|
||||
|
||||
@@ -29,6 +29,7 @@ endfunction
|
||||
|
||||
call ale#linter#Define('puppet', {
|
||||
\ 'name': 'languageserver',
|
||||
\ 'aliases': ['puppet_languageserver'],
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': {b -> ale#Var(b, 'puppet_languageserver_executable')},
|
||||
\ 'command': '%e --stdio',
|
||||
|
||||
@@ -41,6 +41,7 @@ endfunction
|
||||
|
||||
call ale#linter#Define('purescript', {
|
||||
\ 'name': 'purescript-language-server',
|
||||
\ 'aliases': ['purescriptls'],
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': function('ale_linters#purescript#ls#GetExecutable'),
|
||||
\ 'command': function('ale_linters#purescript#ls#GetCommand'),
|
||||
|
||||
@@ -7,6 +7,7 @@ call ale#Set('python_bandit_use_config', 1)
|
||||
call ale#Set('python_bandit_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
call ale#Set('python_bandit_auto_pipenv', 0)
|
||||
call ale#Set('python_bandit_auto_poetry', 0)
|
||||
call ale#Set('python_bandit_auto_uv', 0)
|
||||
|
||||
function! ale_linters#python#bandit#GetExecutable(buffer) abort
|
||||
if (
|
||||
@@ -23,6 +24,11 @@ function! ale_linters#python#bandit#GetExecutable(buffer) abort
|
||||
return 'poetry'
|
||||
endif
|
||||
|
||||
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_bandit_auto_uv'))
|
||||
\ && ale#python#UvPresent(a:buffer)
|
||||
return 'uv'
|
||||
endif
|
||||
|
||||
return ale#python#FindExecutable(a:buffer, 'python_bandit', ['bandit'])
|
||||
endfunction
|
||||
|
||||
@@ -39,7 +45,7 @@ function! ale_linters#python#bandit#GetCommand(buffer) abort
|
||||
endif
|
||||
endif
|
||||
|
||||
let l:exec_args = l:executable =~? 'pipenv\|poetry$'
|
||||
let l:exec_args = l:executable =~? '\(pipenv\|poetry\|uv\)$'
|
||||
\ ? ' run bandit'
|
||||
\ : ''
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ call ale#Set('python_flake8_use_global', get(g:, 'ale_use_global_executables', 0
|
||||
call ale#Set('python_flake8_change_directory', 'project')
|
||||
call ale#Set('python_flake8_auto_pipenv', 0)
|
||||
call ale#Set('python_flake8_auto_poetry', 0)
|
||||
call ale#Set('python_flake8_auto_uv', 0)
|
||||
|
||||
function! s:UsingModule(buffer) abort
|
||||
return ale#Var(a:buffer, 'python_flake8_options') =~# ' *-m flake8'
|
||||
@@ -23,6 +24,11 @@ function! ale_linters#python#flake8#GetExecutable(buffer) abort
|
||||
return 'poetry'
|
||||
endif
|
||||
|
||||
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_flake8_auto_uv'))
|
||||
\ && ale#python#UvPresent(a:buffer)
|
||||
return 'uv'
|
||||
endif
|
||||
|
||||
if !s:UsingModule(a:buffer)
|
||||
return ale#python#FindExecutable(a:buffer, 'python_flake8', ['flake8'])
|
||||
endif
|
||||
@@ -57,7 +63,7 @@ function! ale_linters#python#flake8#GetCwd(buffer) abort
|
||||
endif
|
||||
|
||||
if (l:change_directory is# 'project' && empty(l:cwd))
|
||||
\|| l:change_directory is# 1
|
||||
\|| l:change_directory
|
||||
\|| l:change_directory is# 'file'
|
||||
let l:cwd = '%s:h'
|
||||
endif
|
||||
@@ -68,7 +74,7 @@ endfunction
|
||||
function! ale_linters#python#flake8#GetCommand(buffer, version) abort
|
||||
let l:executable = ale_linters#python#flake8#GetExecutable(a:buffer)
|
||||
|
||||
let l:exec_args = l:executable =~? 'pipenv\|poetry$'
|
||||
let l:exec_args = l:executable =~? '\(pipenv\|poetry\|uv\)$'
|
||||
\ ? ' run flake8'
|
||||
\ : ''
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ call ale#Set('python_flakehell_use_global', get(g:, 'ale_use_global_executables'
|
||||
call ale#Set('python_flakehell_change_directory', 'project')
|
||||
call ale#Set('python_flakehell_auto_pipenv', 0)
|
||||
call ale#Set('python_flakehell_auto_poetry', 0)
|
||||
call ale#Set('python_flakehell_auto_uv', 0)
|
||||
|
||||
function! s:UsingModule(buffer) abort
|
||||
return ale#Var(a:buffer, 'python_flakehell_executable') is? 'python'
|
||||
@@ -23,6 +24,11 @@ function! ale_linters#python#flakehell#GetExecutable(buffer) abort
|
||||
return 'poetry'
|
||||
endif
|
||||
|
||||
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_flakehell_auto_uv'))
|
||||
\ && ale#python#UvPresent(a:buffer)
|
||||
return 'uv'
|
||||
endif
|
||||
|
||||
if !s:UsingModule(a:buffer)
|
||||
return ale#python#FindExecutable(a:buffer, 'python_flakehell', ['flakehell'])
|
||||
endif
|
||||
@@ -57,7 +63,7 @@ function! ale_linters#python#flakehell#GetCwd(buffer) abort
|
||||
endif
|
||||
|
||||
if (l:change_directory is# 'project' && empty(l:cwd))
|
||||
\|| l:change_directory is# 1
|
||||
\|| l:change_directory
|
||||
\|| l:change_directory is# 'file'
|
||||
let l:cwd = '%s:h'
|
||||
endif
|
||||
@@ -68,7 +74,7 @@ endfunction
|
||||
function! ale_linters#python#flakehell#GetCommand(buffer, version) abort
|
||||
let l:executable = ale_linters#python#flakehell#GetExecutable(a:buffer)
|
||||
|
||||
if (l:executable =~? 'pipenv\|poetry$')
|
||||
if (l:executable =~? '\(pipenv\|poetry\|uv\)$')
|
||||
let l:exec_args = ' run flakehell'
|
||||
elseif (l:executable is? 'python')
|
||||
let l:exec_args = ' -m flakehell'
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
call ale#Set('python_jedils_executable', 'jedi-language-server')
|
||||
call ale#Set('python_jedils_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
call ale#Set('python_jedils_auto_pipenv', 0)
|
||||
call ale#Set('python_jedils_auto_poetry', 0)
|
||||
call ale#Set('python_jedils_auto_uv', 0)
|
||||
|
||||
function! ale_linters#python#jedils#GetExecutable(buffer) abort
|
||||
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_jedils_auto_pipenv'))
|
||||
@@ -11,21 +13,36 @@ function! ale_linters#python#jedils#GetExecutable(buffer) abort
|
||||
return 'pipenv'
|
||||
endif
|
||||
|
||||
if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_jedils_auto_poetry'))
|
||||
\ && ale#python#PoetryPresent(a:buffer)
|
||||
return 'poetry'
|
||||
endif
|
||||
|
||||
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_jedils_auto_uv'))
|
||||
\ && ale#python#UvPresent(a:buffer)
|
||||
return 'uv'
|
||||
endif
|
||||
|
||||
return ale#python#FindExecutable(a:buffer, 'python_jedils', ['jedi-language-server'])
|
||||
endfunction
|
||||
|
||||
function! ale_linters#python#jedils#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#python#jedils#GetExecutable(a:buffer)
|
||||
|
||||
let l:exec_args = l:executable =~? 'pipenv$'
|
||||
let l:exec_args = l:executable =~? '\(pipenv\|poetry\|uv\)$'
|
||||
\ ? ' run jedi-language-server'
|
||||
\ : ''
|
||||
let l:env_string = ''
|
||||
|
||||
return ale#Escape(l:executable) . l:exec_args
|
||||
if ale#Var(a:buffer, 'python_auto_virtualenv')
|
||||
let l:env_string = ale#python#AutoVirtualenvEnvString(a:buffer)
|
||||
endif
|
||||
|
||||
return l:env_string . ale#Escape(l:executable) . l:exec_args
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('python', {
|
||||
\ 'name': 'jedils',
|
||||
\ 'aliases': ['jedi_language_server'],
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': function('ale_linters#python#jedils#GetExecutable'),
|
||||
\ 'command': function('ale_linters#python#jedils#GetCommand'),
|
||||
|
||||
@@ -8,6 +8,7 @@ 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)
|
||||
call ale#Set('python_mypy_auto_poetry', 0)
|
||||
call ale#Set('python_mypy_auto_uv', 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'))
|
||||
@@ -20,6 +21,11 @@ function! ale_linters#python#mypy#GetExecutable(buffer) abort
|
||||
return 'poetry'
|
||||
endif
|
||||
|
||||
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_mypy_auto_uv'))
|
||||
\ && ale#python#UvPresent(a:buffer)
|
||||
return 'uv'
|
||||
endif
|
||||
|
||||
return ale#python#FindExecutable(a:buffer, 'python_mypy', ['mypy'])
|
||||
endfunction
|
||||
|
||||
@@ -43,7 +49,7 @@ endfunction
|
||||
|
||||
function! ale_linters#python#mypy#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#python#mypy#GetExecutable(a:buffer)
|
||||
let l:exec_args = l:executable =~? 'pipenv\|poetry$'
|
||||
let l:exec_args = l:executable =~? '\(pipenv\|poetry\|uv\)$'
|
||||
\ ? ' run mypy'
|
||||
\ : ''
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
call ale#Set('python_prospector_auto_pipenv', 0)
|
||||
call ale#Set('python_prospector_auto_poetry', 0)
|
||||
call ale#Set('python_prospector_auto_uv', 0)
|
||||
|
||||
let g:ale_python_prospector_executable =
|
||||
\ get(g:, 'ale_python_prospector_executable', 'prospector')
|
||||
@@ -23,13 +24,18 @@ function! ale_linters#python#prospector#GetExecutable(buffer) abort
|
||||
return 'poetry'
|
||||
endif
|
||||
|
||||
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_prospector_auto_uv'))
|
||||
\ && ale#python#UvPresent(a:buffer)
|
||||
return 'uv'
|
||||
endif
|
||||
|
||||
return ale#python#FindExecutable(a:buffer, 'python_prospector', ['prospector'])
|
||||
endfunction
|
||||
|
||||
function! ale_linters#python#prospector#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#python#prospector#GetExecutable(a:buffer)
|
||||
|
||||
let l:exec_args = l:executable =~? 'pipenv\|poetry$'
|
||||
let l:exec_args = l:executable =~? '\(pipenv\|poetry\|uv\)$'
|
||||
\ ? ' run prospector'
|
||||
\ : ''
|
||||
|
||||
|
||||
92
ale_linters/python/pycln.vim
Normal file
92
ale_linters/python/pycln.vim
Normal file
@@ -0,0 +1,92 @@
|
||||
" Author: Yining <zhang.yining@gmail.com>
|
||||
" Description: pycln as linter for python files
|
||||
|
||||
call ale#Set('python_pycln_executable', 'pycln')
|
||||
call ale#Set('python_pycln_options', '')
|
||||
call ale#Set('python_pycln_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
call ale#Set('python_pycln_change_directory', 1)
|
||||
call ale#Set('python_pycln_auto_pipenv', 0)
|
||||
call ale#Set('python_pycln_auto_poetry', 0)
|
||||
call ale#Set('python_pycln_auto_uv', 0)
|
||||
call ale#Set('python_pycln_config_file', '')
|
||||
|
||||
function! ale_linters#python#pycln#GetExecutable(buffer) abort
|
||||
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pycln_auto_pipenv'))
|
||||
\ && ale#python#PipenvPresent(a:buffer)
|
||||
return 'pipenv'
|
||||
endif
|
||||
|
||||
if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_pycln_auto_poetry'))
|
||||
\ && ale#python#PoetryPresent(a:buffer)
|
||||
return 'poetry'
|
||||
endif
|
||||
|
||||
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_pycln_auto_uv'))
|
||||
\ && ale#python#UvPresent(a:buffer)
|
||||
return 'uv'
|
||||
endif
|
||||
|
||||
return ale#python#FindExecutable(a:buffer, 'python_pycln', ['pycln'])
|
||||
endfunction
|
||||
|
||||
function! ale_linters#python#pycln#GetCwd(buffer) abort
|
||||
if ale#Var(a:buffer, 'python_pycln_change_directory')
|
||||
" Run from project root if found, else from buffer dir.
|
||||
let l:project_root = ale#python#FindProjectRoot(a:buffer)
|
||||
|
||||
return !empty(l:project_root) ? l:project_root : '%s:h'
|
||||
endif
|
||||
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
function! ale_linters#python#pycln#GetCommand(buffer, version) abort
|
||||
let l:executable = ale_linters#python#pycln#GetExecutable(a:buffer)
|
||||
let l:exec_args = l:executable =~? '\(pipenv\|poetry\|uv\)$'
|
||||
\ ? ' run pycln'
|
||||
\ : ''
|
||||
|
||||
let l:options = ale#Var(a:buffer, 'python_pycln_options')
|
||||
let l:config_file = ale#Var(a:buffer, 'python_pycln_config_file')
|
||||
let l:config_file = l:options !~# '\v(^| )--config ' && !empty(l:config_file)
|
||||
\ ? ale#Escape(ale#path#Simplify(l:config_file))
|
||||
\ : ''
|
||||
|
||||
" NOTE: pycln version `1.3.0` supports liniting input from stdin
|
||||
return ale#Escape(l:executable) . l:exec_args
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'python_pycln_options'))
|
||||
\ . (empty(l:config_file) ? '' : ' --config ' . l:config_file)
|
||||
\ . ' --check'
|
||||
\ . (ale#semver#GTE(a:version, [1, 3, 0]) ? ' -' : ' %s')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#python#pycln#Handle(buffer, lines) abort
|
||||
" Example: tmp/test.py:3:0 'import os' would be removed!
|
||||
let l:pattern = '\v^[a-zA-Z]?:?[^:]+:(\d+):(\d+):? (.+)$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[1] + 0,
|
||||
\ 'col': l:match[2] + 0,
|
||||
\ 'text': l:match[3],
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('python', {
|
||||
\ 'name': 'pycln',
|
||||
\ 'executable': function('ale_linters#python#pycln#GetExecutable'),
|
||||
\ 'cwd': function('ale_linters#python#pycln#GetCwd'),
|
||||
\ 'command': {buffer -> ale#semver#RunWithVersionCheck(
|
||||
\ buffer,
|
||||
\ ale_linters#python#pycln#GetExecutable(buffer),
|
||||
\ '%e --version',
|
||||
\ function('ale_linters#python#pycln#GetCommand'),
|
||||
\ )},
|
||||
\ 'callback': 'ale_linters#python#pycln#Handle',
|
||||
\ 'output_stream': 'both',
|
||||
\ 'read_buffer': 1,
|
||||
\})
|
||||
@@ -6,6 +6,7 @@ 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)
|
||||
call ale#Set('python_pycodestyle_auto_poetry', 0)
|
||||
call ale#Set('python_pycodestyle_auto_uv', 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'))
|
||||
@@ -18,13 +19,18 @@ function! ale_linters#python#pycodestyle#GetExecutable(buffer) abort
|
||||
return 'poetry'
|
||||
endif
|
||||
|
||||
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_pycodestyle_auto_uv'))
|
||||
\ && ale#python#UvPresent(a:buffer)
|
||||
return 'uv'
|
||||
endif
|
||||
|
||||
return ale#python#FindExecutable(a:buffer, 'python_pycodestyle', ['pycodestyle'])
|
||||
endfunction
|
||||
|
||||
function! ale_linters#python#pycodestyle#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#python#pycodestyle#GetExecutable(a:buffer)
|
||||
|
||||
let l:exec_args = l:executable =~? 'pipenv\|poetry$'
|
||||
let l:exec_args = l:executable =~? '\(pipenv\|poetry\|uv\)$'
|
||||
\ ? ' run pycodestyle'
|
||||
\ : ''
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ call ale#Set('python_pydocstyle_options', '')
|
||||
call ale#Set('python_pydocstyle_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
call ale#Set('python_pydocstyle_auto_pipenv', 0)
|
||||
call ale#Set('python_pydocstyle_auto_poetry', 0)
|
||||
call ale#Set('python_pydocstyle_auto_uv', 0)
|
||||
|
||||
function! ale_linters#python#pydocstyle#GetExecutable(buffer) abort
|
||||
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pydocstyle_auto_pipenv'))
|
||||
@@ -18,12 +19,17 @@ function! ale_linters#python#pydocstyle#GetExecutable(buffer) abort
|
||||
return 'poetry'
|
||||
endif
|
||||
|
||||
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_pydocstyle_auto_uv'))
|
||||
\ && ale#python#UvPresent(a:buffer)
|
||||
return 'uv'
|
||||
endif
|
||||
|
||||
return ale#python#FindExecutable(a:buffer, 'python_pydocstyle', ['pydocstyle'])
|
||||
endfunction
|
||||
|
||||
function! ale_linters#python#pydocstyle#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#python#pydocstyle#GetExecutable(a:buffer)
|
||||
let l:exec_args = l:executable =~? 'pipenv\|poetry$'
|
||||
let l:exec_args = l:executable =~? '\(pipenv\|poetry\|uv\)$'
|
||||
\ ? ' run pydocstyle'
|
||||
\ : ''
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ 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)
|
||||
call ale#Set('python_pyflakes_auto_poetry', 0)
|
||||
call ale#Set('python_pyflakes_auto_uv', 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'))
|
||||
@@ -17,13 +18,18 @@ function! ale_linters#python#pyflakes#GetExecutable(buffer) abort
|
||||
return 'poetry'
|
||||
endif
|
||||
|
||||
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_pyflakes_auto_uv'))
|
||||
\ && ale#python#UvPresent(a:buffer)
|
||||
return 'uv'
|
||||
endif
|
||||
|
||||
return ale#python#FindExecutable(a:buffer, 'python_pyflakes', ['pyflakes'])
|
||||
endfunction
|
||||
|
||||
function! ale_linters#python#pyflakes#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#python#pyflakes#GetExecutable(a:buffer)
|
||||
|
||||
let l:exec_args = l:executable =~? 'pipenv\|poetry$'
|
||||
let l:exec_args = l:executable =~? '\(pipenv\|poetry\|uv\)$'
|
||||
\ ? ' run pyflakes'
|
||||
\ : ''
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ call ale#Set('python_pylama_options', '')
|
||||
call ale#Set('python_pylama_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
call ale#Set('python_pylama_auto_pipenv', 0)
|
||||
call ale#Set('python_pylama_auto_poetry', 0)
|
||||
call ale#Set('python_pylama_auto_uv', 0)
|
||||
call ale#Set('python_pylama_change_directory', 1)
|
||||
|
||||
function! ale_linters#python#pylama#GetExecutable(buffer) abort
|
||||
@@ -19,12 +20,17 @@ function! ale_linters#python#pylama#GetExecutable(buffer) abort
|
||||
return 'poetry'
|
||||
endif
|
||||
|
||||
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_pylama_auto_uv'))
|
||||
\ && ale#python#UvPresent(a:buffer)
|
||||
return 'uv'
|
||||
endif
|
||||
|
||||
return ale#python#FindExecutable(a:buffer, 'python_pylama', ['pylama'])
|
||||
endfunction
|
||||
|
||||
function! ale_linters#python#pylama#RunWithVersionCheck(buffer) abort
|
||||
let l:executable = ale_linters#python#pylama#GetExecutable(a:buffer)
|
||||
let l:exec_args = l:executable =~? 'pipenv\|poetry$'
|
||||
let l:exec_args = l:executable =~? '\(pipenv\|poetry\|uv\)$'
|
||||
\ ? ' run pylama'
|
||||
\ : ''
|
||||
|
||||
@@ -53,7 +59,7 @@ endfunction
|
||||
|
||||
function! ale_linters#python#pylama#GetCommand(buffer, version) abort
|
||||
let l:executable = ale_linters#python#pylama#GetExecutable(a:buffer)
|
||||
let l:exec_args = l:executable =~? 'pipenv\|poetry$'
|
||||
let l:exec_args = l:executable =~? '\(pipenv\|poetry\|uv\)$'
|
||||
\ ? ' run pylama'
|
||||
\ : ''
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ call ale#Set('python_pylint_use_global', get(g:, 'ale_use_global_executables', 0
|
||||
call ale#Set('python_pylint_change_directory', 1)
|
||||
call ale#Set('python_pylint_auto_pipenv', 0)
|
||||
call ale#Set('python_pylint_auto_poetry', 0)
|
||||
call ale#Set('python_pylint_auto_uv', 0)
|
||||
call ale#Set('python_pylint_use_msg_id', 0)
|
||||
|
||||
function! ale_linters#python#pylint#GetExecutable(buffer) abort
|
||||
@@ -20,6 +21,11 @@ function! ale_linters#python#pylint#GetExecutable(buffer) abort
|
||||
return 'poetry'
|
||||
endif
|
||||
|
||||
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_pylint_auto_uv'))
|
||||
\ && ale#python#UvPresent(a:buffer)
|
||||
return 'uv'
|
||||
endif
|
||||
|
||||
return ale#python#FindExecutable(a:buffer, 'python_pylint', ['pylint'])
|
||||
endfunction
|
||||
|
||||
@@ -38,7 +44,7 @@ endfunction
|
||||
|
||||
function! ale_linters#python#pylint#GetCommand(buffer, version) abort
|
||||
let l:executable = ale_linters#python#pylint#GetExecutable(a:buffer)
|
||||
let l:exec_args = l:executable =~? 'pipenv\|poetry$'
|
||||
let l:exec_args = l:executable =~? '\(pipenv\|poetry\|uv\)$'
|
||||
\ ? ' run pylint'
|
||||
\ : ''
|
||||
|
||||
@@ -76,7 +82,7 @@ function! ale_linters#python#pylint#Handle(buffer, lines) abort
|
||||
continue
|
||||
endif
|
||||
|
||||
if ale#Var(a:buffer, 'python_pylint_use_msg_id') is# 1
|
||||
if ale#Var(a:buffer, 'python_pylint_use_msg_id')
|
||||
let l:code_out = l:code
|
||||
else
|
||||
let l:code_out = l:match[4]
|
||||
|
||||
@@ -6,6 +6,7 @@ call ale#Set('python_pylsp_options', '')
|
||||
call ale#Set('python_pylsp_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
call ale#Set('python_pylsp_auto_pipenv', 0)
|
||||
call ale#Set('python_pylsp_auto_poetry', 0)
|
||||
call ale#Set('python_pylsp_auto_uv', 0)
|
||||
call ale#Set('python_pylsp_config', {})
|
||||
|
||||
function! ale_linters#python#pylsp#GetExecutable(buffer) abort
|
||||
@@ -19,6 +20,11 @@ function! ale_linters#python#pylsp#GetExecutable(buffer) abort
|
||||
return 'poetry'
|
||||
endif
|
||||
|
||||
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_pylsp_auto_uv'))
|
||||
\ && ale#python#UvPresent(a:buffer)
|
||||
return 'uv'
|
||||
endif
|
||||
|
||||
return ale#python#FindExecutable(a:buffer, 'python_pylsp', ['pylsp'])
|
||||
endfunction
|
||||
|
||||
@@ -37,12 +43,16 @@ endfunction
|
||||
|
||||
function! ale_linters#python#pylsp#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#python#pylsp#GetExecutable(a:buffer)
|
||||
|
||||
let l:exec_args = l:executable =~? 'pipenv\|poetry$'
|
||||
let l:exec_args = l:executable =~? '\(pipenv\|poetry\|uv\)$'
|
||||
\ ? ' run pylsp'
|
||||
\ : ''
|
||||
let l:env_string = ''
|
||||
|
||||
return ale#Escape(l:executable) . l:exec_args . ale#Pad(ale#Var(a:buffer, 'python_pylsp_options'))
|
||||
if ale#Var(a:buffer, 'python_auto_virtualenv')
|
||||
let l:env_string = ale#python#AutoVirtualenvEnvString(a:buffer)
|
||||
endif
|
||||
|
||||
return l:env_string . ale#Escape(l:executable) . l:exec_args . ale#Pad(ale#Var(a:buffer, 'python_pylsp_options'))
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('python', {
|
||||
|
||||
@@ -5,6 +5,7 @@ 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)
|
||||
call ale#Set('python_pyre_auto_poetry', 0)
|
||||
call ale#Set('python_pyre_auto_uv', 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'))
|
||||
@@ -17,12 +18,17 @@ function! ale_linters#python#pyre#GetExecutable(buffer) abort
|
||||
return 'poetry'
|
||||
endif
|
||||
|
||||
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_pyre_auto_uv'))
|
||||
\ && ale#python#UvPresent(a:buffer)
|
||||
return 'uv'
|
||||
endif
|
||||
|
||||
return ale#python#FindExecutable(a:buffer, 'python_pyre', ['pyre'])
|
||||
endfunction
|
||||
|
||||
function! ale_linters#python#pyre#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#python#pyre#GetExecutable(a:buffer)
|
||||
let l:exec_args = (l:executable =~? 'pipenv\|poetry$' ? ' run pyre' : '') . ' persistent'
|
||||
let l:exec_args = (l:executable =~? '\(pipenv\|poetry\|uv\)$' ? ' run pyre' : '') . ' persistent'
|
||||
|
||||
return ale#Escape(l:executable) . l:exec_args
|
||||
endfunction
|
||||
|
||||
@@ -1,5 +1,22 @@
|
||||
call ale#Set('python_pyright_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
call ale#Set('python_pyright_executable', 'pyright-langserver')
|
||||
call ale#Set('python_pyright_config', {})
|
||||
call ale#Set('python_pyright_auto_pipenv', 0)
|
||||
call ale#Set('python_pyright_auto_poetry', 0)
|
||||
call ale#Set('python_pyright_auto_uv', 0)
|
||||
|
||||
" Force the cwd of the server to be the same as the project root to
|
||||
" fix issues with treating local files matching first or third party library
|
||||
" names being imported incorrectly.
|
||||
function! ale_linters#python#pyright#GetCwd(buffer) abort
|
||||
let l:fake_linter = {
|
||||
\ 'name': 'pyright',
|
||||
\ 'project_root': function('ale#python#FindProjectRoot'),
|
||||
\}
|
||||
let l:root = ale#lsp_linter#FindProjectRoot(a:buffer, l:fake_linter)
|
||||
|
||||
return !empty(l:root) ? l:root : v:null
|
||||
endfunction
|
||||
|
||||
function! ale_linters#python#pyright#GetConfig(buffer) abort
|
||||
let l:config = deepcopy(ale#Var(a:buffer, 'python_pyright_config'))
|
||||
@@ -32,25 +49,45 @@ function! ale_linters#python#pyright#GetConfig(buffer) abort
|
||||
return l:config
|
||||
endfunction
|
||||
|
||||
" Force the cwd of the server to be the same as the project root to
|
||||
" fix issues with treating local files matching first or third party library
|
||||
" names being imported incorrectly.
|
||||
function! ale_linters#python#pyright#GetCwd(buffer) abort
|
||||
let l:fake_linter = {
|
||||
\ 'name': 'pyright',
|
||||
\ 'project_root': function('ale#python#FindProjectRoot'),
|
||||
\}
|
||||
let l:root = ale#lsp_linter#FindProjectRoot(a:buffer, l:fake_linter)
|
||||
function! ale_linters#python#pyright#GetExecutable(buffer) abort
|
||||
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pyright_auto_pipenv'))
|
||||
\ && ale#python#PipenvPresent(a:buffer)
|
||||
return 'pipenv'
|
||||
endif
|
||||
|
||||
return !empty(l:root) ? l:root : v:null
|
||||
if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_pyright_auto_poetry'))
|
||||
\ && ale#python#PoetryPresent(a:buffer)
|
||||
return 'poetry'
|
||||
endif
|
||||
|
||||
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_pyright_auto_uv'))
|
||||
\ && ale#python#UvPresent(a:buffer)
|
||||
return 'uv'
|
||||
endif
|
||||
|
||||
return ale#python#FindExecutable(a:buffer, 'python_pyright', ['pyright-langserver'])
|
||||
endfunction
|
||||
|
||||
function! ale_linters#python#pyright#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#python#pyright#GetExecutable(a:buffer)
|
||||
let l:exec_args = l:executable =~? '\(pipenv\|poetry\|uv\)$'
|
||||
\ ? ' run pyright-langserver'
|
||||
\ : ''
|
||||
let l:env_string = ''
|
||||
|
||||
if ale#Var(a:buffer, 'python_auto_virtualenv')
|
||||
let l:env_string = ale#python#AutoVirtualenvEnvString(a:buffer)
|
||||
endif
|
||||
|
||||
return l:env_string . ale#Escape(l:executable) . l:exec_args . ' --stdio'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('python', {
|
||||
\ 'name': 'pyright',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': {b -> ale#Var(b, 'python_pyright_executable')},
|
||||
\ 'cwd': function('ale_linters#python#pyright#GetCwd'),
|
||||
\ 'command': '%e --stdio',
|
||||
\ 'executable': function('ale_linters#python#pyright#GetExecutable'),
|
||||
\ 'command': function('ale_linters#python#pyright#GetCommand'),
|
||||
\ 'project_root': function('ale#python#FindProjectRoot'),
|
||||
\ 'completion_filter': 'ale#completion#python#CompletionItemFilter',
|
||||
\ 'lsp_config': function('ale_linters#python#pyright#GetConfig'),
|
||||
|
||||
@@ -7,6 +7,7 @@ call ale#Set('python_refurb_use_global', get(g:, 'ale_use_global_executables', 0
|
||||
call ale#Set('python_refurb_change_directory', 1)
|
||||
call ale#Set('python_refurb_auto_pipenv', 0)
|
||||
call ale#Set('python_refurb_auto_poetry', 0)
|
||||
call ale#Set('python_refurb_auto_uv', 0)
|
||||
|
||||
function! ale_linters#python#refurb#GetExecutable(buffer) abort
|
||||
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_refurb_auto_pipenv'))
|
||||
@@ -19,6 +20,11 @@ function! ale_linters#python#refurb#GetExecutable(buffer) abort
|
||||
return 'poetry'
|
||||
endif
|
||||
|
||||
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_refurb_auto_uv'))
|
||||
\ && ale#python#UvPresent(a:buffer)
|
||||
return 'uv'
|
||||
endif
|
||||
|
||||
return ale#python#FindExecutable(a:buffer, 'python_refurb', ['refurb'])
|
||||
endfunction
|
||||
|
||||
@@ -35,7 +41,7 @@ endfunction
|
||||
|
||||
function! ale_linters#python#refurb#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#python#refurb#GetExecutable(a:buffer)
|
||||
let l:exec_args = l:executable =~? 'pipenv\|poetry$'
|
||||
let l:exec_args = l:executable =~? '\(pipenv\|poetry\|uv\)$'
|
||||
\ ? ' run refurb'
|
||||
\ : ''
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ call ale#Set('python_ruff_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
call ale#Set('python_ruff_change_directory', 1)
|
||||
call ale#Set('python_ruff_auto_pipenv', 0)
|
||||
call ale#Set('python_ruff_auto_poetry', 0)
|
||||
call ale#Set('python_ruff_auto_uv', 0)
|
||||
|
||||
call ale#fix#registry#Add('ruff',
|
||||
\ 'ale#fixers#ruff#Fix',
|
||||
@@ -25,6 +26,11 @@ function! ale_linters#python#ruff#GetExecutable(buffer) abort
|
||||
return 'poetry'
|
||||
endif
|
||||
|
||||
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_ruff_auto_uv'))
|
||||
\ && ale#python#UvPresent(a:buffer)
|
||||
return 'uv'
|
||||
endif
|
||||
|
||||
return ale#python#FindExecutable(a:buffer, 'python_ruff', ['ruff'])
|
||||
endfunction
|
||||
|
||||
@@ -41,28 +47,45 @@ endfunction
|
||||
|
||||
function! ale_linters#python#ruff#GetCommand(buffer, version) abort
|
||||
let l:executable = ale_linters#python#ruff#GetExecutable(a:buffer)
|
||||
let l:exec_args = l:executable =~? 'pipenv\|poetry$'
|
||||
let l:exec_args = l:executable =~? '\(pipenv\|poetry\|uv\)$'
|
||||
\ ? ' run ruff'
|
||||
\ : ''
|
||||
|
||||
" NOTE: ruff version `0.0.69` supports liniting input from stdin
|
||||
return ale#Escape(l:executable) . l:exec_args
|
||||
" NOTE: ruff 0.3.0 deprecates `ruff <path>` in favor of `ruff check <path>`
|
||||
let l:exec_args = l:exec_args
|
||||
\ . (ale#semver#GTE(a:version, [0, 3, 0]) ? ' check' : '')
|
||||
|
||||
" NOTE: ruff version `0.0.69` supports linting input from stdin
|
||||
" NOTE: ruff version `0.1.0` deprecates `--format text`
|
||||
return ale#Escape(l:executable) . l:exec_args . ' -q'
|
||||
\ . ' --no-fix'
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'python_ruff_options'))
|
||||
\ . ' --format text'
|
||||
\ . (ale#semver#GTE(a:version, [0, 0, 69]) ? ' -' : ' %s')
|
||||
\ . (ale#semver#GTE(a:version, [0, 1, 0]) ? ' --output-format json-lines' : ' --format json-lines')
|
||||
\ . (ale#semver#GTE(a:version, [0, 0, 69]) ? ' --stdin-filename %s -' : ' %s')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#python#ruff#Handle(buffer, lines) abort
|
||||
"Example: path/to/file.py:10:5: E999 SyntaxError: unexpected indent
|
||||
let l:pattern = '\v^[a-zA-Z]?:?[^:]+:(\d+):(\d+)?:? (.+)$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[1] + 0,
|
||||
\ 'col': l:match[2] + 0,
|
||||
\ 'text': l:match[3],
|
||||
\})
|
||||
" Read all lines of ruff output and parse use all the valid JSONL lines.
|
||||
for l:line in a:lines
|
||||
try
|
||||
let l:item = json_decode(l:line)
|
||||
catch
|
||||
let l:item = v:null
|
||||
endtry
|
||||
|
||||
if !empty(l:item)
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:item.location.row,
|
||||
\ 'col': l:item.location.column,
|
||||
\ 'end_lnum': l:item.end_location.row,
|
||||
\ 'end_col': l:item.end_location.column - 1,
|
||||
\ 'code': l:item.code,
|
||||
\ 'text': l:item.message,
|
||||
\ 'type': l:item.code =~? '\vE\d+' ? 'E' : 'W',
|
||||
\})
|
||||
endif
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
|
||||
@@ -5,6 +5,7 @@ call ale#Set('python_unimport_options', '')
|
||||
call ale#Set('python_unimport_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
call ale#Set('python_unimport_auto_pipenv', 0)
|
||||
call ale#Set('python_unimport_auto_poetry', 0)
|
||||
call ale#Set('python_unimport_auto_uv', 0)
|
||||
|
||||
function! ale_linters#python#unimport#GetExecutable(buffer) abort
|
||||
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_unimport_auto_pipenv'))
|
||||
@@ -17,12 +18,17 @@ function! ale_linters#python#unimport#GetExecutable(buffer) abort
|
||||
return 'poetry'
|
||||
endif
|
||||
|
||||
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_unimport_auto_uv'))
|
||||
\ && ale#python#UvPresent(a:buffer)
|
||||
return 'uv'
|
||||
endif
|
||||
|
||||
return ale#python#FindExecutable(a:buffer, 'python_unimport', ['unimport'])
|
||||
endfunction
|
||||
|
||||
function! ale_linters#python#unimport#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#python#unimport#GetExecutable(a:buffer)
|
||||
let l:exec_args = l:executable =~? 'pipenv\|poetry$'
|
||||
let l:exec_args = l:executable =~? '\(pipenv\|poetry\|uv\)$'
|
||||
\ ? ' run unimport'
|
||||
\ : ''
|
||||
|
||||
|
||||
@@ -5,6 +5,9 @@ call ale#Set('python_vulture_executable', 'vulture')
|
||||
call ale#Set('python_vulture_options', '')
|
||||
call ale#Set('python_vulture_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
call ale#Set('python_vulture_change_directory', 1)
|
||||
call ale#Set('python_vulture_auto_pipenv', 0)
|
||||
call ale#Set('python_vulture_auto_poetry', 0)
|
||||
call ale#Set('python_vulture_auto_uv', 0)
|
||||
|
||||
" The directory to change to before running vulture
|
||||
function! s:GetDir(buffer) abort
|
||||
@@ -16,6 +19,21 @@ function! s:GetDir(buffer) abort
|
||||
endfunction
|
||||
|
||||
function! ale_linters#python#vulture#GetExecutable(buffer) abort
|
||||
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_vulture_auto_pipenv'))
|
||||
\ && ale#python#PipenvPresent(a:buffer)
|
||||
return 'pipenv'
|
||||
endif
|
||||
|
||||
if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_vulture_auto_poetry'))
|
||||
\ && ale#python#PoetryPresent(a:buffer)
|
||||
return 'poetry'
|
||||
endif
|
||||
|
||||
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_vulture_auto_uv'))
|
||||
\ && ale#python#UvPresent(a:buffer)
|
||||
return 'uv'
|
||||
endif
|
||||
|
||||
return ale#python#FindExecutable(a:buffer, 'python_vulture', ['vulture'])
|
||||
endfunction
|
||||
|
||||
@@ -29,7 +47,7 @@ endfunction
|
||||
|
||||
function! ale_linters#python#vulture#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#python#vulture#GetExecutable(a:buffer)
|
||||
let l:exec_args = l:executable =~? 'pipenv\|poetry$'
|
||||
let l:exec_args = l:executable =~? '\(pipenv\|poetry\|uv\)$'
|
||||
\ ? ' run vulture'
|
||||
\ : ''
|
||||
let l:lint_dest = ale#Var(a:buffer, 'python_vulture_change_directory')
|
||||
|
||||
@@ -19,6 +19,7 @@ endfunction
|
||||
|
||||
call ale#linter#Define('r', {
|
||||
\ 'name': 'languageserver',
|
||||
\ 'aliases': ['r_language_server'],
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'lsp_config': {b -> ale#Var(b, 'r_languageserver_config')},
|
||||
\ 'executable': 'Rscript',
|
||||
|
||||
@@ -15,6 +15,7 @@ endfunction
|
||||
|
||||
call ale#linter#Define('reason', {
|
||||
\ 'name': 'reason-language-server',
|
||||
\ 'aliases': ['reason_ls'],
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': {buffer -> ale#Var(buffer, 'reason_ls_executable')},
|
||||
\ 'command': '%e',
|
||||
|
||||
@@ -6,6 +6,7 @@ call ale#Set('reason_ols_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
|
||||
call ale#linter#Define('reason', {
|
||||
\ 'name': 'ols',
|
||||
\ 'aliases': ['ocaml-language-server'],
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': function('ale#handlers#ols#GetExecutable'),
|
||||
\ 'command': function('ale#handlers#ols#GetCommand'),
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user