Compare commits

...

59 Commits

Author SHA1 Message Date
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
173 changed files with 2772 additions and 465 deletions

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 -->
<!-- Make sure to run :ALEInfo from the buffer where the bug occurred. -->
<!-- Read the output. You might figure out what went wrong yourself. -->
<details>
<summary>Expand</summary>
<!-- Paste the output of :ALEInfo here. Try :ALEInfoToClipboard -->
<!-- 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

@ -29,8 +29,7 @@ jobs:
- '--vim-80-only'
- '--vim-82-only'
- '--neovim-02-only'
- '--neovim-04-only'
- '--neovim-05-only'
- '--neovim-07-only'
- '--linters-only'
steps:
- uses: actions/checkout@v2

View File

@ -1,10 +1,9 @@
FROM testbed/vim:20
RUN install_vim -tag v8.0.0027 -build \
-tag v8.2.2401 -build \
-tag v8.2.4693 -build \
-tag neovim:v0.2.0 -build \
-tag neovim:v0.4.4 -build \
-tag neovim:v0.5.0 -build
-tag neovim:v0.7.0 -build
ENV PACKAGES="\
bash \
@ -25,4 +24,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 @@
# 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 [![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 Dense Analysis Discord server](https://img.shields.io/badge/chat-Discord-5865F2)](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)
@ -359,7 +359,7 @@ See the Vundle documentation for more information.
<a name="installation-with-vim-plug"></a>
### 3.iiii. Installation with Vim-Plug
### 3.iv. Installation with Vim-Plug
You can install this plugin using [Vim-Plug](https://github.com/junegunn/vim-plug)
by adding the GitHub path for this repository to your `~/.vimrc`:
@ -386,8 +386,8 @@ 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>
@ -931,14 +931,14 @@ 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 = ['│', '─', '╭', '╮', '╯', '╰']
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)
let g:ale_floating_window_border = repeat([''], 8)
```
<a name="faq-vim-lsp"></a>

View File

@ -18,9 +18,30 @@ 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 = json_decode(join(a:lines, ''))
for l:issue in l:linter_issues
if ale#path#IsBufferPath(a:buffer, l:issue.location.path)
call add(l:output, {
\ 'lnum': exists('l:issue.location.lines.begin.column') ? l:issue.location.lines.begin.line :
\ l:issue.location.lines.begin,
\ 'col': exists('l:issue.location.lines.begin.column') ? l:issue.location.lines.begin.column : 0,
\ '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 +94,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

@ -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,37 @@
" Author: 0xHyoga <0xHyoga@gmx.com>
" Description: Report starknet-compile errors in cairo code
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

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

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

@ -24,7 +24,7 @@ function! ale_linters#go#golangci_lint#GetCommand(buffer) abort
endfunction
function! ale_linters#go#golangci_lint#GetMatches(lines) abort
let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):?(\d+)?:?:?:?\s\*?(.+)$'
let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):?(\d+)?:?:?:?\s\*?(.+)\s+\((.+)\)$'
return ale#util#GetMatches(a:lines, l:pattern)
endfunction
@ -34,14 +34,20 @@ function! ale_linters#go#golangci_lint#Handler(buffer, lines) abort
let l:output = []
for l:match in ale_linters#go#golangci_lint#GetMatches(a:lines)
if l:match[5] is# 'typecheck'
let l:msg_type = 'E'
else
let l:msg_type = 'W'
endif
" l:match[1] will already be an absolute path, output from
" golangci_lint
call add(l:output, {
\ 'filename': ale#path#GetAbsPath(l:dir, l:match[1]),
\ 'lnum': l:match[2] + 0,
\ 'col': l:match[3] + 0,
\ 'type': 'E',
\ 'text': l:match[4],
\ 'type': l:msg_type,
\ 'text': l:match[4] . ' (' . l:match[5] . ')',
\})
endfor

View File

@ -11,10 +11,17 @@ function! ale_linters#handlebars#embertemplatelint#GetExecutable(buffer) abort
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'
if ale#semver#GTE(a:version, [4, 0, 0])
" --json was removed in favor of --format=json in ember-template-lint@4.0.0
return '%e --format=json --filename %s'
endif
if ale#semver#GTE(a:version, [1, 6, 0])
" Reading from stdin was introduced in ember-template-lint@1.6.0
return '%e --json --filename %s'
endif
return '%e --json %t'
endfunction
function! ale_linters#handlebars#embertemplatelint#GetCommandWithVersionCheck(buffer) abort

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,16 @@
" Author: Dalius Dobravolskas <dalius.dobravolskas@gmail.com>
" Description: VSCode json language server
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': 'vscode-json-language-server',
\ 'command': '%e --stdio',
\ 'project_root': function('ale_linters#json#vscodejson#GetProjectRoot'),
\})

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

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

@ -0,0 +1,23 @@
" 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', '')
function! ale_linters#proto#buf_lint#GetCommand(buffer) abort
let l:config = ale#Var(a:buffer, 'proto_buf_lint_config')
return '%e lint'
\ . (!empty(l:config) ? ' --config=' . ale#Escape(l:config) : '')
\ . ' %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#unix#HandleAsError',
\})

View File

@ -22,6 +22,22 @@ function! ale_linters#python#pylama#GetExecutable(buffer) abort
return ale#python#FindExecutable(a:buffer, 'python_pylama', ['pylama'])
endfunction
function! ale_linters#python#pylama#RunWithVersionCheck(buffer) abort
let l:executable = ale_linters#python#pylama#GetExecutable(a:buffer)
let l:exec_args = l:executable =~? 'pipenv\|poetry$'
\ ? ' run pylama'
\ : ''
let l:command = ale#Escape(l:executable) . l:exec_args . ' --version'
return ale#semver#RunWithVersionCheck(
\ a:buffer,
\ l:executable,
\ l:command,
\ function('ale_linters#python#pylama#GetCommand'),
\)
endfunction
function! ale_linters#python#pylama#GetCwd(buffer) abort
if ale#Var(a:buffer, 'python_pylama_change_directory')
" Pylama loads its configuration from the current directory only, and
@ -35,27 +51,33 @@ function! ale_linters#python#pylama#GetCwd(buffer) abort
return ''
endfunction
function! ale_linters#python#pylama#GetCommand(buffer) abort
function! ale_linters#python#pylama#GetCommand(buffer, version) abort
let l:executable = ale_linters#python#pylama#GetExecutable(a:buffer)
let l:exec_args = l:executable =~? 'pipenv\|poetry$'
\ ? ' run pylama'
\ : ''
" json format is added in version 8.1.4
" https://github.com/klen/pylama/blob/develop/Changelog
let l:format_json_args = ale#semver#GTE(a:version, [8, 1, 4])
\ ? ' --format json'
\ : ''
" Note: Using %t to lint changes would be preferable, but many pylama
" checks use surrounding paths (e.g. C0103 module name, E0402 relative
" import beyond top, etc.). Neither is ideal.
return ale#Escape(l:executable) . l:exec_args
\ . ale#Pad(ale#Var(a:buffer, 'python_pylama_options'))
\ . l:format_json_args
\ . ' %s'
endfunction
function! ale_linters#python#pylama#Handle(buffer, lines) abort
function! ale_linters#python#pylama#Handle(buffer, version, lines) abort
if empty(a:lines)
return []
endif
let l:output = ale#python#HandleTraceback(a:lines, 1)
let l:pattern = '\v^.{-}:([0-9]+):([0-9]+): +%(([A-Z][0-9]+):? +)?(.*)$'
" First letter of error code is a pylint-compatible message type
" http://pylint.pycqa.org/en/latest/user_guide/output.html#source-code-analysis-section
@ -75,16 +97,41 @@ function! ale_linters#python#pylama#Handle(buffer, lines) abort
\ 'D': 'style',
\}
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]),
\ 'code': l:match[3],
\ 'type': get(l:pylint_type_to_ale_type, l:match[3][0], 'W'),
\ 'sub_type': get(l:pylint_type_to_ale_sub_type, l:match[3][0], ''),
\ 'text': l:match[4],
\})
endfor
if ale#semver#GTE(a:version, [8, 1, 4])
try
let l:errors = json_decode(join(a:lines, ''))
catch
return l:output
endtry
if empty(l:errors)
return l:output
endif
for l:error in l:errors
call add(l:output, {
\ 'lnum': l:error['lnum'],
\ 'col': l:error['col'],
\ 'code': l:error['number'],
\ 'type': get(l:pylint_type_to_ale_type, l:error['etype'], 'W'),
\ 'sub_type': get(l:pylint_type_to_ale_sub_type, l:error['etype'], ''),
\ 'text': printf('%s [%s]', l:error['message'], l:error['source']),
\})
endfor
else
let l:pattern = '\v^.{-}:([0-9]+):([0-9]+): +%(([A-Z][0-9]+):? +)?(.*)$'
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]),
\ 'code': l:match[3],
\ 'type': get(l:pylint_type_to_ale_type, l:match[3][0], 'W'),
\ 'sub_type': get(l:pylint_type_to_ale_sub_type, l:match[3][0], ''),
\ 'text': l:match[4],
\})
endfor
endif
return l:output
endfunction
@ -93,7 +140,15 @@ call ale#linter#Define('python', {
\ 'name': 'pylama',
\ 'executable': function('ale_linters#python#pylama#GetExecutable'),
\ 'cwd': function('ale_linters#python#pylama#GetCwd'),
\ 'command': function('ale_linters#python#pylama#GetCommand'),
\ 'callback': 'ale_linters#python#pylama#Handle',
\ 'command': function('ale_linters#python#pylama#RunWithVersionCheck'),
\ 'callback': {buffer, lines -> ale#semver#RunWithVersionCheck(
\ buffer,
\ ale_linters#python#pylama#GetExecutable(buffer),
\ '%e --version',
\ {buffer, version -> ale_linters#python#pylama#Handle(
\ buffer,
\ l:version,
\ lines)},
\ )},
\ 'lint_file': 1,
\})

View File

@ -0,0 +1,4 @@
scriptencoding utf-8
" Description: cspell support for rego files.
call ale#handlers#cspell#DefineLinter('rego')

View File

@ -0,0 +1,56 @@
" Description: opa check for rego files
call ale#Set('rego_opacheck_executable', 'opa')
call ale#Set('rego_opacheck_options', '')
function! ale_linters#rego#opacheck#GetExecutable(buffer) abort
return ale#Var(a:buffer, 'rego_opacheck_executable')
endfunction
function! ale_linters#rego#opacheck#GetCommand(buffer) abort
let l:options = ale#Var(a:buffer, 'rego_opacheck_options')
return ale#Escape(ale_linters#rego#opacheck#GetExecutable(a:buffer))
\ . ' check %s --format json '
\ . (!empty(l:options) ? ' ' . l:options : '')
endfunction
function! ale_linters#rego#opacheck#Handle(buffer, lines) abort
let l:output = []
let l:errors = ale#util#FuzzyJSONDecode(a:lines, {'errors': []})
let l:dir = expand('#' . a:buffer . ':p:h')
let l:file = expand('#' . a:buffer . ':p')
for l:error in l:errors['errors']
if has_key(l:error, 'location')
call add(l:output, {
\ 'filename': ale#path#GetAbsPath(l:dir, l:error['location']['file']),
\ 'lnum': l:error['location']['row'],
\ 'col': l:error['location']['col'],
\ 'text': l:error['message'],
\ 'code': l:error['code'],
\ 'type': 'E',
\})
else
call add(l:output, {
\ 'filename': l:file,
\ 'lnum': 0,
\ 'col': 0,
\ 'text': l:error['message'],
\ 'code': l:error['code'],
\ 'type': 'E',
\})
endif
endfor
return l:output
endfunction
call ale#linter#Define('rego', {
\ 'name': 'opacheck',
\ 'output_stream': 'both',
\ 'executable': function('ale_linters#rego#opacheck#GetExecutable'),
\ 'command': function('ale_linters#rego#opacheck#GetCommand'),
\ 'callback': 'ale_linters#rego#opacheck#Handle',
\})

View File

@ -9,9 +9,21 @@ function! ale_linters#rust#analyzer#GetCommand(buffer) abort
endfunction
function! ale_linters#rust#analyzer#GetProjectRoot(buffer) abort
" Try to find nearest Cargo.toml for cargo projects
let l:cargo_file = ale#path#FindNearestFile(a:buffer, 'Cargo.toml')
return !empty(l:cargo_file) ? fnamemodify(l:cargo_file, ':h') : ''
if !empty(l:cargo_file)
return fnamemodify(l:cargo_file, ':h')
endif
" Try to find nearest rust-project.json for non-cargo projects
let l:rust_project = ale#path#FindNearestFile(a:buffer, 'rust-project.json')
if !empty(l:rust_project)
return fnamemodify(l:rust_project, ':h')
endif
return ''
endfunction
call ale#linter#Define('rust', {

View File

@ -21,7 +21,13 @@ function! ale_linters#terraform#terraform#GetType(severity) abort
endfunction
function! ale_linters#terraform#terraform#GetDetail(error) abort
return get(a:error, 'detail', get(a:error, 'summary', ''))
let l:detail = get(a:error, 'detail', '')
if strlen(l:detail) > 0
return l:detail
else
return get(a:error, 'summary', '')
endif
endfunction
function! ale_linters#terraform#terraform#Handle(buffer, lines) abort

View File

@ -0,0 +1,11 @@
" Author: bretello <bretello@distruzione.org>
call ale#Set('yaml_actionlint_executable', 'actionlint')
call ale#Set('yaml_actionlint_options', '')
call ale#linter#Define('yaml', {
\ 'name': 'actionlint',
\ 'executable': {b -> ale#Var(b, 'yaml_actionlint_executable')},
\ 'command': function('ale#handlers#actionlint#GetCommand'),
\ 'callback': 'ale#handlers#actionlint#Handle',
\})

View File

@ -457,7 +457,7 @@ function! s:ExecuteGetCodeFix(linter, range, MenuCallback) abort
let [l:end_line, l:end_column] = getpos("'>")[1:2]
endif
let l:column = min([l:column, len(getline(l:line))])
let l:column = max([min([l:column, len(getline(l:line))]), 1])
let l:end_column = min([l:end_column, len(getline(l:end_line))])
let l:Callback = function(

View File

@ -133,11 +133,13 @@ let s:should_complete_map = {
\ 'typescript': '\v[a-zA-Z$_][a-zA-Z$_0-9]*$|\.$|''$|"$',
\ 'rust': '\v[a-zA-Z$_][a-zA-Z$_0-9]*$|\.$|::$',
\ 'cpp': '\v[a-zA-Z$_][a-zA-Z$_0-9]*$|\.$|::$|-\>$',
\ 'c': '\v[a-zA-Z$_][a-zA-Z$_0-9]*$|\.$|-\>$',
\}
" Regular expressions for finding the start column to replace with completion.
let s:omni_start_map = {
\ '<default>': '\v[a-zA-Z$_][a-zA-Z$_0-9]*$',
\ 'racket': '\k\+',
\}
" A map of exact characters for triggering LSP completions. Do not forget to
@ -147,6 +149,7 @@ let s:trigger_character_map = {
\ 'typescript': ['.', '''', '"'],
\ 'rust': ['.', '::'],
\ 'cpp': ['.', '::', '->'],
\ 'c': ['.', '->'],
\}
function! s:GetFiletypeValue(map, filetype) abort
@ -581,7 +584,7 @@ function! ale#completion#ParseLSPCompletions(response) abort
continue
endif
if get(l:item, 'insertTextFormat') is s:LSP_INSERT_TEXT_FORMAT_PLAIN
if get(l:item, 'insertTextFormat', s:LSP_INSERT_TEXT_FORMAT_PLAIN) is s:LSP_INSERT_TEXT_FORMAT_PLAIN
\&& type(get(l:item, 'textEdit')) is v:t_dict
let l:text = l:item.textEdit.newText
elseif type(get(l:item, 'insertText')) is v:t_string
@ -776,7 +779,8 @@ function! s:OnReady(linter, lsp_details) abort
if a:linter.lsp is# 'tsserver'
if get(g:, 'ale_completion_tsserver_autoimport') is 1
execute 'echom `g:ale_completion_tsserver_autoimport` is deprecated. Use `g:ale_completion_autoimport` instead.'''
" no-custom-checks
echom '`g:ale_completion_tsserver_autoimport` is deprecated. Use `g:ale_completion_autoimport` instead.'
endif
let l:message = ale#lsp#tsserver_message#Completions(
@ -911,7 +915,8 @@ function! ale#completion#Import() abort
endif
let [l:line, l:column] = getpos('.')[1:2]
let l:column = searchpos('\V' . escape(l:word, '/\'), 'bn', l:line)[1]
let l:column = searchpos('\V' . escape(l:word, '/\'), 'bnc', l:line)[1]
let l:column = l:column + len(l:word) - 1
if l:column isnot 0
let l:started = ale#completion#GetCompletions('ale-import', {

View File

@ -10,12 +10,21 @@ let g:ale_echo_msg_format = get(g:, 'ale_echo_msg_format', '%code: %%s')
let s:cursor_timer = -1
" A wrapper for echon so we can test messages we echo in Vader tests.
function! ale#cursor#Echom(message) abort
" no-custom-checks
exec "norm! :echom a:message\n"
endfunction
function! ale#cursor#TruncatedEcho(original_message) abort
let l:message = a:original_message
" Change tabs to spaces.
let l:message = substitute(l:message, "\t", ' ', 'g')
" Remove any newlines in the message.
let l:message = substitute(l:message, "\n", '', 'g')
" Convert indentation groups into single spaces for better legibility when
" put on a single line
let l:message = substitute(l:message, ' \+', ' ', 'g')
" We need to remember the setting for shortmess and reset it again.
let l:shortmess_options = &l:shortmess
@ -27,7 +36,7 @@ function! ale#cursor#TruncatedEcho(original_message) abort
silent! setlocal shortmess+=T
try
exec "norm! :echomsg l:message\n"
call ale#cursor#Echom(l:message)
catch /^Vim\%((\a\+)\)\=:E523/
" Fallback into manual truncate (#1987)
let l:winwidth = winwidth(0)
@ -87,7 +96,9 @@ function! ale#cursor#EchoCursorWarning(...) abort
elseif get(l:info, 'echoed')
" We'll only clear the echoed message when moving off errors once,
" so we don't continually clear the echo line.
execute 'echo'
"
" no-custom-checks
echo
let l:info.echoed = 0
endif
endif
@ -150,7 +161,8 @@ function! s:ShowCursorDetailForItem(loc, options) abort
" Clear the echo message if we manually displayed details.
if !l:stay_here
execute 'echo'
" no-custom-checks
echo
endif
endif
endfunction

View File

@ -62,7 +62,8 @@ let s:global_variable_list = [
\]
function! s:Echo(message) abort
execute 'echo a:message'
" no-custom-checks
echo a:message
endfunction
function! s:GetLinterVariables(filetype, exclude_linter_names) abort

View File

@ -121,6 +121,12 @@ function! s:OnReady(line, column, options, capability, linter, lsp_details) abor
\ a:line,
\ a:column
\)
elseif a:capability is# 'implementation'
let l:message = ale#lsp#tsserver_message#Implementation(
\ l:buffer,
\ a:line,
\ a:column
\)
endif
else
" Send a message saying the buffer has changed first, or the
@ -134,6 +140,8 @@ function! s:OnReady(line, column, options, capability, linter, lsp_details) abor
let l:message = ale#lsp#message#Definition(l:buffer, a:line, a:column)
elseif a:capability is# 'typeDefinition'
let l:message = ale#lsp#message#TypeDefinition(l:buffer, a:line, a:column)
elseif a:capability is# 'implementation'
let l:message = ale#lsp#message#Implementation(l:buffer, a:line, a:column)
else
" XXX: log here?
return
@ -175,6 +183,14 @@ function! ale#definition#GoToType(options) abort
endfor
endfunction
function! ale#definition#GoToImpl(options) abort
for l:linter in ale#linter#Get(&filetype)
if !empty(l:linter.lsp)
call s:GoToLSPDefinition(l:linter, a:options, 'implementation')
endif
endfor
endfunction
function! ale#definition#GoToCommandHandler(command, ...) abort
let l:options = {}
@ -200,6 +216,8 @@ function! ale#definition#GoToCommandHandler(command, ...) abort
if a:command is# 'type'
call ale#definition#GoToType(l:options)
elseif a:command is# 'implementation'
call ale#definition#GoToImpl(l:options)
else
call ale#definition#GoTo(l:options)
endif

View File

@ -347,6 +347,12 @@ function! ale#engine#FixLocList(buffer, linter_name, from_other_source, loclist)
if has_key(l:old_item, 'end_lnum')
let l:item.end_lnum = str2nr(l:old_item.end_lnum)
" When the error ends after the end of the file, put it at the
" end. This is only done for the current buffer.
if l:item.bufnr == a:buffer && l:item.end_lnum > l:last_line_number
let l:item.end_lnum = l:last_line_number
endif
endif
if has_key(l:old_item, 'sub_type')

View File

@ -77,7 +77,8 @@ function! ale#fix#ApplyFixes(buffer, output) abort
call remove(g:ale_fix_buffer_data, a:buffer)
if !l:data.ignore_file_changed_errors
execute 'echoerr ''The file was changed before fixing finished'''
" no-custom-checks
echoerr 'The file was changed before fixing finished'
endif
return
@ -358,7 +359,8 @@ function! ale#fix#Fix(buffer, fixing_flag, ...) abort
\ 'There is no fixer named `%s`. Check :ALEFixSuggest',
\ l:function_name,
\)
execute 'echom l:echo_message'
" no-custom-checks
echom l:echo_message
endif
return 0
@ -366,7 +368,8 @@ function! ale#fix#Fix(buffer, fixing_flag, ...) abort
if empty(l:callback_list)
if a:fixing_flag is# ''
execute 'echom ''No fixers have been defined. Try :ALEFixSuggest'''
" no-custom-checks
echom 'No fixers have been defined. Try :ALEFixSuggest'
endif
return 0

View File

@ -37,6 +37,11 @@ let s:default_registry = {
\ 'suggested_filetypes': ['python'],
\ 'description': 'Fix PEP8 issues with black.',
\ },
\ 'buf-format': {
\ 'function': 'ale#fixers#buf_format#Fix',
\ 'suggested_filetypes': ['proto'],
\ 'description': 'Fix .proto files with buf format.',
\ },
\ 'buildifier': {
\ 'function': 'ale#fixers#buildifier#Fix',
\ 'suggested_filetypes': ['bzl'],
@ -73,6 +78,11 @@ let s:default_registry = {
\ 'suggested_filetypes': ['dhall'],
\ 'description': 'Standard code formatter for the Dhall language and removing dead code',
\ },
\ 'dune': {
\ 'function': 'ale#fixers#dune#Fix',
\ 'suggested_filetypes': ['dune'],
\ 'description': 'Fix dune files with dune format',
\ },
\ 'fecs': {
\ 'function': 'ale#fixers#fecs#Fix',
\ 'suggested_filetypes': ['javascript', 'css', 'html'],
@ -131,6 +141,11 @@ let s:default_registry = {
\ 'description': 'Apply prettier-eslint to a file.',
\ 'aliases': ['prettier-eslint'],
\ },
\ 'pyflyby': {
\ 'function': 'ale#fixers#pyflyby#Fix',
\ 'suggested_filetypes': ['python'],
\ 'description': 'Tidy Python imports with pyflyby.',
\ },
\ 'importjs': {
\ 'function': 'ale#fixers#importjs#Fix',
\ 'suggested_filetypes': ['javascript'],
@ -206,6 +221,11 @@ let s:default_registry = {
\ 'suggested_filetypes': ['swift'],
\ 'description': 'Apply SwiftFormat to a file.',
\ },
\ 'syntax_tree': {
\ 'function': 'ale#fixers#syntax_tree#Fix',
\ 'suggested_filetypes': ['ruby'],
\ 'description': 'Fix ruby files with stree write',
\ },
\ 'apple-swift-format': {
\ 'function': 'ale#fixers#appleswiftformat#Fix',
\ 'suggested_filetypes': ['swift'],
@ -221,6 +241,11 @@ let s:default_registry = {
\ 'suggested_filetypes': ['php'],
\ 'description': 'Fix PHP files with php-cs-fixer.',
\ },
\ 'pint': {
\ 'function': 'ale#fixers#pint#Fix',
\ 'suggested_filetypes': ['php'],
\ 'description': 'Fix PHP files with Laravel Pint.',
\ },
\ 'astyle': {
\ 'function': 'ale#fixers#astyle#Fix',
\ 'suggested_filetypes': ['c', 'cpp'],
@ -431,6 +456,11 @@ let s:default_registry = {
\ 'suggested_filetypes': ['hcl', 'terraform'],
\ 'description': 'Fix tf and hcl files with terraform fmt.',
\ },
\ 'packer': {
\ 'function': 'ale#fixers#packer#Fix',
\ 'suggested_filetypes': ['hcl', 'packer'],
\ 'description': 'Fix Packer HCL files with packer fmt.',
\ },
\ 'crystal': {
\ 'function': 'ale#fixers#crystal#Fix',
\ 'suggested_filetypes': ['cr'],
@ -521,10 +551,20 @@ let s:default_registry = {
\ 'suggested_filetypes': ['pascal'],
\ 'description': 'Fix Pascal files with ptop.',
\ },
\ 'opafmt': {
\ 'function': 'ale#fixers#opafmt#Fix',
\ 'suggested_filetypes': ['rego'],
\ 'description': 'Fix rego files with opa fmt.',
\ },
\ 'vfmt': {
\ 'function': 'ale#fixers#vfmt#Fix',
\ 'suggested_filetypes': ['v'],
\ 'description': 'A formatter for V source code.',
\ },
\ 'zigfmt': {
\ 'function': 'ale#fixers#zigfmt#Fix',
\ 'suggested_filetypes': ['zig'],
\ 'description': 'Official formatter for Zig',
\ }
\}

View File

@ -0,0 +1,12 @@
" Author: Alex McKinney <alexmckinney01@gmail.com>
" Description: Run buf format.
call ale#Set('proto_buf_format_executable', 'buf')
function! ale#fixers#buf_format#Fix(buffer) abort
let l:executable = ale#Var(a:buffer, 'proto_buf_format_executable')
return {
\ 'command': ale#Escape(l:executable) . ' format %t',
\}
endfunction

View File

@ -0,0 +1,16 @@
" Author: Albert Peschar <albert@peschar.net>
" Description: Fix files with dune format.
call ale#Set('ocaml_dune_executable', 'dune')
call ale#Set('ocaml_dune_options', '')
function! ale#fixers#dune#Fix(buffer) abort
let l:executable = ale#Var(a:buffer, 'ocaml_dune_executable')
let l:options = ale#Var(a:buffer, 'ocaml_dune_options')
return {
\ 'command': ale#Escape(l:executable)
\ . ' format'
\ . (empty(l:options) ? '' : ' ' . l:options),
\}
endfunction

View File

@ -0,0 +1,15 @@
" Description: Fixer for rego files
call ale#Set('opa_fmt_executable', 'opa')
call ale#Set('opa_fmt_options', '')
function! ale#fixers#opafmt#Fix(buffer) abort
let l:executable = ale#Var(a:buffer, 'opa_fmt_executable')
let l:options = ale#Var(a:buffer, 'opa_fmt_options')
return {
\ 'command': ale#Escape(l:executable)
\ . ' fmt'
\ . (empty(l:options) ? '' : ' ' . l:options)
\}
endfunction

View File

@ -0,0 +1,17 @@
" Author: Zhuoyun Wei <wzyboy@wzyboy.org>
" Description: Fixer for Packer HCL files
call ale#Set('packer_fmt_executable', 'packer')
call ale#Set('packer_fmt_options', '')
function! ale#fixers#packer#Fix(buffer) abort
let l:executable = ale#Var(a:buffer, 'packer_fmt_executable')
let l:options = ale#Var(a:buffer, 'packer_fmt_options')
return {
\ 'command': ale#Escape(l:executable)
\ . ' fmt'
\ . (empty(l:options) ? '' : ' ' . l:options)
\ . ' -'
\}
endfunction

View File

@ -0,0 +1,25 @@
" Author: Michael Dyrynda <michael@dyrynda.com.au>
" Description: Fixing files with Laravel Pint.
call ale#Set('php_pint_executable', 'pint')
call ale#Set('php_pint_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('php_pint_options', '')
function! ale#fixers#pint#GetExecutable(buffer) abort
return ale#path#FindExecutable(a:buffer, 'php_pint', [
\ 'vendor/bin/pint',
\ 'pint'
\])
endfunction
function! ale#fixers#pint#Fix(buffer) abort
let l:executable = ale#fixers#pint#GetExecutable(a:buffer)
return {
\ 'command': ale#Escape(l:executable)
\ . ' ' . ale#Var(a:buffer, 'php_pint_options')
\ . ' %t',
\ 'read_temporary_file': 1,
\}
endfunction

View File

@ -0,0 +1,41 @@
" Author: infokiller <joweill@icloud.com>
" Description: Tidy imports using pyflyby's tidy-import script
" https://github.com/deshaw/pyflyby
call ale#Set('python_pyflyby_executable', 'tidy-imports')
call ale#Set('python_pyflyby_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('python_pyflyby_options', '')
call ale#Set('python_pyflyby_auto_pipenv', 0)
call ale#Set('python_pyflyby_auto_poetry', 0)
function! ale#fixers#pyflyby#GetExecutable(buffer) abort
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pyflyby_auto_pipenv'))
\ && ale#python#PipenvPresent(a:buffer)
return 'pipenv'
endif
if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_pyflyby_auto_poetry'))
\ && ale#python#PoetryPresent(a:buffer)
return 'poetry'
endif
return ale#python#FindExecutable(a:buffer, 'python_pyflyby', ['tidy-imports'])
endfunction
function! ale#fixers#pyflyby#Fix(buffer) abort
" let l:executable = ale#fixers#pyflyby#GetExecutable(a:buffer)
let l:executable = ale#fixers#pyflyby#GetExecutable(a:buffer)
let l:cmd = [ale#Escape(l:executable)]
if l:executable =~? 'pipenv\|poetry$'
call extend(l:cmd, ['run', 'tidy-imports'])
endif
let l:options = ale#Var(a:buffer, 'python_pyflyby_options')
if !empty(l:options)
call add(l:cmd, l:options)
endif
return {'command': join(l:cmd, ' ')}
endfunction

View File

@ -5,27 +5,13 @@ scriptencoding utf-8
call ale#Set('sh_shfmt_executable', 'shfmt')
call ale#Set('sh_shfmt_options', '')
function! s:DefaultOption(buffer) abort
if getbufvar(a:buffer, '&expandtab') == 0
" Tab is used by default
return ''
endif
let l:tabsize = getbufvar(a:buffer, '&shiftwidth')
if l:tabsize == 0
let l:tabsize = getbufvar(a:buffer, '&tabstop')
endif
return ' -i ' . l:tabsize
endfunction
function! ale#fixers#shfmt#Fix(buffer) abort
let l:executable = ale#Var(a:buffer, 'sh_shfmt_executable')
let l:options = ale#Var(a:buffer, 'sh_shfmt_options')
return {
\ 'command': ale#Escape(l:executable)
\ . (empty(l:options) ? s:DefaultOption(a:buffer) : ' ' . l:options)
\ . ' -filename=%s'
\ . (empty(l:options) ? '' : ' ' . l:options)
\}
endfunction

View File

@ -0,0 +1,19 @@
call ale#Set('ruby_syntax_tree_options', '')
call ale#Set('ruby_syntax_tree_executable', 'stree')
function! ale#fixers#syntax_tree#GetCommand(buffer) abort
let l:executable = ale#Var(a:buffer, 'ruby_syntax_tree_executable')
let l:options = ale#Var(a:buffer, 'ruby_syntax_tree_options')
return ale#ruby#EscapeExecutable(l:executable, 'stree')
\ . ' write'
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ' %t'
endfunction
function! ale#fixers#syntax_tree#Fix(buffer) abort
return {
\ 'command': ale#fixers#syntax_tree#GetCommand(a:buffer),
\ 'read_temporary_file': 1,
\}
endfunction

View File

@ -0,0 +1,14 @@
scriptencoding utf-8
" Author: Arash Mousavi <arash-m>
" Description: Official formatter for Zig.
call ale#Set('zig_zigfmt_executable', 'zig')
function! ale#fixers#zigfmt#Fix(buffer) abort
let l:executable = ale#Var(a:buffer, 'zig_zigfmt_executable')
return {
\ 'command': ale#Escape(l:executable) . ' fmt %t',
\ 'read_temporary_file': 1,
\}
endfunction

View File

@ -1,13 +1,15 @@
" Author: Jan-Grimo Sobez <jan-grimo.sobez@phys.chem.ethz.ch>
" Author: Kevin Clark <kevin.clark@gmail.com>
" Author: D. Ben Knoble <ben.knoble+github@gmail.com>
" Author: Shaun Duncan <shaun.duncan@gmail.com>
" Description: Floating preview window for showing whatever information in.
" Precondition: exists('*nvim_open_win') || has('popupwin')
function! ale#floating_preview#Show(lines, ...) abort
if !exists('*nvim_open_win') && !has('popupwin')
execute 'echom ''Floating windows not supported in this vim instance.'''
" no-custom-checks
echom 'Floating windows not supported in this vim instance.'
return
endif
@ -105,18 +107,20 @@ function! s:NvimPrepareWindowContent(lines) abort
let l:width += 2
let l:height += 2
let l:hor = g:ale_floating_window_border[0]
let l:top = g:ale_floating_window_border[1]
let l:top_left = g:ale_floating_window_border[2]
let l:top_right = g:ale_floating_window_border[3]
let l:bottom_right = g:ale_floating_window_border[4]
let l:bottom_left = g:ale_floating_window_border[5]
let l:left = get(g:ale_floating_window_border, 0, '|')
let l:top = get(g:ale_floating_window_border, 1, '-')
let l:top_left = get(g:ale_floating_window_border, 2, '+')
let l:top_right = get(g:ale_floating_window_border, 3, '+')
let l:bottom_right = get(g:ale_floating_window_border, 4, '+')
let l:bottom_left = get(g:ale_floating_window_border, 5, '+')
let l:right = get(g:ale_floating_window_border, 6, l:left)
let l:bottom = get(g:ale_floating_window_border, 7, l:top)
let l:lines = [l:top_left . repeat(l:top, l:width - 2) . l:top_right]
for l:line in a:lines
let l:line_width = strchars(l:line)
let l:lines = add(l:lines, l:hor . l:line . repeat(' ', l:width - l:line_width - 2). l:hor)
let l:lines = add(l:lines, l:left . l:line . repeat(' ', l:width - l:line_width - 2). l:right)
endfor
" Truncate the lines
@ -124,21 +128,24 @@ function! s:NvimPrepareWindowContent(lines) abort
let l:lines = l:lines[0:l:max_height]
endif
let l:lines = add(l:lines, l:bottom_left . repeat(l:top, l:width - 2) . l:bottom_right)
let l:lines = add(l:lines, l:bottom_left . repeat(l:bottom, l:width - 2) . l:bottom_right)
return [l:lines, l:width, l:height]
endfunction
function! s:NvimCreate(options) abort
let l:popup_opts = extend({
\ 'relative': 'cursor',
\ 'row': 1,
\ 'col': 0,
\ 'width': 42,
\ 'height': 4,
\ 'style': 'minimal'
\ }, s:GetPopupOpts())
let l:buffer = nvim_create_buf(v:false, v:false)
let l:winid = nvim_open_win(l:buffer, v:false, {
\ 'relative': 'cursor',
\ 'row': 1,
\ 'col': 0,
\ 'width': 42,
\ 'height': 4,
\ 'style': 'minimal'
\ })
let l:winid = nvim_open_win(l:buffer, v:false, l:popup_opts)
call nvim_buf_set_option(l:buffer, 'buftype', 'acwrite')
call nvim_buf_set_option(l:buffer, 'bufhidden', 'delete')
call nvim_buf_set_option(l:buffer, 'swapfile', v:false)
@ -148,7 +155,8 @@ function! s:NvimCreate(options) abort
endfunction
function! s:VimCreate(options) abort
let l:popup_id = popup_create([], {
" default options
let l:popup_opts = extend({
\ 'line': 'cursor+1',
\ 'col': 'cursor',
\ 'drag': v:true,
@ -157,17 +165,19 @@ function! s:VimCreate(options) abort
\ 'padding': [0, 1, 0, 1],
\ 'border': [],
\ 'borderchars': empty(g:ale_floating_window_border) ? [' '] : [
\ g:ale_floating_window_border[1],
\ g:ale_floating_window_border[0],
\ g:ale_floating_window_border[1],
\ g:ale_floating_window_border[0],
\ g:ale_floating_window_border[2],
\ g:ale_floating_window_border[3],
\ g:ale_floating_window_border[4],
\ g:ale_floating_window_border[5],
\ get(g:ale_floating_window_border, 1, '-'),
\ get(g:ale_floating_window_border, 6, '|'),
\ get(g:ale_floating_window_border, 7, '-'),
\ get(g:ale_floating_window_border, 0, '|'),
\ get(g:ale_floating_window_border, 2, '+'),
\ get(g:ale_floating_window_border, 3, '+'),
\ get(g:ale_floating_window_border, 4, '+'),
\ get(g:ale_floating_window_border, 5, '+'),
\ ],
\ 'moved': 'any',
\ })
\ }, s:GetPopupOpts())
let l:popup_id = popup_create([], l:popup_opts)
call setbufvar(winbufnr(l:popup_id), '&filetype', get(a:options, 'filetype', 'ale-preview'))
let w:preview = {'id': l:popup_id}
endfunction
@ -201,3 +211,21 @@ function! s:VimClose() abort
call popup_close(w:preview['id'])
unlet w:preview
endfunction
" get either the results of a function callback or dictionary for popup overrides
function! s:GetPopupOpts() abort
if exists('g:ale_floating_preview_popup_opts')
let l:ref = g:ale_floating_preview_popup_opts
if type(l:ref) is# v:t_dict
return l:ref
elseif type(l:ref) is# v:t_string
try
return function(l:ref)()
catch /E700/
endtry
endif
endif
return {}
endfunction

View File

@ -0,0 +1,36 @@
function! ale#handlers#actionlint#GetCommand(buffer) abort
let l:options = ale#Var(a:buffer, 'yaml_actionlint_options')
" automatically add --no-color option if not defined
if l:options !~# '--no-color'
let l:options .= ' --no-color'
endif
" automatically add --oneline option if not defined
if l:options !~# '--oneline'
let l:options .= ' --oneline'
endif
return '%e ' . l:options . ' %t'
endfunction
function! ale#handlers#actionlint#Handle(buffer, lines) abort
" Matches patterns line the following:
".github/workflows/main.yml:19:0: could not parse as YAML: yaml: line 19: mapping values are not allowed in this context [yaml-syntax]
let l:pattern = '\v^.*:(\d+):(\d+): (.+) \[(.+)\]$'
let l:output = []
for l:match in ale#util#GetMatches(a:lines, l:pattern)
let l:item = {
\ 'lnum': l:match[1] + 0,
\ 'col': l:match[2] + 0,
\ 'text': l:match[3],
\ 'code': l:match[4],
\ 'type': 'E',
\}
call add(l:output, l:item)
endfor
return l:output
endfunction

View File

@ -19,6 +19,16 @@ let s:temp_regex_prefix =
\ . substitute(s:temp_dir, '\\', '\\\\', 'g')
\ . '\.\{-}'
function! s:PanicOutput(lines) abort
return [{
\ 'lnum': 1,
\ 'col': 1,
\ 'text': 'ghc panic!',
\ 'type': 'E',
\ 'detail' : join(a:lines, "\n"),
\}]
endfunction
function! ale#handlers#haskell#HandleGHCFormat(buffer, lines) abort
" Look for lines like the following.
"
@ -34,6 +44,14 @@ function! ale#handlers#haskell#HandleGHCFormat(buffer, lines) abort
let l:corrected_lines = []
" If ghc panic error, put the whole message in details and exit.
let l:panic_position = match(a:lines,'ghc: panic!')
let l:panic_end = match(a:lines,'Please report this as a GHC bug:')
if l:panic_position >= 0
return s:PanicOutput(a:lines[l:panic_position : l:panic_end])
endif
" Group the lines into smaller lists.
for l:line in a:lines
if len(matchlist(l:line, l:pattern)) > 0

View File

@ -0,0 +1,73 @@
scriptencoding utf-8LE
" Description: This file defines a handler function for linting OpenSCAD files
" with SCA2D
function! ale#handlers#openscad#SCA2D_callback(buffer, lines) abort
" Example output::
" foo.scad:3:1: W2001: Variable `unused` overwritten within scope.
" foo.scad:1:1: F0001: Cannot read file due to syntax error:
" - No terminal matches '}' in the current parser context, at line 1 col 36
let l:filename_re = '^\([^:]*\):'
let l:linenum_re = '\([0-9]*\):'
let l:colnum_re = '\([0-9]*\):'
let l:err_id = '\([IWEFU][0-9]\+\):'
let l:err_msg = '\(.*\)'
let l:pattern = filename_re .
\ linenum_re .
\ colnum_re .
\ ' ' .
\ err_id .
\ ' ' .
\ err_msg
let l:result = []
let l:idx = 0
for l:line in a:lines
let l:matches = matchlist(line, pattern)
if len(matches) > 0
" option: Info, Warning, Error, Fatal, Unknown
if index(['I', 'W'], matches[4][0]) >= 0
let l:type = 'W'
else
let l:type = 'E'
endif
let l:lnum = matches[2]
let l:col = matches[3]
let l:text = matches[5]
" Better locations for some syntax errors
if matches[4][0] is# 'F'
let l:syntax_error_re = '^\(.*\), at line \([0-9]\+\) col \([0-9]\+\)$'
let l:next_line = a:lines[idx+1]
let l:syn_err_matches = matchlist(l:next_line, l:syntax_error_re)
if len(syn_err_matches) > 0
let l:text = l:text . l:syn_err_matches[1]
let l:lnum = l:syn_err_matches[2]
let l:col = l:syn_err_matches[3]
else
let l:text = l:next_line
endif
endif
let l:element = {
\ 'lnum': str2nr(l:lnum),
\ 'col': str2nr(l:col),
\ 'text': l:text,
\ 'detail': l:matches[4] . ': ' . l:text,
\ 'filename': fnamemodify(matches[1], ':p'),
\ 'type': l:type
\ }
call add(l:result, l:element)
endif
let l:idx += 1
endfor
return result
endfun

View File

@ -46,7 +46,7 @@ function! ale#hover#HandleTSServerResponse(conn_id, response) abort
call balloon_show(a:response.body.displayString)
elseif get(l:options, 'truncated_echo', 0)
if !empty(a:response.body.displayString)
call ale#cursor#TruncatedEcho(split(a:response.body.displayString, "\n")[0])
call ale#cursor#TruncatedEcho(a:response.body.displayString)
endif
elseif g:ale_hover_to_floating_preview || g:ale_floating_preview
call ale#floating_preview#Show(split(a:response.body.displayString, "\n"), {
@ -231,7 +231,11 @@ function! ale#hover#HandleLSPResponse(conn_id, response) abort
\&& (l:set_balloons is 1 || l:set_balloons is# 'hover')
call balloon_show(join(l:lines, "\n"))
elseif get(l:options, 'truncated_echo', 0)
call ale#cursor#TruncatedEcho(l:lines[0])
if type(l:lines[0]) is# v:t_list
call ale#cursor#TruncatedEcho(join(l:lines[0], '\n'))
else
call ale#cursor#TruncatedEcho(l:lines[0])
endif
elseif g:ale_hover_to_floating_preview || g:ale_floating_preview
call ale#floating_preview#Show(l:lines, {
\ 'filetype': 'ale-preview.message',
@ -335,6 +339,10 @@ function! ale#hover#ShowTruncatedMessageAtCursor() abort
let l:buffer = bufnr('')
let l:pos = getpos('.')[0:2]
if !getbufvar(l:buffer, 'ale_enabled', 1)
return
endif
if l:pos != s:last_pos
let s:last_pos = l:pos
let [l:info, l:loc] = ale#util#FindItemAtCursor(l:buffer)

View File

@ -187,10 +187,16 @@ function! ale#job#PrepareCommand(buffer, command) abort
\ : a:command
" If a custom shell is specified, use that.
if exists('g:ale_shell')
let l:shell_arguments = get(g:, 'ale_shell_arguments', &shellcmdflag)
if exists('b:ale_shell')
let l:ale_shell = b:ale_shell
elseif exists('g:ale_shell')
let l:ale_shell = g:ale_shell
endif
return split(g:ale_shell) + split(l:shell_arguments) + [l:command]
if exists('l:ale_shell')
let l:shell_arguments = get(b:, 'ale_shell_arguments', get(g:, 'ale_shell_arguments', &shellcmdflag))
return split(l:ale_shell) + split(l:shell_arguments) + [l:command]
endif
if has('win32')
@ -244,10 +250,16 @@ function! ale#job#Start(command, options) abort
if has_key(a:options, 'out_cb')
let l:job_options.out_cb = function('s:VimOutputCallback')
else
" prevent buffering of output and excessive polling in case close_cb is set
let l:job_options.out_cb = {->0}
endif
if has_key(a:options, 'err_cb')
let l:job_options.err_cb = function('s:VimErrorCallback')
else
" prevent buffering of output and excessive polling in case close_cb is set
let l:job_options.err_cb = {->0}
endif
if has_key(a:options, 'exit_cb')

View File

@ -19,6 +19,7 @@ let s:default_ale_linter_aliases = {
\ 'rmd': 'r',
\ 'systemverilog': 'verilog',
\ 'typescriptreact': ['typescript', 'tsx'],
\ 'vader': ['vim', 'vader'],
\ 'verilog_systemverilog': ['verilog_systemverilog', 'verilog'],
\ 'vimwiki': 'markdown',
\ 'vue': ['vue', 'javascript'],
@ -45,7 +46,7 @@ let s:default_ale_linters = {
\ 'hack': ['hack'],
\ 'help': [],
\ 'inko': ['inko'],
\ 'json': ['jsonlint', 'spectral'],
\ 'json': ['jsonlint', 'spectral', 'vscodejson'],
\ 'json5': [],
\ 'jsonc': [],
\ 'perl': ['perlcritic'],
@ -54,9 +55,11 @@ let s:default_ale_linters = {
\ 'rust': ['cargo', 'rls'],
\ 'spec': [],
\ 'text': [],
\ 'vader': ['vimls'],
\ 'vue': ['eslint', 'vls'],
\ 'zsh': ['shell'],
\ 'v': ['v'],
\ 'yaml': ['spectral', 'yaml-language-server', 'yamllint'],
\}
" Testing/debugging helper to unload all linters.

View File

@ -44,6 +44,7 @@ function! ale#lsp#Register(executable_or_address, project, init_options) abort
\ 'completion_trigger_characters': [],
\ 'definition': 0,
\ 'typeDefinition': 0,
\ 'implementation': 0,
\ 'symbol_search': 0,
\ 'code_actions': 0,
\ 'did_save': 0,
@ -259,6 +260,14 @@ function! s:UpdateCapabilities(conn, capabilities) abort
let a:conn.capabilities.typeDefinition = 1
endif
if get(a:capabilities, 'implementationProvider') is v:true
let a:conn.capabilities.implementation = 1
endif
if type(get(a:capabilities, 'implementationProvider')) is v:t_dict
let a:conn.capabilities.implementation = 1
endif
if get(a:capabilities, 'workspaceSymbolProvider') is v:true
let a:conn.capabilities.symbol_search = 1
endif
@ -379,6 +388,7 @@ function! ale#lsp#MarkConnectionAsTsserver(conn_id) abort
let l:conn.capabilities.completion_trigger_characters = ['.']
let l:conn.capabilities.definition = 1
let l:conn.capabilities.typeDefinition = 1
let l:conn.capabilities.implementation = 1
let l:conn.capabilities.symbol_search = 1
let l:conn.capabilities.rename = 1
let l:conn.capabilities.filerename = 1
@ -438,11 +448,20 @@ function! s:SendInitMessage(conn) abort
\ 'typeDefinition': {
\ 'dynamicRegistration': v:false,
\ },
\ 'implementation': {
\ 'dynamicRegistration': v:false,
\ 'linkSupport': v:false,
\ },
\ 'publishDiagnostics': {
\ 'relatedInformation': v:true,
\ },
\ 'codeAction': {
\ 'dynamicRegistration': v:false,
\ 'codeActionLiteralSupport': {
\ 'codeActionKind': {
\ 'valueSet': []
\ }
\ }
\ },
\ 'rename': {
\ 'dynamicRegistration': v:false,

View File

@ -139,6 +139,15 @@ function! ale#lsp#message#TypeDefinition(buffer, line, column) abort
\}]
endfunction
function! ale#lsp#message#Implementation(buffer, line, column) abort
return [0, 'textDocument/implementation', {
\ 'textDocument': {
\ 'uri': ale#util#ToURI(expand('#' . a:buffer . ':p')),
\ },
\ 'position': {'line': a:line - 1, 'character': a:column - 1},
\}]
endfunction
function! ale#lsp#message#References(buffer, line, column) abort
return [0, 'textDocument/references', {
\ 'textDocument': {

View File

@ -72,6 +72,14 @@ function! ale#lsp#tsserver_message#TypeDefinition(buffer, line, column) abort
\}]
endfunction
function! ale#lsp#tsserver_message#Implementation(buffer, line, column) abort
return [0, 'ts@implementation', {
\ 'line': a:line,
\ 'offset': a:column,
\ 'file': expand('#' . a:buffer . ':p'),
\}]
endfunction
function! ale#lsp#tsserver_message#References(buffer, line, column) abort
return [0, 'ts@references', {
\ 'line': a:line,

View File

@ -26,6 +26,7 @@ function! ale#python#FindProjectRootIni(buffer) abort
\|| filereadable(l:path . '/tox.ini')
\|| filereadable(l:path . '/.pyre_configuration.local')
\|| filereadable(l:path . '/mypy.ini')
\|| filereadable(l:path . '/.mypy.ini')
\|| filereadable(l:path . '/pycodestyle.cfg')
\|| filereadable(l:path . '/.flake8')
\|| filereadable(l:path . '/.flake8rc')

View File

@ -62,25 +62,34 @@ function! ale#test#SetFilename(path) abort
silent! noautocmd execute 'file ' . fnameescape(l:full_path)
endfunction
function! s:RemoveModule(results) abort
function! RemoveNewerKeys(results) abort
for l:item in a:results
if has_key(l:item, 'module')
call remove(l:item, 'module')
endif
if has_key(l:item, 'end_col')
call remove(l:item, 'end_col')
endif
if has_key(l:item, 'end_lnum')
call remove(l:item, 'end_lnum')
endif
endfor
endfunction
" Return loclist data without the module string, only in newer Vim versions.
function! ale#test#GetLoclistWithoutModule() abort
" Return loclist data with only the keys supported by the lowest Vim versions.
function! ale#test#GetLoclistWithoutNewerKeys() abort
let l:results = getloclist(0)
call s:RemoveModule(l:results)
call RemoveNewerKeys(l:results)
return l:results
endfunction
function! ale#test#GetQflistWithoutModule() abort
" Return quickfix data with only the keys supported by the lowest Vim versions.
function! ale#test#GetQflistWithoutNewerKeys() abort
let l:results = getqflist()
call s:RemoveModule(l:results)
call RemoveNewerKeys(l:results)
return l:results
endfunction

View File

@ -64,7 +64,8 @@ function! ale#toggle#ToggleBuffer(buffer) abort
" Disabling ALE globally removes autocmd events, so we cannot enable
" linting locally when linting is disabled globally
if l:enabled && !g:ale_enabled
execute 'echom ''ALE cannot be enabled locally when disabled globally'''
" no-custom-checks
echom 'ALE cannot be enabled locally when disabled globally'
return
endif

View File

@ -3,7 +3,8 @@
function! s:OpenJDTLink(root, uri, line, column, options, result) abort
if has_key(a:result, 'error')
execute 'echoerr a:result.error.message'
" no-custom-checks
echoerr a:result.error.message
return
endif
@ -11,7 +12,8 @@ function! s:OpenJDTLink(root, uri, line, column, options, result) abort
let l:contents = a:result['result']
if type(l:contents) is# type(v:null)
execute 'echoerr ''File content not found'''
" no-custom-checks
echoerr 'File content not found'
endif
" disable autocmd when opening buffer
@ -59,7 +61,8 @@ endfunction
function! s:ReadClassFileContents(uri, result) abort
if has_key(a:result, 'error')
execute 'echoerr a:result.error.message'
" no-custom-checks
echoerr a:result.error.message
return
endif
@ -67,7 +70,8 @@ function! s:ReadClassFileContents(uri, result) abort
let l:contents = a:result['result']
if type(l:contents) is# type(v:null)
execute 'echoerr ''File content not found'''
" no-custom-checks
echoerr 'File content not found'
endif
call setline(1, split(l:contents, '\n'))

View File

@ -25,7 +25,8 @@ function! ale#util#ShowMessage(string, ...) abort
" We have to assume the user is using a monospace font.
if has('nvim') || (a:string !~? "\n" && len(a:string) < &columns)
execute 'echo a:string'
" no-custom-checks
echo a:string
else
call ale#preview#Show(split(a:string, "\n"), extend(
\ {

View File

@ -8,14 +8,21 @@ let g:ale_virtualtext_delay = get(g:, 'ale_virtualtext_delay', 10)
let s:cursor_timer = -1
let s:last_pos = [0, 0, 0]
let s:has_virt_text = 0
let s:emulate_virt = 0
if has('nvim-0.3.2')
let s:ns_id = nvim_create_namespace('ale')
let s:has_virt_text = 1
elseif has('textprop') && has('popupwin')
call prop_type_add('ale', {})
let s:last_popup = -1
let s:has_virt_text = 1
let s:emulate_virt = !has('patch-9.0.0214')
if s:emulate_virt
call prop_type_add('ale', {})
let s:last_virt = -1
else
let s:last_virt = 1
endif
endif
function! ale#virtualtext#Clear() abort
@ -28,10 +35,13 @@ function! ale#virtualtext#Clear() abort
if has('nvim')
call nvim_buf_clear_highlight(l:buffer, s:ns_id, 0, -1)
else
if s:last_popup != -1
if s:emulate_virt && s:last_virt != -1
call prop_remove({'type': 'ale'})
call popup_close(s:last_popup)
let s:last_popup = -1
call popup_close(s:last_virt)
let s:last_virt = -1
elseif s:last_virt != 1
call prop_remove({'id': s:last_virt})
let s:last_virt = 1
endif
endif
endfunction
@ -48,12 +58,12 @@ function! ale#virtualtext#ShowMessage(message, hl_group) abort
if has('nvim')
call nvim_buf_set_virtual_text(l:buffer, s:ns_id, l:line-1, [[l:msg, a:hl_group]], {})
else
elseif s:emulate_virt
let l:left_pad = col('$')
call prop_add(l:line, l:left_pad, {
\ 'type': 'ale',
\})
let s:last_popup = popup_create(l:msg, {
let s:last_virt = popup_create(l:msg, {
\ 'line': -1,
\ 'padding': [0, 0, 0, 1],
\ 'mask': [[1, 1, 1, 1]],
@ -63,6 +73,17 @@ function! ale#virtualtext#ShowMessage(message, hl_group) abort
\ 'wrap': 0,
\ 'zindex': 2
\})
else
let type = prop_type_get(a:hl_group)
if type == {}
call prop_type_add(a:hl_group, {'highlight': a:hl_group})
endif
let s:last_virt = prop_add(l:line, 0, {
\ 'type': a:hl_group,
\ 'text': ' ' . l:msg
\})
endif
endfunction

15
doc/ale-cairo.txt Normal file
View File

@ -0,0 +1,15 @@
===============================================================================
ALE Cairo Integration *ale-cairo-options*
===============================================================================
starknet *ale-cairo-starknet*
g:ale_cairo_starknet_executable *g:ale_cairo_starknet_executable*
*b:ale_cairo_starknet_executable*
Default: `'starknet-compile'`
Overrides the starknet-compile binary after installing the cairo-language.
For more information read 'https://starknet.io/docs/quickstart.html'

View File

@ -49,5 +49,18 @@ g:ale_css_stylelint_use_global *g:ale_css_stylelint_use_global*
See |ale-integrations-local-executables|
===============================================================================
vscodecss *ale-css-vscode*
Website: https://github.com/hrsh7th/vscode-langservers-extracted
Installation
-------------------------------------------------------------------------------
Install VSCode css language server either globally or locally: >
npm install -g vscode-langservers-extracted
<
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View File

@ -98,8 +98,8 @@ should also follow some additional rules designed to prevent mistakes. Some of
these are reported with ALE's `custom-linting-rules` script. See
|ale-development-tests|.
* Don't leave stray `:echo` lines in code. Use `execute 'echo' ...` if you must
echo something.
* Don't leave stray `:echo` lines in code. Write `" no-custom-checks` above
the line if you must echo something.
* For strings use |is#| instead of |==#|, `is?` instead of `==?`, `isnot#`
instead of `!=#`, and `isnot?` instead of `!=?`. This is because `'x' ==# 0`
returns 1, while `'x' is# 0` returns 0, so you will experience fewer issues
@ -154,10 +154,9 @@ ALE runs tests with the following versions of Vim in the following
environments.
1. Vim 8.0.0027 on Linux via GitHub Actions.
2. Vim 8.2.2401 on Linux via GitHub Actions.
2. Vim 8.2.4693 on Linux via GitHub Actions.
3. NeoVim 0.2.0 on Linux via GitHub Actions.
4. NeoVim 0.4.4 on Linux via GitHub Actions.
5. NeoVim 0.5.0 on Linux via GitHub Actions.
4. NeoVim 0.7.0 on Linux via GitHub Actions.
6. Vim 8 (stable builds) on Windows via AppVeyor.
If you are developing ALE code on Linux, Mac OSX, or BSD, you can run ALEs

View File

@ -354,7 +354,7 @@ g:ale_go_staticcheck_options *g:ale_go_staticcheck_options*
g:ale_go_staticcheck_lint_package *g:ale_go_staticcheck_lint_package*
*b:ale_go_staticcheck_lint_package*
Type: |Number|
Default: `0`
Default: `1`
When set to `1`, the whole Go package will be checked instead of only the
current file.

View File

@ -134,7 +134,7 @@ g:ale_haskell_hlint_options g:ale_haskell_hlint_options
hls *ale-haskell-hls*
g:ale_haskell_hls_executable *g:ale_haskell_hls_executable*
*b:ale_haskell_his_executable*
*b:ale_haskell_hls_executable*
Type: |String|
Default: `'haskell-language-server-wrapper'`

View File

@ -2,6 +2,11 @@
ALE HCL Integration *ale-hcl-options*
===============================================================================
packer-fmt *ale-hcl-packer-fmt*
See |ale-packer-fmt-fixer| for information about the available options.
===============================================================================
terraform-fmt *ale-hcl-terraform-fmt*

View File

@ -164,6 +164,19 @@ g:ale_html_tidy_use_global *g:html_tidy_use_global*
See |ale-integrations-local-executables|
===============================================================================
vscodehtml *ale-html-vscode*
Website: https://github.com/hrsh7th/vscode-langservers-extracted
Installation
-------------------------------------------------------------------------------
Install VSCode html language server either globally or locally: >
npm install -g vscode-langservers-extracted
<
===============================================================================
write-good *ale-html-write-good*

View File

@ -153,6 +153,18 @@ g:ale_json_spectral_use_global *g:ale_json_spectral_use_global*
See |ale-integrations-local-executables|
===============================================================================
vscodejson *ale-json-vscode*
Website: https://github.com/hrsh7th/vscode-langservers-extracted
Installation
-------------------------------------------------------------------------------
Install VSCode json language server either globally or locally: >
npm install -g vscode-langservers-extracted
<
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View File

@ -76,6 +76,25 @@ g:ale_lua_luafmt_options *g:ale_lua_luafmt_options*
This variable can be set to pass additional options to the luafmt fixer.
===============================================================================
selene *ale-lua-selene*
g:ale_lua_selene_executable *g:ale_lua_selene_executable*
*b:ale_lua_selene_executable*
Type: |String|
Default: `'selene'`
This variable can be set to use a different executable for selene.
g:ale_lua_selene_options *g:ale_lua_selene_options*
*b:ale_lua_selene_options*
Type: |String|
Default: `''`
This variable can be set to pass additional options to selene.
===============================================================================
stylua *ale-lua-stylua*

View File

@ -2,6 +2,26 @@
ALE OCaml Integration *ale-ocaml-options*
===============================================================================
dune *ale-ocaml-dune*
Dune is a build system for OCaml projects. The `dune format` command is
supported for automatically formatting `dune` and `dune-project` files.
g:ale_ocaml_dune_executable *g:ale_ocaml_dune_executable*
*b:ale_ocaml_dune_executable*
Type: |String|
Default: `'dune'`
This variable can be set to pass the path to dune.
g:ale_ocaml_dune_options *g:ale_ocaml_dune_options*
*b:ale_ocaml_dune_options*
Type: |String|
Default: `''`
This variable can be set to pass additional options to the dune fixer.
===============================================================================
merlin *ale-ocaml-merlin*

25
doc/ale-openscad.txt Normal file
View File

@ -0,0 +1,25 @@
===============================================================================
ALE OpenSCAD Integration *ale-openscad-options*
===============================================================================
sca2d *ale-openscad-sca2d*
g:ale_openscad_sca2d_executable *g:ale_openscad_sca2d_executable*
*b:ale_openscad_sca2d_executable*
Type: |String|
Default: `'sca2d'`
See |ale-integrations-local-executables|
g:ale_openscad_sca2d_options *g:ale_openscad_sca2d_options*
*b:ale_openscad_sca2d_options*
Type: |String|
Default: `''`
This variable can be set to pass options to sca2d.
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

24
doc/ale-packer.txt Normal file
View File

@ -0,0 +1,24 @@
===============================================================================
ALE Packer Integration *ale-packer-options*
===============================================================================
packer-fmt-fixer *ale-packer-fmt-fixer*
g:ale_packer_fmt_executable *g:ale_packer_fmt_executable*
*b:ale_packer_fmt_executable*
Type: |String|
Default: `'packer'`
This variable can be changed to use a different executable for packer.
g:ale_packer_fmt_options *g:ale_packer_fmt_options*
*b:ale_packer_fmt_options*
Type: |String|
Default: `''`
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View File

@ -272,6 +272,33 @@ g:ale_php_php_executable *g:ale_php_php_executable*
This variable sets the executable used for php.
===============================================================================
pint *ale-php-pint*
g:ale_php_pint_executable *g:ale_php_pint_executable*
*b:ale_php_pint_executable*
Type: |String|
Default: `'pint'`
This variable sets the executable used for pint.
g:ale_php_pint_options *g:ale_php_pint_options*
*b:ale_php_pint_options*
Type: |String|
Default: `''`
This variable can be set to pass additional options to pint.
g:ale_php_pint_use_global *g:ale_php_pint_use_global*
*b:ale_php_pint_use_global*
Type: |Boolean|
Default: `get(g:, 'ale_use_global_executables', 0)`
See |ale-integrations-local-executables|
===============================================================================
tlint *ale-php-tlint*

View File

@ -8,13 +8,51 @@ Integration Information
To enable `.proto` file linting, update |g:ale_linters| as appropriate:
>
" Enable linter for .proto files
let g:ale_linters = {'proto': ['protoc-gen-lint', 'protolint']}
let g:ale_linters = {'proto': ['buf-lint', 'protoc-gen-lint', 'protolint']}
To enable `.proto` file fixing, update |g:ale_fixers| as appropriate:
>
" Enable linter for .proto files
let b:ale_fixers = {'proto': ['protolint']}
let b:ale_fixers = {'proto': ['buf-format', 'protolint']}
<
===============================================================================
buf-format *ale-proto-buf-format*
The formatter uses `buf`, a fully-featured Protobuf compiler that doesn't depend
on `protoc`. Make sure the `buf` binary is available in the system path, or
set ale_proto_buf_format_executable.
g:ale_proto_buf_format_executable *g:ale_proto_buf_format_executable*
Type: |String|
Default: 'buf'
This variable can be changed to modify the executable used for buf.
===============================================================================
buf-lint *ale-proto-buf-lint*
The linter uses `buf`, a fully-featured Protobuf compiler that doesn't depend
on `protoc`. Make sure the `buf` binary is available in the system path, or
set ale_proto_buf_lint_executable.
g:ale_proto_buf_lint_executable *g:ale_proto_buf_lint_executable*
Type: |String|
Default: 'buf'
This variable can be changed to modify the executable used for buf.
g:ale_proto_buf_lint_config *g:ale_proto_buf_lint_config*
Type: |String|
Default: `''`
A path to a buf configuration file.
The path to the configuration file can be an absolute path or a relative
path. ALE will search for the relative path in parent directories.
===============================================================================
protoc-gen-lint *ale-proto-protoc-gen-lint*

View File

@ -39,6 +39,7 @@ ALE will look for configuration files with the following filenames. >
tox.ini
.pyre_configuration.local
mypy.ini
.mypy.ini
pycodestyle.cfg
.flake8
.flake8rc
@ -267,8 +268,8 @@ g:ale_python_flake8_change_directory *g:ale_python_flake8_change_directory*
Default: `'project'`
If set to `project`, ALE will switch to the project root before checking file.
If set to `file`, ALE will switch to directory the Python file being
checked with `flake8` is in before checking it.
If set to `file`, ALE will first switch to the directory containing the
Python file being checked with `flake8` before checking it.
You can turn it off with `off` option if you want to control the directory
Python is executed from yourself.
@ -707,6 +708,52 @@ g:ale_python_pyflakes_auto_poetry *g:ale_python_pyflakes_auto_poetry*
if true. This is overridden by a manually-set executable.
===============================================================================
pyflyby *ale-python-pyflyby*
g:ale_python_pyflyby_executable *g:ale_python_pyflyby_executable*
*b:ale_python_pyflyby_executable*
Type: |String|
Default: `'tidy-imports'`
See |ale-integrations-local-executables|
g:ale_python_pyflyby_options *g:ale_python_pyflyby_options*
*b:ale_python_pyflyby_options*
Type: |String|
Default: `''`
This variable can be changed to add command-line arguments to the pyflyby
tidy-imports invocation.
g:ale_python_pyflyby_use_global *g:ale_python_pyflyby_use_global*
*b:ale_python_pyflyby_use_global*
Type: |Number|
Default: `get(g:, 'ale_use_global_executables', 0)`
See |ale-integrations-local-executables|
g:ale_python_pyflyby_auto_pipenv *g:ale_python_pyflyby_auto_pipenv*
*b:ale_python_pyflyby_auto_pipenv*
Type: |Number|
Default: `0`
Detect whether the file is inside a pipenv, and set the executable to `pipenv`
if true. This is overridden by a manually-set executable.
g:ale_python_pyflyby_auto_poetry *g:ale_python_pyflyby_auto_poetry*
*b:ale_python_pyflyby_auto_poetry*
Type: |Number|
Default: `0`
Detect whether the file is inside a poetry, and set the executable to `poetry`
if true. This is overridden by a manually-set executable.
===============================================================================
pylama *ale-python-pylama*

50
doc/ale-rego.txt Normal file
View File

@ -0,0 +1,50 @@
===============================================================================
ALE Rego Integration *ale-rego-options*
===============================================================================
cspell *ale-rego-cspell*
See |ale-cspell-options|
===============================================================================
opacheck *ale-rego-opa-check*
g:ale_rego_opacheck_executable *g:rego_opacheck_executable*
*b:rego_opacheck_executable*
Type: |String|
Default: `'opa'`
This variable can be changed to use a different executable for opa.
g:rego_opacheck_options *g:rego_opacheck_options*
*b:rego_opacheck_options*
Type: |String|
Default: `''`
This variable can be changed to pass custom CLI flags to opa check.
===============================================================================
opafmt *ale-rego-opa-fmt-fixer*
g:ale_opa_fmt_executable *g:ale_opa_fmt_executable*
*b:ale_opa_fmt_executable*
Type: |String|
Default: `'opa'`
This variable can be changed to use a different executable for opa.
g:ale_opa_fmt_options *g:ale_opa_fmt_options*
*b:ale_opa_fmt_options*
Type: |String|
Default: `''`
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View File

@ -219,5 +219,25 @@ g:ale_ruby_standardrb_options *g:ale_ruby_standardrb_options*
This variable can be changed to modify flags given to standardrb.
===============================================================================
syntax_tree *ale-ruby-syntax_tree*
g:ale_ruby_syntax_tree_executable *g:ale_ruby_syntax_tree_executable*
*b:ale_ruby_syntax_tree_executable*
Type: String
Default: `'stree'`
Override the invoked SyntaxTree binary. Set this to `'bundle'` to invoke
`'bundle` `exec` stree'.
g:ale_ruby_syntax_tree_options *g:ale_ruby_syntax_tree_options*
*b:ale_ruby_syntax_tree_options*
Type: |String|
Default: `''`
This variable can be changed to modify flags given to SyntaxTree.
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View File

@ -26,8 +26,10 @@ Integration Information
4. analyzer -- If you have rust-analyzer installed, you might prefer using
this linter over cargo and rls. rust-analyzer also implements the
Language Server Protocol for incremental compilation of Rust code, and is
the next iteration of rls. rust-analyzer, like rls, requires Rust files
to be contained in Cargo projects.
the next iteration of rls. rust-analyzer either requires Rust files to be
contained in Cargo projects or requires the project to be described in
the rust-project.json format:
https://rust-analyzer.github.io/manual.html#non-cargo-based-projects
5. rustfmt -- If you have `rustfmt` installed, you can use it as a fixer to
consistently reformat your Rust code.

View File

@ -95,6 +95,8 @@ Notes:
* `flawfinder`
* `gcc` (`cc`)
* `uncrustify`
* Cairo
* `starknet`
* Chef
* `cookstyle`
* `foodcritic`!!
@ -114,6 +116,7 @@ Notes:
* `ameba`!!
* `crystal`!!
* CSS
* `VSCode CSS language server`
* `cspell`
* `csslint`
* `fecs`
@ -238,8 +241,10 @@ Notes:
* `stack-ghc`
* `stylish-haskell`
* HCL
* `packer-fmt`
* `terraform-fmt`
* HTML
* `VSCode HTML language server`
* `alex`
* `angular`
* `cspell`
@ -283,6 +288,7 @@ Notes:
* `tsserver`
* `xo`
* JSON
* `VSCode JSON language server`
* `cspell`
* `dprint`
* `eslint`
@ -327,6 +333,7 @@ Notes:
* `luac`
* `luacheck`
* `luafmt`
* `selene`
* `stylua`
* Mail
* `alex`
@ -379,6 +386,7 @@ Notes:
* `clangd`
* `uncrustify`
* OCaml
* `dune`
* `merlin` (see |ale-ocaml-merlin|)
* `ocamlformat`
* `ocamllsp`
@ -388,6 +396,10 @@ Notes:
* `ibm_validator`
* `prettier`
* `yamllint`
* OpenSCAD
* `SCA2D`
* Packer
* `packer-fmt-fixer`
* Pascal
* `ptop`
* Pawn
@ -410,6 +422,7 @@ Notes:
* `phpcs`
* `phpmd`
* `phpstan`
* `pint`
* `psalm`!!
* `tlint`
* PO
@ -430,6 +443,8 @@ Notes:
* Prolog
* `swipl`
* proto
* `buf-format`!!
* `buf-lint`!!
* `protoc-gen-lint`!!
* `protolint`!!
* Pug
@ -457,6 +472,7 @@ Notes:
* `pycodestyle`
* `pydocstyle`
* `pyflakes`
* `pyflyby`
* `pylama`!!
* `pylint`!!
* `pylsp`
@ -483,6 +499,10 @@ Notes:
* `ols`
* `reason-language-server`
* `refmt`
* Rego
* `cspell`
* `opacheck`
* `opafmt`
* reStructuredText
* `alex`
* `cspell`
@ -509,6 +529,7 @@ Notes:
* `solargraph`
* `sorbet`
* `standardrb`
* `syntax_tree`
* Rust
* `cargo`!!
* `cspell`
@ -642,6 +663,7 @@ Notes:
* XML
* `xmllint`
* YAML
* `actionlint`
* `circleci`!!
* `prettier`
* `spectral`
@ -654,6 +676,7 @@ Notes:
* Zeek
* `zeek`!!
* Zig
* `zigfmt`
* `zls`
===============================================================================

View File

@ -2,6 +2,51 @@
ALE YAML Integration *ale-yaml-options*
===============================================================================
actionlint *ale-yaml-actionlint*
Website: https://github.com/rhysd/actionlint
Installation
-------------------------------------------------------------------------------
See installation guide: https://github.com/rhysd/actionlint#quick-start
This linter is disabled by default and must be enabled by setting `g:ale_linters`.
To enable it only for Github Action YAML files a configuration like this is
better:
>
au BufRead,BufNewFile */.github/*/*.y{,a}ml
\ let b:ale_linters = {'yaml': ['actionlint']}
<
Options
-------------------------------------------------------------------------------
g:ale_yaml_actionlint_executable *g:ale_yaml_actionlint_executable*
*b:ale_yaml_actionlint_executable*
Type: |String|
Default: `'actionlint'`
This variable can be set to change the path to actionlint.
g:ale_yaml_actionlint_options *g:ale_yaml_actionlint_options*
*b:ale_yaml_actionlint_options*
Type: |String|
Default: `''`
This variable can be set to add extra options to actionlint executable.
For example, to disable running `shellcheck` and `pyflakes` external commands,
you may want to set:
>
let g:ale_yaml_actionlint_options = '-shellcheck= -pyflakes='
<
Please note that passing `-format` as option is not supported at the moment.
===============================================================================
circleci *ale-yaml-circleci*

View File

@ -7,6 +7,18 @@ Integration Information
Currently, the only supported linter for zig is zls.
===============================================================================
zigfmt *ale-zig-zigfmt*
g:ale_zig_zigfmt_executable *g:ale_zig_zigfmt_executable*
*b:ale_zig_zigfmt_executable*
Type: |String|
Default: `'zig'`
The executable that will be run for the `zig fmt` fixer.
===============================================================================
zls *ale-zig-zls*

View File

@ -17,10 +17,11 @@ CONTENTS *ale-contents*
5.1 Completion........................|ale-completion|
5.2 Go To Definition..................|ale-go-to-definition|
5.3 Go To Type Definition.............|ale-go-to-type-definition|
5.4 Find References...................|ale-find-references|
5.5 Hovering..........................|ale-hover|
5.6 Symbol Search.....................|ale-symbol-search|
5.7 Refactoring: Rename, Actions......|ale-refactor|
5.4 Go To Implementation..............|ale-go-to-type-implementation|
5.5 Find References...................|ale-find-references|
5.6 Hovering..........................|ale-hover|
5.7 Symbol Search.....................|ale-symbol-search|
5.8 Refactoring: Rename, Actions......|ale-refactor|
6. Global Options.......................|ale-options|
6.1 Highlights........................|ale-highlights|
7. Linter/Fixer Options.................|ale-integration-options|
@ -637,14 +638,23 @@ documentation for the command for configuring how the location will be
displayed.
-------------------------------------------------------------------------------
5.4 Find References *ale-find-references*
5.4 Go To Implementation *ale-go-to-implementation*
ALE supports jumping to the files and locations where symbols are implemented
through any enabled LSP linters. The locations ALE will jump to depend on the
information returned by LSP servers. The |ALEGoToImplementation| command will
jump to the implementation of symbols under the cursor. See the documentation
for the command for configuring how the location will be displayed.
-------------------------------------------------------------------------------
5.5 Find References *ale-find-references*
ALE supports finding references for symbols though any enabled LSP linters
with the |ALEFindReferences| command. See the documentation for the command
for a full list of options.
-------------------------------------------------------------------------------
5.5 Hovering *ale-hover*
5.6 Hovering *ale-hover*
ALE supports "hover" information for printing brief information about symbols
at the cursor taken from LSP linters. The following commands are supported:
@ -666,7 +676,8 @@ Hover information can be displayed in the preview window instead by setting
When using Neovim or Vim with |popupwin|, if |g:ale_hover_to_floating_preview|
or |g:ale_floating_preview| is set to 1, the hover information will show in a
floating window. And |g:ale_floating_window_border| for the border setting.
floating window. The borders of the floating preview window can be customized
by setting |g:ale_floating_window_border|.
For Vim 8.1+ terminals, mouse hovering is disabled by default. Enabling
|balloonexpr| commands in terminals can cause scrolling issues in terminals,
@ -686,14 +697,14 @@ Documentation for symbols at the cursor can be retrieved using the
|ALEDocumentation| command. This command is only available for `tsserver`.
-------------------------------------------------------------------------------
5.6 Symbol Search *ale-symbol-search*
5.7 Symbol Search *ale-symbol-search*
ALE supports searching for workspace symbols via LSP linters with the
|ALESymbolSearch| command. See the documentation for the command
for a full list of options.
-------------------------------------------------------------------------------
5.7 Refactoring: Rename, Actions *ale-refactor*
5.8 Refactoring: Rename, Actions *ale-refactor*
ALE supports renaming symbols in code such as variables or class names with
the |ALERename| command.
@ -1223,17 +1234,45 @@ g:ale_floating_preview *g:ale_floating_preview*
|g:ale_detail_to_floating_preview| to `1`.
g:ale_floating_preview_popup_opts *g:ale_floating_preview_popup_opts*
Type: |String| or |Dictionary|
Default: `''`
Either a dictionary of options or the string name of a function that returns a
dictionary of options. This will be used as an argument to |popup_create| for
Vim users or |nvim_open_win| for NeoVim users. Note that in either case, the
resulting dictionary is merged with ALE defaults rather than expliciting overriding
them. This only takes effect if |g:ale_floating_preview| is enabled.
NOTE: for Vim users see |popup_create-arguments|, for NeoVim users see
|nvim_open_win| for argument details
For example, to enhance popups with a title: >
function! CustomOpts() abort {
let [l:info, l:loc] = ale#util#FindItemAtCursor(bufnr(''))
return {'title': ' ALE: ' . (l:loc.linter_name) . ' '}
endfunction
<
g:ale_floating_window_border *g:ale_floating_window_border*
Type: |List|
Default: `['|', '-', '+', '+', '+', '+']`
Default: `['|', '-', '+', '+', '+', '+', '|', '-']`
When set to `[]`, window borders are disabled. The elements in the list set
the horizontal, top, top-left, top-right, bottom-right and bottom-left
border characters, respectively.
the the characters for the left side, top, top-left corner, top-right
corner, bottom-right corner, bottom-left corner, right side, and bottom of
the floating window, respectively.
If the terminal supports Unicode, you might try setting the value to
` ['│', '─', '╭', '╮', '╯', '╰']`, to make it look nicer.
` ['│', '─', '╭', '╮', '╯', '╰', '│', '─']`, to make it look nicer.
NOTE: For compatibility with previous versions, if the list does not have
elements for the right side and bottom, the left side and top will be used
instead.
g:ale_history_enabled *g:ale_history_enabled*
@ -1456,9 +1495,9 @@ g:ale_linter_aliases *g:ale_linter_aliases*
\ 'ps1': 'powershell',
\ 'rmarkdown': 'r',
\ 'rmd': 'r',
\ 'svelte': ['svelte', 'javascript'],
\ 'systemverilog': 'verilog',
\ 'typescriptreact': ['typescript', 'tsx'],
\ 'vader': ['vim', 'vader'],
\ 'verilog_systemverilog': ['verilog_systemverilog', 'verilog'],
\ 'vimwiki': 'markdown',
\ 'vue': ['vue', 'javascript'],
@ -1603,6 +1642,7 @@ g:ale_linters *g:ale_linters*
\ 'help': [],
\ 'inko': ['inko'],
\ 'json': ['jsonlint', 'spectral'],
\ 'json': ['jsonlint', 'spectral', 'vscodejson'],
\ 'json5': [],
\ 'jsonc': [],
\ 'perl': ['perlcritic'],
@ -1611,9 +1651,11 @@ g:ale_linters *g:ale_linters*
\ 'rust': ['cargo', 'rls'],
\ 'spec': [],
\ 'text': [],
\ 'vader': ['vimls'],
\ 'vue': ['eslint', 'vls'],
\ 'zsh': ['shell'],
\ 'v': ['v'],
\ 'yaml': ['spectral', 'yaml-language-server', 'yamllint'],
\}
<
This option can be used to enable only a particular set of linters for a
@ -2093,6 +2135,7 @@ g:ale_sign_priority *g:ale_sign_priority*
g:ale_shell *g:ale_shell*
*b:ale_shell*
Type: |String|
Default: not set
@ -2110,6 +2153,7 @@ g:ale_shell *g:ale_shell*
g:ale_shell_arguments *g:ale_shell_arguments*
*b:ale_shell_arguments*
Type: |String|
Default: not set
@ -2754,6 +2798,8 @@ documented in additional help files.
cspell................................|ale-c-cspell|
flawfinder............................|ale-c-flawfinder|
uncrustify............................|ale-c-uncrustify|
cairo...................................|ale-cairo-options|
starknet..............................|ale-cairo-starknet|
chef....................................|ale-chef-options|
cookstyle.............................|ale-chef-cookstyle|
foodcritic............................|ale-chef-foodcritic|
@ -2793,6 +2839,7 @@ documented in additional help files.
fecs..................................|ale-css-fecs|
prettier..............................|ale-css-prettier|
stylelint.............................|ale-css-stylelint|
vscodecss.............................|ale-css-vscode|
cuda....................................|ale-cuda-options|
nvcc..................................|ale-cuda-nvcc|
clangd................................|ale-cuda-clangd|
@ -2895,6 +2942,7 @@ documented in additional help files.
hie...................................|ale-haskell-hie|
ormolu................................|ale-haskell-ormolu|
hcl.....................................|ale-hcl-options|
packer-fmt............................|ale-hcl-packer-fmt|
terraform-fmt.........................|ale-hcl-terraform-fmt|
help....................................|ale-help-options|
cspell................................|ale-help-cspell|
@ -2907,6 +2955,7 @@ documented in additional help files.
prettier..............................|ale-html-prettier|
stylelint.............................|ale-html-stylelint|
tidy..................................|ale-html-tidy|
vscodehtml............................|ale-html-vscode|
write-good............................|ale-html-write-good|
idris...................................|ale-idris-options|
idris.................................|ale-idris-idris|
@ -2949,6 +2998,7 @@ documented in additional help files.
jq....................................|ale-json-jq|
prettier..............................|ale-json-prettier|
spectral..............................|ale-json-spectral|
vscodejson............................|ale-json-vscode|
jsonc...................................|ale-jsonc-options|
eslint................................|ale-jsonc-eslint|
jsonnet.................................|ale-jsonnet-options|
@ -2978,6 +3028,7 @@ documented in additional help files.
luac..................................|ale-lua-luac|
luacheck..............................|ale-lua-luacheck|
luafmt................................|ale-lua-luafmt|
selene................................|ale-lua-selene|
stylua................................|ale-lua-stylua|
markdown................................|ale-markdown-options|
cspell................................|ale-markdown-cspell|
@ -3013,6 +3064,7 @@ documented in additional help files.
clangd................................|ale-objcpp-clangd|
uncrustify............................|ale-objcpp-uncrustify|
ocaml...................................|ale-ocaml-options|
dune..................................|ale-ocaml-dune|
merlin................................|ale-ocaml-merlin|
ocamllsp..............................|ale-ocaml-ocamllsp|
ols...................................|ale-ocaml-ols|
@ -3022,6 +3074,10 @@ documented in additional help files.
ibm_validator.........................|ale-openapi-ibm-validator|
prettier..............................|ale-openapi-prettier|
yamllint..............................|ale-openapi-yamllint|
openscad................................|ale-openscad-options|
sca2d.................................|ale-openscad-sca2d|
packer..................................|ale-packer-options|
packer-fmt-fixer......................|ale-packer-fmt-fixer|
pascal..................................|ale-pascal-options|
ptop..................................|ale-pascal-ptop|
pawn....................................|ale-pawn-options|
@ -3043,6 +3099,7 @@ documented in additional help files.
psalm.................................|ale-php-psalm|
php-cs-fixer..........................|ale-php-php-cs-fixer|
php...................................|ale-php-php|
pint..................................|ale-php-pint|
tlint.................................|ale-php-tlint|
intelephense..........................|ale-php-intelephense|
po......................................|ale-po-options|
@ -3058,6 +3115,8 @@ documented in additional help files.
prolog..................................|ale-prolog-options|
swipl.................................|ale-prolog-swipl|
proto...................................|ale-proto-options|
buf-format............................|ale-proto-buf-format|
buf-lint..............................|ale-proto-buf-lint|
protoc-gen-lint.......................|ale-proto-protoc-gen-lint|
protolint.............................|ale-proto-protolint|
pug.....................................|ale-pug-options|
@ -3087,6 +3146,7 @@ documented in additional help files.
pycodestyle...........................|ale-python-pycodestyle|
pydocstyle............................|ale-python-pydocstyle|
pyflakes..............................|ale-python-pyflakes|
pyflyby...............................|ale-python-pyflyby|
pylama................................|ale-python-pylama|
pylint................................|ale-python-pylint|
pylsp.................................|ale-python-pylsp|
@ -3107,6 +3167,10 @@ documented in additional help files.
ols...................................|ale-reasonml-ols|
reason-language-server................|ale-reasonml-language-server|
refmt.................................|ale-reasonml-refmt|
rego....................................|ale-rego-options|
cspell................................|ale-rego-cspell|
opacheck..............................|ale-rego-opa-check|
opafmt................................|ale-rego-opa-fmt-fixer|
restructuredtext........................|ale-restructuredtext-options|
cspell................................|ale-restructuredtext-cspell|
textlint..............................|ale-restructuredtext-textlint|
@ -3126,6 +3190,7 @@ documented in additional help files.
solargraph............................|ale-ruby-solargraph|
sorbet................................|ale-ruby-sorbet|
standardrb............................|ale-ruby-standardrb|
syntax_tree...........................|ale-ruby-syntax_tree|
rust....................................|ale-rust-options|
analyzer..............................|ale-rust-analyzer|
cargo.................................|ale-rust-cargo|
@ -3253,6 +3318,7 @@ documented in additional help files.
xml.....................................|ale-xml-options|
xmllint...............................|ale-xml-xmllint|
yaml....................................|ale-yaml-options|
actionlint............................|ale-yaml-actionlint|
circleci..............................|ale-yaml-circleci|
prettier..............................|ale-yaml-prettier|
spectral..............................|ale-yaml-spectral|
@ -3265,6 +3331,7 @@ documented in additional help files.
zeek....................................|ale-zeek-options|
zeek..................................|ale-zeek-zeek|
zig.....................................|ale-zig-options|
zigfmt................................|ale-zig-zigfmt|
zls...................................|ale-zig-zls|
@ -3405,6 +3472,33 @@ ALEGoToTypeDefinition *ALEGoToTypeDefinition*
`<Plug>(ale_go_to_type_definition_in_vsplit)` - `:ALEGoToTypeDefinition -vsplit`
ALEGoToImplementation *ALEGoToImplementation*
This works similar to |ALEGoToDefinition| but instead jumps to the
implementation of symbol under the cursor. ALE will jump to a definition if
an LSP server provides a location to jump to. Otherwise, ALE will do nothing.
The locations opened in different ways using the following variations.
`:ALEGoToImplementation -tab` - Open the location in a new tab.
`:ALEGoToImplementation -split` - Open the location in a horizontal split.
`:ALEGoToImplementation -vsplit` - Open the location in a vertical split.
The default method used for navigating to a new location can be changed
by modifying |g:ale_default_navigation|.
You can jump back to the position you were at before going to the definition
of something with jump motions like CTRL-O. See |jump-motions|.
The following Plug mappings are defined for this command, which correspond
to the following commands.
`<Plug>(ale_go_to_implementation)` - `:ALEGoToImplementation`
`<Plug>(ale_go_to_implementation_in_tab)` - `:ALEGoToImplementation -tab`
`<Plug>(ale_go_to_implementation_in_split)` - `:ALEGoToImplementation -split`
`<Plug>(ale_go_to_implementation_in_vsplit)` - `:ALEGoToImplementation -vsplit`
ALEHover *ALEHover*
Print brief information about the symbol under the cursor, taken from any

View File

@ -24,8 +24,10 @@ endif
if !s:has_features
" Only output a warning if editing some special files.
if index(['', 'gitcommit'], &filetype) == -1
execute 'echoerr ''ALE requires NeoVim >= 0.2.0 or Vim 8 with +timers +job +channel'''
execute 'echoerr ''Please update your editor appropriately.'''
" no-custom-checks
echoerr 'ALE requires NeoVim >= 0.2.0 or Vim 8 with +timers +job +channel'
" no-custom-checks
echoerr 'Please update your editor appropriately.'
endif
" Stop here, as it won't work.
@ -150,10 +152,11 @@ let g:ale_hover_to_floating_preview = get(g:, 'ale_hover_to_floating_preview', 0
" Detail uses floating windows in Neovim
let g:ale_detail_to_floating_preview = get(g:, 'ale_detail_to_floating_preview', 0)
" Border setting for floating preview windows in Neovim
" The element in the list presents - horizontal, top, top-left, top-right,
" bottom-right and bottom-left
let g:ale_floating_window_border = get(g:, 'ale_floating_window_border', ['|', '-', '+', '+', '+', '+'])
" Border setting for floating preview windows
" The elements in the list set the characters for the left, top, top-left,
" top-right, bottom-right, bottom-left, right, and bottom of the border
" respectively
let g:ale_floating_window_border = get(g:, 'ale_floating_window_border', ['|', '-', '+', '+', '+', '+', '|', '-'])
" This flag can be set to 0 to disable warnings for trailing whitespace
let g:ale_warn_about_trailing_whitespace = get(g:, 'ale_warn_about_trailing_whitespace', 1)
@ -250,6 +253,9 @@ command! -bar -nargs=* ALEGoToDefinition :call ale#definition#GoToCommandHandler
" Go to type definition for tsserver and LSP
command! -bar -nargs=* ALEGoToTypeDefinition :call ale#definition#GoToCommandHandler('type', <f-args>)
" Go to implementation for tsserver and LSP
command! -bar -nargs=* ALEGoToImplementation :call ale#definition#GoToCommandHandler('implementation', <f-args>)
" Repeat a previous selection in the preview window
command! -bar ALERepeatSelection :call ale#preview#RepeatSelection()
@ -317,6 +323,9 @@ nnoremap <silent> <Plug>(ale_go_to_type_definition) :ALEGoToTypeDefinition<Retur
nnoremap <silent> <Plug>(ale_go_to_type_definition_in_tab) :ALEGoToTypeDefinition -tab<Return>
nnoremap <silent> <Plug>(ale_go_to_type_definition_in_split) :ALEGoToTypeDefinition -split<Return>
nnoremap <silent> <Plug>(ale_go_to_type_definition_in_vsplit) :ALEGoToTypeDefinitionIn -vsplit<Return>
nnoremap <silent> <Plug>(ale_go_to_implementation_in_tab) :ALEGoToImplementation -tab<Return>
nnoremap <silent> <Plug>(ale_go_to_implementation_in_split) :ALEGoToImplementation -split<Return>
nnoremap <silent> <Plug>(ale_go_to_implementation_in_vsplit) :ALEGoToImplementation -vsplit<Return>
nnoremap <silent> <Plug>(ale_find_references) :ALEFindReferences<Return>
nnoremap <silent> <Plug>(ale_hover) :ALEHover<Return>
nnoremap <silent> <Plug>(ale_documentation) :ALEDocumentation<Return>

View File

@ -32,6 +32,7 @@ class Source(Base):
'rust': r'(\.|::)\w*$',
'typescript': r'(\.|\'|")\w*$',
'cpp': r'(\.|::|->)\w*$',
'c': r'(\.|->)\w*$',
}
# Returns an integer for the start position, as with omnifunc.

View File

@ -25,8 +25,7 @@ tests='test/*.vader test/*/*.vader test/*/*/*.vader test/*/*/*.vader'
verbose_flag=''
quiet_flag=''
run_neovim_02_tests=1
run_neovim_04_tests=1
run_neovim_05_tests=1
run_neovim_07_tests=1
run_vim_80_tests=1
run_vim_82_tests=1
run_linters=1
@ -45,8 +44,7 @@ while [ $# -ne 0 ]; do
run_vim_80_tests=0
run_vim_82_tests=0
run_neovim_02_tests=0
run_neovim_04_tests=0
run_neovim_05_tests=0
run_neovim_07_tests=0
run_linters=0
shift
;;
@ -57,24 +55,14 @@ while [ $# -ne 0 ]; do
shift
;;
--neovim-02-only)
run_neovim_04_tests=0
run_neovim_05_tests=0
run_neovim_07_tests=0
run_vim_80_tests=0
run_vim_82_tests=0
run_linters=0
shift
;;
--neovim-04-only)
--neovim-07-only)
run_neovim_02_tests=0
run_neovim_05_tests=0
run_vim_80_tests=0
run_vim_82_tests=0
run_linters=0
shift
;;
--neovim-05-only)
run_neovim_02_tests=0
run_neovim_04_tests=0
run_vim_80_tests=0
run_vim_82_tests=0
run_linters=0
@ -82,23 +70,20 @@ while [ $# -ne 0 ]; do
;;
--vim-only)
run_neovim_02_tests=0
run_neovim_04_tests=0
run_neovim_05_tests=0
run_neovim_07_tests=0
run_linters=0
shift
;;
--vim-80-only)
run_neovim_02_tests=0
run_neovim_04_tests=0
run_neovim_05_tests=0
run_neovim_07_tests=0
run_vim_82_tests=0
run_linters=0
shift
;;
--vim-82-only)
run_neovim_02_tests=0
run_neovim_04_tests=0
run_neovim_05_tests=0
run_neovim_07_tests=0
run_vim_80_tests=0
run_linters=0
shift
@ -107,16 +92,14 @@ while [ $# -ne 0 ]; do
run_vim_80_tests=0
run_vim_82_tests=0
run_neovim_02_tests=0
run_neovim_04_tests=0
run_neovim_05_tests=0
run_neovim_07_tests=0
shift
;;
--fast)
run_vim_80_tests=0
run_vim_82_tests=0
run_neovim_02_tests=0
run_neovim_04_tests=0
run_neovim_05_tests=1
run_neovim_07_tests=1
shift
;;
--help)
@ -131,8 +114,7 @@ while [ $# -ne 0 ]; do
echo ' --build-image Run docker image build only.'
echo ' --neovim-only Run tests only for NeoVim'
echo ' --neovim-02-only Run tests only for NeoVim 0.2'
echo ' --neovim-04-only Run tests only for NeoVim 0.4'
echo ' --neovim-05-only Run tests only for NeoVim 0.5'
echo ' --neovim-07-only Run tests only for NeoVim 0.7'
echo ' --vim-only Run tests only for Vim'
echo ' --vim-80-only Run tests only for Vim 8.0'
echo ' --vim-82-only Run tests only for Vim 8.2'
@ -238,8 +220,7 @@ for vim in $(docker run --rm "$DOCKER_RUN_IMAGE" ls /vim-build/bin | grep '^neov
if ( [[ $vim =~ ^vim-v8.0 ]] && ((run_vim_80_tests)) ) \
|| ( [[ $vim =~ ^vim-v8.2 ]] && ((run_vim_82_tests)) ) \
|| ( [[ $vim =~ ^neovim-v0.2 ]] && ((run_neovim_02_tests)) ) \
|| ( [[ $vim =~ ^neovim-v0.4 ]] && ((run_neovim_04_tests)) ) \
|| ( [[ $vim =~ ^neovim-v0.5 ]] && ((run_neovim_05_tests)) ); then
|| ( [[ $vim =~ ^neovim-v0.7 ]] && ((run_neovim_07_tests)) ); then
echo "Starting Vim: $vim..."
file_number=$((file_number+1))
test/script/run-vader-tests $quiet_flag $verbose_flag "$vim" "$tests" \

View File

@ -75,7 +75,7 @@ formatting.
* [clangd](https://clang.llvm.org/extra/clangd.html)
* [clangtidy](http://clang.llvm.org/extra/clang-tidy/) :floppy_disk:
* [cppcheck](http://cppcheck.sourceforge.net)
* [cpplint](https://github.com/google/styleguide/tree/gh-pages/cpplint)
* [cpplint](https://github.com/cpplint/cpplint)
* [cquery](https://github.com/cquery-project/cquery)
* [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell)
* [flawfinder](https://www.dwheeler.com/flawfinder/)
@ -104,6 +104,8 @@ formatting.
* [flawfinder](https://www.dwheeler.com/flawfinder/)
* [gcc](https://gcc.gnu.org/)
* [uncrustify](https://github.com/uncrustify/uncrustify)
* Cairo
* [starknet](https://starknet.io/docs)
* Chef
* [cookstyle](https://docs.chef.io/cookstyle.html)
* [foodcritic](http://www.foodcritic.io/) :floppy_disk:
@ -123,6 +125,7 @@ formatting.
* [ameba](https://github.com/veelenga/ameba) :floppy_disk:
* [crystal](https://crystal-lang.org/) :floppy_disk:
* CSS
* [VSCode CSS language server](https://github.com/hrsh7th/vscode-langservers-extracted)
* [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell)
* [csslint](http://csslint.net/)
* [fecs](http://fecs.baidu.com/)
@ -247,8 +250,10 @@ formatting.
* [stack-ghc](https://haskellstack.org/)
* [stylish-haskell](https://github.com/jaspervdj/stylish-haskell)
* HCL
* [packer-fmt](https://github.com/hashicorp/packer)
* [terraform-fmt](https://github.com/hashicorp/terraform)
* HTML
* [VSCode HTML language server](https://github.com/hrsh7th/vscode-langservers-extracted)
* [alex](https://github.com/get-alex/alex)
* [angular](https://www.npmjs.com/package/@angular/language-server)
* [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell)
@ -292,6 +297,7 @@ formatting.
* [tsserver](https://github.com/Microsoft/TypeScript/wiki/Standalone-Server-%28tsserver%29)
* [xo](https://github.com/sindresorhus/xo)
* JSON
* [VSCode JSON language server](https://github.com/hrsh7th/vscode-langservers-extracted)
* [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell) :warning:
* [dprint](https://dprint.dev)
* [eslint](http://eslint.org/) :warning:
@ -336,6 +342,7 @@ formatting.
* [luac](https://www.lua.org/manual/5.1/luac.html)
* [luacheck](https://github.com/mpeterv/luacheck)
* [luafmt](https://github.com/trixnz/lua-fmt)
* [selene](https://github.com/Kampfkarren/selene)
* [stylua](https://github.com/johnnymorganz/stylua)
* Mail
* [alex](https://github.com/get-alex/alex)
@ -388,6 +395,7 @@ formatting.
* [clangd](https://clang.llvm.org/extra/clangd.html)
* [uncrustify](https://github.com/uncrustify/uncrustify)
* OCaml
* [dune](https://dune.build/)
* [merlin](https://github.com/the-lambda-church/merlin) see `:help ale-ocaml-merlin` for configuration instructions
* [ocamlformat](https://github.com/ocaml-ppx/ocamlformat)
* [ocamllsp](https://github.com/ocaml/ocaml-lsp)
@ -397,6 +405,10 @@ formatting.
* [ibm_validator](https://github.com/IBM/openapi-validator)
* [prettier](https://github.com/prettier/prettier)
* [yamllint](https://yamllint.readthedocs.io/)
* OpenSCAD
* [SCA2D](https://gitlab.com/bath_open_instrumentation_group/sca2d) :floppy_disk:
* Packer (HCL)
* [packer-fmt-fixer](https://github.com/hashicorp/packer)
* Pascal
* [ptop](https://www.freepascal.org/tools/ptop.var)
* Pawn
@ -413,12 +425,13 @@ formatting.
* [langserver](https://github.com/felixfbecker/php-language-server)
* [phan](https://github.com/phan/phan) see `:help ale-php-phan` to instructions
* [php -l](https://secure.php.net/)
* [php-cs-fixer](http://cs.sensiolabs.org/)
* [php-cs-fixer](https://cs.symfony.com)
* [phpactor](https://github.com/phpactor/phpactor)
* [phpcbf](https://github.com/squizlabs/PHP_CodeSniffer)
* [phpcs](https://github.com/squizlabs/PHP_CodeSniffer)
* [phpmd](https://phpmd.org)
* [phpstan](https://github.com/phpstan/phpstan)
* [pint](https://github.com/laravel/pint) :beer:
* [psalm](https://getpsalm.org) :floppy_disk:
* [tlint](https://github.com/tightenco/tlint)
* PO
@ -439,6 +452,8 @@ formatting.
* Prolog
* [swipl](https://github.com/SWI-Prolog/swipl-devel)
* proto
* [buf-format](https://github.com/bufbuild/buf) :floppy_disk:
* [buf-lint](https://github.com/bufbuild/buf) :floppy_disk:
* [protoc-gen-lint](https://github.com/ckaznocha/protoc-gen-lint) :floppy_disk:
* [protolint](https://github.com/yoheimuta/protolint) :floppy_disk:
* Pug
@ -466,6 +481,7 @@ formatting.
* [pycodestyle](https://github.com/PyCQA/pycodestyle) :warning:
* [pydocstyle](https://www.pydocstyle.org/) :warning:
* [pyflakes](https://github.com/PyCQA/pyflakes)
* [pyflyby](https://github.com/deshaw/pyflyby) :warning:
* [pylama](https://github.com/klen/pylama) :floppy_disk:
* [pylint](https://www.pylint.org/) :floppy_disk:
* [pylsp](https://github.com/python-lsp/python-lsp-server) :warning:
@ -492,6 +508,10 @@ formatting.
* [ols](https://github.com/freebroccolo/ocaml-language-server)
* [reason-language-server](https://github.com/jaredly/reason-language-server)
* [refmt](https://github.com/reasonml/reason-cli)
* Rego
* [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell)
* [opacheck](https://www.openpolicyagent.org/docs/latest/cli/#opa-check)
* [opafmt](https://www.openpolicyagent.org/docs/latest/cli/#opa-fmt)
* reStructuredText
* [alex](https://github.com/get-alex/alex)
* [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell)
@ -518,6 +538,7 @@ formatting.
* [solargraph](https://solargraph.org)
* [sorbet](https://github.com/sorbet/sorbet)
* [standardrb](https://github.com/testdouble/standard)
* [syntax_tree](https://github.com/ruby-syntax-tree/syntax_tree)
* Rust
* [cargo](https://github.com/rust-lang/cargo) :floppy_disk: (see `:help ale-integration-rust` for configuration instructions)
* [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell)
@ -651,10 +672,11 @@ formatting.
* XML
* [xmllint](http://xmlsoft.org/xmllint.html)
* YAML
* [circleci](https://circleci.com/docs/2.0/local-cli) :floppy_disk:
* [actionlint](https://github.com/rhysd/actionlint) :warning:
* [circleci](https://circleci.com/docs/2.0/local-cli) :floppy_disk: :warning:
* [prettier](https://github.com/prettier/prettier)
* [spectral](https://github.com/stoplightio/spectral)
* [swaglint](https://github.com/byCedric/swaglint)
* [swaglint](https://github.com/byCedric/swaglint) :warning:
* [yaml-language-server](https://github.com/redhat-developer/yaml-language-server)
* [yamlfix](https://lyz-code.github.io/yamlfix)
* [yamllint](https://yamllint.readthedocs.io/)
@ -663,4 +685,5 @@ formatting.
* Zeek
* [zeek](http://zeek.org) :floppy_disk:
* Zig
* [zigfmt](https://github.com/ziglang/zig)
* [zls](https://github.com/zigtools/zls)

View File

@ -187,7 +187,7 @@ Execute(ALEImport should request imports correctly for tsserver):
\ 'conn_id': 0,
\ 'request_id': 0,
\ 'source': 'ale-import',
\ 'column': 11,
\ 'column': 21,
\ 'line': 2,
\ 'line_length': 21,
\ 'prefix': 'missingword',
@ -206,7 +206,7 @@ Execute(ALEImport should request imports correctly for tsserver):
\ 'conn_id': 347,
\ 'request_id': 1,
\ 'source': 'ale-import',
\ 'column': 11,
\ 'column': 21,
\ 'line': 2,
\ 'line_length': 21,
\ 'prefix': 'missingword',
@ -229,14 +229,14 @@ Execute(ALEImport should request imports correctly for tsserver):
\ [0, 'ts@completions', {
\ 'file': expand('%:p'),
\ 'includeExternalModuleExports': 1,
\ 'offset': 11,
\ 'offset': 21,
\ 'line': 2,
\ 'prefix': 'missingword',
\ }],
\ [0, 'ts@completionEntryDetails', {
\ 'file': expand('%:p'),
\ 'entryNames': [{'name': 'missingword'}],
\ 'offset': 11,
\ 'offset': 21,
\ 'line': 2,
\ }]
\ ],
@ -282,7 +282,7 @@ Execute(ALEImport should tell the user when no completions were found from tsser
\ 'conn_id': 0,
\ 'request_id': 0,
\ 'source': 'ale-import',
\ 'column': 11,
\ 'column': 21,
\ 'line': 2,
\ 'line_length': 21,
\ 'prefix': 'missingword',
@ -301,7 +301,7 @@ Execute(ALEImport should tell the user when no completions were found from tsser
\ 'conn_id': 347,
\ 'request_id': 1,
\ 'source': 'ale-import',
\ 'column': 11,
\ 'column': 21,
\ 'line': 2,
\ 'line_length': 21,
\ 'prefix': 'missingword',
@ -336,7 +336,7 @@ Execute(ALEImport should request imports correctly for language servers):
\ 'conn_id': 0,
\ 'request_id': 0,
\ 'source': 'ale-import',
\ 'column': 7,
\ 'column': 17,
\ 'line': 2,
\ 'line_length': 17,
\ 'prefix': 'missingword',
@ -355,7 +355,7 @@ Execute(ALEImport should request imports correctly for language servers):
\ 'conn_id': 347,
\ 'request_id': 1,
\ 'source': 'ale-import',
\ 'column': 7,
\ 'column': 17,
\ 'line': 2,
\ 'line_length': 17,
\ 'prefix': 'missingword',
@ -369,7 +369,7 @@ Execute(ALEImport should request imports correctly for language servers):
\ [
\ [0, 'textDocument/completion', {
\ 'textDocument': {'uri': ale#path#ToFileURI(expand('%:p'))},
\ 'position': {'character': 6, 'line': 1}
\ 'position': {'character': 16, 'line': 1}
\ }],
\ ],
\ g:sent_message_list
@ -482,7 +482,7 @@ Execute(ALEImport should tell the user when no completions were found from a lan
\ 'conn_id': 0,
\ 'request_id': 0,
\ 'source': 'ale-import',
\ 'column': 7,
\ 'column': 17,
\ 'line': 2,
\ 'line_length': 17,
\ 'prefix': 'missingword',
@ -501,7 +501,7 @@ Execute(ALEImport should tell the user when no completions were found from a lan
\ 'conn_id': 347,
\ 'request_id': 1,
\ 'source': 'ale-import',
\ 'column': 7,
\ 'column': 17,
\ 'line': 2,
\ 'line_length': 17,
\ 'prefix': 'missingword',
@ -515,7 +515,7 @@ Execute(ALEImport should tell the user when no completions were found from a lan
\ [
\ [0, 'textDocument/completion', {
\ 'textDocument': {'uri': ale#path#ToFileURI(expand('%:p'))},
\ 'position': {'character': 6, 'line': 1}
\ 'position': {'character': 16, 'line': 1}
\ }],
\ ],
\ g:sent_message_list

View File

@ -528,6 +528,38 @@ Execute(Should handle completion messages with textEdit objects):
\ },
\ })
Execute(Should handle completion messages with textEdit objects and no insertTextFormat key):
let g:ale_completion_autoimport = 0
AssertEqual
\ [
\ {'word': 'next_callback', 'dup': 0, 'menu': 'PlayTimeCallback', 'info': '', 'kind': 'v', 'icase': 1, 'user_data': json_encode({'_ale_completion_item': 1})},
\ ],
\ ale#completion#ParseLSPCompletions({
\ 'id': 226,
\ 'jsonrpc': '2.0',
\ 'result': {
\ 'isIncomplete': v:false,
\ 'items': [
\ {
\ 'detail': 'PlayTimeCallback',
\ 'filterText': 'next_callback',
\ 'insertText': 'ignoreme',
\ 'kind': 6,
\ 'label': ' next_callback',
\ 'sortText': '3ee19999next_callback',
\ 'textEdit': {
\ 'newText': 'next_callback',
\ 'range': {
\ 'end': {'character': 13, 'line': 12},
\ 'start': {'character': 4, 'line': 12},
\ },
\ },
\ },
\ ],
\ },
\ })
Execute(Should handle completion messages with the deprecated insertText attribute):
let g:ale_completion_autoimport = 0

View File

@ -499,7 +499,7 @@ Execute(ALEFix should fix files on the save event):
\ 'nr': -1,
\ 'pattern': '',
\ 'valid': 1,
\}], ale#test#GetLoclistWithoutModule()
\}], ale#test#GetLoclistWithoutNewerKeys()
endif
Expect(The buffer should be modified):
@ -547,7 +547,7 @@ Execute(ALEFix should run the linters with b:ale_lint_on_save = 1):
\ 'nr': -1,
\ 'pattern': '',
\ 'valid': 1,
\}], ale#test#GetLoclistWithoutModule()
\}], ale#test#GetLoclistWithoutNewerKeys()
endif
Expect(The buffer should be modified):
@ -579,7 +579,7 @@ Execute(ALEFix should not fix files on :wq):
Assert &modified, 'The was not marked as ''modified'''
" We should not run the linter.
AssertEqual [], ale#test#GetLoclistWithoutModule()
AssertEqual [], ale#test#GetLoclistWithoutNewerKeys()
Expect(The buffer should not be modified):
a
@ -619,7 +619,7 @@ Execute(ALEFix should still lint with no linters to be applied):
\ 'nr': -1,
\ 'pattern': '',
\ 'valid': 1,
\}], ale#test#GetLoclistWithoutModule()
\}], ale#test#GetLoclistWithoutNewerKeys()
endif
Expect(The buffer should be the same):
@ -655,7 +655,7 @@ Execute(ALEFix should still lint when nothing was fixed on save):
\ 'nr': -1,
\ 'pattern': '',
\ 'valid': 1,
\}], ale#test#GetLoclistWithoutModule()
\}], ale#test#GetLoclistWithoutNewerKeys()
endif
Expect(The buffer should be the same):
@ -679,7 +679,7 @@ Execute(ALEFix should not lint the buffer on save if linting on save is disabled
Assert !filereadable(g:test_filename), 'The file should not have been saved'
AssertEqual [], ale#test#GetLoclistWithoutModule()
AssertEqual [], ale#test#GetLoclistWithoutNewerKeys()
Expect(The buffer should be the same):
a
@ -702,7 +702,7 @@ Execute(ALEFix should not lint the buffer on save if linting on save is disabled
Assert !filereadable(g:test_filename), 'The file should not have been saved'
AssertEqual [], ale#test#GetLoclistWithoutModule()
AssertEqual [], ale#test#GetLoclistWithoutNewerKeys()
Expect(The buffer should be the same):
a

View File

@ -0,0 +1,21 @@
Before:
Save g:ale_proto_buf_format_executable
" Use an invalid global executable, so we don't match it.
let g:ale_proto_buf_format_executable = 'xxxinvalid'
call ale#test#SetDirectory('/testplugin/test/fixers')
After:
Restore
call ale#test#RestoreDirectory()
Execute(The buf-format callback should return the correct default values):
call ale#test#SetFilename('../test-files/proto/testfile.proto')
AssertEqual
\ {
\ 'command': ale#Escape('xxxinvalid') . ' format %t',
\ },
\ ale#fixers#buf_format#Fix(bufnr(''))

View File

@ -0,0 +1,36 @@
Before:
Save g:ale_ocaml_dune_executable
Save g:ale_ocaml_dune_options
" Use an invalid global executable, so we don't match it.
let g:ale_ocaml_dune_executable = 'xxxinvalid'
let g:ale_ocaml_dune_options = ''
call ale#test#SetDirectory('/testplugin/test/fixers')
After:
Restore
call ale#test#RestoreDirectory()
Execute(The dune callback should return the correct default values):
call ale#test#SetFilename('../test-files/ocaml/testfile.re')
AssertEqual
\ {
\ 'command': ale#Escape('xxxinvalid')
\ . ' format',
\ },
\ ale#fixers#dune#Fix(bufnr(''))
Execute(The dune callback should include custom dune options):
let g:ale_ocaml_dune_options = "--random-option"
call ale#test#SetFilename('../test-files/ocaml/testfile.re')
AssertEqual
\ {
\ 'command': ale#Escape('xxxinvalid')
\ . ' format'
\ . ' ' . g:ale_ocaml_dune_options,
\ },
\ ale#fixers#dune#Fix(bufnr(''))

View File

@ -0,0 +1,33 @@
Before:
Save g:ale_opa_fmt_executable
Save g:ale_opa_fmt_options
" Use an invalid global executable, so we don't match it.
let g:ale_opa_fmt_executable = 'xxxinvalid'
let g:ale_opa_fmt_options = ''
call ale#test#SetDirectory('/testplugin/test/fixers')
After:
Restore
call ale#test#RestoreDirectory()
Execute(The opa fmt callback should return the correct default values):
AssertEqual
\ {
\ 'command': ale#Escape('xxxinvalid') . ' fmt',
\ },
\ ale#fixers#opafmt#Fix(bufnr(''))
Execute(The opa fmt callback should include custom options):
let g:ale_opa_fmt_options = "--list"
AssertEqual
\ {
\ 'command': ale#Escape('xxxinvalid')
\ . ' fmt'
\ . ' ' . g:ale_opa_fmt_options
\ },
\ ale#fixers#opafmt#Fix(bufnr(''))

View File

@ -0,0 +1,34 @@
Before:
Save g:ale_packer_fmt_executable
Save g:ale_packer_fmt_options
" Use an invalid global executable, so we don't match it.
let g:ale_packer_fmt_executable = 'xxxinvalid'
let g:ale_packer_fmt_options = ''
call ale#test#SetDirectory('/testplugin/test/fixers')
After:
Restore
call ale#test#RestoreDirectory()
Execute(The packer fmt callback should return the correct default values):
AssertEqual
\ {
\ 'command': ale#Escape('xxxinvalid') . ' fmt -',
\ },
\ ale#fixers#packer#Fix(bufnr(''))
Execute(The packer fmt callback should include custom options):
let g:ale_packer_fmt_options = "-list=true"
AssertEqual
\ {
\ 'command': ale#Escape('xxxinvalid')
\ . ' fmt'
\ . ' ' . g:ale_packer_fmt_options
\ . ' -',
\ },
\ ale#fixers#packer#Fix(bufnr(''))

View File

@ -0,0 +1,62 @@
Before:
Save g:ale_php_pint_executable
Save g:ale_php_pint_options
let g:ale_php_pint_executable = 'pint'
let g:ale_php_pint_options = ''
call ale#test#SetDirectory('/testplugin/test/fixers')
After:
Restore
call ale#test#RestoreDirectory()
Execute(project with pint should use local by default):
call ale#test#SetFilename('../test-files/php/project-with-pint/test.php')
AssertEqual
\ ale#path#Simplify(g:dir . '/../test-files/php/project-with-pint/vendor/bin/pint'),
\ ale#fixers#pint#GetExecutable(bufnr(''))
Execute(use-global should override local detection):
let g:ale_php_pint_use_global = 1
call ale#test#SetFilename('../test-files/php/project-with-pint/test.php')
AssertEqual
\ 'pint',
\ ale#fixers#pint#GetExecutable(bufnr(''))
Execute(project without pint should use global):
call ale#test#SetFilename('../test-files/php/project-without-pint/test.php')
AssertEqual
\ 'pint',
\ ale#fixers#pint#GetExecutable(bufnr(''))
Execute(The pint callback should return the correct default values):
call ale#test#SetFilename('../test-files/php/project-without-pint/foo/test.php')
AssertEqual
\ {
\ 'read_temporary_file': 1,
\ 'command': ale#Escape('pint')
\ . ' ' . g:ale_php_pint_options
\ . ' %t'
\ },
\ ale#fixers#pint#Fix(bufnr(''))
Execute(The pint callback should include custom pint options):
let g:ale_php_pint_options = '--test'
call ale#test#SetFilename('../test-files/php/project-without-pint/test.php')
AssertEqual
\ {
\ 'command': ale#Escape(g:ale_php_pint_executable)
\ . ' --test %t',
\ 'read_temporary_file': 1,
\ },
\ ale#fixers#pint#Fix(bufnr(''))

View File

@ -0,0 +1,38 @@
Before:
call ale#assert#SetUpFixerTest('python', 'pyflyby')
let b:bin_dir = has('win32') ? 'Scripts' : 'bin'
After:
call ale#assert#TearDownFixerTest()
unlet! b:bin_dir
Execute(The pyflyby callback should return the correct default values):
call ale#test#SetFilename('../test-files/python/with_virtualenv/subdir/foo/bar.py')
AssertFixer
\ {
\ 'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/tidy-imports')),
\ }
Execute(Pipenv is detected when python_pyflyby_auto_pipenv is set):
let g:ale_python_pyflyby_auto_pipenv = 1
call ale#test#SetFilename('../test-files/python/pipenv/whatever.py')
AssertFixer
\ {
\ 'command': ale#Escape('pipenv') . ' run tidy-imports'
\ }
Execute(Poetry is detected when python_pyflyby_auto_poetry is set):
let g:ale_python_pyflyby_auto_poetry = 1
call ale#test#SetFilename('../test-files/python/poetry/whatever.py')
GivenCommandOutput ['VERSION 5.7.0']
AssertFixer
\ {
\ 'command': ale#Escape('poetry') . ' run tidy-imports'
\ }

View File

@ -14,39 +14,6 @@ Execute(The shfmt callback should return 'shfmt' as default command):
\ ale#fixers#shfmt#Fix(bufnr('')).command =~# '^' . ale#Escape('shfmt'),
\ "Default command name is expected to be 'shfmt'"
Execute(The shfmt callback should return the command with no option as default when noexpandtab is set):
let g:ale_sh_shfmt_executable = 'shfmt'
let g:ale_sh_shfmt_options = ''
setlocal noexpandtab
AssertEqual
\ {
\ 'command': ale#Escape('shfmt'),
\ },
\ ale#fixers#shfmt#Fix(bufnr(''))
Execute(The shfmt callback should return the command specifying indent width by looking shiftwidth as default):
let g:ale_sh_shfmt_executable = 'shfmt'
let g:ale_sh_shfmt_options = ''
setlocal expandtab
setlocal shiftwidth=4
AssertEqual
\ {
\ 'command': ale#Escape('shfmt') . ' -i 4',
\ },
\ ale#fixers#shfmt#Fix(bufnr(''))
Execute(The shfmt callback should return the command specifying indent width by looking tabstop when shiftwidth is 0 as default):
let g:ale_sh_shfmt_executable = 'shfmt'
let g:ale_sh_shfmt_options = ''
setlocal expandtab
setlocal shiftwidth=0
setlocal tabstop=8
AssertEqual
\ {
\ 'command': ale#Escape('shfmt') . ' -i 8',
\ },
\ ale#fixers#shfmt#Fix(bufnr(''))
Execute(The shfmt executable and options should be configurable):
let g:ale_sh_shfmt_executable = 'foobar'
let g:ale_sh_shfmt_options = '--some-option'
@ -54,6 +21,7 @@ Execute(The shfmt executable and options should be configurable):
AssertEqual
\ {
\ 'command': ale#Escape('foobar')
\ . ' -filename=%s'
\ . ' --some-option',
\ },
\ ale#fixers#shfmt#Fix(bufnr(''))

View File

@ -0,0 +1,37 @@
Before:
Save g:ale_ruby_syntax_tree_executable
Save g:ale_ruby_syntax_tree_options
" Use an invalid global executable, so we don't match it.
let g:ale_ruby_syntax_tree_executable = 'xxxinvalid'
let g:ale_ruby_syntax_tree_options = ''
call ale#test#SetDirectory('/testplugin/test/fixers')
After:
Restore
call ale#test#RestoreDirectory()
Execute(The syntax_tree callback should return the correct default values):
call ale#test#SetFilename('../test-files/ruby/dummy.rb')
AssertEqual
\ {
\ 'read_temporary_file': 1,
\ 'command': ale#Escape(g:ale_ruby_syntax_tree_executable)
\ . ' write %t',
\ },
\ ale#fixers#syntax_tree#Fix(bufnr(''))
Execute(The syntax_tree callback should include custom options):
let g:ale_ruby_syntax_tree_options = '--print-width=100 --plugins=plugin/trailing_comma'
call ale#test#SetFilename('../test-files/ruby/with_config/dummy.rb')
AssertEqual
\ {
\ 'read_temporary_file': 1,
\ 'command': ale#Escape(g:ale_ruby_syntax_tree_executable)
\ . ' write --print-width=100 --plugins=plugin/trailing_comma %t',
\ },
\ ale#fixers#syntax_tree#Fix(bufnr(''))

View File

@ -0,0 +1,20 @@
Before:
call ale#assert#SetUpFixerTest('zig', 'zigfmt')
After:
call ale#assert#TearDownFixerTest()
Execute(The zig callback should return the correct default values):
AssertFixer {
\ 'command': ale#Escape('zig') . ' fmt %t',
\ 'read_temporary_file': 1,
\}
Execute(The zig callback should allow custom zig executables):
let g:ale_zig_zigfmt_executable = 'foo/bar'
AssertFixer {
\ 'command': ale#Escape('foo/bar') . ' fmt %t',
\ 'read_temporary_file': 1,
\}

View File

@ -0,0 +1,43 @@
Before:
runtime! ale/handlers/actionlint.vim
After:
unlet! g:ale_yaml_actionlint_options
call ale#linter#Reset()
Execute(Problems should be parsed correctly for actionlint):
AssertEqual
\ [
\ {
\ 'lnum': 2,
\ 'col': 1,
\ 'type': 'E',
\ 'text': '"jobs" section is missing in workflow',
\ 'code': 'syntax-check',
\ },
\ {
\ 'lnum': 56,
\ 'col': 23,
\ 'type': 'E',
\ 'text': 'property "unknown_input" is not defined in object type {input7: bool; input0: any; input1: any; input2: string; input3: any; input4: any; input5: number; input6: number}',
\ 'code': 'expression',
\ },
\ ],
\ ale#handlers#actionlint#Handle(bufnr(''), [
\ '.codecov.yaml:2:1: "jobs" section is missing in workflow [syntax-check]',
\ 'workflow_call_event.yaml:56:23: property "unknown_input" is not defined in object type {input7: bool; input0: any; input1: any; input2: string; input3: any; input4: any; input5: number; input6: number} [expression]',
\ ])
Execute(Command should always have --no-color and --oneline options):
let g:ale_yaml_actionlint_options = ''
AssertEqual
\ '%e --no-color --oneline %t',
\ ale#handlers#actionlint#GetCommand(bufnr(''))
Execute(Options should be added to command):
let g:ale_yaml_actionlint_options = '-shellcheck= -pyflakes='
AssertEqual
\ '%e -shellcheck= -pyflakes= --no-color --oneline %t',
\ ale#handlers#actionlint#GetCommand(bufnr(''))

View File

@ -19,10 +19,17 @@ Execute(Basic problems should be parsed correctly):
\ 'lnum': 2,
\ 'col': 16,
\ },
\ {
\ 'type': 'I',
\ 'text': 'dead_code: Dead code. Try removing the code, or fixing the code before it so that it can be reached.',
\ 'lnum': 8,
\ 'col': 3,
\ },
\ ],
\ ale_linters#dart#dart_analyze#Handle(bufnr(''), [
\ 'Analyzing main.dart...',
\ ' error - main.dart:5:1 - Expected to find ''}'' - expected_token',
\ ' warning - main.dart:2:16 - A value of type ''String'' can''t be assigned to a variable of type ''int'' - invalid_assignment',
\ '1 error and 1 warning found.',
\ 'warning - main.dart:2:16 - A value of type ''String'' can''t be assigned to a variable of type ''int'' - invalid_assignment',
\ ' info - main.dart:8:3 - Dead code. Try removing the code, or fixing the code before it so that it can be reached. - dead_code',
\ '3 issues found.',
\ ])

View File

@ -130,3 +130,48 @@ Execute(The ghc handler should handle stack 1.5.1 output):
\ ' 160 | pattern F :: Exp a',
\ ' | ^^^^^',
\ ])
Execute(The ghc handler should handle ghc panic):
let g:detail = [
\ '[15 of 15] Compiling SizedTypes.List',
\ 'ghc: panic! (the ''impossible'' happened)',
\ ' (GHC version 8.10.3:',
\ ' src/SizedTypes/List.hs:(46,19)-(50,0) Specified type does not refine Haskell type for `SizedTypes.List.out` (Plugged Init types new)',
\ ' The Liquid type',
\ ' .',
\ ' GHC.Types.Int -> (SizedTypes.List.List a) -> (_, (SizedTypes.List.List a))',
\ ' .',
\ ' is inconsistent with the Haskell type',
\ ' .',
\ ' forall p a ->',
\ 'p -> SizedTypes.List.List a -> (a, SizedTypes.List.List a)',
\ ' .',
\ ' defined at src/SizedTypes/List.hs:52:1-3',
\ ' .',
\ ' Specifically, the Liquid component',
\ ' .',
\ ' {VV##0 : GHC.Types.Int | VV##0 >= 0}',
\ ' .',
\ ' is inconsistent with the Haskell component',
\ ' .',
\ ' p',
\ ' .',
\ ' ',
\ ' HINT: Use the hole ''_'' instead of the mismatched component (in the Liquid specification)',
\ '',
\ 'Please report this as a GHC bug: https://www.haskell.org/ghc/reportabug',
\ '',
\ ''
\ ]
AssertEqual
\ [
\ {
\ 'lnum': 1,
\ 'col': 1,
\ 'type': 'E',
\ 'text': 'ghc panic!',
\ 'detail': join(g:detail[1:-3], "\n"),
\ },
\ ],
\ ale#handlers#haskell#HandleGHCFormat(bufnr(''), g:detail)
unlet g:detail

View File

@ -13,19 +13,21 @@ Execute (The golangci-lint handler should handle names with spaces):
\ 'C:\something\file with spaces.go',
\ '12',
\ '3',
\ 'expected ''package'', found ''IDENT'' gibberish (staticcheck)',
\ 'expected ''package'', found ''IDENT'' gibberish',
\ 'staticcheck',
\ ],
\ [
\ 'C:\something\file with spaces.go',
\ '37',
\ '5',
\ 'expected ''package'', found ''IDENT'' gibberish (golint)',
\ 'expected ''package'', found ''IDENT'' gibberish',
\ 'golint',
\ ],
\ ],
\ map(ale_linters#go#golangci_lint#GetMatches([
\ 'C:\something\file with spaces.go:12:3: expected ''package'', found ''IDENT'' gibberish (staticcheck)',
\ 'C:\something\file with spaces.go:37:5: expected ''package'', found ''IDENT'' gibberish (golint)',
\ ]), 'v:val[1:4]')
\ ]), 'v:val[1:5]')
Execute (The golangci-lint handler should handle paths correctly):
call ale#test#SetFilename('app/test.go')
@ -38,14 +40,14 @@ Execute (The golangci-lint handler should handle paths correctly):
\ 'lnum': 12,
\ 'col': 3,
\ 'text': 'expected ''package'', found ''IDENT'' gibberish (staticcheck)',
\ 'type': 'E',
\ 'type': 'W',
\ 'filename': ale#path#Simplify(expand('%:p:h') . '/test.go'),
\ },
\ {
\ 'lnum': 37,
\ 'col': 5,
\ 'text': 'expected ''package'', found ''IDENT'' gibberish (golint)',
\ 'type': 'E',
\ 'type': 'W',
\ 'filename': ale#path#Simplify(expand('%:p:h') . '/test.go'),
\ },
\ ],
@ -53,3 +55,30 @@ Execute (The golangci-lint handler should handle paths correctly):
\ file . ':12:3: expected ''package'', found ''IDENT'' gibberish (staticcheck)',
\ file . ':37:5: expected ''package'', found ''IDENT'' gibberish (golint)',
\ ])
Execute (The golangci-lint handler should handle only typecheck lines as errors):
call ale#test#SetFilename('app/main.go')
let file = ale#path#GetAbsPath(expand('%:p:h'), 'test.go')
AssertEqual
\ [
\ {
\ 'lnum': 30,
\ 'col': 5,
\ 'text': 'variable ''err'' is not used (typecheck)',
\ 'type': 'E',
\ 'filename': ale#path#Simplify(expand('%:p:h') . '/test.go'),
\ },
\ {
\ 'lnum': 505,
\ 'col': 75,
\ 'text': 'Magic number: 404, in <argument> detected (gomnd)',
\ 'type': 'W',
\ 'filename': ale#path#Simplify(expand('%:p:h') . '/test.go'),
\ }
\ ],
\ ale_linters#go#golangci_lint#Handler(bufnr(''), [
\ file . ':30:5: variable ''err'' is not used (typecheck)',
\ file . ':505:75: Magic number: 404, in <argument> detected (gomnd)',
\ ])

View File

@ -0,0 +1,38 @@
Before:
runtime ale_linters/lua/selene.vim
After:
Restore
call ale#linter#Reset()
Execute(The selene handler for Lua should parse input correctly):
AssertEqual
\ [
\ {
\ 'lnum': 1,
\ 'end_lnum': 2,
\ 'col': 1,
\ 'end_col': 3,
\ 'text': 'empty if block',
\ 'code': 'empty_if',
\ 'type': 'W',
\ },
\ {
\ 'lnum': 1,
\ 'end_lnum': 1,
\ 'col': 4,
\ 'end_col': 11,
\ 'text': 'comparing things to nan directly is not allowed',
\ 'code': 'compare_nan',
\ 'type': 'E',
\ 'detail': "comparing things to nan directly is not allowed\n\ntry: `x ~= x` instead"
\ },
\ ],
\ ale_linters#lua#selene#Handle(0, [
\ '{"severity":"Warning","code":"empty_if","message":"empty if block","primary_label":{"span":{"start":0,"start_line":0,"start_column":0,"end":20,"end_line":1,"end_column":3},"message":""},"notes":[],"secondary_labels":[]}',
\ '{"severity":"Error","code":"compare_nan","message":"comparing things to nan directly is not allowed","primary_label":{"span":{"start":3,"start_line":0,"start_column":3,"end":11,"end_line":0,"end_column":11},"message":""},"notes":["try: `x ~= x` instead"],"secondary_labels":[]}',
\ 'Results:',
\ '1 errors',
\ '1 warnings',
\ '0 parse errors',
\ ])

View File

@ -0,0 +1,76 @@
Before:
call ale#test#SetDirectory('/testplugin/test/handler')
" Load sca2d
runtime ale_linters/openscad/sca2d.vim
After:
call ale#test#RestoreDirectory()
call ale#linter#Reset()
Execute(The openscad handler should handle sca2d output):
AssertEqual
\ [
\ {
\ 'filename': ale#path#Simplify(g:dir . '/awesome_project.scad'),
\ 'lnum': 7,
\ 'type': 'E',
\ 'col': 42,
\ 'text': 'Module `corcle` used but never defined.',
\ 'detail': 'E2002: Module `corcle` used but never defined.',
\ },
\ ],
\ ale#handlers#openscad#SCA2D_callback(bufnr(''), [
\ 'awesome_project.scad:7:42: E2002: Module `corcle` used but never defined.',
\ '',
\ 'SCA2D message summary',
\ '=====================',
\ 'Fatal errors: 0',
\ 'Errors: 1',
\ 'Warnings: 0',
\ 'Info: 0',
\ 'Depreciated 0',
\ ])
AssertEqual
\ [
\ {
\ 'filename': ale#path#Simplify(g:dir . '/awesome_project.scad'),
\ 'lnum': 1,
\ 'type': 'E',
\ 'col': 37,
\ 'text': 'Cannot read file due to syntax error: - No terminal matches ''}'' in the current parser context',
\ 'detail': 'F0001: Cannot read file due to syntax error: - No terminal matches ''}'' in the current parser context',
\ },
\ ],
\ ale#handlers#openscad#SCA2D_callback(bufnr(''), [
\ 'awesome_project.scad:1:1: F0001: Cannot read file due to syntax error:',
\ ' - No terminal matches ''}'' in the current parser context, at line 1 col 37',
\ ' - ',
\ ' - translate([ 0, 0, 0 ]) { circle(10) }',
\ ' - ^',
\ ' - Expected one of: ',
\ ' - * IF',
\ ' - * LET',
\ ' - * FOR',
\ ' - * FUNC_CALL_NAME',
\ ' - * TERMINATION',
\ ' - * STAR',
\ ' - * LBRACE',
\ ' - * BANG',
\ ' - * ASSIGN',
\ ' - * PERCENT',
\ ' - * HASH',
\ ' - * INTERSECTION_FOR',
\ ' - ',
\ 'If you belive this is a bug in SCA2D please report it to us.',
\ '',
\ '',
\ 'SCA2D message summary',
\ '=====================',
\ 'Fatal errors: 1',
\ 'Errors: 0',
\ 'Warnings: 0',
\ 'Info: 0',
\ 'Depreciated 0',
\ ])

View File

@ -12,10 +12,13 @@ After:
silent file something_else.py
Execute(The pylama handler should handle no messages):
AssertEqual [], ale_linters#python#pylama#Handle(bufnr(''), [])
Execute(The pylama handler should handle no messages with version older than 8.1.4):
AssertEqual [], ale_linters#python#pylama#Handle(bufnr(''), [8, 0, 5], [])
Execute(The pylama handler should handle basic warnings and syntax errors):
Execute(The pylama handler should handle no messages with version newer or equal than 8.1.4):
AssertEqual [], ale_linters#python#pylama#Handle(bufnr(''), [8, 2, 0], [])
Execute(The pylama handler should handle basic warnings and syntax errors with version older than 8.1.4):
AssertEqual
\ [
\ {
@ -83,7 +86,7 @@ Execute(The pylama handler should handle basic warnings and syntax errors):
\ 'text': 'Invalid string quote ", should be '' [pylint]',
\ },
\ ],
\ ale_linters#python#pylama#Handle(bufnr(''), [
\ ale_linters#python#pylama#Handle(bufnr(''), [8, 0, 5], [
\ 'No config file found, using default configuration',
\ 'index.py:8:1: W0611 ''foo'' imported but unused [pyflakes]',
\ 'index.py:8:0: E0401 Unable to import ''foo'' [pylint]',
@ -95,7 +98,79 @@ Execute(The pylama handler should handle basic warnings and syntax errors):
\ 'index.py:20:0: C4001 Invalid string quote ", should be '' [pylint]',
\ ])
Execute(The pylama handler should handle tracebacks with parsable messages):
Execute(The pylama handler should handle basic warnings and syntax errors with version newer than 8.1.4):
AssertEqual
\ [
\ {
\ 'lnum': 8,
\ 'col': 1,
\ 'code': 'W0611',
\ 'type': 'W',
\ 'sub_type': '',
\ 'text': '''foo'' imported but unused [pyflakes]',
\ },
\ {
\ 'lnum': 8,
\ 'col': 0,
\ 'code': 'E0401',
\ 'type': 'E',
\ 'sub_type': '',
\ 'text': 'Unable to import ''foo'' [pylint]',
\ },
\ {
\ 'lnum': 10,
\ 'col': 1,
\ 'code': 'E302',
\ 'type': 'E',
\ 'sub_type': '',
\ 'text': 'expected 2 blank lines, found 1 [pycodestyle]',
\ },
\ {
\ 'lnum': 11,
\ 'col': 1,
\ 'code': 'D401',
\ 'type': 'W',
\ 'sub_type': 'style',
\ 'text': 'First line should be in imperative mood (''Get'', not ''Gets'') [pydocstyle]',
\ },
\ {
\ 'lnum': 15,
\ 'col': 81,
\ 'code': 'E501',
\ 'type': 'E',
\ 'sub_type': '',
\ 'text': 'line too long (96 > 80 characters) [pycodestyle]',
\ },
\ {
\ 'lnum': 16,
\ 'col': 1,
\ 'code': 'D203',
\ 'type': 'W',
\ 'sub_type': 'style',
\ 'text': '1 blank line required before class docstring (found 0) [pydocstyle]',
\ },
\ {
\ 'lnum': 18,
\ 'col': 1,
\ 'code': 'D107',
\ 'type': 'W',
\ 'sub_type': 'style',
\ 'text': 'Missing docstring in __init__ [pydocstyle]',
\ },
\ {
\ 'lnum': 20,
\ 'col': 0,
\ 'code': 'C4001',
\ 'type': 'W',
\ 'sub_type': 'style',
\ 'text': 'Invalid string quote ", should be '' [pylint]',
\ },
\ ],
\ ale_linters#python#pylama#Handle(bufnr(''), [8, 2, 0], [
\ '[{"source":"pyflakes","col":1,"lnum":8,"etype":"W","message":"''foo'' imported but unused","filename":"index.py","number":"W0611"},{"source":"pylint","col":0,"lnum":8,"etype":"E","message":"Unable to import ''foo''","filename":"index.py","number":"E0401"},{"source":"pycodestyle","col":1,"lnum":10,"etype":"E","message":"expected 2 blank lines, found 1","filename":"index.py","number":"E302"},{"source":"pydocstyle","col":1,"lnum":11,"etype":"D","message":"First line should be in imperative mood (''Get'', not ''Gets'')","filename":"index.py","number":"D401"},{"source":"pycodestyle","col":81,"lnum":15,"etype":"E","message":"line too long (96 > 80 characters)","filename":"index.py","number":"E501"},{"source":"pydocstyle","col":1,"lnum":16,"etype":"D","message":"1 blank line required before class docstring (found 0)","filename":"index.py","number":"D203"},{"source":"pydocstyle","col":1,"lnum":18,"etype":"D","message":"Missing docstring in __init__","filename":"index.py","number":"D107"},{"source":"pylint","col":0,"lnum":20,"etype":"C","message":"Invalid string quote \", should be ''","filename":"index.py","number":"C4001"}]',
\ ])
Execute(The pylama handler should handle tracebacks with parsable messages with version older than 8.1.4):
AssertEqual
\ [
\ {
@ -135,7 +210,7 @@ Execute(The pylama handler should handle tracebacks with parsable messages):
\ 'text': 'line too long (96 > 80 characters) [pycodestyle]',
\ },
\ ],
\ ale_linters#python#pylama#Handle(bufnr(''), [
\ ale_linters#python#pylama#Handle(bufnr(''), [8, 0, 5], [
\ 'Traceback (most recent call last):',
\ ' File "/usr/local/lib/python2.7/site-packages/pylama/core.py", line 66, in run',
\ ' path, code=code, ignore=ignore, select=select, params=lparams)',
@ -158,7 +233,7 @@ Execute(The pylama handler should handle tracebacks with parsable messages):
" Note: This is probably a bug, since all pylama plugins produce codes, but
" should be handled for compatibility.
" Note: The pylama isort plugin is distributed in the isort package.
Execute(The pylama handler should handle messages without codes):
Execute(The pylama handler should handle messages without codes with version older than 8.1.4):
AssertEqual
\ [
\ {
@ -170,13 +245,13 @@ Execute(The pylama handler should handle messages without codes):
\ 'text': 'Incorrectly sorted imports. [isort]'
\ },
\ ],
\ ale_linters#python#pylama#Handle(bufnr(''), [
\ ale_linters#python#pylama#Handle(bufnr(''), [8, 0, 5], [
\ 'index.py:0:0: Incorrectly sorted imports. [isort]',
\ ])
" Note: This is a pylama bug, but should be handled for compatibility.
" See https://github.com/klen/pylama/pull/146
Execute(The pylama handler should handle message codes followed by a colon):
Execute(The pylama handler should handle message codes followed by a colon with version older than 8.1.4):
AssertEqual
\ [
\ {
@ -188,6 +263,6 @@ Execute(The pylama handler should handle message codes followed by a colon):
\ 'text': 'Found commented out code: # needs_sphinx = ''1.0'' [eradicate]',
\ },
\ ],
\ ale_linters#python#pylama#Handle(bufnr(''), [
\ ale_linters#python#pylama#Handle(bufnr(''), [8, 0, 5], [
\ 'index.py:31:1: E800: Found commented out code: # needs_sphinx = ''1.0'' [eradicate]',
\ ])

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