Compare commits

...

363 Commits

Author SHA1 Message Date
w0rp
e1c8d665d6 #3600 Implement pull model with Neovim Client
Implement the diagnostics pull model with the LSP Neovim client. We
must handle messages a little different and tweak client capabilities
for pull diagnostics to work through the Neovim client.
2025-03-23 16:08:18 +00:00
w0rp
fe50a711cb Close #3600 - Implement pull diagnostics in VimL
Implement pull diagnostics in the VimL implementation so ALE is able
to track when servers are busy checking files. Only servers that
support this feature will return diagnostics these ways.
2025-03-23 16:07:46 +00:00
w0rp
19e1b5a9d3 Implement ale.queue for calling ale#Queue in Lua 2025-03-22 01:10:11 +00:00
w0rp
33a902f489 Implement ale.pad in Lua 2025-03-22 00:43:29 +00:00
w0rp
a1c57918ef Implement ale.get_filename_mappings in Lua 2025-03-22 00:35:53 +00:00
w0rp
1aae83497d Add ale.has to mirror ale#Has in Lua 2025-03-22 00:04:46 +00:00
w0rp
f4af0dc84b Add basic Lua ALE functions and test coverage
Ensure that basic ALE functions `ale.var`, `ale.escape`, and `ale.env`
are available in Lua. Cover all Lua code so far with busted tests,
fixing bugs where ALE variables can be set with Boolean values instead
of numbers. Document all functionality so far.
2025-03-21 23:37:35 +00:00
w0rp
7f43666fb3 Detect the Lua project root using .luarc.json 2025-03-21 12:07:10 +00:00
w0rp
bcd1a12949 Implement Lua ALE setup & overhaul documentation
1. Add ale.setup and ale.setup.buffer for pure Lua configuration.
2. Update many global settings to use Booleans instead of numbers to
   make types easiert to work with in Lua.
3. Radically reformat documentation and fix errors to make
   documentation more usable for Neovim users.
2025-03-20 21:52:13 +00:00
w0rp
53f036fe9f Support g:ale_shell with the Neovim LSP client 2025-03-20 21:45:19 +00:00
w0rp
3dfebe45c6 Add Neovim TCP connections to language servers
Support TCP connections to language servers through Neovim's built in
client. In all but what is currently the nightly builds of Neovim
connections via a hostname will fail, but connections via an IP address
should function. We will still enable the built in Neovim client by
default anyway, as LSP clients very rarely connect over TCP.
2025-03-20 21:45:19 +00:00
w0rp
964e0a2e39 Supply language_id values to Neovim LSP API
Change logic so ALE's LSP implementation and the Neovim LSP client
retrieve the language_id for language clients at roughly the same time
via the same means. This makes ALE inform the language server what the
language for the language is for clients.
2025-03-20 21:45:19 +00:00
w0rp
ee975196ff Fix tests for Neovim LSP integration 2025-03-20 21:45:19 +00:00
w0rp
3f7ea86ae1 Update documentation for Neovim LSP integration
Update documentation to advertise ALE's integration with Neovim's native
LSP client, and explain how functionality is integrated with ALE,
Neovim's native tools, and other plugins.
2025-03-20 21:45:18 +00:00
w0rp
dd8d7cb4b4 Clean up message handling for LSP integration
Now we ought to be able to handle any kind of response for any request
we send, clean up message handling so there are fewer changes to make
to LSP code to adjust for Neovim integration.
2025-03-20 21:45:18 +00:00
w0rp
8216ee4a65 Handle other LSP capabilities via ALE
Save capabilities from language servers ALE connects to via Neovim's LSP
client and handle responses to requests ALE sends to language servers.
This enables ALE to work with Neovim's language client for its commands
while also letting users directly use the connected clients for native
Neovim keybinds and so on.
2025-03-20 21:45:18 +00:00
w0rp
9a251b2865 Remove the log_level line from Lua code 2025-03-20 21:45:18 +00:00
w0rp
61a1fcc92f Handle Neovim LSP diagnostics via ALE's functions 2025-03-20 21:45:18 +00:00
w0rp
c9eb8f9d15 Start up language servers with Neovim's API
Get language servers starting and displaying diagnostics with Neovim's
API in Neovim 0.8 and up. With this set up, now ALE needs to take over
handling diagnostics returned by the language servers.
2025-03-20 21:45:18 +00:00
Horacio Sanson
7fcc0548b0 (feat) add support for kulala_fmt fixer (#4925)
Some checks failed
CI / build_image (push) Has been cancelled
CI / test_ale (--linters-only) (push) Has been cancelled
CI / test_ale (--neovim-07-only) (push) Has been cancelled
CI / test_ale (--neovim-08-only) (push) Has been cancelled
CI / test_ale (--vim-80-only) (push) Has been cancelled
CI / test_ale (--vim-90-only) (push) Has been cancelled
* (feat) add support for kulala_fmt fixer

Co-authored-by: w0rp <w0rp@users.noreply.github.com>
2025-03-18 12:40:52 +00:00
w0rp
9ce2c29df1 Simplfiy zlint configuration and tests 2025-03-18 12:33:58 +00:00
Enrique Miguel Mora Meza
59c996c5b8 Support for Zlint as Zig linter (#4923)
* feat: Add Zig zlint linter and handler for ALE
* docs: Add zlint documentation to ALE Zig integration guide
* docs: Updating docs for zlint support
* tests: Adding tests for checking zlint executable and command
* refactor: Move zlint configuration test to separate test file
2025-03-18 12:30:05 +00:00
w0rp
c4cedeea3f Remove unreliable yls test for now 2025-03-18 11:57:49 +00:00
w0rp
f3b6269388 Make yls tests work better locally 2025-03-18 11:38:47 +00:00
Adrian Vollmer
47f1f49655 Add linting support for all formats supported by djlint (#4920)
Some checks are pending
CI / build_image (push) Waiting to run
CI / test_ale (--linters-only) (push) Blocked by required conditions
CI / test_ale (--neovim-07-only) (push) Blocked by required conditions
CI / test_ale (--neovim-08-only) (push) Blocked by required conditions
CI / test_ale (--vim-80-only) (push) Blocked by required conditions
CI / test_ale (--vim-90-only) (push) Blocked by required conditions
* Refactor djlint linter code

This patch moves the code to the `autoload` directory, so it's available
when it's needed by a specific linter. This avoids redundant code when
another format supported by djlint is added.

* Add linting support for all formats supported by djlint

So far, the `djlint` linter in ALE only supported `html`, which is only
one of several file types supported by `djlint`.

This patch adds support for the following file types:

* gohtmltmpl
* handlebars
* htmlangular
* htmldjango
* jinja
* nunjucks

* Add djlint fixer for various HTML template formats

* Supported formats:
    - html
    - htmlangular
    - htmldjango
    - jinja
    - handlebars
    - nunjucks
    - gohtmltmpl

* Add doc entries

* Add vader tests

---------

Co-authored-by: Adrian Vollmer <computerfluesterer@protonmail.com>
2025-03-18 07:56:32 +09:00
Adrian Vollmer
fe6a91fb92 Add the typstyle formatter as a fixer for Typst (#4927)
Some checks are pending
CI / build_image (push) Waiting to run
CI / test_ale (--linters-only) (push) Blocked by required conditions
CI / test_ale (--neovim-07-only) (push) Blocked by required conditions
CI / test_ale (--neovim-08-only) (push) Blocked by required conditions
CI / test_ale (--vim-80-only) (push) Blocked by required conditions
CI / test_ale (--vim-90-only) (push) Blocked by required conditions
Co-authored-by: Adrian Vollmer <computerfluesterer@protonmail.com>
2025-03-17 21:10:24 +09:00
K4YT3X
995d78435a fix(golangci-lint): incorrect filename concat preventing errors from being displayed (#4926)
Some checks failed
CI / build_image (push) Has been cancelled
CI / test_ale (--linters-only) (push) Has been cancelled
CI / test_ale (--neovim-07-only) (push) Has been cancelled
CI / test_ale (--neovim-08-only) (push) Has been cancelled
CI / test_ale (--vim-80-only) (push) Has been cancelled
CI / test_ale (--vim-90-only) (push) Has been cancelled
Signed-off-by: k4yt3x <i@k4yt3x.com>
2025-03-16 09:56:27 +09:00
w0rp
1c91102112 Bump the ALE version to 4.0.0
Some checks failed
CI / build_image (push) Has been cancelled
CI / test_ale (--linters-only) (push) Has been cancelled
CI / test_ale (--neovim-07-only) (push) Has been cancelled
CI / test_ale (--neovim-08-only) (push) Has been cancelled
CI / test_ale (--vim-80-only) (push) Has been cancelled
CI / test_ale (--vim-90-only) (push) Has been cancelled
2025-03-14 11:58:10 +00:00
w0rp
8506d0d1ae Fix the ftplugin for ALEInfo in Vim 8.0
Some checks are pending
CI / build_image (push) Waiting to run
CI / test_ale (--linters-only) (push) Blocked by required conditions
CI / test_ale (--neovim-07-only) (push) Blocked by required conditions
CI / test_ale (--neovim-08-only) (push) Blocked by required conditions
CI / test_ale (--vim-80-only) (push) Blocked by required conditions
CI / test_ale (--vim-90-only) (push) Blocked by required conditions
2025-03-14 09:40:08 +00:00
w0rp
15bf26632c Close #4618 - Do not show info for the ALEInfo window 2025-03-14 09:19:41 +00:00
Simon Lundström
1acd964a2b Fix docs for variable names (#4922)
Some checks failed
CI / build_image (push) Has been cancelled
CI / test_ale (--linters-only) (push) Has been cancelled
CI / test_ale (--neovim-07-only) (push) Has been cancelled
CI / test_ale (--neovim-08-only) (push) Has been cancelled
CI / test_ale (--vim-80-only) (push) Has been cancelled
CI / test_ale (--vim-90-only) (push) Has been cancelled
2025-03-12 17:43:46 +00:00
Braden Kelley
07b0496f6d Run opacheck on entire dir for more context (#4531)
Some checks are pending
CI / build_image (push) Waiting to run
CI / test_ale (--linters-only) (push) Blocked by required conditions
CI / test_ale (--neovim-07-only) (push) Blocked by required conditions
CI / test_ale (--neovim-08-only) (push) Blocked by required conditions
CI / test_ale (--vim-80-only) (push) Blocked by required conditions
CI / test_ale (--vim-90-only) (push) Blocked by required conditions
Running `opa check` on a single file can report errors that might not
exist when considering other files in the same directory
2025-03-11 20:05:06 +00:00
JINNOUCHI Yasushi
61191dd4bf feat: remove logic for unsupported older Neovim (#4921)
See #4872

Now we no longer support Neovim 0.6 or older, we can remove logic in Lua code for supporting it.
2025-03-11 19:57:38 +00:00
JINNOUCHI Yasushi
e4a2bff0f2 Consider the original config for signs in Neovim (#4872)
Some checks are pending
CI / build_image (push) Waiting to run
CI / test_ale (--linters-only) (push) Blocked by required conditions
CI / test_ale (--neovim-07-only) (push) Blocked by required conditions
CI / test_ale (--neovim-08-only) (push) Blocked by required conditions
CI / test_ale (--vim-80-only) (push) Blocked by required conditions
CI / test_ale (--vim-90-only) (push) Blocked by required conditions
Preserve a user-configured sign priority in Neovim if set, and use the ALE setting if not configured otherwise.
2025-03-11 13:14:21 +00:00
w0rp
a49943aa62 Update GitHub Actions to test with Neovim 0.7 2025-03-11 13:06:21 +00:00
w0rp
564369db58 Update the minimum supported Neovim version to 0.7 2025-03-11 13:04:52 +00:00
tony-o
92753662a7 Add scadformat fixer for OpenSCAD (#4808)
Add scadformat to ALE

---------

Co-authored-by: w0rp <w0rp@users.noreply.github.com>
2025-03-11 13:00:03 +00:00
Raph471
b26608681d Add pymarkdown for Markdown linting (#4906)
Add support for pymarkdown

Closes #4785
2025-03-11 12:31:31 +00:00
TcM1911
f0c8eb4fa8 Add Yara yls support (#4886)
This adds Yara support to ALE using Avast's language server for Yara:
https://avast.github.io/yls/

A ".git" folder is used to determine the project_root so this means the
Yara rules must be in a git repo for the integration to work.

The server only have 1 optional argument (-v, --verbose). Since this is
the case, no additional configuration options are available.

---------

Co-authored-by: w0rp <w0rp@users.noreply.github.com>
2025-03-11 12:18:29 +00:00
w0rp
0f71d4c494 Use ModeChanged events instead of InsertLeave emulation #4919 #4738
Some checks are pending
CI / build_image (push) Waiting to run
CI / test_ale (--linters-only) (push) Blocked by required conditions
CI / test_ale (--neovim-06-only) (push) Blocked by required conditions
CI / test_ale (--neovim-08-only) (push) Blocked by required conditions
CI / test_ale (--vim-80-only) (push) Blocked by required conditions
CI / test_ale (--vim-90-only) (push) Blocked by required conditions
`ModeChanged` looks like a more reliable way to detect an "exit insert mode" event and is a lot simpler (doesn't need a timer). Also, it can detect some other transitions like `\<C-o\>` in insert mode.
The `ModeChanged` event is available in:

* [Vim 8.2.3430](f1e8876fa2)
* [NeoVim 0.7.0](69bd1e4e36)

---------

Co-authored-by: Dmitry Zolotukhin <zlogic@gmail.com>
2025-03-10 21:28:20 +00:00
Vivian De Smedt
3611c32d60 Add support for the [djlinter](https://www.djlint.com/) (#4909)
Some checks failed
CI / build_image (push) Has been cancelled
CI / test_ale (--linters-only) (push) Has been cancelled
CI / test_ale (--neovim-06-only) (push) Has been cancelled
CI / test_ale (--neovim-08-only) (push) Has been cancelled
CI / test_ale (--vim-80-only) (push) Has been cancelled
CI / test_ale (--vim-90-only) (push) Has been cancelled
* Add support for the [djlinter](https://www.djlint.com/)

* Add documentation and tests.

* Fix the name of the variable for the executable name.

* Correct the name of the handler in the test.

* Correct the test adding the value of vcol.

* Format djlint.vim according to formatting rules.
2025-03-08 16:45:17 +09:00
Alexander Huynh
a6db6c95a6 more defensive coding: guard against a non-iterable loclist (#4912)
Sometimes `s:HandleExit` can execute a deferred linter callback, which
ends up setting the `l:loclist` that's passed into
`ale#engine#HandleLoclist` at the end of `s:HandleExit` to a dictionary.
This dictionary cannot be iterated over, and thus errors out.

Guard against trying to iterate over values that don't make sense.

Co-authored-by: Alexander Huynh <git@e.sc>
2025-03-08 16:44:43 +09:00
Horacio Sanson
7882fb9811 Fix 4913 - use JSON output for golangci-lint instead of regexps. (#4917)
Some checks are pending
CI / build_image (push) Waiting to run
CI / test_ale (--linters-only) (push) Blocked by required conditions
CI / test_ale (--neovim-06-only) (push) Blocked by required conditions
CI / test_ale (--neovim-08-only) (push) Blocked by required conditions
CI / test_ale (--vim-80-only) (push) Blocked by required conditions
CI / test_ale (--vim-90-only) (push) Blocked by required conditions
* Fix 4913 - use JSON output for golangci-lint instead of regexps.

* Check for empty array
2025-03-07 22:02:49 +09:00
Noah
e319d48941 Fixed the issue with Black ignoring config file to tell it which file is being processed. (#3406) (#4894)
Some checks failed
CI / build_image (push) Has been cancelled
CI / test_ale (--linters-only) (push) Has been cancelled
CI / test_ale (--neovim-06-only) (push) Has been cancelled
CI / test_ale (--neovim-08-only) (push) Has been cancelled
CI / test_ale (--vim-80-only) (push) Has been cancelled
CI / test_ale (--vim-90-only) (push) Has been cancelled
* Fixed the issue with Black ignoring files is being processed. (#3406)

Add test for stdin-filename on test/fixers/test_ruff_format_fixer_callback.vader

* Fixed the issue with Black ignoring files is being processed. (#3406)
Fixed the problem on Windows's tests.

* Fixed the issue with Black ignoring config file to tell it which file is being processed. Trailing whitespace removed
2025-02-24 11:36:56 +09:00
David Briscoe
d38a3f7739 Add fixer for json: python's json.tool (#4847)
Resolves #4314.

Add a fixer that's built into python for json formatting. Include a
couple arguments in docs to make these features more discoverable.

Uses stdin-based fixing so you don't need to save the file to fix.
2025-02-24 11:30:43 +09:00
Jim Keener
699c0dbe80 iverilog current file search path (#4907)
Some checks failed
CI / build_image (push) Has been cancelled
CI / test_ale (--linters-only) (push) Has been cancelled
CI / test_ale (--neovim-06-only) (push) Has been cancelled
CI / test_ale (--neovim-08-only) (push) Has been cancelled
CI / test_ale (--vim-80-only) (push) Has been cancelled
CI / test_ale (--vim-90-only) (push) Has been cancelled
In the vein of commit ea72d66b "Verilator current file search path (#3500)"

This includes the directory of the current file in the library
search path. From `man iverilog`:

           -ylibdir
               Append  the  directory  to the library module search
               path. When the compiler finds an undefined module, it
               looks in these directories for files with the right name.
2025-02-16 10:38:30 +09:00
Bogdan Gusiev
ce2b002c03 Add matched text to ALEFindReferences -quickfix for tsserver (#4898)
Some checks are pending
CI / build_image (push) Waiting to run
CI / test_ale (--linters-only) (push) Blocked by required conditions
CI / test_ale (--neovim-06-only) (push) Blocked by required conditions
CI / test_ale (--neovim-08-only) (push) Blocked by required conditions
CI / test_ale (--vim-80-only) (push) Blocked by required conditions
CI / test_ale (--vim-90-only) (push) Blocked by required conditions
* Add matched text to ALEFindReferences -quickfix for tsserver

* Update autoload/ale/references.vim
2025-02-16 10:16:01 +09:00
Takahito Nakano
e5d6d94f71 Fix cwd setting to use .stylua.toml if stylua.toml is not found (#4892)
Some checks failed
CI / build_image (push) Has been cancelled
CI / test_ale (--linters-only) (push) Has been cancelled
CI / test_ale (--neovim-06-only) (push) Has been cancelled
CI / test_ale (--neovim-08-only) (push) Has been cancelled
CI / test_ale (--vim-80-only) (push) Has been cancelled
CI / test_ale (--vim-90-only) (push) Has been cancelled
2025-02-07 18:19:05 +09:00
Kevin Quinn
62af9f2650 fix: memory-limit option for phpstan (#4900)
This might only be a problem for newer phpstan versions (2.1.1 here).

If you try to run `phpstan` the way ale will when it builds the option, you will get something like:

```
The "--memory-limit" option requires a value.
```

It wants you to use `--memory-limit=-1` instead.
2025-02-07 18:12:54 +09:00
dcai
305e1c2fb1 fix(biome): update biome fixer supports css and graphql (#4902)
Co-authored-by: dcai <dongsheng.cai@iag.com.au>
2025-02-07 17:48:58 +09:00
dcai
6c337ad19c fix: stylua should have cwd and --stdin-filepath (#4873)
Some checks failed
CI / build_image (push) Has been cancelled
CI / test_ale (--linters-only) (push) Has been cancelled
CI / test_ale (--neovim-06-only) (push) Has been cancelled
CI / test_ale (--neovim-08-only) (push) Has been cancelled
CI / test_ale (--vim-80-only) (push) Has been cancelled
CI / test_ale (--vim-90-only) (push) Has been cancelled
2025-01-10 13:35:30 +09:00
Vangelis
83ec182bdf xmllint fixer must read from stdin - not buffer filename (#4884)
The current xmllint fixer reads and formats the file that a buffer is
associated with from disk instead of accepting input from stdin. This
has the side effect that if the filename is changed in the buffer, but
not saved yet, the fixer discards all the pending changes and replaces
the buffer contents with the formatted text from the file contents on
disk.
2025-01-10 13:34:56 +09:00
konimarti
3ca2a9ea3c Add support for c3-lsp linter (#4836)
* Add support for c3-lsp linter

Add support for c3-lang with the c3-lsp language server.

Link: http://github.com/pherrymason/c3-lsp
Link: http://c3-lang.org

* fix linter error

* fix: consistent use of the executable name

Consistently use the executable name 'c3lsp' instead of the project name
'c3-lsp'.

* c3lsp: add command line arguments to executable
2025-01-10 13:34:29 +09:00
Dmitri Vereshchagin
0551602b19 Add erlfmt fixer to the registry and use it with stdin (#4868)
Some checks failed
CI / build_image (push) Has been cancelled
CI / test_ale (--linters-only) (push) Has been cancelled
CI / test_ale (--neovim-06-only) (push) Has been cancelled
CI / test_ale (--neovim-08-only) (push) Has been cancelled
CI / test_ale (--vim-80-only) (push) Has been cancelled
CI / test_ale (--vim-90-only) (push) Has been cancelled
* Add erlfmt fixer to the registry

Without this, the fixer will not appear in the list of suggested tools
and cannot be used without additional configuration.

* Handle stdin in the erlfmt fixer command

Previously, the full path to the file being edited was used, which
resulted in the loss of unsaved changes.

* Add executable selection tests for erlfmt fixer
2024-12-29 13:55:43 +09:00
Logan
c9df465148 Add podman to launch test (#4882)
Users can set the DOCKER environnement variable to select Docker or
Podman to run the tests.

Co-authored-by: L'HOSPITAL Logan <lhospitallogan@gmail.com>
2024-12-29 13:42:04 +09:00
Hugo
d69f8fed73 Implement support for apkbuild-fixer (#4881)
I am not the author of a single file, but have full permissions from the
original author for permission for submitting this to ALE under the
2-Clause BSD licence.

See: https://gitlab.alpinelinux.org/Leo/apkbuild.vim/-/issues/3
2024-12-29 13:37:33 +09:00
axhav
e82fd24943 Add yq support (#4861)
* Added jq support

Cleaned up yq.vim file

* Updated docs

* Updated supported-tools.md

* Added yq tests

* Fix python linting/formatting error when in virtual environment (#4865)

Python fixers and linters were failing when vim is running in a virtual
environment that's located in a path containing text `poetry`. The cause
of this was the regular expression `poetry\|pipenv\|uv$` which matches
`poetry` and `pipenv` if they appear anywhere in the virtualenv path.

* Add cljfmt fixer for clojure files (#4860)

* When using `actionlint` look for & use a config file (#4858)

Actionlint supports a config file and it lives in a very searchable
path, as the only files it acts on are in the `.github` directory
already.

Look for an `actionlint.yml` and `.yaml` in that path, and use the
config if its there.

* Fix linting with jq (#4765) (#4862)

With the 1.6 version of jq the error message start with "parse error".
With the last version of jq the error message start with "jq: parse error".
Fix it by using a regular expression that works in both cases.

* Properly handle optional end_line_no/end_line_pos in sqlfluff (#4867)

end_line_no/end_line_pos are optional. Example SQL:
`SELECT NULL FROM {{ a_jinja_templated_table }};`

`sqlfluff lint --dialect ansi --format json` gives the following error
among others:
```
{"start_line_no": 1, "start_line_pos": 21, "code": "TMP", "description":
"Undefined jinja template variable: 'a_jinja_templated_table'", "name":
"", "warning": false}
```

As one can see there is no end_line_no/end_line_pos.

* Add golangci-lint fixer (#4853)

Closes #4616

* Fixed copy-paste misstakes and added filter to docs

* Added test vader file for yq

* Fixed and updated the test case

---------

Co-authored-by: Walter Kaunda <14844142+kwalter94@users.noreply.github.com>
Co-authored-by: rudolf ordoyne <49649789+casens5@users.noreply.github.com>
Co-authored-by: Bea Hughes <108035665+beahues@users.noreply.github.com>
Co-authored-by: benjos1234 <legrimlvl24@gmail.com>
Co-authored-by: Coacher <Coacher@users.noreply.github.com>
Co-authored-by: Ian Stapleton Cordasco <graffatcolmingov@gmail.com>
2024-12-29 13:36:18 +09:00
Robert Muir
5b2e69ae61 fix ale_python_auto_virtualenv to correctly set virtualenv env vars (#4885)
* fix ale_python_auto_virtualenv to correctly set virtualenv env vars

According to the documentation, `ale_python_auto_virtualenv` should automatically set environment variables for commands, but previously the variables were not set completely or correctly.

Before:
  `PATH` variable was expanded to include `/path/to/venv`
After:
  `PATH` variable is expanded to include `/path/to/venv/bin`
  `VIRTUAL_ENV` variable is set to `path/to/venv`

This mimics exactly what the `activate` scripts do, and allows the configuration knob to work as expected.

For example, after this change, `jedi-language-server` can be installed globally (instead of inside every venv), and it will "just work" (e.g. find references to dependencies in the venv) when editing a file in a project that uses a venv, because the correct variables are set.

* fix test_python_virtualenv.vader test to expect output with both virtualenv vars

* remove unnecessary non-escape in test_python_virtualenv.vader

* fix accidentally removed space in windows test_python_virtualenv.vader
2024-12-29 13:35:28 +09:00
Benjamin Bannier
6e4f01f6d1 Surface warnings from Zeek linter (#4883)
In addition to errors Zeek's parsing can also expose warning messages,
e.g., for the following code

```zeek
event http_stats(c: connection, stats: http_stats_rec) {
    c$removal_hooks;
}
```

a warning is emitted

```
warning in /tmp/foo.zeek, line 2: expression value ignored (c$removal_hooks)
```

This patch adds parsing and propagation of these warning messages.
2024-12-29 13:07:00 +09:00
Ian Stapleton Cordasco
65b49c1b81 Add golangci-lint fixer (#4853)
Some checks failed
CI / build_image (push) Has been cancelled
CI / test_ale (--linters-only) (push) Has been cancelled
CI / test_ale (--neovim-06-only) (push) Has been cancelled
CI / test_ale (--neovim-08-only) (push) Has been cancelled
CI / test_ale (--vim-80-only) (push) Has been cancelled
CI / test_ale (--vim-90-only) (push) Has been cancelled
Closes #4616
2024-11-27 22:17:31 +09:00
Coacher
0ef2c455ee Properly handle optional end_line_no/end_line_pos in sqlfluff (#4867)
end_line_no/end_line_pos are optional. Example SQL:
`SELECT NULL FROM {{ a_jinja_templated_table }};`

`sqlfluff lint --dialect ansi --format json` gives the following error
among others:
```
{"start_line_no": 1, "start_line_pos": 21, "code": "TMP", "description":
"Undefined jinja template variable: 'a_jinja_templated_table'", "name":
"", "warning": false}
```

As one can see there is no end_line_no/end_line_pos.
2024-11-27 22:17:02 +09:00
benjos1234
9d30fb2f59 Fix linting with jq (#4765) (#4862)
Some checks failed
CI / build_image (push) Has been cancelled
CI / test_ale (--linters-only) (push) Has been cancelled
CI / test_ale (--neovim-06-only) (push) Has been cancelled
CI / test_ale (--neovim-08-only) (push) Has been cancelled
CI / test_ale (--vim-80-only) (push) Has been cancelled
CI / test_ale (--vim-90-only) (push) Has been cancelled
With the 1.6 version of jq the error message start with "parse error".
With the last version of jq the error message start with "jq: parse error".
Fix it by using a regular expression that works in both cases.
2024-11-23 18:42:22 +09:00
Bea Hughes
1e1604be56 When using actionlint look for & use a config file (#4858)
Some checks failed
CI / build_image (push) Has been cancelled
CI / test_ale (--linters-only) (push) Has been cancelled
CI / test_ale (--neovim-06-only) (push) Has been cancelled
CI / test_ale (--neovim-08-only) (push) Has been cancelled
CI / test_ale (--vim-80-only) (push) Has been cancelled
CI / test_ale (--vim-90-only) (push) Has been cancelled
Actionlint supports a config file and it lives in a very searchable
path, as the only files it acts on are in the `.github` directory
already.

Look for an `actionlint.yml` and `.yaml` in that path, and use the
config if its there.
2024-11-19 11:40:56 +09:00
rudolf ordoyne
defb0ea336 Add cljfmt fixer for clojure files (#4860)
Some checks failed
CI / build_image (push) Has been cancelled
CI / test_ale (--linters-only) (push) Has been cancelled
CI / test_ale (--neovim-06-only) (push) Has been cancelled
CI / test_ale (--neovim-08-only) (push) Has been cancelled
CI / test_ale (--vim-80-only) (push) Has been cancelled
CI / test_ale (--vim-90-only) (push) Has been cancelled
2024-11-17 11:22:36 +09:00
Walter Kaunda
5cc6b933b1 Fix python linting/formatting error when in virtual environment (#4865)
Python fixers and linters were failing when vim is running in a virtual
environment that's located in a path containing text `poetry`. The cause
of this was the regular expression `poetry\|pipenv\|uv$` which matches
`poetry` and `pipenv` if they appear anywhere in the virtualenv path.
2024-11-17 11:00:55 +09:00
Dmitri Vereshchagin
898638abe5 Add erlang-ls as an alias for erlang_ls linter (#4852)
Some checks failed
CI / build_image (push) Has been cancelled
CI / test_ale (--linters-only) (push) Has been cancelled
CI / test_ale (--neovim-06-only) (push) Has been cancelled
CI / test_ale (--neovim-08-only) (push) Has been cancelled
CI / test_ale (--vim-80-only) (push) Has been cancelled
CI / test_ale (--vim-90-only) (push) Has been cancelled
The project itself is often referred to as Erlang LS, so erlang-ls would
be a suitable alias.
2024-11-09 15:51:54 +09:00
Dmitri Vereshchagin
4fca3824cc Add erlang-mode fixer for Erlang files (#4848)
Some checks failed
CI / build_image (push) Has been cancelled
CI / test_ale (--linters-only) (push) Has been cancelled
CI / test_ale (--neovim-06-only) (push) Has been cancelled
CI / test_ale (--neovim-08-only) (push) Has been cancelled
CI / test_ale (--vim-80-only) (push) Has been cancelled
CI / test_ale (--vim-90-only) (push) Has been cancelled
This fixer performs indentation with the Erlang mode for Emacs.
The Erlang mode is maintained in the Erlang/OTP source tree.  It indents
some things differently than the Vim indent plugin, and provides more
customization options.
2024-10-31 21:29:59 +09:00
Dmitri Vereshchagin
d82d968f8a Set two-space indent for *.vader in .editorconfig (#4849)
Will be useful for those who use an EditorConfig plugin.
2024-10-31 21:28:44 +09:00
Krishnansh Agarwal
9854e19fa9 Update metals.vim (#4843)
Some checks failed
CI / build_image (push) Has been cancelled
CI / test_ale (--linters-only) (push) Has been cancelled
CI / test_ale (--neovim-06-only) (push) Has been cancelled
CI / test_ale (--neovim-08-only) (push) Has been cancelled
CI / test_ale (--vim-80-only) (push) Has been cancelled
CI / test_ale (--vim-90-only) (push) Has been cancelled
The binary installed by `cs install metals` is called `metals`, not `metals-vim`

Please fix this !
2024-10-20 00:19:18 +09:00
Friedrich C. Kischkel
02eb9984b1 Make documentation more consistent with Vim's own :help (#4840)
* Prefix user-defined commands with colons

This is consistent with Vim's own :help pages.

* Remove dot hack

Now that we have `:ALEInfo` and `ALEInfo`, we don't need `ALEInfo.` any
more to disambiguate them.

* Use colons in references

* Use angle brackets for command arguments

* Use `:Command` for command references

* Use a non-command reference for tsserver

* Prefix highlight references with hl-

* Fix some references into Vim's own :help

E.g. location-list or +features

* Misc hotlink improvements

* Undo previous changes to tsserver

Just leave it in backticks - even though I don't like it.

* Use bars for a command for consistency

* Append hotlinks to hl-groups

Remove minuses to make tables look more like in Vim's own :help

* Prefix features with +

* Provide full hotlink to ale.txt

* Fix double pipe typo

* Capitalize Error highlight

There seems to be no hotlink in Vim's own documentation for this.
I would have expected *hl-Error* - no such thing :-(

* Right align tags to col 79
2024-10-20 00:18:24 +09:00
David Briscoe
0b4c665840 Return floating_preview window id (#4828)
Make ale#floating_preview#Show more similar to popup_create and return
the id of the window so it's easy to set the filetype of the resulting
buffer.

Update test stub version of Show() to return a win id (the current window
since it's not actually creating a window).

Test
* both tests still pass
2024-10-20 00:13:50 +09:00
Markus
2e5f135836 no need to write and read temporary file with syntax_tree (#4834)
Some checks failed
CI / build_image (push) Has been cancelled
CI / test_ale (--linters-only) (push) Has been cancelled
CI / test_ale (--neovim-06-only) (push) Has been cancelled
CI / test_ale (--neovim-08-only) (push) Has been cancelled
CI / test_ale (--vim-80-only) (push) Has been cancelled
CI / test_ale (--vim-90-only) (push) Has been cancelled
2024-10-14 11:45:41 +09:00
Diego Henrique Oliveira
a7ef1817b7 Improve support for python package manage: pipenv, poetry and uv (#4825)
Some checks failed
CI / build_image (push) Has been cancelled
CI / test_ale (--linters-only) (push) Has been cancelled
CI / test_ale (--neovim-06-only) (push) Has been cancelled
CI / test_ale (--neovim-08-only) (push) Has been cancelled
CI / test_ale (--vim-80-only) (push) Has been cancelled
CI / test_ale (--vim-90-only) (push) Has been cancelled
2024-09-05 15:37:30 +09:00
ghsang
954682108d Add support for astro (#4780)
Some checks failed
CI / build_image (push) Has been cancelled
CI / test_ale (--linters-only) (push) Has been cancelled
CI / test_ale (--neovim-06-only) (push) Has been cancelled
CI / test_ale (--neovim-08-only) (push) Has been cancelled
CI / test_ale (--vim-80-only) (push) Has been cancelled
CI / test_ale (--vim-90-only) (push) Has been cancelled
* feat: prettier for astro
* feat: eslint for astro
* feat: doc for astro
2024-08-14 08:24:22 +01:00
Dmitri Vereshchagin
48d73c87c3 Refactor SyntaxErl linter file (#4807) 2024-07-12 09:40:38 +09:00
Braden Kelley
5c635d5038 feat(biome): add support for json and jsonc (#4805)
- adds biome linter for json and jsonc
- enables biome by default for json and jsonc
- suggests biome as a fixer for json and jsonc
2024-07-09 09:41:17 +09:00
w0rp
3220b94d20 Fix #4714 - Handle ruff garbage
When ruff outputs errors are invalid JSON text, handle that and stop ALE
from throwing exceptions.
2024-07-08 03:22:46 +01:00
Tom Bourton
a35fa4d732 When ruff version is >=0.5.0 use 'ruff check <path>' instead of 'ruff <path>' (#4802) 2024-07-02 16:43:02 +09:00
Braden Kelley
a0ad5f938a fix!(biome): allow passing options to biome check (#4799)
The only option available to biome's `lsp-proxy` command used for
linting is `--config-path`. However, we are using ALE to find and set
the project root, and have a way to manually override, so that is no
longer necessary.

The LSP proxy also used the `g:ale_biome_options` config, which is
shared with the fixer's `check` command, but `lsp-proxy` will throw an
error if unknown options are included, making it so that option is only
useful to set the project root.

BREAKING CHANGE: We are no longer passing options to the biome LSP
proxy, but we can still set the project root with
`g:ale_biome_lsp_project_root`.
2024-06-27 14:30:06 +09:00
Braden Kelley
ed0b036220 fix(biome): find root when using biome.jsonc (#4774)
Since biome supports either `biome.json` or `biome.jsonc` config files,
we need to look for both when searching for the LSP project root. We can
also look for a package.json or .git folder to use. This uses mostly the
same logic as deno.
2024-06-25 17:18:28 +09:00
Loic Nageleisen
e09520e2d7 Add Ruby linter with Steep (#4671)
* Add Ruby linter with Steep

Fixes #3254

* Run steep instead of using language server

LSP presents a few issues and this works around those.

* Work around Steep path issue

See https://github.com/soutaro/steep/pull/975

* Add simple tests for steep

* Add steep to supported tools

* Pass linter

* Add a comment regarding Steep's column counting

* Make lnum an integer

* Add Steep handler test

* Fix separator for Windows

* Escape Windows path separators for substitute()

* Use ALEInfo (I) group

* Use fnameescape instead of quotes

* Skip linting for files not under steep root

* Add and pass tests covering proper steep root lookup

* Fix separator discrepancy

* Use strict operators (match case)

* Fix ordering

* Use `is#` instead of `==#`
2024-06-25 17:17:27 +09:00
Alexey Vazhnov
f4bc3c2711 README.md: fix typo: there should be a comma (#4797) 2024-06-24 06:34:34 +01:00
Braden Kelley
5606606b32 fix(biome): send correct language to lsp proxy (#4773)
Since Biome understands `typescriptreact` and `javascriptreact` as
languages, we can send the `filetype` to the LSP, rather than only
sending `typescript` for both `ts` and `tsx` files, or `javascript` for
`js` and `jsx` files.

fixes: #4752
2024-06-24 06:32:24 +01:00
Braden Kelley
f2aef2f510 fix(biome): run all enabled biome fixers (#4763)
- based on biome config, will format, lint, and/or sort imports
- adds variable to apply unsafe fixes, disabled by default

fixes: #4754
2024-06-21 09:21:19 +09:00
Braden Kelley
0cd64c87bf fix(biome): use temp file instead of stdin (#4775)
biome handles utf8 characters differently between files and stdin, and
in some cases can replace emojis with ascii characters when using stdin

refs: biomejs/biome#2604
2024-06-21 08:19:55 +09:00
w0rp
c7c41e1574 Run actionlint by default on GitHub files
Detect paths containing .github as a directory for running actionlint
by default on YAML filetypes.
2024-06-02 19:07:06 +01:00
ghsang
adaa7f6f62 Fix eslint cwd strategy (#4781)
Change eslint cwd to follow configuration file paths.
2024-05-31 09:30:37 +02:00
Macuyler Dunn
c88bddfa83 Update dart analysis_server command (#4761)
* Update dart analysis_server command

In 2021 the dart team added a new sub-command `language-server` to
replace the original `./snapshots/analysis_server.dart.snapshot --lsp`
convention for starting the language server.

c224cc2e0d

* Add ale_dart_analysis_server_enable_language_server option

This allows users to opt-in to the new `dart language-server` command.

* Enable ale_dart_analysis_server_enable_language_server option by default

* Update doc/ale-dart.txt

Include the dart version number where the `dart language-server` command
was added.
2024-05-09 10:58:16 +09:00
Bryan Garber
70eeae54fb Implement listing all returned results for LSP textDocument/implements (#4755)
* Fix list of definitions
* Fix when LSP returns single response on definition/implementation
* Update tag stack on ShowSelection
2024-05-01 11:58:06 +01:00
Yining
d19b238aa2 fix: force --no-fix when ruff used as a linter (#4759)
this commit is to fix #4756 which suggests to force disable applying
fixes when linting, particularly when `fix = true` was set in project
`pyproject.toml` file.

The flag `--no-fix` was added without checking the version of `ruff` at
this moment as it seems to be available in a quite early version.
2024-04-26 18:29:17 +09:00
Mathew Attlee
adee52fba0 feat: detect ESLint flat config (#4753) 2024-04-20 19:14:48 +01:00
Arash Mousavi
7516e2e484 Add htmlbeautifier support (#4751) 2024-04-17 23:58:28 +09:00
Kevin Van Leer
6db58b3379 Added fix subcommand options (#4746)
php-cs-fixer command line options are ordered. Options that appear after the
main command are applied to the main command. Options that appear after the
subcommands are applied to the subcommands. This change enables a user to
specific fix options (like --config). This change also sets the plugin to
find the the configuraiton file in the current project tree. This matches
the default behavior of other linters like eslint.
2024-04-07 17:34:02 +09:00
Chayoung You
b6b9612691 Make cmake-lint read .cmake-format config file (#4747) 2024-04-07 10:32:19 +09:00
elig0n
6c10a519f1 Fix typos (#4745) 2024-03-20 17:06:33 +09:00
Shad
712b4b3a97 Add support for sqlfluff 3.0.0 (#4743)
As stated in the changelog:
"the original fields of line_pos and line_no have been renamed to start_line_pos and start_line_no, to distinguish them from the new fields starting end_*"
2024-03-14 09:09:56 +09:00
Andrew Brunker
831f739340 docs: Add lazy.nvim configration #4694 (#4739)
* docs: Add lazy.nvim configration #4694

* docs: fix typo, and add lazy.nvim configuration example
2024-03-12 14:44:04 +09:00
Horacio Sanson
8f9197b79b Fix 4740 - add hurlfmt linter (#4741)
* Fix 4740 - add hurlfmt linter

* Fix 4740 - add hurlfmt fixer

* Fix wrong comments

* Add end_col to qflist

* Fix test
2024-03-12 09:51:49 +09:00
Mathew Attlee
5a8287e676 Add support for .eslintrc.cjs (#4742) 2024-03-12 08:53:59 +09:00
David Dominguez
4d132b3ffa Fix biome formatter (#4733)
* Fix biome formatter

Added escaped executable to the biome#Fix command

* Added fixer callback test
2024-03-02 16:05:47 +09:00
Yining
b01c0b23bb Fix: ruff version 0.3.0 cli breaking changes (#4732)
This commit appends `check` to the ruff executable if the version of
specified ruff executable is `>= 0.3.0`, as ruff version `0.3.0`
deprecates `ruff <path>` in favor of `ruff check <path>`:

https://github.com/astral-sh/ruff/releases/tag/v0.3.0
2024-03-02 08:31:19 +09:00
Horacio Sanson
24a937e04f Fix 4586 - Make golangci-lint lint package on by default. (#4730)
Checking whole packages instead of individual files is more sensible
default for golang projects. Without this we get many cryptic
`typecheck` errors in ALE that do not show when running in terminal or
CI.
2024-02-28 10:07:22 +09:00
Horacio Sanson
8d199d8c10 Fix 4721 - force latex language id on cspell for tex filetype (#4724)
* Fix 4721 - force latex language id on cspell for tex filetype

* Fix tests
2024-02-27 08:54:45 +09:00
Jorengarenar
9b8413a825 Fix chktex highlighting wrong column when using tabs instead of spaces (#4727)
* Fix '-s' to be '-S' when setting 'TabSize=1' for chktex

Fixes #4712
Closes #4725

* Check if chktex's -S option is available

* Check chktex version instead of trying -S option
2024-02-27 08:54:14 +09:00
Horacio Sanson
00dcf52d6f 4712 revert chktex 4661 (#4725)
* Fix 4712 - revert #4661

* Fix tests
2024-02-26 11:56:56 +09:00
Filip Gospodinov
9cc8383fe9 Add full support for biome (#4705)
* Revert "Add biome support for javascript (#4701)"

This reverts commit 8922478a83.

* Add support for biome
2024-02-24 16:51:39 +09:00
Dmitri Vereshchagin
b74cd02648 Set working directory for Elvis linter (#4726)
Most of the time it works to assume that the current working
directory is the root of the project.  However, this is not the case
for Rebar3 checked out dependencies, for example.

It's also worth noting that because of the way Elvis handles file
patterns, and because directories in configuration are relative to the
project root, the path supplied to command must be also relative.
2024-02-24 15:37:55 +09:00
Sam
5e8904cd3d Add support for gjs template linting using embertemplate lint (#4653)
* super hacky way to get ember template lint to work on gjs files

* Clean up code so we use a handler which means we reuse all the config
also moves handler to the glimmer directory so it only fires
for gjs files

* fix tests
2024-02-23 13:30:12 +09:00
Edwin Huijsing
f38a802172 Add file mapping to phpstan (#4685)
* PHPStan is now working with filename-mapping

See help ale-lint-other-machines for more info about filename-mapping.

* Add two tests to show and test what is expected

* Missed this update while creating previous commit

* Simplified the update

We only needed to refactor the processing loop.
No extra test are needed.
2024-02-22 11:55:52 +09:00
AlvinRolling
52c6146751 Slang linter for Verilog. (#4713) 2024-02-22 11:18:04 +09:00
Dmitri Vereshchagin
1c5b84f375 Update project root detection for erlang_ls linter (#4619)
* Refactor erlang_ls linter tests

* Add Rebar3 _checkouts support for erlang_ls linter

* Add Erlang.mk support for erlang_ls linter
2024-02-22 11:14:56 +09:00
Benjamin Block
8b8ddea6e5 Adding support for Odin language server (ols). (#4679) 2024-02-22 11:12:57 +09:00
Brandon Maier
38c31302da Add wiki link to ShellCheck linting (#4681)
The ShellCheck integrations wiki suggests providing users with more
info by linking back to the ShellCheck wiki.

https://www.shellcheck.net/wiki/Integration#linking-to-the-wiki
2024-02-22 11:11:56 +09:00
Oliver Albertini
506d392f6a [hover] ParseLSPResult sets language 'text' for missing spec (#4699)
I have an LSP that is returning markdown code blocks on Hover with no
language specified, e.g.

````
```
Foobar
```
````

As a result, you get "```" in the message line which is not that useful.

I made the regex to catch the first code fence accept empty language as
well, and if it's empty, we set it to "text".

This makes it so that LSPs that return no language still produce legible
restuls on the message line.

Co-authored-by: Oliver Ruben Albertini <ora@fb.com>
2024-02-22 11:10:32 +09:00
Tim Carry
6fd9f3c54f fix #4687 - only lint one file with actionlint (#4688) 2024-02-06 10:23:26 +09:00
Jonathan Palardy
1b24bd3f5f Support 'gleam format' as Gleam fixer (#4710) 2024-02-06 10:16:25 +09:00
Akiomi Kamakura
8922478a83 Add biome support for javascript (#4701) 2024-01-14 21:11:14 +09:00
ohakutsu
531970533a Add language id of cspell (#4700) 2024-01-14 21:05:38 +09:00
Jorengarenar
94f764631d Fix chktex highlighting wrong column when using tabs instead of spaces (#4661)
* Fix chktex highlighting wrong column when using tabs instead of spaces

Fixes #723

chktex implemented feature request [1] for allowing setting options from
the command line. Thanks to that we can tell it to treat tab character
as of one space width, i.e. one char. That means, after we translate the
output back to Vim columns, we get correct numbers.

[1]: https://savannah.nongnu.org/bugs/?56486

* Add test_tex_chktex.vader

* Use functions to set g: variables in ale_linters/tex/chktex.vim

* Update ale_linters#tex#chktex#GetCommand() to use '%e'
2024-01-14 21:04:23 +09:00
Yining
3dbf0b2202 add: support for rubyfmt as ruby fixer (#4678)
[rubyfmt](https://github.com/fables-tales/rubyfmt) is a formatter for
 `ruby` code.

This commit adds support for `rubyfmt` as a `ruby` fixer (#2991),
together with some tests and documentation.
2024-01-14 20:59:20 +09:00
Tim Carry
17cca243e3 Actionlint: correctly parse error line when using shellcheck sublinter (#4689) 2024-01-14 20:51:39 +09:00
Brandon Maier
d63f5e6a77 Add end_col and end_lnum to ShellCheck (#4692)
* Add end_col and end_lnum to ShellCheck

ShellCheck supports a JSON format mode which includes an 'endLine' and
'endColumn' field.

We must use the newer 'json1' format as it properly treats tabs as a
single character. 'json1' was not supported until v0.7.0 in 2019[1], so
we maintain support for the older GCC based format.

[1] https://github.com/koalaman/shellcheck/blob/v0.9.0/CHANGELOG.md?plain=1#L121

* Add wiki link to ShellCheck json output
2024-01-14 20:47:42 +09:00
Jonathan Palardy
ebc6718c0a Support gleamlsp language server for gleam (#4696) 2024-01-14 20:43:59 +09:00
Nicolas Blanchot
32e6fc5975 Stylelint linter output stream can go to stderr (#4702)
Since [version 13.6.0](804bb24c75/CHANGELOG.md (L654)),
following [PR 4799](https://github.com/stylelint/stylelint/pull/4799)
`stylelint` errors are sent to `stderr`. Previous versions where sending
errors to `stdout`.
2024-01-14 20:43:31 +09:00
Ingo Meyer
562680e786 Use different group names for signs and virtual text (#4704)
Since Neovim commit c4afb9788c4f139eb2e3b7aa4d6a6a20b67ba156, the sign
API uses extmarks internally. Virtual text is already rendered using
extmarks. ALE uses the same group name for both signs and virtual text
and as a result, both are placed in the same extmark group. Since ALE
deletes all extmarks in the virtual text group after all signs have been
placed, no signs are ever shown. This commit fixes this by renaming the
sign group from `ale` to `ale_signs`.
2024-01-14 20:29:10 +09:00
samuelhelen
143074a780 Fix E1085: Not a callable type: elm_ls#GetOptions (#4707)
Rename GetOptions to GetInitializationOptions for consistency.
2024-01-14 20:28:29 +09:00
Finn Steffens
9a23ec1f60 Ruff use json-lines output format (#4656)
* Ruff use json-lines output format
* Fix Ruff: add -q to prevent non json output

Using the json-lines output format allows for setting of the end_line,
end_col and code field of the handle output.

Additionally, the first letter of the code is used to determine the type
field.

Co-authored-by: w0rp <w0rp@users.noreply.github.com>
2023-12-10 11:45:01 +00:00
Shad
ecc796b3d7 fix tempfile for phpmd, to be able to use phpmd 2.14.0 (#4617) 2023-12-10 11:11:29 +00:00
MD
71718722b2 Add support for Scarb in cairo files (#4669)
* Add support for Scarb in `cairo` files
* specify if linter should run on saved
2023-12-08 22:13:37 +00:00
Yining
32ee7039d0 add: support for nickel format as Nickel fixer (#4665)
Nickel(https://nickel-lang.org/) is a configuration language, like
Jsonnet, Cue, Dhall.

`nickel`(https://github.com/tweag/nickel) is the main command to run,
export and also format Nickel code.

this commit adds `nickel format` as a Nickel fixer, together with some
tests and documentation.
2023-12-07 14:55:14 +00:00
Jorengarenar
fc45a935bf Add clang-check linter for C (#4662)
* Close #976 - add clang-check to C linters

* Update docs
2023-12-07 14:49:37 +00:00
D. Ben Knoble
1ccd99e113 add b:undo_ftplugin (#4625) 2023-11-19 09:13:56 +00:00
Joseph Henrich
5cddc4c8e1 Adding support for ruff formatter (#4645) 2023-11-16 12:12:40 +00:00
Adam Blackwater
50e237facd Fix: Ruff output option (#4632)
* fix --output-format option
* Add conditionally changing flag based on Ruff version
2023-11-08 21:44:11 +00:00
Julian Gong
901d3ff8dd Fix a typo in README.md (#4647)
Co-authored-by: Julian Gong <julian@meds.com>
2023-11-05 18:22:41 +00:00
w0rp
53b01d6a54 Fix #4499 - Fix solhint >= 3.4.0
Fix solhint for versions >= 3.4.0, while still supporting older
versions.

The solhint linter code has been moved out of the `handlers` directory
as it does not need to be shared between different filetypes. Code has
been simplified.

Co-authored-by: Henrique Barcelos <16565602+hbarcelos@users.noreply.github.com>
2023-09-17 17:24:23 +01:00
w0rp
bd9fc580a1 Close #4541 - Fix Haskell project root detection
We weren't joining and returning paths correctly for detecting project
roots for Haskell projects, and now we are.

Co-authored-by: Rodrigo Mesquita <rodrigo.m.mesquita@gmail.com>
2023-09-16 23:25:39 +01:00
w0rp
dca621b675 Fix #4505 - Handle spaces in markdown fences 2023-09-16 23:04:46 +01:00
w0rp
e412fa34ff Fix #3115 - Fix environment variable quoting on Windows 2023-09-16 22:33:59 +01:00
w0rp
ae1d051504 #4454 Clean up more tests and code
* Remove some tests we no longer need
* Delete blocks of redundant code
* Compress some tests together to simplify them
* Remove a little code for ancient linter versions
* Escape more executables we didn't escape before
* Rename a deno option that didn't match our conventions
2023-09-16 22:23:30 +01:00
pokir
4b11cf21dc Fix grammar in ale-java.txt (#4611) 2023-09-16 22:06:13 +01:00
w0rp
cf270a1ada Stop supporting ale_lsp_root
We renamed the ale_lsp_root setting to ale_root long ago. Stop
supporting the old setting name.
2023-09-16 17:17:42 +01:00
w0rp
1799f8bec6 Close #4458 - Add an ALEStopLSP command
Add an ALEStopLSP command to stop all language servers that match a
given name. Completions are available for the command. This makes it
possible to keep other language servers running other than the one
you're interested in stopping.
2023-09-16 17:03:02 +01:00
w0rp
be69af2705 #4607 No conflicts with nvim-lspconfig by default
Default `g:ale_disable_lsp` to a new mode `'auto'` by default. With this
setting applied, ALE will now check for the presence of nvim-lspconfig
and automatically turn off particular LSP linters if already configured
via nvim-lspconfig.

For users that do not use `nvim-lspconfig`, everything should work as
before.
2023-09-14 00:40:56 +01:00
ymap
9092af9ad6 Add support for Packwerk (#4594)
Packwerk (https://github.com/Shopify/packwerk) is a Ruby gem
used to enforce boundaries and modularize Rails applications.
2023-09-13 15:53:24 +01:00
Axel Clark
ac615e7f65 Add lexical for linting elixir projects (#4580) 2023-09-11 13:48:11 +01:00
w0rp
1bf445c6d5 Print the most severe problem with virtualtext
Fix the ordering of virtualtext so we print the most severe problem on a
line. If two problems are the most severe, we will print the left-most
problem.
2023-09-10 17:44:25 +01:00
w0rp
385dc4130c Show a single virtualtext message by default
Show only a single virtualtext message per line by default. The setting
can be configured to whatever the user wants. This default prevents
several linters from spamming the editor with messages that run off into
the right margin.

Documentation now clarifies that problems have a predictable order, and
which message will come first.
2023-09-10 17:22:16 +01:00
Peter Benjamin
61892e8586 fix(json): update vscode json lsp name (#4601)
* fix(json): update vscode json lsp name
* fix(vscodejson): fallback to previous name

Co-authored-by: w0rp <devw0rp@gmail.com>
2023-09-09 23:28:38 +01:00
w0rp
92267a14ba Remove backwards compatibility with ancient setting names 2023-09-09 23:13:44 +01:00
w0rp
7b56ddc3f6 Close #4481 Try .venv first, drop ve-py3
.venv was going to be the officially recommended default virtualenv
directory name in PEP 704, which was not accepted. Still, poetry uses
this name by default, as do other projects. We can deem it the first
name we should try to search for.

ve-py3 was a directory name I can't find mentions of online, and was
used in my own projects during the days of migrating from Python 2 to 3.
We can just drop it, and people can update their settings if they still
need it.
2023-09-09 22:57:01 +01:00
w0rp
65f0fd0d6a #4442 - Use the same default signs as Neovim diagnostics 2023-09-09 16:44:54 +01:00
w0rp
a16f060481 Close #4442 - Use Neovim diagnostics by default
Use Neovim's diagnostics API by default in recent enough Neovim
versions. This will make problems found by ALE play nicely with problems
found by other tools.
2023-09-09 16:34:55 +01:00
w0rp
0a135456a6 Clean up documentation typos and formatting 2023-09-09 15:40:30 +01:00
w0rp
d2c2bbf2dc Add --globals vim to luacheck automatically
luacheck will run with `--globals vim` automatically if the file is in
runtimepath and `--globals` hasn't already been configured.
2023-09-09 14:01:00 +01:00
w0rp
79a2dc2d8a #4442 Display error codes in Neovim diagnostics 2023-09-09 00:10:27 +01:00
w0rp
e4411276a5 #4442 Configure signs in Neovim diagnostics
Respect ALE's options to enable/disable signs in Neovim diagnostics,
and use ALE's priority setting.
2023-09-08 23:54:16 +01:00
w0rp
dadc778451 #4605 Use a single time for InsertLeave emulation
Use a single timer for InsertLeave emulation to optimise it for many
buffers, and specifically lint the buffer we entered insert mode on.
2023-09-08 18:51:04 +01:00
w0rp
dd3abf1ad9 Close #4605 - Emulate InsertLeave mode
Use a repeating timer to emulate InsertLeave mode for users who have not
rebound <C-c> to <Esc>, like many experienced Vim users do. This allows
ALE to start linting when you finish typing by default without having
to know about this quirk in Vim or Neovim.
2023-09-08 18:42:45 +01:00
w0rp
bf55175b69 #4454 Clean up root test directory tests
Combine cases into smaller tests of tests and remove tests we no longer
need. Linter tests have been moved to where they should be.
2023-09-08 01:00:35 +01:00
w0rp
e5816964d1 Give up on Windows tests again for now
Add directories and files to AppVeyor to make it skip running if it
doesn't need to run.
2023-09-07 21:20:58 +01:00
w0rp
89428cb957 Try windows-2019, as windows-latest is slow as Hell 2023-09-07 21:06:44 +01:00
w0rp
0d07f4dba6 Try to fix building Vader again 2023-09-07 20:57:13 +01:00
w0rp
bf8e7f6368 Stop redirecting error streams for Vader build 2023-09-07 20:54:35 +01:00
w0rp
752acbe79b Try http:// for downloading Vim 2023-09-07 20:52:42 +01:00
w0rp
9713faf192 Attempt running Windows rests relative to GitHub dir 2023-09-07 20:47:20 +01:00
w0rp
d52c3db238 Try to fix GitHub Actions 2023-09-07 20:38:32 +01:00
w0rp
99a33d8d3f Try to test ALE on Windows in GitHub 2023-09-07 20:29:35 +01:00
w0rp
108e858d61 Update minimum supported NeoVim version to 0.6.0
Stop officially supporting NeoVim versions below 0.6.0, without
necessarily breaking ALE for people using older versions.
2023-09-07 20:01:31 +01:00
w0rp
14350dbb0d Close #3368 - Supercharge :ALEInfo
Make a series of sweeping changes to make :ALEInfo more useful.

1. Deprecate :ALEInfoToClipboard and support :ALEInfo -clipboard
2. Permit :ALEInfo -clip as a shorthand for :ALEInfo -clipboard
3. Support :ALEInfo -preview to render in the preview window
4. Support :ALEInfo -echo for the classic :ALEInfo mode
5. Change the default mode to 'preview', and make it configurable
6. Add syntax highlighting for ALEInfo in preview mode
7. Add a convenience to look up documentatation that explains itself
8. Don't show an empty 'Linter Variables' section
2023-09-06 00:21:58 +01:00
w0rp
551fbcfb09 Add an option to save hidden buffers
When commands are run, it can be useful to just save the hidden buffers
so language servers immediately get updated with changes to files
without you having to manually save each file. You can now enable this
by setting `g:ale_save_hidden` to `1`.
2023-09-06 00:17:27 +01:00
w0rp
8ba7ae818c Close #4461 - Use rust-analyzer by default
Use rust-analyzer by default instead of rls, as rls has been deprecated.
2023-09-05 21:45:34 +01:00
Henrique Barcelos
64ddf457e1 Feature: add forge fmt as a fixer for Solidity files (#4598)
* feat: add `forge fmt` as a fixer for Solidity
2023-09-05 18:34:39 +01:00
Magnus Groß
59e455b4d8 Improve ALEFix performance for neovim (#3974)
* Avoid performance problems with setbufline() and Treesitter

Call nvim_buf_set_lines() instead.

Since this is a performance problem only in Neovim (Treesitter is only
available there), it doesn't matter that this API is unavailable in Vim.

Note: nvim_buf_set_lines() returns E5555, when set nomodifiable is on.

Fixes #3669

* Avoid sign flickering

The signs flickered because nvim_buf_set_lines() removes all signs from
lines that it touches, which will immediately be readded by Ale (causing
the brief flicker). This is intended behaviour in neovim [0].

Neovim itself faced this problem in their own LSP formatting sync,
although they had the problem with marks instead of signs [1].
Similar to how neovim fixed it by storing and restoring the marks [2],
we can do the same thing with signs.

In fact it is easier with signs, because sign_placelist() will just
ignore and skip invalid line numbers, so we don't need to filter signs
that are not valid anymore.

[0] https://github.com/neovim/neovim/issues/10880#issuecomment-526466042
[1] https://github.com/neovim/neovim/issues/14307
[2] https://github.com/neovim/neovim/pull/14630
2023-09-05 14:36:17 +01:00
xu0o0
ea27441834 fix(neovim): ignore unrelated diagnostics (#4597)
Fix the NeoVim diagnostics bridge so it only sends over diagnostics relevant to the current buffer.
2023-09-05 14:34:33 +01:00
Peter Benjamin
3bedafc29a fix(yaml): make actionlint respect config (#4584)
* fix(yaml): make actionlint respect config
* docs: update actionlint docs
* chore: update author & add description
* test: move actionlint test to test/linter/
2023-09-05 14:33:41 +01:00
jiz4oh
115ad17ace Support format xml file which haven't yet persisted at the disk (#4585)
Support format xml file which haven't yet persisted at the disk
2023-08-20 10:43:31 +01:00
ymap
d1bac104a1 Fix typo in filename (#4595) 2023-08-20 10:33:37 +01:00
Tomáš Janoušek
fe38101db7 Fix error loading "text" syntax for hover (#4574)
rust-analyzer sometimes returns a hover result with language being
"text", but there's no syntax/text.vim, so this would fail with:

    Error detected while processing function <SNR>150_VimOutputCallback[6]..<lambda>8[1]..ale#lsp#HandleMessage[30]..ale#hover#HandleLSPResponse[42]..ale#floating_preview#Show[13]..<SNR>161_VimShow:
    line   13:
    E484: Cannot open file syntax/text.vim

Only including the file when it actually exists fixes this.
2023-08-15 11:20:47 +01:00
Matheus Werny
951b280bd5 yamlfmt (#4587)
* Added the fixer, wrote tests and tested it
2023-08-15 10:15:06 +01:00
Rodrigo Mesquita
15cbc0e912 Close #4579 - Support numhl highlights for vim >= 8.2.3874
In #2637, support for numhl highlights was added for nvim.

In the meantime, vim added support for numhl highlights in patch 8.2.3874.

This patch allows numhl highlights to be enabled in ALE for vim >= 8.2.3874 too.
2023-08-05 18:10:03 +01:00
Oskar Haarklou Veileborg
af42e0b510 floatwin: use win_execute in NeoVim for commands when it exists (#4532) 2023-08-01 21:30:23 +01:00
Peter Benjamin
0bc2ea0800 docs: fix typo (#4567)
Closes #4517

Co-authored-by: Peter Benjamin <peterbenjamin@peters-mbp.lan>
2023-08-01 21:23:53 +01:00
Peter Benjamin
18cd44c57d feat(markdown): add marksman lsp (#4565)
* feat(markdown): add marksman lsp
* docs: add marksman docs
* test(markdown): add marksman test

Co-authored-by: Peter Benjamin <peter.benjamin@peter.benjamin-FVFHP2WSQ05Q>
2023-08-01 21:23:02 +01:00
Amadeus Demarzi
1174b3b81e Don't echom if not in normal mode (#4560) 2023-07-31 08:39:30 +01:00
Wooter
b216892f0c Communicate support for markdown to the lsp server (#4450) (#4453) 2023-07-25 10:43:57 +01:00
JoseGRuiz
481c5cccbf fixed parsing errors when certain options are used in glslangValidator (#4540)
* fixed parsing errors when certain options are used in glslang

* Update glslang.vim

set column number to 0 like it is always set by glslangValidator

* Added a test for the handler of glslangValidator
2023-07-24 21:43:13 +09:00
Arash Mousavi
93a4f70414 Add erb-formatter support (#4546) 2023-07-24 21:38:52 +09:00
Craig Rodrigues
3d10770387 Remove gometalinter support (#4534)
gometalinter has been deprecated, and was archived in 2019
2023-07-24 21:33:15 +09:00
Craig Rodrigues
f34016a552 feat: enable golangci-lint by default (#4536)
This replaces golint and gometalinter which are both deprecated
2023-07-24 21:30:00 +09:00
LittleKey
969f7b080f Add end_col of matched forbidden word (#4556) 2023-07-24 10:37:49 +09:00
Mitchell Hanberg
7ba88ad343 chore: update elixir_ls.vim (#4547)
The project was forked and lived under a new organization
2023-07-24 10:28:34 +09:00
Arnold Chand
32e1417d98 fix(vue): volar v1 support (#4552)
* fix: volar v1 support

* fix: volar linter errors
2023-07-24 10:08:11 +09:00
Ben Boeckel
1084152a11 ale-rust: add an example for rust-analyzer configuration (#4559)
Closes: #4557
2023-07-24 09:35:54 +09:00
Craig Rodrigues
29e5ffe35a Remove golint supported-tools (#4535)
golint has been deprecated and was archived in 2019
2023-06-27 18:52:50 +09:00
Chuck Grindel
21f1ab6ffc feat: support Bazel buildifier linter (#4529)
* Initial buildifier linter files

* Add handler test

* Fix test when options are not set
2023-06-27 18:52:25 +09:00
0xHyoga
5ab35a7a30 Update cairo linter to Cairo 1.0 (#4530)
* update cairo linter

* new cairo handler test

* add another handler instead of replacing
2023-06-27 18:44:20 +09:00
Nathan Henrie
c0eff9f2f1 Mention deadnix in supported tools (#4528)
Deadnix support was added in
https://github.com/dense-analysis/ale/pull/4443 but it seems not to have
been mentioned in the lists of supported tools.
2023-06-09 10:56:53 +09:00
Rob Whittaker
7021ed0c68 🐛 Fix a Ruby deprecation warning in the ERB linter (#4521)
* Fix a Ruby deprecation warning in the ERB linter

Before, the ERB linter used positional arguments. Newer versions of Ruby
have deprecated this method signature. We fixed the linter to use
keyword arguments.

* fixup! Fix a Ruby deprecation warning in the ERB linter
2023-05-26 14:52:51 +09:00
Shad
a46121a532 Dockerlinter (#4518)
* dockerlinter support

* Tests & ShellCheck reference

* sort and align docs
2023-05-22 11:58:59 +09:00
bretello
5c803fb970 docs: fix broken link for ccls init opts (#4520)
Co-authored-by: bretello <bretello@distruzione.org>
2023-05-21 14:11:15 +09:00
lucas-str
9fe9f11521 Add support for npm-groovy-lint (#4495)
* Add support for npm-groovy-lint

* Add doc and tests for npm-groovy-lint

* Use ale#util#FuzzyJSONDecode instead of json_decode
2023-05-06 09:02:07 +09:00
Pat Brisbin
61248e1453 Add fourmolu fixer (#4501)
* Add fourmolu fixer

Fourmolu is aversion of Ormolu that supports configuration. This fixer
was modeled after the Ormolu one, but using the "stack executable"
approach of the Brittany and Stylish Haskell fixers.

* Sort supported-tools.md
2023-04-22 22:05:50 +09:00
Horacio Sanson
fdadaed2ba Fix 4490 - Fix pyright not running with poetry (#4491)
* Fix 4490 - Fix pyright not running with poetry

* Fix tests
2023-04-13 08:54:49 +09:00
Carl Smedstad
93100159a2 Add support for Bicep when installed as a plugin to Azure CLI (#4496)
* Add support for Bicep when installed as a plugin to Azure CLI

The compiler for Microsoft's DSL Bicep can be installed both
independently and as a plugin to Azure CLI. The latter is probably how
most people install it.

The program output is the same but Azure CLI wraps the arguments and has
a slightly different interface, hence I opted to copy the old linter and
modify it to match the plugin arguments.

* Fix bicep/az_bicep tests, arguments and parsing

* Actually test the ale_linters#bicep#az_bicep#Handle function in the
  test that should test that function, not
  ale_linters#bicep#bicep#Handle.

* Use the same method as in bicep/bicep for discarding output file, i.e.
  by specifying --outfile to a null file.

* Fix parsing of occasionally occurring leading error type (such as
  'ERROR: ').

* Correct option defaults for bicep & az_bicep specified in documentation
2023-04-13 08:51:52 +09:00
SkrrtBacharach
57254db9ef Fix error from ansible-lint versions >=6.11.0. (#4492)
* Fix error from ansible-lint versions >=6.11.0.

The JSON output format of ansible-lint has changed since
6.11.0. Issue locations can have either a 'positions' or
a 'lines' member, rather than just a 'lines' member as it
was before. This fix checks which member is present, and
passes that member name to subsequent dictionary lookups.

The error was caused by the following change:
https://github.com/ansible/ansible-lint/pull/2897

* Add ansible-lint test to check each type of ansible-lint issue json.

* Change long single-line JSON in ansible test into multiline JSON.

* Fix linting errors in ansible_lint.vim.
2023-04-07 09:19:58 +09:00
Veselin Ivanov
b0ba31f88e remove --enable-all from golangci-lint options (#4488)
* remove --enable-all from default golangci-lint options

* update golangci-lint options documentation

* update tests to use empty golangci-lint options
2023-04-02 18:09:58 +09:00
David le Blanc
41e12fd640 Added column alignment for errors (#4473) 2023-03-31 10:50:48 +09:00
Guillermo R. Roig Carralero
7dbd3c96ac Add support for rustywind fixer (#4477) 2023-03-26 15:38:24 +09:00
w0rp
fbae1bc193 Use cooler badges in README 2023-03-15 22:31:51 +00:00
Wilson E. Alvarez
e1a0781f9d Fix ale#util#GetBufferContents and propagate use (#4457)
* Use newline characters instead in ale#util#GetBufferContents
* Propagate use of ale#util#GetBufferContents
* Add ale#util#GetContentBuffer test
2023-03-14 20:55:28 +00:00
TheBearodactyl
011e4f6590 Added instructions for pathogen install (#4471) 2023-03-11 09:02:01 +09:00
jiz4oh
f04887740d Fix mismatched type on compare g:ale_virtualtext_cursor (#4476) 2023-03-09 08:55:49 +00:00
Daniel Harding
007c5b1152 Clear virtualtext no matter how enabled (#4475)
When toggling ALE off, clear the virtualtext even when g:ale_virtualtext_cursor is 'all'.
2023-03-08 14:47:58 +00:00
w0rp
16f5a1915b Fix a typo in the README 2023-03-07 03:54:48 +00:00
w0rp
aca71daa2e Close #4441 - Update FAQ and add "Why ALE?" 2023-03-07 03:50:18 +00:00
w0rp
39c76cf6af Fix vim-plug and Vundle headings 2023-03-07 02:39:57 +00:00
w0rp
d5a3da19d4 Fix installation text 2023-03-07 02:39:19 +00:00
w0rp
40c1b17e2f Remove Table of Contents and simplify installation section 2023-03-07 02:38:03 +00:00
w0rp
96f0bf7172 Fix windows virtualenv PATH tests 2023-03-07 02:11:43 +00:00
w0rp
bb691d6dee #2172 - Expand PATH in the shell for automatic virtualenv 2023-03-07 01:59:11 +00:00
Albert Peschar
6ae26df22b Add deadnix linter (#4443) 2023-03-07 01:31:14 +00:00
Oskar Haarklou Veileborg
c8e9146049 Fix #3616, #3903 - Use proper floating window borders in neovim (#4417)
* Fix #3616, #3903 - Use proper floating window borders in neovim

* Compatibility w. length 6/7 ale_floating_window_border values
2023-02-21 18:25:10 +09:00
w0rp
c3f9bccb8c Ignore shellcheck error in run-vader-tests 2023-02-13 04:43:45 +00:00
w0rp
ab7757b532 Clean up run-tests syntax 2023-02-13 04:24:54 +00:00
Albert Peschar
9c45358aab run-tests: download images only on x86-64 (#4421)
When running the tests on aarch64, the run-tests script tries to
download a pre-built image that is built for x86-64, and thus does not
run.

This change adds a check for the Docker daemon host platform and only
downloads the image if it will run.

Furthermore, the image dependency testbed/vim:24 is also built unless
the platform is x86_64, since it is also only provided for this
platform.
2023-02-13 03:53:15 +00:00
javad
f78e9d634f Add support for llvm-mc as an assembly linter (#4446) 2023-02-09 10:49:24 +09:00
w0rp
ae2d47ba83 Attempt to fix auto virtualenv on Windows 2023-02-08 09:44:25 +00:00
w0rp
2a24b4e0d1 Fix CI BS 2023-02-08 09:25:15 +00:00
w0rp
4c162877e2 #2172 Auto PATH with ale_python_auto_virtualenv
Automatically set `PATH` for some Python linters that seem to need it
when g:ale_python_auto_virtualenv or b:ale_python_auto_virtualenv is
`1`.
2023-02-08 09:11:31 +00:00
w0rp
6ff1f0b200 Close #4389 - Run pyright via poetry, pipenv, venv
Add support for automatically detecting and running Pyright via poetry,
pipenv, and virtualenv directories just like we do with flake8.
2023-02-08 08:24:16 +00:00
w0rp
f2a21c960a Add support for lua-language-server 2023-02-08 01:14:47 +00:00
w0rp
da5fa17df1 Fix broken tag references and the broken script to check them 2023-02-07 18:41:13 +00:00
Nathan Henrie
e1ae009bac Add alejandra for nix (#4435)
- Fixes https://github.com/dense-analysis/ale/issues/4434
2023-02-07 17:24:52 +09:00
Andreas Wachowski
45a3e3f574 Remove duplicated word in help g:ale_virtualtext_cursor (#4444) 2023-02-03 17:25:49 +00:00
vindex10
98f466f9ce add eslint plugin html for linting js in html files (#4428)
* add eslint plugin html for linting js in html files

* fix linting
2023-02-02 14:13:52 +09:00
Albert Peschar
599f7b1eda phpstan: set cwd to configuration file directory (#4422)
PHPStan will only detect a configuration file in the current working
directory, so set that to the directory in which ALE finds the
configuration file.
2023-02-02 14:09:11 +09:00
Ben Boeckel
116d713f63 diagnostics: support sending ALE output to Neovim's diagnostics API (#4345)
Support replacing ALE's display of problems with sending problems to the Neovim diagnostics API.

:help g:ale_use_neovim_diagnostics_api

Co-authored-by: David Balatero <dbalatero@users.noreply.github.com>
Co-authored-by: Georgi Angelchev <angelchev@live.co.uk>
Co-authored-by: w0rp <devw0rp@gmail.com>
2023-01-29 17:25:09 +00:00
Sean Enck
0af4899605 Add gopls format as a Go fixer 2023-01-28 00:20:29 -07:00
Horacio Sanson
65088b59b7 State ALE works with vim 8.0 and above (#4430) 2023-01-27 16:30:34 +00:00
Yining
b6f6d84c25 add: pycln as a python linter and fixer (#4415)
this commit adds pycln as a Python linter and fixer, together with some
tests and documentation. It addresses #4340

pycln repo: https://github.com/hadialqattan/pycln
2023-01-27 10:24:18 +09:00
Actionless Loveless
26c79014f5 fix(ale_linters: python: ruff): add --stdin-filename if version > 0.0.69 (#4414) 2023-01-27 09:03:41 +09:00
w0rp
69c1dc8b5f Fix #4413 - Avoid errors for invalid buffers in ale#virtualtext#Clear 2023-01-06 19:02:35 +00:00
w0rp
0f51c3b01b Fix #4410 - Ignore prop_add errors 2023-01-04 15:13:21 +00:00
w0rp
5c703f4e4b Update copyright to use company name and current year
I am the President and Treasurer of Dense Analysis, and through my sole authority I transfer the copyright of ALE to my own nonprofit organisation, so it can live on throughout history as a protected FOSS project after I am dead. Nuff said.
2023-01-03 14:12:36 +00:00
w0rp
4872ce2ab4 Add new demo video to README 2022-12-31 15:17:13 +00:00
Leon
1ee863002a Fix #4408 - Trigger floating preview autocommand on BufWinLeave and WinScrolled (#4409) 2022-12-30 18:47:43 +00:00
Antonio Gurgel
ef6715ee41 nix: durably handle versions before 2.4 (#4398)
What I should have done in 4394. Idea: @w0rp
2022-12-28 21:05:32 +09:00
w0rp
457e0a50f1 Fix #4331 - Shift line 0 errors to line 1 for virtual-text 2022-12-27 23:40:49 +00:00
w0rp
a18472cc58 Close #4401 - Use subtle defaults for virtual-text
Default virtual-text to the Comment highlight group and prefix
virtual-text messages with comment text for each language by default.

Messages can now be formatted with `%type%` to print the error type.

The Vim 9.0 version has been updated in the Docker image to add test
coverage for virtual-text.
2022-12-27 23:11:53 +00:00
w0rp
98b2ef438e #4400 - Remove virtual-text defaults from highlight.vim 2022-12-27 16:24:10 +00:00
w0rp
fe61e00040 Fix #4400 - Separate virtual text highlight groups to avoid errors 2022-12-27 15:36:35 +00:00
w0rp
3cb4f33a9a Fix #4399 - Manage virtual-text state better 2022-12-26 15:56:34 +00:00
w0rp
31010ad1d1 Update ALE to v3.3.0 2022-12-25 20:30:21 +00:00
w0rp
9f2a000237 Close #4396 - Enable virtualtext by default
Wherever it's supported, enable virtualtext by default.
2022-12-25 20:18:47 +00:00
w0rp
300ea232de Close #4397 - Add human-readable values for g:ale_virtualtext_cursor 2022-12-25 19:29:16 +00:00
w0rp
522b5d0433 Fix markdownlint documentation 2022-12-25 15:47:30 +00:00
w0rp
2ae04b310a Enable ruff for Python by default 2022-12-25 15:13:10 +00:00
Antonio Gurgel
4c5c47b593 nix: handle versions past 2.9 (#4394) 2022-12-25 19:02:01 +09:00
w0rp
87b4ab4e20 Document how to create ALE releases 2022-12-24 22:16:36 +00:00
w0rp
bc95701575 Fix #4388: Fix pylsp and Pyright cwd
Add functions to compute the cwd to be the same as the project root for
pylsp and Pyright to work around issues in each language server when
they encounter modules that share the same name as first or third party
libraries.
2022-12-24 13:37:57 +00:00
Yining
1e398202b9 fix: ruff not registered as fixer (#4393)
this commit fixes the issue reported at:
https://github.com/dense-analysis/ale/issues/4301#issuecomment-1359289391

it also had some code refactored and
tests added for ruff as fixer (missed in PR #4347).
2022-12-22 09:53:01 +09:00
Yining
8bcbb29958 fix: #4356 Missing racket documentation (#4384)
This commit adds vim help docs for `raco_fmt` and `racket-langserver`.
2022-12-10 11:51:50 +09:00
Michael F. Schönitzer
42a17dec16 Handle empty answer of ansible-lint (#4373)
* Handle empty answer of ansible-lint

The variable a:lines might be empty if ansible-lint exited early, in
that case json_decode would trow an error.

* Use ales JSON decode function
2022-12-06 21:44:10 +09:00
Yining
cad8f8e683 add: support for refurb as a Python linter (#4379)
this commit adds refurb as a Python linter, together with some tests
and documentation. it should fix issue: #4362

refurb repo: https://github.com/dosisod/refurb
2022-12-06 21:26:09 +09:00
Matheus
5ce2bf84ca Added support for more file types for clang-format. (#4367) 2022-11-25 13:16:16 +00:00
U1s2e3r4n5a6m7e
b8de4ac96d fix: missing plug mapping ale_go_to_implementation (#4337)
Co-authored-by: Tiffany <taftaftesed@gmail.com>
2022-11-25 13:14:12 +00:00
Horacio Sanson
3e460fa93b Fix 4246 - Add ansible language-server (#4355) 2022-11-25 13:13:38 +00:00
w0rp
46e77fad77 Remove a flaky smoke test we no longer need 2022-11-25 12:58:14 +00:00
Horacio Sanson
cbf7045eee Fix 4324 - add neovim 0.8 test (#4325)
* Fix 4324 - add neovim 0.8 test
* Update vim testbed image
* Update documentation

Co-authored-by: w0rp <w0rp@users.noreply.github.com>
2022-11-25 12:55:31 +00:00
Horacio Sanson
2cfbebdd59 4242 update tests with vim 9 (#4366)
* Replace Vim 8.2 with Vim 9.0 in CI
* Keep Windows tests on Vim 8.0 for now

Co-authored-by: w0rp <w0rp@users.noreply.github.com>
2022-11-25 12:34:40 +00:00
Carl Smedstad
590352304e Fix bug in sqlfluff implementation & implement fixer support (#4365)
* Account for no sqlfluff output

Avoid crashes when there isn't any output from sqlfluff.

* Add supplort for sqlfluff as a fixer
2022-11-23 19:58:49 +09:00
Joey Buiteweg
0b25d712b7 Add rustfmt executable variable to rust docs (#4360) 2022-11-22 10:28:39 +09:00
Carl Smedstad
6c4be47437 Implement support for SQL linter sqlfluff (#4361) 2022-11-21 19:50:45 +09:00
Götz Christ
ca355f4cb4 Markdown: allow passing custom executable for markdownlint (#4358) 2022-11-21 19:47:05 +09:00
Jeremy Cantrell
4b433e5693 Add raco_fmt fixer for Racket files (#4354)
* Add raco_fmt fixer for Racket files

* Fix command and add test

* Fix quoting
2022-11-07 22:20:25 +09:00
Yining
edffffac25 add: support config option for checkmake linter (#4351)
`checkmake` by default checks config file "in the same folder it's
executed in" unless `--config` option is set.

This commit allows setting the `--config` option with an option
variable (with documentation updated).
2022-11-06 09:32:51 +09:00
D. Ben Knoble
07bd24d0fd omni: racket should complete at end of keywords (#4352)
Consider a file like
```
 #lang racket
(require racket/gui)
```
Type `Go(eventspace-`.

Pressing <C-x><C-o> to trigger omnicomplete should suggest
```
eventspace-handler-thread
eventspace-shutdown?
eventspace-event-evt
```

It does not (instead producing "top-level" completions, as if
`(eventspace-` wasn't even there).

Debugging, place the cursor on a space _after_. Now
`ale#completion#OmniFunc(1, '')` correctly returns `1`, but when given
`(0, 'eventspace-')` it returns either the empty list or generic
completion results as described above. I'm not entirely sure of the
mechanism, but it seems that `b:ale_completion_info.prefix` is the key,
and that this is set by `ale#completion#GetPrefix`. Calling
`ale#completion#GetPrefix('racket', line('.'), col('.'))` returned `''`!

Now, it returns `eventspace-` and the completions work correctly again.

Ref #4293, #4186, #3870
2022-11-05 16:47:59 +09:00
Matthew Armand
121fbefeae Add 'dockerfile_hadolint_options' config setting (#4353)
- Add this option so command line arguments can be supplied to hadolint
- This will be respected when running in docker and via the executable
- Preserve the --no-color and - flags, and add these to the list
- Add to docs and tests
2022-11-04 17:07:56 +09:00
Yining
483d056528 add: support for ruff as a Python linter and fixer (#4347)
this commit adds ruff as both a Python linter and fixer, together with
some tests and documentation.

ruff repo: https://github.com/charliermarsh/ruff
2022-10-31 21:55:14 +09:00
Dmitri Vereshchagin
06efbdd25a Add erlang_ls linter for Erlang files (#4346) 2022-10-29 20:58:30 +09:00
Ben Boeckel
d02e58b404 Doc style fixes (#4344)
* ale.txt: fix indentation

* ale.txt: fix Type and Default markup

* ale.txt: use `not set` instead of `undefined`

This matches the way the variables are referenced in prose about
existence state.
2022-10-29 20:56:47 +09:00
Ben Boeckel
28cff80652 codespell: fix spelling errors picked out by codespell (#4343) 2022-10-29 20:56:09 +09:00
D. Ben Knoble
e4b2054408 test: ensure helptags runs (#4336)
Close #4328
2022-10-14 09:36:43 +09:00
Nicolas Pauss
951a668b14 cc: fix using '-x c*-header' for header files with GCC. (#4334)
Gcc does not support `x c*-header` when using `-` as input filename,
which is what ALE does.

Rework the feature to only use `-x c*-header` flag when using Clang and
not GCC.

The feature is now also controlled with the variable
`g:ale_c_cc_use_header_lang_flag` and
`g:ale_cpp_cc_use_header_lang_flag`.
2022-10-12 07:05:37 +09:00
koka
f085227504 fix: wrong config name (#4326) 2022-10-05 08:39:45 +09:00
koka
14d2b261ce Add support for tfsec Terraform linter (#4323) 2022-10-04 11:47:00 +09:00
Horacio Sanson
4094426c70 Add vim 9.0 and remove 8.0 (#4271)
* Add vim 9.0 and remove 8.0

* Remove vim 8.2 and keep 8.0
2022-10-04 09:38:07 +09:00
Matheus Gabriel Werny de Lima
a33960eb51 Add fixer "css-beautify". Adjust "html-beautify." (#4319)
* Add fixer "css-beautify". Adjust "html-beautify."

* Error fixes.

* Added chars.
2022-09-30 19:24:32 +09:00
Matheus Gabriel Werny de Lima
7dd13afc6c Added file types for dprint. (#4320) 2022-09-30 12:58:44 +09:00
Andreas Doll
915dc415f3 Add pyright config files to project root files list (#4321)
Add configuration files for pyright (JSON and TOML) to list of files
which identify a project root directory. Update documentation
accordingly.

Co-authored-by: Andreas Doll <andreas.doll@posteo.de>
2022-09-30 11:21:09 +09:00
Nicolas Pauss
78942df284 cc: use '-x c*-header' for header files for C and C++ linters. (#4318)
When linting an header file in C or C++, `-x c-header` or
`-x c++-header` should be used instead of `-x c` or `-x c++`.

Using `-x c` or `-x c++` for headers files can lead to unused variables
and functions marked as static inlined as seen in #4096.

Using `-x c-header` or `-x c++-header` solve these issues.

The list of file extensions that are considered as header files can be
configured with the variables `g:ale_c_cc_header_exts` and
`g:ale_cpp_cc_header_exts`.
2022-09-25 09:02:43 +09:00
Christoph Frick
a56d51ec1c Pass input via stdin and filename as arg to clj-kondo (#4315)
This allows using linters like `:namespace-name-mismatch`.

This replaces: https://github.com/dense-analysis/ale/pull/4109
2022-09-22 07:24:01 +09:00
Carl Smedstad
e73f0f5cb3 bicep: Lint files on disk instead of buffer (#4311)
I discovered that references to other Bicep files (modules) will be
broken if running on a temporary file in a different location. I've
found no way of providing an alternate path when invoking the command.
2022-09-21 22:44:22 +09:00
Carl Smedstad
8e03ceecdc Add support for Microsoft's DSL Bicep (#4310)
* Add support for Microsoft's DSL Bicep

The compilation command 'bicep build' catches compilation errors as well
as providing some lint warnings.

Repository for Bicep: https://github.com/Azure/bicep

* Different null file on Windows & hardcode commands
2022-09-14 08:13:41 +09:00
BBOOXX
77fcf9b2c2 chore(volar): update volar executable name (#4308)
see: johnsoncodehk/volar#876
see: johnsoncodehk/volar/blob/master/packages/vue-language-server/package.json#L11
2022-09-11 11:07:01 +09:00
Dirk Jonker
1458b8749c Deno: find project root using deno.json/deno.jsonc (#4306)
Deno LSP automatically detects config files named deno.json or
deno.jsonc since version 1.18.

For Deno 1.18+ this means that ALE no longer needs to resolve the
project root. However, removing the project root logic from ALE means
breaking changes for people that are still using an older version.
Adding deno.json to the list of looking files to look for will keep the
behavior consistent and compatible with the Deno config file naming
convention.

See also:
https://deno.com/blog/v1.18#auto-discovery-of-the-config-file
2022-09-11 10:57:03 +09:00
Horacio Sanson
a51fd9daba Add gitlablint support (#3042) 2022-09-11 10:53:33 +09:00
Horacio Sanson
9e8920b336 Fix 4155 - Show error when project root not found (#4207) 2022-09-11 10:51:27 +09:00
Guangqing Chen
477ad3fdd2 Allow to pass options to the buf linter and fix callback. (#4300)
* Allow to pass options to the buf linter

* Fix the callback of buf linter
2022-09-08 17:04:17 +09:00
D. Ben Knoble
e99f262c2f omni: find last racket keyword for completion (#4293)
Otherwise it finds the first keyword, which is usually not relevant to the
cursor position, and incorrectly calculates the completion position.
2022-09-08 16:57:43 +09:00
Nate Pinsky
a83a3659ac Fix typo in plug mapping for ale_go_to_implementation_in_vsplit (#4304) 2022-09-08 16:53:42 +09:00
Magnus Groß
9feba1148c Implement buffer-wide virtual text support (#4289)
* Remove virtual text via types-filter

This is more robust and has the additional sideeffect that it will make
it easier to implement showing virtual text for all warnings
simultaneously.

We definitely do not want to do a call to prop_remove() for every
virtual text as that will cause noticeable lag when many warnings are
present, thus we can use this to remove all virtual text lines with one
call in the future.

Fixes #4294

refs: https://github.com/vim/vim/pull/10945

* Allow virtual text to appear for all warnings of the buffer

This can be enabled with:

let g:ale_virtualtext_cursor = 2

It is implemented both for neovim and vim 9.0.0297.

Note that sometimes it may appear like some warnings are displayed
multiple times. This is not a bug in the virtual text implementation,
but a sideeffect of multiple linters returning similar results.

For example for Rust, the 'cargo' and 'rls' linters appear to be
activated at the same time, but they sometimes return identical errors.
This causes the virtual text to show the same warning twice.

In the future we can mitigate this problem by removing duplicate errors
from our internal location list.

However users can also achieve cleaner warnings simply by activating
only one linter for each language (or multiple unambiguous linters).

For example for Rust, the problem could be solved with:

let g:ale_linters = {'rust': ['analyzer']}

Fixes #2962
Fixes #3666
2022-09-07 19:38:01 +09:00
Magnus Groß
4943b7d39f Fix virtual text for vim 8.2 (#4291)
Regression was introduced in d93bc2baf7

The problem was that we did not handle the edge case where there is no
last popup to close, which caused old vim versions to enter code by
accident that was only supposed to be run by vim 9.

We fix this by guarding the if condition for vim 9.

Fixes #4290
2022-09-06 19:35:13 +09:00
Shaun Duncan
6996d1c14d Allow callbacks for floating preview popups (#4247)
* Add extra config options for virtualtext

* Undo virtualtext changes and move to floating preview

* revert changes to pass hightlight group to floating preview

* rename var

* Document changes

* Add updates based on feedback

* Check for string type and attempt to call the function

* Fix lint errors

Co-authored-by: Shaun Duncan <shaun@speedscale.com>
2022-08-23 20:22:52 +09:00
Magnus Groß
d93bc2baf7 Use native virtual-text for vim9 (#4281)
Our current virtual text implementation for vim emulates it by abusing
the textprop and popupwin feature from vim 8.2 (for more details see
commit 708e810414).
This implementation sometimes is janky, for example the popups may leak
into other vim windows next to the current window.

Luckily, vim just got native virtual-text support as a proper subtype to
the prop_add() function. By using the 'text' option, the text property
automatically becomes virtual text that is appended to the current line
if col is zero.

Note that the prop_add() method now returns negative IDs for virtual
text properties.

This feature was added in vim 9.0.0067, but it got a lot of bugfixes
which is why we only use this new API if vim has at least version
9.0.0214.
However, there are still some minor bugs with vim's native virtual text,
so we might have to bump the version check again in the future.

Also see #3906.

Now with proper virtual text support for both vim and neovim available,
we can tackle #2962 in the future by simply tracking multiple virt-texts
instead of just the last one.

In the future we might also want to disable our virtual text emulation
support for vim, as it is a total hack, but for now we should keep it
for backwards compatibility.
2022-08-23 20:22:14 +09:00
Erik Westrup
992476982a Put :ALEInfo in collapsible for bug reports (#4286)
To make the bug reports a bit more readable. See an example of usage
here: https://github.com/dense-analysis/ale/issues/4285
2022-08-18 06:51:01 +09:00
Hongbo Liu
7889983f89 fix #4276: honor b:ale_enabled for hover at cursor (#4277)
* fix #4276: honor b:ale_enabled for hover at cursor

* fix indention
2022-08-18 06:34:34 +09:00
Mo Lawson
233b681029 Add support for syntax_tree fixer (#4268)
This is the library that now powers prettier/plugin-ruby but is also
stands on its own: https://github.com/ruby-syntax-tree/syntax_tree
2022-08-09 21:11:20 +09:00
Nathan Henrie
5063804d44 Add openscad and sca2d support (#4205) 2022-08-07 16:27:17 +09:00
Tomáš Janoušek
e10fcf22dc Prevent buffering of job output and excessive polling (#4259)
When 'close_cb' is set for job_start(), but out_cb or err_cb isn't, vim
buffers data instead of dropping it (in case someone wanted to read and
process it in close_cb), and additionally polls for new data every 10
milliseconds, causing excessive wakeups and CPU usage. Since we don't
read the data anywhere outside of out_cb/err_cb, any LSP that prints an
error to stderr triggers this and vim keeps spinning until :ALEStopAllLSPs.

Fix this by always setting both callbacks, thus dropping any data we're
not interested in.

See https://github.com/vim/vim/issues/10758 for an upstream report of
the excessive polling. It's possible this is intentional, I dunno.

Fixes: b42153eb17 ("Fix #4098 - Clear LSP data when servers crash")
2022-07-26 17:56:12 +09:00
Albert Peschar
854d606333 Add support for Dune (#4263)
* Add support for dune

* Add test

* Undo reformatting of Markdown file

* Refer to ale-ocaml-dune from ale.txt
2022-07-26 17:55:22 +09:00
0xHyoga
0ea53870b6 cairo support (#4256)
* cairo support

* supported languages txt

* add cairo to ale.txt
2022-07-22 13:05:08 +09:00
Horacio Sanson
5ef26c32da Fix 4249 - Revert change to stop compl menu. (#4250)
In #4231 some code was added to stop the completion menu if any when
opening a new one. This resulted in an issue in Vim that fills the
buffer with Ctrl-Z characters when deleting to the end of a line in a
position that triggers auto-completion.

Since auto-completion seems to work fine on all my tests I am reverting
this specific change.
2022-07-14 07:25:42 +09:00
Michael Dyrynda
ad2f75e4b2 Add support for Laravel Pint (#4238)
* add support, docs, tests for Laravel Pint

* fix php-cs-fixer link

* add missing project-without-pint

* fix indentation

* fix pint executable in pint fixer test

* fix variables, docs related to pint support
2022-07-07 21:42:21 +09:00
Marios S
a918f8c7bc Improve struct and pointer autocompletion in C (#4231)
* Add explicit trigger characters for C (#4226)

* Stop completion before issuing subsequent requests (#4226)

Co-authored-by: Marios Sioutis <26476573+s-marios@users.noreply.github.com>
2022-07-04 22:00:29 +09:00
Henrique Barcelos
d6f3d4976d Allow shfmt fixer to use .editorconfig (#4244)
* fix: added support for local solhint executable

* feat: added support for matching parse errors

* test: added test for solhint command callback and handler

* chore: removed command callback test

* refactor: made solhint handler structure closer to eslint

* refactor(shfmt-fixer): remove derivation of default CLI arguments
2022-07-02 22:05:03 +09:00
Horacio Sanson
16cca1413f Update tests to use latest neovim 0.7 (#4180)
* Update tests to use latest neovim 0.7

* Update CI to use neovim 0.7

* Fix conflict
2022-06-29 13:17:00 +09:00
Steven Leiva
39d1a10589 Update ale-haskell.txt (#4241)
Change `b:ale_haskell_his_executable` to `b:ale_haskell_hls_executable`.
2022-06-26 16:04:59 +09:00
Gabriel Remus
4a0d669c0a Show warnings for dart_analyze linter (#4237) 2022-06-25 00:18:08 +09:00
D. Ben Knoble
0e99519500 racket: start completion in a full keyword (#4186)
The default `omni_start_map` is too restrictive for Lisps and Schemes
like Racket, which permit hyphens (among other special characters).

As recorded in #3870, trying to complete `file-name-from-path` when
typing `file-name<C-x><C-o>` would give completions like `namespace`
because the hyphen is ignored to find the start of the word for
completion.

Now the racket filetype searches for the start using the keyword class
`\k`, which is more precise.
2022-06-23 09:13:28 +09:00
infokiller
91e8422d6d Add pyflyby fixer (using its tidy-imports script) (#4219)
* add pyflyby fixer

updates

* pyflyby: add docs

updates

* add tests to pyflyby fixer
2022-06-16 22:41:57 +09:00
w0rp
f10349b48b Replace gitter badge with Discord 2022-06-08 15:26:25 +01:00
w0rp
9e1089c38d Recommend Discord instead of IRC, actually 2022-06-08 15:22:21 +01:00
Danny (he/him)
f6d7aa4f0f Fix README typo (#4225) 2022-06-06 22:58:11 +09:00
Paul Thompson
9bdc923624 re-worded confusing grammar (#4223) 2022-06-04 15:58:36 +09:00
Isman Firmansyah
876140832c Add support for actionlint options (#4216)
* Add support for actionlint options

* fix misaligned doc tags
2022-05-29 22:23:47 +09:00
Devin J. Pohly
ae44f05600 Allow customization of all floating window borders (#4215)
* Allow customization of all floating window borders

Users may not necessarily want the same border character for top+bottom
or left+right, so allow all eight border characters to be configured in
g:ale_floating_window_border.

For backwards compatibility, the old rules are still applied if only six
elements are given.

* Reorder popup border array for compatibility
2022-05-27 13:41:06 +09:00
Arash Mousavi
3d7b3a6541 Add zig fmt support (#4198)
* Add zig fmt support

* Review changes

* Fix linter errors
2022-05-17 07:38:54 +09:00
Michał Padula
e343148e80 Fallback to summary field if detail exists but is empty in terraform linter (#4157)
* Fallback to summary field if detail exists but is empty in terraform linter

* Add test

* Update terraform.vim

* remove whitespaces
2022-05-17 00:00:34 +09:00
Zhuoyun Wei
429f5a1447 Add support for Packer (#4192)
* Add support for HashiCorp Packer

* Add test for packer fmt

* Add doc for HCL/Packer

* Add link to Packer doc

* Also suggest packer fix for packer ft

* Add more links to TOC
2022-05-16 21:15:52 +09:00
Krishnakumar Gopalakrishnan, PhD
b611fde718 fixes cpplint url in supported-tools.md (#4204) 2022-05-16 21:15:09 +09:00
Reza J. Bavaghoush
75d2413425 add rego support (#4199)
* add opa fmt fixer for rego files

* add opa linter

* add basic tests for linter and fixer

* add cspell to the docs
2022-05-16 21:14:11 +09:00
James C. Davis
5479b58660 support ember-template-lint 4.x (#4200)
* support ember-template-lint 4.x

* update ember-template-lint linter test
2022-05-15 12:44:23 +09:00
Fionn Fitzmaurice
e6ca599e87 Look for .mypy.ini when finding project root (#4202)
We already check for mypy.ini, but the fallback .mypy.ini was ignored.
2022-05-15 12:20:16 +09:00
w0rp
044a6c956b Close #4201 - Run vimls from Vader by default 2022-05-13 18:00:19 +01:00
w0rp
e3e940a7fe Update Vim versions mentioned in ale-development.txt 2022-05-13 17:47:15 +01:00
Matt Perry
14265e464a Add support for ansible-lint 6.0.0 (#4189)
ansible-lint 6.0.0 removed the `--parseable-severity` option. Use the
JSON output in its place.

Fixes #4188
2022-05-09 20:27:21 +09:00
Richard Jonas
9e1351499c Handle golangci_lint warning and error messages correctly (#4182)
* Handle golangci_lint warning and error messages correctly

* Fix linter warning

Co-authored-by: Richard Jonas <richard.jonas@derivco.se>
2022-05-04 20:05:32 +09:00
zandr
4e6a7debb4 Use stdin for Selene Lua linter (#4183)
When I added Selene as a linter, I wasn't aware it had the option to
process stdin using `-`.
2022-05-04 10:55:13 +09:00
bretello
323e2c0b6f fix docs for actionlint (#4181)
Co-authored-by: bretello <bretello@distruzione.org>
2022-05-04 10:53:59 +09:00
Horacio Sanson
204e6294cf Fix 4177 set default yaml linters (#4178)
* Fix 4177 set default yaml linters

* Fix 4177 set default yaml linters
2022-05-03 10:34:52 +09:00
bretello
c694a24188 add yaml actionlint support (github actions) (#4173)
Co-authored-by: bretello <bretello@distruzione.org>
2022-05-03 10:03:05 +09:00
Dalius Dobravolskas
56399106fc VSCode LSPs for CSS, HTML and JSON (#4175)
Switched to `vscode-langservers-extracted` as it is the one most
up-to-date.
2022-05-02 19:42:24 +09:00
Dalius Dobravolskas
34892186e4 vscode-json-languageserver support (#4164)
* vscode-json-languageserver-bin support

VSCode JSON languageserver has schema support for linting and
completions.

I have enabled snippets support (`snippetSupport`) even if it is not
fully supported. `label` that comes with completions response can be
used as well.

* Test fix.

* vscode-json-languageserver instead of vscode-json-languageserver-bin

vscode-json-languageserver is more up-to-date (about 1 year old),
vscode-json-languageserver-bin is 4 years old.

* Use git root.

* Documentation update.

* Trying to sort ordering issue.

* One more attempt

* One more attempt

* Uppercase seems to win.

* Clean-up

* Clean-up 2

* Test removed.
2022-04-30 12:33:48 +09:00
godbless
d484347fb5 Add ALEGoToImplementation (#4160)
* Add go to implementation

* Add test cases for GoToImplementation

* Add documentation for GoToImplementation
2022-04-30 12:28:26 +09:00
zandr
57e16957e0 Add support for selene Lua linter (#4169) 2022-04-30 11:11:12 +09:00
godbless
3348222abc Add CodeAction codeActionLiteralSupport Feature (#4163)
* Advertise codeActionLiteralSupport to LSP server

Without this, rust-analyzer doesn't return any code actions.  With it,
everything works properly.

* linter fixes

* test cases fixes

* Fix underflow of column in position.

Special values like for example -1 to denote the end of a line are not supported.
[reference](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#position)

Co-authored-by: Brian Gernhardt <brian@gernhardtsoftware.com>
2022-04-29 22:17:29 +09:00
Diep Pham
6c51bb1573 Improve pylama linter output handling (#4106)
* Use JSON format for newer pylama version

https://github.com/klen/pylama/blob/develop/Changelog

The --format json option is added in pylama version 8.1.4.

* Fix linting warnings for pylama
2022-04-24 08:28:33 +09:00
Horacio Sanson
e2ef4d91ee Fix 3837 - update test to use latest vim 8.2 (#4147) 2022-04-20 22:07:25 +09:00
Alex McKinney
607f33a1b0 Add buf linter and fixer (#4128)
* Add buf lint to linters

* Add buf format to fixers

* Fix test/linter/test_buf_lint.vader

* Fix test/fixers/test_buf_format_fixer_callback.vader

* Simplify test/test-files/proto/testfile.proto

* Add buf-lint alias and rename linter
2022-04-06 17:00:59 +09:00
lykmast
1e997580fd Handle ghc panic in haskell (#4145)
* Add primitive handling of ghc panic.

* PascalCase in function.

* Add simple test.
2022-04-06 16:59:50 +09:00
James Cherti
6c1f616c59 Add the buffer-local options 'b:ale_shell' and 'b:ale_shell_arguments'. (#4146) 2022-04-06 14:32:11 +09:00
Horacio Sanson
c984daa0ec Fix 4141 - Stop press enter prompt on long diagnostic messages (#4144)
* Fix 4141 - Stop press enter prompt on long diagnostic messages

* Fix 4139 - Check for array before join truncated_echo
2022-04-06 10:51:07 +09:00
Satoshi Matsubara
cae550f07b Update help for ale_go_staticcheck_lint_package (#4122) 2022-04-05 21:25:42 +09:00
w0rp
d3df00b898 Fix test for echoing messages
The previous linter rule about stray echo lines has been restored, and
now all problems for custom linting rules can be ignored by adding a
comment above problem lines.
2022-04-01 14:35:07 +01:00
Amadeus Demarzi
b3d1d6eecf Use echon over echom for cursor echo (#3888)
* Problem messages no longer clutter `:messages`
* Messages are truncated better
2022-04-01 13:54:23 +01:00
João Costa
bc406a846e Set default value for insertTextFormat (#4124)
Co-authored-by: w0rp <devw0rp@gmail.com>
2022-04-01 12:41:05 +00:00
Horacio Sanson
0f55d371e9 Add neovim 0.6 to run-tests (#3998)
* Update test scripts
* Remove neovim 0.3 and 0.4
* Add neovim 0.6.1

Co-authored-by: Horacio Sanson <horacio@allm.inc>
Co-authored-by: w0rp <devw0rp@gmail.com>
2022-04-01 13:17:15 +01:00
Felix Maurer
e81f005c78 Fix end line number when it exceeds the file (#4130)
If the end of the error exceeds the file, set it to the last line,
similarly as it is done with the beginning of the error.
2022-04-01 17:13:27 +09:00
Felix Maurer
80dcd648d3 rust-analyzer for non-Cargo projects (#4118)
* rust-analyzer in non-cargo projects

rust-analyzer can also be used in non-cargo projects. This requires a
rust-project.json file in the project root [1].

Make the rust-analyzer linter search for a rust-project.json file if no
Cargo.toml file could be found.

[1]: https://rust-analyzer.github.io/manual.html#non-cargo-based-projects

* Document rust-analyzer without cargo

* Test rust-analyzer with non-cargo projects

Change the other rust tests to match the new directory structure of the
test files.
2022-03-23 10:56:29 +09:00
Barnabás Ágoston
5c7019f394 Make it possible to override awk --lint option (#4114)
Currently, it's not possible to override the awk `--lint` option with

```viml
let g:ale_awk_gawk_options = '--lint=no-ext'
```

although this could be useful for those who only use gawk and don't want to get these lint errors:
> FEATURE X is a gawk extension

The idea is to move the default `--lint` option before the `awk_gawk_options` in the gawk.vim code to give the custom `--lint=...` option a higher precedence.

Co-authored-by: Barnabás Ágoston <barna@agoston.dev>
2022-03-20 13:52:22 +00:00
yoshi1123
c42fee3da5 Fix :ALEImport column position
Fix :ALEImport column position so it works with more language servers.

Co-authored-by: w0rp <devw0rp@gmail.com>
2022-03-20 13:20:33 +00:00
853 changed files with 24490 additions and 6354 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -40,7 +40,9 @@ Are you having trouble configuring ALE? Try asking for help on [Stack Exchange](
2. Then this happened.
### :ALEInfo
<!-- Paste the output of :ALEInfo here. Try :ALEInfoToClipboard -->
<details>
<summary>Expand</summary>
<!-- 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>

View File

@@ -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:
@@ -27,12 +27,12 @@ jobs:
matrix:
vim-version:
- '--vim-80-only'
- '--vim-82-only'
- '--neovim-02-only'
- '--neovim-04-only'
- '--neovim-05-only'
- '--vim-90-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
View 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
}

View File

@@ -1,12 +1,11 @@
FROM testbed/vim:20
ARG TESTBED_VIM_VERSION=24
RUN install_vim -tag v8.0.0027 -build \
-tag v8.2.2401 -build \
-tag neovim:v0.2.0 -build \
-tag neovim:v0.4.4 -build \
-tag neovim:v0.5.0 -build
FROM testbed/vim:${TESTBED_VIM_VERSION}
ENV PACKAGES="\
lua5.1 \
lua5.1-dev \
lua5.1-busted \
bash \
git \
python2 \
@@ -18,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 && \
@@ -25,4 +29,4 @@ RUN git clone https://github.com/junegunn/vader.vim vader && \
ARG GIT_VERSION
LABEL Version=${GIT_VERSION}
LABEL Name=w0rp/ale
LABEL Name=denseanalysis/ale

View File

@@ -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

666
README.md
View File

@@ -1,15 +1,16 @@
# Asynchronous Lint Engine [![GitHub Build Status](https://github.com/dense-analysis/ale/workflows/CI/badge.svg)](https://github.com/dense-analysis/ale/actions?query=event%3Apush+workflow%3ACI+branch%3Amaster++) [![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/r0ef1xu8xjmik58d/branch/master?svg=true)](https://ci.appveyor.com/project/dense-analysis/ale) [![Join the chat at https://gitter.im/vim-ale/Lobby](https://badges.gitter.im/vim-ale/Lobby.svg)](https://gitter.im/vim-ale/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
# Asynchronous Lint Engine
[![Vim](https://img.shields.io/badge/VIM-%2311AB00.svg?style=for-the-badge&logo=vim&logoColor=white)](https://www.vim.org/) [![Neovim](https://img.shields.io/badge/NeoVim-%2357A143.svg?&style=for-the-badge&logo=neovim&logoColor=white)](https://neovim.io/) [![CI](https://img.shields.io/github/actions/workflow/status/dense-analysis/ale/main.yml?branch=master&label=CI&logo=github&style=for-the-badge)](https://github.com/dense-analysis/ale/actions?query=event%3Apush+workflow%3ACI+branch%3Amaster++) [![AppVeyor Build Status](https://img.shields.io/appveyor/build/dense-analysis/ale?label=Windows&style=for-the-badge)](https://ci.appveyor.com/project/dense-analysis/ale) [![Join the Dense Analysis Discord server](https://img.shields.io/badge/chat-Discord-5865F2?style=for-the-badge&logo=appveyor)](https://discord.gg/5zFD6pQxDk)
![ALE Logo by Mark Grealish - https://www.bhalash.com/](https://user-images.githubusercontent.com/3518142/59195920-2c339500-8b85-11e9-9c22-f6b7f69637b8.jpg)
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.iiii. 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)
@@ -386,16 +331,14 @@ If you are interested in the general direction of the project, check out the
[wiki home page](https://github.com/dense-analysis/ale/wiki). The wiki includes
a Roadmap for the future, and more.
If you'd liked to discuss the project more directly, check out the `#vim-ale` channel
on Libera Chat. Web chat is available [here](https://web.libera.chat/#vim-ale).
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:
![Echoed message](https://user-images.githubusercontent.com/3518142/59195927-348bd000-8b85-11e9-88b6-508a094f1548.png)
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.
![Echoed message](https://user-images.githubusercontent.com/3518142/59195927-348bd000-8b85-11e9-88b6-508a094f1548.png)
```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([''], 6)
```
<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.

View File

@@ -18,9 +18,40 @@ function! ale_linters#ansible#ansible_lint#Handle(buffer, version, lines) abort
endif
endfor
let l:version_group = ale#semver#GTE(a:version, [5, 0, 0]) ? '>=5.0.0' : '<5.0.0'
let l:version_group = ale#semver#GTE(a:version, [6, 0, 0]) ? '>=6.0.0' :
\ ale#semver#GTE(a:version, [5, 0, 0]) ? '>=5.0.0' :
\ '<5.0.0'
let l:output = []
if '>=6.0.0' is# l:version_group
let l:error_codes = { 'blocker': 'E', 'critical': 'E', 'major': 'W', 'minor': 'W', 'info': 'I' }
let l:linter_issues = ale#util#FuzzyJSONDecode(a:lines, [])
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: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,
\ 'type': l:error_codes[l:issue.severity],
\})
endif
endfor
endif
if '>=5.0.0' is# l:version_group
" Matches patterns line the following:
" test.yml:3:148: syntax-check 'var' is not a valid attribute for a Play
@@ -73,10 +104,13 @@ endfunction
function! ale_linters#ansible#ansible_lint#GetCommand(buffer, version) abort
let l:commands = {
\ '>=6.0.0': '%e --nocolor -f json -x yaml %s',
\ '>=5.0.0': '%e --nocolor --parseable-severity -x yaml %s',
\ '<5.0.0': '%e --nocolor -p %t'
\}
let l:command = ale#semver#GTE(a:version, [5, 0]) ? l:commands['>=5.0.0'] : l:commands['<5.0.0']
let l:command = ale#semver#GTE(a:version, [6, 0]) ? l:commands['>=6.0.0'] :
\ ale#semver#GTE(a:version, [5, 0]) ? l:commands['>=5.0.0'] :
\ l:commands['<5.0.0']
return l:command
endfunction

View File

@@ -0,0 +1,47 @@
" Author: Horacio Sanson <https://github.com/hsanson>
" Description: Support ansible language server https://github.com/ansible/ansible-language-server/
call ale#Set('ansible_language_server_executable', 'ansible-language-server')
call ale#Set('ansible_language_server_config', {})
function! ale_linters#ansible#language_server#Executable(buffer) abort
return ale#Var(a:buffer, 'ansible_language_server_executable')
endfunction
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#language_server#FindProjectRoot(buffer) abort
let l:dir = fnamemodify(
\ ale#path#FindNearestFile(a:buffer, 'ansible.cfg'),
\ ':h'
\)
if l:dir isnot# '.' && isdirectory(l:dir)
return l:dir
endif
let l:dir = fnamemodify(
\ ale#path#FindNearestDirectory(a:buffer, '.git'),
\ ':h:h'
\)
if l:dir isnot# '.' && isdirectory(l:dir)
return l:dir
endif
return ''
endfunction
call ale#linter#Define('ansible', {
\ 'name': 'language_server',
\ 'aliases': ['ansible_language_server', 'ansible-language-server'],
\ 'lsp': 'stdio',
\ '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')}
\})

View 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',
\})

View 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',
\})

View File

@@ -1,5 +1,5 @@
" Author: kmarc <korondi.mark@gmail.com>
" Description: This file adds support for using GNU awk with sripts.
" Description: This file adds support for using GNU awk with scripts.
call ale#Set('awk_gawk_executable', 'gawk')
call ale#Set('awk_gawk_options', '')
@@ -9,8 +9,9 @@ function! ale_linters#awk#gawk#GetCommand(buffer) abort
" gawk from attempting to execute the body of the script
" it is linting.
return '%e --source ' . ale#Escape('BEGIN { exit } END { exit 1 }')
\ . ' --lint'
\ . ale#Pad(ale#Var(a:buffer, 'awk_gawk_options'))
\ . ' -f %t --lint /dev/null'
\ . ' -f %t /dev/null'
endfunction
call ale#linter#Define('awk', {

View 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,
\})

View File

@@ -0,0 +1,65 @@
" Author: Carl Smedstad <carl.smedstad at protonmail dot com>
" Description: bicep for bicep files
let g:ale_bicep_bicep_executable =
\ get(g:, 'ale_bicep_bicep_executable', 'bicep')
let g:ale_bicep_bicep_options =
\ get(g:, 'ale_bicep_bicep_options', '')
function! ale_linters#bicep#bicep#Executable(buffer) abort
return ale#Var(a:buffer, 'bicep_bicep_executable')
endfunction
function! ale_linters#bicep#bicep#Command(buffer) abort
let l:executable = ale_linters#bicep#bicep#Executable(a:buffer)
let l:options = ale#Var(a:buffer, 'bicep_bicep_options')
if has('win32')
let l:nullfile = 'NUL'
else
let l:nullfile = '/dev/null'
endif
return ale#Escape(l:executable)
\ . ' build --outfile '
\ . l:nullfile
\ . ' '
\ . l:options
\ . ' %s'
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:output = []
for l:match in ale#util#GetMatches(a:lines, l:pattern)
if l:match[4] is# 'Error'
let l:type = 'E'
elseif l:match[4] is# 'Warning'
let l:type = 'W'
else
let l:type = 'I'
endif
call add(l:output, {
\ 'filename': l:match[1],
\ 'lnum': l:match[2] + 0,
\ 'col': l:match[3] + 0,
\ 'type': l:type,
\ 'code': l:match[5],
\ 'text': l:match[6],
\})
endfor
return l:output
endfunction
call ale#linter#Define('bicep', {
\ 'name': 'bicep',
\ 'executable': function('ale_linters#bicep#bicep#Executable'),
\ 'command': function('ale_linters#bicep#bicep#Command'),
\ 'callback': 'ale_linters#bicep#bicep#Handle',
\ 'output_stream': 'both',
\ 'lint_file': 1,
\})

View 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'),
\})

View File

@@ -3,6 +3,8 @@
call ale#Set('c_cc_executable', '<auto>')
call ale#Set('c_cc_options', '-std=c11 -Wall')
call ale#Set('c_cc_use_header_lang_flag', -1)
call ale#Set('c_cc_header_exts', ['h'])
function! ale_linters#c#cc#GetExecutable(buffer) abort
let l:executable = ale#Var(a:buffer, 'c_cc_executable')
@@ -31,12 +33,24 @@ function! ale_linters#c#cc#GetCommand(buffer, output) abort
\ 'g')
endif
" Select the correct language flag depending on the executable, options
" and file extension
let l:executable = ale_linters#c#cc#GetExecutable(a:buffer)
let l:use_header_lang_flag = ale#Var(a:buffer, 'c_cc_use_header_lang_flag')
let l:header_exts = ale#Var(a:buffer, 'c_cc_header_exts')
let l:lang_flag = ale#c#GetLanguageFlag(
\ a:buffer,
\ l:executable,
\ l:use_header_lang_flag,
\ l:header_exts,
\ 'c')
" -iquote with the directory the file is in makes #include work for
" headers in the same directory.
"
" `-o /dev/null` or `-o null` is needed to catch all errors,
" -fsyntax-only doesn't catch everything.
return '%e -S -x c'
return '%e -S -x ' . l:lang_flag
\ . ' -o ' . g:ale#util#nul_file
\ . ' -iquote %s:h'
\ . ale#Pad(l:cflags)

View 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
View 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')},
\})

View 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,
\})

View 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',
\})

View File

@@ -0,0 +1,39 @@
" Author: 0xHyoga <0xHyoga@gmx.com>
" 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', '')
function! ale_linters#cairo#starknet#Handle(buffer, lines) abort
" Error always on the first line
" e.g ex01.cairo:20:6: Could not find module 'contracts.utils.ex00_base'. Searched in the following paths:
let l:pattern = '\v\.cairo:(\d+):(\d+):+ (.*)'
let l:output = []
for l:match in ale#util#GetMatches(a:lines, l:pattern)
call add(l:output, {
\ 'lnum': str2nr(l:match[1]),
\ 'col': str2nr(l:match[2]),
\ 'type': 'E',
\ 'text': l:match[3],
\})
endfor
return l:output
endfunction
function! ale_linters#cairo#starknet#GetCommand(buffer) abort
let l:executable = ale#Var(a:buffer, 'cairo_starknet_executable')
return l:executable . ale#Pad(ale#Var(a:buffer, 'cairo_starknet_options')) . ' %s'
endfunction
call ale#linter#Define('cairo', {
\ 'name': 'starknet',
\ 'executable': {b -> ale#Var(b, 'cairo_starknet_executable')},
\ 'command': function('ale_linters#cairo#starknet#GetCommand'),
\ 'callback': 'ale_linters#cairo#starknet#Handle',
\ 'output_stream': 'stderr',
\})

View File

@@ -8,7 +8,8 @@ function! ale_linters#clojure#clj_kondo#GetCommand(buffer) abort
let l:command = 'clj-kondo'
\ . ale#Pad(l:options)
\ . ' --lint %t'
\ . ' --lint -'
\ . ' --filename %s'
return l:command
endfunction

View File

@@ -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

View File

@@ -3,6 +3,8 @@
call ale#Set('cpp_cc_executable', '<auto>')
call ale#Set('cpp_cc_options', '-std=c++14 -Wall')
call ale#Set('cpp_cc_use_header_lang_flag', -1)
call ale#Set('cpp_cc_header_exts', ['h', 'hpp'])
function! ale_linters#cpp#cc#GetExecutable(buffer) abort
let l:executable = ale#Var(a:buffer, 'cpp_cc_executable')
@@ -31,12 +33,24 @@ function! ale_linters#cpp#cc#GetCommand(buffer, output) abort
\ 'g')
endif
" Select the correct language flag depending on the executable, options
" and file extension
let l:executable = ale_linters#cpp#cc#GetExecutable(a:buffer)
let l:use_header_lang_flag = ale#Var(a:buffer, 'cpp_cc_use_header_lang_flag')
let l:header_exts = ale#Var(a:buffer, 'cpp_cc_header_exts')
let l:lang_flag = ale#c#GetLanguageFlag(
\ a:buffer,
\ l:executable,
\ l:use_header_lang_flag,
\ l:header_exts,
\ 'c++')
" -iquote with the directory the file is in makes #include work for
" headers in the same directory.
"
" `-o /dev/null` or `-o null` is needed to catch all errors,
" -fsyntax-only doesn't catch everything.
return '%e -S -x c++'
return '%e -S -x ' . l:lang_flag
\ . ' -o ' . g:ale#util#nul_file
\ . ' -iquote %s:h'
\ . ale#Pad(l:cflags)

View File

@@ -26,7 +26,7 @@ function! ale_linters#cpp#clangtidy#GetCommand(buffer, output) abort
" Tell clang-tidy a .h header with a C++ filetype in Vim is a C++ file
" only when compile-commands.json file is not there. Adding these
" flags makes clang-tidy completely ignore compile commmands.
" flags makes clang-tidy completely ignore compile commands.
if expand('#' . a:buffer) =~# '\.h$'
let l:options .= !empty(l:options) ? ' -x c++' : '-x c++'
endif

View File

@@ -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',
\ ])},

View File

@@ -0,0 +1,16 @@
" Author: Dalius Dobravolskas <dalius.dobravolskas@gmail.com>
" Description: VSCode css language server
function! ale_linters#css#vscodecss#GetProjectRoot(buffer) abort
let l:git_path = ale#path#FindNearestDirectory(a:buffer, '.git')
return !empty(l:git_path) ? fnamemodify(l:git_path, ':h:h') : ''
endfunction
call ale#linter#Define('css', {
\ 'name': 'vscodecss',
\ 'lsp': 'stdio',
\ 'executable': 'vscode-css-language-server',
\ 'command': '%e --stdio',
\ 'project_root': function('ale_linters#css#vscodecss#GetProjectRoot'),
\})

View File

@@ -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',

View File

@@ -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', {

View File

@@ -4,15 +4,16 @@
call ale#Set('dart_analyze_executable', 'dart')
function! ale_linters#dart#dart_analyze#Handle(buffer, lines) abort
let l:pattern = '\v^ ([a-z]+) - (.+):(\d+):(\d+) - (.+) - (.+)$'
let l:pattern = '\v([a-z]+) - (.+):(\d+):(\d+) - (.+) - (.+)$'
let l:output = []
for l:match in ale#util#GetMatches(a:lines, l:pattern)
let [l:type, l:filename, l:lnum, l:col, l:message, l:code] = l:match[1:6]
call add(l:output, {
\ 'type': l:match[1] is# 'error' ? 'E' : 'W',
\ 'text': l:match[6] . ': ' . l:match[5],
\ 'lnum': str2nr(l:match[3]),
\ 'col': str2nr(l:match[4]),
\ 'type': l:type is# 'error' ? 'E' : l:type is# 'info' ? 'I' : 'W',
\ 'text': l:code . ': ' . l:message,
\ 'lnum': str2nr(l:lnum),
\ 'col': str2nr(l:col),
\})
endfor
@@ -22,7 +23,7 @@ endfunction
call ale#linter#Define('dart', {
\ 'name': 'dart_analyze',
\ 'executable': {b -> ale#Var(b, 'dart_analyze_executable')},
\ 'command': '%e analyze %s',
\ 'command': '%e analyze --fatal-infos %s',
\ 'callback': 'ale_linters#dart#dart_analyze#Handle',
\ 'lint_file': 1,
\})

View 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',
\})

View File

@@ -3,6 +3,7 @@
" always, yes, never
call ale#Set('dockerfile_hadolint_use_docker', 'never')
call ale#Set('dockerfile_hadolint_docker_image', 'hadolint/hadolint')
call ale#Set('dockerfile_hadolint_options', '')
function! ale_linters#dockerfile#hadolint#Handle(buffer, lines) abort
" Matches patterns line the following:
@@ -102,7 +103,7 @@ endfunction
function! ale_linters#dockerfile#hadolint#GetCommand(buffer) abort
let l:command = ale_linters#dockerfile#hadolint#GetExecutable(a:buffer)
let l:opts = '--no-color -'
let l:opts = ale#Var(a:buffer, 'dockerfile_hadolint_options') . ' --no-color -'
if l:command is# 'docker'
return printf('docker run --rm -i %s hadolint %s',

View File

@@ -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'),

View 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'),
\})

View File

@@ -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')
\})

View File

@@ -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,
\})

View File

@@ -0,0 +1,57 @@
" Author: Dmitri Vereshchagin <dmitri.vereshchagin@gmail.com>
" Description: LSP linter for Erlang files
call ale#Set('erlang_erlang_ls_executable', 'erlang_ls')
call ale#Set('erlang_erlang_ls_log_dir', '')
call ale#Set('erlang_erlang_ls_log_level', 'info')
function! s:GetCommand(buffer) abort
let l:log_dir = ale#Var(a:buffer, 'erlang_erlang_ls_log_dir')
let l:log_level = ale#Var(a:buffer, 'erlang_erlang_ls_log_level')
let l:command = '%e'
if !empty(l:log_dir)
let l:command .= ' --log-dir=' . ale#Escape(l:log_dir)
endif
let l:command .= ' --log-level=' . ale#Escape(l:log_level)
return l:command
endfunction
function! s:FindProjectRoot(buffer) abort
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.
let l:markers += ['.kerl_config']
for l:marker in l:markers
let l:path = l:marker[-1:] is# '/'
\ ? ale#path#FindNearestDirectory(a:buffer, l:marker)
\ : ale#path#FindNearestFile(a:buffer, l:marker)
if !empty(l:path)
return ale#path#Dirname(l:path)
endif
endfor
return ''
endfunction
call ale#linter#Define('erlang', {
\ 'name': 'erlang_ls',
\ 'executable': {b -> ale#Var(b, 'erlang_erlang_ls_executable')},
\ 'command': function('s:GetCommand'),
\ 'lsp': 'stdio',
\ 'project_root': function('s:FindProjectRoot'),
\ 'aliases': ['erlang-ls'],
\})

View File

@@ -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'),
\})

View File

@@ -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', {

View File

@@ -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',

View 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'),
\})

View 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')

View File

@@ -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',
\})

View File

@@ -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,

View File

@@ -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,33 +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\*?(.+)$'
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)
" l:match[1] will already be an absolute path, output from
" golangci_lint
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
call add(l:output, {
\ 'filename': ale#path#GetAbsPath(l:dir, l:match[1]),
\ 'lnum': l:match[2] + 0,
\ 'col': l:match[3] + 0,
\ 'type': 'E',
\ 'text': l:match[4],
\ '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': match['FromLinter'] . ' - ' . l:match['Text'],
\})
endfor

View File

@@ -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',
\})

View File

@@ -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,
\})

View File

@@ -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,
\})

View 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',
\})

View 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',
\})

View 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',
\})

View File

@@ -1,60 +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
" Reading from stdin was introduced in ember-template-lint@1.6.0
return ale#semver#GTE(a:version, [1, 6, 0])
\ ? '%e --json --filename %s'
\ : '%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')

View File

@@ -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

View File

@@ -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'),

View 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:

View 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',
\ })

View File

@@ -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',

View File

@@ -0,0 +1,16 @@
" Author: Dalius Dobravolskas <dalius.dobravolskas@gmail.com>
" Description: VSCode html language server
function! ale_linters#html#vscodehtml#GetProjectRoot(buffer) abort
let l:git_path = ale#path#FindNearestDirectory(a:buffer, '.git')
return !empty(l:git_path) ? fnamemodify(l:git_path, ':h:h') : ''
endfunction
call ale#linter#Define('html', {
\ 'name': 'vscodehtml',
\ 'lsp': 'stdio',
\ 'executable': 'vscode-html-language-server',
\ 'command': '%e --stdio',
\ 'project_root': function('ale_linters#html#vscodehtml#GetProjectRoot'),
\})

View 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',
\})

View 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',
\})

View 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',
\})

View File

@@ -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'),

View 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'),
\})

View File

@@ -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',

View 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',
\})

View 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'),
\})

View File

@@ -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 -> {

View File

@@ -0,0 +1,32 @@
" 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')
return !empty(l:git_path) ? fnamemodify(l:git_path, ':h:h') : ''
endfunction
call ale#linter#Define('json', {
\ 'name': 'vscodejson',
\ 'lsp': 'stdio',
\ 'executable': function('ale_linters#json#vscodejson#GetExecutable'),
\ 'command': '%e --stdio',
\ 'project_root': function('ale_linters#json#vscodejson#GetProjectRoot'),
\})

View 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'),
\})

View File

@@ -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'),

View File

@@ -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',

View File

@@ -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',
\ ])},

View 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')},
\})

View File

@@ -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

View File

@@ -0,0 +1,46 @@
call ale#Set('lua_selene_executable', 'selene')
call ale#Set('lua_selene_options', '')
function! ale_linters#lua#selene#GetCommand(buffer) abort
return '%e' . ale#Pad(ale#Var(a:buffer, 'lua_selene_options'))
\ . ' --display-style=json -'
endfunction
function! ale_linters#lua#selene#Handle(buffer, lines) abort
let l:output = []
for l:line in a:lines
" as of version 0.17.0, selene has no way to suppress summary
" information when outputting json, so stop processing when we hit it
" (PR for this here: https://github.com/Kampfkarren/selene/pull/356)
if l:line is# 'Results:'
break
endif
let l:json = json_decode(l:line)
let l:lint = {
\ 'lnum': l:json.primary_label.span.start_line + 1,
\ 'end_lnum': l:json.primary_label.span.end_line + 1,
\ 'col': l:json.primary_label.span.start_column + 1,
\ 'end_col': l:json.primary_label.span.end_column,
\ 'text': l:json.message,
\ 'code': l:json.code,
\ 'type': l:json.severity is# 'Warning' ? 'W' : 'E',
\}
if has_key(l:json, 'notes') && len(l:json.notes) > 0
let l:lint.detail = l:lint.text . "\n\n" . join(l:json.notes, "\n")
endif
call add(l:output, l:lint)
endfor
return l:output
endfunction
call ale#linter#Define('lua', {
\ 'name': 'selene',
\ 'executable': {b -> ale#Var(b, 'lua_selene_executable')},
\ 'command': function('ale_linters#lua#selene#GetCommand'),
\ 'callback': 'ale_linters#lua#selene#Handle',
\})

View File

@@ -1,5 +1,7 @@
" Author: aurieh - https://github.com/aurieh
call ale#Set('make_checkmake_config', '')
function! ale_linters#make#checkmake#Handle(buffer, lines) abort
let l:pattern = '\v^(\d+):(.+):(.+)$'
let l:output = []
@@ -17,9 +19,19 @@ function! ale_linters#make#checkmake#Handle(buffer, lines) abort
return l:output
endfunction
function! ale_linters#make#checkmake#GetCommand(buffer) abort
let l:config = ale#Var(a:buffer, 'make_checkmake_config')
let l:cmd = 'checkmake'
\ . ' --format="{{.LineNumber}}:{{.Rule}}:{{.Violation}}{{\"\r\n\"}}"'
\ . (!empty(l:config) ? ' --config="' . l:config . '"' : '')
\ . ' %s'
return l:cmd
endfunction
call ale#linter#Define('make', {
\ 'name': 'checkmake',
\ 'executable': 'checkmake',
\ 'command': 'checkmake %s --format="{{.LineNumber}}:{{.Rule}}:{{.Violation}}{{\"\r\n\"}}"',
\ 'command': function('ale_linters#make#checkmake#GetCommand'),
\ 'callback': 'ale_linters#make#checkmake#Handle',
\})

View File

@@ -1,10 +1,15 @@
" Author: Ty-Lucas Kelley <tylucaskelley@gmail.com>
" Description: Adds support for markdownlint
call ale#Set('markdown_markdownlint_executable', 'markdownlint')
call ale#Set('markdown_markdownlint_options', '')
function! ale_linters#markdown#markdownlint#GetExecutable(buffer) abort
return ale#Var(a:buffer, 'markdown_markdownlint_executable')
endfunction
function! ale_linters#markdown#markdownlint#GetCommand(buffer) abort
let l:executable = 'markdownlint'
let l:executable = ale_linters#markdown#markdownlint#GetExecutable(a:buffer)
let l:options = ale#Var(a:buffer, 'markdown_markdownlint_options')
@@ -14,7 +19,7 @@ endfunction
call ale#linter#Define('markdown', {
\ 'name': 'markdownlint',
\ 'executable': 'markdownlint',
\ 'executable': function('ale_linters#markdown#markdownlint#GetExecutable'),
\ 'lint_file': 1,
\ 'output_stream': 'both',
\ 'command': function('ale_linters#markdown#markdownlint#GetCommand'),

View 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': {},
\})

View 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',
\})

View File

@@ -17,7 +17,7 @@ function! ale_linters#matlab#mlint#Handle(buffer, lines) abort
let l:code = l:match[3]
let l:text = l:match[4]
" Suppress erroneous waring about filename
" Suppress erroneous warning about filename
" TODO: Enable this error when copying filename is supported
if l:code is# 'FNDEF'
continue

View 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',
\})

View File

@@ -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]\|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

View File

@@ -9,6 +9,7 @@ endfunction
call ale#linter#Define('nix', {
\ 'name': 'rnix_lsp',
\ 'aliases': ['rnix'],
\ 'lsp': 'stdio',
\ 'executable': 'rnix-lsp',
\ 'command': '%e',

View 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',
\})

View File

@@ -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
View 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'),
\})

View File

@@ -0,0 +1,24 @@
" Description: SCA2D linter for OpenSCAD files
call ale#Set('openscad_sca2d_executable', 'sca2d')
call ale#Set('openscad_sca2d_options', '')
function! ale_linters#openscad#sca2d#GetExecutable(buffer) abort
return ale#Var(a:buffer, 'openscad_sca2d_executable')
endfunction
function! ale_linters#openscad#sca2d#GetCommand(buffer) abort
let l:executable = ale_linters#openscad#sca2d#GetExecutable(a:buffer)
let l:options = ale#Var(a:buffer, 'openscad_sca2d_options')
return ale#Escape(l:executable) . ale#Pad(l:options) . ' %s'
endfunction
call ale#linter#Define('openscad', {
\ 'name': 'SCA2D',
\ 'aliases': ['sca2d'],
\ 'executable': function('ale_linters#openscad#sca2d#GetExecutable'),
\ 'command': function('ale_linters#openscad#sca2d#GetCommand'),
\ 'callback': 'ale#handlers#openscad#SCA2D_callback',
\ 'lint_file': 1,
\ })

View File

@@ -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

View File

@@ -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
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'),
\})

View File

@@ -13,7 +13,7 @@ function! ale_linters#powershell#psscriptanalyzer#GetExecutable(buffer) abort
return ale#Var(a:buffer, 'powershell_psscriptanalyzer_executable')
endfunction
" Run Invoke-ScriptAnalyzer and output each linting message as 4 seperate lines
" Run Invoke-ScriptAnalyzer and output each linting message as 4 separate lines
" for each parsing
function! ale_linters#powershell#psscriptanalyzer#GetCommand(buffer) abort
let l:exclude_option = ale#Var(

View File

@@ -0,0 +1,26 @@
" Author: Alex McKinney <alexmckinney01@gmail.com>
" Description: Run buf lint.
call ale#Set('proto_buf_lint_executable', 'buf')
call ale#Set('proto_buf_lint_config', '')
call ale#Set('proto_buf_lint_options', '')
function! ale_linters#proto#buf_lint#GetCommand(buffer) abort
let l:config = ale#Var(a:buffer, 'proto_buf_lint_config')
let l:options = ale#Var(a:buffer, 'proto_buf_lint_options')
return '%e lint'
\ . (!empty(l:config) ? ' --config=' . ale#Escape(l:config) : '')
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ' %s#include_package_files=true'
endfunction
call ale#linter#Define('proto', {
\ 'name': 'buf_lint',
\ 'aliases': ['buf-lint'],
\ 'lint_file': 1,
\ 'output_stream': 'stdout',
\ 'executable': {b -> ale#Var(b, 'proto_buf_lint_executable')},
\ 'command': function('ale_linters#proto#buf_lint#GetCommand'),
\ 'callback': 'ale#handlers#go#Handler',
\})

View File

@@ -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',

View File

@@ -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'),

View File

@@ -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'
\ : ''

View File

@@ -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'
\ : ''

View File

@@ -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'

View File

@@ -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'),

View File

@@ -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'
\ : ''

View File

@@ -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'
\ : ''

Some files were not shown because too many files have changed in this diff Show More