Compare commits

..

40 Commits

Author SHA1 Message Date
copilot-swe-agent[bot]
014c959fee Improve comment clarity in FindCompileCommands
Co-authored-by: w0rp <3518142+w0rp@users.noreply.github.com>
2026-02-12 00:25:08 +00:00
copilot-swe-agent[bot]
520c775c6a Fix FindCompileCommands to handle absolute paths in c_build_dir_names
Use ale#path#GetAbsPath to resolve build directory paths, which correctly
handles both absolute and relative paths. When the dirname is absolute,
derive the project root from the parent of the build directory.

Co-authored-by: w0rp <3518142+w0rp@users.noreply.github.com>
2026-02-12 00:24:39 +00:00
copilot-swe-agent[bot]
7f79d30fb9 Initial plan 2026-02-12 00:20:49 +00:00
w0rp
cb8c4662aa Fix #5062 - Keep ALE LSP compatible with Neovim 0.10 and 0.11+
Some checks failed
CI / build_image (push) Has been cancelled
CI / test_ale (--linters-only) (push) Has been cancelled
CI / test_ale (--lua-only) (push) Has been cancelled
CI / test_ale (--neovim-07-only) (push) Has been cancelled
CI / test_ale (--neovim-08-only) (push) Has been cancelled
CI / test_ale (--vim-80-only) (push) Has been cancelled
CI / test_ale (--vim-90-only) (push) Has been cancelled
2026-02-12 00:12:54 +00:00
w0rp
d87b4956ad Tell OpenCode how to write ALE code 2026-02-11 21:14:09 +00:00
PsickOSSH
3c837714cd feat(rstcheck): Add automatic --config support with version check (#5095)
* Add automatic --config support for rstcheck >= 3.4.0
* Add tests for rstcheck

Co-authored-by: PsickOSSH <PsickOSSH@protonmail.com>
Co-authored-by: w0rp <devw0rp@gmail.com>
2026-02-11 21:12:30 +00:00
w0rp
bee0b49067 Truncate astro test files to quiet dependabot
Some checks failed
CI / build_image (push) Has been cancelled
CI / test_ale (--linters-only) (push) Has been cancelled
CI / test_ale (--lua-only) (push) Has been cancelled
CI / test_ale (--neovim-07-only) (push) Has been cancelled
CI / test_ale (--neovim-08-only) (push) Has been cancelled
CI / test_ale (--vim-80-only) (push) Has been cancelled
CI / test_ale (--vim-90-only) (push) Has been cancelled
2026-02-11 20:21:57 +00:00
w0rp
be0dfdb671 Skip ALE docker download attempts
Turns out the "image" variable never finds a local image any more
because the "docker.io/" part isn't part of the image name locally,
so we must alter the string slightly to find a local copy.
2026-02-11 20:16:15 +00:00
yoan667
b5f8cb296a doc goimport (#5093)
Some checks failed
CI / build_image (push) Has been cancelled
CI / test_ale (--linters-only) (push) Has been cancelled
CI / test_ale (--lua-only) (push) Has been cancelled
CI / test_ale (--neovim-07-only) (push) Has been cancelled
CI / test_ale (--neovim-08-only) (push) Has been cancelled
CI / test_ale (--vim-80-only) (push) Has been cancelled
CI / test_ale (--vim-90-only) (push) Has been cancelled
2026-02-07 17:24:34 +09:00
PsickOSSH
af5a38c697 refactor: use ale#Pad for option padding across the codebase (#5091)
Co-authored-by: PsickOSSH <PsickOSSH@protonmail.com>
2026-02-07 17:23:48 +09:00
blobmasterbrian
e762262f44 add option to lint diff buffers (#3185)
Some checks failed
CI / build_image (push) Has been cancelled
CI / test_ale (--linters-only) (push) Has been cancelled
CI / test_ale (--lua-only) (push) Has been cancelled
CI / test_ale (--neovim-07-only) (push) Has been cancelled
CI / test_ale (--neovim-08-only) (push) Has been cancelled
CI / test_ale (--vim-80-only) (push) Has been cancelled
CI / test_ale (--vim-90-only) (push) Has been cancelled
* add option to lint diff buffers
* fix misaligned doc tag
* update docs
2026-02-06 18:47:52 +00:00
Mathis Bernadet
6d99629461 Add missing space to gcc linter (#4791). (#5088)
Some checks failed
CI / build_image (push) Has been cancelled
CI / test_ale (--linters-only) (push) Has been cancelled
CI / test_ale (--lua-only) (push) Has been cancelled
CI / test_ale (--neovim-07-only) (push) Has been cancelled
CI / test_ale (--neovim-08-only) (push) Has been cancelled
CI / test_ale (--vim-80-only) (push) Has been cancelled
CI / test_ale (--vim-90-only) (push) Has been cancelled
Co-authored-by: Mathis Bernadet <matbernadet@emi.u-bordeaux.fr>
2026-01-25 16:42:46 +09:00
Steve Matney
f730dedca7 Utilizing -fzf for tsserver responses along with regular lsp responses (#5084)
* Utilizing -fzf for tsserver responses along with regular lsp responses

* Refactoring FormatResponseItem in references.vim to accept response item config
2026-01-25 16:42:14 +09:00
Holger Detering
9b51f66960 Fix markdownlint output format (#5085)
* test: Add failing tests for markdownlint 0.47.0 output format

Add two new test cases to verify the markdownlint handler's ability to
parse output from version 0.47.0, which includes severity keywords
("error" or "warning"). These tests will fail with the current
implementation, demonstrating the need for a fix to handle the new
output format.

The tests specifically verify:
- Parsing of error severity keyword
- Parsing of warning severity keyword
- Correct mapping of severity to ALE type (E/W)

Backward compatibility with version 0.46.0 is already verified by
the existing ests.

* fix: Update markdownlint handler for version 0.47.0 output format

Update the markdownlint handler to support the new output format
introduced in version 0.47.0, which includes severity keywords ("error"
and "warning") after the column number.

Changes:
- Updated regex pattern to capture optional severity keyword
- Added type mapping logic (error → 'E', warning → 'W')
- Adjusted match indices for rule ID and description text
- Maintained backward compatibility with version 0.46.0

All tests now pass, including the new tests for 0.47.0 format.

* style: Fix vint linting errors in markdownlint handler

- Add blank line before if statement for better readability
- Replace `==#` with `is#` for case-sensitive comparison
2026-01-25 16:37:20 +09:00
gumballriggy
e3c1528619 fix: replace deprecated client.request method call with colon syntax (#5081)
* Update lsp.lua

replace deprecated client.request method call with colon syntax

* fixy

same as b4 but for client.notify now

* how did this even happen
2026-01-25 16:36:54 +09:00
yoan667
646d956630 fix vale option (#5086) 2026-01-25 16:30:53 +09:00
PsickOSSH
d59cb7b3c2 fix-proselint (#5074) 2026-01-25 16:29:03 +09:00
halfcrazy
c0dd8167a6 fix gopls without setting ale_go_gopls_init_options (#5059) 2026-01-25 16:25:25 +09:00
Adrian Vollmer
8eb4803da9 Add pymarkdown fixer (#5045)
Some checks failed
CI / build_image (push) Has been cancelled
CI / test_ale (--linters-only) (push) Has been cancelled
CI / test_ale (--lua-only) (push) Has been cancelled
CI / test_ale (--neovim-07-only) (push) Has been cancelled
CI / test_ale (--neovim-08-only) (push) Has been cancelled
CI / test_ale (--vim-80-only) (push) Has been cancelled
CI / test_ale (--vim-90-only) (push) Has been cancelled
2025-12-21 18:34:05 +09:00
John Jackson
0360a73644 Add ReScript support (#5072)
This adds support for both rescript format and rescript-language-server.

Closes https://github.com/dense-analysis/ale/issues/3335
2025-12-21 18:25:42 +09:00
bretello
dd6e6f1b15 ALEFindReferences: add -fzf flag to show output in fzf (#5018)
* references: add ALEFindReferences -fzf option

Allows using -fzf to show previews using fzf.vim. Includes:

- add support for opening in bufers, splits, tabs and for adding matches quickfix
- add support for -relative
- add fzf preview `--highlight-line` option
- add fzf.vim autoload module

* tests: fix references tests for fzf support update
2025-12-21 13:06:34 +09:00
Eric T. Johnson
fa3d4f2f13 cppcheck: don't pass source file if --project is specified (#5075)
This is no longer supported as of version 2.13.0.

Fixes: #4854
2025-12-21 12:59:13 +09:00
yoan667
710e1aac9c fix linter cppcheck (#5071) 2025-12-21 12:56:23 +09:00
rymdbar
281eb4808c Finalize #5055, adding SuperHTML linter for HTML (#5069)
Remove bogus test of non-existing g:ale_html_superhtml_options.

Co-authored-by: cos <cos>
2025-12-21 12:51:45 +09:00
yoan667
ca1da76d5e add markdownlint fixer for markdown (#5066)
Some checks failed
CI / build_image (push) Has been cancelled
CI / test_ale (--linters-only) (push) Has been cancelled
CI / test_ale (--lua-only) (push) Has been cancelled
CI / test_ale (--neovim-07-only) (push) Has been cancelled
CI / test_ale (--neovim-08-only) (push) Has been cancelled
CI / test_ale (--vim-80-only) (push) Has been cancelled
CI / test_ale (--vim-90-only) (push) Has been cancelled
2025-11-22 21:16:50 +09:00
pmonson711
962a932ed4 add support for expert (#5036)
* add support for expert

* Refactor elixir expert linter from feedback

- Simplify configuration by removing executable lookup logic
- Update documentation to reflect current configuration options
- Rename test file and update assertions for the new configuration

* default to expert for the lsp

The install instructions included something I missed. It includes a
global install, where the default executable is just `expert`. I'll
default to that and review if I should should add a configuration for a
global config.

---------

Co-authored-by: Your Name <pmonson711@nfiindustries.com>
2025-11-22 21:15:52 +09:00
yoan667
395d9fa2aa Add SuperHTML linter for HTML (#5055) 2025-11-22 21:15:28 +09:00
FouMalade
5f286eb909 add unimport fixer (#5068) 2025-11-22 21:14:57 +09:00
FouMalade
1f0f9ef28d fix option pymarkdown linter (#5060) 2025-11-22 21:12:51 +09:00
FouMalade
e56b55b65d Fix j2lint linter (#5065)
* fix option pymarkdown linter

* fix-j2lint-linter
2025-11-22 21:12:18 +09:00
Albert Peschar
260c756a9b biome: use --stdin-file-path for fixer (#5051) 2025-11-22 21:03:14 +09:00
Ben Boeckel
86d8ada5cb tombi: support toml_tombi_online flag to control remote schema fetching (#5032) 2025-11-22 21:02:24 +09:00
Steve Matney
de2d3da738 Adding --no-color flag to stylelint args (#5050)
* Adding --no-color flag to sass stylelint

* Adding --no-color to all stylelint args

* Adding --no-color expectation to stylelint tests

* Properly handling SyntaxError for stylelint; adding corresponding test

* Fixing CSS stylelint parameters and adding regression test
2025-11-22 21:00:41 +09:00
rymdbar
b9d7f56471 Use FindNearestFileOrDirectory, perl languageserver (#5038)
Some checks failed
CI / build_image (push) Has been cancelled
CI / test_ale (--linters-only) (push) Has been cancelled
CI / test_ale (--lua-only) (push) Has been cancelled
CI / test_ale (--neovim-07-only) (push) Has been cancelled
CI / test_ale (--neovim-08-only) (push) Has been cancelled
CI / test_ale (--vim-80-only) (push) Has been cancelled
CI / test_ale (--vim-90-only) (push) Has been cancelled
Update to use mentioned function to find both .git/ directories and .git
worktree files.

Co-authored-by: cos <cos>
2025-10-28 21:16:17 +09:00
rymdbar
6d8e4a641c Make documentation mirror custom_linting_rules (#5056)
Some checks failed
CI / build_image (push) Has been cancelled
CI / test_ale (--linters-only) (push) Has been cancelled
CI / test_ale (--lua-only) (push) Has been cancelled
CI / test_ale (--neovim-07-only) (push) Has been cancelled
CI / test_ale (--neovim-08-only) (push) Has been cancelled
CI / test_ale (--vim-80-only) (push) Has been cancelled
CI / test_ale (--vim-90-only) (push) Has been cancelled
Co-authored-by: cos <cos>
2025-10-27 21:56:35 +09:00
Nicolas Derumigny
d2f4090c33 doc(slang): fix minor typo (#5047)
Some checks failed
CI / build_image (push) Has been cancelled
CI / test_ale (--linters-only) (push) Has been cancelled
CI / test_ale (--lua-only) (push) Has been cancelled
CI / test_ale (--neovim-07-only) (push) Has been cancelled
CI / test_ale (--neovim-08-only) (push) Has been cancelled
CI / test_ale (--vim-80-only) (push) Has been cancelled
CI / test_ale (--vim-90-only) (push) Has been cancelled
2025-10-26 16:16:04 +09:00
Bill Ruddock
59c6b4f7b0 phpstan: support config phpstan.dist.neon (#5052)
phpstan will load config from (in order) phpstan.neon, phpstan.neon.dist, or
phpstan.dist.neon.
2025-10-26 15:55:40 +09:00
Bill Ruddock
21d5de18b2 fix phpstan: use configured level 0 (#5053)
Use configured g:ale_php_phpstan_level if it is 0 (as a number rather
than string).

0 (number) is considered to be empty, but '0' (string) is not.
2025-10-26 15:51:03 +09:00
Max Jacobson
ed26d1f1d9 Add --editor-mode flag when invoking rubocop (#5049)
* Add --editor-mode flag when invoking rubocop

Since RuboCop 1.61.0 (released in February 2024), RuboCop accepts an
`--editor-mode` flag which improves editor integrations like ale.

Some of RuboCop's auto-corrections can be surprising or annoying to run
on save. When RuboCop is running via an LSP or when the `--editor-mode`
flag is passed, it will understand that it is running in an editor, and
it will hold off on making changes that might be surprising or annoying.

For example, if I write

```ruby
def call
  results = some_process
end
```

This has an unused variable, and RuboCop will remove the unused variable
when you run it. However, if you're in the middle of editing, you may
not want it to remove that unused variable, because you may be about to
add a usage of it.

More context:

- PR which introduced it: https://github.com/rubocop/rubocop/pull/12682
- Release notes for 1.61: https://github.com/rubocop/rubocop/releases/tag/v1.61.0
- Docs: https://docs.rubocop.org/rubocop/1.80/configuration.html#contextual

This will be a breaking change for anyone who is running an old version
of RuboCop, because the flag will not exist for them. If they would like
to opt out of this change, they can set an option to omit the flag. I
think this ought to be enabled by default so that people will get this
benefit out of the box.

In the meantime, I am opting into this behavior by setting this option:

```vim
let g:ale_ruby_rubocop_options = "--editor-mode"
```

So I appreciate that this seam was already introduced.

* Make this a non-breaking change

This will detect the current rubocop version and auto-enable
--editor-mode for newer version of rubocop without affecting users of
older versions of rubocop.
2025-10-26 15:14:30 +09:00
FouMalade
9811114948 Add j2lint linter for Jinja2 templates (#5048)
Co-authored-by: Nicolas SCHMAUCH <nic.schmauch@i-0330135t.ac-bordeaux.fr>
2025-10-26 14:54:22 +09:00
150 changed files with 2050 additions and 328 deletions

6
AGENTS.md Normal file
View File

@@ -0,0 +1,6 @@
# ALE Agent instructions
1. Read documentation from `doc/ale-development.txt` to understand how to be an
ALE developer.
2. Run Vader/Vim tests with `./run-tests -q --fast test/path/some_file.vader`
3. When editing Lua code run Lua tests with `./run-tests -q --lua-only`

View File

@@ -1,9 +1,11 @@
" Author: Daniel M. Capella https://github.com/polyzen
" Description: proselint for AsciiDoc files
call ale#Set('proselint_executable', 'proselint')
call ale#linter#Define('asciidoc', {
\ 'name': 'proselint',
\ 'executable': 'proselint',
\ 'command': 'proselint %t',
\ 'executable': function('ale#proselint#GetExecutable'),
\ 'command': function('ale#proselint#GetCommandWithVersionCheck'),
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
\})

View File

@@ -9,7 +9,7 @@ function! ale_linters#asm#gcc#GetCommand(buffer) abort
" -fsyntax-only doesn't catch everything.
return '%e -x assembler'
\ . ' -o ' . g:ale#util#nul_file
\ . '-iquote %s:h'
\ . ' -iquote %s:h'
\ . ' ' . ale#Var(a:buffer, 'asm_gcc_options') . ' -'
endfunction

View File

@@ -10,13 +10,18 @@ function! ale_linters#c#cppcheck#GetCommand(buffer) abort
\ ? ale#handlers#cppcheck#GetBufferPathIncludeOptions(a:buffer)
\ : ''
let l:template = ' --template=' . ale#Escape('{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}')
" Versions >=2.13 don't allow using --project in conjunction with an
" explicit source file.
let l:source_file = stridx(l:compile_commands_option, '--project=') < 0
\ ? ' %t'
\ : ''
return '%e -q --language=c'
\ . l:template
\ . ale#Pad(l:compile_commands_option)
\ . ale#Pad(ale#Var(a:buffer, 'c_cppcheck_options'))
\ . l:buffer_path_include
\ . ' %t'
\ . l:source_file
endfunction
call ale#linter#Define('c', {

View File

@@ -18,7 +18,7 @@ function! ale_linters#cpp#clazy#GetCommand(buffer) abort
return '%e'
\ . (!empty(l:checks) ? ' -checks=' . ale#Escape(l:checks) : '')
\ . (!empty(l:build_dir) ? ' -p ' . ale#Escape(l:build_dir) : '')
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ale#Pad(l:options)
\ . ' %s'
endfunction

View File

@@ -10,13 +10,18 @@ function! ale_linters#cpp#cppcheck#GetCommand(buffer) abort
\ ? ale#handlers#cppcheck#GetBufferPathIncludeOptions(a:buffer)
\ : ''
let l:template = ' --template=' . ale#Escape('{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}')
" Versions >=2.13 don't allow using --project in conjunction with an
" explicit source file.
let l:source_file = stridx(l:compile_commands_option, '--project=') < 0
\ ? ' %t'
\ : ''
return '%e -q --language=c++'
\ . l:template
\ . ale#Pad(l:compile_commands_option)
\ . ale#Pad(ale#Var(a:buffer, 'cpp_cppcheck_options'))
\ . l:buffer_path_include
\ . ' %t'
\ . l:source_file
endfunction
call ale#linter#Define('cpp', {

View File

@@ -4,7 +4,7 @@ function! ale_linters#cs#mcs#GetCommand(buffer) abort
let l:options = ale#Var(a:buffer, 'cs_mcs_options')
return 'mcs -unsafe --parse'
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ale#Pad(l:options)
\ . ' %t'
endfunction

View File

@@ -6,7 +6,7 @@ call ale#Set('css_stylelint_use_global', get(g:, 'ale_use_global_executables', 0
function! ale_linters#css#stylelint#GetCommand(buffer) abort
return '%e ' . ale#Pad(ale#Var(a:buffer, 'css_stylelint_options'))
\ . ' --stdin-filename %s'
\ . ' --no-color --stdin-filename %s'
endfunction
call ale#linter#Define('css', {

View File

@@ -0,0 +1,12 @@
" Author: Paul Monson <pmonson711@pm.me>
" Description: Expert integration (https://github.com/elixir-lang/expert)
call ale#Set('elixir_expert_executable', 'expert')
call ale#linter#Define('elixir', {
\ 'name': 'expert',
\ 'lsp': 'stdio',
\ 'executable': {b -> ale#Var(b, 'elixir_expert_executable')},
\ 'command': '%e',
\ 'project_root': function('ale#handlers#elixir#FindMixUmbrellaRoot'),
\})

View File

@@ -1,9 +1,11 @@
" Author: Jansen Mitchell https://github.com/JansenMitchell
" Description: proselint for Fountain files
call ale#Set('proselint_executable', 'proselint')
call ale#linter#Define('fountain', {
\ 'name': 'proselint',
\ 'executable': 'proselint',
\ 'command': 'proselint %t',
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
\ 'name': 'proselint',
\ 'executable': function('ale#proselint#GetExecutable'),
\ 'command': function('ale#proselint#GetCommandWithVersionCheck'),
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
\})

View File

@@ -8,7 +8,7 @@ function! ale_linters#go#revive#GetCommand(buffer) abort
let l:options = ale#Var(a:buffer, 'go_revive_options')
return ale#go#EnvString(a:buffer) . '%e'
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ale#Pad(l:options)
\ . ' %t'
endfunction

View File

@@ -13,11 +13,11 @@ function! ale_linters#go#staticcheck#GetCommand(buffer) abort
if l:lint_package
return l:env . '%e'
\ . (!empty(l:options) ? ' ' . l:options : '') . ' .'
\ . ale#Pad(l:options) . ' .'
endif
return l:env . '%e'
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ale#Pad(l:options)
\ . ' %s:t'
endfunction

View File

@@ -8,7 +8,7 @@ function! ale_linters#groovy#npmgroovylint#GetCommand(buffer) abort
let l:options = ale#Var(a:buffer, 'groovy_npmgroovylint_options')
return '%e --failon none --output json'
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ale#Pad(l:options)
\ . ' %t'
endfunction

View File

@@ -1,9 +1,11 @@
" Author: Daniel M. Capella https://github.com/polyzen
" Description: proselint for Vim help files
call ale#Set('proselint_executable', 'proselint')
call ale#linter#Define('help', {
\ 'name': 'proselint',
\ 'executable': 'proselint',
\ 'command': 'proselint %t',
\ 'executable': function('ale#proselint#GetExecutable'),
\ 'command': function('ale#proselint#GetCommandWithVersionCheck'),
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
\})

View File

@@ -1,9 +1,11 @@
" Author: Daniel M. Capella https://github.com/polyzen
" Description: proselint for HTML files
call ale#Set('proselint_executable', 'proselint')
call ale#linter#Define('html', {
\ 'name': 'proselint',
\ 'executable': 'proselint',
\ 'command': 'proselint %t',
\ 'executable': function('ale#proselint#GetExecutable'),
\ 'command': function('ale#proselint#GetCommandWithVersionCheck'),
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
\})

View File

@@ -15,8 +15,8 @@ function! ale_linters#html#stylelint#GetCommand(buffer) abort
let l:options = ale#Var(a:buffer, 'html_stylelint_options')
return ale#Escape(l:executable)
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ' --stdin-filename %s'
\ . ale#Pad(l:options)
\ . ' --no-color --stdin-filename %s'
endfunction
call ale#linter#Define('html', {

View File

@@ -0,0 +1,34 @@
call ale#Set('html_superhtml_executable', 'superhtml')
call ale#Set('html_superhtml_use_global', get(g:, 'ale_use_global_executables', 0))
function! ale_linters#html#superhtml#GetCommand(buffer) abort
return '%e check --stdin'
endfunction
function! ale_linters#html#superhtml#Handle(buffer, lines) abort
let l:output = []
let l:pattern = '^\(.*\):\(\d\+\):\(\d\+\): \(.*\)$'
for l:line in a:lines
let l:match = matchlist(l:line, l:pattern)
if !empty(l:match)
call add(l:output, {
\ 'lnum': str2nr(l:match[2]),
\ 'col': str2nr(l:match[3]),
\ 'text': l:match[4],
\ 'type': 'E'
\})
endif
endfor
return l:output
endfunction
call ale#linter#Define('html', {
\ 'name': 'superhtml',
\ 'executable': {b -> ale#Var(b, 'html_superhtml_executable')},
\ 'command': function('ale_linters#html#superhtml#GetCommand'),
\ 'output_stream': 'stderr',
\ 'callback': 'ale_linters#html#superhtml#Handle',
\})

View File

@@ -19,7 +19,7 @@ function! ale_linters#javascript#standard#GetCommand(buffer) abort
let l:options = ale#Var(a:buffer, 'javascript_standard_options')
return ale#node#Executable(a:buffer, l:executable)
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ale#Pad(l:options)
\ . ' --stdin %s'
endfunction

View File

@@ -0,0 +1,46 @@
" Description: linter for jinja using j2lint
call ale#Set('jinja_j2lint_executable', 'j2lint')
call ale#Set('jinja_j2lint_options', '')
call ale#Set('jinja_j2lint_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('jinja_j2lint_auto_pipenv', 0)
call ale#Set('jinja_j2lint_auto_poetry', 0)
call ale#Set('jinja_j2lint_auto_uv', 0)
function! ale_linters#jinja#j2lint#GetExecutable(buffer) abort
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'jinja_j2lint_auto_pipenv'))
\ && ale#python#PipenvPresent(a:buffer)
return 'pipenv'
endif
if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'jinja_j2lint_auto_poetry'))
\ && ale#python#PoetryPresent(a:buffer)
return 'poetry'
endif
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'jinja_j2lint_auto_uv'))
\ && ale#python#UvPresent(a:buffer)
return 'uv'
endif
return ale#python#FindExecutable(a:buffer, 'jinja_j2lint', ['j2lint'])
endfunction
function! ale_linters#jinja#j2lint#GetCommand(buffer) abort
let l:executable = ale_linters#jinja#j2lint#GetExecutable(a:buffer)
let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
\ ? ' run j2lint'
\ : ''
return ale#Escape(l:executable) . l:exec_args
\ . ale#Pad(ale#Var(a:buffer, 'jinja_j2lint_options'))
\ . ' %t'
endfunction
call ale#linter#Define('jinja', {
\ 'name': 'j2lint',
\ 'executable': function('ale_linters#jinja#j2lint#GetExecutable'),
\ 'command': function('ale_linters#jinja#j2lint#GetCommand'),
\ 'callback': 'ale#handlers#unix#HandleAsError',
\})

View File

@@ -7,7 +7,7 @@ call ale#Set('less_stylelint_use_global', get(g:, 'ale_use_global_executables',
function! ale_linters#less#stylelint#GetCommand(buffer) abort
let l:options = ale#Var(a:buffer, 'less_stylelint_options')
return '%e' . ale#Pad(l:options) . ' --stdin-filename %s'
return '%e' . ale#Pad(l:options) . ' --no-color --stdin-filename %s'
endfunction
call ale#linter#Define('less', {

View File

@@ -1,9 +1,11 @@
" Author: Daniel M. Capella https://github.com/polyzen
" Description: proselint for mail files
call ale#Set('proselint_executable', 'proselint')
call ale#linter#Define('mail', {
\ 'name': 'proselint',
\ 'executable': 'proselint',
\ 'command': 'proselint %t',
\ 'executable': function('ale#proselint#GetExecutable'),
\ 'command': function('ale#proselint#GetCommandWithVersionCheck'),
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
\})

View File

@@ -14,7 +14,7 @@ function! ale_linters#markdown#markdownlint#GetCommand(buffer) abort
let l:options = ale#Var(a:buffer, 'markdown_markdownlint_options')
return ale#Escape(l:executable)
\ . (!empty(l:options) ? ' ' . l:options : '') . ' %s'
\ . ale#Pad(l:options) . ' %s'
endfunction
call ale#linter#Define('markdown', {

View File

@@ -17,7 +17,7 @@ function! ale_linters#markdown#mdl#GetCommand(buffer) abort
let l:options = ale#Var(a:buffer, 'markdown_mdl_options')
return ale#Escape(l:executable) . l:exec_args
\ . ' -j' . (!empty(l:options) ? ' ' . l:options : '')
\ . ' -j' . ale#Pad(l:options)
endfunction
function! ale_linters#markdown#mdl#Handle(buffer, lines) abort

View File

@@ -1,9 +1,11 @@
" Author: poohzrn https://github.com/poohzrn
" Description: proselint for Markdown files
call ale#Set('proselint_executable', 'proselint')
call ale#linter#Define('markdown', {
\ 'name': 'proselint',
\ 'executable': 'proselint',
\ 'command': 'proselint %t',
\ 'executable': function('ale#proselint#GetExecutable'),
\ 'command': function('ale#proselint#GetCommandWithVersionCheck'),
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
\})

View File

@@ -33,9 +33,8 @@ function! ale_linters#markdown#pymarkdown#GetCommand(buffer) abort
\ : ''
return ale#Escape(l:executable) . l:exec_args
\ . ' '
\ . ale#Var(a:buffer, 'markdown_pymarkdown_options')
\ . 'scan-stdin'
\ . ale#Pad(ale#Var(a:buffer, 'markdown_pymarkdown_options'))
\ . ' scan-stdin'
endfunction
function! ale_linters#markdown#pymarkdown#Handle(buffer, lines) abort

View File

@@ -1,9 +1,11 @@
" Author: Daniel M. Capella https://github.com/polyzen
" Description: proselint for nroff files
call ale#Set('proselint_executable', 'proselint')
call ale#linter#Define('nroff', {
\ 'name': 'proselint',
\ 'executable': 'proselint',
\ 'command': 'proselint %t',
\ 'executable': function('ale#proselint#GetExecutable'),
\ 'command': function('ale#proselint#GetCommandWithVersionCheck'),
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
\})

View File

@@ -9,7 +9,7 @@ function! ale_linters#perl#languageserver#GetProjectRoot(buffer) abort
" Makefile.PL, https://perldoc.perl.org/ExtUtils::MakeMaker
" Build.PL, https://metacpan.org/pod/Module::Build
" dist.ini, https://metacpan.org/pod/Dist::Zilla
let l:potential_roots = [ 'Makefile.PL', 'Build.PL', 'dist.ini', '.git' ]
let l:potential_roots = [ 'Makefile.PL', 'Build.PL', 'dist.ini' ]
for l:root in l:potential_roots
let l:project_root = ale#path#FindNearestFile(a:buffer, l:root)
@@ -19,6 +19,12 @@ function! ale_linters#perl#languageserver#GetProjectRoot(buffer) abort
endif
endfor
let l:project_root = ale#path#FindNearestFileOrDirectory(a:buffer, '.git')
if !empty(l:project_root)
return fnamemodify(l:project_root . '/', ':p:h:h')
endif
return fnamemodify(expand('#' . a:buffer . ':p:h'), ':p:h')
endfunction

View File

@@ -27,6 +27,10 @@ function! ale_linters#php#phpstan#GetCommand(buffer, version) abort
let l:level = ale#Var(a:buffer, 'php_phpstan_level')
if type(l:level) is v:t_number
let l:level = string(l:level)
endif
if empty(l:level) && empty(ale_linters#php#phpstan#FindConfigFile(a:buffer))
" if no configuration file is found, then use 4 as a default level
let l:level = '4'
@@ -83,6 +87,10 @@ function! ale_linters#php#phpstan#FindConfigFile(buffer) abort
let l:result = ale#path#FindNearestFile(a:buffer, 'phpstan.neon.dist')
endif
if empty(l:result)
let l:result = ale#path#FindNearestFile(a:buffer, 'phpstan.dist.neon')
endif
return l:result
endfunction

View File

@@ -31,7 +31,7 @@ function! ale_linters#php#tlint#GetCommand(buffer) abort
let l:options = ale#Var(a:buffer, 'php_tlint_options')
return ale#node#Executable(a:buffer, l:executable)
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ale#Pad(l:options)
\ . ' lint %s'
endfunction

View File

@@ -1,9 +1,11 @@
" Author: Cian Butler https://github.com/butlerx
" Description: proselint for PO files
call ale#Set('proselint_executable', 'proselint')
call ale#linter#Define('po', {
\ 'name': 'proselint',
\ 'executable': 'proselint',
\ 'command': 'proselint %t',
\ 'executable': function('ale#proselint#GetExecutable'),
\ 'command': function('ale#proselint#GetCommandWithVersionCheck'),
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
\})

View File

@@ -1,9 +1,11 @@
" Author: Daniel M. Capella https://github.com/polyzen
" Description: proselint for Pod files
call ale#Set('proselint_executable', 'proselint')
call ale#linter#Define('pod', {
\ 'name': 'proselint',
\ 'executable': 'proselint',
\ 'command': 'proselint %t',
\ 'executable': function('ale#proselint#GetExecutable'),
\ 'command': function('ale#proselint#GetCommandWithVersionCheck'),
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
\})

View File

@@ -11,7 +11,7 @@ function! ale_linters#proto#buf_lint#GetCommand(buffer) abort
return '%e lint'
\ . (!empty(l:config) ? ' --config=' . ale#Escape(l:config) : '')
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ale#Pad(l:options)
\ . ' %s#include_package_files=true'
endfunction

View File

@@ -87,7 +87,7 @@ function! ale_linters#python#flake8#GetCommand(buffer, version) abort
let l:options = ale#Var(a:buffer, 'python_flake8_options')
return ale#Escape(l:executable) . l:exec_args
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ale#Pad(l:options)
\ . ' --format=default'
\ . l:display_name_args . ' -'
endfunction

View File

@@ -12,7 +12,7 @@ function! ale_linters#rego#opacheck#GetCommand(buffer) abort
return ale#Escape(ale_linters#rego#opacheck#GetExecutable(a:buffer))
\ . ' check %s:h --format json '
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ale#Pad(l:options)
endfunction
function! ale_linters#rego#opacheck#Handle(buffer, lines) abort

View File

@@ -0,0 +1,24 @@
" Author: John Jackson <john@johnridesa.bike>
" Description: The official language server for ReScript.
call ale#Set('rescript_language_server_executable', 'rescript-language-server')
call ale#Set(
\ 'rescript_language_server_use_global',
\ get(g:, 'ale_use_global_executables', v:true),
\ )
function! s:GetProjectRoot(buffer) abort
let l:config_file = ale#path#FindNearestFile(a:buffer, 'rescript.json')
return !empty(l:config_file) ? fnamemodify(l:config_file, ':h') : ''
endfunction
call ale#linter#Define('rescript', {
\ 'name': 'rescript_language_server',
\ 'lsp': 'stdio',
\ 'executable': {b -> ale#path#FindExecutable(b, 'rescript_language_server', [
\ 'node_modules/.bin/rescript-language-server'
\ ])},
\ 'command': '%e --stdio',
\ 'project_root': function('s:GetProjectRoot'),
\})

View File

@@ -1,9 +1,11 @@
" Author: Daniel M. Capella https://github.com/polyzen
" Description: proselint for reStructuredText files
" Description: proselint for reStructuredrst files
call ale#Set('proselint_executable', 'proselint')
call ale#linter#Define('rst', {
\ 'name': 'proselint',
\ 'executable': 'proselint',
\ 'command': 'proselint %t',
\ 'executable': function('ale#proselint#GetExecutable'),
\ 'command': function('ale#proselint#GetCommandWithVersionCheck'),
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
\})

View File

@@ -1,5 +1,13 @@
" Author: John Nduli https://github.com/jnduli
" Description: Rstcheck for reStructuredText files
" Authors:
" John Nduli https://github.com/jnduli,
" Michael Goerz https://github.com/goerz
call ale#Set('rst_rstcheck_executable', 'rstcheck')
call ale#Set('rst_rstcheck_options', '')
function! ale_linters#rst#rstcheck#GetExecutable(buffer) abort
return ale#Var(a:buffer, 'rst_rstcheck_executable')
endfunction
function! ale_linters#rst#rstcheck#Handle(buffer, lines) abort
" matches: 'bad_rst.rst:1: (SEVERE/4) Title overline & underline
@@ -21,11 +29,35 @@ function! ale_linters#rst#rstcheck#Handle(buffer, lines) abort
return l:output
endfunction
function! ale_linters#rst#rstcheck#GetCommand(buffer, version) abort
let l:executable = ale_linters#rst#rstcheck#GetExecutable(a:buffer)
let l:options = ale#Var(a:buffer, 'rst_rstcheck_options')
let l:dir = expand('#' . a:buffer . ':p:h')
let l:exec_args = ale#Pad(l:options)
if ale#semver#GTE(a:version, [3, 4, 0])
let l:exec_args .= ' --config ' . ale#Escape(l:dir)
endif
return ale#Escape(l:executable)
\ . l:exec_args
\ . ' %t'
endfunction
function! ale_linters#rst#rstcheck#GetCommandWithVersionCheck(buffer) abort
return ale#semver#RunWithVersionCheck(
\ a:buffer,
\ ale_linters#rst#rstcheck#GetExecutable(a:buffer),
\ '%e --version',
\ function('ale_linters#rst#rstcheck#GetCommand')
\)
endfunction
call ale#linter#Define('rst', {
\ 'name': 'rstcheck',
\ 'executable': 'rstcheck',
\ 'cwd': '%s:h',
\ 'command': 'rstcheck %t',
\ 'command': function('ale_linters#rst#rstcheck#GetCommandWithVersionCheck'),
\ 'callback': 'ale_linters#rst#rstcheck#Handle',
\ 'output_stream': 'both',
\})

View File

@@ -10,7 +10,7 @@ function! ale_linters#ruby#sorbet#GetCommand(buffer) abort
return ale#ruby#EscapeExecutable(l:executable, 'srb')
\ . ' tc'
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ale#Pad(l:options)
\ . ' --lsp'
\ . (l:enable_watchman ? '' : ' --disable-watchman')
endfunction

View File

@@ -20,7 +20,7 @@ function! ale_linters#rust#rustc#RustcCommand(buffer) abort
let l:options = ale#Var(a:buffer, 'rust_rustc_options')
return 'rustc --error-format=json'
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ale#Pad(l:options)
\ . l:dependencies . ' -'
endfunction

View File

@@ -16,7 +16,7 @@ function! ale_linters#sass#sasslint#GetCommand(buffer) abort
let l:options = ale#Var(a:buffer, 'sass_sasslint_options')
return ale#node#Executable(a:buffer, l:executable)
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ale#Pad(l:options)
\ . ' -v -q -f compact %t'
endfunction

View File

@@ -9,6 +9,6 @@ call ale#linter#Define('sass', {
\ 'executable': {b -> ale#path#FindExecutable(b, 'sass_stylelint', [
\ 'node_modules/.bin/stylelint',
\ ])},
\ 'command': '%e --stdin-filename %s',
\ 'command': '%e --no-color --stdin-filename %s',
\ 'callback': 'ale#handlers#css#HandleStyleLintFormat',
\})

View File

@@ -16,7 +16,7 @@ function! ale_linters#scss#sasslint#GetCommand(buffer) abort
let l:options = ale#Var(a:buffer, 'scss_sasslint_options')
return ale#node#Executable(a:buffer, l:executable)
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ale#Pad(l:options)
\ . ' -v -q -f compact %t'
endfunction

View File

@@ -6,7 +6,7 @@ call ale#Set('scss_stylelint_use_global', get(g:, 'ale_use_global_executables',
function! ale_linters#scss#stylelint#GetCommand(buffer) abort
return '%e ' . ale#Pad(ale#Var(a:buffer, 'scss_stylelint_options'))
\ . ' --stdin-filename %s'
\ . ' --no-color --stdin-filename %s'
endfunction
call ale#linter#Define('scss', {

View File

@@ -7,7 +7,7 @@ call ale#Set('stylus_stylelint_use_global', get(g:, 'ale_use_global_executables'
function! ale_linters#stylus#stylelint#GetCommand(buffer) abort
return '%e'
\ . ale#Pad(ale#Var(a:buffer, 'stylus_stylelint_options'))
\ . ' --stdin-filename %s'
\ . ' --no-color --stdin-filename %s'
endfunction
call ale#linter#Define('stylus', {

View File

@@ -8,7 +8,7 @@ call ale#Set('sugarss_stylelint_use_global', get(g:, 'ale_use_global_executables
function! ale_linters#sugarss#stylelint#GetCommand(buffer) abort
return '%e ' . ale#Pad(ale#Var(a:buffer, 'sugarss_stylelint_options'))
\ . ' --syntax=sugarss'
\ . ' --stdin-filename %s'
\ . ' --no-color --stdin-filename %s'
endfunction
call ale#linter#Define('sugarss', {

View File

@@ -1,9 +1,11 @@
" Author: poohzrn https://github.com/poohzrn
" Description: proselint for TeX files
call ale#Set('proselint_executable', 'proselint')
call ale#linter#Define('tex', {
\ 'name': 'proselint',
\ 'executable': 'proselint',
\ 'command': 'proselint %t',
\ 'executable': function('ale#proselint#GetExecutable'),
\ 'command': function('ale#proselint#GetCommandWithVersionCheck'),
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
\})

View File

@@ -1,9 +1,11 @@
" Author: Daniel M. Capella https://github.com/polyzen
" Description: proselint for Texinfo files
call ale#Set('proselint_executable', 'proselint')
call ale#linter#Define('texinfo', {
\ 'name': 'proselint',
\ 'executable': 'proselint',
\ 'command': 'proselint %t',
\ 'executable': function('ale#proselint#GetExecutable'),
\ 'command': function('ale#proselint#GetCommandWithVersionCheck'),
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
\})

View File

@@ -1,9 +1,11 @@
" Author: poohzrn https://github.com/poohzrn
" Description: proselint for text files
call ale#Set('proselint_executable', 'proselint')
call ale#linter#Define('text', {
\ 'name': 'proselint',
\ 'executable': 'proselint',
\ 'command': 'proselint %t',
\ 'executable': function('ale#proselint#GetExecutable'),
\ 'command': function('ale#proselint#GetCommandWithVersionCheck'),
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
\})

View File

@@ -1,9 +1,22 @@
" Author: chew-z https://github.com/chew-z
" Description: vale for text files
call ale#Set('vale_executable', 'vale')
call ale#Set('vale_options', '')
function! ale_linters#text#vale#GetCommand(buffer) abort
let l:executable = ale#Var(a:buffer, 'vale_executable')
let l:options = ale#Var(a:buffer, 'vale_options')
return ale#Escape(l:executable)
\ . ale#Pad(l:options)
\ . ' --output=JSON %t'
endfunction
call ale#linter#Define('text', {
\ 'name': 'vale',
\ 'executable': 'vale',
\ 'command': 'vale --output=JSON %t',
\ 'command': function('ale_linters#text#vale#GetCommand'),
\ 'callback': 'ale#handlers#vale#Handle',
\})

View File

@@ -3,6 +3,19 @@
call ale#Set('toml_tombi_executable', 'tombi')
call ale#Set('toml_tombi_lsp_options', '')
call ale#Set('toml_tombi_online', 0)
function! ale_linters#toml#tombi#GetCommand(buffer) abort
let l:offline = ''
if !ale#Var(a:buffer, 'toml_tombi_online')
let l:offline = '--offline'
endif
return '%e lsp'
\ . ale#Pad(l:offline)
\ . ale#Pad(ale#Var(a:buffer, 'toml_tombi_lsp_options'))
endfunction
function! ale_linters#toml#tombi#GetProjectRoot(buffer) abort
" Try to find nearest tombi.toml
@@ -33,6 +46,6 @@ call ale#linter#Define('toml', {
\ 'name': 'tombi',
\ 'lsp': 'stdio',
\ 'executable': {b -> ale#Var(b, 'toml_tombi_executable')},
\ 'command': {b -> '%e lsp' . ale#Pad(ale#Var(b, 'toml_tombi_lsp_options'))},
\ 'command': function('ale_linters#toml#tombi#GetCommand'),
\ 'project_root': function('ale_linters#toml#tombi#GetProjectRoot'),
\})

View File

@@ -18,7 +18,7 @@ function! ale_linters#typescript#standard#GetCommand(buffer) abort
let l:options = ale#Var(a:buffer, 'typescript_standard_options')
return ale#node#Executable(a:buffer, l:executable)
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ale#Pad(l:options)
\ . ' --stdin %s'
endfunction

View File

@@ -1,9 +1,11 @@
" Author: Daniel M. Capella https://github.com/polyzen
" Description: proselint for XHTML files
call ale#Set('proselint_executable', 'proselint')
call ale#linter#Define('xhtml', {
\ 'name': 'proselint',
\ 'executable': 'proselint',
\ 'command': 'proselint %t',
\ 'executable': function('ale#proselint#GetExecutable'),
\ 'command': function('ale#proselint#GetCommandWithVersionCheck'),
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
\})

View File

@@ -48,7 +48,7 @@ function! ale#ShouldDoNothing(buffer) abort
endif
" Do nothing for diff buffers.
if getbufvar(a:buffer, '&diff')
if getbufvar(a:buffer, '&diff') && !get(g:, 'ale_lint_diff', 0)
return 1
endif

View File

@@ -249,11 +249,19 @@ function! ale#c#FindCompileCommands(buffer) abort
" Search in build directories if we can't find it in the project.
for l:path in ale#path#Upwards(expand('#' . a:buffer . ':p:h'))
for l:dirname in ale#Var(a:buffer, 'c_build_dir_names')
let l:c_build_dir = l:path . s:sep . l:dirname
let l:c_build_dir = ale#path#GetAbsPath(l:path, l:dirname)
let l:json_file = l:c_build_dir . s:sep . 'compile_commands.json'
if filereadable(l:json_file)
return [l:path, l:json_file]
" For absolute build dir paths, use the parent
" of the build dir as the project root. For
" relative paths, use the directory found by
" searching upwards from the file.
let l:root = ale#path#IsAbsolute(l:dirname)
\ ? fnamemodify(l:c_build_dir, ':h')
\ : l:path
return [l:root, l:json_file]
endif
endfor
endfor

View File

@@ -192,6 +192,11 @@ let s:default_registry = {
\ 'suggested_filetypes': ['python'],
\ 'description': 'Tidy Python imports with pyflyby.',
\ },
\ 'unimport': {
\ 'function': 'ale#fixers#unimport#Fix',
\ 'suggested_filetypes': ['python'],
\ 'description': 'unimport fixer',
\ },
\ 'importjs': {
\ 'function': 'ale#fixers#importjs#Fix',
\ 'suggested_filetypes': ['javascript'],
@@ -452,6 +457,11 @@ let s:default_registry = {
\ 'suggested_filetypes': ['markdown'],
\ 'description': 'Fix markdown files with pandoc.',
\ },
\ 'pymarkdown': {
\ 'function': 'ale#fixers#pymarkdown#Fix',
\ 'suggested_filetypes': ['markdown'],
\ 'description': 'Fix markdown files with pymarkdown.',
\ },
\ 'shfmt': {
\ 'function': 'ale#fixers#shfmt#Fix',
\ 'suggested_filetypes': ['sh'],
@@ -667,6 +677,11 @@ let s:default_registry = {
\ 'suggested_filetypes': ['racket'],
\ 'description': 'Fix Racket files with raco fmt.',
\ },
\ 'rescript_format': {
\ 'function': 'ale#fixers#rescript_format#Fix',
\ 'suggested_filetypes': ['rescript'],
\ 'description': 'Official formatter for ReScript.',
\ },
\ 'ruff': {
\ 'function': 'ale#fixers#ruff#Fix',
\ 'suggested_filetypes': ['python'],
@@ -747,6 +762,11 @@ let s:default_registry = {
\ 'suggested_filetypes': ['verilog'],
\ 'description': 'Formats verilog files using verible.',
\ },
\ 'markdownlint': {
\ 'function': 'ale#fixers#markdownlint#Fix',
\ 'suggested_filetypes': ['markdown'],
\ 'description': 'Fix markdown files with markdownlint.',
\ },
\}
" Reset the function registry to the default entries.

View File

@@ -38,7 +38,7 @@ function! ale#fixers#autoflake#Fix(buffer) abort
return {
\ 'command': ale#Escape(l:executable) . l:exec_args
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ale#Pad(l:options)
\ . ' --in-place '
\ . ' %t',
\ 'read_temporary_file': 1,

View File

@@ -39,7 +39,7 @@ function! ale#fixers#autoimport#Fix(buffer) abort
return {
\ 'cwd': '%s:h',
\ 'command': ale#Escape(l:executable) . l:exec_args
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ale#Pad(l:options)
\ . ' -',
\}
endfunction

View File

@@ -38,7 +38,7 @@ function! ale#fixers#autopep8#Fix(buffer) abort
return {
\ 'command': ale#Escape(l:executable) . l:exec_args
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ale#Pad(l:options)
\ . ' -',
\}
endfunction

View File

@@ -1,12 +1,11 @@
function! ale#fixers#biome#Fix(buffer) abort
let l:executable = ale#handlers#biome#GetExecutable(a:buffer)
let l:options = ale#Var(a:buffer, 'biome_options')
let l:apply = ale#Var(a:buffer, 'biome_fixer_apply_unsafe') ? '--write --unsafe' : '--write'
let l:unsafe = ale#Var(a:buffer, 'biome_fixer_apply_unsafe') ? ' --unsafe' : ''
return {
\ 'read_temporary_file': 1,
\ 'command': ale#Escape(l:executable) . ' check ' . l:apply
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ' %t'
\ 'command': ale#Escape(l:executable) . ' check '
\ . '--write --stdin-file-path %s' . l:unsafe
\ . ale#Pad(l:options)
\}
endfunction

View File

@@ -28,7 +28,7 @@ function! ale#fixers#erblint#GetCommand(buffer) abort
let l:options = ale#Var(a:buffer, 'eruby_erblint_options')
return ale#ruby#EscapeExecutable(l:executable, 'erblint')
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ale#Pad(l:options)
\ . ' --autocorrect --stdin %s'
endfunction

View File

@@ -10,7 +10,7 @@ function! ale#fixers#gnatpp#Fix(buffer) abort
return {
\ 'command': ale#Escape(l:executable)
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ale#Pad(l:options)
\ . ' %t',
\ 'read_temporary_file': 1,
\}

View File

@@ -0,0 +1,15 @@
:scriptencoding utf-8
call ale#Set('markdownlint_executable', 'markdownlint')
call ale#Set('markdownlint_options', '--fix')
function! ale#fixers#markdownlint#Fix(buffer) abort
let l:executable = ale#Var(a:buffer, 'markdownlint_executable')
let l:options = ale#Var(a:buffer, 'markdownlint_options')
return {
\ 'command': ale#Escape(l:executable)
\ . ' ' . l:options,
\}
endfunction

View File

@@ -13,7 +13,7 @@ function! ale#fixers#mix_format#GetCommand(buffer) abort
let l:options = ale#Var(a:buffer, 'elixir_mix_format_options')
return l:executable . ' format'
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ale#Pad(l:options)
\ . ' %t'
endfunction

View File

@@ -9,7 +9,7 @@ function! ale#fixers#npmgroovylint#Fix(buffer) abort
return {
\ 'command': ale#Escape(l:executable)
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ale#Pad(l:options)
\ . ' %t',
\ 'read_temporary_file': 1,
\}

View File

@@ -99,7 +99,7 @@ function! ale#fixers#prettier#ApplyFixForVersion(buffer, version) abort
return {
\ 'cwd': '%s:h',
\ 'command':ale#Escape(l:executable)
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ale#Pad(l:options)
\ . ' --stdin-filepath %s --stdin',
\ 'process_with': 'ale#fixers#prettier#ProcessPrettierDOutput',
\}
@@ -110,7 +110,7 @@ function! ale#fixers#prettier#ApplyFixForVersion(buffer, version) abort
return {
\ 'cwd': ale#fixers#prettier#GetCwd(a:buffer),
\ 'command': ale#Escape(l:executable)
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ale#Pad(l:options)
\ . ' --stdin-filepath %s --stdin',
\}
endif
@@ -118,7 +118,7 @@ function! ale#fixers#prettier#ApplyFixForVersion(buffer, version) abort
return {
\ 'command': ale#Escape(l:executable)
\ . ' %t'
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ale#Pad(l:options)
\ . ' --write',
\ 'read_temporary_file': 1,
\}

View File

@@ -40,7 +40,7 @@ function! ale#fixers#prettier_eslint#ApplyFixForVersion(buffer, version) abort
\ 'cwd': '%s:h',
\ 'command': ale#Escape(l:executable)
\ . l:eslint_config_option
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ale#Pad(l:options)
\ . ' --stdin-filepath %s --stdin',
\}
endif
@@ -49,7 +49,7 @@ function! ale#fixers#prettier_eslint#ApplyFixForVersion(buffer, version) abort
\ 'command': ale#Escape(l:executable)
\ . ' %t'
\ . l:eslint_config_option
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ale#Pad(l:options)
\ . ' --write',
\ 'read_temporary_file': 1,
\}

View File

@@ -0,0 +1,46 @@
scriptencoding utf-8
" Author: Adrian Vollmer <adrian.vollmer@syss.de>
" Description: Fix markdown files with pymarkdown.
call ale#Set('markdown_pymarkdown_executable', 'pymarkdown')
call ale#Set('markdown_pymarkdown_options', '')
call ale#Set('markdown_pymarkdown_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('markdown_pymarkdown_auto_pipenv', 0)
call ale#Set('markdown_pymarkdown_auto_poetry', 0)
call ale#Set('markdown_pymarkdown_auto_uv', 0)
function! ale#fixers#pymarkdown#GetExecutable(buffer) abort
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'markdown_pymarkdown_auto_pipenv'))
\ && ale#python#PipenvPresent(a:buffer)
return 'pipenv'
endif
if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'markdown_pymarkdown_auto_poetry'))
\ && ale#python#PoetryPresent(a:buffer)
return 'poetry'
endif
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'markdown_pymarkdown_auto_uv'))
\ && ale#python#UvPresent(a:buffer)
return 'uv'
endif
return ale#python#FindExecutable(a:buffer, 'markdown_pymarkdown', ['pymarkdown'])
endfunction
function! ale#fixers#pymarkdown#Fix(buffer) abort
let l:executable = ale#fixers#pymarkdown#GetExecutable(a:buffer)
let l:options = ale#Var(a:buffer, 'markdown_pymarkdown_options')
let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
\ ? ' run pymarkdown'
\ : ''
return {
\ 'command': ale#Escape(l:executable) . l:exec_args
\ . ' fix'
\ . ale#Pad(l:options)
\ . ' %t',
\ 'read_temporary_file': 1,
\}
endfunction

View File

@@ -18,7 +18,7 @@ function! ale#fixers#remark_lint#Fix(buffer) abort
return {
\ 'command': ale#Escape(l:executable)
\ . (!empty(l:options) ? ' ' . l:options : ''),
\ . ale#Pad(l:options),
\}
endfunction

View File

@@ -38,6 +38,6 @@ function! ale#fixers#reorder_python_imports#Fix(buffer) abort
return {
\ 'command': ale#Escape(l:executable) . l:exec_args
\ . (!empty(l:options) ? ' ' . l:options : '') . ' -',
\ . ale#Pad(l:options) . ' -',
\}
endfunction

View File

@@ -0,0 +1,33 @@
" Author: John Jackson <john@johnridesa.bike>
" Description: Fix ReScript files with the ReScript formatter.
call ale#Set('rescript_format_executable', 'rescript')
call ale#Set(
\ 'rescript_format_use_global',
\ get(g:, 'ale_use_global_executables', v:false)
\ )
function! s:GetExecutable(buffer) abort
return ale#path#FindExecutable(a:buffer, 'rescript_format', [
\ 'node_modules/.bin/rescript',
\])
endfunction
function! s:FixWithVersion(buffer, version) abort
let l:exe = ale#Escape(s:GetExecutable(a:buffer))
let l:stdin = ale#semver#GTE(a:version, [12, 0, 0]) ? ' --stdin' : ' -stdin'
let l:ext = fnamemodify(bufname(a:buffer), ':e') is? 'resi'
\ ? ' .resi'
\ : ' .res'
return {'command': l:exe . ' format' . l:stdin . l:ext}
endfunction
function! ale#fixers#rescript_format#Fix(buffer) abort
return ale#semver#RunWithVersionCheck(
\ a:buffer,
\ s:GetExecutable(a:buffer),
\ '%e --version',
\ function('s:FixWithVersion'),
\)
endfunction

View File

@@ -19,20 +19,34 @@ function! ale#fixers#rubocop#PostProcess(buffer, output) abort
return a:output[l:line :]
endfunction
function! ale#fixers#rubocop#GetCommand(buffer) abort
function! ale#fixers#rubocop#GetCommand(buffer, version) abort
let l:executable = ale#Var(a:buffer, 'ruby_rubocop_executable')
let l:options = ale#Var(a:buffer, 'ruby_rubocop_options')
let l:auto_correct_all = ale#Var(a:buffer, 'ruby_rubocop_auto_correct_all')
let l:editor_mode = ale#semver#GTE(a:version, [1, 61, 0])
return ale#ruby#EscapeExecutable(l:executable, 'rubocop')
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ale#Pad(l:options)
\ . (l:auto_correct_all ? ' --auto-correct-all' : ' --auto-correct')
\ . (l:editor_mode ? ' --editor-mode' : '')
\ . ' --force-exclusion --stdin %s'
endfunction
function! ale#fixers#rubocop#Fix(buffer) abort
function! ale#fixers#rubocop#GetCommandForVersion(buffer, version) abort
return {
\ 'command': ale#fixers#rubocop#GetCommand(a:buffer),
\ 'process_with': 'ale#fixers#rubocop#PostProcess'
\ 'command': ale#fixers#rubocop#GetCommand(a:buffer, a:version),
\ 'process_with': 'ale#fixers#rubocop#PostProcess'
\}
endfunction
function! ale#fixers#rubocop#Fix(buffer) abort
let l:executable = ale#Var(a:buffer, 'ruby_rubocop_executable')
let l:command = l:executable . ale#Pad('--version')
return ale#semver#RunWithVersionCheck(
\ a:buffer,
\ l:executable,
\ l:command,
\ function('ale#fixers#rubocop#GetCommandForVersion'),
\)
endfunction

View File

@@ -7,7 +7,7 @@ function! ale#fixers#sorbet#GetCommand(buffer) abort
return ale#ruby#EscapeExecutable(l:executable, 'srb')
\ . ' tc'
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ale#Pad(l:options)
\ . ' --autocorrect --file %t'
endfunction

View File

@@ -10,7 +10,7 @@ function! ale#fixers#sqlformat#Fix(buffer) abort
return {
\ 'command': ale#Escape(l:executable)
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ale#Pad(l:options)
\ . ' -'
\}
endfunction

View File

@@ -26,7 +26,7 @@ function! ale#fixers#standard#Fix(buffer) abort
return {
\ 'command': ale#node#Executable(a:buffer, l:executable)
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ale#Pad(l:options)
\ . ' --fix --stdin < %s > %t',
\ 'read_temporary_file': 1,
\}

View File

@@ -11,7 +11,7 @@ function! ale#fixers#standardrb#GetCommand(buffer) abort
return ale#ruby#EscapeExecutable(l:executable, 'standardrb')
\ . (!empty(l:config) ? ' --config ' . ale#Escape(l:config) : '')
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ale#Pad(l:options)
\ . ' --fix --force-exclusion --stdin %s'
endfunction

View File

@@ -20,7 +20,7 @@ function! ale#fixers#stylelint#Fix(buffer) abort
\ 'cwd': '%s:h',
\ 'command': ale#node#Executable(a:buffer, l:executable)
\ . ale#Pad(l:options)
\ . ' --fix --stdin --stdin-filename %s',
\ . ' --fix --stdin --no-color --stdin-filename %s',
\ 'read_temporary_file': 0,
\}
endfunction

View File

@@ -7,7 +7,7 @@ function! ale#fixers#syntax_tree#GetCommand(buffer) abort
return ale#ruby#EscapeExecutable(l:executable, 'stree')
\ . ' format'
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ale#Pad(l:options)
\ . ' %t'
endfunction

View File

@@ -3,13 +3,20 @@
call ale#Set('toml_tombi_executable', 'tombi')
call ale#Set('toml_tombi_format_options', '')
call ale#Set('toml_tombi_online', 0)
function! ale#fixers#tombi_format#Fix(buffer) abort
let l:executable = ale#Var(a:buffer, 'toml_tombi_executable')
let l:offline = ''
if !ale#Var(a:buffer, 'toml_tombi_online')
let l:offline = '--offline'
endif
return {
\ 'command': ale#Escape(l:executable)
\ . ' format'
\ . ale#Pad(l:offline)
\ . ale#Pad(ale#Var(a:buffer, 'toml_tombi_format_options')),
\}
endfunction

View File

@@ -3,13 +3,20 @@
call ale#Set('toml_tombi_executable', 'tombi')
call ale#Set('toml_tombi_lint_options', '')
call ale#Set('toml_tombi_online', 0)
function! ale#fixers#tombi_lint#Fix(buffer) abort
let l:executable = ale#Var(a:buffer, 'toml_tombi_executable')
let l:offline = ''
if !ale#Var(a:buffer, 'toml_tombi_online')
let l:offline = '--offline'
endif
return {
\ 'command': ale#Escape(l:executable)
\ . ' lint'
\ . ale#Pad(l:offline)
\ . ale#Pad(ale#Var(a:buffer, 'toml_tombi_lint_options')),
\}
endfunction

View File

@@ -0,0 +1,42 @@
call ale#Set('python_unimport_executable', 'unimport')
call ale#Set('python_unimport_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('python_unimport_options', '')
call ale#Set('python_unimport_auto_pipenv', 0)
call ale#Set('python_unimport_auto_poetry', 0)
call ale#Set('python_unimport_auto_uv', 0)
function! ale#fixers#unimport#GetExecutable(buffer) abort
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_unimport_auto_pipenv'))
\ && ale#python#PipenvPresent(a:buffer)
return 'pipenv'
endif
if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_unimport_auto_poetry'))
\ && ale#python#PoetryPresent(a:buffer)
return 'poetry'
endif
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_unimport_auto_uv'))
\ && ale#python#UvPresent(a:buffer)
return 'uv'
endif
return ale#python#FindExecutable(a:buffer, 'python_unimport', ['unimport'])
endfunction
function! ale#fixers#unimport#Fix(buffer) abort
let l:executable = ale#fixers#unimport#GetExecutable(a:buffer)
let l:cmd = [ale#Escape(l:executable)]
if l:executable =~? '\(pipenv\|poetry\|uv\)$'
call extend(l:cmd, ['run', 'unimport'])
endif
let l:options = ale#Var(a:buffer, 'python_unimport_options')
if !empty(l:options)
call add(l:cmd, l:options)
endif
return {'command': join(l:cmd, ' ')}
endfunction

View File

@@ -20,6 +20,6 @@ function! ale#fixers#yamlfix#Fix(buffer) abort
return {
\ 'cwd': '%s:h',
\ 'command': ale#Escape(l:executable)
\ . (!empty(l:options) ? ' ' . l:options : '') . ' -',
\ . ale#Pad(l:options) . ' -',
\}
endfunction

85
autoload/ale/fzf.vim Normal file
View File

@@ -0,0 +1,85 @@
" Author: bretello https://github.com/bretello
" Description: Functions for integrating with fzf
" Handle references found with ALEFindReferences using fzf
function! ale#fzf#ShowReferences(item_list, options) abort
let l:name = 'LSP References'
let l:capname = 'References'
let l:items = copy(a:item_list)
let l:cwd = getcwd() " no-custom-checks
let l:sep = has('win32') ? '\' : '/'
function! s:relative_paths(line) closure abort
return substitute(a:line, '^' . l:cwd . l:sep, '', '')
endfunction
if get(a:options, 'use_relative_paths')
let l:items = map(filter(l:items, 'len(v:val)'), 's:relative_paths(v:val)')
endif
let l:start_query = ''
let l:fzf_options = {
\ 'source': items,
\ 'options': ['--prompt', l:name.'> ', '--query', l:start_query,
\ '--multi', '--bind', 'alt-a:select-all,alt-d:deselect-all',
\ '--delimiter', ':', '--preview-window', '+{2}/2']
\}
call add(l:fzf_options['options'], '--highlight-line') " this only works for more recent fzf versions (TODO: handle version check?)
" wrap with #with_preview and #fzfwrap before adding the sinklist,
" otherwise --expect options are not added
let l:opts_with_preview = fzf#vim#with_preview(l:fzf_options)
let l:bang = 0 " TODO: handle bang
let l:wrapped = fzf#wrap(l:name, l:opts_with_preview, l:bang)
call remove(l:wrapped, 'sink*') " remove the default sinklist to add in our custom sinklist
function! l:wrapped.sinklist(lines) closure abort
if len(a:lines) <2
return
endif
let l:cmd = a:lines[0]
function! s:references_to_qf(line) closure abort
" mimics ag_to_qf in junegunn/fzf.vim
let l:parts = matchlist(a:line, '\(.\{-}\)\s*:\s*\(\d\+\)\%(\s*:\s*\(\d\+\)\)\?\%(\s*:\(.*\)\)\?')
let l:filename = &autochdir ? fnamemodify(l:parts[1], ':p') : l:parts[1]
return {'filename': l:filename, 'lnum': l:parts[2], 'col': l:parts[3], 'text': l:parts[4]}
endfunction
let l:references = map(filter(a:lines[1:], 'len(v:val)'), 's:references_to_qf(v:val)')
if empty(l:references)
return
endif
if get(a:options, 'open_in') is# 'quickfix'
call setqflist([], 'r')
call setqflist(l:references, 'a')
call ale#util#Execute('cc 1')
endif
function! s:action(key, file) abort
" copied from fzf.vim
let l:default_action = {
\ 'ctrl-t': 'tab split',
\ 'ctrl-x': 'split',
\ 'ctrl-v': 'vsplit' }
let fzf_actions = get(g:, 'fzf_action', l:default_action)
let l:Cmd = get(fzf_actions, a:key, 'edit')
let l:cursor_cmd = escape('call cursor(' . a:file['lnum'] . ',' . a:file['col'] . ')', ' ')
let l:fullcmd = l:Cmd . ' +' . l:cursor_cmd . ' ' . fnameescape(a:file['filename'])
silent keepjumps keepalt execute fullcmd
endfunction
return map(l:references, 's:action(cmd, v:val)')
endfunction
call fzf#run(l:wrapped)
endfunction

View File

@@ -69,11 +69,12 @@ function! ale#handlers#cppcheck#HandleCppCheckFormat(buffer, lines) abort
"test.c:1:16: style: misra violation (use --rule-texts=<file> to get proper output) [misra-c2012-2.7]\'
"void test( int parm ) {}
" ^
let l:pattern = '\v(\f+):(\d+):(\d+|\{column\}): (\w+):(\{inconclusive:inconclusive\})? ?(.*) \[(%(\w[-.]?)+)\]\'
let l:pattern = '\v(\f+):(\d+):(\d+|\{column\}): (\w+):(\{inconclusive:inconclusive\})? ?(.*) \[(%(\w[-.]?)+)\]\\?'
let l:output = []
for l:match in ale#util#GetMatches(a:lines, l:pattern)
if ale#path#IsBufferPath(a:buffer, l:match[1])
let l:text = substitute(l:match[6], '\\$', '', '')
call add(l:output, {
\ 'lnum': str2nr(l:match[2]),
\ 'col': match(l:match[3],'{column}') >= 0 ? 1 : str2nr(l:match[3]),

View File

@@ -36,7 +36,7 @@ function! ale#handlers#css#HandleCSSLintFormat(buffer, lines) abort
endfunction
function! ale#handlers#css#HandleStyleLintFormat(buffer, lines) abort
let l:exception_pattern = '\v^Error:'
let l:exception_pattern = '\v^(Syntax)?Error:'
for l:line in a:lines[:10]
if len(matchlist(l:line, l:exception_pattern)) > 0

View File

@@ -39,7 +39,7 @@ function! ale#handlers#djlint#GetCommand(buffer) abort
endif
return ale#Escape(l:executable)
\ . (!empty(l:options) ? ' ' . l:options : '') . ' %s'
\ . ale#Pad(l:options) . ' %s'
endfunction
function! ale#handlers#djlint#Handle(buffer, lines) abort

View File

@@ -54,7 +54,7 @@ function! ale#handlers#eslint#GetCommand(buffer) abort
let l:options = ale#Var(a:buffer, 'javascript_eslint_options')
return ale#node#Executable(a:buffer, l:executable)
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ale#Pad(l:options)
\ . ' -f json --stdin --stdin-filename %s'
endfunction

View File

@@ -2,15 +2,21 @@
" Description: Adds support for markdownlint
function! ale#handlers#markdownlint#Handle(buffer, lines) abort
let l:pattern=': \?\(\d\+\)\(:\(\d\+\)\?\)\? \(MD\d\{3}/[A-Za-z0-9-/]\+\) \(.*\)$'
let l:pattern=': \?\(\d\+\)\(:\(\d\+\)\?\)\? \(error\|warning\)\? \?\(MD\d\{3}/[A-Za-z0-9-/]\+\) \(.*\)$'
let l:output=[]
for l:match in ale#util#GetMatches(a:lines, l:pattern)
let l:type = 'W'
if l:match[4] is# 'error'
let l:type = 'E'
endif
let l:result = ({
\ 'lnum': l:match[1] + 0,
\ 'code': l:match[4],
\ 'text': l:match[5],
\ 'type': 'W',
\ 'code': l:match[5],
\ 'text': l:match[6],
\ 'type': l:type,
\})
if len(l:match[3]) > 0

View File

@@ -57,7 +57,7 @@ function! ale#handlers#shellcheck#GetCommand(buffer, version) abort
return '%e'
\ . (!empty(l:dialect) ? ' -s ' . l:dialect : '')
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ale#Pad(l:options)
\ . (!empty(l:exclude_option) ? ' -e ' . l:exclude_option : '')
\ . l:external_option
\ . ' -f ' . l:format . ' -'

View File

@@ -17,7 +17,7 @@ function! ale#handlers#textlint#GetCommand(buffer) abort
let l:options = ale#Var(a:buffer, 'textlint_options')
return ale#node#Executable(a:buffer, l:executable)
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ale#Pad(l:options)
\ . ' -f json --stdin --stdin-filename %s'
endfunction

View File

@@ -22,7 +22,7 @@ function! ale#handlers#writegood#GetCommand(buffer) abort
let l:options = ale#Var(a:buffer, 'writegood_options')
return ale#node#Executable(a:buffer, l:executable)
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ale#Pad(l:options)
\ . ' %t'
endfunction

View File

@@ -81,7 +81,7 @@ function! ale#preview#ShowSelection(item_list, ...) abort
\ l:filename
\ . ':' . l:item.line
\ . ':' . l:item.column
\ . (!empty(l:match) ? ' ' . l:match : ''),
\ . ale#Pad(l:match),
\)
endfor

View File

@@ -0,0 +1,25 @@
call ale#Set('proselint_executable', 'proselint')
function! ale#proselint#GetExecutable(buffer) abort
return ale#Var(a:buffer, 'proselint_executable')
endfunction
function! ale#proselint#GetCommand(buffer, version) abort
let l:executable = ale#proselint#GetExecutable(a:buffer)
let l:escaped_exec = ale#Escape(l:executable)
if ale#semver#GTE(a:version, [0, 16, 0])
return l:escaped_exec . ' check %t'
else
return l:escaped_exec . ' %t'
endif
endfunction
function! ale#proselint#GetCommandWithVersionCheck(buffer) abort
return ale#semver#RunWithVersionCheck(
\ a:buffer,
\ ale#proselint#GetExecutable(a:buffer),
\ '%e version --output-format json',
\ function('ale#proselint#GetCommand')
\)
endfunction

View File

@@ -1,5 +1,6 @@
let g:ale_default_navigation = get(g:, 'ale_default_navigation', 'buffer')
let g:ale_references_show_contents = get(g:, 'ale_references_show_contents', 1)
let g:ale_references_use_fzf = get(g:, 'ale_references_use_fzf', 0)
let s:references_map = {}
@@ -17,117 +18,123 @@ function! ale#references#ClearLSPData() abort
let s:references_map = {}
endfunction
function! ale#references#FormatTSResponseItem(response_item, options) abort
let l:match = substitute(a:response_item.lineText, '^\s*\(.\{-}\)\s*$', '\1', '')
function! ale#references#FormatResponseItem(response_item, options) abort
let l:filename = get(a:response_item, 'filename', '')
let l:column = get(a:response_item, 'column', 0)
let l:line = get(a:response_item, 'line', 0)
let l:line_text = get(a:response_item, 'line_text', '')
try
let l:line_text = substitute(
\ l:line_text,
\ '^\s*\(.\{-}\)\s*$', '\1', ''
\)
catch
" This happens in tests
endtry
if get(a:options, 'use_fzf') == 1
" grep-style output (filename:line:col:text) so that fzf can properly
" show matches and previews using ':' as delimiter
return l:filename . ':' . l:line . ':' . l:column . ':' . l:line_text
endif
if get(a:options, 'open_in') is# 'quickfix'
return {
\ 'filename': a:response_item.file,
\ 'lnum': a:response_item.start.line,
\ 'col': a:response_item.start.offset,
\ 'text': l:match,
\ 'filename': l:filename,
\ 'lnum': l:line,
\ 'col': l:column,
\ 'text': l:line_text,
\}
else
return {
\ 'filename': a:response_item.file,
\ 'line': a:response_item.start.line,
\ 'column': a:response_item.start.offset,
\ 'match': l:match,
\ 'filename': l:filename,
\ 'line': l:line,
\ 'column': l:column,
\ 'match': l:line_text,
\}
endif
endfunction
function! ale#references#DisplayReferences(item_list, options) abort
if empty(a:item_list)
call ale#util#Execute('echom ''No references found.''')
else
if get(a:options, 'use_fzf') == 1
if !exists('*fzf#run')
throw 'fzf#run function not found. You also need Vim plugin from the main fzf repository (i.e. junegunn/fzf *and* junegunn/fzf.vim)'
endif
call ale#fzf#ShowReferences(a:item_list, a:options)
elseif get(a:options, 'open_in') is# 'quickfix'
call setqflist([], 'r')
call setqflist(a:item_list, 'a')
call ale#util#Execute('cc 1')
else
call ale#preview#ShowSelection(a:item_list, a:options)
endif
endif
endfunction
function! ale#references#HandleTSServerResponse(conn_id, response) abort
if get(a:response, 'command', '') is# 'references'
\&& has_key(s:references_map, a:response.request_seq)
let l:options = remove(s:references_map, a:response.request_seq)
let l:format_options = copy(l:options)
if get(a:response, 'success', v:false) is v:true
let l:item_list = []
for l:response_item in a:response.body.refs
let l:format_response_item = {
\ 'filename': l:response_item.file,
\ 'line': l:response_item.start.line,
\ 'column': l:response_item.start.offset,
\ 'line_text': l:response_item.lineText,
\ }
call add(
\ l:item_list,
\ ale#references#FormatTSResponseItem(l:response_item, l:options)
\ ale#references#FormatResponseItem(l:format_response_item, l:format_options)
\)
endfor
if empty(l:item_list)
call ale#util#Execute('echom ''No references found.''')
else
if get(l:options, 'open_in') is# 'quickfix'
call setqflist([], 'r')
call setqflist(l:item_list, 'a')
call ale#util#Execute('cc 1')
else
call ale#preview#ShowSelection(l:item_list, l:options)
endif
endif
call ale#references#DisplayReferences(l:item_list, l:format_options)
endif
endif
endfunction
function! ale#references#FormatLSPResponseItem(response_item, options) abort
let l:line_text = ''
let l:line= a:response_item.range.start.line
let l:col = a:response_item.range.start.character
let l:filename = ale#util#ToResource(a:response_item.uri)
if get(a:options, 'show_contents') == 1
try
let l:line_text = substitute(readfile(l:filename)[l:line], '^\s*\(.\{-}\)\s*$', '\1', '')
catch
" This happens in tests
endtry
endif
if get(a:options, 'open_in') is# 'quickfix'
return {
\ 'filename': l:filename,
\ 'lnum': a:response_item.range.start.line + 1,
\ 'col': a:response_item.range.start.character + 1,
\ 'text': l:line_text,
\}
else
return {
\ 'filename': l:filename,
\ 'line': l:line + 1,
\ 'column': l:col + 1,
\ 'match': l:line_text,
\}
endif
endfunction
function! ale#references#HandleLSPResponse(conn_id, response) abort
if has_key(a:response, 'id')
\&& has_key(s:references_map, a:response.id)
let l:options = remove(s:references_map, a:response.id)
" The result can be a Dictionary item, a List of the same, or null.
let l:result = get(a:response, 'result', [])
let l:item_list = []
if type(l:result) is v:t_list
for l:response_item in l:result
call add(l:item_list,
\ ale#references#FormatLSPResponseItem(l:response_item, l:options)
\)
endfor
endif
if empty(l:item_list)
call ale#util#Execute('echom ''No references found.''')
else
if get(l:options, 'open_in') is# 'quickfix'
call setqflist([], 'r')
call setqflist(l:item_list, 'a')
call ale#util#Execute('cc 1')
else
call ale#preview#ShowSelection(l:item_list, l:options)
endif
endif
if ! (has_key(a:response, 'id') && has_key(s:references_map, a:response.id))
return
endif
let l:options = remove(s:references_map, a:response.id)
" The result can be a Dictionary item, a List of the same, or null.
let l:result = get(a:response, 'result', [])
let l:item_list = []
if type(l:result) is v:t_list
for l:response_item in l:result
let l:filename = ale#util#ToResource(get(l:response_item, 'uri', ''))
let l:read_line = l:response_item.range.start.line
let l:line = l:read_line + 1
let l:format_response_item = {
\ 'filename': l:filename,
\ 'line': l:line,
\ 'column': l:response_item.range.start.character + 1,
\ 'line_text': get(l:options, 'show_contents') == 1
\ ? readfile(l:filename)[l:read_line]
\ : '',
\ }
call add(l:item_list,
\ ale#references#FormatResponseItem(l:format_response_item, l:options)
\)
endfor
endif
call ale#references#DisplayReferences(l:item_list, l:options)
endfunction
function! s:OnReady(line, column, options, linter, lsp_details) abort
@@ -165,6 +172,7 @@ function! s:OnReady(line, column, options, linter, lsp_details) abort
\ 'use_relative_paths': has_key(a:options, 'use_relative_paths') ? a:options.use_relative_paths : 0,
\ 'open_in': get(a:options, 'open_in', 'current-buffer'),
\ 'show_contents': a:options.show_contents,
\ 'use_fzf': get(a:options, 'use_fzf', g:ale_references_use_fzf),
\}
endfunction
@@ -185,6 +193,8 @@ function! ale#references#Find(...) abort
let l:options.open_in = 'quickfix'
elseif l:option is? '-contents'
let l:options.show_contents = 1
elseif l:option is? '-fzf'
let l:options.use_fzf = 1
endif
endfor
endif

View File

@@ -85,9 +85,11 @@ The following general coding standards should be adhered to for Vim code.
* Try to keep lines no longer than 80 characters, but this isn't an absolute
requirement.
* Use 4 spaces for every level of indentation in Vim code.
* Add a blank line before every `function`, `if`, `for`, `while`, or `return`,
which doesn't start a new level of indentation. This makes the logic in
your code easier to follow.
* Add a blank line before every `function`, `if`, `for`, `while`, `try`, or `return`,
which doesn't start a new level of indentation. When adding more code on the
same indentation level, also add blank lines after every corresponding end
for those mentioned keywords. This makes the logic in your code easier to
follow.
* End every file with a trailing newline character, but not with extra blank
lines. Remove trailing whitespace from the ends of lines.
* Write the full names of commands instead of abbreviations. For example, write

View File

@@ -139,8 +139,28 @@ g:ale_elixir_lexical_release
For example, set release to: `/home/projects/lexical/_build/dev/rel/lexical`
There are currnetly no configuration options for lexical.
There are currently no configuration options for lexical.
===============================================================================
expert *ale-elixir-expert*
Expert (https://github.com/elixir-lang/expert)
*ale-options.elixir_expert_executable*
*g:ale_elixir_expert_executable*
*b:ale_elixir_expert_executable*
elixir_expert_executable
g:ale_elixir_expert_executable
Type: |String|
Default: `/usr/bin/elixir-expert`
Location of the expert executable.
For example, set release to:
`/home/projects/expert/apps/expert/burrito_out/expert_linux_amd64`
There are currently no configuration options for expert.
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View File

@@ -6,7 +6,7 @@ ALE Go Integration *ale-go-options*
Integration Information
ALE enables `gofmt`, `gopls` and `go vet` by default. It also supports `staticcheck`,
`go build, ``gosimple`, `golangserver`, and `golangci-lint.
`go build, ``gosimple`, `golangserver`, `golangci-lint`, and `goimports`.
To enable `golangci-lint`, update |g:ale_linters| as appropriate.
A possible configuration is to enable golangci-lint and `gofmt:
@@ -118,6 +118,30 @@ g:ale_go_gofumpt_options
Options to pass to the gofumpt fixer.
===============================================================================
goimports *ale-go-goimports*
*ale-options.go_goimports_executable*
*g:ale_go_goimports_executable*
*b:ale_go_goimports_executable*
go_goimports_executable
g:ale_go_goimports_executable
Type: |String|
Default: `'goimports'`
This variable can be set to change the executable path for goimports.
*ale-options.go_goimports_options*
*g:ale_go_goimports_options*
*b:ale_go_goimports_options*
go_goimports_options
g:ale_go_goimports_options
Type: |String|
Default: `''`
This variable can be set to pass additional options to the goimports fixer.
===============================================================================
golangci-lint *ale-go-golangci-lint*

View File

@@ -206,6 +206,24 @@ g:ale_html_stylelint_use_global
See |ale-integrations-local-executables|
===============================================================================
superhtml *ale-html-superhtml*
g:ale_html_superhtml_executable *g:ale_html_superhtml_executable*
*b:ale_html_superhtml_executable*
Type: |String|
Default: `'superhtml'`
This variable can be changed to use a different executable for superhtml.
g:ale_html_superhtml_use_global *g:ale_html_superhtml_use_global*
*b:ale_html_superhtml_use_global*
Type: |Number|
Default: `get(g:, 'ale_use_global_executables', 0)`
See |ale-integrations-local-executables|
===============================================================================
tidy *ale-html-tidy*

View File

@@ -8,5 +8,9 @@ djlint *ale-jinja-djlint*
See |ale-html-djlint|
===============================================================================
j2lint *ale-jinja-j2lint*
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View File

@@ -111,9 +111,11 @@ See |ale-javascript-prettier| for information about the available options.
===============================================================================
pymarkdown *ale-markdown-pymarkdown*
pymarkdown can be used both as a linter and a fixer for Markdown files.
*ale-options.markdown_pymarkdown_executable*
*g:ale_markdown_pymarkdown_executable*
*b:ale_markdown_pymarkdown_executable*
*b:ale_markdown_pymarkdown_executable*
markdown_pymarkdown_executable
g:ale_markdown_pymarkdown_executable
Type: |String|
@@ -126,7 +128,7 @@ g:ale_markdown_pymarkdown_executable
*ale-options.markdown_pymarkdown_options*
*g:ale_markdown_pymarkdown_options*
*b:ale_markdown_pymarkdown_options*
*b:ale_markdown_pymarkdown_options*
markdown_pymarkdown_options
g:ale_markdown_pymarkdown_options
Type: |String|
@@ -137,7 +139,7 @@ g:ale_markdown_pymarkdown_options
*ale-options.markdown_pymarkdown_use_global*
*g:ale_markdown_pymarkdown_use_global*
*b:ale_markdown_pymarkdown_use_global*
*b:ale_markdown_pymarkdown_use_global*
markdown_pymarkdown_use_global
g:ale_markdown_pymarkdown_use_global
Type: |Number|
@@ -147,7 +149,7 @@ g:ale_markdown_pymarkdown_use_global
*ale-options.markdown_pymarkdown_auto_pipenv*
*g:ale_markdown_pymarkdown_auto_pipenv*
*b:ale_markdown_pymarkdown_auto_pipenv*
*b:ale_markdown_pymarkdown_auto_pipenv*
markdown_pymarkdown_auto_pipenv
g:ale_markdown_pymarkdown_auto_pipenv
Type: |Number|
@@ -158,7 +160,7 @@ g:ale_markdown_pymarkdown_auto_pipenv
*ale-options.markdown_pymarkdown_auto_poetry*
*g:ale_markdown_pymarkdown_auto_poetry*
*b:ale_markdown_pymarkdown_auto_poetry*
*b:ale_markdown_pymarkdown_auto_poetry*
markdown_pymarkdown_auto_poetry
g:ale_markdown_pymarkdown_auto_poetry
Type: |Number|
@@ -169,7 +171,7 @@ g:ale_markdown_pymarkdown_auto_poetry
*ale-options.markdown_pymarkdown_auto_uv*
*g:ale_markdown_pymarkdown_auto_uv*
*b:ale_markdown_pymarkdown_auto_uv*
*b:ale_markdown_pymarkdown_auto_uv*
markdown_pymarkdown_auto_uv
g:ale_markdown_pymarkdown_auto_uv
Type: |Number|

54
doc/ale-rescript.txt Normal file
View File

@@ -0,0 +1,54 @@
===============================================================================
ALE ReScript Integration *ale-rescript-options*
===============================================================================
rescript-language-server *ale-rescript-language-server*
*ale-options.rescript_language_server_executable*
*g:ale_rescript_language_server_executable*
*b:ale_rescript_language_server_executable*
ale_rescript_language_server_executable
g:ale_rescript_language_server_executable
Type: |String|
Default: `'rescript-language-server'`
See |ale-integrations-local-executables|
*ale-options.rescript_language_server_use_global*
*g:ale_rescript_language_server_use_global*
*b:ale_rescript_language_server_use_global*
rescript_language_server_use_global
g:ale_rescript_language_server_use_global
Type: |Number|
Default: `get(g:, 'ale_use_global_executables', v:true)`
See |ale-integrations-local-executables|
===============================================================================
rescript_format *ale-rescript-format*
*ale-options.rescript_format_executable*
*g:ale_rescript_format_executable*
*b:ale_rescript_format_executable*
rescript_format_executable
g:ale_rescript_format_executable
Type: |String|
Default: `'rescript'`
See |ale-integrations-local-executables|
*ale-options.rescript_format_use_global*
*g:ale_rescript_format_use_global*
*b:ale_rescript_format_use_global*
rescript_format_use_global
g:ale_rescript_format_use_global
Type: |Number|
Default: `get(g:, 'ale_use_global_executables', v:false)`
See |ale-integrations-local-executables|
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

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