Compare commits

..

19 Commits

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

View File

@@ -41,10 +41,10 @@ install:
- ps: >- - ps: >-
if (!(Test-Path -Path C:\vim)){ if (!(Test-Path -Path C:\vim)){
Add-Type -A System.IO.Compression.FileSystem Add-Type -A System.IO.Compression.FileSystem
Invoke-WebRequest https://github.com/dense-analysis/ale/releases/download/v4.0.0/vim80-586w32.zip ` Invoke-WebRequest ftp://ftp.vim.org/pub/vim/pc/vim80-586w32.zip `
-OutFile C:\vim.zip -OutFile C:\vim.zip
[IO.Compression.ZipFile]::ExtractToDirectory('C:\vim.zip', 'C:\vim') [IO.Compression.ZipFile]::ExtractToDirectory('C:\vim.zip', 'C:\vim')
Invoke-WebRequest https://github.com/dense-analysis/ale/releases/download/v4.0.0/vim80-586rt.zip ` Invoke-WebRequest ftp://ftp.vim.org/pub/vim/pc/vim80-586rt.zip `
-OutFile C:\rt.zip -OutFile C:\rt.zip
[IO.Compression.ZipFile]::ExtractToDirectory('C:\rt.zip', 'C:\vim') [IO.Compression.ZipFile]::ExtractToDirectory('C:\rt.zip', 'C:\vim')
} }

View File

@@ -1,7 +1,6 @@
--- ---
name: Report a bug name: Report a bug
labels: bug labels: bug
type: Bug
about: Report a bug with ALE. about: Report a bug with ALE.
--- ---

View File

@@ -1,7 +1,6 @@
--- ---
name: Suggest a new linter or fixer name: Suggest a new linter or fixer
labels: new tool labels: new tool
type: Task
about: Suggest a new tool ALE can officially integrate with. about: Suggest a new tool ALE can officially integrate with.
--- ---

View File

@@ -1,7 +1,6 @@
--- ---
name: Suggest an improvement name: Suggest an improvement
labels: enhancement labels: enhancement
type: Feature
about: Suggest some way to improve ALE, or add a new feature. about: Suggest some way to improve ALE, or add a new feature.
--- ---

View File

@@ -7,8 +7,7 @@
"test" "test"
], ],
"workspace.library": [ "workspace.library": [
"/usr/share/nvim/runtime/lua", "/usr/share/nvim/runtime/lua"
"/opt/homebrew/share/nvim/runtime/lua"
], ],
"runtime.pathStrict": true, "runtime.pathStrict": true,
"runtime.path": [ "runtime.path": [

View File

@@ -61,14 +61,6 @@ linting and fixing of code in Vim. ALE offers the following.
* Windows support * Windows support
* Well-integrated with other plugins * Well-integrated with other plugins
## Sponsorship
If you would like to donate to Dense Analysis to say thank you for ALE, please
consider visiting our [Sponsorship page](https://denseanalysis.org/sponsors/).
Funds will be used to pay for our hosting fees and research. Whilst visiting our
site, please feel free to make use of our educational resources and other
recommended tools.
## Supported Languages and Tools ## Supported Languages and Tools
ALE supports a wide variety of languages and tools. See the ALE supports a wide variety of languages and tools. See the

View File

@@ -2,44 +2,11 @@
" Description: ansible-lint for ansible-yaml files " Description: ansible-lint for ansible-yaml files
call ale#Set('ansible_ansible_lint_executable', 'ansible-lint') call ale#Set('ansible_ansible_lint_executable', 'ansible-lint')
call ale#Set('ansible_ansible_lint_auto_pipenv', 0)
call ale#Set('ansible_ansible_lint_auto_poetry', 0)
call ale#Set('ansible_ansible_lint_auto_uv', 0)
call ale#Set('ansible_ansible_lint_change_directory', 1)
function! ale_linters#ansible#ansible_lint#GetExecutable(buffer) abort function! ale_linters#ansible#ansible_lint#GetExecutable(buffer) abort
if (ale#Var(a:buffer, 'python_auto_pipenv')
\ || ale#Var(a:buffer, 'ansible_ansible_lint_auto_pipenv'))
\ && ale#python#PipenvPresent(a:buffer)
return 'pipenv'
endif
if (ale#Var(a:buffer, 'python_auto_poetry')
\ || ale#Var(a:buffer, 'ansible_ansible_lint_auto_poetry'))
\ && ale#python#PoetryPresent(a:buffer)
return 'poetry'
endif
if (ale#Var(a:buffer, 'python_auto_uv')
\ || ale#Var(a:buffer, 'ansible_ansible_lint_auto_uv'))
\ && ale#python#UvPresent(a:buffer)
return 'uv'
endif
return ale#Var(a:buffer, 'ansible_ansible_lint_executable') return ale#Var(a:buffer, 'ansible_ansible_lint_executable')
endfunction endfunction
function! ale_linters#ansible#ansible_lint#GetCwd(buffer) abort
if ale#Var(a:buffer, 'ansible_ansible_lint_change_directory')
" Run from project root if found, else from buffer dir.
let l:project_root = ale#python#FindProjectRoot(a:buffer)
return !empty(l:project_root) ? l:project_root : '%s:h'
endif
return ''
endfunction
function! ale_linters#ansible#ansible_lint#Handle(buffer, version, lines) abort function! ale_linters#ansible#ansible_lint#Handle(buffer, version, lines) abort
for l:line in a:lines[:10] for l:line in a:lines[:10]
if match(l:line, '^Traceback') >= 0 if match(l:line, '^Traceback') >= 0
@@ -136,50 +103,28 @@ function! ale_linters#ansible#ansible_lint#Handle(buffer, version, lines) abort
endfunction endfunction
function! ale_linters#ansible#ansible_lint#GetCommand(buffer, version) abort function! ale_linters#ansible#ansible_lint#GetCommand(buffer, version) abort
let l:executable = ale_linters#ansible#ansible_lint#GetExecutable(a:buffer) let l:commands = {
\ '>=6.0.0': '%e --nocolor -f json -x yaml %s',
let l:exec_args = l:executable =~? '\(pipenv\|poetry\|uv\)$' \ '>=5.0.0': '%e --nocolor --parseable-severity -x yaml %s',
\ ? ' run ansible-lint' \ '<5.0.0': '%e --nocolor -p %t'
\ : ''
let l:opts_map = {
\ '>=6.0.0': ' --nocolor -f json -x yaml %s',
\ '>=5.0.0': ' --nocolor --parseable-severity -x yaml %s',
\ '<5.0.0': ' --nocolor -p %t'
\} \}
let l:command = ale#semver#GTE(a:version, [6, 0]) ? l:commands['>=6.0.0'] :
let l:cmd_opts = ale#semver#GTE(a:version, [6, 0]) ? l:opts_map['>=6.0.0'] : \ ale#semver#GTE(a:version, [5, 0]) ? l:commands['>=5.0.0'] :
\ ale#semver#GTE(a:version, [5, 0]) ? l:opts_map['>=5.0.0'] : \ l:commands['<5.0.0']
\ l:opts_map['<5.0.0']
let l:command = ale#Escape(l:executable) . l:exec_args . l:cmd_opts
return l:command return l:command
endfunction endfunction
function! ale_linters#ansible#ansible_lint#RunWithVersionCheck(buffer) abort
let l:executable = ale_linters#ansible#ansible_lint#GetExecutable(a:buffer)
let l:exec_args = l:executable =~? '\(pipenv\|poetry\|uv\)$'
\ ? ' run ansible-lint'
\ : ''
let l:command = ale#Escape(l:executable) . l:exec_args . ' --version'
return ale#semver#RunWithVersionCheck(
\ a:buffer,
\ l:executable,
\ l:command,
\ function('ale_linters#ansible#ansible_lint#GetCommand'),
\)
endfunction
call ale#linter#Define('ansible', { call ale#linter#Define('ansible', {
\ 'name': 'ansible_lint', \ 'name': 'ansible_lint',
\ 'aliases': ['ansible', 'ansible-lint'], \ 'aliases': ['ansible', 'ansible-lint'],
\ 'executable': function('ale_linters#ansible#ansible_lint#GetExecutable'), \ 'executable': function('ale_linters#ansible#ansible_lint#GetExecutable'),
\ 'cwd': function('ale_linters#ansible#ansible_lint#GetCwd'), \ 'command': {buffer -> ale#semver#RunWithVersionCheck(
\ 'command': function('ale_linters#ansible#ansible_lint#RunWithVersionCheck'), \ buffer,
\ ale_linters#ansible#ansible_lint#GetExecutable(buffer),
\ '%e --version',
\ function('ale_linters#ansible#ansible_lint#GetCommand'),
\ )},
\ 'lint_file': 1, \ 'lint_file': 1,
\ 'callback': {buffer, lines -> ale#semver#RunWithVersionCheck( \ 'callback': {buffer, lines -> ale#semver#RunWithVersionCheck(
\ buffer, \ buffer,

View File

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

View File

@@ -1,4 +1,9 @@
" Author: rhysd https://rhysd.github.io " Author: rhysd https://rhysd.github.io
" Description: Redpen, a proofreading tool (http://redpen.cc) " Description: Redpen, a proofreading tool (http://redpen.cc)
call ale#handlers#redpen#DefineLinter('asciidoc') call ale#linter#Define('asciidoc', {
\ 'name': 'redpen',
\ 'executable': 'redpen',
\ 'command': 'redpen -f asciidoc -r json %t',
\ 'callback': 'ale#handlers#redpen#HandleRedpenOutput',
\})

View File

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

View File

@@ -1,43 +0,0 @@
" Description: named-checkzone for bindzone
call ale#Set('bindzone_checkzone_executable', 'named-checkzone')
call ale#Set('bindzone_checkzone_options', '-c IN')
function! ale_linters#bindzone#checkzone#GetCommand(buffer) abort
return '%e' . ale#Pad(ale#Var(a:buffer, 'bindzone_checkzone_options'))
\ . ' example.com %t'
endfunction
function! ale_linters#bindzone#checkzone#Handle(buffer, lines) abort
let l:warning_pattern = '\vzone example.com/IN: (.+)$'
let l:error_pattern = '\v:(\d+): (.+)$'
let l:output = []
for l:match in ale#util#GetMatches(a:lines, l:error_pattern)
let l:lnum = l:match[1]
let l:text = l:match[2]
call add(l:output, {'text': l:text, 'lnum': l:lnum + 0, 'type': 'E'})
endfor
for l:match in ale#util#GetMatches(a:lines, l:warning_pattern)
let l:text = l:match[1]
" Ignore information messages
let l:scrub_match = matchlist(l:text, '\v(loaded serial|not loaded due to) ')
if empty(l:scrub_match)
call add(l:output, {'text': l:text, 'lnum': 0, 'type': 'W'})
endif
endfor
return l:output
endfunction
call ale#linter#Define('bindzone', {
\ 'name': 'checkzone',
\ 'executable': {b -> ale#Var(b, 'bindzone_checkzone_executable')},
\ 'command': function('ale_linters#bindzone#checkzone#GetCommand'),
\ 'callback': 'ale_linters#bindzone#checkzone#Handle',
\ 'read_buffer': 0,
\})

View File

@@ -5,14 +5,6 @@ call ale#Set('bitbake_oelint_adv_executable', 'oelint-adv')
call ale#Set('bitbake_oelint_adv_options', '') call ale#Set('bitbake_oelint_adv_options', '')
call ale#Set('bitbake_oelint_adv_config', '.oelint.cfg') call ale#Set('bitbake_oelint_adv_config', '.oelint.cfg')
function! ale_linters#bitbake#oelint_adv#StripAnsiCodes(line) abort
return substitute(a:line, '\e\[[0-9;]\+[mK]', '', 'g')
endfunction
function! ale_linters#bitbake#oelint_adv#RemoveBranch(line) abort
return substitute(a:line, ' \[branch:.*', '', 'g')
endfunction
function! ale_linters#bitbake#oelint_adv#Command(buffer) abort function! ale_linters#bitbake#oelint_adv#Command(buffer) abort
let l:config_file = ale#path#FindNearestFile(a:buffer, let l:config_file = ale#path#FindNearestFile(a:buffer,
\ ale#Var(a:buffer, 'bitbake_oelint_adv_config')) \ ale#Var(a:buffer, 'bitbake_oelint_adv_config'))
@@ -25,25 +17,26 @@ function! ale_linters#bitbake#oelint_adv#Command(buffer) abort
endfunction endfunction
function! ale_linters#bitbake#oelint_adv#Handle(buffer, lines) abort function! ale_linters#bitbake#oelint_adv#Handle(buffer, lines) abort
let l:pattern = '\v^(.{-}):(.{-}):(.{-}):(.{-}):(.{-})$' let l:pattern = '\v^(.+):(.+):(.+):(.+):(.+)$'
let l:output = [] let l:output = []
for l:match in ale#util#GetMatches(a:lines, l:pattern) for l:match in ale#util#GetMatches(a:lines, l:pattern)
call add(l:output, { call add(l:output, {
\ 'lnum': str2nr(l:match[2]), \ 'lnum': str2nr(l:match[2]),
\ 'type': l:match[3] is# 'error' \ 'type': l:match[3] is# 'error'
\ ? 'E' \ ? 'E' : (l:match[3] is# 'warning' ? 'W' : 'I'),
\ : (l:match[3] is# 'warning' ? 'W' : 'I'), \ 'text': StripAnsiCodes(l:match[5]),
\ 'text': ale_linters#bitbake#oelint_adv#RemoveBranch( \ 'code': l:match[4]
\ ale_linters#bitbake#oelint_adv#StripAnsiCodes(l:match[5]) \ })
\ ),
\ 'code': l:match[4],
\})
endfor endfor
return l:output return l:output
endfunction endfunction
function! StripAnsiCodes(line) abort
return substitute(a:line, '\e\[[0-9;]\+[mK]', '', 'g')
endfunction
call ale#linter#Define('bitbake', { call ale#linter#Define('bitbake', {
\ 'name': 'oelint_adv', \ 'name': 'oelint_adv',
\ 'output_stream': 'both', \ 'output_stream': 'both',

View File

@@ -10,18 +10,13 @@ function! ale_linters#c#cppcheck#GetCommand(buffer) abort
\ ? ale#handlers#cppcheck#GetBufferPathIncludeOptions(a:buffer) \ ? ale#handlers#cppcheck#GetBufferPathIncludeOptions(a:buffer)
\ : '' \ : ''
let l:template = ' --template=' . ale#Escape('{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}') 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' return '%e -q --language=c'
\ . l:template \ . l:template
\ . ale#Pad(l:compile_commands_option) \ . ale#Pad(l:compile_commands_option)
\ . ale#Pad(ale#Var(a:buffer, 'c_cppcheck_options')) \ . ale#Pad(ale#Var(a:buffer, 'c_cppcheck_options'))
\ . l:buffer_path_include \ . l:buffer_path_include
\ . l:source_file \ . ' %t'
endfunction endfunction
call ale#linter#Define('c', { call ale#linter#Define('c', {

View File

@@ -1,41 +0,0 @@
" Author: J. Handsel <jennpbc@posteo.net>, Thyme-87 <thyme-87@posteo.me>
" Description: use checkov for providing warnings for cloudformation via ale
call ale#Set('cloudformation_checkov_executable', 'checkov')
call ale#Set('cloudformation_checkov_options', '')
function! ale_linters#cloudformation#checkov#GetExecutable(buffer) abort
return ale#Var(a:buffer, 'cloudformation_checkov_executable')
endfunction
function! ale_linters#cloudformation#checkov#GetCommand(buffer) abort
return '%e ' . '-f %t -o json --quiet --framework cloudformation ' . ale#Var(a:buffer, 'cloudformation_checkov_options')
endfunction
function! ale_linters#cloudformation#checkov#Handle(buffer, lines) abort
let l:output = []
let l:results = get(get(ale#util#FuzzyJSONDecode(a:lines, {}), 'results', []), 'failed_checks', [])
for l:violation in l:results
call add(l:output, {
\ 'filename': l:violation['file_path'],
\ 'lnum': l:violation['file_line_range'][0],
\ 'end_lnum': l:violation['file_line_range'][1],
\ 'text': l:violation['check_name'] . ' [' . l:violation['check_id'] . ']',
\ 'detail': l:violation['check_id'] . ': ' . l:violation['check_name'] . "\n" .
\ 'For more information, see: '. l:violation['guideline'],
\ 'type': 'W',
\ })
endfor
return l:output
endfunction
call ale#linter#Define('cloudformation', {
\ 'name': 'checkov',
\ 'output_stream': 'stdout',
\ 'executable': function('ale_linters#cloudformation#checkov#GetExecutable'),
\ 'command': function('ale_linters#cloudformation#checkov#GetCommand'),
\ 'callback': 'ale_linters#cloudformation#checkov#Handle',
\})

View File

@@ -10,18 +10,13 @@ function! ale_linters#cpp#cppcheck#GetCommand(buffer) abort
\ ? ale#handlers#cppcheck#GetBufferPathIncludeOptions(a:buffer) \ ? ale#handlers#cppcheck#GetBufferPathIncludeOptions(a:buffer)
\ : '' \ : ''
let l:template = ' --template=' . ale#Escape('{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}') 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++' return '%e -q --language=c++'
\ . l:template \ . l:template
\ . ale#Pad(l:compile_commands_option) \ . ale#Pad(l:compile_commands_option)
\ . ale#Pad(ale#Var(a:buffer, 'cpp_cppcheck_options')) \ . ale#Pad(ale#Var(a:buffer, 'cpp_cppcheck_options'))
\ . l:buffer_path_include \ . l:buffer_path_include
\ . l:source_file \ . ' %t'
endfunction endfunction
call ale#linter#Define('cpp', { call ale#linter#Define('cpp', {

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 function! ale_linters#css#stylelint#GetCommand(buffer) abort
return '%e ' . ale#Pad(ale#Var(a:buffer, 'css_stylelint_options')) return '%e ' . ale#Pad(ale#Var(a:buffer, 'css_stylelint_options'))
\ . ' --no-color --stdin-filename %s' \ . ' --stdin-filename %s'
endfunction endfunction
call ale#linter#Define('css', { call ale#linter#Define('css', {

View File

@@ -49,6 +49,7 @@ function! ale_linters#dockerfile#hadolint#Handle(buffer, lines) abort
if l:match[5] isnot# '' if l:match[5] isnot# ''
let l:code = l:match[4] . l:match[5] let l:code = l:match[4] . l:match[5]
let l:link = ' ( ' . l:domain . l:code . ' )' let l:link = ' ( ' . l:domain . l:code . ' )'
let l:text = l:code . ': ' . l:detail
let l:detail = l:code . l:link . "\n\n" . l:detail let l:detail = l:code . l:link . "\n\n" . l:detail
else else
let l:type = 'E' let l:type = 'E'

View File

@@ -1,12 +0,0 @@
" 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,47 +0,0 @@
" Author: gomfol12
" Desciption: A linter for fortran using fortitude.
call ale#Set('fortran_fortitude_executable', 'fortitude')
call ale#Set('fortran_fortitude_options', '')
let s:severity_map = {
\ 'E': 'E',
\ 'C': 'W',
\ 'OB': 'I',
\ 'MOD': 'I',
\ 'S': 'I',
\ 'PORT': 'I',
\ 'FORT': 'I',
\}
function! ale_linters#fortran#fortitude#Handle(buffer, lines) abort
let l:output = []
for l:error in ale#util#FuzzyJSONDecode(a:lines, [])
let l:prefix = matchstr(l:error['code'], '^\a\+')
let l:type = get(s:severity_map, l:prefix, 'I')
call add(l:output, {
\ 'lnum': l:error['location']['row'],
\ 'end_lnum': l:error['end_location']['row'],
\ 'col': l:error['location']['column'],
\ 'end_col': l:error['end_location']['column'],
\ 'text': l:error['message'],
\ 'type': l:type,
\ 'code': l:error['code'],
\})
endfor
return l:output
endfunction
call ale#linter#Define('fortran', {
\ 'name': 'fortitude',
\ 'output_stream': 'stdout',
\ 'executable': {b -> ale#Var(b, 'fortran_fortitude_executable')},
\ 'command': {b ->
\ '%e' . ' check --output-format json' . ale#Pad(ale#Var(b, 'fortran_fortitude_options')) . ' %s'
\ },
\ 'callback': 'ale_linters#fortran#fortitude#Handle',
\ 'lint_file': 1,
\})

View File

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

View File

@@ -5,38 +5,26 @@ call ale#Set('go_golangci_lint_options', '')
call ale#Set('go_golangci_lint_executable', 'golangci-lint') call ale#Set('go_golangci_lint_executable', 'golangci-lint')
call ale#Set('go_golangci_lint_package', 1) call ale#Set('go_golangci_lint_package', 1)
function! ale_linters#go#golangci_lint#GetExecutable(buffer) abort function! ale_linters#go#golangci_lint#GetCommand(buffer) abort
let l:executable = ale#Var(a:buffer, 'go_golangci_lint_executable')
return l:executable
endfunction
function! ale_linters#go#golangci_lint#GetCommand(buffer, version) abort
let l:filename = expand('#' . a:buffer . ':t') let l:filename = expand('#' . a:buffer . ':t')
let l:options = ale#Var(a:buffer, 'go_golangci_lint_options') let l:options = ale#Var(a:buffer, 'go_golangci_lint_options')
let l:lint_package = ale#Var(a:buffer, 'go_golangci_lint_package') let l:lint_package = ale#Var(a:buffer, 'go_golangci_lint_package')
if ale#semver#GTE(a:version, [2, 0, 0])
let l:options = l:options
\ . ' --output.json.path stdout'
\ . ' --output.text.path stderr'
\ . ' --show-stats=0'
else
let l:options = l:options
\ . ' --out-format=json'
\ . ' --show-stats=0'
endif
if l:lint_package if l:lint_package
return ale#go#EnvString(a:buffer) return ale#go#EnvString(a:buffer)
\ . '%e run ' \ . '%e run '
\ . l:options \ . l:options
\ . ' --out-format=json'
\ . ' --show-stats=0'
endif endif
return ale#go#EnvString(a:buffer) return ale#go#EnvString(a:buffer)
\ . '%e run ' \ . '%e run '
\ . ale#Escape(l:filename) \ . ale#Escape(l:filename)
\ . ' ' . l:options \ . ' ' . l:options
\ . ' --out-format=json'
\ . ' --show-stats=0'
endfunction endfunction
function! ale_linters#go#golangci_lint#Handler(buffer, lines) abort function! ale_linters#go#golangci_lint#Handler(buffer, lines) abort
@@ -70,14 +58,9 @@ endfunction
call ale#linter#Define('go', { call ale#linter#Define('go', {
\ 'name': 'golangci-lint', \ 'name': 'golangci-lint',
\ 'executable': function('ale_linters#go#golangci_lint#GetExecutable'), \ 'executable': {b -> ale#Var(b, 'go_golangci_lint_executable')},
\ 'cwd': '%s:h', \ 'cwd': '%s:h',
\ 'command': {buffer -> ale#semver#RunWithVersionCheck( \ 'command': function('ale_linters#go#golangci_lint#GetCommand'),
\ buffer,
\ ale_linters#go#golangci_lint#GetExecutable(buffer),
\ '%e --version',
\ function('ale_linters#go#golangci_lint#GetCommand'),
\ )},
\ 'callback': 'ale_linters#go#golangci_lint#Handler', \ 'callback': 'ale_linters#go#golangci_lint#Handler',
\ 'lint_file': 1, \ 'lint_file': 1,
\}) \})

View File

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

View File

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

View File

@@ -16,7 +16,7 @@ function! ale_linters#html#stylelint#GetCommand(buffer) abort
return ale#Escape(l:executable) return ale#Escape(l:executable)
\ . (!empty(l:options) ? ' ' . l:options : '') \ . (!empty(l:options) ? ' ' . l:options : '')
\ . ' --no-color --stdin-filename %s' \ . ' --stdin-filename %s'
endfunction endfunction
call ale#linter#Define('html', { call ale#linter#Define('html', {

View File

@@ -1,34 +0,0 @@
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

@@ -1,46 +0,0 @@
" 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

@@ -1,28 +0,0 @@
" Author: Benjamin Block <https://github.com/benjamindblock>
" Description: A language server for Lean 4.
function! ale_linters#lean#lake#GetProjectRoot(buffer) abort
let l:lakefile_toml = ale#path#FindNearestFile(a:buffer, 'lakefile.toml')
let l:lakefile_lean = ale#path#FindNearestFile(a:buffer, 'lakefile.lean')
if !empty(l:lakefile_toml)
return fnamemodify(l:lakefile_toml, ':p:h')
elseif !empty(l:lakefile_lean)
return fnamemodify(l:lakefile_lean, ':p:h')
else
return fnamemodify('', ':h')
endif
endfunction
call ale#Set('lean_lake_executable', 'lake')
call ale#Set('lean_lake_config', {})
call ale#linter#Define('lean', {
\ 'name': 'lake',
\ 'lsp': 'stdio',
\ 'language': 'lean',
\ 'lsp_config': {b -> ale#Var(b, 'lean_lake_config')},
\ 'executable': {b -> ale#Var(b, 'lean_lake_executable')},
\ 'command': '%e serve',
\ 'project_root': function('ale_linters#lean#lake#GetProjectRoot'),
\})

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 function! ale_linters#less#stylelint#GetCommand(buffer) abort
let l:options = ale#Var(a:buffer, 'less_stylelint_options') let l:options = ale#Var(a:buffer, 'less_stylelint_options')
return '%e' . ale#Pad(l:options) . ' --no-color --stdin-filename %s' return '%e' . ale#Pad(l:options) . ' --stdin-filename %s'
endfunction endfunction
call ale#linter#Define('less', { call ale#linter#Define('less', {

View File

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

View File

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

View File

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

View File

@@ -1,4 +1,9 @@
" Author: rhysd https://rhysd.github.io " Author: rhysd https://rhysd.github.io
" Description: Redpen, a proofreading tool (http://redpen.cc) " Description: Redpen, a proofreading tool (http://redpen.cc)
call ale#handlers#redpen#DefineLinter('markdown') call ale#linter#Define('markdown', {
\ 'name': 'redpen',
\ 'executable': 'redpen',
\ 'command': 'redpen -f markdown -r json %t',
\ 'callback': 'ale#handlers#redpen#HandleRedpenOutput',
\})

View File

@@ -29,7 +29,7 @@ function! ale_linters#nix#nix#Handle(buffer, lines) abort
\ 'type': 'E', \ 'type': 'E',
\ 'lnum': l:result.line, \ 'lnum': l:result.line,
\ 'col': l:result.column, \ 'col': l:result.column,
\ 'text': substitute(l:result.raw_msg, '\e\[[0-9;]*m', '', 'g'), \ 'text': l:result.raw_msg
\}) \})
endif endif
endif endif

View File

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

View File

@@ -1,49 +0,0 @@
" Authors: ophirr33 <coghlan.ty@gmail.com>, rymdbar <https://rymdbar.x20.se/>
" Description: Perl::LanguageServer for perl, from cpan.org
" This should have the same value as in perl.vim
call ale#Set('perl_perl_executable', 'perl')
" Please note that perl_perl_options does not exist here.
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' ]
for l:root in l:potential_roots
let l:project_root = ale#path#FindNearestFile(a:buffer, l:root)
if !empty(l:project_root)
return fnamemodify(l:project_root . '/', ':p:h:h')
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
call ale#Set('perl_languageserver_config', {})
function! s:get_lsp_config(buffer) abort
" This tool doesn't kick in unless workspace/didChangeConfiguration is
" called, thus this function returning a fallback dict when there is no
" config.
let l:lsp_config = ale#Var(a:buffer, 'perl_languageserver_config')
return empty(l:lsp_config) ? { 'perl': { 'enable': 1 } } : l:lsp_config
endfunction
call ale#linter#Define('perl', {
\ 'name': 'languageserver',
\ 'lsp': 'stdio',
\ 'executable': {b -> ale#Var(b, 'perl_perl_executable')},
\ 'command': '%e -MPerl::LanguageServer -ePerl::LanguageServer::run',
\ 'lsp_config': {b -> s:get_lsp_config(b)},
\ 'project_root': function('ale_linters#perl#languageserver#GetProjectRoot'),
\ })

View File

@@ -1,9 +1,6 @@
" Author: Arizard <https://github.com/Arizard> " Author: Arizard <https://github.com/Arizard>
" Description: PHPactor integration for ALE " Description: PHPactor integration for ALE
call ale#Set('php_phpactor_executable', 'phpactor')
call ale#Set('php_phpactor_init_options', {})
" Copied from langserver.vim " Copied from langserver.vim
function! ale_linters#php#phpactor#GetProjectRoot(buffer) abort function! ale_linters#php#phpactor#GetProjectRoot(buffer) abort
let l:composer_path = ale#path#FindNearestFile(a:buffer, 'composer.json') let l:composer_path = ale#path#FindNearestFile(a:buffer, 'composer.json')
@@ -20,8 +17,7 @@ endfunction
call ale#linter#Define('php', { call ale#linter#Define('php', {
\ 'name': 'phpactor', \ 'name': 'phpactor',
\ 'lsp': 'stdio', \ 'lsp': 'stdio',
\ 'executable': {b -> ale#Var(b, 'php_phpactor_executable')}, \ 'executable': 'phpactor',
\ 'command': '%e language-server', \ 'command': '%e language-server',
\ 'initialization_options': {b -> ale#Var(b, 'php_phpactor_init_options')},
\ 'project_root': function('ale_linters#php#phpactor#GetProjectRoot'), \ 'project_root': function('ale_linters#php#phpactor#GetProjectRoot'),
\}) \})

View File

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

View File

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

View File

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

View File

@@ -1,57 +0,0 @@
" Author: oliverralbertini <oliver.albertini@gmail.com>
" Description: A performant type-checker supporting LSP for Python 3 created by Facebook
call ale#Set('python_pyrefly_executable', 'pyrefly')
call ale#Set('python_pyrefly_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('python_pyrefly_auto_pipenv', 0)
call ale#Set('python_pyrefly_auto_poetry', 0)
call ale#Set('python_pyrefly_auto_uv', 0)
function! ale_linters#python#pyrefly#GetExecutable(buffer) abort
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pyrefly_auto_pipenv'))
\ && ale#python#PipenvPresent(a:buffer)
return 'pipenv'
endif
if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_pyrefly_auto_poetry'))
\ && ale#python#PoetryPresent(a:buffer)
return 'poetry'
endif
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_pyrefly_auto_uv'))
\ && ale#python#UvPresent(a:buffer)
return 'uv'
endif
return ale#python#FindExecutable(a:buffer, 'python_pyrefly', ['pyrefly'])
endfunction
function! ale_linters#python#pyrefly#GetCommand(buffer) abort
let l:executable = ale_linters#python#pyrefly#GetExecutable(a:buffer)
let l:exec_args = [
\ ale#Escape(l:executable)
\ ]
\ + (l:executable =~? '\(pipenv\|poetry\|uv\)$' ? ['run', 'pyrefly'] : [])
\ + [
\ 'lsp',
\ ]
return join(l:exec_args, ' ')
endfunction
function! ale_linters#python#pyrefly#GetCwd(buffer) abort
" Run from project root if found, else from buffer dir.
let l:project_root = ale#python#FindProjectRoot(a:buffer)
return !empty(l:project_root) ? l:project_root : '%s:h'
endfunction
call ale#linter#Define('python', {
\ 'name': 'pyrefly',
\ 'lsp': 'stdio',
\ 'executable': function('ale_linters#python#pyrefly#GetExecutable'),
\ 'command': function('ale_linters#python#pyrefly#GetCommand'),
\ 'project_root': function('ale#python#FindProjectRoot'),
\ 'completion_filter': 'ale#completion#python#CompletionItemFilter',
\ 'cwd': function('ale_linters#python#pyrefly#GetCwd'),
\})

View File

@@ -34,22 +34,6 @@ function! ale_linters#python#ruff#GetExecutable(buffer) abort
return ale#python#FindExecutable(a:buffer, 'python_ruff', ['ruff']) return ale#python#FindExecutable(a:buffer, 'python_ruff', ['ruff'])
endfunction endfunction
function! ale_linters#python#ruff#RunWithVersionCheck(buffer) abort
let l:executable = ale_linters#python#ruff#GetExecutable(a:buffer)
let l:exec_args = l:executable =~? '\(pipenv\|poetry\|uv\)$'
\ ? ' run ruff'
\ : ''
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#ruff#GetCommand'),
\)
endfunction
function! ale_linters#python#ruff#GetCwd(buffer) abort function! ale_linters#python#ruff#GetCwd(buffer) abort
if ale#Var(a:buffer, 'python_ruff_change_directory') if ale#Var(a:buffer, 'python_ruff_change_directory')
" Run from project root if found, else from buffer dir. " Run from project root if found, else from buffer dir.
@@ -88,35 +72,20 @@ function! ale_linters#python#ruff#Handle(buffer, lines) abort
try try
let l:item = json_decode(l:line) let l:item = json_decode(l:line)
catch catch
" If we can't decode a line, skip it. let l:item = v:null
continue
endtry endtry
if empty(l:item) if !empty(l:item)
continue call add(l:output, {
\ 'lnum': l:item.location.row,
\ 'col': l:item.location.column,
\ 'end_lnum': l:item.end_location.row,
\ 'end_col': l:item.end_location.column - 1,
\ 'code': l:item.code,
\ 'text': l:item.message,
\ 'type': l:item.code =~? '\vE\d+' ? 'E' : 'W',
\})
endif endif
if (l:item.code is# 'W291' || l:item.code is# 'W293')
\&& !ale#Var(a:buffer, 'warn_about_trailing_whitespace')
" Skip warnings for trailing whitespace if the option is off.
continue
endif
if l:item.code is# 'W391'
\&& !ale#Var(a:buffer, 'warn_about_trailing_blank_lines')
" Skip warnings for trailing blank lines if the option is off
continue
endif
call add(l:output, {
\ 'lnum': l:item.location.row,
\ 'col': l:item.location.column,
\ 'end_lnum': l:item.end_location.row,
\ 'end_col': l:item.end_location.column - 1,
\ 'code': l:item.code,
\ 'text': l:item.message,
\ 'type': l:item.code =~? '\vE\d+' ? 'E' : 'W',
\})
endfor endfor
return l:output return l:output
@@ -126,7 +95,12 @@ call ale#linter#Define('python', {
\ 'name': 'ruff', \ 'name': 'ruff',
\ 'executable': function('ale_linters#python#ruff#GetExecutable'), \ 'executable': function('ale_linters#python#ruff#GetExecutable'),
\ 'cwd': function('ale_linters#python#ruff#GetCwd'), \ 'cwd': function('ale_linters#python#ruff#GetCwd'),
\ 'command': function('ale_linters#python#ruff#RunWithVersionCheck'), \ 'command': {buffer -> ale#semver#RunWithVersionCheck(
\ buffer,
\ ale_linters#python#ruff#GetExecutable(buffer),
\ '%e --version',
\ function('ale_linters#python#ruff#GetCommand'),
\ )},
\ 'callback': 'ale_linters#python#ruff#Handle', \ 'callback': 'ale_linters#python#ruff#Handle',
\ 'output_stream': 'both', \ 'output_stream': 'both',
\ 'read_buffer': 1, \ 'read_buffer': 1,

View File

@@ -1,24 +0,0 @@
" 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,4 +1,9 @@
" Author: rhysd https://rhysd.github.io " Author: rhysd https://rhysd.github.io
" Description: Redpen, a proofreading tool (http://redpen.cc) " Description: Redpen, a proofreading tool (http://redpen.cc)
call ale#handlers#redpen#DefineLinter('review') call ale#linter#Define('review', {
\ 'name': 'redpen',
\ 'executable': 'redpen',
\ 'command': 'redpen -f review -r json %t',
\ 'callback': 'ale#handlers#redpen#HandleRedpenOutput',
\})

View File

@@ -1,25 +0,0 @@
" Author: Benjamin Block <https://github.com/benjamindblock>
" Description: A language server for Roc.
function! ale_linters#roc#roc_language_server#GetProjectRoot(buffer) abort
let l:roc_main_file = ale#path#FindNearestFile(a:buffer, 'main.roc')
if !empty(l:roc_main_file)
return fnamemodify(l:roc_main_file, ':p:h')
else
return fnamemodify('', ':h')
endif
endfunction
call ale#Set('roc_roc_language_server_executable', 'roc_language_server')
call ale#Set('roc_roc_language_server_config', {})
call ale#linter#Define('roc', {
\ 'name': 'roc_language_server',
\ 'lsp': 'stdio',
\ 'language': 'roc',
\ 'lsp_config': {b -> ale#Var(b, 'roc_roc_language_server_config')},
\ 'executable': {b -> ale#Var(b, 'roc_roc_language_server_executable')},
\ 'command': '%e',
\ 'project_root': function('ale_linters#roc#roc_language_server#GetProjectRoot'),
\})

View File

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

View File

@@ -1,4 +1,9 @@
" Author: rhysd https://rhysd.github.io " Author: rhysd https://rhysd.github.io
" Description: Redpen, a proofreading tool (http://redpen.cc) " Description: Redpen, a proofreading tool (http://redpen.cc)
call ale#handlers#redpen#DefineLinter('rst') call ale#linter#Define('rst', {
\ 'name': 'redpen',
\ 'executable': 'redpen',
\ 'command': 'redpen -f rest -r json %t',
\ 'callback': 'ale#handlers#redpen#HandleRedpenOutput',
\})

View File

@@ -1,7 +1,6 @@
call ale#Set('ruby_sorbet_executable', 'srb') call ale#Set('ruby_sorbet_executable', 'srb')
call ale#Set('ruby_sorbet_options', '') call ale#Set('ruby_sorbet_options', '')
call ale#Set('ruby_sorbet_enable_watchman', 0) call ale#Set('ruby_sorbet_enable_watchman', 0)
call ale#Set('ruby_sorbet_initialization_options', { 'highlightUntyped': v:false })
function! ale_linters#ruby#sorbet#GetCommand(buffer) abort function! ale_linters#ruby#sorbet#GetCommand(buffer) abort
let l:executable = ale#Var(a:buffer, 'ruby_sorbet_executable') let l:executable = ale#Var(a:buffer, 'ruby_sorbet_executable')
@@ -22,6 +21,6 @@ call ale#linter#Define('ruby', {
\ 'language': 'ruby', \ 'language': 'ruby',
\ 'executable': {b -> ale#Var(b, 'ruby_sorbet_executable')}, \ 'executable': {b -> ale#Var(b, 'ruby_sorbet_executable')},
\ 'command': function('ale_linters#ruby#sorbet#GetCommand'), \ 'command': function('ale_linters#ruby#sorbet#GetCommand'),
\ 'project_root': function('ale#ruby#FindProjectRoot'), \ 'project_root': function('ale#ruby#FindProjectRoot')
\ 'initialization_options': {b -> ale#Var(b, 'ruby_sorbet_initialization_options')}
\}) \})

View File

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

View File

@@ -13,7 +13,6 @@ function! ale_linters#scala#metals#GetProjectRoot(buffer) abort
let l:potential_roots = [ let l:potential_roots = [
\ 'build.sc', \ 'build.sc',
\ 'build.mill',
\ 'build.sbt', \ 'build.sbt',
\ '.bloop', \ '.bloop',
\ '.metals', \ '.metals',

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 function! ale_linters#scss#stylelint#GetCommand(buffer) abort
return '%e ' . ale#Pad(ale#Var(a:buffer, 'scss_stylelint_options')) return '%e ' . ale#Pad(ale#Var(a:buffer, 'scss_stylelint_options'))
\ . ' --no-color --stdin-filename %s' \ . ' --stdin-filename %s'
endfunction endfunction
call ale#linter#Define('scss', { call ale#linter#Define('scss', {

View File

@@ -25,7 +25,6 @@ endfunction
call ale#linter#Define('sh', { call ale#linter#Define('sh', {
\ 'name': 'language_server', \ 'name': 'language_server',
\ 'aliases': ['bash-language-server'],
\ 'lsp': 'stdio', \ 'lsp': 'stdio',
\ 'executable': function('ale_linters#sh#language_server#GetExecutable'), \ 'executable': function('ale_linters#sh#language_server#GetExecutable'),
\ 'command': function('ale_linters#sh#language_server#GetCommand'), \ 'command': function('ale_linters#sh#language_server#GetCommand'),

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 function! ale_linters#stylus#stylelint#GetCommand(buffer) abort
return '%e' return '%e'
\ . ale#Pad(ale#Var(a:buffer, 'stylus_stylelint_options')) \ . ale#Pad(ale#Var(a:buffer, 'stylus_stylelint_options'))
\ . ' --no-color --stdin-filename %s' \ . ' --stdin-filename %s'
endfunction endfunction
call ale#linter#Define('stylus', { 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 function! ale_linters#sugarss#stylelint#GetCommand(buffer) abort
return '%e ' . ale#Pad(ale#Var(a:buffer, 'sugarss_stylelint_options')) return '%e ' . ale#Pad(ale#Var(a:buffer, 'sugarss_stylelint_options'))
\ . ' --syntax=sugarss' \ . ' --syntax=sugarss'
\ . ' --no-color --stdin-filename %s' \ . ' --stdin-filename %s'
endfunction endfunction
call ale#linter#Define('sugarss', { call ale#linter#Define('sugarss', {

View File

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

View File

@@ -1,4 +1,9 @@
" Author: rhysd https://rhysd.github.io " Author: rhysd https://rhysd.github.io
" Description: Redpen, a proofreading tool (http://redpen.cc) " Description: Redpen, a proofreading tool (http://redpen.cc)
call ale#handlers#redpen#DefineLinter('tex') call ale#linter#Define('tex', {
\ 'name': 'redpen',
\ 'executable': 'redpen',
\ 'command': 'redpen -f latex -r json %t',
\ 'callback': 'ale#handlers#redpen#HandleRedpenOutput',
\})

View File

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

View File

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

View File

@@ -1,4 +1,9 @@
" Author: rhysd https://rhysd.github.io " Author: rhysd https://rhysd.github.io
" Description: Redpen, a proofreading tool (http://redpen.cc) " Description: Redpen, a proofreading tool (http://redpen.cc)
call ale#handlers#redpen#DefineLinter('text') call ale#linter#Define('text', {
\ 'name': 'redpen',
\ 'executable': 'redpen',
\ 'command': 'redpen -f plain -r json %t',
\ 'callback': 'ale#handlers#redpen#HandleRedpenOutput',
\})

View File

@@ -1,22 +1,9 @@
" Author: chew-z https://github.com/chew-z " Author: chew-z https://github.com/chew-z
" Description: vale for text files " 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)
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ' --output=JSON %t'
endfunction
call ale#linter#Define('text', { call ale#linter#Define('text', {
\ 'name': 'vale', \ 'name': 'vale',
\ 'executable': 'vale', \ 'executable': 'vale',
\ 'command': function('ale_linters#text#vale#GetCommand'), \ 'command': 'vale --output=JSON %t',
\ 'callback': 'ale#handlers#vale#Handle', \ 'callback': 'ale#handlers#vale#Handle',
\}) \})

View File

@@ -1,51 +0,0 @@
" Author: Ben Boeckel <github@me.benboeckel.net>
" Description: TOML Formatter / Linter / Language Server
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
let l:tombiconfig_file = ale#path#FindNearestFile(a:buffer, 'tombi.toml')
if !empty(l:tombiconfig_file)
return fnamemodify(l:tombiconfig_file . '/', ':p:h:h')
endif
" Try to find nearest pyproject.toml
let l:pyproject_file = ale#path#FindNearestFile(a:buffer, 'pyproject.toml')
if !empty(l:pyproject_file)
return fnamemodify(l:pyproject_file . '/', ':p:h:h')
endif
" Try to find nearest `git` directory
let l:gitdir = ale#path#FindNearestFile(a:buffer, '.git')
if !empty(l:gitdir)
return fnamemodify(l:gitdir . '/', ':p:h:h')
endif
return ''
endfunction
call ale#linter#Define('toml', {
\ 'name': 'tombi',
\ 'lsp': 'stdio',
\ 'executable': {b -> ale#Var(b, 'toml_tombi_executable')},
\ 'command': function('ale_linters#toml#tombi#GetCommand'),
\ 'project_root': function('ale_linters#toml#tombi#GetProjectRoot'),
\})

View File

@@ -9,9 +9,7 @@ endif
" --lint-only " --lint-only
function! ale_linters#verilog#slang#GetCommand(buffer) abort function! ale_linters#verilog#slang#GetCommand(buffer) abort
return 'slang -Weverything ' return 'slang -Weverything '
\ . '--diag-abs-paths '
\ . '-I%s:h ' \ . '-I%s:h '
\ . '-y%s:h '
\ . ale#Var(a:buffer, 'verilog_slang_options') .' ' \ . ale#Var(a:buffer, 'verilog_slang_options') .' '
\ . '%t' \ . '%t'
endfunction endfunction
@@ -30,7 +28,6 @@ function! ale_linters#verilog#slang#Handle(buffer, lines) abort
for l:match in ale#util#GetMatches(a:lines, l:pattern) for l:match in ale#util#GetMatches(a:lines, l:pattern)
let l:item = { let l:item = {
\ 'filename': l:match[1],
\ 'lnum': str2nr(l:match[2]), \ 'lnum': str2nr(l:match[2]),
\ 'type': (l:match[4] is# 'error') ? 'E' : 'W', \ 'type': (l:match[4] is# 'error') ? 'E' : 'W',
\ 'text': s:RemoveUnicodeQuotes(l:match[5]), \ 'text': s:RemoveUnicodeQuotes(l:match[5]),

View File

@@ -1,43 +0,0 @@
" Author: Nicolas Derumigny <https://github.com/nicolasderumigny>
" Description: Verible LSP for verilog
call ale#Set('verilog_verible_ls_options', '--rules_config_search')
call ale#Set('verilog_verible_ls_rules', '')
call ale#Set('verilog_verible_ls_executable', 'verible-verilog-ls')
call ale#Set('verilog_verible_ls_config', {})
function! ale_linters#verilog#verible_ls#GetProjectRoot(buffer) abort
let l:git_dir = ale#path#FindNearestFile(a:buffer, 'verible.filelist')
if !empty(l:git_dir)
return fnamemodify(l:git_dir, ':p:h')
else
return fnamemodify('', ':h')
endif
endfunction
function! ale_linters#verilog#verible_ls#GetCommand(buffer) abort
let l:command = ale#Escape(ale#Var(a:buffer, 'verilog_verible_ls_executable'))
let l:options = ale#Var(a:buffer, 'verilog_verible_ls_options')
let l:rules = ale#Var(a:buffer, 'verilog_verible_ls_rules')
if l:options isnot# ''
let l:command .= ' ' . l:options
endif
if l:rules isnot# ''
let l:command .= ' --rules=' . l:rules
endif
return l:command
endfunction
call ale#linter#Define('verilog', {
\ 'name': 'verible_ls',
\ 'lsp': 'stdio',
\ 'lsp_config': {b -> ale#Var(b, 'verilog_verible_ls_config')},
\ 'executable': {b -> ale#Var(b, 'verilog_verible_ls_executable')},
\ 'command': function('ale_linters#verilog#verible_ls#GetCommand') ,
\ 'project_root': function('ale_linters#verilog#verible_ls#GetProjectRoot'),
\})

View File

@@ -10,7 +10,6 @@ function! ale_linters#verilog#verilator#GetCommand(buffer) abort
" the path to the current file is systematically added to the search path " the path to the current file is systematically added to the search path
return 'verilator --lint-only -Wall -Wno-DECLFILENAME ' return 'verilator --lint-only -Wall -Wno-DECLFILENAME '
\ . '-I%s:h ' \ . '-I%s:h '
\ . '-y %s:h '
\ . ale#Var(a:buffer, 'verilog_verilator_options') .' ' \ . ale#Var(a:buffer, 'verilog_verilator_options') .' '
\ . '%t' \ . '%t'
endfunction endfunction

View File

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

View File

@@ -12,8 +12,6 @@ let g:__ale_c_project_filenames = ['.git/HEAD', 'configure', 'Makefile', 'CMakeL
let g:ale_c_build_dir_names = get(g:, 'ale_c_build_dir_names', [ let g:ale_c_build_dir_names = get(g:, 'ale_c_build_dir_names', [
\ 'build', \ 'build',
\ 'build/Debug',
\ 'build/Release',
\ 'bin', \ 'bin',
\]) \])

View File

@@ -23,7 +23,7 @@ function! ale#cursor#TruncatedEcho(original_message) abort
" Change tabs to spaces. " Change tabs to spaces.
let l:message = substitute(l:message, "\t", ' ', 'g') let l:message = substitute(l:message, "\t", ' ', 'g')
" Remove any newlines in the message. " Remove any newlines in the message.
let l:message = substitute(l:message, "\n", ' ', 'g') let l:message = substitute(l:message, "\n", '', 'g')
" Convert indentation groups into single spaces for better legibility when " Convert indentation groups into single spaces for better legibility when
" put on a single line " put on a single line
let l:message = substitute(l:message, ' \+', ' ', 'g') let l:message = substitute(l:message, ' \+', ' ', 'g')
@@ -93,7 +93,6 @@ function! ale#cursor#EchoCursorWarning(...) abort
if !empty(l:loc) if !empty(l:loc)
let l:format = ale#Var(l:buffer, 'echo_msg_format') let l:format = ale#Var(l:buffer, 'echo_msg_format')
let l:msg = ale#GetLocItemMessage(l:loc, l:format) let l:msg = ale#GetLocItemMessage(l:loc, l:format)
call ale#cursor#TruncatedEcho(l:msg) call ale#cursor#TruncatedEcho(l:msg)
let l:info.echoed = 1 let l:info.echoed = 1
elseif get(l:info, 'echoed') elseif get(l:info, 'echoed')

View File

@@ -78,7 +78,7 @@ function! ale#fix#ApplyFixes(buffer, output) abort
if !l:data.ignore_file_changed_errors if !l:data.ignore_file_changed_errors
" no-custom-checks " no-custom-checks
echom 'The file was changed before fixing finished' echoerr 'The file was changed before fixing finished'
endif endif
return return

View File

@@ -192,11 +192,6 @@ let s:default_registry = {
\ 'suggested_filetypes': ['python'], \ 'suggested_filetypes': ['python'],
\ 'description': 'Tidy Python imports with pyflyby.', \ 'description': 'Tidy Python imports with pyflyby.',
\ }, \ },
\ 'unimport': {
\ 'function': 'ale#fixers#unimport#Fix',
\ 'suggested_filetypes': ['python'],
\ 'description': 'unimport fixer',
\ },
\ 'importjs': { \ 'importjs': {
\ 'function': 'ale#fixers#importjs#Fix', \ 'function': 'ale#fixers#importjs#Fix',
\ 'suggested_filetypes': ['javascript'], \ 'suggested_filetypes': ['javascript'],
@@ -457,11 +452,6 @@ let s:default_registry = {
\ 'suggested_filetypes': ['markdown'], \ 'suggested_filetypes': ['markdown'],
\ 'description': 'Fix markdown files with pandoc.', \ 'description': 'Fix markdown files with pandoc.',
\ }, \ },
\ 'pymarkdown': {
\ 'function': 'ale#fixers#pymarkdown#Fix',
\ 'suggested_filetypes': ['markdown'],
\ 'description': 'Fix markdown files with pymarkdown.',
\ },
\ 'shfmt': { \ 'shfmt': {
\ 'function': 'ale#fixers#shfmt#Fix', \ 'function': 'ale#fixers#shfmt#Fix',
\ 'suggested_filetypes': ['sh'], \ 'suggested_filetypes': ['sh'],
@@ -677,11 +667,6 @@ let s:default_registry = {
\ 'suggested_filetypes': ['racket'], \ 'suggested_filetypes': ['racket'],
\ 'description': 'Fix Racket files with raco fmt.', \ 'description': 'Fix Racket files with raco fmt.',
\ }, \ },
\ 'rescript_format': {
\ 'function': 'ale#fixers#rescript_format#Fix',
\ 'suggested_filetypes': ['rescript'],
\ 'description': 'Official formatter for ReScript.',
\ },
\ 'ruff': { \ 'ruff': {
\ 'function': 'ale#fixers#ruff#Fix', \ 'function': 'ale#fixers#ruff#Fix',
\ 'suggested_filetypes': ['python'], \ 'suggested_filetypes': ['python'],
@@ -737,36 +722,6 @@ let s:default_registry = {
\ 'suggested_filetypes': ['typst'], \ 'suggested_filetypes': ['typst'],
\ 'description': 'A formatter for Typst files', \ 'description': 'A formatter for Typst files',
\ }, \ },
\ 'roc_format': {
\ 'function': 'ale#fixers#roc_format#Fix',
\ 'suggested_filetypes': ['roc'],
\ 'description': 'Formats Roc files.',
\ },
\ 'roc_annotate': {
\ 'function': 'ale#fixers#roc_annotate#Fix',
\ 'suggested_filetypes': ['roc'],
\ 'description': 'Annotates all top-level definitions in Roc files.',
\ },
\ 'tombi_format': {
\ 'function': 'ale#fixers#tombi_format#Fix',
\ 'suggested_filetypes': ['toml'],
\ 'description': 'Formats TOML files',
\ },
\ 'tombi_lint': {
\ 'function': 'ale#fixers#tombi_lint#Fix',
\ 'suggested_filetypes': ['toml'],
\ 'description': 'Lints TOML files',
\ },
\ 'verible_format': {
\ 'function': 'ale#fixers#verible_format#Fix',
\ '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. " Reset the function registry to the default entries.

View File

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

View File

@@ -22,7 +22,7 @@ function! ale#fixers#clangformat#Fix(buffer) abort
let l:use_local_file = ale#Var(a:buffer, 'c_clangformat_use_local_file') let l:use_local_file = ale#Var(a:buffer, 'c_clangformat_use_local_file')
if l:style_option isnot# '' if l:style_option isnot# ''
let l:style_option = '-style=' . ale#Escape(l:style_option) let l:style_option = '-style=' . "'" . l:style_option . "'"
endif endif
if l:use_local_file if l:use_local_file

View File

@@ -17,11 +17,10 @@ let s:variables = {
\} \}
function! ale#fixers#erlang_mode#Fix(buffer) abort function! ale#fixers#erlang_mode#Fix(buffer) abort
let l:emacs_executable = let emacs_executable =
\ ale#Var(a:buffer, 'erlang_erlang_mode_emacs_executable') \ ale#Var(a:buffer, 'erlang_erlang_mode_emacs_executable')
let l:exprs = [ let l:exprs = [
\ '(setq enable-local-variables :safe)',
\ s:SetqDefault(a:buffer, s:variables), \ s:SetqDefault(a:buffer, s:variables),
\ '(erlang-mode)', \ '(erlang-mode)',
\ '(font-lock-fontify-region (point-min) (point-max))', \ '(font-lock-fontify-region (point-min) (point-max))',

View File

@@ -1,48 +1,32 @@
" Author: Ian Stapleton Cordasco <graffatcolmingov@gmail.com> " Author: Ian Stapleton Cordasco <graffatcolmingov@gmail.com>
" Description: Run golangci-lint with the --fix flag to autofix some issues " Description: Run golangci-lint with the --fix flag to autofix some issues
call ale#Set('go_golangci_formatter_options', '') call ale#Set('go_golangci_lint_options', '')
call ale#Set('go_golangci_formatter_executable', 'golangci-lint') call ale#Set('go_golangci_lint_executable', 'golangci-lint')
call ale#Set('go_golangci_lint_package', 1)
function! ale#fixers#golangci_lint#GetExecutable(buffer) abort function! ale#fixers#golangci_lint#GetCommand(buffer) abort
let l:executable = ale#Var(a:buffer, 'go_golangci_formatter_executable')
return l:executable
endfunction
function! ale#fixers#golangci_lint#GetCommand(buffer, version) abort
let l:filename = expand('#' . a:buffer . ':t') let l:filename = expand('#' . a:buffer . ':t')
let l:executable = ale#fixers#golangci_lint#GetExecutable(a:buffer) let l:executable = ale#Var(a:buffer, 'go_golangci_lint_executable')
let l:options = ale#Var(a:buffer, 'go_golangci_formatter_options') let l:options = ale#Var(a:buffer, 'go_golangci_lint_options') . ' --fix'
let l:package_mode = ale#Var(a:buffer, 'go_golangci_lint_package')
let l:env = ale#go#EnvString(a:buffer) let l:env = ale#go#EnvString(a:buffer)
if ale#semver#GTE(a:version, [2, 0, 0])
return l:env . ale#Escape(l:executable)
\ . ' fmt --stdin '
\ . l:options
else
return l:env . ale#Escape(l:executable)
\ . ' run --fix '
\ . l:options
\ . ' '
\ . ale#Escape(l:filename)
endif
endfunction
function! ale#fixers#golangci_lint#GetCommandForVersion(buffer, version) abort if l:package_mode
return { return l:env . ale#Escape(l:executable)
\ 'command': ale#fixers#golangci_lint#GetCommand(a:buffer, a:version) \ . ' run '
\} \ . l:options
endif
return l:env . ale#Escape(l:executable)
\ . ' run '
\ . l:options
\ . ' ' . ale#Escape(l:filename)
endfunction endfunction
function! ale#fixers#golangci_lint#Fix(buffer) abort function! ale#fixers#golangci_lint#Fix(buffer) abort
let l:executable = ale#fixers#golangci_lint#GetExecutable(a:buffer) return {
let l:command = ale#fixers#golangci_lint#GetExecutable(a:buffer) . ale#Pad('--version') \ 'command': ale#fixers#golangci_lint#GetCommand(a:buffer),
\}
return ale#semver#RunWithVersionCheck(
\ a:buffer,
\ l:executable,
\ l:command,
\ function('ale#fixers#golangci_lint#GetCommandForVersion'),
\)
endfunction endfunction

View File

@@ -1,15 +0,0 @@
: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

@@ -1,46 +0,0 @@
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'
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ' %t',
\ 'read_temporary_file': 1,
\}
endfunction

View File

@@ -1,33 +0,0 @@
" 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

@@ -1,21 +0,0 @@
" Author: Benjamin Block <https://github.com/benjamindblock>
" Description: Official type annotation tool for Roc.
call ale#Set('roc_roc_annotate_executable', 'roc')
call ale#Set('roc_roc_annotate_options', '')
function! ale#fixers#roc_annotate#Fix(buffer) abort
let l:executable = ale#Var(a:buffer, 'roc_roc_annotate_executable')
let l:command = l:executable . ' format annotate'
let l:options = ale#Var(a:buffer, 'roc_roc_annotate_options')
if l:options isnot# ''
let l:command .= ' ' . l:options
endif
return {
\ 'command': l:command . ' %t',
\ 'read_temporary_file': 1,
\}
endfunction

View File

@@ -1,20 +0,0 @@
" Author: Benjamin Block <https://github.com/benjamindblock>
" Description: Official formatter for Roc.
call ale#Set('roc_roc_format_executable', 'roc')
call ale#Set('roc_roc_format_options', '')
function! ale#fixers#roc_format#Fix(buffer) abort
let l:executable = ale#Var(a:buffer, 'roc_roc_format_executable')
let l:command = l:executable . ' format'
let l:options = ale#Var(a:buffer, 'roc_roc_format_options')
if l:options isnot# ''
let l:command .= ' ' . l:options
endif
return {
\ 'command': l:command . ' %t',
\ 'read_temporary_file': 1,
\}
endfunction

View File

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

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

View File

@@ -1,22 +0,0 @@
" Author: Ben Boeckel <github@me.benboeckel.net>
" Description: Integration of tombi formatting with ALE.
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

@@ -1,22 +0,0 @@
" Author: Ben Boeckel <github@me.benboeckel.net>
" Description: Integration of tombi linting with ALE.
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

@@ -1,42 +0,0 @@
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

@@ -1,17 +0,0 @@
" Author: Nicolas Derumigny <https://github.com/nicolasderumigny>
" Description: verible formatter for verilog.
call ale#Set('verilog_verible_format_executable', 'verible-verilog-format')
call ale#Set('verilog_verible_format_options', '')
function! ale#fixers#verible_format#Fix(buffer) abort
let l:executable = ale#Escape(ale#Var(a:buffer, 'verilog_verible_format_executable'))
let l:command = l:executable
let l:options = ale#Var(a:buffer, 'verilog_verible_format_options')
if l:options isnot# ''
let l:command .= ' ' . l:options
endif
return {'command': l:command . ' -'}
endfunction

View File

@@ -1,85 +0,0 @@
" 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,12 +69,11 @@ 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]\' "test.c:1:16: style: misra violation (use --rule-texts=<file> to get proper output) [misra-c2012-2.7]\'
"void test( int parm ) {} "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 = [] let l:output = []
for l:match in ale#util#GetMatches(a:lines, l:pattern) for l:match in ale#util#GetMatches(a:lines, l:pattern)
if ale#path#IsBufferPath(a:buffer, l:match[1]) if ale#path#IsBufferPath(a:buffer, l:match[1])
let l:text = substitute(l:match[6], '\\$', '', '')
call add(l:output, { call add(l:output, {
\ 'lnum': str2nr(l:match[2]), \ 'lnum': str2nr(l:match[2]),
\ 'col': match(l:match[3],'{column}') >= 0 ? 1 : str2nr(l:match[3]), \ '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 endfunction
function! ale#handlers#css#HandleStyleLintFormat(buffer, lines) abort function! ale#handlers#css#HandleStyleLintFormat(buffer, lines) abort
let l:exception_pattern = '\v^(Syntax)?Error:' let l:exception_pattern = '\v^Error:'
for l:line in a:lines[:10] for l:line in a:lines[:10]
if len(matchlist(l:line, l:exception_pattern)) > 0 if len(matchlist(l:line, l:exception_pattern)) > 0

View File

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

View File

@@ -1,8 +1,6 @@
" Author: rhysd https://rhysd.github.io " Author: rhysd https://rhysd.github.io
" Description: Redpen, a proofreading tool (http://redpen.cc) " Description: Redpen, a proofreading tool (http://redpen.cc)
call ale#Set('redpen_options', '')
function! ale#handlers#redpen#HandleRedpenOutput(buffer, lines) abort function! ale#handlers#redpen#HandleRedpenOutput(buffer, lines) abort
" Only one file was passed to redpen. So response array has only one " Only one file was passed to redpen. So response array has only one
" element. " element.
@@ -65,14 +63,3 @@ function! ale#handlers#redpen#HandleRedpenOutput(buffer, lines) abort
return l:output return l:output
endfunction endfunction
" Define the redpen linter for a given filetype.
function! ale#handlers#redpen#DefineLinter(filetype) abort
call ale#linter#Define(a:filetype, {
\ 'name': 'redpen',
\ 'executable': 'redpen',
\ 'command': {b -> 'redpen -f ' . a:filetype . ' -r json' . ale#Pad(ale#Var(b, 'redpen_options')) . ' %t'},
\ 'callback': 'ale#handlers#redpen#HandleRedpenOutput',
\})
endfunction

View File

@@ -63,12 +63,6 @@ function! ale#handlers#shellcheck#GetCommand(buffer, version) abort
\ . ' -f ' . l:format . ' -' \ . ' -f ' . l:format . ' -'
endfunction endfunction
function! s:ShouldIgnoreErrorCode(buffer, code) abort
" Skip warnings for trailing whitespace if the option is off.
return a:code is# 'SC1101'
\ && !ale#Var(a:buffer, 'warn_about_trailing_whitespace')
endfunction
function! s:HandleShellcheckJSON(buffer, lines) abort function! s:HandleShellcheckJSON(buffer, lines) abort
try try
let l:errors = json_decode(a:lines[0]) let l:errors = json_decode(a:lines[0])
@@ -93,17 +87,11 @@ function! s:HandleShellcheckJSON(buffer, lines) abort
let l:type = 'W' let l:type = 'W'
endif endif
let l:code = 'SC' . l:error['code']
if s:ShouldIgnoreErrorCode(a:buffer, l:code)
continue
endif
let l:item = { let l:item = {
\ 'lnum': l:error['line'], \ 'lnum': l:error['line'],
\ 'type': l:type, \ 'type': l:type,
\ 'text': l:error['message'], \ 'text': l:error['message'],
\ 'code': l:code, \ 'code': 'SC' . l:error['code'],
\ 'detail': l:error['message'] . "\n\nFor more information:\n https://www.shellcheck.net/wiki/SC" . l:error['code'], \ 'detail': l:error['message'] . "\n\nFor more information:\n https://www.shellcheck.net/wiki/SC" . l:error['code'],
\} \}
@@ -119,6 +107,7 @@ function! s:HandleShellcheckJSON(buffer, lines) abort
let l:item.end_lnum = l:error['endLine'] let l:item.end_lnum = l:error['endLine']
endif endif
" If the filename is something like <stdin>, <nofile> or -, then " If the filename is something like <stdin>, <nofile> or -, then
" this is an error for the file we checked. " this is an error for the file we checked.
if has_key(l:error, 'file') if has_key(l:error, 'file')
@@ -146,17 +135,11 @@ function! s:HandleShellcheckGCC(buffer, lines) abort
let l:type = 'W' let l:type = 'W'
endif endif
let l:code = l:match[6]
if s:ShouldIgnoreErrorCode(a:buffer, l:code)
continue
endif
let l:item = { let l:item = {
\ 'lnum': str2nr(l:match[2]), \ 'lnum': str2nr(l:match[2]),
\ 'type': l:type, \ 'type': l:type,
\ 'text': l:match[5], \ 'text': l:match[5],
\ 'code': l:code, \ 'code': l:match[6],
\ 'detail': l:match[5] . "\n\nFor more information:\n https://www.shellcheck.net/wiki/" . l:match[6], \ 'detail': l:match[5] . "\n\nFor more information:\n https://www.shellcheck.net/wiki/" . l:match[6],
\} \}

View File

@@ -11,7 +11,6 @@ let s:linters = {}
" NOTE: Update the g:ale_linter_aliases documentation when modifying this. " NOTE: Update the g:ale_linter_aliases documentation when modifying this.
let s:default_ale_linter_aliases = { let s:default_ale_linter_aliases = {
\ 'Dockerfile': 'dockerfile', \ 'Dockerfile': 'dockerfile',
\ 'bash': 'sh',
\ 'csh': 'sh', \ 'csh': 'sh',
\ 'javascriptreact': ['javascript', 'jsx'], \ 'javascriptreact': ['javascript', 'jsx'],
\ 'plaintex': 'tex', \ 'plaintex': 'tex',

View File

@@ -531,7 +531,7 @@ function! ale#lsp#StartProgram(conn_id, executable, command) abort
if g:ale_use_neovim_lsp_api && !l:conn.is_tsserver if g:ale_use_neovim_lsp_api && !l:conn.is_tsserver
" For Windows from 'cmd /s/c "foo bar"' we need 'foo bar' " For Windows from 'cmd /s/c "foo bar"' we need 'foo bar'
let l:lsp_cmd = has('win32') && type(a:command) is v:t_string let l:lsp_cmd = has('win32') && type(a:command) is v:t_string
\ ? ['cmd', '/s/c', a:command[10:-2]] \ ? ['cmd', '/s/c/', a:command[10:-2]]
\ : a:command \ : a:command
" Always call lsp.start, which will either create or re-use a " Always call lsp.start, which will either create or re-use a
@@ -706,7 +706,7 @@ function! ale#lsp#Send(conn_id, message) abort
throw 'LSP server not initialized yet!' throw 'LSP server not initialized yet!'
endif endif
if g:ale_use_neovim_lsp_api && !l:conn.is_tsserver if g:ale_use_neovim_lsp_api
return luaeval('require("ale.lsp").send_message(_A)', { return luaeval('require("ale.lsp").send_message(_A)', {
\ 'client_id': l:conn.client_id, \ 'client_id': l:conn.client_id,
\ 'is_notification': a:message[0] == 1 ? v:true : v:false, \ 'is_notification': a:message[0] == 1 ? v:true : v:false,

View File

@@ -28,7 +28,7 @@ function! ale#lsp#response#ReadDiagnostics(diagnostics) abort
for l:diagnostic in a:diagnostics for l:diagnostic in a:diagnostics
let l:severity = get(l:diagnostic, 'severity', 0) let l:severity = get(l:diagnostic, 'severity', 0)
let l:loclist_item = { let l:loclist_item = {
\ 'text': l:diagnostic.message, \ 'text': substitute(l:diagnostic.message, '\(\r\n\|\n\|\r\)', ' ', 'g'),
\ 'type': 'E', \ 'type': 'E',
\ 'lnum': l:diagnostic.range.start.line + 1, \ 'lnum': l:diagnostic.range.start.line + 1,
\ 'col': l:diagnostic.range.start.character + 1, \ 'col': l:diagnostic.range.start.character + 1,

View File

@@ -62,36 +62,6 @@ function! ale#path#FindNearestDirectory(buffer, directory_name) abort
return '' return ''
endfunction endfunction
" Given a buffer and a filename, find the nearest file or directory by
" searching upwards through the paths relative to the given buffer.
function! ale#path#FindNearestFileOrDirectory(buffer, filename) abort
let l:buffer_filename = fnamemodify(bufname(a:buffer), ':p')
let l:buffer_filename = fnameescape(l:buffer_filename)
let l:relative_path_file = findfile(a:filename, l:buffer_filename . ';')
let l:relative_path_dir = finddir(a:filename, l:buffer_filename . ';')
" If we find both a file and directory, choose the shorter response by
" making the longer one empty instead.
if !empty(l:relative_path_file) && !empty(l:relative_path_dir)
if strlen(l:relative_path_file) > strlen(l:relative_path_dir)
let l:relative_path_dir = ''
else
let l:relative_path_file = ''
endif
endif
if !empty(l:relative_path_file)
return fnamemodify(l:relative_path_file, ':p')
endif
if !empty(l:relative_path_dir)
return fnamemodify(l:relative_path_dir, ':p')
endif
return ''
endfunction
" Given a buffer, a string to search for, and a global fallback for when " Given a buffer, a string to search for, and a global fallback for when
" the search fails, look for a file in parent paths, and if that fails, " the search fails, look for a file in parent paths, and if that fails,
" use the global fallback path instead. " use the global fallback path instead.
@@ -145,24 +115,20 @@ endfunction
" Return 1 if a path is an absolute path. " Return 1 if a path is an absolute path.
function! ale#path#IsAbsolute(filename) abort function! ale#path#IsAbsolute(filename) abort
if has('win32') if has('win32') && a:filename[:0] is# '\'
return a:filename[:0] =~# '[\\/]' || a:filename[0:2] =~? '[A-Z]:[/\\]' return 1
else
return a:filename[:0] is# '/'
endif endif
" Check for /foo and C:\foo, etc.
return a:filename[:0] is# '/' || a:filename[1:2] is# ':\'
endfunction endfunction
let s:temp_dir = ale#path#Simplify(fnamemodify(ale#util#Tempname(), ':h:h')) let s:temp_dir = ale#path#Simplify(fnamemodify(ale#util#Tempname(), ':h:h'))
let s:resolved_temp_dir = resolve(s:temp_dir)
" Given a filename, return 1 if the file represents some temporary file " Given a filename, return 1 if the file represents some temporary file
" created by Vim. If the temporary location is symlinked (e.g. macOS), some " created by Vim.
" linters may report the resolved version of the path, so both are checked.
function! ale#path#IsTempName(filename) abort function! ale#path#IsTempName(filename) abort
let l:filename = ale#path#Simplify(a:filename) return ale#path#Simplify(a:filename)[:len(s:temp_dir) - 1] is# s:temp_dir
return l:filename[:len(s:temp_dir) - 1] is# s:temp_dir
\|| l:filename[:len(s:resolved_temp_dir) - 1] is# s:resolved_temp_dir
endfunction endfunction
" Given a base directory, which must not have a trailing slash, and a " Given a base directory, which must not have a trailing slash, and a

View File

@@ -1,25 +0,0 @@
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

@@ -26,6 +26,7 @@ function! ale#python#FindProjectRootIni(buffer) abort
" If you change this, update ale-python-root documentation. " If you change this, update ale-python-root documentation.
if filereadable(l:path . '/MANIFEST.in') if filereadable(l:path . '/MANIFEST.in')
\|| filereadable(l:path . '/setup.cfg') \|| filereadable(l:path . '/setup.cfg')
\|| filereadable(l:path . '/pytest.ini')
\|| filereadable(l:path . '/tox.ini') \|| filereadable(l:path . '/tox.ini')
\|| filereadable(l:path . '/.pyre_configuration.local') \|| filereadable(l:path . '/.pyre_configuration.local')
\|| filereadable(l:path . '/mypy.ini') \|| filereadable(l:path . '/mypy.ini')
@@ -54,12 +55,11 @@ endfunction
" Given a buffer number, find the project root directory for Python. " Given a buffer number, find the project root directory for Python.
" The root directory is defined as the first directory found while searching " The root directory is defined as the first directory found while searching
" upwards through paths, including the current directory, until a path " upwards through paths, including the current directory, until a path
" containing an configuration file is found. (See list above) " containing an init file (one from MANIFEST.in, setup.cfg, pytest.ini,
" " tox.ini) is found. If it is not possible to find the project root directory
" If it is not possible to find the project root directory via configuration " via init file, then it will be defined as the first directory found
" file, then it will be defined as the first directory found searching upwards " searching upwards through paths, including the current directory, until no
" through paths, including the current directory, until no __init__.py files " __init__.py files is found.
" is found.
function! ale#python#FindProjectRoot(buffer) abort function! ale#python#FindProjectRoot(buffer) abort
let l:ini_root = ale#python#FindProjectRootIni(a:buffer) let l:ini_root = ale#python#FindProjectRootIni(a:buffer)
@@ -200,7 +200,7 @@ function! ale#python#PoetryPresent(buffer) abort
return findfile('poetry.lock', expand('#' . a:buffer . ':p:h') . ';') isnot# '' return findfile('poetry.lock', expand('#' . a:buffer . ':p:h') . ';') isnot# ''
endfunction endfunction
" Detects whether a uv environment is present. " Detects whether a poetry environment is present.
function! ale#python#UvPresent(buffer) abort function! ale#python#UvPresent(buffer) abort
return findfile('uv.lock', expand('#' . a:buffer . ':p:h') . ';') isnot# '' return findfile('uv.lock', expand('#' . a:buffer . ':p:h') . ';') isnot# ''
endfunction endfunction

View File

@@ -1,6 +1,4 @@
let g:ale_default_navigation = get(g:, 'ale_default_navigation', 'buffer') 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 = {} let s:references_map = {}
@@ -18,123 +16,101 @@ function! ale#references#ClearLSPData() abort
let s:references_map = {} let s:references_map = {}
endfunction endfunction
function! ale#references#FormatResponseItem(response_item, options) abort function! ale#references#FormatTSResponseItem(response_item, options) abort
let l:filename = get(a:response_item, 'filename', '') let l:match = substitute(a:response_item.lineText, '^\s*\(.\{-}\)\s*$', '\1', '')
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' if get(a:options, 'open_in') is# 'quickfix'
return { return {
\ 'filename': l:filename, \ 'filename': a:response_item.file,
\ 'lnum': l:line, \ 'lnum': a:response_item.start.line,
\ 'col': l:column, \ 'col': a:response_item.start.offset,
\ 'text': l:line_text, \ 'text': l:match,
\} \}
else else
return { return {
\ 'filename': l:filename, \ 'filename': a:response_item.file,
\ 'line': l:line, \ 'line': a:response_item.start.line,
\ 'column': l:column, \ 'column': a:response_item.start.offset,
\ 'match': l:line_text, \ 'match': l:match,
\} \}
endif endif
endfunction 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 function! ale#references#HandleTSServerResponse(conn_id, response) abort
if get(a:response, 'command', '') is# 'references' if get(a:response, 'command', '') is# 'references'
\&& has_key(s:references_map, a:response.request_seq) \&& has_key(s:references_map, a:response.request_seq)
let l:options = remove(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 if get(a:response, 'success', v:false) is v:true
let l:item_list = [] let l:item_list = []
for l:response_item in a:response.body.refs 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( call add(
\ l:item_list, \ l:item_list,
\ ale#references#FormatResponseItem(l:format_response_item, l:format_options) \ ale#references#FormatTSResponseItem(l:response_item, l:options)
\) \)
endfor endfor
call ale#references#DisplayReferences(l:item_list, l:format_options) 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
endif endif
endif endif
endfunction endfunction
function! ale#references#FormatLSPResponseItem(response_item, options) abort
if get(a:options, 'open_in') is# 'quickfix'
return {
\ 'filename': ale#util#ToResource(a:response_item.uri),
\ 'lnum': a:response_item.range.start.line + 1,
\ 'col': a:response_item.range.start.character + 1,
\}
else
return {
\ 'filename': ale#util#ToResource(a:response_item.uri),
\ 'line': a:response_item.range.start.line + 1,
\ 'column': a:response_item.range.start.character + 1,
\}
endif
endfunction
function! ale#references#HandleLSPResponse(conn_id, response) abort function! ale#references#HandleLSPResponse(conn_id, response) abort
if ! (has_key(a:response, 'id') && has_key(s:references_map, a:response.id)) if has_key(a:response, 'id')
return \&& 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
endif 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 endfunction
function! s:OnReady(line, column, options, linter, lsp_details) abort function! s:OnReady(line, column, options, linter, lsp_details) abort
@@ -171,8 +147,6 @@ function! s:OnReady(line, column, options, linter, lsp_details) abort
let s:references_map[l:request_id] = { let s:references_map[l:request_id] = {
\ 'use_relative_paths': has_key(a:options, 'use_relative_paths') ? a:options.use_relative_paths : 0, \ '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'), \ '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 endfunction
@@ -191,10 +165,6 @@ function! ale#references#Find(...) abort
let l:options.open_in = 'vsplit' let l:options.open_in = 'vsplit'
elseif l:option is? '-quickfix' elseif l:option is? '-quickfix'
let l:options.open_in = 'quickfix' 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 endif
endfor endfor
endif endif
@@ -207,10 +177,6 @@ function! ale#references#Find(...) abort
endif endif
endif endif
if !has_key(l:options, 'show_contents')
let l:options.show_contents = ale#Var(bufnr(''), 'references_show_contents')
endif
let l:buffer = bufnr('') let l:buffer = bufnr('')
let [l:line, l:column] = getpos('.')[1:2] let [l:line, l:column] = getpos('.')[1:2]
let l:column = min([l:column, len(getline(l:line))]) let l:column = min([l:column, len(getline(l:line))])

View File

@@ -44,39 +44,5 @@ g:ale_ansible_ansible_lint_executable
This variable can be changed to modify the executable used for ansible-lint. This variable can be changed to modify the executable used for ansible-lint.
*ale-options.ansible_ansible_lint_auto_pipenv*
*g:ale_ansible_ansible_lint_auto_pipenv*
*b:ale_ansible_ansible_lint_auto_pipenv*
ansible_ansible_lint_auto_pipenv
g:ale_ansible_ansible_lint_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.
*ale-options.ansible_ansible_lint_auto_poetry*
*g:ale_ansible_ansible_lint_auto_poetry*
*b:ale_ansible_ansible_lint_auto_poetry*
ansible_ansible_lint_auto_poetry
g:ale_ansible_ansible_lint_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.
*ale-options.ansible_ansible_lint_auto_uv*
*g:ale_ansible_ansible_lint_auto_uv*
*b:ale_ansible_ansible_lint_auto_uv*
ansible_ansible_lint_auto_uv
g:ale_ansible_ansible_lint_auto_uv
Type: |Number|
Default: `0`
Set the executable to `uv` if true. This is overridden by a manually-set
executable.
=============================================================================== ===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View File

@@ -20,11 +20,5 @@ textlint *ale-asciidoc-textlint*
See |ale-text-textlint| See |ale-text-textlint|
===============================================================================
redpen *ale-asciidoc-redpen*
See |ale-redpen-options|
=============================================================================== ===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View File

@@ -1,32 +0,0 @@
===============================================================================
ALE BINDZone Integration *ale-bindzone-options*
===============================================================================
checkzone *ale-bindzone-checkzone*
*ale-options.bindzone_checkzone_executable*
*g:ale_bindzone_checkzone_executable*
*b:ale_bindzone_checkzone_executable*
bindzone_checkzone_executable
g:ale_bindzone_checkzone_executable
Type: |String|
Default: `named-checkzone`
This variable can be changed to set the path to named-checkzone executable.
*ale-options.bindzone_checkzone_options*
*g:ale_bindzone_checkzone_options*
*b:ale_bindzone_checkzone_options*
bindzone_checkzone_options
g:ale_bindzone_checkzone_options
Type: |String|
Default: `-c IN`
This variable can be changed to add additional command-line arguments.
All available options can be found at:
https://bind9.readthedocs.io/en/stable/manpages.html#named-checkzone-zone-file-validation-tool
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View File

@@ -26,7 +26,7 @@ g:ale_c_always_make
c_build_dir_names c_build_dir_names
g:ale_c_build_dir_names g:ale_c_build_dir_names
Type: |List| Type: |List|
Default: `['build', 'build/Debug', 'build/Release', 'bin']` Default: `['build', 'bin']`
A list of directory names to be used when searching upwards from C files A list of directory names to be used when searching upwards from C files
to discover compilation databases with. For directory named `'foo'`, ALE to discover compilation databases with. For directory named `'foo'`, ALE

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