pax_global_header00006660000000000000000000000064147650147220014522gustar00rootroot0000000000000052 comment=1c91102112ac5addbdbf178268c61a2ead64fb2a ale-4.0.0/000077500000000000000000000000001476501472200122645ustar00rootroot00000000000000ale-4.0.0/LICENSE000066400000000000000000000024311476501472200132710ustar00rootroot00000000000000Copyright (c) 2016-2023, Dense Analysis All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ale-4.0.0/ale_linters/000077500000000000000000000000001476501472200145655ustar00rootroot00000000000000ale-4.0.0/ale_linters/ada/000077500000000000000000000000001476501472200153125ustar00rootroot00000000000000ale-4.0.0/ale_linters/ada/adals.vim000066400000000000000000000016141476501472200171150ustar00rootroot00000000000000" Author: Bartek Jasicki http://github.com/thindil " Description: Support for Ada Language Server call ale#Set('ada_adals_executable', 'ada_language_server') call ale#Set('ada_adals_project', 'default.gpr') call ale#Set('ada_adals_encoding', 'utf-8') function! ale_linters#ada#adals#GetAdaLSConfig(buffer) abort return { \ 'ada.projectFile': ale#Var(a:buffer, 'ada_adals_project'), \ 'ada.defaultCharset': ale#Var(a:buffer, 'ada_adals_encoding') \} endfunction function! ale_linters#ada#adals#GetRootDirectory(buffer) abort return fnamemodify(bufname(a:buffer), ':p:h') endfunction call ale#linter#Define('ada', { \ 'name': 'adals', \ 'lsp': 'stdio', \ 'executable': {b -> ale#Var(b, 'ada_adals_executable')}, \ 'command': '%e', \ 'project_root': function('ale_linters#ada#adals#GetRootDirectory'), \ 'lsp_config': function('ale_linters#ada#adals#GetAdaLSConfig') \}) ale-4.0.0/ale_linters/ada/cspell.vim000066400000000000000000000002261476501472200173110ustar00rootroot00000000000000scriptencoding utf-8 " Author: David Houston " Description: cspell support for Ada files. call ale#handlers#cspell#DefineLinter('ada') ale-4.0.0/ale_linters/ada/gcc.vim000066400000000000000000000041001476501472200165560ustar00rootroot00000000000000" Author: Martino Pilia " Description: Lint Ada files with GCC call ale#Set('ada_gcc_executable', 'gcc') " -gnatwa: activate most optional warnings " -gnatq: try semantic analysis even if syntax errors have been found call ale#Set('ada_gcc_options', '-gnatwa -gnatq') function! ale_linters#ada#gcc#GetCommand(buffer) abort " Build a suitable output file name. The output file is specified because " the .ali file may be created even if no code generation is attempted. " The output file name must match the source file name (except for the " extension), so here we cannot use the null file as output. let l:tmp_dir = fnamemodify(ale#command#CreateDirectory(a:buffer), ':p') let l:out_file = l:tmp_dir . fnamemodify(bufname(a:buffer), ':t:r') . '.o' " -gnatc: Check syntax and semantics only (no code generation attempted) return '%e -x ada -c -gnatc' \ . ' -o ' . ale#Escape(l:out_file) \ . ' -I %s:h' \ . ale#Pad(ale#Var(a:buffer, 'ada_gcc_options')) \ . ' %t' endfunction " For the message format please refer to: " https://gcc.gnu.org/onlinedocs/gnat_ugn/Output-and-Error-Message-Control.html " https://gcc.gnu.org/onlinedocs/gnat_ugn/Warning-Message-Control.html function! ale_linters#ada#gcc#Handle(buffer, lines) abort " Error format: ::: " Warning format: ::: warning: let l:re = '\v(.+):([0-9]+):([0-9]+):\s+(warning:)?\s*(.+)\s*' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:re) call add(l:output, { \ 'bufnr': a:buffer, \ 'lnum': str2nr(l:match[2]), \ 'col': str2nr(l:match[3]), \ 'type': l:match[4] is# 'warning:' ? 'W' : 'E', \ 'text': l:match[5], \}) endfor return l:output endfunction call ale#linter#Define('ada', { \ 'name': 'gcc', \ 'output_stream': 'stderr', \ 'executable': {b -> ale#Var(b, 'ada_gcc_executable')}, \ 'command': function('ale_linters#ada#gcc#GetCommand'), \ 'callback': 'ale_linters#ada#gcc#Handle', \}) ale-4.0.0/ale_linters/ansible/000077500000000000000000000000001476501472200162025ustar00rootroot00000000000000ale-4.0.0/ale_linters/ansible/ansible_lint.vim000066400000000000000000000125751476501472200213740ustar00rootroot00000000000000" Authors: Bjorn Neergaard , Vytautas Macionis " Description: ansible-lint for ansible-yaml files call ale#Set('ansible_ansible_lint_executable', 'ansible-lint') function! ale_linters#ansible#ansible_lint#GetExecutable(buffer) abort return ale#Var(a:buffer, 'ansible_ansible_lint_executable') endfunction function! ale_linters#ansible#ansible_lint#Handle(buffer, version, lines) abort for l:line in a:lines[:10] if match(l:line, '^Traceback') >= 0 return [{ \ 'lnum': 1, \ 'text': 'An exception was thrown. See :ALEDetail', \ 'detail': join(a:lines, "\n"), \}] endif endfor let l:version_group = ale#semver#GTE(a:version, [6, 0, 0]) ? '>=6.0.0' : \ ale#semver#GTE(a:version, [5, 0, 0]) ? '>=5.0.0' : \ '<5.0.0' let l:output = [] if '>=6.0.0' is# l:version_group let l:error_codes = { 'blocker': 'E', 'critical': 'E', 'major': 'W', 'minor': 'W', 'info': 'I' } let l:linter_issues = ale#util#FuzzyJSONDecode(a:lines, []) for l:issue in l:linter_issues if ale#path#IsBufferPath(a:buffer, l:issue.location.path) if exists('l:issue.location.positions') let l:coord_keyname = 'positions' else let l:coord_keyname = 'lines' endif let l:column_member = printf( \ 'l:issue.location.%s.begin.column', l:coord_keyname \) call add(l:output, { \ 'lnum': exists(l:column_member) ? l:issue.location[l:coord_keyname].begin.line : \ l:issue.location[l:coord_keyname].begin, \ 'col': exists(l:column_member) ? l:issue.location[l:coord_keyname].begin.column : 0, \ 'text': l:issue.check_name, \ 'detail': l:issue.description, \ 'code': l:issue.severity, \ 'type': l:error_codes[l:issue.severity], \}) endif endfor endif if '>=5.0.0' is# l:version_group " Matches patterns line the following: " test.yml:3:148: syntax-check 'var' is not a valid attribute for a Play " roles/test/tasks/test.yml:8: [package-latest] [VERY_LOW] Package installs should not use latest " D:\test\tasks\test.yml:8: [package-latest] [VERY_LOW] package installs should not use latest let l:pattern = '\v^(%([a-zA-Z]:)?[^:]+):(\d+):%((\d+):)? %(\[([-[:alnum:]]+)\]) %(\[([_[:alnum:]]+)\]) (.*)$' let l:error_codes = { 'VERY_HIGH': 'E', 'HIGH': 'E', 'MEDIUM': 'W', 'LOW': 'W', 'VERY_LOW': 'W', 'INFO': 'I' } for l:match in ale#util#GetMatches(a:lines, l:pattern) if ale#path#IsBufferPath(a:buffer, l:match[1]) call add(l:output, { \ 'lnum': l:match[2] + 0, \ 'col': l:match[3] + 0, \ 'text': l:match[6], \ 'code': l:match[4], \ 'type': l:error_codes[l:match[5]], \}) endif endfor endif if '<5.0.0' is# l:version_group " Matches patterns line the following: " test.yml:35: [EANSIBLE0002] Trailing whitespace let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):?(\d+)?: \[?([[:alnum:]]+)\]? (.*)$' for l:match in ale#util#GetMatches(a:lines, l:pattern) let l:code = l:match[4] if l:code is# 'EANSIBLE0002' \&& !ale#Var(a:buffer, 'warn_about_trailing_whitespace') " Skip warnings for trailing whitespace if the option is off. continue endif if ale#path#IsBufferPath(a:buffer, l:match[1]) call add(l:output, { \ 'lnum': l:match[2] + 0, \ 'col': l:match[3] + 0, \ 'text': l:match[5], \ 'code': l:code, \ 'type': l:code[:0] is# 'E' ? 'E' : 'W', \}) endif endfor endif return l:output endfunction function! ale_linters#ansible#ansible_lint#GetCommand(buffer, version) abort let l:commands = { \ '>=6.0.0': '%e --nocolor -f json -x yaml %s', \ '>=5.0.0': '%e --nocolor --parseable-severity -x yaml %s', \ '<5.0.0': '%e --nocolor -p %t' \} let l:command = ale#semver#GTE(a:version, [6, 0]) ? l:commands['>=6.0.0'] : \ ale#semver#GTE(a:version, [5, 0]) ? l:commands['>=5.0.0'] : \ l:commands['<5.0.0'] return l:command endfunction call ale#linter#Define('ansible', { \ 'name': 'ansible_lint', \ 'aliases': ['ansible', 'ansible-lint'], \ 'executable': function('ale_linters#ansible#ansible_lint#GetExecutable'), \ 'command': {buffer -> ale#semver#RunWithVersionCheck( \ buffer, \ ale_linters#ansible#ansible_lint#GetExecutable(buffer), \ '%e --version', \ function('ale_linters#ansible#ansible_lint#GetCommand'), \ )}, \ 'lint_file': 1, \ 'callback': {buffer, lines -> ale#semver#RunWithVersionCheck( \ buffer, \ ale_linters#ansible#ansible_lint#GetExecutable(buffer), \ '%e --version', \ {buffer, version -> ale_linters#ansible#ansible_lint#Handle( \ buffer, \ l:version, \ lines)}, \ )}, \}) ale-4.0.0/ale_linters/ansible/language_server.vim000066400000000000000000000030741476501472200220740ustar00rootroot00000000000000" Author: Horacio Sanson " Description: Support ansible language server https://github.com/ansible/ansible-language-server/ call ale#Set('ansible_language_server_executable', 'ansible-language-server') call ale#Set('ansible_language_server_config', {}) function! ale_linters#ansible#language_server#Executable(buffer) abort return ale#Var(a:buffer, 'ansible_language_server_executable') endfunction function! ale_linters#ansible#language_server#GetCommand(buffer) abort let l:executable = ale_linters#ansible#language_server#Executable(a:buffer) return ale#Escape(l:executable) . ' --stdio' endfunction function! ale_linters#ansible#language_server#FindProjectRoot(buffer) abort let l:dir = fnamemodify( \ ale#path#FindNearestFile(a:buffer, 'ansible.cfg'), \ ':h' \) if l:dir isnot# '.' && isdirectory(l:dir) return l:dir endif let l:dir = fnamemodify( \ ale#path#FindNearestDirectory(a:buffer, '.git'), \ ':h:h' \) if l:dir isnot# '.' && isdirectory(l:dir) return l:dir endif return '' endfunction call ale#linter#Define('ansible', { \ 'name': 'language_server', \ 'aliases': ['ansible_language_server', 'ansible-language-server'], \ 'lsp': 'stdio', \ 'executable': function('ale_linters#ansible#language_server#Executable'), \ 'command': function('ale_linters#ansible#language_server#GetCommand'), \ 'project_root': function('ale_linters#ansible#language_server#FindProjectRoot'), \ 'lsp_config': {b -> ale#Var(b, 'ansible_language_server_config')} \}) ale-4.0.0/ale_linters/apiblueprint/000077500000000000000000000000001476501472200172635ustar00rootroot00000000000000ale-4.0.0/ale_linters/apiblueprint/drafter.vim000066400000000000000000000030431476501472200214270ustar00rootroot00000000000000" Author: nametake https://nametake.github.io " Description: apiblueprint parser function! ale_linters#apiblueprint#drafter#HandleErrors(buffer, lines) abort " Matches patterns line the following: " " warning: (3) unable to parse response signature, expected 'response [] [()]'; line 4, column 3k - line 4, column 22 " warning: (10) message-body asset is expected to be a pre-formatted code block, separate it by a newline and indent every of its line by 12 spaces or 3 tabs; line 30, column 5 - line 30, column 9; line 31, column 9 - line 31, column 14; line 32, column 9 - line 32, column 14 let l:pattern = '\(^.*\): (\d\+) \(.\{-\}\); line \(\d\+\), column \(\d\+\) - line \d\+, column \d\+\(.*; line \d\+, column \d\+ - line \(\d\+\), column \(\d\+\)\)\{-\}$' let l:output = [] for l:match in ale#util#GetMatches(a:lines[2:], l:pattern) let l:item = { \ 'type': l:match[1] is# 'warning' ? 'W' : 'E', \ 'text': l:match[2], \ 'lnum': l:match[3] + 0, \ 'col': l:match[4] + 0, \} if l:match[5] isnot# '' let l:item.end_lnum = l:match[6] + 0 let l:item.end_col = l:match[7] + 0 endif call add(l:output, l:item) endfor return l:output endfunction call ale#linter#Define('apiblueprint', { \ 'name': 'drafter', \ 'output_stream': 'stderr', \ 'executable': 'drafter', \ 'command': 'drafter --use-line-num --validate', \ 'callback': 'ale_linters#apiblueprint#drafter#HandleErrors', \}) ale-4.0.0/ale_linters/apkbuild/000077500000000000000000000000001476501472200163605ustar00rootroot00000000000000ale-4.0.0/ale_linters/apkbuild/apkbuild_lint.vim000066400000000000000000000006411476501472200217170ustar00rootroot00000000000000" Author: Leo " Description: apkbuild-lint from atools linter for APKBUILDs call ale#Set('apkbuild_apkbuild_lint_executable', 'apkbuild-lint') call ale#linter#Define('apkbuild', { \ 'name': 'apkbuild_lint', \ 'output_stream': 'stdout', \ 'executable': {b -> ale#Var(b, 'apkbuild_apkbuild_lint_executable')}, \ 'command': '%e %t', \ 'callback': 'ale#handlers#atools#Handle', \}) ale-4.0.0/ale_linters/apkbuild/secfixes_check.vim000066400000000000000000000006461476501472200220510ustar00rootroot00000000000000" Author: Leo " Description: secfixes-check from atools linter for APKBUILDs call ale#Set('apkbuild_secfixes_check_executable', 'secfixes-check') call ale#linter#Define('apkbuild', { \ 'name': 'secfixes_check', \ 'output_stream': 'stdout', \ 'executable': {b -> ale#Var(b, 'apkbuild_secfixes_check_executable')}, \ 'command': '%e %t', \ 'callback': 'ale#handlers#atools#Handle', \}) ale-4.0.0/ale_linters/asciidoc/000077500000000000000000000000001476501472200163435ustar00rootroot00000000000000ale-4.0.0/ale_linters/asciidoc/alex.vim000066400000000000000000000002231476501472200200060ustar00rootroot00000000000000" Author: Johannes Wienke " Description: alex for asciidoc files call ale#handlers#alex#DefineLinter('asciidoc', '--text') ale-4.0.0/ale_linters/asciidoc/cspell.vim000066400000000000000000000002401476501472200203360ustar00rootroot00000000000000scriptencoding utf-8 " Author: David Houston " Description: cspell support for ASCIIDoc files. call ale#handlers#cspell#DefineLinter('asciidoc') ale-4.0.0/ale_linters/asciidoc/languagetool.vim000066400000000000000000000002631476501472200215420ustar00rootroot00000000000000" Author: Horacio Sanson (hsanson [ät] gmail.com) " Description: languagetool for asciidoc files, copied from markdown. call ale#handlers#languagetool#DefineLinter('asciidoc') ale-4.0.0/ale_linters/asciidoc/proselint.vim000066400000000000000000000004311476501472200210750ustar00rootroot00000000000000" Author: Daniel M. Capella https://github.com/polyzen " Description: proselint for AsciiDoc files call ale#linter#Define('asciidoc', { \ 'name': 'proselint', \ 'executable': 'proselint', \ 'command': 'proselint %t', \ 'callback': 'ale#handlers#unix#HandleAsWarning', \}) ale-4.0.0/ale_linters/asciidoc/redpen.vim000066400000000000000000000004541476501472200203400ustar00rootroot00000000000000" Author: rhysd https://rhysd.github.io " Description: Redpen, a proofreading tool (http://redpen.cc) call ale#linter#Define('asciidoc', { \ 'name': 'redpen', \ 'executable': 'redpen', \ 'command': 'redpen -f asciidoc -r json %t', \ 'callback': 'ale#handlers#redpen#HandleRedpenOutput', \}) ale-4.0.0/ale_linters/asciidoc/textlint.vim000066400000000000000000000005311476501472200207320ustar00rootroot00000000000000" Author: TANIGUCHI Masaya " Description: textlint for AsciiDoc files call ale#linter#Define('asciidoc', { \ 'name': 'textlint', \ 'executable': function('ale#handlers#textlint#GetExecutable'), \ 'command': function('ale#handlers#textlint#GetCommand'), \ 'callback': 'ale#handlers#textlint#HandleTextlintOutput', \}) ale-4.0.0/ale_linters/asciidoc/vale.vim000066400000000000000000000004341476501472200200100ustar00rootroot00000000000000" Author: Jeff Kreeftmeijer https://github.com/jeffkreeftmeijer " Description: vale for AsciiDoc files call ale#linter#Define('asciidoc', { \ 'name': 'vale', \ 'executable': 'vale', \ 'command': 'vale --output=line %t', \ 'callback': 'ale#handlers#unix#HandleAsWarning', \}) ale-4.0.0/ale_linters/asciidoc/writegood.vim000066400000000000000000000002251476501472200210620ustar00rootroot00000000000000" Author: Sumner Evans " Description: write-good for AsciiDoc files call ale#handlers#writegood#DefineLinter('asciidoc') ale-4.0.0/ale_linters/asm/000077500000000000000000000000001476501472200153455ustar00rootroot00000000000000ale-4.0.0/ale_linters/asm/gcc.vim000066400000000000000000000022041476501472200166140ustar00rootroot00000000000000" Author: Lucas Kolstad " Description: gcc linter for asm files call ale#Set('asm_gcc_executable', 'gcc') call ale#Set('asm_gcc_options', '-Wall') function! ale_linters#asm#gcc#GetCommand(buffer) abort " `-o /dev/null` or `-o null` is needed to catch all errors, " -fsyntax-only doesn't catch everything. return '%e -x assembler' \ . ' -o ' . g:ale#util#nul_file \ . '-iquote %s:h' \ . ' ' . ale#Var(a:buffer, 'asm_gcc_options') . ' -' endfunction function! ale_linters#asm#gcc#Handle(buffer, lines) abort let l:pattern = '^.\+:\(\d\+\): \([^:]\+\): \(.\+\)$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) call add(l:output, { \ 'lnum': l:match[1] + 0, \ 'type': l:match[2] =~? 'error' ? 'E' : 'W', \ 'text': l:match[3], \}) endfor return l:output endfunction call ale#linter#Define('asm', { \ 'name': 'gcc', \ 'output_stream': 'stderr', \ 'executable': {b -> ale#Var(b, 'asm_gcc_executable')}, \ 'command': function('ale_linters#asm#gcc#GetCommand'), \ 'callback': 'ale_linters#asm#gcc#Handle', \}) ale-4.0.0/ale_linters/asm/llvm_mc.vim000066400000000000000000000021411476501472200175110ustar00rootroot00000000000000" Author: uidops " Description: llvm-mc linter for asm files call ale#Set('asm_llvm_mc_executable', 'llvm-mc') call ale#Set('asm_llvm_mc_options', '') function! ale_linters#asm#llvm_mc#GetCommand(buffer) abort return '%e --assemble' \ . ' --filetype=asm' \ . ' -o ' . g:ale#util#nul_file \ . ' ' . ale#Var(a:buffer, 'asm_llvm_mc_options') endfunction function! ale_linters#asm#llvm_mc#Handle(buffer, lines) abort let l:pattern = '^.\+:\(\d\+\):\(\d\+\): \([^:]\+\): \(.\+\)$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) call add(l:output, { \ 'lnum': l:match[1] + 0, \ 'col': l:match[2] + 0, \ 'type': l:match[3] =~? 'error' ? 'E' : 'W', \ 'text': l:match[4], \}) endfor return l:output endfunction call ale#linter#Define('asm', { \ 'name': 'llvm_mc', \ 'output_stream': 'stderr', \ 'executable': {b -> ale#Var(b, 'asm_llvm_mc_executable')}, \ 'command': function('ale_linters#asm#llvm_mc#GetCommand'), \ 'callback': 'ale_linters#asm#llvm_mc#Handle', \}) ale-4.0.0/ale_linters/astro/000077500000000000000000000000001476501472200157155ustar00rootroot00000000000000ale-4.0.0/ale_linters/astro/eslint.vim000066400000000000000000000006221476501472200177300ustar00rootroot00000000000000" Author: Hyuksang Kwon " Description: eslint for astro files call ale#linter#Define('astro', { \ 'name': 'eslint', \ 'output_stream': 'both', \ 'executable': function('ale#handlers#eslint#GetExecutable'), \ 'cwd': function('ale#handlers#eslint#GetCwd'), \ 'command': function('ale#handlers#eslint#GetCommand'), \ 'callback': 'ale#handlers#eslint#HandleJSON', \}) ale-4.0.0/ale_linters/avra/000077500000000000000000000000001476501472200155165ustar00rootroot00000000000000ale-4.0.0/ale_linters/avra/avra.vim000066400000000000000000000021161476501472200171640ustar00rootroot00000000000000" Author: Utkarsh Verma " Description: AVRA linter for avra syntax. call ale#Set('avra_avra_executable', 'avra') call ale#Set('avra_avra_options', '') function! ale_linters#avra#avra#GetCommand(buffer) abort return '%e' \ . ' %t' \ . ale#Pad(ale#Var(a:buffer, 'avra_avra_options')) \ . ' -o ' . g:ale#util#nul_file endfunction function! ale_linters#avra#avra#Handle(buffer, lines) abort " Note that we treat 'fatal' as errors. let l:pattern = '^\S\+(\(\d\+\))\s\+:\s\+\(\S\+\)\s\+:\s\+\(.\+\)$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) call add(l:output, { \ 'lnum': l:match[1] + 0, \ 'type': l:match[2] =~? 'Error' ? 'E' : 'W', \ 'text': l:match[3], \}) endfor return l:output endfunction call ale#linter#Define('avra', { \ 'name': 'avra', \ 'output_stream': 'stderr', \ 'executable': {b -> ale#Var(b, 'avra_avra_executable')}, \ 'command': function('ale_linters#avra#avra#GetCommand'), \ 'callback': 'ale_linters#avra#avra#Handle', \}) ale-4.0.0/ale_linters/awk/000077500000000000000000000000001476501472200153475ustar00rootroot00000000000000ale-4.0.0/ale_linters/awk/gawk.vim000066400000000000000000000015001476501472200170110ustar00rootroot00000000000000" Author: kmarc " Description: This file adds support for using GNU awk with scripts. call ale#Set('awk_gawk_executable', 'gawk') call ale#Set('awk_gawk_options', '') function! ale_linters#awk#gawk#GetCommand(buffer) abort " note the --source 'BEGIN ...' is to prevent " gawk from attempting to execute the body of the script " it is linting. return '%e --source ' . ale#Escape('BEGIN { exit } END { exit 1 }') \ . ' --lint' \ . ale#Pad(ale#Var(a:buffer, 'awk_gawk_options')) \ . ' -f %t /dev/null' endfunction call ale#linter#Define('awk', { \ 'name': 'gawk', \ 'executable': {b -> ale#Var(b, 'awk_gawk_executable')}, \ 'command': function('ale_linters#awk#gawk#GetCommand'), \ 'callback': 'ale#handlers#gawk#HandleGawkFormat', \ 'output_stream': 'both' \}) ale-4.0.0/ale_linters/bats/000077500000000000000000000000001476501472200155165ustar00rootroot00000000000000ale-4.0.0/ale_linters/bats/shellcheck.vim000066400000000000000000000002251476501472200203370ustar00rootroot00000000000000" Author: Ian2020 " Description: shellcheck linter for bats scripts. call ale#handlers#shellcheck#DefineLinter('bats') ale-4.0.0/ale_linters/bib/000077500000000000000000000000001476501472200153215ustar00rootroot00000000000000ale-4.0.0/ale_linters/bib/bibclean.vim000066400000000000000000000046711476501472200176050ustar00rootroot00000000000000" Author: Horacio Sanson - https://github.com/hsanson " Description: Support for bibclean linter for BibTeX files. call ale#Set('bib_bibclean_executable', 'bibclean') function! ale_linters#bib#bibclean#GetCommand(buffer) abort let l:executable = ale#Var(a:buffer, 'bib_bibclean_executable') return ale#Escape(l:executable) . ' -file-position ' endfunction function! ale_linters#bib#bibclean#get_type(str) abort if a:str is# '??' return 'E' else return 'W' endif endfunction function! ale_linters#bib#bibclean#match_msg(line) abort " Legacy message pattern works for bibclean <= v2.11.4. If empty, try " the new message pattern for bibtex > v2.11.4 let l:matches_legacy = matchlist(a:line, '^\(.*\) "stdin", line \(\d\+\): \(.*\)$') return ! empty(l:matches_legacy) ? l:matches_legacy \ : matchlist(a:line, '^\(.*\) stdin:\(\d\+\):\(.*\)$') endfunction function! ale_linters#bib#bibclean#match_entry(line) abort return matchlist(a:line, 'Entry input byte=.* line=\(.*\) column=\(.*\) output .*$') endfunction function! ale_linters#bib#bibclean#match_value(line) abort return matchlist(a:line, 'Value input byte=.* line=\(.*\) column=\(.*\) output .*$') endfunction function! ale_linters#bib#bibclean#Handle(buffer, lines) abort let l:output = [] let l:type = 'E' let l:msg = '' for l:line in a:lines if empty(l:msg) let l:mlist = ale_linters#bib#bibclean#match_msg(l:line) if !empty(l:mlist) let l:msg = l:mlist[3] let l:type = ale_linters#bib#bibclean#get_type(l:mlist[1]) endif else if l:type is# 'E' let l:mlist = ale_linters#bib#bibclean#match_entry(l:line) else let l:mlist = ale_linters#bib#bibclean#match_value(l:line) endif if !empty(l:mlist) call add(l:output, { \ 'lnum': l:mlist[1], \ 'col': l:mlist[2], \ 'text': l:msg, \ 'type': l:type \}) let l:msg = '' endif endif endfor return l:output endfunction call ale#linter#Define('bib', { \ 'name': 'bibclean', \ 'executable': {b -> ale#Var(b, 'bib_bibclean_executable')}, \ 'command': function('ale_linters#bib#bibclean#GetCommand'), \ 'output_stream': 'stderr', \ 'callback': 'ale_linters#bib#bibclean#Handle', \}) ale-4.0.0/ale_linters/bicep/000077500000000000000000000000001476501472200156475ustar00rootroot00000000000000ale-4.0.0/ale_linters/bicep/az_bicep.vim000066400000000000000000000037551476501472200201520ustar00rootroot00000000000000" Author: Carl Smedstad " Description: az_bicep for bicep files let g:ale_bicep_az_bicep_executable = \ get(g:, 'ale_bicep_az_bicep_executable', 'az') let g:ale_bicep_az_bicep_options = \ get(g:, 'ale_bicep_az_bicep_options', '') function! ale_linters#bicep#az_bicep#Executable(buffer) abort return ale#Var(a:buffer, 'bicep_az_bicep_executable') endfunction function! ale_linters#bicep#az_bicep#Command(buffer) abort let l:executable = ale_linters#bicep#az_bicep#Executable(a:buffer) let l:options = ale#Var(a:buffer, 'bicep_az_bicep_options') if has('win32') let l:nullfile = 'NUL' else let l:nullfile = '/dev/null' endif return ale#Escape(l:executable) \ . ' bicep build --outfile ' \ . l:nullfile \ . ' --file ' \ . '%s ' \ . l:options endfunction function! ale_linters#bicep#az_bicep#Handle(buffer, lines) abort let l:pattern = '\v^([A-Z]+)?(:\s)?(.*)\((\d+),(\d+)\)\s:\s([a-zA-Z]*)\s([-a-zA-Z0-9]*):\s(.*)' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) if l:match[1] is# 'ERROR' let l:type = 'E' elseif l:match[1] is# 'WARNING' let l:type = 'W' elseif l:match[6] is# 'Error' let l:type = 'E' elseif l:match[6] is# 'Warning' let l:type = 'W' else let l:type = 'I' endif call add(l:output, { \ 'filename': l:match[3], \ 'lnum': l:match[4] + 0, \ 'col': l:match[5] + 0, \ 'type': l:type, \ 'code': l:match[7], \ 'text': l:match[8], \}) endfor return l:output endfunction call ale#linter#Define('bicep', { \ 'name': 'az_bicep', \ 'executable': function('ale_linters#bicep#az_bicep#Executable'), \ 'command': function('ale_linters#bicep#az_bicep#Command'), \ 'callback': 'ale_linters#bicep#az_bicep#Handle', \ 'output_stream': 'stderr', \ 'lint_file': 1, \}) ale-4.0.0/ale_linters/bicep/bicep.vim000066400000000000000000000034351476501472200174530ustar00rootroot00000000000000" Author: Carl Smedstad " Description: bicep for bicep files let g:ale_bicep_bicep_executable = \ get(g:, 'ale_bicep_bicep_executable', 'bicep') let g:ale_bicep_bicep_options = \ get(g:, 'ale_bicep_bicep_options', '') function! ale_linters#bicep#bicep#Executable(buffer) abort return ale#Var(a:buffer, 'bicep_bicep_executable') endfunction function! ale_linters#bicep#bicep#Command(buffer) abort let l:executable = ale_linters#bicep#bicep#Executable(a:buffer) let l:options = ale#Var(a:buffer, 'bicep_bicep_options') if has('win32') let l:nullfile = 'NUL' else let l:nullfile = '/dev/null' endif return ale#Escape(l:executable) \ . ' build --outfile ' \ . l:nullfile \ . ' ' \ . l:options \ . ' %s' endfunction function! ale_linters#bicep#bicep#Handle(buffer, lines) abort let l:pattern = '\v^(.*)\((\d+),(\d+)\)\s:\s([a-zA-Z]*)\s([-a-zA-Z0-9]*):\s(.*)' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) if l:match[4] is# 'Error' let l:type = 'E' elseif l:match[4] is# 'Warning' let l:type = 'W' else let l:type = 'I' endif call add(l:output, { \ 'filename': l:match[1], \ 'lnum': l:match[2] + 0, \ 'col': l:match[3] + 0, \ 'type': l:type, \ 'code': l:match[5], \ 'text': l:match[6], \}) endfor return l:output endfunction call ale#linter#Define('bicep', { \ 'name': 'bicep', \ 'executable': function('ale_linters#bicep#bicep#Executable'), \ 'command': function('ale_linters#bicep#bicep#Command'), \ 'callback': 'ale_linters#bicep#bicep#Handle', \ 'output_stream': 'both', \ 'lint_file': 1, \}) ale-4.0.0/ale_linters/bitbake/000077500000000000000000000000001476501472200161665ustar00rootroot00000000000000ale-4.0.0/ale_linters/bitbake/oelint_adv.vim000066400000000000000000000030601476501472200210260ustar00rootroot00000000000000" Author: offa " Description: oelint-adv for BitBake files call ale#Set('bitbake_oelint_adv_executable', 'oelint-adv') call ale#Set('bitbake_oelint_adv_options', '') call ale#Set('bitbake_oelint_adv_config', '.oelint.cfg') function! ale_linters#bitbake#oelint_adv#Command(buffer) abort let l:config_file = ale#path#FindNearestFile(a:buffer, \ ale#Var(a:buffer, 'bitbake_oelint_adv_config')) return ((!empty(l:config_file)) \ ? 'OELINT_CONFIG=' . ale#Escape(l:config_file) . ' ' \ : '') \ . '%e --quiet ' \ . ale#Pad(ale#Var(a:buffer, 'bitbake_oelint_adv_options')) . '%s' endfunction function! ale_linters#bitbake#oelint_adv#Handle(buffer, lines) abort let l:pattern = '\v^(.+):(.+):(.+):(.+):(.+)$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) call add(l:output, { \ 'lnum': str2nr(l:match[2]), \ 'type': l:match[3] is# 'error' \ ? 'E' : (l:match[3] is# 'warning' ? 'W' : 'I'), \ 'text': StripAnsiCodes(l:match[5]), \ 'code': l:match[4] \ }) endfor return l:output endfunction function! StripAnsiCodes(line) abort return substitute(a:line, '\e\[[0-9;]\+[mK]', '', 'g') endfunction call ale#linter#Define('bitbake', { \ 'name': 'oelint_adv', \ 'output_stream': 'both', \ 'executable': {b -> ale#Var(b, 'bitbake_oelint_adv_executable')}, \ 'cwd': '%s:h', \ 'command': function('ale_linters#bitbake#oelint_adv#Command'), \ 'callback': 'ale_linters#bitbake#oelint_adv#Handle', \ }) ale-4.0.0/ale_linters/bzl/000077500000000000000000000000001476501472200153545ustar00rootroot00000000000000ale-4.0.0/ale_linters/bzl/buildifier.vim000066400000000000000000000024671476501472200202200ustar00rootroot00000000000000" Author: Chuck Grindel " Description: Bazel Starlark lint support using buildifier. function! ale_linters#bzl#buildifier#GetCommand(buffer) abort let l:executable = ale#Escape(ale#fixers#buildifier#GetExecutable(a:buffer)) let l:options = ale#Var(a:buffer, 'bazel_buildifier_options') let l:filename = ale#Escape(bufname(a:buffer)) let l:command = l:executable . ' -mode check -lint warn -path %s' if l:options isnot# '' let l:command .= ' ' . l:options endif return l:command endfunction function! ale_linters#bzl#buildifier#Handle(buffer, lines) abort let l:pattern = '\v^[^:]+:(\d+):(\d+)?:?\s+(syntax error near)?(.+)$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) call add(l:output, { \ 'lnum': l:match[1] + 0, \ 'col': l:match[2] + 0, \ 'text': l:match[3] . l:match[4], \ 'type': l:match[3] is# 'syntax error near' ? 'E' : 'W', \}) endfor return l:output endfunction call ale#linter#Define('bzl', { \ 'name': 'buildifier', \ 'output_stream': 'both', \ 'executable': function('ale#fixers#buildifier#GetExecutable'), \ 'command': function('ale_linters#bzl#buildifier#GetCommand'), \ 'callback': function('ale_linters#bzl#buildifier#Handle'), \}) ale-4.0.0/ale_linters/c/000077500000000000000000000000001476501472200150075ustar00rootroot00000000000000ale-4.0.0/ale_linters/c/cc.vim000066400000000000000000000042531476501472200161150ustar00rootroot00000000000000" Author: w0rp " Description: A C compiler linter for C files with gcc/clang, etc. call ale#Set('c_cc_executable', '') call ale#Set('c_cc_options', '-std=c11 -Wall') call ale#Set('c_cc_use_header_lang_flag', -1) call ale#Set('c_cc_header_exts', ['h']) function! ale_linters#c#cc#GetExecutable(buffer) abort let l:executable = ale#Var(a:buffer, 'c_cc_executable') " Default to either clang or gcc. if l:executable is# '' if ale#engine#IsExecutable(a:buffer, 'clang') let l:executable = 'clang' else let l:executable = 'gcc' endif endif return l:executable endfunction function! ale_linters#c#cc#GetCommand(buffer, output) abort let l:cflags = ale#c#GetCFlags(a:buffer, a:output) let l:ale_flags = ale#Var(a:buffer, 'c_cc_options') if l:cflags =~# '-std=' let l:ale_flags = substitute( \ l:ale_flags, \ '-std=\(c\|gnu\)[0-9]\{2\}', \ '', \ 'g') endif " Select the correct language flag depending on the executable, options " and file extension let l:executable = ale_linters#c#cc#GetExecutable(a:buffer) let l:use_header_lang_flag = ale#Var(a:buffer, 'c_cc_use_header_lang_flag') let l:header_exts = ale#Var(a:buffer, 'c_cc_header_exts') let l:lang_flag = ale#c#GetLanguageFlag( \ a:buffer, \ l:executable, \ l:use_header_lang_flag, \ l:header_exts, \ 'c') " -iquote with the directory the file is in makes #include work for " headers in the same directory. " " `-o /dev/null` or `-o null` is needed to catch all errors, " -fsyntax-only doesn't catch everything. return '%e -S -x ' . l:lang_flag \ . ' -o ' . g:ale#util#nul_file \ . ' -iquote %s:h' \ . ale#Pad(l:cflags) \ . ale#Pad(l:ale_flags) . ' -' endfunction call ale#linter#Define('c', { \ 'name': 'cc', \ 'aliases': ['gcc', 'clang'], \ 'output_stream': 'stderr', \ 'executable': function('ale_linters#c#cc#GetExecutable'), \ 'command': {b -> ale#c#RunMakeCommand(b, function('ale_linters#c#cc#GetCommand'))}, \ 'callback': 'ale#handlers#gcc#HandleGCCFormatWithIncludes', \}) ale-4.0.0/ale_linters/c/ccls.vim000066400000000000000000000011141476501472200164450ustar00rootroot00000000000000" Author: Ye Jingchen , Ben Falconer , jtalowell " Description: A language server for C call ale#Set('c_ccls_executable', 'ccls') call ale#Set('c_ccls_init_options', {}) call ale#Set('c_build_dir', '') call ale#linter#Define('c', { \ 'name': 'ccls', \ 'lsp': 'stdio', \ 'executable': {b -> ale#Var(b, 'c_ccls_executable')}, \ 'command': '%e', \ 'project_root': function('ale#handlers#ccls#GetProjectRoot'), \ 'initialization_options': {b -> ale#handlers#ccls#GetInitOpts(b, 'c_ccls_init_options')}, \}) ale-4.0.0/ale_linters/c/clangcheck.vim000066400000000000000000000027471476501472200176200ustar00rootroot00000000000000" Author: gagbo " : luibo " : Jorengarenar " Description: clang-check linter for C files " modified from cpp/clangcheck.vim to match for C call ale#Set('c_clangcheck_executable', 'clang-check') call ale#Set('c_clangcheck_options', '') call ale#Set('c_build_dir', '') function! ale_linters#c#clangcheck#GetCommand(buffer) abort let l:user_options = ale#Var(a:buffer, 'c_clangcheck_options') " Try to find compilation database to link automatically let l:build_dir = ale#Var(a:buffer, 'c_build_dir') if empty(l:build_dir) let [l:root, l:json_file] = ale#c#FindCompileCommands(a:buffer) let l:build_dir = ale#path#Dirname(l:json_file) endif " The extra arguments in the command are used to prevent .plist files from " being generated. These are only added if no build directory can be " detected. return '%e -analyze %s' \ . (empty(l:build_dir) ? ' --extra-arg=-Xclang --extra-arg=-analyzer-output=text --extra-arg=-fno-color-diagnostics': '') \ . ale#Pad(l:user_options) \ . (!empty(l:build_dir) ? ' -p ' . ale#Escape(l:build_dir) : '') endfunction call ale#linter#Define('c', { \ 'name': 'clangcheck', \ 'output_stream': 'stderr', \ 'executable': {b -> ale#Var(b, 'c_clangcheck_executable')}, \ 'command': function('ale_linters#c#clangcheck#GetCommand'), \ 'callback': 'ale#handlers#gcc#HandleGCCFormat', \ 'lint_file': 1, \}) ale-4.0.0/ale_linters/c/clangd.vim000066400000000000000000000013671476501472200167630ustar00rootroot00000000000000" Author: Andrey Melentyev " Description: Clangd language server call ale#Set('c_clangd_executable', 'clangd') call ale#Set('c_clangd_options', '') call ale#Set('c_build_dir', '') function! ale_linters#c#clangd#GetCommand(buffer) abort let l:build_dir = ale#c#GetBuildDirectory(a:buffer) return '%e' \ . ale#Pad(ale#Var(a:buffer, 'c_clangd_options')) \ . (!empty(l:build_dir) ? ' -compile-commands-dir=' . ale#Escape(l:build_dir) : '') endfunction call ale#linter#Define('c', { \ 'name': 'clangd', \ 'lsp': 'stdio', \ 'executable': {b -> ale#Var(b, 'c_clangd_executable')}, \ 'command': function('ale_linters#c#clangd#GetCommand'), \ 'project_root': function('ale#c#FindProjectRoot'), \}) ale-4.0.0/ale_linters/c/clangtidy.vim000066400000000000000000000041451476501472200175060ustar00rootroot00000000000000" Author: vdeurzen , w0rp , " gagbo , Andrej Radovic " Description: clang-tidy linter for c files call ale#Set('c_clangtidy_executable', 'clang-tidy') " Set this option to check the checks clang-tidy will apply. " The number of checks that can be applied to C files is limited in contrast to " C++ " " Consult the check list in clang-tidy's documentation: " http://clang.llvm.org/extra/clang-tidy/checks/list.html call ale#Set('c_clangtidy_checks', []) " Set this option to manually set some options for clang-tidy to use as compile " flags. " This will disable compile_commands.json detection. call ale#Set('c_clangtidy_options', '') " Set this option to manually set options for clang-tidy directly. call ale#Set('c_clangtidy_extra_options', '') call ale#Set('c_build_dir', '') function! ale_linters#c#clangtidy#GetCommand(buffer, output) abort let l:checks = join(ale#Var(a:buffer, 'c_clangtidy_checks'), ',') let l:build_dir = ale#c#GetBuildDirectory(a:buffer) let l:options = '' " Get the extra options if we couldn't find a build directory. if empty(l:build_dir) let l:options = ale#Var(a:buffer, 'c_clangtidy_options') let l:cflags = ale#c#GetCFlags(a:buffer, a:output) let l:options .= !empty(l:options) ? ale#Pad(l:cflags) : l:cflags endif " Get the options to pass directly to clang-tidy let l:extra_options = ale#Var(a:buffer, 'c_clangtidy_extra_options') return '%e' \ . (!empty(l:checks) ? ' -checks=' . ale#Escape(l:checks) : '') \ . (!empty(l:extra_options) ? ' ' . ale#Escape(l:extra_options) : '') \ . ' %s' \ . (!empty(l:build_dir) ? ' -p ' . ale#Escape(l:build_dir) : '') \ . (!empty(l:options) ? ' -- ' . l:options : '') endfunction call ale#linter#Define('c', { \ 'name': 'clangtidy', \ 'output_stream': 'stdout', \ 'executable': {b -> ale#Var(b, 'c_clangtidy_executable')}, \ 'command': {b -> ale#c#RunMakeCommand(b, function('ale_linters#c#clangtidy#GetCommand'))}, \ 'callback': 'ale#handlers#gcc#HandleGCCFormat', \ 'lint_file': 1, \}) ale-4.0.0/ale_linters/c/cppcheck.vim000066400000000000000000000022351476501472200173060ustar00rootroot00000000000000" Author: Bart Libert " Description: cppcheck linter for c files call ale#Set('c_cppcheck_executable', 'cppcheck') call ale#Set('c_cppcheck_options', '--enable=style') function! ale_linters#c#cppcheck#GetCommand(buffer) abort let l:compile_commands_option = ale#handlers#cppcheck#GetCompileCommandsOptions(a:buffer) let l:buffer_path_include = empty(l:compile_commands_option) \ ? ale#handlers#cppcheck#GetBufferPathIncludeOptions(a:buffer) \ : '' let l:template = ' --template=' . ale#Escape('{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}') return '%e -q --language=c' \ . l:template \ . ale#Pad(l:compile_commands_option) \ . ale#Pad(ale#Var(a:buffer, 'c_cppcheck_options')) \ . l:buffer_path_include \ . ' %t' endfunction call ale#linter#Define('c', { \ 'name': 'cppcheck', \ 'output_stream': 'both', \ 'executable': {b -> ale#Var(b, 'c_cppcheck_executable')}, \ 'cwd': function('ale#handlers#cppcheck#GetCwd'), \ 'command': function('ale_linters#c#cppcheck#GetCommand'), \ 'callback': 'ale#handlers#cppcheck#HandleCppCheckFormat', \}) ale-4.0.0/ale_linters/c/cpplint.vim000066400000000000000000000011751476501472200172010ustar00rootroot00000000000000" Author: Justin Huang " Description: cpplint for c files call ale#Set('c_cpplint_executable', 'cpplint') call ale#Set('c_cpplint_options', '') function! ale_linters#c#cpplint#GetCommand(buffer) abort let l:options = ale#Var(a:buffer, 'c_cpplint_options') return '%e' . ale#Pad(l:options) . ' %s' endfunction call ale#linter#Define('c', { \ 'name': 'cpplint', \ 'output_stream': 'stderr', \ 'executable': {b -> ale#Var(b, 'c_cpplint_executable')}, \ 'command': function('ale_linters#c#cpplint#GetCommand'), \ 'callback': 'ale#handlers#cpplint#HandleCppLintFormat', \ 'lint_file': 1, \}) ale-4.0.0/ale_linters/c/cquery.vim000066400000000000000000000020641476501472200170360ustar00rootroot00000000000000" Author: Ben Falconer , jtalowell " Description: A language server for C call ale#Set('c_cquery_executable', 'cquery') call ale#Set('c_cquery_cache_directory', expand('~/.cache/cquery')) function! ale_linters#c#cquery#GetProjectRoot(buffer) abort " Try to find cquery configuration files first. let l:config = ale#path#FindNearestFile(a:buffer, '.cquery') if !empty(l:config) return fnamemodify(l:config, ':h') endif " Fall back on default project root detection. return ale#c#FindProjectRoot(a:buffer) endfunction function! ale_linters#c#cquery#GetInitializationOptions(buffer) abort return {'cacheDirectory': ale#Var(a:buffer, 'c_cquery_cache_directory')} endfunction call ale#linter#Define('c', { \ 'name': 'cquery', \ 'lsp': 'stdio', \ 'executable': {b -> ale#Var(b, 'c_cquery_executable')}, \ 'command': '%e', \ 'project_root': function('ale_linters#c#cquery#GetProjectRoot'), \ 'initialization_options': function('ale_linters#c#cquery#GetInitializationOptions'), \}) ale-4.0.0/ale_linters/c/cspell.vim000066400000000000000000000002221476501472200170020ustar00rootroot00000000000000scriptencoding utf-8 " Author: David Houston " Description: cspell support for C files. call ale#handlers#cspell#DefineLinter('c') ale-4.0.0/ale_linters/c/flawfinder.vim000066400000000000000000000016051476501472200176470ustar00rootroot00000000000000" Author: Christian Gibbons " Description: flawfinder linter for c files call ale#Set('c_flawfinder_executable', 'flawfinder') call ale#Set('c_flawfinder_options', '') call ale#Set('c_flawfinder_minlevel', 1) call ale#Set('c_flawfinder_error_severity', 6) function! ale_linters#c#flawfinder#GetCommand(buffer) abort " Set the minimum vulnerability level for flawfinder to bother with let l:minlevel = ' --minlevel=' . ale#Var(a:buffer, 'c_flawfinder_minlevel') return '%e -CDQS' \ . ale#Pad(ale#Var(a:buffer, 'c_flawfinder_options')) \ . l:minlevel \ . ' %t' endfunction call ale#linter#Define('c', { \ 'name': 'flawfinder', \ 'output_stream': 'stdout', \ 'executable': {b -> ale#Var(b, 'c_flawfinder_executable')}, \ 'command': function('ale_linters#c#flawfinder#GetCommand'), \ 'callback': 'ale#handlers#flawfinder#HandleFlawfinderFormat', \}) ale-4.0.0/ale_linters/c3/000077500000000000000000000000001476501472200150725ustar00rootroot00000000000000ale-4.0.0/ale_linters/c3/c3lsp.vim000066400000000000000000000014311476501472200166320ustar00rootroot00000000000000" Author: Koni Marti " Description: A Language Server implementation for C3 call ale#Set('c3_c3lsp_executable', 'c3lsp') call ale#Set('c3_c3lsp_options', '') call ale#Set('c3_c3lsp_init_options', {}) function! ale_linters#c3#c3lsp#GetCommand(buffer) abort let l:executable = ale#Var(a:buffer, 'c3_c3lsp_executable') return ale#Escape(l:executable) . ale#Pad(ale#Var(a:buffer, 'c3_c3lsp_options')) endfunction call ale#linter#Define('c3', { \ 'name': 'c3lsp', \ 'lsp': 'stdio', \ 'executable': {b -> ale#Var(b, 'c3_c3lsp_executable')}, \ 'command': function('ale_linters#c3#c3lsp#GetCommand'), \ 'project_root': function('ale#handlers#c3lsp#GetProjectRoot'), \ 'lsp_config': {b -> ale#handlers#c3lsp#GetInitOpts(b, 'c3_c3lsp_init_options')}, \}) ale-4.0.0/ale_linters/cairo/000077500000000000000000000000001476501472200156625ustar00rootroot00000000000000ale-4.0.0/ale_linters/cairo/scarb.vim000066400000000000000000000017501476501472200174740ustar00rootroot00000000000000" Author: 0xhyoga <0xhyoga@gmx.com>, " Description: scarb for cairo files function! ale_linters#cairo#scarb#GetScarbExecutable(bufnr) abort if ale#path#FindNearestFile(a:bufnr, 'Scarb.toml') isnot# '' return 'scarb' else " if there is no Scarb.toml file, we don't use scarb even if it exists, " so we return '', because executable('') apparently always fails return '' endif endfunction function! ale_linters#cairo#scarb#GetCommand(buffer, version) abort return 'scarb build' endfunction call ale#linter#Define('cairo', { \ 'name': 'scarb', \ 'executable': function('ale_linters#cairo#scarb#GetScarbExecutable'), \ 'command': {buffer -> ale#semver#RunWithVersionCheck( \ buffer, \ ale_linters#cairo#scarb#GetScarbExecutable(buffer), \ '%e --version', \ function('ale_linters#cairo#scarb#GetCommand'), \ )}, \ 'callback': 'ale#handlers#cairo#HandleCairoErrors', \ 'output_stream': 'both', \ 'lint_file': 1, \}) ale-4.0.0/ale_linters/cairo/sierra.vim000066400000000000000000000033151476501472200176660ustar00rootroot00000000000000" Author: 0xHyoga <0xHyoga@gmx.com> " Description: Report Starknet compile to sierra errors in cairo 1.0 code call ale#Set('cairo_sierra_executable', 'starknet-compile') call ale#Set('cairo_sierra_options', '') function! ale_linters#cairo#sierra#Handle(buffer, lines) abort " Matches patterns like the following: " Error: Expected ';' but got '(' " --> /path/to/file/file.cairo:1:10:) let l:pattern = '\v(error|warning): (.*)$' let l:line_and_column_pattern = '\v\.cairo:(\d+):(\d+)' let l:output = [] for l:line in a:lines let l:match = matchlist(l:line, l:pattern) if len(l:match) == 0 let l:match = matchlist(l:line, l:line_and_column_pattern) if len(l:match) > 0 let l:index = len(l:output) - 1 let l:output[l:index]['lnum'] = l:match[1] + 0 let l:output[l:index]['col'] = l:match[2] + 0 endif else let l:isError = l:match[1] is? 'Error' call add(l:output, { \ 'lnum': 0, \ 'col': 0, \ 'text': l:match[2], \ 'type': l:isError ? 'E' : 'W', \}) endif endfor return l:output endfunction function! ale_linters#cairo#sierra#GetCommand(buffer) abort let l:executable = ale#Var(a:buffer, 'cairo_sierra_executable') return l:executable . ale#Pad(ale#Var(a:buffer, 'cairo_sierra_options')) . ' %s' endfunction call ale#linter#Define('cairo', { \ 'name': 'sierra', \ 'executable': {b -> ale#Var(b, 'cairo_sierra_executable')}, \ 'command': function('ale_linters#cairo#sierra#GetCommand'), \ 'callback': 'ale_linters#cairo#sierra#Handle', \ 'output_stream': 'stderr', \}) ale-4.0.0/ale_linters/cairo/starknet.vim000066400000000000000000000025221476501472200202330ustar00rootroot00000000000000" Author: 0xHyoga <0xHyoga@gmx.com> " Description: Report starknet-compile errors in cairo code (pre-starknet " 1.0). This is deprecated but kept for backwards compatability. call ale#Set('cairo_starknet_executable', 'starknet-compile') call ale#Set('cairo_starknet_options', '') function! ale_linters#cairo#starknet#Handle(buffer, lines) abort " Error always on the first line " e.g ex01.cairo:20:6: Could not find module 'contracts.utils.ex00_base'. Searched in the following paths: let l:pattern = '\v\.cairo:(\d+):(\d+):+ (.*)' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) call add(l:output, { \ 'lnum': str2nr(l:match[1]), \ 'col': str2nr(l:match[2]), \ 'type': 'E', \ 'text': l:match[3], \}) endfor return l:output endfunction function! ale_linters#cairo#starknet#GetCommand(buffer) abort let l:executable = ale#Var(a:buffer, 'cairo_starknet_executable') return l:executable . ale#Pad(ale#Var(a:buffer, 'cairo_starknet_options')) . ' %s' endfunction call ale#linter#Define('cairo', { \ 'name': 'starknet', \ 'executable': {b -> ale#Var(b, 'cairo_starknet_executable')}, \ 'command': function('ale_linters#cairo#starknet#GetCommand'), \ 'callback': 'ale_linters#cairo#starknet#Handle', \ 'output_stream': 'stderr', \}) ale-4.0.0/ale_linters/chef/000077500000000000000000000000001476501472200154725ustar00rootroot00000000000000ale-4.0.0/ale_linters/chef/cookstyle.vim000066400000000000000000000032551476501472200202300ustar00rootroot00000000000000" Author: Raphael Hoegger - https://github.com/pfuender " Description: Cookstyle (RuboCop based), a code style analyzer for Ruby files call ale#Set('chef_cookstyle_executable', 'cookstyle') call ale#Set('chef_cookstyle_options', '') function! ale_linters#chef#cookstyle#GetCommand(buffer) abort let l:options = ale#Var(a:buffer, 'chef_cookstyle_options') return '%e' . ale#Pad(escape(l:options, '~')) . ' --force-exclusion --format json --stdin ' . ' %s' endfunction function! ale_linters#chef#cookstyle#Handle(buffer, lines) abort if len(a:lines) == 0 return [] endif let l:errors = ale#util#FuzzyJSONDecode(a:lines[0], {}) if !has_key(l:errors, 'summary') \|| l:errors['summary']['offense_count'] == 0 \|| empty(l:errors['files']) return [] endif let l:output = [] for l:error in l:errors['files'][0]['offenses'] let l:start_col = str2nr(l:error['location']['start_column']) let l:end_col = str2nr(l:error['location']['last_column']) if !l:end_col let l:end_col = l:start_col + 1 endif call add(l:output, { \ 'lnum': str2nr(l:error['location']['line']), \ 'col': l:start_col, \ 'end_col': l:end_col, \ 'code': l:error['cop_name'], \ 'text': l:error['message'], \ 'type': l:error['severity'] is? 'convention' ? 'W' : 'E', \}) endfor return l:output endfunction call ale#linter#Define('chef', { \ 'name': 'cookstyle', \ 'executable': {b -> ale#Var(b, 'chef_cookstyle_executable')}, \ 'command': function('ale_linters#chef#cookstyle#GetCommand'), \ 'callback': 'ale_linters#chef#cookstyle#Handle', \}) ale-4.0.0/ale_linters/chef/foodcritic.vim000066400000000000000000000025041476501472200203350ustar00rootroot00000000000000" Author: Edward Larkey " Author: Jose Junior " Author: w0rp " Description: This file adds the foodcritic linter for Chef files. call ale#Set('chef_foodcritic_executable', 'foodcritic') call ale#Set('chef_foodcritic_options', '') function! ale_linters#chef#foodcritic#GetCommand(buffer) abort let l:options = ale#Var(a:buffer, 'chef_foodcritic_options') return '%e' . ale#Pad(escape(l:options, '~')) . ' %s' endfunction function! ale_linters#chef#foodcritic#Handle(buffer, lines) abort " Matches patterns line the following: " " FC002: Avoid string interpolation where not required: httpd.rb:13 let l:pattern = '\v([^:]+): (.+): ([a-zA-Z]?:?[^:]+):(\d+)$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) call add(l:output, { \ 'code': l:match[1], \ 'text': l:match[2], \ 'filename': l:match[3], \ 'lnum': l:match[4] + 0, \ 'type': 'W', \}) endfor return l:output endfunction call ale#linter#Define('chef', { \ 'name': 'foodcritic', \ 'executable': {b -> ale#Var(b, 'chef_foodcritic_executable')}, \ 'command': function('ale_linters#chef#foodcritic#GetCommand'), \ 'callback': 'ale_linters#chef#foodcritic#Handle', \ 'lint_file': 1, \}) ale-4.0.0/ale_linters/clojure/000077500000000000000000000000001476501472200162305ustar00rootroot00000000000000ale-4.0.0/ale_linters/clojure/clj_kondo.vim000066400000000000000000000025621476501472200207140ustar00rootroot00000000000000" Author: Masashi Iizuka " Description: linter for clojure using clj-kondo https://github.com/borkdude/clj-kondo call ale#Set('clojure_clj_kondo_options', '--cache') function! ale_linters#clojure#clj_kondo#GetCommand(buffer) abort let l:options = ale#Var(a:buffer, 'clojure_clj_kondo_options') let l:command = 'clj-kondo' \ . ale#Pad(l:options) \ . ' --lint -' \ . ' --filename %s' return l:command endfunction function! ale_linters#clojure#clj_kondo#HandleCljKondoFormat(buffer, lines) abort " output format " ::: : let l:pattern = '\v^[a-zA-Z]?:?[^:]+:(\d+)?:(\d+)?:? ((Exception|error|warning): ?(.+))$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) let l:type = 'E' if l:match[4] is? 'warning' let l:type = 'W' endif call add(l:output, { \ 'lnum': l:match[1] + 0, \ 'col': l:match[2] + 0, \ 'text': l:match[3], \ 'type': l:type, \}) endfor return l:output endfunction call ale#linter#Define('clojure', { \ 'name': 'clj-kondo', \ 'output_stream': 'stdout', \ 'executable': 'clj-kondo', \ 'command': function('ale_linters#clojure#clj_kondo#GetCommand'), \ 'callback': 'ale_linters#clojure#clj_kondo#HandleCljKondoFormat', \}) ale-4.0.0/ale_linters/clojure/joker.vim000066400000000000000000000020121476501472200200520ustar00rootroot00000000000000" Author: Nic West " Description: linter for clojure using joker https://github.com/candid82/joker function! ale_linters#clojure#joker#HandleJokerFormat(buffer, lines) abort " output format " ::: : let l:pattern = '\v^[a-zA-Z]?:?[^:]+:(\d+):(\d+):? ((Read error|Parse error|Parse warning|Exception): ?(.+))$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) let l:type = 'E' if l:match[4] is? 'Parse warning' let l:type = 'W' endif call add(l:output, { \ 'lnum': l:match[1] + 0, \ 'col': l:match[2] + 0, \ 'text': l:match[3], \ 'type': l:type, \}) endfor return l:output endfunction call ale#linter#Define('clojure', { \ 'name': 'joker', \ 'output_stream': 'stderr', \ 'executable': 'joker', \ 'command': 'joker --working-dir %s --lint %t', \ 'callback': 'ale_linters#clojure#joker#HandleJokerFormat', \}) ale-4.0.0/ale_linters/cloudformation/000077500000000000000000000000001476501472200176125ustar00rootroot00000000000000ale-4.0.0/ale_linters/cloudformation/cfn_python_lint.vim000066400000000000000000000023641476501472200235310ustar00rootroot00000000000000" Author: Yasuhiro Kiyota " Description: Support cfn-python-lint for AWS Cloudformation template file function! ale_linters#cloudformation#cfn_python_lint#Handle(buffer, lines) abort " Matches patterns line the following: " " sample.template.yaml:96:7:96:15:E3012:Property Resources/Sample/Properties/FromPort should be of type Integer let l:pattern = '\v^(.*):(\d+):(\d+):(\d+):(\d+):([[:alnum:]]+):(.*)$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) let l:code = l:match[6] if ale#path#IsBufferPath(a:buffer, l:match[1]) call add(l:output, { \ 'lnum': l:match[2], \ 'col': l:match[3], \ 'end_lnum': l:match[4], \ 'end_col': l:match[5], \ 'code': l:code, \ 'type': l:code[:0] is# 'E' ? 'E' : 'W', \ 'text': l:match[7] \}) endif endfor return l:output endfunction call ale#linter#Define('cloudformation', { \ 'name': 'cloudformation', \ 'aliases': ['cfn-lint'], \ 'executable': 'cfn-lint', \ 'command': 'cfn-lint --template %t --format parseable', \ 'callback': 'ale_linters#cloudformation#cfn_python_lint#Handle', \}) ale-4.0.0/ale_linters/cmake/000077500000000000000000000000001476501472200156455ustar00rootroot00000000000000ale-4.0.0/ale_linters/cmake/cmake_lint.vim000066400000000000000000000026211476501472200204710ustar00rootroot00000000000000" Author: Carl Smedstad " Description: cmake-lint for cmake files let g:ale_cmake_cmake_lint_executable = \ get(g:, 'ale_cmake_cmake_lint_executable', 'cmake-lint') let g:ale_cmake_cmake_lint_options = \ get(g:, 'ale_cmake_cmake_lint_options', '') function! ale_linters#cmake#cmake_lint#Executable(buffer) abort return ale#Var(a:buffer, 'cmake_cmake_lint_executable') endfunction function! ale_linters#cmake#cmake_lint#Command(buffer) abort let l:executable = ale_linters#cmake#cmake_lint#Executable(a:buffer) let l:options = ale#Var(a:buffer, 'cmake_cmake_lint_options') return ale#Escape(l:executable) . ' ' . l:options . ' %s' endfunction function! ale_linters#cmake#cmake_lint#Handle(buffer, lines) abort let l:pattern = '\v^[^:]+:(\d+),?(\d+)?:\s\[([A-Z]\d+)\]\s(.+)$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) call add(l:output, { \ 'lnum': l:match[1] + 0, \ 'col': l:match[2] + 0, \ 'type': 'W', \ 'code': l:match[3], \ 'text': l:match[4], \}) endfor return l:output endfunction call ale#linter#Define('cmake', { \ 'name': 'cmake_lint', \ 'executable': function('ale_linters#cmake#cmake_lint#Executable'), \ 'command': function('ale_linters#cmake#cmake_lint#Command'), \ 'callback': 'ale_linters#cmake#cmake_lint#Handle', \}) ale-4.0.0/ale_linters/cmake/cmakelint.vim000066400000000000000000000015341476501472200203340ustar00rootroot00000000000000" Author: Kenneth Benzie " Description: cmakelint for cmake files let g:ale_cmake_cmakelint_executable = \ get(g:, 'ale_cmake_cmakelint_executable', 'cmakelint') let g:ale_cmake_cmakelint_options = \ get(g:, 'ale_cmake_cmakelint_options', '') function! ale_linters#cmake#cmakelint#Executable(buffer) abort return ale#Var(a:buffer, 'cmake_cmakelint_executable') endfunction function! ale_linters#cmake#cmakelint#Command(buffer) abort return ale_linters#cmake#cmakelint#Executable(a:buffer) \ . ' ' . ale#Var(a:buffer, 'cmake_cmakelint_options') . ' %t' endfunction call ale#linter#Define('cmake', { \ 'name': 'cmakelint', \ 'executable': function('ale_linters#cmake#cmakelint#Executable'), \ 'command': function('ale_linters#cmake#cmakelint#Command'), \ 'callback': 'ale#handlers#unix#HandleAsWarning', \}) ale-4.0.0/ale_linters/coffee/000077500000000000000000000000001476501472200160145ustar00rootroot00000000000000ale-4.0.0/ale_linters/coffee/coffee.vim000066400000000000000000000013301476501472200177550ustar00rootroot00000000000000" Author: KabbAmine - https://github.com/KabbAmine " Description: Coffee for checking coffee files function! ale_linters#coffee#coffee#GetExecutable(buffer) abort return ale#path#ResolveLocalPath( \ a:buffer, \ 'node_modules/.bin/coffee', \ 'coffee' \) endfunction function! ale_linters#coffee#coffee#GetCommand(buffer) abort return ale_linters#coffee#coffee#GetExecutable(a:buffer) \ . ' -cp -s' endfunction call ale#linter#Define('coffee', { \ 'name': 'coffee', \ 'executable': function('ale_linters#coffee#coffee#GetExecutable'), \ 'command': function('ale_linters#coffee#coffee#GetCommand'), \ 'output_stream': 'stderr', \ 'callback': 'ale#handlers#gcc#HandleGCCFormat', \}) ale-4.0.0/ale_linters/coffee/coffeelint.vim000066400000000000000000000026121476501472200206500ustar00rootroot00000000000000" Author: Prashanth Chandra https://github.com/prashcr " Description: coffeelint linter for coffeescript files function! ale_linters#coffee#coffeelint#GetExecutable(buffer) abort return ale#path#ResolveLocalPath( \ a:buffer, \ 'node_modules/.bin/coffeelint', \ 'coffeelint' \) endfunction function! ale_linters#coffee#coffeelint#GetCommand(buffer) abort return ale_linters#coffee#coffeelint#GetExecutable(a:buffer) \ . ' --stdin --reporter csv' endfunction function! ale_linters#coffee#coffeelint#Handle(buffer, lines) abort " Matches patterns like the following: " " path,lineNumber,lineNumberEnd,level,message " stdin,14,,error,Throwing strings is forbidden " " Note that we currently ignore lineNumberEnd for multiline errors let l:pattern = 'stdin,\(\d\+\),\(\d*\),\(.\{-1,}\),\(.\+\)' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) call add(l:output, { \ 'lnum': str2nr(l:match[1]), \ 'type': l:match[3] is# 'error' ? 'E' : 'W', \ 'text': l:match[4], \}) endfor return l:output endfunction call ale#linter#Define('coffee', { \ 'name': 'coffeelint', \ 'executable': function('ale_linters#coffee#coffeelint#GetExecutable'), \ 'command': function('ale_linters#coffee#coffeelint#GetCommand'), \ 'callback': 'ale_linters#coffee#coffeelint#Handle', \}) ale-4.0.0/ale_linters/cpp/000077500000000000000000000000001476501472200153475ustar00rootroot00000000000000ale-4.0.0/ale_linters/cpp/cc.vim000066400000000000000000000043601476501472200164540ustar00rootroot00000000000000" Author: w0rp " Description: A C++ compiler linter for C++ files with gcc/clang, etc. call ale#Set('cpp_cc_executable', '') call ale#Set('cpp_cc_options', '-std=c++14 -Wall') call ale#Set('cpp_cc_use_header_lang_flag', -1) call ale#Set('cpp_cc_header_exts', ['h', 'hpp']) function! ale_linters#cpp#cc#GetExecutable(buffer) abort let l:executable = ale#Var(a:buffer, 'cpp_cc_executable') " Default to either clang++ or gcc. if l:executable is# '' if ale#engine#IsExecutable(a:buffer, 'clang++') let l:executable = 'clang++' else let l:executable = 'gcc' endif endif return l:executable endfunction function! ale_linters#cpp#cc#GetCommand(buffer, output) abort let l:cflags = ale#c#GetCFlags(a:buffer, a:output) let l:ale_flags = ale#Var(a:buffer, 'cpp_cc_options') if l:cflags =~# '-std=' let l:ale_flags = substitute( \ l:ale_flags, \ '-std=\(c\|gnu\)++[0-9]\{2\}', \ '', \ 'g') endif " Select the correct language flag depending on the executable, options " and file extension let l:executable = ale_linters#cpp#cc#GetExecutable(a:buffer) let l:use_header_lang_flag = ale#Var(a:buffer, 'cpp_cc_use_header_lang_flag') let l:header_exts = ale#Var(a:buffer, 'cpp_cc_header_exts') let l:lang_flag = ale#c#GetLanguageFlag( \ a:buffer, \ l:executable, \ l:use_header_lang_flag, \ l:header_exts, \ 'c++') " -iquote with the directory the file is in makes #include work for " headers in the same directory. " " `-o /dev/null` or `-o null` is needed to catch all errors, " -fsyntax-only doesn't catch everything. return '%e -S -x ' . l:lang_flag \ . ' -o ' . g:ale#util#nul_file \ . ' -iquote %s:h' \ . ale#Pad(l:cflags) \ . ale#Pad(l:ale_flags) . ' -' endfunction call ale#linter#Define('cpp', { \ 'name': 'cc', \ 'aliases': ['gcc', 'clang', 'g++', 'clang++'], \ 'output_stream': 'stderr', \ 'executable': function('ale_linters#cpp#cc#GetExecutable'), \ 'command': {b -> ale#c#RunMakeCommand(b, function('ale_linters#cpp#cc#GetCommand'))}, \ 'callback': 'ale#handlers#gcc#HandleGCCFormatWithIncludes', \}) ale-4.0.0/ale_linters/cpp/ccls.vim000066400000000000000000000011301476501472200170030ustar00rootroot00000000000000" Author: Ye Jingchen , Ben Falconer , jtalowell " Description: A language server for C++ call ale#Set('cpp_ccls_executable', 'ccls') call ale#Set('cpp_ccls_init_options', {}) call ale#Set('c_build_dir', '') call ale#linter#Define('cpp', { \ 'name': 'ccls', \ 'lsp': 'stdio', \ 'executable': {b -> ale#Var(b, 'cpp_ccls_executable')}, \ 'command': '%e', \ 'project_root': function('ale#handlers#ccls#GetProjectRoot'), \ 'initialization_options': {b -> ale#handlers#ccls#GetInitOpts(b, 'cpp_ccls_init_options')}, \}) ale-4.0.0/ale_linters/cpp/clangcheck.vim000066400000000000000000000025371476501472200201550ustar00rootroot00000000000000" Author: gagbo " Description: clang-check linter for cpp files call ale#Set('cpp_clangcheck_executable', 'clang-check') call ale#Set('cpp_clangcheck_options', '') call ale#Set('c_build_dir', '') function! ale_linters#cpp#clangcheck#GetCommand(buffer) abort let l:user_options = ale#Var(a:buffer, 'cpp_clangcheck_options') " Try to find compilation database to link automatically let l:build_dir = ale#Var(a:buffer, 'c_build_dir') if empty(l:build_dir) let [l:root, l:json_file] = ale#c#FindCompileCommands(a:buffer) let l:build_dir = ale#path#Dirname(l:json_file) endif " The extra arguments in the command are used to prevent .plist files from " being generated. These are only added if no build directory can be " detected. return '%e -analyze %s' \ . (empty(l:build_dir) ? ' --extra-arg=-Xclang --extra-arg=-analyzer-output=text --extra-arg=-fno-color-diagnostics': '') \ . ale#Pad(l:user_options) \ . (!empty(l:build_dir) ? ' -p ' . ale#Escape(l:build_dir) : '') endfunction call ale#linter#Define('cpp', { \ 'name': 'clangcheck', \ 'output_stream': 'stderr', \ 'executable': {b -> ale#Var(b, 'cpp_clangcheck_executable')}, \ 'command': function('ale_linters#cpp#clangcheck#GetCommand'), \ 'callback': 'ale#handlers#gcc#HandleGCCFormat', \ 'lint_file': 1, \}) ale-4.0.0/ale_linters/cpp/clangd.vim000066400000000000000000000014051476501472200173140ustar00rootroot00000000000000" Author: Andrey Melentyev " Description: Clangd language server call ale#Set('cpp_clangd_executable', 'clangd') call ale#Set('cpp_clangd_options', '') call ale#Set('c_build_dir', '') function! ale_linters#cpp#clangd#GetCommand(buffer) abort let l:build_dir = ale#c#GetBuildDirectory(a:buffer) return '%e' \ . ale#Pad(ale#Var(a:buffer, 'cpp_clangd_options')) \ . (!empty(l:build_dir) ? ' -compile-commands-dir=' . ale#Escape(l:build_dir) : '') endfunction call ale#linter#Define('cpp', { \ 'name': 'clangd', \ 'lsp': 'stdio', \ 'executable': {b -> ale#Var(b, 'cpp_clangd_executable')}, \ 'command': function('ale_linters#cpp#clangd#GetCommand'), \ 'project_root': function('ale#c#FindProjectRoot'), \}) ale-4.0.0/ale_linters/cpp/clangtidy.vim000066400000000000000000000043551476501472200200510ustar00rootroot00000000000000" Author: vdeurzen , w0rp , " gagbo " Description: clang-tidy linter for cpp files call ale#Set('cpp_clangtidy_executable', 'clang-tidy') " Set this option to check the checks clang-tidy will apply. call ale#Set('cpp_clangtidy_checks', []) " Set this option to manually set some options for clang-tidy to use as compile " flags. " This will disable compile_commands.json detection. call ale#Set('cpp_clangtidy_options', '') " Set this option to manually set options for clang-tidy directly. call ale#Set('cpp_clangtidy_extra_options', '') call ale#Set('c_build_dir', '') function! ale_linters#cpp#clangtidy#GetCommand(buffer, output) abort let l:checks = join(ale#Var(a:buffer, 'cpp_clangtidy_checks'), ',') let l:build_dir = ale#c#GetBuildDirectory(a:buffer) let l:options = '' " Get the extra options if we couldn't find a build directory. if empty(l:build_dir) let l:options = ale#Var(a:buffer, 'cpp_clangtidy_options') let l:cflags = ale#c#GetCFlags(a:buffer, a:output) let l:options .= !empty(l:options) ? ale#Pad(l:cflags) : l:cflags " Tell clang-tidy a .h header with a C++ filetype in Vim is a C++ file " only when compile-commands.json file is not there. Adding these " flags makes clang-tidy completely ignore compile commands. if expand('#' . a:buffer) =~# '\.h$' let l:options .= !empty(l:options) ? ' -x c++' : '-x c++' endif endif " Get the options to pass directly to clang-tidy let l:extra_options = ale#Var(a:buffer, 'cpp_clangtidy_extra_options') return '%e' \ . (!empty(l:checks) ? ' -checks=' . ale#Escape(l:checks) : '') \ . (!empty(l:extra_options) ? ' ' . ale#Escape(l:extra_options) : '') \ . ' %s' \ . (!empty(l:build_dir) ? ' -p ' . ale#Escape(l:build_dir) : '') \ . (!empty(l:options) ? ' -- ' . l:options : '') endfunction call ale#linter#Define('cpp', { \ 'name': 'clangtidy', \ 'output_stream': 'stdout', \ 'executable': {b -> ale#Var(b, 'cpp_clangtidy_executable')}, \ 'command': {b -> ale#c#RunMakeCommand(b, function('ale_linters#cpp#clangtidy#GetCommand'))}, \ 'callback': 'ale#handlers#gcc#HandleGCCFormat', \ 'lint_file': 1, \}) ale-4.0.0/ale_linters/cpp/clazy.vim000066400000000000000000000023351476501472200172110ustar00rootroot00000000000000" Description: clazy linter for cpp files (clang-based and Qt-oriented) call ale#Set('cpp_clazy_executable', 'clazy-standalone') " Set this option to check the checks clazy will apply. call ale#Set('cpp_clazy_checks', ['level1']) " Set this option to manually set some options for clazy. " This will disable compile_commands.json detection. call ale#Set('cpp_clazy_options', '') call ale#Set('c_build_dir', '') function! ale_linters#cpp#clazy#GetCommand(buffer) abort let l:checks = join(ale#Var(a:buffer, 'cpp_clazy_checks'), ',') let l:build_dir = ale#c#GetBuildDirectory(a:buffer) " Get the extra options if we couldn't find a build directory. let l:options = ale#Var(a:buffer, 'cpp_clazy_options') return '%e' \ . (!empty(l:checks) ? ' -checks=' . ale#Escape(l:checks) : '') \ . (!empty(l:build_dir) ? ' -p ' . ale#Escape(l:build_dir) : '') \ . (!empty(l:options) ? ' ' . l:options : '') \ . ' %s' endfunction call ale#linter#Define('cpp', { \ 'name': 'clazy', \ 'output_stream': 'stderr', \ 'executable': {b -> ale#Var(b, 'cpp_clazy_executable')}, \ 'command': function('ale_linters#cpp#clazy#GetCommand'), \ 'callback': 'ale#handlers#gcc#HandleGCCFormat', \ 'lint_file': 1, \}) ale-4.0.0/ale_linters/cpp/cppcheck.vim000066400000000000000000000022571476501472200176520ustar00rootroot00000000000000" Author: Bart Libert " Description: cppcheck linter for cpp files call ale#Set('cpp_cppcheck_executable', 'cppcheck') call ale#Set('cpp_cppcheck_options', '--enable=style') function! ale_linters#cpp#cppcheck#GetCommand(buffer) abort let l:compile_commands_option = ale#handlers#cppcheck#GetCompileCommandsOptions(a:buffer) let l:buffer_path_include = empty(l:compile_commands_option) \ ? ale#handlers#cppcheck#GetBufferPathIncludeOptions(a:buffer) \ : '' let l:template = ' --template=' . ale#Escape('{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}') return '%e -q --language=c++' \ . l:template \ . ale#Pad(l:compile_commands_option) \ . ale#Pad(ale#Var(a:buffer, 'cpp_cppcheck_options')) \ . l:buffer_path_include \ . ' %t' endfunction call ale#linter#Define('cpp', { \ 'name': 'cppcheck', \ 'output_stream': 'both', \ 'executable': {b -> ale#Var(b, 'cpp_cppcheck_executable')}, \ 'cwd': function('ale#handlers#cppcheck#GetCwd'), \ 'command': function('ale_linters#cpp#cppcheck#GetCommand'), \ 'callback': 'ale#handlers#cppcheck#HandleCppCheckFormat', \}) ale-4.0.0/ale_linters/cpp/cpplint.vim000066400000000000000000000012151476501472200175340ustar00rootroot00000000000000" Author: Dawid Kurek https://github.com/dawikur " Description: cpplint for cpp files call ale#Set('cpp_cpplint_executable', 'cpplint') call ale#Set('cpp_cpplint_options', '') function! ale_linters#cpp#cpplint#GetCommand(buffer) abort let l:options = ale#Var(a:buffer, 'cpp_cpplint_options') return '%e' . ale#Pad(l:options) . ' %s' endfunction call ale#linter#Define('cpp', { \ 'name': 'cpplint', \ 'output_stream': 'stderr', \ 'executable': {b -> ale#Var(b, 'cpp_cpplint_executable')}, \ 'command': function('ale_linters#cpp#cpplint#GetCommand'), \ 'callback': 'ale#handlers#cpplint#HandleCppLintFormat', \ 'lint_file': 1, \}) ale-4.0.0/ale_linters/cpp/cquery.vim000066400000000000000000000020421476501472200173720ustar00rootroot00000000000000" Author: Ben Falconer " Description: A language server for C++ call ale#Set('cpp_cquery_executable', 'cquery') call ale#Set('cpp_cquery_cache_directory', expand('~/.cache/cquery')) function! ale_linters#cpp#cquery#GetProjectRoot(buffer) abort " Try to find cquery configuration files first. let l:config = ale#path#FindNearestFile(a:buffer, '.cquery') if !empty(l:config) return fnamemodify(l:config, ':h') endif " Fall back on default project root detection. return ale#c#FindProjectRoot(a:buffer) endfunction function! ale_linters#cpp#cquery#GetInitializationOptions(buffer) abort return {'cacheDirectory': ale#Var(a:buffer, 'cpp_cquery_cache_directory')} endfunction call ale#linter#Define('cpp', { \ 'name': 'cquery', \ 'lsp': 'stdio', \ 'executable': {b -> ale#Var(b, 'cpp_cquery_executable')}, \ 'command': '%e', \ 'project_root': function('ale_linters#cpp#cquery#GetProjectRoot'), \ 'initialization_options': function('ale_linters#cpp#cquery#GetInitializationOptions'), \}) ale-4.0.0/ale_linters/cpp/cspell.vim000066400000000000000000000002261476501472200173460ustar00rootroot00000000000000scriptencoding utf-8 " Author: David Houston " Description: cspell support for C++ files. call ale#handlers#cspell#DefineLinter('cpp') ale-4.0.0/ale_linters/cpp/flawfinder.vim000066400000000000000000000016201476501472200202040ustar00rootroot00000000000000" Author: Christian Gibbons " Description: flawfinder linter for c++ files call ale#Set('cpp_flawfinder_executable', 'flawfinder') call ale#Set('cpp_flawfinder_options', '') call ale#Set('cpp_flawfinder_minlevel', 1) call ale#Set('c_flawfinder_error_severity', 6) function! ale_linters#cpp#flawfinder#GetCommand(buffer) abort " Set the minimum vulnerability level for flawfinder to bother with let l:minlevel = ' --minlevel=' . ale#Var(a:buffer, 'cpp_flawfinder_minlevel') return '%e -CDQS' \ . ale#Var(a:buffer, 'cpp_flawfinder_options') \ . l:minlevel \ . ' %t' endfunction call ale#linter#Define('cpp', { \ 'name': 'flawfinder', \ 'output_stream': 'stdout', \ 'executable': {b -> ale#Var(b, 'cpp_flawfinder_executable')}, \ 'command': function('ale_linters#cpp#flawfinder#GetCommand'), \ 'callback': 'ale#handlers#flawfinder#HandleFlawfinderFormat', \}) ale-4.0.0/ale_linters/crystal/000077500000000000000000000000001476501472200162465ustar00rootroot00000000000000ale-4.0.0/ale_linters/crystal/ameba.vim000066400000000000000000000032051476501472200200300ustar00rootroot00000000000000" Author: Harrison Bachrach - https://github.com/HarrisonB " Description: Ameba, a linter for crystal files call ale#Set('crystal_ameba_executable', 'bin/ameba') function! ale_linters#crystal#ameba#GetCommand(buffer) abort let l:executable = ale#Var(a:buffer, 'crystal_ameba_executable') return ale#Escape(l:executable) \ . ' --format json ' \ . ale#Escape(expand('#' . a:buffer . ':p')) endfunction " Handle output from ameba function! ale_linters#crystal#ameba#HandleAmebaOutput(buffer, lines) abort if len(a:lines) == 0 return [] endif let l:errors = ale#util#FuzzyJSONDecode(a:lines[0], {}) if !has_key(l:errors, 'summary') \|| l:errors['summary']['issues_count'] == 0 \|| empty(l:errors['sources']) return [] endif let l:output = [] for l:error in l:errors['sources'][0]['issues'] let l:start_col = str2nr(l:error['location']['column']) let l:end_col = str2nr(l:error['end_location']['column']) if !l:end_col let l:end_col = l:start_col + 1 endif call add(l:output, { \ 'lnum': str2nr(l:error['location']['line']), \ 'col': l:start_col, \ 'end_col': l:end_col, \ 'code': l:error['rule_name'], \ 'text': l:error['message'], \ 'type': 'W', \}) endfor return l:output endfunction call ale#linter#Define('crystal', { \ 'name': 'ameba', \ 'executable': {b -> ale#Var(b, 'crystal_ameba_executable')}, \ 'command': function('ale_linters#crystal#ameba#GetCommand'), \ 'callback': 'ale_linters#crystal#ameba#HandleAmebaOutput', \ 'lint_file': 1, \}) ale-4.0.0/ale_linters/crystal/crystal.vim000066400000000000000000000020501476501472200204410ustar00rootroot00000000000000" Author: Jordan Andree , David Alexander " Description: This file adds support for checking Crystal with crystal build function! ale_linters#crystal#crystal#Handle(buffer, lines) abort let l:output = [] for l:error in ale#util#FuzzyJSONDecode(a:lines, []) if !has_key(l:error, 'file') continue endif call add(l:output, { \ 'lnum': l:error.line + 0, \ 'col': l:error.column + 0, \ 'text': l:error.message, \}) endfor return l:output endfunction function! ale_linters#crystal#crystal#GetCommand(buffer) abort return 'crystal build -f json --no-codegen --no-color -o ' \ . ale#Escape(g:ale#util#nul_file) \ . ' %s' endfunction call ale#linter#Define('crystal', { \ 'name': 'crystal', \ 'executable': 'crystal', \ 'output_stream': 'both', \ 'lint_file': 1, \ 'command': function('ale_linters#crystal#crystal#GetCommand'), \ 'callback': 'ale_linters#crystal#crystal#Handle', \}) ale-4.0.0/ale_linters/cs/000077500000000000000000000000001476501472200151725ustar00rootroot00000000000000ale-4.0.0/ale_linters/cs/csc.vim000066400000000000000000000060571476501472200164670ustar00rootroot00000000000000call ale#Set('cs_csc_options', '') call ale#Set('cs_csc_source', '') call ale#Set('cs_csc_assembly_path', []) call ale#Set('cs_csc_assemblies', []) function! ale_linters#cs#csc#GetCwd(buffer) abort let l:cwd = ale#Var(a:buffer, 'cs_csc_source') return !empty(l:cwd) ? l:cwd : expand('#' . a:buffer . ':p:h') endfunction function! ale_linters#cs#csc#GetCommand(buffer) abort " Pass assembly paths via the -lib: parameter. let l:path_list = ale#Var(a:buffer, 'cs_csc_assembly_path') let l:lib_option = !empty(l:path_list) \ ? '/lib:' . join(map(copy(l:path_list), 'ale#Escape(v:val)'), ',') \ : '' " Pass paths to DLL files via the -r: parameter. let l:assembly_list = ale#Var(a:buffer, 'cs_csc_assemblies') let l:r_option = !empty(l:assembly_list) \ ? '/r:' . join(map(copy(l:assembly_list), 'ale#Escape(v:val)'), ',') \ : '' " register temporary module target file with ale " register temporary module target file with ALE. let l:out = ale#command#CreateFile(a:buffer) " The code is compiled as a module and the output is redirected to a " temporary file. return 'csc /unsafe' \ . ale#Pad(ale#Var(a:buffer, 'cs_csc_options')) \ . ale#Pad(l:lib_option) \ . ale#Pad(l:r_option) \ . ' /out:' . l:out \ . ' /t:module' \ . ' /recurse:' . ale#Escape('*.cs') endfunction function! ale_linters#cs#csc#Handle(buffer, lines) abort " Look for lines like the following. " " Tests.cs(12,29): error CSXXXX: ; expected " " NOTE: pattern also captures file name as linter compiles all " files within the source tree rooted at the specified source " path and not just the file loaded in the buffer let l:patterns = [ \ '^\v(.+\.cs)\((\d+),(\d+)\)\:\s+([^ ]+)\s+([cC][sS][^ ]+):\s(.+)$', \ '^\v([^ ]+)\s+([Cc][sS][^ ]+):\s+(.+)$', \] let l:output = [] let l:dir = ale_linters#cs#csc#GetCwd(a:buffer) for l:match in ale#util#GetMatches(a:lines, l:patterns) if len(l:match) > 6 && strlen(l:match[5]) > 2 && l:match[5][:1] is? 'CS' call add(l:output, { \ 'filename': ale#path#GetAbsPath(l:dir, l:match[1]), \ 'lnum': l:match[2] + 0, \ 'col': l:match[3] + 0, \ 'type': l:match[4] is# 'error' ? 'E' : 'W', \ 'code': l:match[5], \ 'text': l:match[6] , \}) elseif strlen(l:match[2]) > 2 && l:match[2][:1] is? 'CS' call add(l:output, { \ 'filename':'', \ 'lnum': -1, \ 'col': -1, \ 'type': l:match[1] is# 'error' ? 'E' : 'W', \ 'code': l:match[2], \ 'text': l:match[3], \}) endif endfor return l:output endfunction call ale#linter#Define('cs',{ \ 'name': 'csc', \ 'output_stream': 'stdout', \ 'executable': 'csc', \ 'cwd': function('ale_linters#cs#csc#GetCwd'), \ 'command': function('ale_linters#cs#csc#GetCommand'), \ 'callback': 'ale_linters#cs#csc#Handle', \ 'lint_file': 1 \}) ale-4.0.0/ale_linters/cs/cspell.vim000066400000000000000000000002241476501472200171670ustar00rootroot00000000000000scriptencoding utf-8 " Author: David Houston " Description: cspell support for C# files. call ale#handlers#cspell#DefineLinter('cs') ale-4.0.0/ale_linters/cs/mcs.vim000066400000000000000000000020751476501472200164750ustar00rootroot00000000000000let g:ale_cs_mcs_options = get(g:, 'ale_cs_mcs_options', '') function! ale_linters#cs#mcs#GetCommand(buffer) abort let l:options = ale#Var(a:buffer, 'cs_mcs_options') return 'mcs -unsafe --parse' \ . (!empty(l:options) ? ' ' . l:options : '') \ . ' %t' endfunction function! ale_linters#cs#mcs#Handle(buffer, lines) abort " Look for lines like the following. " " Tests.cs(12,29): error CSXXXX: ; expected let l:pattern = '^\v(.+\.cs)\((\d+),(\d+)\)\: ([^ ]+) ([^ ]+): (.+)$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) call add(l:output, { \ 'lnum': l:match[2] + 0, \ 'col': l:match[3] + 0, \ 'type': l:match[4] is# 'error' ? 'E' : 'W', \ 'code': l:match[5], \ 'text': l:match[6], \}) endfor return l:output endfunction call ale#linter#Define('cs',{ \ 'name': 'mcs', \ 'output_stream': 'stderr', \ 'executable': 'mcs', \ 'command': function('ale_linters#cs#mcs#GetCommand'), \ 'callback': 'ale_linters#cs#mcs#Handle', \}) ale-4.0.0/ale_linters/cs/mcsc.vim000066400000000000000000000061001476501472200166310ustar00rootroot00000000000000call ale#Set('cs_mcsc_options', '') call ale#Set('cs_mcsc_source', '') call ale#Set('cs_mcsc_assembly_path', []) call ale#Set('cs_mcsc_assemblies', []) function! ale_linters#cs#mcsc#GetCwd(buffer) abort let l:cwd = ale#Var(a:buffer, 'cs_mcsc_source') return !empty(l:cwd) ? l:cwd : expand('#' . a:buffer . ':p:h') endfunction function! ale_linters#cs#mcsc#GetCommand(buffer) abort " Pass assembly paths via the -lib: parameter. let l:path_list = ale#Var(a:buffer, 'cs_mcsc_assembly_path') let l:lib_option = !empty(l:path_list) \ ? '-lib:' . join(map(copy(l:path_list), 'ale#Escape(v:val)'), ',') \ : '' " Pass paths to DLL files via the -r: parameter. let l:assembly_list = ale#Var(a:buffer, 'cs_mcsc_assemblies') let l:r_option = !empty(l:assembly_list) \ ? '-r:' . join(map(copy(l:assembly_list), 'ale#Escape(v:val)'), ',') \ : '' " register temporary module target file with ale " register temporary module target file with ALE. let l:out = ale#command#CreateFile(a:buffer) " The code is compiled as a module and the output is redirected to a " temporary file. return 'mcs -unsafe' \ . ale#Pad(ale#Var(a:buffer, 'cs_mcsc_options')) \ . ale#Pad(l:lib_option) \ . ale#Pad(l:r_option) \ . ' -out:' . l:out \ . ' -t:module' \ . ' -recurse:' . ale#Escape('*.cs') endfunction function! ale_linters#cs#mcsc#Handle(buffer, lines) abort " Look for lines like the following. " " Tests.cs(12,29): error CSXXXX: ; expected " " NOTE: pattern also captures file name as linter compiles all " files within the source tree rooted at the specified source " path and not just the file loaded in the buffer let l:patterns = [ \ '^\v(.+\.cs)\((\d+),(\d+)\)\:\s+([^ ]+)\s+([cC][sS][^ ]+):\s(.+)$', \ '^\v([^ ]+)\s+([Cc][sS][^ ]+):\s+(.+)$', \] let l:output = [] let l:dir = ale_linters#cs#mcsc#GetCwd(a:buffer) for l:match in ale#util#GetMatches(a:lines, l:patterns) if len(l:match) > 6 && strlen(l:match[5]) > 2 && l:match[5][:1] is? 'CS' call add(l:output, { \ 'filename': ale#path#GetAbsPath(l:dir, l:match[1]), \ 'lnum': l:match[2] + 0, \ 'col': l:match[3] + 0, \ 'type': l:match[4] is# 'error' ? 'E' : 'W', \ 'code': l:match[5], \ 'text': l:match[6] , \}) elseif strlen(l:match[2]) > 2 && l:match[2][:1] is? 'CS' call add(l:output, { \ 'filename':'', \ 'lnum': -1, \ 'col': -1, \ 'type': l:match[1] is# 'error' ? 'E' : 'W', \ 'code': l:match[2], \ 'text': l:match[3], \}) endif endfor return l:output endfunction call ale#linter#Define('cs',{ \ 'name': 'mcsc', \ 'output_stream': 'stderr', \ 'executable': 'mcs', \ 'cwd': function('ale_linters#cs#mcsc#GetCwd'), \ 'command': function('ale_linters#cs#mcsc#GetCommand'), \ 'callback': 'ale_linters#cs#mcsc#Handle', \ 'lint_file': 1 \}) ale-4.0.0/ale_linters/css/000077500000000000000000000000001476501472200153555ustar00rootroot00000000000000ale-4.0.0/ale_linters/css/cspell.vim000066400000000000000000000002261476501472200173540ustar00rootroot00000000000000scriptencoding utf-8 " Author: David Houston " Description: cspell support for CSS files. call ale#handlers#cspell#DefineLinter('css') ale-4.0.0/ale_linters/css/csslint.vim000066400000000000000000000011711476501472200175510ustar00rootroot00000000000000" Author: w0rp " Description: This file adds support for checking CSS code with csslint. function! ale_linters#css#csslint#GetCommand(buffer) abort let l:csslintrc = ale#path#FindNearestFile(a:buffer, '.csslintrc') let l:config_option = !empty(l:csslintrc) \ ? '--config=' . ale#Escape(l:csslintrc) \ : '' return 'csslint --format=compact ' . l:config_option . ' %t' endfunction call ale#linter#Define('css', { \ 'name': 'csslint', \ 'executable': 'csslint', \ 'command': function('ale_linters#css#csslint#GetCommand'), \ 'callback': 'ale#handlers#css#HandleCSSLintFormat', \}) ale-4.0.0/ale_linters/css/fecs.vim000066400000000000000000000004431476501472200170130ustar00rootroot00000000000000" Author: harttle " Description: fecs for CSS files call ale#linter#Define('css', { \ 'name': 'fecs', \ 'executable': function('ale#handlers#fecs#GetExecutable'), \ 'command': function('ale#handlers#fecs#GetCommand'), \ 'callback': 'ale#handlers#fecs#Handle', \}) ale-4.0.0/ale_linters/css/stylelint.vim000066400000000000000000000013301476501472200201160ustar00rootroot00000000000000" Author: diartyz call ale#Set('css_stylelint_executable', 'stylelint') call ale#Set('css_stylelint_options', '') call ale#Set('css_stylelint_use_global', get(g:, 'ale_use_global_executables', 0)) function! ale_linters#css#stylelint#GetCommand(buffer) abort return '%e ' . ale#Pad(ale#Var(a:buffer, 'css_stylelint_options')) \ . ' --stdin-filename %s' endfunction call ale#linter#Define('css', { \ 'name': 'stylelint', \ 'output_stream': 'both', \ 'executable': {b -> ale#path#FindExecutable(b, 'css_stylelint', [ \ 'node_modules/.bin/stylelint', \ ])}, \ 'command': function('ale_linters#css#stylelint#GetCommand'), \ 'callback': 'ale#handlers#css#HandleStyleLintFormat', \}) ale-4.0.0/ale_linters/css/vscodecss.vim000066400000000000000000000010521476501472200200640ustar00rootroot00000000000000" Author: Dalius Dobravolskas " Description: VSCode css language server function! ale_linters#css#vscodecss#GetProjectRoot(buffer) abort let l:git_path = ale#path#FindNearestDirectory(a:buffer, '.git') return !empty(l:git_path) ? fnamemodify(l:git_path, ':h:h') : '' endfunction call ale#linter#Define('css', { \ 'name': 'vscodecss', \ 'lsp': 'stdio', \ 'executable': 'vscode-css-language-server', \ 'command': '%e --stdio', \ 'project_root': function('ale_linters#css#vscodecss#GetProjectRoot'), \}) ale-4.0.0/ale_linters/cucumber/000077500000000000000000000000001476501472200163725ustar00rootroot00000000000000ale-4.0.0/ale_linters/cucumber/cucumber.vim000066400000000000000000000024421476501472200207160ustar00rootroot00000000000000" Author: Eddie Lebow https://github.com/elebow " Description: Cucumber, a BDD test tool function! ale_linters#cucumber#cucumber#GetCommand(buffer) abort let l:features_dir = ale#path#FindNearestDirectory(a:buffer, 'features') if !empty(l:features_dir) let l:features_arg = '-r ' . ale#Escape(l:features_dir) else let l:features_arg = '' endif return 'cucumber --dry-run --quiet --strict --format=json ' \ . l:features_arg . ' %t' endfunction function! ale_linters#cucumber#cucumber#Handle(buffer, lines) abort try let l:json = ale#util#FuzzyJSONDecode(a:lines, {})[0] catch return [] endtry let l:output = [] for l:element in get(l:json, 'elements', []) for l:step in l:element['steps'] if l:step['result']['status'] is# 'undefined' call add(l:output, { \ 'lnum': l:step['line'], \ 'code': 'E', \ 'text': 'Undefined step' \}) endif endfor endfor return l:output endfunction call ale#linter#Define('cucumber', { \ 'name': 'cucumber', \ 'executable': 'cucumber', \ 'command': function('ale_linters#cucumber#cucumber#GetCommand'), \ 'callback': 'ale_linters#cucumber#cucumber#Handle' \}) ale-4.0.0/ale_linters/cuda/000077500000000000000000000000001476501472200155015ustar00rootroot00000000000000ale-4.0.0/ale_linters/cuda/clangd.vim000066400000000000000000000015041476501472200174460ustar00rootroot00000000000000" Author: Tommy Chiang " Description: Clangd language server for CUDA (modified from Andrey " Melentyev's implementation for C++) call ale#Set('cuda_clangd_executable', 'clangd') call ale#Set('cuda_clangd_options', '') call ale#Set('c_build_dir', '') function! ale_linters#cuda#clangd#GetCommand(buffer) abort let l:build_dir = ale#c#GetBuildDirectory(a:buffer) return '%e' \ . ale#Pad(ale#Var(a:buffer, 'cuda_clangd_options')) \ . (!empty(l:build_dir) ? ' -compile-commands-dir=' . ale#Escape(l:build_dir) : '') endfunction call ale#linter#Define('cuda', { \ 'name': 'clangd', \ 'lsp': 'stdio', \ 'executable': {b -> ale#Var(b, 'cuda_clangd_executable')}, \ 'command': function('ale_linters#cuda#clangd#GetCommand'), \ 'project_root': function('ale#c#FindProjectRoot'), \}) ale-4.0.0/ale_linters/cuda/nvcc.vim000066400000000000000000000027451476501472200171570ustar00rootroot00000000000000" Author: blahgeek " Description: NVCC linter for cuda files call ale#Set('cuda_nvcc_executable', 'nvcc') call ale#Set('cuda_nvcc_options', '-std=c++11') function! ale_linters#cuda#nvcc#GetCommand(buffer) abort return '%e -cuda' \ . ale#Pad(ale#c#IncludeOptions(ale#c#FindLocalHeaderPaths(a:buffer))) \ . ale#Pad(ale#Var(a:buffer, 'cuda_nvcc_options')) \ . ' %s -o ' . g:ale#util#nul_file endfunction function! ale_linters#cuda#nvcc#HandleNVCCFormat(buffer, lines) abort " Look for lines like the following. " " test.cu(8): error: argument of type "void *" is incompatible with parameter of type "int *" let l:pattern = '\v^([^:\(\)]+):?\(?(\d+)\)?:(\d+)?:?\s*\w*\s*(error|warning): (.+)$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) let l:item = { \ 'lnum': str2nr(l:match[2]), \ 'type': l:match[4] =~# 'error' ? 'E' : 'W', \ 'text': l:match[5], \ 'filename': fnamemodify(l:match[1], ':p'), \} if !empty(l:match[3]) let l:item.col = str2nr(l:match[3]) endif call add(l:output, l:item) endfor return l:output endfunction call ale#linter#Define('cuda', { \ 'name': 'nvcc', \ 'output_stream': 'stderr', \ 'executable': {b -> ale#Var(b, 'cuda_nvcc_executable')}, \ 'command': function('ale_linters#cuda#nvcc#GetCommand'), \ 'callback': 'ale_linters#cuda#nvcc#HandleNVCCFormat', \ 'lint_file': 1, \}) ale-4.0.0/ale_linters/cypher/000077500000000000000000000000001476501472200160575ustar00rootroot00000000000000ale-4.0.0/ale_linters/cypher/cypher_lint.vim000066400000000000000000000013411476501472200211130ustar00rootroot00000000000000" Author: Francisco Lopes " Description: Linting for Neo4j's Cypher function! ale_linters#cypher#cypher_lint#Handle(buffer, lines) abort let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):(\d+): (.*)$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) call add(l:output, { \ 'lnum': l:match[2] + 0, \ 'col': l:match[3] + 0, \ 'text': l:match[4], \ 'type': 'E', \}) endfor return l:output endfunction call ale#linter#Define('cypher', { \ 'name': 'cypher_lint', \ 'executable': 'cypher-lint', \ 'command': 'cypher-lint', \ 'output_stream': 'stderr', \ 'callback': 'ale_linters#cypher#cypher_lint#Handle', \}) ale-4.0.0/ale_linters/d/000077500000000000000000000000001476501472200150105ustar00rootroot00000000000000ale-4.0.0/ale_linters/d/dls.vim000066400000000000000000000013471476501472200163140ustar00rootroot00000000000000" Author: aurieh " Description: A Language Server implementation for D call ale#Set('d_dls_executable', 'dls') function! ale_linters#d#dls#GetExecutable(buffer) abort return ale#Var(a:buffer, 'd_dls_executable') endfunction function! ale_linters#d#dls#FindProjectRoot(buffer) abort " Note: this will return . if dub config is empty " dls can run outside DUB projects just fine return fnamemodify(ale#d#FindDUBConfig(a:buffer), ':h') endfunction call ale#linter#Define('d', { \ 'name': 'dls', \ 'lsp': 'stdio', \ 'executable': function('ale_linters#d#dls#GetExecutable'), \ 'command': function('ale_linters#d#dls#GetExecutable'), \ 'project_root': function('ale_linters#d#dls#FindProjectRoot'), \}) ale-4.0.0/ale_linters/d/dmd.vim000066400000000000000000000100451476501472200162710ustar00rootroot00000000000000" Author: w0rp " Description: "dmd for D files" function! s:GetDUBCommand(buffer) abort " If we can't run dub, then skip this command. if executable('dub') " Returning an empty string skips to the DMD command. let l:config = ale#d#FindDUBConfig(a:buffer) " To support older dub versions, we just change the directory to the " directory where we found the dub config, and then run `dub describe` " from that directory. if !empty(l:config) return [fnamemodify(l:config, ':h'), 'dub describe --data-list \ --data=import-paths \ --data=string-import-paths \ --data=versions \ --data=debug-versions \'] endif endif return ['', ''] endfunction function! ale_linters#d#dmd#RunDUBCommand(buffer) abort let [l:cwd, l:command] = s:GetDUBCommand(a:buffer) if empty(l:command) " If we can't run DUB, just run DMD. return ale_linters#d#dmd#DMDCommand(a:buffer, [], {}) endif return ale#command#Run( \ a:buffer, \ l:command, \ function('ale_linters#d#dmd#DMDCommand'), \ {'cwd': l:cwd}, \) endfunction function! ale_linters#d#dmd#DMDCommand(buffer, dub_output, meta) abort let l:import_list = [] let l:str_import_list = [] let l:versions_list = [] let l:deb_versions_list = [] let l:list_ind = 1 let l:seen_line = 0 " Build a list of options generated from DUB, if available. " DUB output each path or version on a single line. " Each list is separated by a blank line. " Empty list are represented by a blank line (followed and/or " preceded by a separation blank line) for l:line in a:dub_output " line still has end of line char on windows let l:line = substitute(l:line, '[\r\n]*$', '', '') if !empty(l:line) if l:list_ind == 1 call add(l:import_list, '-I' . ale#Escape(l:line)) elseif l:list_ind == 2 call add(l:str_import_list, '-J' . ale#Escape(l:line)) elseif l:list_ind == 3 call add(l:versions_list, '-version=' . ale#Escape(l:line)) elseif l:list_ind == 4 call add(l:deb_versions_list, '-debug=' . ale#Escape(l:line)) endif let l:seen_line = 1 elseif !l:seen_line " if list is empty must skip one empty line let l:seen_line = 1 else let l:seen_line = 0 let l:list_ind += 1 endif endfor return 'dmd ' . join(l:import_list) . ' ' . \ join(l:str_import_list) . ' ' . \ join(l:versions_list) . ' ' . \ join(l:deb_versions_list) . ' -o- -wi -vcolumns -c %t' endfunction function! ale_linters#d#dmd#Handle(buffer, lines) abort " Matches patterns lines like the following: " /tmp/tmp.qclsa7qLP7/file.d(1): Error: function declaration without return type. (Note that constructors are always named 'this') " /tmp/tmp.G1L5xIizvB.d(8,8): Error: module weak_reference is in file 'dstruct/weak_reference.d' which cannot be read let l:pattern = '\v^(\f+)\((\d+)(,(\d+))?\): (\w+): (.+)$' let l:output = [] let l:dir = expand('#' . a:buffer . ':p:h') for l:match in ale#util#GetMatches(a:lines, l:pattern) " If dmd was invoked with relative path, match[1] is relative, otherwise it is absolute. " As we invoke dmd with the buffer path (in /tmp), this will generally be absolute already let l:fname = ale#path#GetAbsPath(l:dir, l:match[1]) call add(l:output, { \ 'filename': l:fname, \ 'lnum': l:match[2], \ 'col': l:match[4], \ 'type': l:match[5] is# 'Warning' || l:match[5] is# 'Deprecation' ? 'W' : 'E', \ 'text': l:match[6], \}) endfor return l:output endfunction call ale#linter#Define('d', { \ 'name': 'dmd', \ 'executable': 'dmd', \ 'command': function('ale_linters#d#dmd#RunDUBCommand'), \ 'callback': 'ale_linters#d#dmd#Handle', \ 'output_stream': 'stderr', \}) ale-4.0.0/ale_linters/dafny/000077500000000000000000000000001476501472200156665ustar00rootroot00000000000000ale-4.0.0/ale_linters/dafny/dafny.vim000066400000000000000000000024501476501472200175050ustar00rootroot00000000000000" Author: Taylor Blau call ale#Set('dafny_dafny_timelimit', 10) function! ale_linters#dafny#dafny#Handle(buffer, lines) abort let l:pattern = '\v(.*)\((\d+),(\d+)\): (.*): (.*)' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) call add(l:output, { \ 'filename': l:match[1], \ 'col': l:match[3] + 0, \ 'lnum': l:match[2] + 0, \ 'text': l:match[5], \ 'type': l:match[4] =~# '^Error' ? 'E' : 'W' \ }) endfor for l:match in ale#util#GetMatches(a:lines, '\v(.*)\((\d+),(\d+)\): (Verification of .{-} timed out after \d+ seconds)') call add(l:output, { \ 'filename': l:match[1], \ 'col': l:match[3] + 0, \ 'lnum': l:match[2] + 0, \ 'text': l:match[4], \ 'type': 'E', \ }) endfor return l:output endfunction function! ale_linters#dafny#dafny#GetCommand(buffer) abort return printf('dafny %%s /compile:0 /timeLimit:%d', ale#Var(a:buffer, 'dafny_dafny_timelimit')) endfunction call ale#linter#Define('dafny', { \ 'name': 'dafny', \ 'executable': 'dafny', \ 'command': function('ale_linters#dafny#dafny#GetCommand'), \ 'callback': 'ale_linters#dafny#dafny#Handle', \ 'lint_file': 1, \ }) ale-4.0.0/ale_linters/dart/000077500000000000000000000000001476501472200155175ustar00rootroot00000000000000ale-4.0.0/ale_linters/dart/analysis_server.vim000066400000000000000000000026551476501472200214550ustar00rootroot00000000000000" Author: Nelson Yeung " Description: Check Dart files with dart analysis server LSP call ale#Set('dart_analysis_server_enable_language_server', 1) call ale#Set('dart_analysis_server_executable', 'dart') function! ale_linters#dart#analysis_server#GetProjectRoot(buffer) abort " Note: pub only looks for pubspec.yaml, there's no point in adding " support for pubspec.yml let l:pubspec = ale#path#FindNearestFile(a:buffer, 'pubspec.yaml') return !empty(l:pubspec) ? fnamemodify(l:pubspec, ':h:h') : '.' endfunction function! ale_linters#dart#analysis_server#GetCommand(buffer) abort let l:language_server = ale#Var(a:buffer, 'dart_analysis_server_enable_language_server') let l:executable = ale#Var(a:buffer, 'dart_analysis_server_executable') let l:dart = resolve(exepath(l:executable)) let l:output = '%e ' \ . fnamemodify(l:dart, ':h') . '/snapshots/analysis_server.dart.snapshot' \ . ' --lsp' " Enable new language-server command if l:language_server == 1 let l:output = '%e language-server --protocol=lsp' endif return l:output endfunction call ale#linter#Define('dart', { \ 'name': 'analysis_server', \ 'lsp': 'stdio', \ 'executable': {b -> ale#Var(b, 'dart_analysis_server_executable')}, \ 'command': function('ale_linters#dart#analysis_server#GetCommand'), \ 'project_root': function('ale_linters#dart#analysis_server#GetProjectRoot'), \}) ale-4.0.0/ale_linters/dart/dart_analyze.vim000066400000000000000000000017151476501472200207150ustar00rootroot00000000000000" Author: ghsang " Description: Check Dart files with dart analyze call ale#Set('dart_analyze_executable', 'dart') function! ale_linters#dart#dart_analyze#Handle(buffer, lines) abort let l:pattern = '\v([a-z]+) - (.+):(\d+):(\d+) - (.+) - (.+)$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) let [l:type, l:filename, l:lnum, l:col, l:message, l:code] = l:match[1:6] call add(l:output, { \ 'type': l:type is# 'error' ? 'E' : l:type is# 'info' ? 'I' : 'W', \ 'text': l:code . ': ' . l:message, \ 'lnum': str2nr(l:lnum), \ 'col': str2nr(l:col), \}) endfor return l:output endfunction call ale#linter#Define('dart', { \ 'name': 'dart_analyze', \ 'executable': {b -> ale#Var(b, 'dart_analyze_executable')}, \ 'command': '%e analyze --fatal-infos %s', \ 'callback': 'ale_linters#dart#dart_analyze#Handle', \ 'lint_file': 1, \}) ale-4.0.0/ale_linters/dart/language_server.vim000066400000000000000000000013401476501472200214030ustar00rootroot00000000000000" Author: aurieh " Description: A language server for dart call ale#Set('dart_language_server_executable', 'dart_language_server') function! ale_linters#dart#language_server#GetProjectRoot(buffer) abort " Note: pub only looks for pubspec.yaml, there's no point in adding " support for pubspec.yml let l:pubspec = ale#path#FindNearestFile(a:buffer, 'pubspec.yaml') return !empty(l:pubspec) ? fnamemodify(l:pubspec, ':h:h') : '' endfunction call ale#linter#Define('dart', { \ 'name': 'language_server', \ 'lsp': 'stdio', \ 'executable': {b -> ale#Var(b, 'dart_language_server_executable')}, \ 'command': '%e', \ 'project_root': function('ale_linters#dart#language_server#GetProjectRoot'), \}) ale-4.0.0/ale_linters/desktop/000077500000000000000000000000001476501472200162365ustar00rootroot00000000000000ale-4.0.0/ale_linters/desktop/desktop_file_validate.vim000066400000000000000000000020021476501472200232660ustar00rootroot00000000000000call ale#Set('desktop_desktop_file_validate_options', '') " Example matches for pattern: " " foo.desktop: warning: key "TerminalOptions" in group ... " foo.desktop: error: action "new-private-window" is defined, ... let s:pattern = '\v^(.+): ([a-z]+): (.+)$' function! ale_linters#desktop#desktop_file_validate#Handle(buffer, lines) abort " The error format doesn't specify lines, so we can just put all of the " errors on line 1. return ale#util#MapMatches(a:lines, s:pattern, {match -> { \ 'lnum': 1, \ 'col': 1, \ 'type': match[2] is? 'error' ? 'E' : 'W', \ 'text': match[3], \}}) endfunction call ale#linter#Define('desktop', { \ 'name': 'desktop_file_validate', \ 'aliases': ['desktop-file-validate'], \ 'executable': 'desktop-file-validate', \ 'command': {b -> \ '%e' \ . ale#Pad(ale#Var(b, 'desktop_desktop_file_validate_options')) \ . ' %t' \ }, \ 'callback': 'ale_linters#desktop#desktop_file_validate#Handle', \ 'output_stream': 'both', \}) ale-4.0.0/ale_linters/dockerfile/000077500000000000000000000000001476501472200166745ustar00rootroot00000000000000ale-4.0.0/ale_linters/dockerfile/dockerfile_lint.vim000066400000000000000000000045231476501472200225520ustar00rootroot00000000000000" Author: Alexander Olofsson call ale#Set('dockerfile_dockerfile_lint_executable', 'dockerfile_lint') call ale#Set('dockerfile_dockerfile_lint_options', '') function! ale_linters#dockerfile#dockerfile_lint#GetType(type) abort if a:type is? 'error' return 'E' elseif a:type is? 'warn' return 'W' endif return 'I' endfunction function! ale_linters#dockerfile#dockerfile_lint#Handle(buffer, lines) abort try let l:data = json_decode(join(a:lines, '')) catch return [] endtry if empty(l:data) " Should never happen, but it's better to be on the safe side return [] endif let l:messages = [] for l:type in ['error', 'warn', 'info'] for l:object in l:data[l:type]['data'] let l:line = get(l:object, 'line', -1) let l:message = l:object['message'] let l:link = get(l:object, 'reference_url', '') if type(l:link) == v:t_list " Somehow, reference_url is returned as two-part list. " Anchor markers in that list are sometimes duplicated. " See https://github.com/projectatomic/dockerfile_lint/issues/134 let l:link = join(l:link, '') let l:link = substitute(l:link, '##', '#', '') endif let l:detail = l:message if get(l:object, 'description', 'None') isnot# 'None' let l:detail .= "\n\n" . l:object['description'] endif let l:detail .= "\n\n" . l:link call add(l:messages, { \ 'lnum': l:line, \ 'text': l:message, \ 'type': ale_linters#dockerfile#dockerfile_lint#GetType(l:type), \ 'detail': l:detail, \}) endfor endfor return l:messages endfunction function! ale_linters#dockerfile#dockerfile_lint#GetCommand(buffer) abort return '%e' . ale#Pad(ale#Var(a:buffer, 'dockerfile_dockerfile_lint_options')) \ . ' -p -j -f' \ . ' %t' endfunction call ale#linter#Define('dockerfile', { \ 'name': 'dockerfile_lint', \ 'executable': {b -> ale#Var(b, 'dockerfile_dockerfile_lint_executable')}, \ 'command': function('ale_linters#dockerfile#dockerfile_lint#GetCommand'), \ 'callback': 'ale_linters#dockerfile#dockerfile_lint#Handle', \}) ale-4.0.0/ale_linters/dockerfile/dockerlinter.vim000066400000000000000000000037051476501472200221030ustar00rootroot00000000000000" Author: Shad " Description: dockerlinter linter for dockerfile call ale#Set('dockerfile_dockerlinter_executable', 'dockerlinter') call ale#Set('dockerfile_dockerlinter_options', '') function! ale_linters#dockerfile#dockerlinter#GetType(type) abort if a:type is? 'error' return 'E' elseif a:type is? 'warning' return 'W' endif return 'I' endfunction function! ale_linters#dockerfile#dockerlinter#Handle(buffer, lines) abort try let l:data = json_decode(join(a:lines, '')) catch return [] endtry if empty(l:data) " Should never happen, but it's better to be on the safe side return [] endif let l:messages = [] for l:object in l:data let l:line = get(l:object, 'lineNumber', -1) let l:message = l:object['message'] let l:type = l:object['level'] let l:detail = l:message let l:code = l:object['code'] if l:code =~# '^SC' let l:link = 'https://www.shellcheck.net/wiki/' . l:code else let l:link = 'https://github.com/buddy-works/dockerfile-linter/blob/master/Rules.md#' . l:code endif let l:detail = l:message . "\n\n" . l:link call add(l:messages, { \ 'lnum': l:line, \ 'code': l:code, \ 'text': l:message, \ 'type': ale_linters#dockerfile#dockerlinter#GetType(l:type), \ 'detail': l:detail, \}) endfor return l:messages endfunction function! ale_linters#dockerfile#dockerlinter#GetCommand(buffer) abort return '%e' . ale#Pad(ale#Var(a:buffer, 'dockerfile_dockerlinter_options')) \ . ' -j -f' \ . ' %t' endfunction call ale#linter#Define('dockerfile', { \ 'name': 'dockerlinter', \ 'executable': {b -> ale#Var(b, 'dockerfile_dockerlinter_executable')}, \ 'command': function('ale_linters#dockerfile#dockerlinter#GetCommand'), \ 'callback': 'ale_linters#dockerfile#dockerlinter#Handle', \}) ale-4.0.0/ale_linters/dockerfile/hadolint.vim000066400000000000000000000075211476501472200212200ustar00rootroot00000000000000" Author: hauleth - https://github.com/hauleth " always, yes, never call ale#Set('dockerfile_hadolint_use_docker', 'never') call ale#Set('dockerfile_hadolint_docker_image', 'hadolint/hadolint') call ale#Set('dockerfile_hadolint_options', '') function! ale_linters#dockerfile#hadolint#Handle(buffer, lines) abort " Matches patterns line the following: " " -:19 DL3001 warning: Pipe chain should start with a raw value. " /dev/stdin:19:3 unexpected thing let l:pattern = '\v^%(/dev/stdin|-):(\d+):?(\d+)? ((DL|SC)(\d+) )?((.+)?: )?(.+)$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) let l:lnum = 0 let l:colnum = 0 if l:match[1] isnot# '' let l:lnum = l:match[1] + 0 endif if l:match[2] isnot# '' let l:colnum = l:match[2] + 0 endif " Shellcheck knows a 'style' severity - pin it to info level as well. if l:match[7] is# 'style' let l:type = 'I' elseif l:match[7] is# 'info' let l:type = 'I' elseif l:match[7] is# 'warning' let l:type = 'W' else let l:type = 'E' endif let l:text = l:match[8] let l:detail = l:match[8] let l:domain = 'https://github.com/hadolint/hadolint/wiki/' let l:code = '' let l:link = '' if l:match[4] is# 'SC' let l:domain = 'https://github.com/koalaman/shellcheck/wiki/' endif if l:match[5] isnot# '' let l:code = l:match[4] . l:match[5] 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 else let l:type = 'E' let l:detail = 'hadolint could not parse the file because of a syntax error.' endif let l:line_output = { \ 'lnum': l:lnum, \ 'col': l:colnum, \ 'type': l:type, \ 'text': l:text, \ 'detail': l:detail \} if l:code isnot# '' let l:line_output['code'] = l:code endif call add(l:output, l:line_output) endfor return l:output endfunction " This is a little different than the typical 'executable' callback. We want " to afford the user the chance to say always use docker, never use docker, " and use docker if the hadolint executable is not present on the system. " " In the case of neither docker nor hadolint executables being present, it " really doesn't matter which we return -- either will have the effect of " 'nope, can't use this linter!'. function! ale_linters#dockerfile#hadolint#GetExecutable(buffer) abort let l:use_docker = ale#Var(a:buffer, 'dockerfile_hadolint_use_docker') " check for mandatory directives if l:use_docker is# 'never' return 'hadolint' elseif l:use_docker is# 'always' return 'docker' endif " if we reach here, we want to use 'hadolint' if present... if executable('hadolint') return 'hadolint' endif "... and 'docker' as a fallback. return 'docker' endfunction function! ale_linters#dockerfile#hadolint#GetCommand(buffer) abort let l:command = ale_linters#dockerfile#hadolint#GetExecutable(a:buffer) let l:opts = ale#Var(a:buffer, 'dockerfile_hadolint_options') . ' --no-color -' if l:command is# 'docker' return printf('docker run --rm -i %s hadolint %s', \ ale#Var(a:buffer, 'dockerfile_hadolint_docker_image'), \ l:opts) endif return 'hadolint ' . l:opts endfunction call ale#linter#Define('dockerfile', { \ 'name': 'hadolint', \ 'executable': function('ale_linters#dockerfile#hadolint#GetExecutable'), \ 'command': function('ale_linters#dockerfile#hadolint#GetCommand'), \ 'callback': 'ale_linters#dockerfile#hadolint#Handle', \}) ale-4.0.0/ale_linters/elixir/000077500000000000000000000000001476501472200160615ustar00rootroot00000000000000ale-4.0.0/ale_linters/elixir/credo.vim000066400000000000000000000036731476501472200177030ustar00rootroot00000000000000" Author: hauleth - https://github.com/hauleth function! ale_linters#elixir#credo#Handle(buffer, lines) abort " Matches patterns line the following: " " lib/filename.ex:19:7: F: Pipe chain should start with a raw value. let l:pattern = '\v:(\d+):?(\d+)?: (.): (.+)$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) let l:type = l:match[3] let l:text = l:match[4] " Refactoring opportunities if l:type is# 'F' let l:type = 'W' " Consistency elseif l:type is# 'C' let l:type = 'W' " Software Design elseif l:type is# 'D' let l:type = 'I' " Code Readability elseif l:type is# 'R' let l:type = 'I' endif call add(l:output, { \ 'bufnr': a:buffer, \ 'lnum': l:match[1] + 0, \ 'col': l:match[2] + 0, \ 'type': l:type, \ 'text': l:text, \}) endfor return l:output endfunction function! ale_linters#elixir#credo#GetMode() abort if get(g:, 'ale_elixir_credo_strict', 0) return '--strict' else return 'suggest' endif endfunction function! ale_linters#elixir#credo#GetConfigFile() abort let l:config_file = get(g:, 'ale_elixir_credo_config_file', '') if empty(l:config_file) return '' endif return ' --config-file ' . l:config_file endfunction function! ale_linters#elixir#credo#GetCommand(buffer) abort return 'mix help credo && ' \ . 'mix credo ' . ale_linters#elixir#credo#GetMode() \ . ale_linters#elixir#credo#GetConfigFile() \ . ' --format=flycheck --read-from-stdin %s' endfunction call ale#linter#Define('elixir', { \ 'name': 'credo', \ 'executable': 'mix', \ 'cwd': function('ale#handlers#elixir#FindMixUmbrellaRoot'), \ 'command': function('ale_linters#elixir#credo#GetCommand'), \ 'callback': 'ale_linters#elixir#credo#Handle', \}) ale-4.0.0/ale_linters/elixir/cspell.vim000066400000000000000000000002341476501472200200570ustar00rootroot00000000000000scriptencoding utf-8 " Author: David Houston " Description: cspell support for Elixir files. call ale#handlers#cspell#DefineLinter('elixir') ale-4.0.0/ale_linters/elixir/dialyxir.vim000066400000000000000000000020361476501472200204240ustar00rootroot00000000000000" Author: Fran C. - https://github.com/franciscoj " Description: Add dialyzer support for elixir through dialyxir " https://github.com/jeremyjh/dialyxir function! ale_linters#elixir#dialyxir#Handle(buffer, lines) abort " Matches patterns line the following: " " lib/filename.ex:19: Function fname/1 has no local return let l:pattern = '\v(.+):(\d+): (.+)$' let l:output = [] let l:type = 'W' for l:match in ale#util#GetMatches(a:lines, l:pattern) if bufname(a:buffer) == l:match[1] call add(l:output, { \ 'bufnr': a:buffer, \ 'lnum': l:match[2] + 0, \ 'col': 0, \ 'type': l:type, \ 'text': l:match[3], \}) endif endfor return l:output endfunction call ale#linter#Define('elixir', { \ 'name': 'dialyxir', \ 'executable': 'mix', \ 'cwd': function('ale#handlers#elixir#FindMixProjectRoot'), \ 'command': 'mix help dialyzer && mix dialyzer', \ 'callback': 'ale_linters#elixir#dialyxir#Handle', \}) ale-4.0.0/ale_linters/elixir/dogma.vim000066400000000000000000000021041476501472200176620ustar00rootroot00000000000000" Author: archseer - https://github.com/archSeer function! ale_linters#elixir#dogma#Handle(buffer, lines) abort " Matches patterns line the following: " " lib/filename.ex:19:7: F: Pipe chain should start with a raw value. let l:pattern = '\v:(\d+):?(\d+)?: (.): (.+)$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) let l:type = l:match[3] let l:text = l:match[4] if l:type is# 'C' let l:type = 'E' elseif l:type is# 'R' let l:type = 'W' endif call add(l:output, { \ 'bufnr': a:buffer, \ 'lnum': l:match[1] + 0, \ 'col': l:match[2] + 0, \ 'type': l:type, \ 'text': l:text, \}) endfor return l:output endfunction call ale#linter#Define('elixir', { \ 'name': 'dogma', \ 'executable': 'mix', \ 'cwd': function('ale#handlers#elixir#FindMixProjectRoot'), \ 'command': 'mix help dogma && mix dogma %s --format=flycheck', \ 'lint_file': 1, \ 'callback': 'ale_linters#elixir#dogma#Handle', \}) ale-4.0.0/ale_linters/elixir/elixir_ls.vim000066400000000000000000000015741476501472200205770ustar00rootroot00000000000000" Author: Jon Parise " Description: ElixirLS integration (https://github.com/elixir-lsp/elixir-ls) call ale#Set('elixir_elixir_ls_release', 'elixir-ls') call ale#Set('elixir_elixir_ls_config', {}) function! ale_linters#elixir#elixir_ls#GetExecutable(buffer) abort let l:dir = ale#path#Simplify(ale#Var(a:buffer, 'elixir_elixir_ls_release')) let l:cmd = has('win32') ? '\language_server.bat' : '/language_server.sh' return l:dir . l:cmd endfunction call ale#linter#Define('elixir', { \ 'name': 'elixir_ls', \ 'aliases': ['elixir-ls', 'elixirls'], \ 'lsp': 'stdio', \ 'executable': function('ale_linters#elixir#elixir_ls#GetExecutable'), \ 'command': function('ale_linters#elixir#elixir_ls#GetExecutable'), \ 'project_root': function('ale#handlers#elixir#FindMixUmbrellaRoot'), \ 'lsp_config': {b -> ale#Var(b, 'elixir_elixir_ls_config')}, \}) ale-4.0.0/ale_linters/elixir/lexical.vim000066400000000000000000000013201476501472200202130ustar00rootroot00000000000000" Author: Axel Clark " Description: Lexical integration (https://github.com/lexical-lsp/lexical) call ale#Set('elixir_lexical_release', 'lexical') function! ale_linters#elixir#lexical#GetExecutable(buffer) abort let l:dir = ale#path#Simplify(ale#Var(a:buffer, 'elixir_lexical_release')) let l:cmd = has('win32') ? '\start_lexical.bat' : '/start_lexical.sh' return l:dir . l:cmd endfunction call ale#linter#Define('elixir', { \ 'name': 'lexical', \ 'lsp': 'stdio', \ 'executable': function('ale_linters#elixir#lexical#GetExecutable'), \ 'command': function('ale_linters#elixir#lexical#GetExecutable'), \ 'project_root': function('ale#handlers#elixir#FindMixUmbrellaRoot'), \}) ale-4.0.0/ale_linters/elixir/mix.vim000066400000000000000000000026761476501472200174060ustar00rootroot00000000000000" Author: evnu - https://github.com/evnu " Author: colbydehart - https://github.com/colbydehart " Description: Mix compile checking for Elixir files function! ale_linters#elixir#mix#Handle(buffer, lines) abort " Matches patterns like the following: " " Error format " ** (CompileError) apps/sim/lib/sim/server.ex:87: undefined function update_in/4 " " TODO: Warning format " warning: variable "foobar" does not exist and is being expanded to "foobar()", please use parentheses to remove the ambiguity or change the variable name let l:pattern = '\v\(([^\)]+Error)\) ([^:]+):([^:]+): (.+)$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) let l:type = 'E' let l:text = l:match[4] call add(l:output, { \ 'bufnr': a:buffer, \ 'lnum': l:match[3] + 0, \ 'col': 0, \ 'type': l:type, \ 'text': l:text, \}) endfor return l:output endfunction function! ale_linters#elixir#mix#GetCommand(buffer) abort let l:temp_dir = ale#command#CreateDirectory(a:buffer) return ale#Env('MIX_BUILD_PATH', l:temp_dir) . 'mix compile %s' endfunction call ale#linter#Define('elixir', { \ 'name': 'mix', \ 'executable': 'mix', \ 'cwd': function('ale#handlers#elixir#FindMixProjectRoot'), \ 'command': function('ale_linters#elixir#mix#GetCommand'), \ 'callback': 'ale_linters#elixir#mix#Handle', \ 'lint_file': 1, \}) ale-4.0.0/ale_linters/elm/000077500000000000000000000000001476501472200153425ustar00rootroot00000000000000ale-4.0.0/ale_linters/elm/ls.vim000066400000000000000000000030541476501472200164770ustar00rootroot00000000000000" Author: antew - https://github.com/antew " Description: elm-language-server integration for elm (diagnostics, formatting, and more) call ale#Set('elm_ls_executable', 'elm-language-server') call ale#Set('elm_ls_use_global', get(g:, 'ale_use_global_executables', 1)) " elm-language-server will search for local and global binaries, if empty call ale#Set('elm_ls_elm_path', '') call ale#Set('elm_ls_elm_format_path', '') call ale#Set('elm_ls_elm_test_path', '') call ale#Set('elm_ls_elm_analyse_trigger', 'change') function! ale_linters#elm#ls#GetProjectRoot(buffer) abort let l:elm_json = ale#path#FindNearestFile(a:buffer, 'elm.json') return !empty(l:elm_json) ? fnamemodify(l:elm_json, ':p:h') : '' endfunction function! ale_linters#elm#ls#GetInitializationOptions(buffer) abort return { \ 'elmPath': ale#Var(a:buffer, 'elm_ls_elm_path'), \ 'elmFormatPath': ale#Var(a:buffer, 'elm_ls_elm_format_path'), \ 'elmTestPath': ale#Var(a:buffer, 'elm_ls_elm_test_path'), \ 'elmAnalyseTrigger': ale#Var(a:buffer, 'elm_ls_elm_analyse_trigger'), \} endfunction call ale#linter#Define('elm', { \ 'name': 'ls', \ 'aliases': ['elm_ls'], \ 'lsp': 'stdio', \ 'executable': {b -> ale#path#FindExecutable(b, 'elm_ls', [ \ 'node_modules/.bin/elm-language-server', \ 'node_modules/.bin/elm-lsp', \ 'elm-lsp' \ ])}, \ 'command': '%e --stdio', \ 'project_root': function('ale_linters#elm#ls#GetProjectRoot'), \ 'language': 'elm', \ 'initialization_options': function('ale_linters#elm#ls#GetInitializationOptions') \}) ale-4.0.0/ale_linters/elm/make.vim000066400000000000000000000203151476501472200167750ustar00rootroot00000000000000" Author: buffalocoder - https://github.com/buffalocoder, soywod - https://github.com/soywod, hecrj - https://github.com/hecrj " Description: Elm linting in Ale. Closely follows the Syntastic checker in https://github.com/ElmCast/elm-vim. call ale#Set('elm_make_executable', 'elm') call ale#Set('elm_make_use_global', get(g:, 'ale_use_global_executables', 0)) function! ale_linters#elm#make#Handle(buffer, lines) abort let l:output = [] let l:unparsed_lines = [] for l:line in a:lines if l:line[0] is# '{' " Elm 0.19 call ale_linters#elm#make#HandleElm019Line(l:line, l:output) elseif l:line[0] is# '[' " Elm 0.18 call ale_linters#elm#make#HandleElm018Line(l:line, l:output) elseif l:line isnot# 'Successfully generated /dev/null' call add(l:unparsed_lines, l:line) endif endfor if len(l:unparsed_lines) > 0 call add(l:output, { \ 'lnum': 1, \ 'type': 'E', \ 'text': l:unparsed_lines[0], \ 'detail': join(l:unparsed_lines, "\n") \}) endif return l:output endfunction function! ale_linters#elm#make#HandleElm019Line(line, output) abort let l:report = json_decode(a:line) if l:report.type is? 'error' " General problem let l:details = ale_linters#elm#make#ParseMessage(l:report.message) if empty(l:report.path) let l:report.path = 'Elm' endif if ale_linters#elm#make#FileIsBuffer(l:report.path) call add(a:output, { \ 'lnum': 1, \ 'type': 'E', \ 'text': l:details, \}) else call add(a:output, { \ 'lnum': 1, \ 'type': 'E', \ 'text': l:report.path .' - '. l:details, \ 'detail': l:report.path ." ----------\n\n". l:details, \}) endif else " Compilation errors for l:error in l:report.errors let l:file_is_buffer = ale_linters#elm#make#FileIsBuffer(l:error.path) for l:problem in l:error.problems let l:details = ale_linters#elm#make#ParseMessage(l:problem.message) if l:file_is_buffer " Buffer module has problems call add(a:output, { \ 'lnum': l:problem.region.start.line, \ 'col': l:problem.region.start.column, \ 'end_lnum': l:problem.region.end.line, \ 'end_col': l:problem.region.end.column, \ 'type': 'E', \ 'text': l:details, \}) else " Imported module has problems let l:location = l:error.path .':'. l:problem.region.start.line call add(a:output, { \ 'lnum': 1, \ 'type': 'E', \ 'text': l:location .' - '. l:details, \ 'detail': l:location ." ----------\n\n". l:details, \}) endif endfor endfor endif endfunction function! ale_linters#elm#make#HandleElm018Line(line, output) abort let l:errors = json_decode(a:line) for l:error in l:errors let l:file_is_buffer = ale_linters#elm#make#FileIsBuffer(l:error.file) if l:file_is_buffer " Current buffer has problems call add(a:output, { \ 'lnum': l:error.region.start.line, \ 'col': l:error.region.start.column, \ 'end_lnum': l:error.region.end.line, \ 'end_col': l:error.region.end.column, \ 'type': (l:error.type is? 'error') ? 'E' : 'W', \ 'text': l:error.overview, \ 'detail': l:error.overview . "\n\n" . l:error.details \}) elseif l:error.type is? 'error' " Imported module has errors let l:location = l:error.file .':'. l:error.region.start.line call add(a:output, { \ 'lnum': 1, \ 'type': 'E', \ 'text': l:location .' - '. l:error.overview, \ 'detail': l:location ." ----------\n\n". l:error.overview . "\n\n" . l:error.details \}) endif endfor endfunction function! ale_linters#elm#make#FileIsBuffer(path) abort return ale#path#IsTempName(a:path) endfunction function! ale_linters#elm#make#ParseMessage(message) abort return join(map(copy(a:message), 'ale_linters#elm#make#ParseMessageItem(v:val)'), '') endfunction function! ale_linters#elm#make#ParseMessageItem(item) abort if type(a:item) is v:t_string return a:item else return a:item.string endif endfunction function! ale_linters#elm#make#GetPackageFile(buffer) abort let l:elm_json = ale#path#FindNearestFile(a:buffer, 'elm.json') if empty(l:elm_json) " Fallback to Elm 0.18 let l:elm_json = ale#path#FindNearestFile(a:buffer, 'elm-package.json') endif return l:elm_json endfunction function! ale_linters#elm#make#IsVersionGte19(buffer) abort let l:elm_json = ale_linters#elm#make#GetPackageFile(a:buffer) if l:elm_json =~# '-package' return 0 else return 1 endif endfunction function! ale_linters#elm#make#GetRootDir(buffer) abort let l:elm_json = ale_linters#elm#make#GetPackageFile(a:buffer) if empty(l:elm_json) return '' else return fnamemodify(l:elm_json, ':p:h') endif endfunction function! ale_linters#elm#make#IsTest(buffer) abort let l:root_dir = ale_linters#elm#make#GetRootDir(a:buffer) if empty(l:root_dir) return 0 endif let l:tests_dir = join([l:root_dir, 'tests', ''], has('win32') ? '\' : '/') let l:buffer_path = fnamemodify(bufname(a:buffer), ':p') if stridx(l:buffer_path, l:tests_dir) == 0 return 1 else return 0 endif endfunction function! ale_linters#elm#make#GetCwd(buffer) abort let l:root_dir = ale_linters#elm#make#GetRootDir(a:buffer) return !empty(l:root_dir) ? l:root_dir : '' endfunction " Return the command to execute the linter in the projects directory. " If it doesn't, then this will fail when imports are needed. function! ale_linters#elm#make#GetCommand(buffer) abort let l:executable = ale_linters#elm#make#GetExecutable(a:buffer) let l:is_v19 = ale_linters#elm#make#IsVersionGte19(a:buffer) let l:is_using_elm_test = l:executable =~# 'elm-test$' " elm-test needs to know the path of elm-make if elm isn't installed globally. " https://github.com/rtfeldman/node-test-runner/blob/57728f10668f2d2ab3179e7e3208bcfa9a1f19aa/README.md#--compiler if l:is_v19 && l:is_using_elm_test let l:elm_make_executable = ale#path#FindExecutable(a:buffer, 'elm_make', ['node_modules/.bin/elm']) let l:elm_test_compiler_flag = ' --compiler ' . l:elm_make_executable . ' ' else let l:elm_test_compiler_flag = ' ' endif " The elm compiler, at the time of this writing, uses '/dev/null' as " a sort of flag to tell the compiler not to generate an output file, " which is why this is hard coded here. " Source: https://github.com/elm-lang/elm-compiler/blob/19d5a769b30ec0b2fc4475985abb4cd94cd1d6c3/builder/src/Generate/Output.hs#L253 return '%e make --report=json --output=/dev/null' \ . l:elm_test_compiler_flag \ . '%t' endfunction function! ale_linters#elm#make#GetExecutable(buffer) abort let l:is_test = ale_linters#elm#make#IsTest(a:buffer) let l:is_v19 = ale_linters#elm#make#IsVersionGte19(a:buffer) if l:is_test && l:is_v19 return ale#path#FindExecutable( \ a:buffer, \ 'elm_make', \ ['node_modules/.bin/elm-test', 'node_modules/.bin/elm'] \) else return ale#path#FindExecutable(a:buffer, 'elm_make', ['node_modules/.bin/elm']) endif endfunction call ale#linter#Define('elm', { \ 'name': 'make', \ 'executable': function('ale_linters#elm#make#GetExecutable'), \ 'output_stream': 'both', \ 'cwd': function('ale_linters#elm#make#GetCwd'), \ 'command': function('ale_linters#elm#make#GetCommand'), \ 'callback': 'ale_linters#elm#make#Handle' \}) ale-4.0.0/ale_linters/erlang/000077500000000000000000000000001476501472200160355ustar00rootroot00000000000000ale-4.0.0/ale_linters/erlang/dialyzer.vim000066400000000000000000000061441476501472200204020ustar00rootroot00000000000000" Author: Autoine Gagne - https://github.com/AntoineGagne " Description: Define a checker that runs dialyzer on Erlang files. let g:ale_erlang_dialyzer_executable = \ get(g:, 'ale_erlang_dialyzer_executable', 'dialyzer') let g:ale_erlang_dialyzer_options = \ get(g:, 'ale_erlang_dialyzer_options', '-Wunmatched_returns' \ . ' -Werror_handling' \ . ' -Wrace_conditions' \ . ' -Wunderspecs') let g:ale_erlang_dialyzer_plt_file = \ get(g:, 'ale_erlang_dialyzer_plt_file', '') let g:ale_erlang_dialyzer_rebar3_profile = \ get(g:, 'ale_erlang_dialyzer_rebar3_profile', 'default') function! ale_linters#erlang#dialyzer#GetRebar3Profile(buffer) abort return ale#Var(a:buffer, 'erlang_dialyzer_rebar3_profile') endfunction function! ale_linters#erlang#dialyzer#FindPlt(buffer) abort let l:plt_file = '' let l:rebar3_profile = ale_linters#erlang#dialyzer#GetRebar3Profile(a:buffer) let l:plt_file_directory = ale#path#FindNearestDirectory(a:buffer, '_build/' . l:rebar3_profile) if !empty(l:plt_file_directory) let l:plt_file = globpath(l:plt_file_directory, '*_plt', 0, 1) endif if !empty(l:plt_file) return l:plt_file[0] endif if !empty($REBAR_PLT_DIR) return expand('$REBAR_PLT_DIR/dialyzer/plt') endif return expand('$HOME/.dialyzer_plt') endfunction function! ale_linters#erlang#dialyzer#GetPlt(buffer) abort let l:plt_file = ale#Var(a:buffer, 'erlang_dialyzer_plt_file') if !empty(l:plt_file) return l:plt_file endif return ale_linters#erlang#dialyzer#FindPlt(a:buffer) endfunction function! ale_linters#erlang#dialyzer#GetExecutable(buffer) abort return ale#Var(a:buffer, 'erlang_dialyzer_executable') endfunction function! ale_linters#erlang#dialyzer#GetCommand(buffer) abort let l:options = ale#Var(a:buffer, 'erlang_dialyzer_options') let l:command = ale#Escape(ale_linters#erlang#dialyzer#GetExecutable(a:buffer)) \ . ' -n' \ . ' --plt ' . ale#Escape(ale_linters#erlang#dialyzer#GetPlt(a:buffer)) \ . ' ' . l:options \ . ' %s' return l:command endfunction function! ale_linters#erlang#dialyzer#Handle(buffer, lines) abort " Match patterns like the following: " " erl_tidy_prv_fmt.erl:3: Callback info about the provider behaviour is not available let l:pattern = '^\S\+:\(\d\+\): \(.\+\)$' let l:output = [] for l:line in a:lines let l:match = matchlist(l:line, l:pattern) if len(l:match) != 0 let l:code = l:match[2] call add(l:output, { \ 'lnum': str2nr(l:match[1]), \ 'lcol': 0, \ 'text': l:code, \ 'type': 'W' \}) endif endfor return l:output endfunction call ale#linter#Define('erlang', { \ 'name': 'dialyzer', \ 'executable': function('ale_linters#erlang#dialyzer#GetExecutable'), \ 'command': function('ale_linters#erlang#dialyzer#GetCommand'), \ 'callback': function('ale_linters#erlang#dialyzer#Handle'), \ 'lint_file': 1 \}) ale-4.0.0/ale_linters/erlang/elvis.vim000066400000000000000000000031661476501472200177020ustar00rootroot00000000000000" Author: Dmitri Vereshchagin " Description: Elvis linter for Erlang files call ale#Set('erlang_elvis_executable', 'elvis') function! ale_linters#erlang#elvis#Handle(buffer, lines) abort let l:pattern = '\v:(\d+):[^:]+:(.+)' let l:loclist = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) call add(l:loclist, { \ 'lnum': str2nr(l:match[1]), \ 'text': s:AbbreviateMessage(l:match[2]), \ 'type': 'W', \ 'sub_type': 'style', \}) endfor return l:loclist endfunction function! s:AbbreviateMessage(text) abort let l:pattern = '\v\c^(line \d+ is too long):.*$' return substitute(a:text, l:pattern, '\1.', '') endfunction function! s:GetCommand(buffer) abort let l:cwd = s:GetCwd(a:buffer) let l:file = !empty(l:cwd) \ ? expand('#' . a:buffer . ':p')[len(l:cwd) + 1:] \ : expand('#' . a:buffer . ':.') return '%e rock --output-format=parsable ' . ale#Escape(l:file) endfunction function! s:GetCwd(buffer) abort let l:markers = ['elvis.config', 'rebar.lock', 'erlang.mk'] for l:path in ale#path#Upwards(expand('#' . a:buffer . ':p:h')) for l:marker in l:markers if filereadable(l:path . '/' . l:marker) return l:path endif endfor endfor return '' endfunction call ale#linter#Define('erlang', { \ 'name': 'elvis', \ 'callback': 'ale_linters#erlang#elvis#Handle', \ 'executable': {b -> ale#Var(b, 'erlang_elvis_executable')}, \ 'command': function('s:GetCommand'), \ 'cwd': function('s:GetCwd'), \ 'lint_file': 1, \}) ale-4.0.0/ale_linters/erlang/erlang_ls.vim000066400000000000000000000031371476501472200205240ustar00rootroot00000000000000" Author: Dmitri Vereshchagin " Description: LSP linter for Erlang files call ale#Set('erlang_erlang_ls_executable', 'erlang_ls') call ale#Set('erlang_erlang_ls_log_dir', '') call ale#Set('erlang_erlang_ls_log_level', 'info') function! s:GetCommand(buffer) abort let l:log_dir = ale#Var(a:buffer, 'erlang_erlang_ls_log_dir') let l:log_level = ale#Var(a:buffer, 'erlang_erlang_ls_log_level') let l:command = '%e' if !empty(l:log_dir) let l:command .= ' --log-dir=' . ale#Escape(l:log_dir) endif let l:command .= ' --log-level=' . ale#Escape(l:log_level) return l:command endfunction function! s:FindProjectRoot(buffer) abort let l:markers = [ \ '_checkouts/', \ '_build/', \ 'deps/', \ 'erlang_ls.config', \ 'rebar.lock', \ 'erlang.mk', \] " This is a way to find Erlang/OTP root (the one that is managed " by kerl or asdf). Useful if :ALEGoToDefinition takes us there. let l:markers += ['.kerl_config'] for l:marker in l:markers let l:path = l:marker[-1:] is# '/' \ ? ale#path#FindNearestDirectory(a:buffer, l:marker) \ : ale#path#FindNearestFile(a:buffer, l:marker) if !empty(l:path) return ale#path#Dirname(l:path) endif endfor return '' endfunction call ale#linter#Define('erlang', { \ 'name': 'erlang_ls', \ 'executable': {b -> ale#Var(b, 'erlang_erlang_ls_executable')}, \ 'command': function('s:GetCommand'), \ 'lsp': 'stdio', \ 'project_root': function('s:FindProjectRoot'), \ 'aliases': ['erlang-ls'], \}) ale-4.0.0/ale_linters/erlang/erlc.vim000066400000000000000000000066101476501472200175020ustar00rootroot00000000000000" Author: Magnus Ottenklinger - https://github.com/evnu let g:ale_erlang_erlc_executable = get(g:, 'ale_erlang_erlc_executable', 'erlc') let g:ale_erlang_erlc_options = get(g:, 'ale_erlang_erlc_options', '') function! ale_linters#erlang#erlc#GetExecutable(buffer) abort return ale#Var(a:buffer, 'erlang_erlc_executable') endfunction function! ale_linters#erlang#erlc#GetCommand(buffer) abort let l:output_file = ale#util#Tempname() call ale#command#ManageFile(a:buffer, l:output_file) let l:command = ale#Escape(ale_linters#erlang#erlc#GetExecutable(a:buffer)) \ . ' -o ' . ale#Escape(l:output_file) \ . ' ' . ale#Var(a:buffer, 'erlang_erlc_options') \ . ' %t' return l:command endfunction function! ale_linters#erlang#erlc#Handle(buffer, lines) abort " Matches patterns like the following: " " error.erl:4: variable 'B' is unbound " error.erl:3: Warning: function main/0 is unused " error.erl:4: Warning: variable 'A' is unused let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):(\d+:)? (Warning: )?(.+)$' " parse_transforms are a special case. The error message does not indicate a location: " error.erl: undefined parse transform 'some_parse_transform' let l:pattern_parse_transform = '\v(undefined parse transform .*)$' let l:output = [] let l:pattern_no_module_definition = '\v(no module definition)$' let l:pattern_unused = '\v(.* is unused)$' let l:is_hrl = fnamemodify(bufname(a:buffer), ':e') is# 'hrl' for l:line in a:lines let l:match = matchlist(l:line, l:pattern) " Determine if the output indicates an error. We distinguish between two cases: " " 1) normal errors match l:pattern " 2) parse_transform errors match l:pattern_parse_transform " " If none of the patterns above match, the line can be ignored if len(l:match) == 0 " not a 'normal' warning or error let l:match_parse_transform = matchlist(l:line, l:pattern_parse_transform) if len(l:match_parse_transform) == 0 " also not a parse_transform error continue endif call add(l:output, { \ 'bufnr': a:buffer, \ 'lnum': 0, \ 'col': 0, \ 'type': 'E', \ 'text': l:match_parse_transform[0], \}) continue endif let l:line = l:match[2] let l:warning_or_text = l:match[4] let l:text = l:match[5] " If this file is a header .hrl, ignore the following expected messages: " - 'no module definition' " - 'X is unused' if l:is_hrl && ( \ match(l:text, l:pattern_no_module_definition) != -1 \ || match(l:text, l:pattern_unused) != -1 \) continue endif if !empty(l:warning_or_text) let l:type = 'W' else let l:type = 'E' endif call add(l:output, { \ 'bufnr': a:buffer, \ 'lnum': l:line, \ 'col': 0, \ 'type': l:type, \ 'text': l:text, \}) endfor return l:output endfunction call ale#linter#Define('erlang', { \ 'name': 'erlc', \ 'executable': function('ale_linters#erlang#erlc#GetExecutable'), \ 'command': function('ale_linters#erlang#erlc#GetCommand'), \ 'callback': 'ale_linters#erlang#erlc#Handle', \}) ale-4.0.0/ale_linters/erlang/syntaxerl.vim000066400000000000000000000024631476501472200206100ustar00rootroot00000000000000" Author: Dmitri Vereshchagin " Description: SyntaxErl linter for Erlang files call ale#Set('erlang_syntaxerl_executable', 'syntaxerl') function! ale_linters#erlang#syntaxerl#Handle(buffer, lines) abort let l:pattern = '\v\C:(\d+):( warning:)? (.+)' let l:loclist = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) call add(l:loclist, { \ 'lnum': str2nr(l:match[1]), \ 'text': l:match[3], \ 'type': empty(l:match[2]) ? 'E' : 'W', \}) endfor return l:loclist endfunction function! s:GetExecutable(buffer) abort return ale#Var(a:buffer, 'erlang_syntaxerl_executable') endfunction function! s:GetCommand(buffer) abort let l:Callback = function('s:GetCommandFromHelpOutput') return ale#command#Run(a:buffer, '%e -h', l:Callback, { \ 'executable': s:GetExecutable(a:buffer), \}) endfunction function! s:GetCommandFromHelpOutput(buffer, output, metadata) abort let l:has_b_option = match(a:output, '\V\C-b, --base\>') > -1 return l:has_b_option ? '%e -b %s %t' : '%e %t' endfunction call ale#linter#Define('erlang', { \ 'name': 'syntaxerl', \ 'callback': 'ale_linters#erlang#syntaxerl#Handle', \ 'executable': function('s:GetExecutable'), \ 'command': function('s:GetCommand'), \}) ale-4.0.0/ale_linters/eruby/000077500000000000000000000000001476501472200157135ustar00rootroot00000000000000ale-4.0.0/ale_linters/eruby/erb.vim000066400000000000000000000017401476501472200172020ustar00rootroot00000000000000" Author: Matthias Guenther - https://wikimatze.de, Eddie Lebow https://github.com/elebow " Description: ERB from the Ruby standard library, for eruby/erb files function! ale_linters#eruby#erb#GetCommand(buffer) abort let l:rails_root = ale#ruby#FindRailsRoot(a:buffer) if empty(l:rails_root) return 'erb -P -T - -x %t | ruby -c' endif " Rails-flavored eRuby does not comply with the standard as understood by " ERB, so we'll have to do some substitution. This does not reduce the " effectiveness of the linter—the translated code is still evaluated. return 'ruby -r erb -e ' . ale#Escape('puts ERB.new($stdin.read.gsub(%{<%=},%{<%}), trim_mode: %{-}).src') . '< %t | ruby -c' endfunction call ale#linter#Define('eruby', { \ 'name': 'erb', \ 'aliases': ['erubylint'], \ 'executable': 'erb', \ 'output_stream': 'stderr', \ 'command': function('ale_linters#eruby#erb#GetCommand'), \ 'callback': 'ale#handlers#ruby#HandleSyntaxErrors', \}) ale-4.0.0/ale_linters/eruby/erblint.vim000066400000000000000000000030721476501472200200710ustar00rootroot00000000000000" Author: Roeland Moors - https://github.com/roelandmoors " based on the ale ruumba and robocop linters " Description: ERB Lint, support for https://github.com/Shopify/erb-lint call ale#Set('eruby_erblint_executable', 'erblint') call ale#Set('eruby_erblint_options', '') function! ale_linters#eruby#erblint#GetCommand(buffer) abort let l:executable = ale#Var(a:buffer, 'eruby_erblint_executable') return ale#ruby#EscapeExecutable(l:executable, 'erblint') \ . ' --format json ' \ . ale#Var(a:buffer, 'eruby_erblint_options') \ . ' --stdin %s' endfunction function! ale_linters#eruby#erblint#Handle(buffer, lines) abort if empty(a:lines) return [] endif let l:errors = ale#util#FuzzyJSONDecode(a:lines[0], []) if !has_key(l:errors, 'summary') \|| l:errors['summary']['offenses'] == 0 \|| empty(l:errors['files']) return [] endif let l:output = [] for l:error in l:errors['files'][0]['offenses'] call add(l:output, { \ 'lnum': l:error['location']['start_line'] + 0, \ 'col': l:error['location']['start_column'] + 0, \ 'end_col': l:error['location']['last_column'] + 0, \ 'code': l:error['linter'], \ 'text': l:error['message'], \ 'type': 'W', \}) endfor return l:output endfunction call ale#linter#Define('eruby', { \ 'name': 'erblint', \ 'executable': {b -> ale#Var(b, 'eruby_erblint_executable')}, \ 'command': function('ale_linters#eruby#erblint#GetCommand'), \ 'callback': 'ale_linters#eruby#erblint#Handle', \}) ale-4.0.0/ale_linters/eruby/erubi.vim000066400000000000000000000024201476501472200175340ustar00rootroot00000000000000" Author: Eddie Lebow https://github.com/elebow " Description: eruby checker using `erubi` function! ale_linters#eruby#erubi#GetCommand(buffer, output, meta) abort let l:rails_root = ale#ruby#FindRailsRoot(a:buffer) if !empty(a:output) " The empty command in CheckErubi returns nothing if erubi runs and " emits an error if erubi is not present return '' endif if empty(l:rails_root) return 'ruby -r erubi/capture_end -e ' . ale#Escape('puts Erubi::CaptureEndEngine.new($stdin.read).src') . '< %t | ruby -c' endif " Rails-flavored eRuby does not comply with the standard as understood by " Erubi, so we'll have to do some substitution. This does not reduce the " effectiveness of the linter---the translated code is still evaluated. return 'ruby -r erubi/capture_end -e ' . ale#Escape('puts Erubi::CaptureEndEngine.new($stdin.read.gsub(%{<%=},%{<%}), nil, %{-}).src') . '< %t | ruby -c' endfunction call ale#linter#Define('eruby', { \ 'name': 'erubi', \ 'executable': 'ruby', \ 'command': {buffer -> ale#command#Run( \ buffer, \ 'ruby -r erubi/capture_end -e ' . ale#Escape('""'), \ function('ale_linters#eruby#erubi#GetCommand'), \ )}, \ 'callback': 'ale#handlers#ruby#HandleSyntaxErrors', \}) ale-4.0.0/ale_linters/eruby/erubis.vim000066400000000000000000000016701476501472200177250ustar00rootroot00000000000000" Author: Jake Zimmerman , Eddie Lebow https://github.com/elebow " Description: eruby checker using `erubis`, instead of `erb` function! ale_linters#eruby#erubis#GetCommand(buffer) abort let l:rails_root = ale#ruby#FindRailsRoot(a:buffer) if empty(l:rails_root) return 'erubis -x %t | ruby -c' endif " Rails-flavored eRuby does not comply with the standard as understood by " Erubis, so we'll have to do some substitution. This does not reduce the " effectiveness of the linter - the translated code is still evaluated. return 'ruby -r erubis -e ' . ale#Escape('puts Erubis::Eruby.new($stdin.read.gsub(%{<%=},%{<%})).src') . '< %t | ruby -c' endfunction call ale#linter#Define('eruby', { \ 'name': 'erubis', \ 'executable': 'erubis', \ 'output_stream': 'stderr', \ 'command': function('ale_linters#eruby#erubis#GetCommand'), \ 'callback': 'ale#handlers#ruby#HandleSyntaxErrors', \}) ale-4.0.0/ale_linters/eruby/ruumba.vim000066400000000000000000000035021476501472200177230ustar00rootroot00000000000000" Author: aclemons - https://github.com/aclemons " based on the ale rubocop linter " Description: Ruumba, RuboCop linting for ERB templates. call ale#Set('eruby_ruumba_executable', 'ruumba') call ale#Set('eruby_ruumba_options', '') function! ale_linters#eruby#ruumba#GetCommand(buffer) abort let l:executable = ale#Var(a:buffer, 'eruby_ruumba_executable') return ale#ruby#EscapeExecutable(l:executable, 'ruumba') \ . ' --format json --force-exclusion ' \ . ale#Var(a:buffer, 'eruby_ruumba_options') \ . ' --stdin %s' endfunction function! ale_linters#eruby#ruumba#Handle(buffer, lines) abort try let l:errors = json_decode(a:lines[0]) catch return [] endtry if !has_key(l:errors, 'summary') \|| l:errors['summary']['offense_count'] == 0 \|| empty(l:errors['files']) return [] endif let l:output = [] for l:error in l:errors['files'][0]['offenses'] let l:start_col = l:error['location']['column'] + 0 call add(l:output, { \ 'lnum': l:error['location']['line'] + 0, \ 'col': l:start_col, \ 'end_col': l:start_col + l:error['location']['length'] - 1, \ 'code': l:error['cop_name'], \ 'text': l:error['message'], \ 'type': ale_linters#eruby#ruumba#GetType(l:error['severity']), \}) endfor return l:output endfunction function! ale_linters#eruby#ruumba#GetType(severity) abort if a:severity is? 'convention' \|| a:severity is? 'warning' \|| a:severity is? 'refactor' return 'W' endif return 'E' endfunction call ale#linter#Define('eruby', { \ 'name': 'ruumba', \ 'executable': {b -> ale#Var(b, 'eruby_ruumba_executable')}, \ 'command': function('ale_linters#eruby#ruumba#GetCommand'), \ 'callback': 'ale_linters#eruby#ruumba#Handle', \}) ale-4.0.0/ale_linters/fish/000077500000000000000000000000001476501472200155165ustar00rootroot00000000000000ale-4.0.0/ale_linters/fish/fish.vim000066400000000000000000000042011476501472200171610ustar00rootroot00000000000000" Author: Niraj Thapaliya - https://github.com/nthapaliya " Description: Lints fish files using fish -n function! ale_linters#fish#fish#Handle(buffer, lines) abort " Matches patterns such as: " " home/.config/fish/functions/foo.fish (line 1): Missing end to balance this function definition " function foo " ^ " " OR, patterns such as: " " Unsupported use of '||'. In fish, please use 'COMMAND; or COMMAND'. " /tmp/vLz620o/258/test.fish (line 2): if set -q SSH_CLIENT || set -q SSH_TTY " ^ " " fish -n can return errors in either format. let l:pattern = '^\(.* (line \(\d\+\)): \)\(.*\)$' let l:column_pattern = '^ *\^' let l:output = [] let l:column_offset = 0 let l:last_line_with_message = '' for l:line in a:lines " Look for error lines first. let l:match = matchlist(l:line, l:pattern) if !empty(l:match) if !empty(l:last_line_with_message) let l:text = l:last_line_with_message else let l:text = l:match[3] endif let l:column_offset = len(l:match[1]) let l:last_line_with_message = '' call add(l:output, { \ 'col': 0, \ 'lnum': str2nr(l:match[2]), \ 'text': l:text, \}) else " Look for column markers like ' ^' second. " The column index will be set according to how long the line is. let l:column_match = matchstr(l:line, l:column_pattern) if !empty(l:column_match) && !empty(l:output) let l:output[-1].col = len(l:column_match) - l:column_offset let l:last_line_with_message = '' else let l:last_line_with_message = l:line let l:column_offset = 0 endif endif endfor return l:output endfunction call ale#linter#Define('fish', { \ 'name': 'fish', \ 'output_stream': 'stderr', \ 'executable': 'fish', \ 'command': 'fish -n %t', \ 'callback': 'ale_linters#fish#fish#Handle', \}) ale-4.0.0/ale_linters/fortran/000077500000000000000000000000001476501472200162405ustar00rootroot00000000000000ale-4.0.0/ale_linters/fortran/gcc.vim000066400000000000000000000044051476501472200175140ustar00rootroot00000000000000" Author: w0rp " Description: gcc for Fortran files " This option can be set to 0 to use -ffixed-form call ale#Set('fortran_gcc_use_free_form', 1) call ale#Set('fortran_gcc_executable', 'gcc') " Set this option to change the GCC options for warnings for Fortran. call ale#Set('fortran_gcc_options', '-Wall') function! ale_linters#fortran#gcc#Handle(buffer, lines) abort " We have to match a starting line and a later ending line together, " like so. " " :21.34: " Error: Expected comma in I/O list at (1) let l:line_marker_pattern = ':\(\d\+\)[.:]\=\(\d\+\)\=:\=$' let l:message_pattern = '^\(Error\|Warning\): \(.\+\)$' let l:looking_for_message = 0 let l:last_loclist_obj = {} let l:output = [] for l:line in a:lines if l:looking_for_message let l:match = matchlist(l:line, l:message_pattern) else let l:match = matchlist(l:line, l:line_marker_pattern) endif if len(l:match) == 0 continue endif if l:looking_for_message let l:looking_for_message = 0 " Now we have the text, we can set it and add the error. let l:last_loclist_obj.text = l:match[2] let l:last_loclist_obj.type = l:match[1] is# 'Warning' ? 'W' : 'E' call add(l:output, l:last_loclist_obj) else let l:last_loclist_obj = { \ 'bufnr': a:buffer, \ 'lnum': l:match[1] + 0, \ 'col': l:match[2] + 0, \} " Start looking for the message and error type. let l:looking_for_message = 1 endif endfor return l:output endfunction function! ale_linters#fortran#gcc#GetCommand(buffer) abort let l:layout_option = ale#Var(a:buffer, 'fortran_gcc_use_free_form') \ ? '-ffree-form' \ : '-ffixed-form' return '%e -S -x f95 -fsyntax-only ' . l:layout_option \ . ale#Pad(ale#Var(a:buffer, 'fortran_gcc_options')) \ . ' -' endfunction call ale#linter#Define('fortran', { \ 'name': 'gcc', \ 'output_stream': 'stderr', \ 'executable': {b -> ale#Var(b, 'fortran_gcc_executable')}, \ 'command': function('ale_linters#fortran#gcc#GetCommand'), \ 'callback': 'ale_linters#fortran#gcc#Handle', \}) ale-4.0.0/ale_linters/fortran/language_server.vim000066400000000000000000000014141476501472200221260ustar00rootroot00000000000000" Author: unpairedbracket ben.spiers22@gmail.com " Description: A language server for fortran call ale#Set('fortran_language_server_executable', 'fortls') call ale#Set('fortran_language_server_use_global', get(g:, 'ale_use_global_executables', 0)) function! ale_linters#fortran#language_server#GetProjectRoot(buffer) abort let l:fortls_file = ale#path#FindNearestFile(a:buffer, '.fortls') return !empty(l:fortls_file) ? fnamemodify(l:fortls_file, ':h') : '' endfunction call ale#linter#Define('fortran', { \ 'name': 'language_server', \ 'aliases': ['fortls'], \ 'lsp': 'stdio', \ 'executable': {b -> ale#Var(b, 'fortran_language_server_executable')}, \ 'command': '%e', \ 'project_root': function('ale_linters#fortran#language_server#GetProjectRoot'), \}) ale-4.0.0/ale_linters/fountain/000077500000000000000000000000001476501472200164105ustar00rootroot00000000000000ale-4.0.0/ale_linters/fountain/proselint.vim000066400000000000000000000004421476501472200211440ustar00rootroot00000000000000" Author: Jansen Mitchell https://github.com/JansenMitchell " Description: proselint for Fountain files call ale#linter#Define('fountain', { \ 'name': 'proselint', \ 'executable': 'proselint', \ 'command': 'proselint %t', \ 'callback': 'ale#handlers#unix#HandleAsWarning', \}) ale-4.0.0/ale_linters/fuse/000077500000000000000000000000001476501472200155275ustar00rootroot00000000000000ale-4.0.0/ale_linters/fuse/fusionlint.vim000066400000000000000000000020631476501472200204370ustar00rootroot00000000000000" Author: RyanSquared " Description: `fusion-lint` linter for FusionScript files call ale#Set('fuse_fusionlint_executable', 'fusion-lint') call ale#Set('fuse_fusionlint_options', '') function! ale_linters#fuse#fusionlint#GetCommand(buffer) abort return '%e' . ale#Pad(ale#Var(a:buffer, 'fuse_fusionlint_options')) \ . ' --filename %s -i' endfunction function! ale_linters#fuse#fusionlint#Handle(buffer, lines) abort let l:pattern = '^.*:\(\d\+\):\(\d\+\): (\([WE]\)\d\+) \(.\+\)$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) call add(l:output, { \ 'lnum': l:match[1] + 0, \ 'col': l:match[2] + 0, \ 'text': l:match[4], \ 'type': l:match[3], \}) endfor return l:output endfunction call ale#linter#Define('fuse', { \ 'name': 'fusionlint', \ 'executable': {b -> ale#Var(b, 'fuse_fusionlint_executable')}, \ 'command': function('ale_linters#fuse#fusionlint#GetCommand'), \ 'callback': 'ale_linters#fuse#fusionlint#Handle', \}) ale-4.0.0/ale_linters/gitcommit/000077500000000000000000000000001476501472200165615ustar00rootroot00000000000000ale-4.0.0/ale_linters/gitcommit/gitlint.vim000066400000000000000000000031211476501472200207450ustar00rootroot00000000000000" Author: Nick Yamane " Description: gitlint for git commit message files call ale#Set('gitcommit_gitlint_executable', 'gitlint') call ale#Set('gitcommit_gitlint_options', '') call ale#Set('gitcommit_gitlint_use_global', get(g:, 'ale_use_global_executables', 0)) function! ale_linters#gitcommit#gitlint#GetExecutable(buffer) abort return ale#python#FindExecutable(a:buffer, 'gitcommit_gitlint', ['gitlint']) endfunction function! ale_linters#gitcommit#gitlint#GetCommand(buffer) abort let l:options = ale#Var(a:buffer, 'gitcommit_gitlint_options') return '%e' . ale#Pad(l:options) . ' lint' endfunction function! ale_linters#gitcommit#gitlint#Handle(buffer, lines) abort " Matches patterns line the following: let l:pattern = '\v^(\d+): (\w+) (.*)$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) let l:code = l:match[2] if !ale#Var(a:buffer, 'warn_about_trailing_whitespace') if l:code is# 'T2' || l:code is# 'B2' continue endif endif let l:item = { \ 'lnum': l:match[1] + 0, \ 'text': l:match[3], \ 'code': l:code, \ 'type': 'E', \} call add(l:output, l:item) endfor return l:output endfunction call ale#linter#Define('gitcommit', { \ 'name': 'gitlint', \ 'output_stream': 'stderr', \ 'executable': function('ale_linters#gitcommit#gitlint#GetExecutable'), \ 'command': function('ale_linters#gitcommit#gitlint#GetCommand'), \ 'callback': 'ale_linters#gitcommit#gitlint#Handle', \}) ale-4.0.0/ale_linters/gleam/000077500000000000000000000000001476501472200156525ustar00rootroot00000000000000ale-4.0.0/ale_linters/gleam/gleamlsp.vim000066400000000000000000000012001476501472200201640ustar00rootroot00000000000000" Author: Jonathan Palardt https://github.com/jpalardy " Description: Support for Gleam Language Server call ale#Set('gleam_gleamlsp_executable', 'gleam') function! ale_linters#gleam#gleamlsp#GetProjectRoot(buffer) abort let l:gleam_toml = ale#path#FindNearestFile(a:buffer, 'gleam.toml') return !empty(l:gleam_toml) ? fnamemodify(l:gleam_toml, ':p:h') : '' endfunction call ale#linter#Define('gleam', { \ 'name': 'gleamlsp', \ 'lsp': 'stdio', \ 'executable': {buffer -> ale#Var(buffer, 'gleam_gleamlsp_executable')}, \ 'command': '%e lsp', \ 'project_root': function('ale_linters#gleam#gleamlsp#GetProjectRoot'), \}) ale-4.0.0/ale_linters/glimmer/000077500000000000000000000000001476501472200162215ustar00rootroot00000000000000ale-4.0.0/ale_linters/glimmer/embertemplatelint.vim000066400000000000000000000003101476501472200224450ustar00rootroot00000000000000" Author: Sam Saffron " Description: Ember-template-lint for checking GJS (Glimmer JS) files scriptencoding utf-8 call ale#handlers#embertemplatelint#DefineLinter('glimmer') ale-4.0.0/ale_linters/glsl/000077500000000000000000000000001476501472200155265ustar00rootroot00000000000000ale-4.0.0/ale_linters/glsl/glslang.vim000066400000000000000000000025211476501472200176720ustar00rootroot00000000000000" Author: Sven-Hendrik Haase " Description: glslang-based linter for glsl files " " TODO: Once https://github.com/KhronosGroup/glslang/pull/1047 is accepted, " we can use stdin. call ale#Set('glsl_glslang_executable', 'glslangValidator') call ale#Set('glsl_glslang_options', '') function! ale_linters#glsl#glslang#GetCommand(buffer) abort return '%e' \ . ale#Pad(ale#Var(a:buffer, 'glsl_glslang_options')) \ . ' -C %t' endfunction function! ale_linters#glsl#glslang#Handle(buffer, lines) abort " Matches patterns like the following: " " ERROR: 0:5: 'foo' : undeclared identifier " or when using options like -V or -G or --target-env " ERROR: filename:5: 'foo' : undeclared identifier let l:pattern = '^\(.\+\): \(.\+\):\(\d\+\): \(.\+\)' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) call add(l:output, { \ 'lnum': str2nr(l:match[3]), \ 'col' : 0, \ 'text': l:match[4], \ 'type': l:match[1] is# 'ERROR' ? 'E' : 'W', \}) endfor return l:output endfunction call ale#linter#Define('glsl', { \ 'name': 'glslang', \ 'executable': {b -> ale#Var(b, 'glsl_glslang_executable')}, \ 'command': function('ale_linters#glsl#glslang#GetCommand'), \ 'callback': 'ale_linters#glsl#glslang#Handle', \}) ale-4.0.0/ale_linters/glsl/glslls.vim000066400000000000000000000017201476501472200175430ustar00rootroot00000000000000" Author: Sven-Hendrik Haase " Description: A language server for glsl call ale#Set('glsl_glslls_executable', 'glslls') call ale#Set('glsl_glslls_logfile', '') function! ale_linters#glsl#glslls#GetCommand(buffer) abort let l:logfile = ale#Var(a:buffer, 'glsl_glslls_logfile') let l:logfile_args = '' if l:logfile isnot# '' let l:logfile_args = ' --verbose -l ' . l:logfile endif return '%e' . l:logfile_args . ' --stdin' endfunction function! ale_linters#glsl#glslls#GetProjectRoot(buffer) abort let l:project_root = ale#c#FindProjectRoot(a:buffer) return !empty(l:project_root) ? fnamemodify(l:project_root, ':h:h') : '' endfunction call ale#linter#Define('glsl', { \ 'name': 'glslls', \ 'lsp': 'stdio', \ 'executable': {b -> ale#Var(b, 'glsl_glslls_executable')}, \ 'command': function('ale_linters#glsl#glslls#GetCommand'), \ 'project_root': function('ale_linters#glsl#glslls#GetProjectRoot'), \}) ale-4.0.0/ale_linters/go/000077500000000000000000000000001476501472200151725ustar00rootroot00000000000000ale-4.0.0/ale_linters/go/bingo.vim000066400000000000000000000021371476501472200170100ustar00rootroot00000000000000" Author: Jerko Steiner " Description: https://github.com/saibing/bingo call ale#Set('go_bingo_executable', 'bingo') call ale#Set('go_bingo_options', '--mode stdio') function! ale_linters#go#bingo#GetCommand(buffer) abort return ale#go#EnvString(a:buffer) . '%e' . ale#Pad(ale#Var(a:buffer, 'go_bingo_options')) endfunction function! ale_linters#go#bingo#FindProjectRoot(buffer) abort let l:go_modules_off = ale#Var(a:buffer, 'go_go111module') is# 'off' let l:project_root = l:go_modules_off ? \ '' : ale#path#FindNearestFile(a:buffer, 'go.mod') let l:mods = ':h' if empty(l:project_root) let l:project_root = ale#path#FindNearestDirectory(a:buffer, '.git') let l:mods = ':h:h' endif return !empty(l:project_root) ? fnamemodify(l:project_root, l:mods) : '' endfunction call ale#linter#Define('go', { \ 'name': 'bingo', \ 'lsp': 'stdio', \ 'executable': {b -> ale#Var(b, 'go_bingo_executable')}, \ 'command': function('ale_linters#go#bingo#GetCommand'), \ 'project_root': function('ale_linters#go#bingo#FindProjectRoot'), \}) ale-4.0.0/ale_linters/go/cspell.vim000066400000000000000000000002241476501472200171670ustar00rootroot00000000000000scriptencoding utf-8 " Author: David Houston " Description: cspell support for Go files. call ale#handlers#cspell#DefineLinter('go') ale-4.0.0/ale_linters/go/gobuild.vim000066400000000000000000000035361476501472200173430ustar00rootroot00000000000000" Author: Joshua Rubin , Ben Reedy , " Jeff Willette " Description: go build for Go files " inspired by work from dzhou121 call ale#Set('go_go_executable', 'go') call ale#Set('go_gobuild_options', '') function! ale_linters#go#gobuild#GetMatches(lines) abort " Matches patterns like the following: " " file.go:27: missing argument for Printf("%s"): format reads arg 2, have only 1 args " file.go:53:10: if block ends with a return statement, so drop this else and outdent its block (move short variable declaration to its own line if necessary) " file.go:5:2: expected declaration, found 'STRING' "log" " go test returns relative paths so use tail of filename as part of pattern matcher let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):?(\d+)?:? (.+)$' return ale#util#GetMatches(a:lines, l:pattern) endfunction function! ale_linters#go#gobuild#Handler(buffer, lines) abort let l:dir = expand('#' . a:buffer . ':p:h') let l:output = [] for l:match in ale_linters#go#gobuild#GetMatches(a:lines) call add(l:output, { \ 'filename': ale#path#GetAbsPath(l:dir, l:match[1]), \ 'lnum': l:match[2] + 0, \ 'col': l:match[3] + 0, \ 'text': l:match[4], \ 'type': 'E', \}) endfor return l:output endfunction call ale#linter#Define('go', { \ 'name': 'gobuild', \ 'aliases': ['go build'], \ 'executable': {b -> ale#Var(b, 'go_go_executable')}, \ 'cwd': '%s:h', \ 'command': {b -> \ ale#go#EnvString(b) \ . ale#Escape(ale#Var(b, 'go_go_executable')) . ' test' \ . ale#Pad(ale#Var(b, 'go_gobuild_options')) \ . ' -c -o /dev/null ./' \ }, \ 'output_stream': 'stderr', \ 'callback': 'ale_linters#go#gobuild#Handler', \ 'lint_file': 1, \}) ale-4.0.0/ale_linters/go/gofmt.vim000066400000000000000000000006621476501472200170270ustar00rootroot00000000000000" Author: neersighted " Description: gofmt for Go files function! ale_linters#go#gofmt#GetCommand(buffer) abort return ale#go#EnvString(a:buffer) \ . '%e -e %t' endfunction call ale#linter#Define('go', { \ 'name': 'gofmt', \ 'output_stream': 'stderr', \ 'executable': 'gofmt', \ 'command': function('ale_linters#go#gofmt#GetCommand'), \ 'callback': 'ale#handlers#unix#HandleAsError', \}) ale-4.0.0/ale_linters/go/golangci_lint.vim000066400000000000000000000036621476501472200205270ustar00rootroot00000000000000" Author: Sascha Grunert " Description: Adds support of golangci-lint call ale#Set('go_golangci_lint_options', '') call ale#Set('go_golangci_lint_executable', 'golangci-lint') call ale#Set('go_golangci_lint_package', 1) function! ale_linters#go#golangci_lint#GetCommand(buffer) abort let l:filename = expand('#' . a:buffer . ':t') let l:options = ale#Var(a:buffer, 'go_golangci_lint_options') let l:lint_package = ale#Var(a:buffer, 'go_golangci_lint_package') if l:lint_package return ale#go#EnvString(a:buffer) \ . '%e run ' \ . l:options \ . ' --out-format=json' \ . ' --show-stats=0' endif return ale#go#EnvString(a:buffer) \ . '%e run ' \ . ale#Escape(l:filename) \ . ' ' . l:options \ . ' --out-format=json' \ . ' --show-stats=0' endfunction function! ale_linters#go#golangci_lint#Handler(buffer, lines) abort let l:dir = expand('#' . a:buffer . ':p:h') let l:output = [] let l:matches = ale#util#FuzzyJSONDecode(a:lines, []) if empty(l:matches) return [] endif for l:match in l:matches['Issues'] if l:match['FromLinter'] is# 'typecheck' let l:msg_type = 'E' else let l:msg_type = 'W' endif call add(l:output, { \ 'filename': ale#path#GetAbsPath(l:dir, l:match['Pos']['Filename']), \ 'lnum': l:match['Pos']['Line'] + 0, \ 'col': l:match['Pos']['Column'] + 0, \ 'type': l:msg_type, \ 'text': match['FromLinter'] . ' - ' . l:match['Text'], \}) endfor return l:output endfunction call ale#linter#Define('go', { \ 'name': 'golangci-lint', \ 'executable': {b -> ale#Var(b, 'go_golangci_lint_executable')}, \ 'cwd': '%s:h', \ 'command': function('ale_linters#go#golangci_lint#GetCommand'), \ 'callback': 'ale_linters#go#golangci_lint#Handler', \ 'lint_file': 1, \}) ale-4.0.0/ale_linters/go/gopls.vim000066400000000000000000000026231476501472200170360ustar00rootroot00000000000000" Author: w0rp " Author: Jerko Steiner " Description: https://github.com/saibing/gopls call ale#Set('go_gopls_executable', 'gopls') call ale#Set('go_gopls_options', '--mode stdio') call ale#Set('go_gopls_init_options', {}) call ale#Set('go_gopls_use_global', get(g:, 'ale_use_global_executables', 0)) function! ale_linters#go#gopls#GetCommand(buffer) abort return ale#go#EnvString(a:buffer) \ . '%e' \ . ale#Pad(ale#Var(a:buffer, 'go_gopls_options')) endfunction function! ale_linters#go#gopls#FindProjectRoot(buffer) abort let l:go_modules_off = ale#Var(a:buffer, 'go_go111module') is# 'off' let l:project_root = l:go_modules_off ? \ '' : ale#path#FindNearestFile(a:buffer, 'go.mod') let l:mods = ':h' if empty(l:project_root) let l:project_root = ale#path#FindNearestDirectory(a:buffer, '.git') let l:mods = ':h:h' endif return !empty(l:project_root) ? fnamemodify(l:project_root, l:mods) : '' endfunction call ale#linter#Define('go', { \ 'name': 'gopls', \ 'lsp': 'stdio', \ 'executable': {b -> ale#path#FindExecutable(b, 'go_gopls', [ \ ale#go#GetGoPathExecutable('bin/gopls'), \ ])}, \ 'command': function('ale_linters#go#gopls#GetCommand'), \ 'project_root': function('ale_linters#go#gopls#FindProjectRoot'), \ 'initialization_options': {b -> ale#Var(b, 'go_gopls_init_options')}, \}) ale-4.0.0/ale_linters/go/gosimple.vim000066400000000000000000000005321476501472200175260ustar00rootroot00000000000000" Author: Ben Reedy " Description: gosimple for Go files call ale#linter#Define('go', { \ 'name': 'gosimple', \ 'executable': 'gosimple', \ 'cwd': '%s:h', \ 'command': {b -> ale#go#EnvString(b) . 'gosimple .'}, \ 'callback': 'ale#handlers#go#Handler', \ 'output_stream': 'both', \ 'lint_file': 1, \}) ale-4.0.0/ale_linters/go/gotype.vim000066400000000000000000000012541476501472200172200ustar00rootroot00000000000000" Author: Jelte Fennema " Description: gotype for Go files function! ale_linters#go#gotype#GetExecutable(buffer) abort if expand('#' . a:buffer . ':p') =~# '_test\.go$' return '' endif return 'gotype' endfunction function! ale_linters#go#gotype#GetCommand(buffer) abort return ale#go#EnvString(a:buffer) . 'gotype -e .' endfunction call ale#linter#Define('go', { \ 'name': 'gotype', \ 'output_stream': 'stderr', \ 'executable': function('ale_linters#go#gotype#GetExecutable'), \ 'cwd': '%s:h', \ 'command': function('ale_linters#go#gotype#GetCommand'), \ 'callback': 'ale#handlers#go#Handler', \ 'lint_file': 1, \}) ale-4.0.0/ale_linters/go/govet.vim000066400000000000000000000011101476501472200170240ustar00rootroot00000000000000" Author: neersighted , John Eikenberry " Description: go vet for Go files call ale#Set('go_go_executable', 'go') call ale#Set('go_govet_options', '') call ale#linter#Define('go', { \ 'name': 'govet', \ 'aliases': ['go vet'], \ 'output_stream': 'stderr', \ 'executable': {b -> ale#Var(b, 'go_go_executable')}, \ 'cwd': '%s:h', \ 'command': {b -> \ ale#go#EnvString(b) \ . '%e vet' \ . ale#Pad(ale#Var(b, 'go_govet_options')) \ . ' .' \ }, \ 'callback': 'ale#handlers#go#Handler', \ 'lint_file': 1, \}) ale-4.0.0/ale_linters/go/langserver.vim000066400000000000000000000021521476501472200200570ustar00rootroot00000000000000" Author: Horacio Sanson " Description: Support for go-langserver https://github.com/sourcegraph/go-langserver call ale#Set('go_langserver_executable', 'go-langserver') call ale#Set('go_langserver_options', '') function! ale_linters#go#langserver#GetCommand(buffer) abort let l:executable = [ale#Escape(ale#Var(a:buffer, 'go_langserver_executable'))] let l:options = ale#Var(a:buffer, 'go_langserver_options') let l:options = substitute(l:options, '-gocodecompletion', '', 'g') let l:options = filter(split(l:options, ' '), 'empty(v:val) != 1') if ale#Var(a:buffer, 'completion_enabled') call add(l:options, '-gocodecompletion') endif let l:options = uniq(sort(l:options)) let l:env = ale#go#EnvString(a:buffer) return l:env . join(extend(l:executable, l:options), ' ') endfunction call ale#linter#Define('go', { \ 'name': 'golangserver', \ 'lsp': 'stdio', \ 'executable': {b -> ale#Var(b, 'go_langserver_executable')}, \ 'command': function('ale_linters#go#langserver#GetCommand'), \ 'project_root': function('ale#go#FindProjectRoot'), \}) ale-4.0.0/ale_linters/go/revive.vim000066400000000000000000000012451476501472200172110ustar00rootroot00000000000000" Author: Penghui Liao " Description: Adds support for revive call ale#Set('go_revive_executable', 'revive') call ale#Set('go_revive_options', '') function! ale_linters#go#revive#GetCommand(buffer) abort let l:options = ale#Var(a:buffer, 'go_revive_options') return ale#go#EnvString(a:buffer) . '%e' \ . (!empty(l:options) ? ' ' . l:options : '') \ . ' %t' endfunction call ale#linter#Define('go', { \ 'name': 'revive', \ 'output_stream': 'both', \ 'executable': {b -> ale#Var(b, 'go_revive_executable')}, \ 'command': function('ale_linters#go#revive#GetCommand'), \ 'callback': 'ale#handlers#unix#HandleAsWarning', \}) ale-4.0.0/ale_linters/go/staticcheck.vim000066400000000000000000000022261476501472200201760ustar00rootroot00000000000000" Author: Ben Reedy " Description: staticcheck for Go files call ale#Set('go_staticcheck_executable', 'staticcheck') call ale#Set('go_staticcheck_options', '') call ale#Set('go_staticcheck_lint_package', 1) call ale#Set('go_staticcheck_use_global', get(g:, 'ale_use_global_executables', 0)) function! ale_linters#go#staticcheck#GetCommand(buffer) abort let l:options = ale#Var(a:buffer, 'go_staticcheck_options') let l:lint_package = ale#Var(a:buffer, 'go_staticcheck_lint_package') let l:env = ale#go#EnvString(a:buffer) if l:lint_package return l:env . '%e' \ . (!empty(l:options) ? ' ' . l:options : '') . ' .' endif return l:env . '%e' \ . (!empty(l:options) ? ' ' . l:options : '') \ . ' %s:t' endfunction call ale#linter#Define('go', { \ 'name': 'staticcheck', \ 'executable': {b -> ale#path#FindExecutable(b, 'go_staticcheck', [ \ ale#go#GetGoPathExecutable('bin/staticcheck'), \ ])}, \ 'cwd': '%s:h', \ 'command': function('ale_linters#go#staticcheck#GetCommand'), \ 'callback': 'ale#handlers#go#Handler', \ 'output_stream': 'both', \ 'lint_file': 1, \}) ale-4.0.0/ale_linters/graphql/000077500000000000000000000000001476501472200162235ustar00rootroot00000000000000ale-4.0.0/ale_linters/graphql/eslint.vim000066400000000000000000000005701476501472200202400ustar00rootroot00000000000000" Author: Benjie Gillam " Description: eslint for GraphQL files call ale#linter#Define('graphql', { \ 'name': 'eslint', \ 'executable': function('ale#handlers#eslint#GetExecutable'), \ 'cwd': function('ale#handlers#eslint#GetCwd'), \ 'command': function('ale#handlers#eslint#GetCommand'), \ 'callback': 'ale#handlers#eslint#HandleJSON', \}) ale-4.0.0/ale_linters/graphql/gqlint.vim000066400000000000000000000004571476501472200202440ustar00rootroot00000000000000" Author: Michiel Westerbeek " Description: Linter for GraphQL Schemas call ale#linter#Define('graphql', { \ 'name': 'gqlint', \ 'executable': 'gqlint', \ 'cwd': '%s:h', \ 'command': 'gqlint --reporter=simple %t', \ 'callback': 'ale#handlers#unix#HandleAsWarning', \}) ale-4.0.0/ale_linters/groovy/000077500000000000000000000000001476501472200161125ustar00rootroot00000000000000ale-4.0.0/ale_linters/groovy/npmgroovylint.vim000066400000000000000000000031461476501472200215620ustar00rootroot00000000000000" Author: lucas-str " Description: Integration of npm-groovy-lint for Groovy files. call ale#Set('groovy_npmgroovylint_executable', 'npm-groovy-lint') call ale#Set('groovy_npmgroovylint_options', '--loglevel warning') function! ale_linters#groovy#npmgroovylint#GetCommand(buffer) abort let l:options = ale#Var(a:buffer, 'groovy_npmgroovylint_options') return '%e --failon none --output json' \ . (!empty(l:options) ? ' ' . l:options : '') \ . ' %t' endfunction function! ale_linters#groovy#npmgroovylint#Handle(buffer, lines) abort let l:output = [] let l:json = ale#util#FuzzyJSONDecode(a:lines, {}) for [l:filename, l:file] in items(get(l:json, 'files', {})) for l:error in get(l:file, 'errors', []) let l:output_line = { \ 'filename': l:filename, \ 'lnum': l:error.line, \ 'text': l:error.msg, \ 'type': toupper(l:error.severity[0]), \} if has_key(l:error, 'range') let l:output_line.col = l:error.range.start.character let l:output_line.end_col = l:error.range.end.character let l:output_line.end_lnum = l:error.range.end.line endif call add(l:output, l:output_line) endfor endfor return l:output endfunction call ale#linter#Define('groovy', { \ 'name': 'npm-groovy-lint', \ 'executable': {b -> ale#Var(b, 'groovy_npmgroovylint_executable')}, \ 'command': function('ale_linters#groovy#npmgroovylint#GetCommand'), \ 'callback': 'ale_linters#groovy#npmgroovylint#Handle', \}) ale-4.0.0/ale_linters/hack/000077500000000000000000000000001476501472200154735ustar00rootroot00000000000000ale-4.0.0/ale_linters/hack/hack.vim000066400000000000000000000013201476501472200171120ustar00rootroot00000000000000" Author: Fred Emmott " Description: Hack support via `hack lsp` call ale#Set('hack_hack_executable', 'hh_client') function! ale_linters#hack#hack#GetProjectRoot(buffer) abort let l:hhconfig = ale#path#FindNearestFile(a:buffer, '.hhconfig') return !empty(l:hhconfig) ? fnamemodify(l:hhconfig, ':h') : '' endfunction function! ale_linters#hack#hack#GetExecutable(buffer) abort return ale#Var(a:buffer, 'hack_hack_executable') endfunction call ale#linter#Define('hack', { \ 'name': 'hack', \ 'lsp': 'stdio', \ 'executable': function('ale_linters#hack#hack#GetExecutable'), \ 'command': '%e lsp --from vim-ale', \ 'project_root': function('ale_linters#hack#hack#GetProjectRoot'), \}) ale-4.0.0/ale_linters/hack/hhast.vim000066400000000000000000000026241476501472200173230ustar00rootroot00000000000000" Author: Fred Emmott " Description: Hack support via `hhast lsp` call ale#Set('hack_hhast_executable', 'vendor/bin/hhast-lint') function! ale_linters#hack#hhast#GetProjectRoot(buffer) abort " Find the hack root, then figure out if it's also an HHAST root. " Don't try to use lint configurations from vendor/foo/bar/hhast-lint.json let l:hhconfig = ale#path#FindNearestFile(a:buffer, '.hhconfig') if empty(l:hhconfig) return '' endif let l:root = fnamemodify(l:hhconfig, ':h') let l:hhast_config = findfile('hhast-lint.json', l:root) return !empty(l:hhast_config) ? l:root : '' endfunction function! ale_linters#hack#hhast#GetExecutable(buffer) abort let l:root = ale_linters#hack#hhast#GetProjectRoot(a:buffer) let l:relative = ale#Var(a:buffer, 'hack_hhast_executable') let l:absolute = findfile(l:relative, l:root) return !empty(l:absolute) ? l:absolute : '' endfunction function! ale_linters#hack#hhast#GetInitializationOptions(buffer) abort return {'lintMode': 'open-files'} endfunction call ale#linter#Define('hack', { \ 'name': 'hhast', \ 'lsp': 'stdio', \ 'executable': function('ale_linters#hack#hhast#GetExecutable'), \ 'command': '%e --mode lsp --from vim-ale', \ 'project_root': function('ale_linters#hack#hhast#GetProjectRoot'), \ 'initialization_options': function('ale_linters#hack#hhast#GetInitializationOptions'), \}) ale-4.0.0/ale_linters/haml/000077500000000000000000000000001476501472200155065ustar00rootroot00000000000000ale-4.0.0/ale_linters/haml/hamllint.vim000066400000000000000000000041431476501472200200350ustar00rootroot00000000000000" Author: Patrick Lewis - https://github.com/patricklewis, thenoseman - https://github.com/thenoseman " Description: haml-lint for Haml files call ale#Set('haml_hamllint_executable', 'haml-lint') function! ale_linters#haml#hamllint#GetExecutable(buffer) abort return ale#Var(a:buffer, 'haml_hamllint_executable') endfunction function! ale_linters#haml#hamllint#GetCommand(buffer) abort let l:prefix = '' let l:rubocop_config_file_path = ale#path#FindNearestFile(a:buffer, '.rubocop.yml') let l:hamllint_config_file_path = ale#path#FindNearestFile(a:buffer, '.haml-lint.yml') " Set HAML_LINT_RUBOCOP_CONF variable as it is needed for haml-lint to " pick up the rubocop config. " " See https://github.com/brigade/haml-lint/blob/master/lib/haml_lint/linter/rubocop.rb#L89 " HamlLint::Linter::RuboCop#rubocop_flags if !empty(l:rubocop_config_file_path) if has('win32') let l:prefix = 'set HAML_LINT_RUBOCOP_CONF=' . ale#Escape(l:rubocop_config_file_path) . ' &&' else let l:prefix = 'HAML_LINT_RUBOCOP_CONF=' . ale#Escape(l:rubocop_config_file_path) endif endif return (!empty(l:prefix) ? l:prefix . ' ' : '') \ . ale_linters#haml#hamllint#GetExecutable(a:buffer) \ . (!empty(l:hamllint_config_file_path) ? ' --config ' . ale#Escape(l:hamllint_config_file_path) : '') \ . ' %t' endfunction function! ale_linters#haml#hamllint#Handle(buffer, lines) abort " Matches patterns like the following: " :51 [W] RuboCop: Use the new Ruby 1.9 hash syntax. let l:pattern = '\v^.*:(\d+) \[([EW])\] (.+)$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) call add(l:output, { \ 'lnum': l:match[1] + 0, \ 'type': l:match[2], \ 'text': l:match[3] \}) endfor return l:output endfunction call ale#linter#Define('haml', { \ 'name': 'hamllint', \ 'executable': function('ale_linters#haml#hamllint#GetExecutable'), \ 'command': function('ale_linters#haml#hamllint#GetCommand'), \ 'callback': 'ale_linters#haml#hamllint#Handle' \}) ale-4.0.0/ale_linters/handlebars/000077500000000000000000000000001476501472200166705ustar00rootroot00000000000000ale-4.0.0/ale_linters/handlebars/embertemplatelint.vim000066400000000000000000000003121476501472200231160ustar00rootroot00000000000000" Author: Adrian Zalewski " Description: Ember-template-lint for checking Handlebars files scriptencoding utf-8 call ale#handlers#embertemplatelint#DefineLinter('handlebars') ale-4.0.0/ale_linters/haskell/000077500000000000000000000000001476501472200162105ustar00rootroot00000000000000ale-4.0.0/ale_linters/haskell/cabal_ghc.vim000066400000000000000000000012041476501472200206050ustar00rootroot00000000000000" Author: Eric Wolf " Description: ghc for Haskell files called with cabal exec call ale#Set('haskell_cabal_ghc_options', '-fno-code -v0') function! ale_linters#haskell#cabal_ghc#GetCommand(buffer) abort return 'cabal exec -- ghc ' \ . ale#Var(a:buffer, 'haskell_cabal_ghc_options') \ . ' %t' endfunction call ale#linter#Define('haskell', { \ 'name': 'cabal_ghc', \ 'aliases': ['cabal-ghc'], \ 'output_stream': 'stderr', \ 'executable': 'cabal', \ 'cwd': '%s:h', \ 'command': function('ale_linters#haskell#cabal_ghc#GetCommand'), \ 'callback': 'ale#handlers#haskell#HandleGHCFormat', \}) ale-4.0.0/ale_linters/haskell/cspell.vim000066400000000000000000000002361476501472200202100ustar00rootroot00000000000000scriptencoding utf-8 " Author: David Houston " Description: cspell support for Haskell files. call ale#handlers#cspell#DefineLinter('haskell') ale-4.0.0/ale_linters/haskell/ghc.vim000066400000000000000000000010061476501472200174630ustar00rootroot00000000000000" Author: w0rp " Description: ghc for Haskell files call ale#Set('haskell_ghc_options', '-fno-code -v0') function! ale_linters#haskell#ghc#GetCommand(buffer) abort return 'ghc ' \ . ale#Var(a:buffer, 'haskell_ghc_options') \ . ' %t' endfunction call ale#linter#Define('haskell', { \ 'name': 'ghc', \ 'output_stream': 'stderr', \ 'executable': 'ghc', \ 'command': function('ale_linters#haskell#ghc#GetCommand'), \ 'callback': 'ale#handlers#haskell#HandleGHCFormat', \}) ale-4.0.0/ale_linters/haskell/ghc_mod.vim000066400000000000000000000012521476501472200203250ustar00rootroot00000000000000" Author: wizzup " Description: ghc-mod for Haskell files call ale#Set('haskell_ghc_mod_executable', 'ghc-mod') function! ale_linters#haskell#ghc_mod#GetCommand (buffer) abort let l:executable = ale#Var(a:buffer, 'haskell_ghc_mod_executable') return ale#handlers#haskell_stack#EscapeExecutable(l:executable, 'ghc-mod') \ . ' --map-file %s=%t check %s' endfunction call ale#linter#Define('haskell', { \ 'name': 'ghc_mod', \ 'aliases': ['ghc-mod'], \ 'executable': {b -> ale#Var(b, 'haskell_ghc_mod_executable')}, \ 'command': function('ale_linters#haskell#ghc_mod#GetCommand'), \ 'callback': 'ale#handlers#haskell#HandleGHCFormat', \}) ale-4.0.0/ale_linters/haskell/hdevtools.vim000066400000000000000000000014631476501472200207400ustar00rootroot00000000000000" Author: rob-b, Takano Akio " Description: hdevtools for Haskell files call ale#Set('haskell_hdevtools_executable', 'hdevtools') call ale#Set('haskell_hdevtools_options', get(g:, 'hdevtools_options', '-g -Wall')) function! ale_linters#haskell#hdevtools#GetCommand(buffer) abort let l:executable = ale#Var(a:buffer, 'haskell_hdevtools_executable') return ale#handlers#haskell_stack#EscapeExecutable(l:executable, 'hdevtools') \ . ' check' . ale#Pad(ale#Var(a:buffer, 'haskell_hdevtools_options')) \ . ' -p %s %t' endfunction call ale#linter#Define('haskell', { \ 'name': 'hdevtools', \ 'executable': {b -> ale#Var(b, 'haskell_hdevtools_executable')}, \ 'command': function('ale_linters#haskell#hdevtools#GetCommand'), \ 'callback': 'ale#handlers#haskell#HandleGHCFormat', \}) ale-4.0.0/ale_linters/haskell/hie.vim000066400000000000000000000025351476501472200174770ustar00rootroot00000000000000" Author: Luxed " Description: A language server for Haskell call ale#Set('haskell_hie_executable', 'hie') function! ale_linters#haskell#hie#GetProjectRoot(buffer) abort " Search for the stack file first let l:project_file = ale#path#FindNearestFile(a:buffer, 'stack.yaml') " If it's empty, search for the cabal file if empty(l:project_file) " Search all of the paths except for the root filesystem path. let l:paths = join( \ ale#path#Upwards(expand('#' . a:buffer . ':p:h'))[:-2], \ ',' \) let l:project_file = globpath(l:paths, '*.cabal') endif " If we still can't find one, use the current file. if empty(l:project_file) let l:project_file = expand('#' . a:buffer . ':p') endif return fnamemodify(l:project_file, ':h') endfunction function! ale_linters#haskell#hie#GetCommand(buffer) abort let l:executable = ale#Var(a:buffer, 'haskell_hie_executable') return ale#handlers#haskell_stack#EscapeExecutable(l:executable, 'hie') \ . ' --lsp' endfunction call ale#linter#Define('haskell', { \ 'name': 'hie', \ 'lsp': 'stdio', \ 'command': function('ale_linters#haskell#hie#GetCommand'), \ 'executable': {b -> ale#Var(b, 'haskell_hie_executable')}, \ 'project_root': function('ale_linters#haskell#hie#GetProjectRoot'), \}) ale-4.0.0/ale_linters/haskell/hlint.vim000066400000000000000000000027361476501472200200530ustar00rootroot00000000000000" Author: jparoz " Description: hlint for Haskell files call ale#Set('haskell_hlint_executable', 'hlint') call ale#Set('haskell_hlint_options', get(g:, 'hlint_options', '')) function! ale_linters#haskell#hlint#Handle(buffer, lines) abort let l:output = [] for l:error in ale#util#FuzzyJSONDecode(a:lines, []) if l:error.severity is# 'Error' let l:type = 'E' elseif l:error.severity is# 'Suggestion' let l:type = 'I' else let l:type = 'W' endif call add(l:output, { \ 'lnum': str2nr(l:error.startLine), \ 'col': str2nr(l:error.startColumn), \ 'end_lnum': str2nr(l:error.endLine), \ 'end_col': str2nr(l:error.endColumn), \ 'text': l:error.severity . ': ' . l:error.hint . '. Found: ' . l:error.from . ' Why not: ' . l:error.to, \ 'type': l:type, \}) endfor return l:output endfunction function! ale_linters#haskell#hlint#GetCommand(buffer) abort let l:hlintopts = '--color=never --json' return ale#handlers#hlint#GetExecutable(a:buffer) \ . ' ' . ale#Var(a:buffer, 'haskell_hlint_options') \ . ' ' . l:hlintopts \ . ' -' endfunction call ale#linter#Define('haskell', { \ 'name': 'hlint', \ 'executable': {b -> ale#Var(b, 'haskell_hlint_executable')}, \ 'command': function('ale_linters#haskell#hlint#GetCommand') , \ 'callback': 'ale_linters#haskell#hlint#Handle', \}) ale-4.0.0/ale_linters/haskell/hls.vim000066400000000000000000000042301476501472200175120ustar00rootroot00000000000000" Author: Yen3 " Description: A language server for haskell " The file is based on hie.vim (author: Luxed " ). It search more project root files. " call ale#Set('haskell_hls_executable', 'haskell-language-server-wrapper') call ale#Set('haskell_hls_config', {}) function! ale_linters#haskell#hls#FindRootFile(buffer) abort let l:serach_root_files = [ \ 'stack.yaml', \ 'cabal.project', \ 'package.yaml', \ 'hie.yaml' \ ] for l:path in ale#path#Upwards(expand('#' . a:buffer . ':p:h')) for l:root_file in l:serach_root_files if filereadable(l:path . '/' . l:root_file) " Add on / so fnamemodify(..., ':h') below keeps the path. return l:path . '/' endif endfor endfor return '' endfunction function! ale_linters#haskell#hls#GetProjectRoot(buffer) abort " Search for the project file first let l:project_file = ale_linters#haskell#hls#FindRootFile(a:buffer) " If it's empty, search for the cabal file if empty(l:project_file) " Search all of the paths except for the root filesystem path. let l:paths = join( \ ale#path#Upwards(expand('#' . a:buffer . ':p:h'))[:-2], \ ',' \) let l:project_file = globpath(l:paths, '*.cabal') endif " If we still can't find one, use the current file. if empty(l:project_file) let l:project_file = expand('#' . a:buffer . ':p') endif return fnamemodify(l:project_file, ':h') endfunction function! ale_linters#haskell#hls#GetCommand(buffer) abort let l:executable = ale#Var(a:buffer, 'haskell_hls_executable') return ale#handlers#haskell_stack#EscapeExecutable(l:executable, \ 'haskell-language-server-wrapper') \ . ' --lsp' endfunction call ale#linter#Define('haskell', { \ 'name': 'hls', \ 'lsp': 'stdio', \ 'command': function('ale_linters#haskell#hls#GetCommand'), \ 'executable': {b -> ale#Var(b, 'haskell_hls_executable')}, \ 'project_root': function('ale_linters#haskell#hls#GetProjectRoot'), \ 'lsp_config': {b -> ale#Var(b, 'haskell_hls_config')}, \}) ale-4.0.0/ale_linters/haskell/stack_build.vim000066400000000000000000000015001476501472200212050ustar00rootroot00000000000000" Author: Jake Zimmerman " Description: Like stack-ghc, but for entire projects " " Note: Ideally, this would *only* typecheck. Right now, it also does codegen. " See . call ale#Set('haskell_stack_build_options', '--fast') function! ale_linters#haskell#stack_build#GetCommand(buffer) abort let l:flags = ale#Var(a:buffer, 'haskell_stack_build_options') return 'stack build ' . l:flags endfunction call ale#linter#Define('haskell', { \ 'name': 'stack_build', \ 'aliases': ['stack-build'], \ 'output_stream': 'stderr', \ 'executable': function('ale#handlers#haskell#GetStackExecutable'), \ 'command': function('ale_linters#haskell#stack_build#GetCommand'), \ 'lint_file': 1, \ 'callback': 'ale#handlers#haskell#HandleGHCFormat', \}) ale-4.0.0/ale_linters/haskell/stack_ghc.vim000066400000000000000000000013121476501472200206500ustar00rootroot00000000000000" Author: w0rp " Description: ghc for Haskell files, using Stack call ale#Set('haskell_stack_ghc_options', '-fno-code -v0') function! ale_linters#haskell#stack_ghc#GetCommand(buffer) abort return ale#handlers#haskell#GetStackExecutable(a:buffer) \ . ' ghc -- ' \ . ale#Var(a:buffer, 'haskell_stack_ghc_options') \ . ' %t' endfunction call ale#linter#Define('haskell', { \ 'name': 'stack_ghc', \ 'aliases': ['stack-ghc'], \ 'output_stream': 'stderr', \ 'executable': function('ale#handlers#haskell#GetStackExecutable'), \ 'cwd': '%s:h', \ 'command': function('ale_linters#haskell#stack_ghc#GetCommand'), \ 'callback': 'ale#handlers#haskell#HandleGHCFormat', \}) ale-4.0.0/ale_linters/help/000077500000000000000000000000001476501472200155155ustar00rootroot00000000000000ale-4.0.0/ale_linters/help/alex.vim000066400000000000000000000002131476501472200171570ustar00rootroot00000000000000" Author: Johannes Wienke " Description: alex for help files call ale#handlers#alex#DefineLinter('help', '--text') ale-4.0.0/ale_linters/help/cspell.vim000066400000000000000000000002301476501472200175070ustar00rootroot00000000000000scriptencoding utf-8 " Author: David Houston " Description: cspell support for help files. call ale#handlers#cspell#DefineLinter('help') ale-4.0.0/ale_linters/help/proselint.vim000066400000000000000000000004251476501472200202520ustar00rootroot00000000000000" Author: Daniel M. Capella https://github.com/polyzen " Description: proselint for Vim help files call ale#linter#Define('help', { \ 'name': 'proselint', \ 'executable': 'proselint', \ 'command': 'proselint %t', \ 'callback': 'ale#handlers#unix#HandleAsWarning', \}) ale-4.0.0/ale_linters/help/writegood.vim000066400000000000000000000002211476501472200202300ustar00rootroot00000000000000" Author: Sumner Evans " Description: write-good for vim Help files call ale#handlers#writegood#DefineLinter('help') ale-4.0.0/ale_linters/html/000077500000000000000000000000001476501472200155315ustar00rootroot00000000000000ale-4.0.0/ale_linters/html/alex.vim000066400000000000000000000002131476501472200171730ustar00rootroot00000000000000" Author: Johannes Wienke " Description: alex for HTML files call ale#handlers#alex#DefineLinter('html', '--html') ale-4.0.0/ale_linters/html/angular.vim000066400000000000000000000034411476501472200177010ustar00rootroot00000000000000" Author: w0rp " Description: tsserver integration for ALE call ale#Set('html_angular_executable', 'ngserver') call ale#Set('html_angular_use_global', get(g:, 'ale_use_global_executables', 0)) function! ale_linters#html#angular#GetProjectRoot(buffer) abort return ale#path#Dirname( \ ale#path#FindNearestDirectory(a:buffer, 'node_modules') \) endfunction function! ale_linters#html#angular#GetExecutable(buffer) abort return 'node' endfunction function! ale_linters#html#angular#GetCommand(buffer) abort let l:language_service_dir = ale#path#Simplify( \ ale#path#FindNearestDirectory( \ a:buffer, \ 'node_modules/@angular/language-service' \ ) \) if empty(l:language_service_dir) return '' endif let l:language_service_dir = fnamemodify(l:language_service_dir, ':h') let l:typescript_dir = ale#path#Simplify( \ fnamemodify(l:language_service_dir, ':h:h') \ . '/typescript' \) let l:script = ale#path#FindExecutable(a:buffer, 'html_angular', [ \ 'node_modules/@angular/language-server/bin/ngserver', \ 'node_modules/@angular/language-server/index.js', \]) if !filereadable(l:script) return '' endif return ale#Escape('node') . ' ' . ale#Escape(l:script) \ . ' --ngProbeLocations ' . ale#Escape(l:language_service_dir) \ . ' --tsProbeLocations ' . ale#Escape(l:typescript_dir) \ . ' --stdio' endfunction call ale#linter#Define('html', { \ 'name': 'angular', \ 'aliases': ['angular-language-server', 'angularls'], \ 'lsp': 'stdio', \ 'executable': function('ale_linters#html#angular#GetExecutable'), \ 'command': function('ale_linters#html#angular#GetCommand'), \ 'project_root': function('ale_linters#html#angular#GetProjectRoot'), \}) ale-4.0.0/ale_linters/html/cspell.vim000066400000000000000000000002301476501472200175230ustar00rootroot00000000000000scriptencoding utf-8 " Author: David Houston " Description: cspell support for HTML files. call ale#handlers#cspell#DefineLinter('html') ale-4.0.0/ale_linters/html/djlint.vim000066400000000000000000000025711476501472200175370ustar00rootroot00000000000000" Author: Vivian De Smedt " Description: Adds support for djlint call ale#Set('html_djlint_executable', 'djlint') call ale#Set('html_djlint_options', '') function! ale_linters#html#djlint#GetExecutable(buffer) abort return ale#Var(a:buffer, 'html_djlint_executable') endfunction function! ale_linters#html#djlint#GetCommand(buffer) abort let l:executable = ale_linters#html#djlint#GetExecutable(a:buffer) let l:options = ale#Var(a:buffer, 'html_djlint_options') return ale#Escape(l:executable) \ . (!empty(l:options) ? ' ' . l:options : '') . ' %s' endfunction function! ale_linters#html#djlint#Handle(buffer, lines) abort let l:output = [] let l:pattern = '\v^([A-Z]\d+) (\d+):(\d+) (.*)$' let l:i = 0 for l:match in ale#util#GetMatches(a:lines, l:pattern) let l:i += 1 let l:item = { \ 'lnum': l:match[2] + 0, \ 'col': l:match[3] + 0, \ 'vcol': 1, \ 'text': l:match[4], \ 'code': l:match[1], \ 'type': 'W', \} call add(l:output, l:item) endfor return l:output endfunction call ale#linter#Define('html', { \ 'name': 'djlint', \ 'executable': function('ale_linters#html#djlint#GetExecutable'), \ 'command': function('ale_linters#html#djlint#GetCommand'), \ 'callback': 'ale_linters#html#djlint#Handle', \}) " vim:ts=4:sw=4:et: ale-4.0.0/ale_linters/html/eslint.vim000066400000000000000000000006361476501472200175510ustar00rootroot00000000000000" Author: Victor Ananyev " Description: eslint for js snippets in HTML files call ale#linter#Define('html', { \ 'name': 'eslint', \ 'output_stream': 'both', \ 'executable': function('ale#handlers#eslint#GetExecutable'), \ 'cwd': function('ale#handlers#eslint#GetCwd'), \ 'command': function('ale#handlers#eslint#GetCommand'), \ 'callback': 'ale#handlers#eslint#HandleJSON', \ }) ale-4.0.0/ale_linters/html/fecs.vim000066400000000000000000000004451476501472200171710ustar00rootroot00000000000000" Author: harttle " Description: fecs for HTMl files call ale#linter#Define('html', { \ 'name': 'fecs', \ 'executable': function('ale#handlers#fecs#GetExecutable'), \ 'command': function('ale#handlers#fecs#GetCommand'), \ 'callback': 'ale#handlers#fecs#Handle', \}) ale-4.0.0/ale_linters/html/htmlhint.vim000066400000000000000000000021671476501472200201030ustar00rootroot00000000000000" Author: KabbAmine , deathmaz <00maz1987@gmail.com>, diartyz " Description: HTMLHint for checking html files call ale#Set('html_htmlhint_options', '') call ale#Set('html_htmlhint_executable', 'htmlhint') call ale#Set('html_htmlhint_use_global', get(g:, 'ale_use_global_executables', 0)) function! ale_linters#html#htmlhint#GetCommand(buffer) abort let l:options = ale#Var(a:buffer, 'html_htmlhint_options') let l:config = l:options !~# '--config' \ ? ale#path#FindNearestFile(a:buffer, '.htmlhintrc') \ : '' if !empty(l:config) let l:options .= ' --config ' . ale#Escape(l:config) endif if !empty(l:options) let l:options = substitute(l:options, '--format=unix', '', '') endif return '%e' . ale#Pad(l:options) . ' --format=unix %t' endfunction call ale#linter#Define('html', { \ 'name': 'htmlhint', \ 'executable': {b -> ale#path#FindExecutable(b, 'html_htmlhint', [ \ 'node_modules/.bin/htmlhint', \ ])}, \ 'command': function('ale_linters#html#htmlhint#GetCommand'), \ 'callback': 'ale#handlers#unix#HandleAsError', \}) ale-4.0.0/ale_linters/html/proselint.vim000066400000000000000000000004211476501472200202620ustar00rootroot00000000000000" Author: Daniel M. Capella https://github.com/polyzen " Description: proselint for HTML files call ale#linter#Define('html', { \ 'name': 'proselint', \ 'executable': 'proselint', \ 'command': 'proselint %t', \ 'callback': 'ale#handlers#unix#HandleAsWarning', \}) ale-4.0.0/ale_linters/html/stylelint.vim000066400000000000000000000020131476501472200202710ustar00rootroot00000000000000" Author: Filipe Kiss http://github.com/filipekiss call ale#Set('html_stylelint_executable', 'stylelint') call ale#Set('html_stylelint_options', '') call ale#Set('html_stylelint_use_global', 0) function! ale_linters#html#stylelint#GetExecutable(buffer) abort return ale#path#FindExecutable(a:buffer, 'html_stylelint', [ \ 'node_modules/.bin/stylelint', \]) endfunction function! ale_linters#html#stylelint#GetCommand(buffer) abort let l:executable = ale_linters#html#stylelint#GetExecutable(a:buffer) let l:options = ale#Var(a:buffer, 'html_stylelint_options') return ale#Escape(l:executable) \ . (!empty(l:options) ? ' ' . l:options : '') \ . ' --stdin-filename %s' endfunction call ale#linter#Define('html', { \ 'name': 'stylelint', \ 'output_stream': 'both', \ 'executable': function('ale_linters#html#stylelint#GetExecutable'), \ 'command': function('ale_linters#html#stylelint#GetCommand'), \ 'callback': 'ale#handlers#css#HandleStyleLintFormat', \}) ale-4.0.0/ale_linters/html/tidy.vim000066400000000000000000000045421476501472200172240ustar00rootroot00000000000000" Author: KabbAmine " Description: This file adds support for checking HTML code with tidy. let g:ale_html_tidy_executable = get(g:, 'ale_html_tidy_executable', 'tidy') let g:ale_html_tidy_options = get(g:, 'ale_html_tidy_options', '-q -e -language en') function! ale_linters#html#tidy#GetCommand(buffer) abort " Specify file encoding in options " (Idea taken from https://github.com/scrooloose/syntastic/blob/master/syntax_checkers/html/tidy.vim) let l:file_encoding = get({ \ 'ascii': '-ascii', \ 'big5': '-big5', \ 'cp1252': '-win1252', \ 'cp850': '-ibm858', \ 'cp932': '-shiftjis', \ 'iso-2022-jp': '-iso-2022', \ 'latin1': '-latin1', \ 'macroman': '-mac', \ 'sjis': '-shiftjis', \ 'utf-16le': '-utf16le', \ 'utf-16': '-utf16', \ 'utf-8': '-utf8', \ }, &fileencoding, '-utf8') " On macOS, old tidy (released on 31 Oct 2006) is installed. It does not " consider HTML5 so we should avoid it. let l:executable = ale#Var(a:buffer, 'html_tidy_executable') if has('mac') && l:executable is# 'tidy' && exists('*exepath') \ && exepath(l:executable) is# '/usr/bin/tidy' return '' endif return printf('%s %s %s -', \ l:executable, \ ale#Var(a:buffer, 'html_tidy_options'), \ l:file_encoding \) endfunction function! ale_linters#html#tidy#Handle(buffer, lines) abort " Matches patterns lines like the following: " line 7 column 5 - Warning: missing before let l:pattern = '^line \(\d\+\) column \(\d\+\) - \(Warning\|Error\): \(.\+\)$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) let l:line = l:match[1] + 0 let l:col = l:match[2] + 0 let l:type = l:match[3] is# 'Error' ? 'E' : 'W' let l:text = l:match[4] call add(l:output, { \ 'lnum': l:line, \ 'col': l:col, \ 'text': l:text, \ 'type': l:type, \}) endfor return l:output endfunction call ale#linter#Define('html', { \ 'name': 'tidy', \ 'executable': {b -> ale#Var(b, 'html_tidy_executable')}, \ 'output_stream': 'stderr', \ 'command': function('ale_linters#html#tidy#GetCommand'), \ 'callback': 'ale_linters#html#tidy#Handle', \ }) ale-4.0.0/ale_linters/html/vscodehtml.vim000066400000000000000000000010621476501472200204150ustar00rootroot00000000000000" Author: Dalius Dobravolskas " Description: VSCode html language server function! ale_linters#html#vscodehtml#GetProjectRoot(buffer) abort let l:git_path = ale#path#FindNearestDirectory(a:buffer, '.git') return !empty(l:git_path) ? fnamemodify(l:git_path, ':h:h') : '' endfunction call ale#linter#Define('html', { \ 'name': 'vscodehtml', \ 'lsp': 'stdio', \ 'executable': 'vscode-html-language-server', \ 'command': '%e --stdio', \ 'project_root': function('ale_linters#html#vscodehtml#GetProjectRoot'), \}) ale-4.0.0/ale_linters/html/writegood.vim000066400000000000000000000002151476501472200202470ustar00rootroot00000000000000" Author: Sumner Evans " Description: write-good for html files call ale#handlers#writegood#DefineLinter('html') ale-4.0.0/ale_linters/hurl/000077500000000000000000000000001476501472200155375ustar00rootroot00000000000000ale-4.0.0/ale_linters/hurl/hurlfmt.vim000066400000000000000000000036441476501472200177440ustar00rootroot00000000000000" Description: Hurl linter using hurlfmt --check. " https://hurl.dev/ call ale#Set('hurl_hurlfmt_executable', 'hurlfmt') function! ale_linters#hurl#hurlfmt#GetCommand(buffer) abort return '%e' \ . ' --check --no-color ' endfunction function! ale_linters#hurl#hurlfmt#HandleOutput(buffer, lines) abort " Matches patterns: " " error: Parsing space " --> test.hurl:11:48 " | " 8 | header "Content-Type"= "application/json; charset=utf-8" " | ^ expecting a space " | " " error: Parsing URL " --> test.hurl:11:48 " | " 11 | PUT https://jsonplaceholder.typicode.com/posts/{post_id}} " | ^ illegal character <{> " | " " Note: hurlfmt seems to report always the first error only so we assume " there is only one error to make parsing easier. let l:output = [] if empty(a:lines) return l:output endif let l:pattern = '\v(error|warning): (.+) --\> (.+):(\d+):(\d+) .+ \^ (.+) |' let l:lines = join(a:lines, ' ') for l:match in ale#util#GetMatches(l:lines, l:pattern) call add(l:output, { \ 'bufnr': a:buffer, \ 'lnum': match[4] + 0, \ 'col': match[5] + 0, \ 'end_col': match[5] + 0, \ 'text': match[2] . ' : ' . match[6], \ 'type': (match[1] is# 'error') ? 'E' : 'W' \}) endfor return l:output endfunction function! ale_linters#hurl#hurlfmt#GetType(severity) abort if a:severity is? 'convention' \|| a:severity is? 'warning' \|| a:severity is? 'refactor' return 'W' endif return 'E' endfunction call ale#linter#Define('hurl', { \ 'name': 'hurlfmt', \ 'output_stream': 'stderr', \ 'executable': {b -> ale#Var(b, 'hurl_hurlfmt_executable')}, \ 'command': function('ale_linters#hurl#hurlfmt#GetCommand'), \ 'callback': 'ale_linters#hurl#hurlfmt#HandleOutput', \}) ale-4.0.0/ale_linters/idris/000077500000000000000000000000001476501472200156775ustar00rootroot00000000000000ale-4.0.0/ale_linters/idris/idris.vim000066400000000000000000000046011476501472200175270ustar00rootroot00000000000000" Author: Scott Bonds " Description: default Idris compiler call ale#Set('idris_idris_executable', 'idris') call ale#Set('idris_idris_options', '--total --warnpartial --warnreach --warnipkg') function! ale_linters#idris#idris#GetCommand(buffer) abort let l:options = ale#Var(a:buffer, 'idris_idris_options') return '%e' . ale#Pad(l:options) . ' --check %s' endfunction function! ale_linters#idris#idris#Handle(buffer, lines) abort " This was copied almost verbatim from ale#handlers#haskell#HandleGHCFormat " " Look for lines like the following: " foo.idr:2:6:When checking right hand side of main with expected type " bar.idr:11:11-13: let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):(\d+)(-\d+)?:(.*)?$' let l:output = [] let l:corrected_lines = [] for l:line in a:lines if len(matchlist(l:line, l:pattern)) > 0 call add(l:corrected_lines, l:line) elseif len(l:corrected_lines) > 0 if l:line is# '' let l:corrected_lines[-1] .= ' ' " turn a blank line into a space else let l:corrected_lines[-1] .= l:line endif let l:corrected_lines[-1] = substitute(l:corrected_lines[-1], '\s\+', ' ', 'g') endif endfor for l:line in l:corrected_lines let l:match = matchlist(l:line, l:pattern) if len(l:match) == 0 continue endif if !ale#path#IsBufferPath(a:buffer, l:match[1]) continue endif let l:errors = matchlist(l:match[5], '\v([wW]arning|[eE]rror) - ?(.*)') if len(l:errors) > 0 let l:ghc_type = l:errors[1] let l:text = l:errors[2] else let l:ghc_type = '' let l:text = l:match[5][:0] is# ' ' ? l:match[5][1:] : l:match[5] endif if l:ghc_type is? 'Warning' let l:type = 'W' else let l:type = 'E' endif call add(l:output, { \ 'lnum': l:match[2] + 0, \ 'col': l:match[3] + 0, \ 'text': l:text, \ 'type': l:type, \}) endfor return l:output endfunction call ale#linter#Define('idris', { \ 'name': 'idris', \ 'executable': {b -> ale#Var(b, 'idris_idris_executable')}, \ 'command': function('ale_linters#idris#idris#GetCommand'), \ 'callback': 'ale_linters#idris#idris#Handle', \}) ale-4.0.0/ale_linters/ink/000077500000000000000000000000001476501472200153465ustar00rootroot00000000000000ale-4.0.0/ale_linters/ink/ls.vim000066400000000000000000000025261476501472200165060ustar00rootroot00000000000000" Author: Andreww Hayworth " Description: Integrate ALE with ink-language-server call ale#Set('ink_ls_executable', 'ink-language-server') call ale#Set('ink_ls_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('ink_ls_initialization_options', {}) function! ale_linters#ink#ls#GetExecutable(buffer) abort return ale#path#FindExecutable(a:buffer, 'ink_ls', [ \ 'ink-language-server', \ 'node_modules/.bin/ink-language-server', \]) endfunction function! ale_linters#ink#ls#GetCommand(buffer) abort let l:executable = ale_linters#ink#ls#GetExecutable(a:buffer) return ale#Escape(l:executable) . ' --stdio' endfunction function! ale_linters#ink#ls#FindProjectRoot(buffer) abort let l:main_file = get(ale#Var(a:buffer, 'ink_ls_initialization_options'), 'mainStoryPath', 'main.ink') let l:config = ale#path#ResolveLocalPath(a:buffer, l:main_file, expand('#' . a:buffer . ':p')) return ale#path#Dirname(l:config) endfunction call ale#linter#Define('ink', { \ 'name': 'ink-language-server', \ 'lsp': 'stdio', \ 'executable': function('ale_linters#ink#ls#GetExecutable'), \ 'command': function('ale_linters#ink#ls#GetCommand'), \ 'project_root': function('ale_linters#ink#ls#FindProjectRoot'), \ 'initialization_options': {b -> ale#Var(b, 'ink_ls_initialization_options')}, \}) ale-4.0.0/ale_linters/inko/000077500000000000000000000000001476501472200155255ustar00rootroot00000000000000ale-4.0.0/ale_linters/inko/inko.vim000066400000000000000000000021421476501472200172010ustar00rootroot00000000000000" Author: Yorick Peterse " Description: linting of Inko source code using the Inko compiler call ale#Set('inko_inko_executable', 'inko') function! ale_linters#inko#inko#GetCommand(buffer) abort let l:include = '' " Include the tests source directory, but only for test files. if expand('#' . a:buffer . ':p') =~? '\vtests[/\\]test[/\\]' let l:test_dir = ale#path#FindNearestDirectory(a:buffer, 'tests') if isdirectory(l:test_dir) let l:include = '--include ' . ale#Escape(l:test_dir) endif endif " We use %s instead of %t so the compiler determines the correct module " names for the file being edited. Not doing so may lead to errors in " certain cases. return '%e build --check --format=json' \ . ale#Pad(l:include) \ . ' %s' endfunction call ale#linter#Define('inko', { \ 'name': 'inko', \ 'executable': {b -> ale#Var(b, 'inko_inko_executable')}, \ 'command': function('ale_linters#inko#inko#GetCommand'), \ 'callback': 'ale#handlers#inko#Handle', \ 'output_stream': 'stderr', \ 'lint_file': 1 \}) ale-4.0.0/ale_linters/ispc/000077500000000000000000000000001476501472200155235ustar00rootroot00000000000000ale-4.0.0/ale_linters/ispc/ispc.vim000066400000000000000000000031231476501472200171750ustar00rootroot00000000000000" Author: Martino Pilia " Description: Lint ispc files with the Intel(R) SPMD Program Compiler call ale#Set('ispc_ispc_executable', 'ispc') call ale#Set('ispc_ispc_options', '') function! ale_linters#ispc#ispc#GetCommand(buffer) abort " --nowrap: do not wrap message lines return '%e --nowrap' \ . ale#Pad(ale#c#IncludeOptions(ale#c#FindLocalHeaderPaths(a:buffer))) \ . ale#Pad(ale#Var(a:buffer, 'ispc_ispc_options')) \ . ' %s' endfunction " Note that we ignore the two warnings in the beginning of the compiler output " ('no output file specified' and 'no --target specified'), since they have " nothing to do with linting. function! ale_linters#ispc#ispc#Handle(buffer, lines) abort " Message format: :: : " As far as I know, can be any of: " 'error', 'Error', 'fatal error', 'Warning', 'Performance Warning' let l:re = '\v.+:([0-9]+):([0-9]+):\s+([^:]+):\s+(.+)' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:re) call add(l:output, { \ 'bufnr': a:buffer, \ 'lnum': str2nr(l:match[1]), \ 'col': str2nr(l:match[2]), \ 'type': l:match[3] =~? 'error' ? 'E' : 'W', \ 'text': l:match[4], \}) endfor return l:output endfunction call ale#linter#Define('ispc', { \ 'name': 'ispc', \ 'output_stream': 'stderr', \ 'executable': {b -> ale#Var(b, 'ispc_ispc_executable')}, \ 'command': function('ale_linters#ispc#ispc#GetCommand'), \ 'callback': 'ale_linters#ispc#ispc#Handle', \ 'lint_file': 1, \}) ale-4.0.0/ale_linters/java/000077500000000000000000000000001476501472200155065ustar00rootroot00000000000000ale-4.0.0/ale_linters/java/checkstyle.vim000066400000000000000000000042561476501472200203700ustar00rootroot00000000000000" Author: Devon Meunier " Description: checkstyle for Java files call ale#Set('java_checkstyle_executable', 'checkstyle') call ale#Set('java_checkstyle_config', '/google_checks.xml') call ale#Set('java_checkstyle_options', '') function! ale_linters#java#checkstyle#Handle(buffer, lines) abort let l:output = [] " modern checkstyle versions let l:pattern = '\v\[(WARN|ERROR)\] [a-zA-Z]?:?[^:]+:(\d+):(\d+)?:? (.*) \[(.+)\]' for l:match in ale#util#GetMatches(a:lines, l:pattern) call add(l:output, { \ 'type': l:match[1] is? 'WARN' ? 'W' : 'E', \ 'sub_type': 'style', \ 'lnum': l:match[2] + 0, \ 'col': l:match[3] + 0, \ 'text': l:match[4], \ 'code': l:match[5], \}) endfor if !empty(l:output) return l:output endif " old checkstyle versions let l:pattern = '\v(.+):(\d+): ([^:]+): (.+)$' for l:match in ale#util#GetMatches(a:lines, l:pattern) call add(l:output, { \ 'type': l:match[3] is? 'warning' ? 'W' : 'E', \ 'sub_type': 'style', \ 'lnum': l:match[2] + 0, \ 'text': l:match[4], \}) endfor return l:output endfunction function! s:GetConfig(buffer, config) abort if ale#path#IsAbsolute(a:config) return a:config endif let s:file = ale#path#FindNearestFile(a:buffer, a:config) return !empty(s:file) ? s:file : a:config endfunction function! ale_linters#java#checkstyle#GetCommand(buffer) abort let l:options = ale#Var(a:buffer, 'java_checkstyle_options') let l:config_option = ale#Var(a:buffer, 'java_checkstyle_config') let l:config = l:options !~# '\v(^| )-c ' && !empty(l:config_option) \ ? s:GetConfig(a:buffer, l:config_option) \ : '' return '%e' \ . ale#Pad(l:options) \ . (!empty(l:config) ? ' -c ' . ale#Escape(l:config) : '') \ . ' %s' endfunction call ale#linter#Define('java', { \ 'name': 'checkstyle', \ 'executable': {b -> ale#Var(b, 'java_checkstyle_executable')}, \ 'command': function('ale_linters#java#checkstyle#GetCommand'), \ 'callback': 'ale_linters#java#checkstyle#Handle', \ 'lint_file': 1, \}) ale-4.0.0/ale_linters/java/cspell.vim000066400000000000000000000002301476501472200175000ustar00rootroot00000000000000scriptencoding utf-8 " Author: David Houston " Description: cspell support for Java files. call ale#handlers#cspell#DefineLinter('java') ale-4.0.0/ale_linters/java/eclipselsp.vim000066400000000000000000000140061476501472200203670ustar00rootroot00000000000000" Author: Horacio Sanson " Description: Support for the Eclipse language server https://github.com/eclipse/eclipse.jdt.ls let s:version_cache = {} call ale#Set('java_eclipselsp_path', ale#path#Simplify($HOME . '/eclipse.jdt.ls')) call ale#Set('java_eclipselsp_config_path', '') call ale#Set('java_eclipselsp_workspace_path', '') call ale#Set('java_eclipselsp_executable', 'java') call ale#Set('java_eclipselsp_javaagent', '') function! ale_linters#java#eclipselsp#Executable(buffer) abort return ale#Var(a:buffer, 'java_eclipselsp_executable') endfunction function! ale_linters#java#eclipselsp#TargetPath(buffer) abort return ale#Var(a:buffer, 'java_eclipselsp_path') endfunction function! ale_linters#java#eclipselsp#JarPath(buffer) abort let l:path = ale_linters#java#eclipselsp#TargetPath(a:buffer) if has('win32') let l:platform = 'win32' elseif has('macunix') let l:platform = 'macosx' else let l:platform = 'linux' endif " Search jar file within repository path when manually built using mvn let l:files = globpath(l:path, '**/'.l:platform.'/**/plugins/org.eclipse.equinox.launcher_*\.jar', 1, 1) if len(l:files) >= 1 return l:files[0] endif " Search jar file within VSCode extensions folder. let l:files = globpath(l:path, '**/'.l:platform.'/plugins/org.eclipse.equinox.launcher_*\.jar', 1, 1) if len(l:files) >= 1 return l:files[0] endif " Search jar file within unzipped tar.gz file let l:files = globpath(l:path, 'plugins/org.eclipse.equinox.launcher_*\.jar', 1, 1) if len(l:files) >= 1 return l:files[0] endif " Search jar file within system package path let l:files = globpath('/usr/share/java/jdtls/plugins', 'org.eclipse.equinox.launcher_*\.jar', 1, 1) if len(l:files) >= 1 return l:files[0] endif return '' endfunction function! ale_linters#java#eclipselsp#ConfigurationPath(buffer) abort let l:path = fnamemodify(ale_linters#java#eclipselsp#JarPath(a:buffer), ':p:h:h') let l:config_path = ale#Var(a:buffer, 'java_eclipselsp_config_path') if !empty(l:config_path) return ale#path#Simplify(l:config_path) endif if has('win32') let l:path = l:path . '/config_win' elseif has('macunix') let l:path = l:path . '/config_mac' else let l:path = l:path . '/config_linux' endif return ale#path#Simplify(l:path) endfunction function! ale_linters#java#eclipselsp#VersionCheck(version_lines) abort return s:GetVersion('', a:version_lines) endfunction function! s:GetVersion(executable, version_lines) abort let l:version = [] for l:line in a:version_lines let l:match = matchlist(l:line, '\(\d\+\)\.\(\d\+\)\.\(\d\+\)') if !empty(l:match) let l:version = [l:match[1] + 0, l:match[2] + 0, l:match[3] + 0] let s:version_cache[a:executable] = l:version break endif endfor return l:version endfunction function! ale_linters#java#eclipselsp#CommandWithVersion(buffer, version_lines, meta) abort let l:executable = ale_linters#java#eclipselsp#Executable(a:buffer) let l:version = s:GetVersion(l:executable, a:version_lines) return ale_linters#java#eclipselsp#Command(a:buffer, l:version) endfunction function! ale_linters#java#eclipselsp#WorkspacePath(buffer) abort let l:wspath = ale#Var(a:buffer, 'java_eclipselsp_workspace_path') if !empty(l:wspath) return l:wspath endif return ale#path#Dirname(ale#java#FindProjectRoot(a:buffer)) endfunction function! ale_linters#java#eclipselsp#Javaagent(buffer) abort let l:rets = [] let l:raw = ale#Var(a:buffer, 'java_eclipselsp_javaagent') if empty(l:raw) return '' endif let l:jars = split(l:raw) for l:jar in l:jars call add(l:rets, ale#Escape('-javaagent:' . l:jar)) endfor return join(l:rets, ' ') endfunction function! ale_linters#java#eclipselsp#Command(buffer, version) abort let l:path = ale#Var(a:buffer, 'java_eclipselsp_path') let l:executable = ale_linters#java#eclipselsp#Executable(a:buffer) let l:cmd = [ ale#Escape(l:executable), \ ale_linters#java#eclipselsp#Javaagent(a:buffer), \ '-Declipse.application=org.eclipse.jdt.ls.core.id1', \ '-Dosgi.bundles.defaultStartLevel=4', \ '-Declipse.product=org.eclipse.jdt.ls.core.product', \ '-Dlog.level=ALL', \ '-noverify', \ '-Xmx1G', \ '-jar', \ ale#Escape(ale_linters#java#eclipselsp#JarPath(a:buffer)), \ '-configuration', \ ale#Escape(ale_linters#java#eclipselsp#ConfigurationPath(a:buffer)), \ '-data', \ ale#Escape(ale_linters#java#eclipselsp#WorkspacePath(a:buffer)) \ ] if ale#semver#GTE(a:version, [1, 9]) call add(l:cmd, '--add-modules=ALL-SYSTEM') call add(l:cmd, '--add-opens java.base/java.util=ALL-UNNAMED') call add(l:cmd, '--add-opens java.base/java.lang=ALL-UNNAMED') endif return join(l:cmd, ' ') endfunction function! ale_linters#java#eclipselsp#RunWithVersionCheck(buffer) abort let l:executable = ale_linters#java#eclipselsp#Executable(a:buffer) if empty(l:executable) return '' endif let l:cache = s:version_cache if has_key(s:version_cache, l:executable) return ale_linters#java#eclipselsp#Command(a:buffer, s:version_cache[l:executable]) endif let l:command = ale#Escape(l:executable) . ' -version' return ale#command#Run( \ a:buffer, \ l:command, \ function('ale_linters#java#eclipselsp#CommandWithVersion'), \ { 'output_stream': 'both' } \) endfunction call ale#linter#Define('java', { \ 'name': 'eclipselsp', \ 'lsp': 'stdio', \ 'executable': function('ale_linters#java#eclipselsp#Executable'), \ 'command': function('ale_linters#java#eclipselsp#RunWithVersionCheck'), \ 'language': 'java', \ 'project_root': function('ale#java#FindProjectRoot'), \ 'initialization_options': { \ 'extendedClientCapabilities': { \ 'classFileContentsSupport': v:true \ } \ } \}) ale-4.0.0/ale_linters/java/javac.vim000066400000000000000000000126431476501472200173150ustar00rootroot00000000000000" Author: farenjihn , w0rp " Description: Lints java files using javac let s:classpath_sep = has('unix') ? ':' : ';' call ale#Set('java_javac_executable', 'javac') call ale#Set('java_javac_options', '') call ale#Set('java_javac_classpath', '') call ale#Set('java_javac_sourcepath', '') function! ale_linters#java#javac#RunWithImportPaths(buffer) abort let [l:cwd, l:command] = ale#maven#BuildClasspathCommand(a:buffer) " Try to use Gradle if Maven isn't available. if empty(l:command) let [l:cwd, l:command] = ale#gradle#BuildClasspathCommand(a:buffer) endif " Try to use Ant if Gradle and Maven aren't available if empty(l:command) let [l:cwd, l:command] = ale#ant#BuildClasspathCommand(a:buffer) endif if empty(l:command) return ale_linters#java#javac#GetCommand(a:buffer, [], {}) endif return ale#command#Run( \ a:buffer, \ l:command, \ function('ale_linters#java#javac#GetCommand'), \ {'cwd': l:cwd}, \) endfunction function! s:BuildClassPathOption(buffer, import_paths) abort " Filter out lines like [INFO], etc. let l:class_paths = filter(a:import_paths[:], 'v:val !~# ''[''') let l:cls_path = ale#Var(a:buffer, 'java_javac_classpath') if !empty(l:cls_path) && type(l:cls_path) is v:t_string call extend(l:class_paths, split(l:cls_path, s:classpath_sep)) endif if !empty(l:cls_path) && type(l:cls_path) is v:t_list call extend(l:class_paths, l:cls_path) endif return !empty(l:class_paths) \ ? '-cp ' . ale#Escape(join(l:class_paths, s:classpath_sep)) \ : '' endfunction function! ale_linters#java#javac#GetCommand(buffer, import_paths, meta) abort let l:cp_option = s:BuildClassPathOption(a:buffer, a:import_paths) let l:sp_option = '' " Find the src directory, for files in this project. let l:src_dir = ale#path#FindNearestDirectory(a:buffer, 'src/main/java') let l:sp_dirs = [] if !empty(l:src_dir) call add(l:sp_dirs, l:src_dir) " Automatically include the jaxb directory too, if it's there. let l:jaxb_dir = fnamemodify(l:src_dir, ':h:h') \ . (has('win32') ? '\jaxb\' : '/jaxb/') if isdirectory(l:jaxb_dir) call add(l:sp_dirs, l:jaxb_dir) endif endif " Automatically include the test directory, but only for test code. if expand('#' . a:buffer . ':p') =~? '\vsrc[/\\]test[/\\]java' let l:test_dir = ale#path#FindNearestDirectory(a:buffer, 'src/test/java') if isdirectory(l:test_dir) call add(l:sp_dirs, l:test_dir) endif endif let l:source_paths = [] let l:source_path = ale#Var(a:buffer, 'java_javac_sourcepath') if !empty(l:source_path) && type(l:source_path) is v:t_string let l:source_paths = split(l:source_path, s:classpath_sep) endif if !empty(l:source_path) && type(l:source_path) is v:t_list let l:source_paths = l:source_path endif if !empty(l:source_paths) for l:path in l:source_paths let l:sp_path = ale#path#FindNearestDirectory(a:buffer, l:path) if !empty(l:sp_path) call add(l:sp_dirs, l:sp_path) endif endfor endif if !empty(l:sp_dirs) let l:sp_option = '-sourcepath ' \ . ale#Escape(join(l:sp_dirs, s:classpath_sep)) endif " Create .class files in a temporary directory, which we will delete later. let l:class_file_directory = ale#command#CreateDirectory(a:buffer) " Always run javac from the directory the file is in, so we can resolve " relative paths correctly. return '%e -Xlint' \ . ale#Pad(l:cp_option) \ . ale#Pad(l:sp_option) \ . ' -d ' . ale#Escape(l:class_file_directory) \ . ale#Pad(ale#Var(a:buffer, 'java_javac_options')) \ . ' %t' endfunction function! ale_linters#java#javac#Handle(buffer, lines) abort " Look for lines like the following. " " Main.java:13: warning: [deprecation] donaught() in Testclass has been deprecated " Main.java:16: error: ';' expected let l:directory = expand('#' . a:buffer . ':p:h') let l:pattern = '\v^(.*):(\d+): (.{-1,}):(.+)$' let l:col_pattern = '\v^(\s*\^)$' let l:symbol_pattern = '\v^ +symbol: *(class|method) +([^ ]+)' let l:output = [] for l:match in ale#util#GetMatches(a:lines, [l:pattern, l:col_pattern, l:symbol_pattern]) if empty(l:match[2]) && empty(l:match[3]) if !empty(l:match[1]) && !empty(l:output) let l:output[-1].col = len(l:match[1]) endif elseif empty(l:match[3]) " Add symbols to 'cannot find symbol' errors. if l:output[-1].text is# 'error: cannot find symbol' let l:output[-1].text .= ': ' . l:match[2] endif else call add(l:output, { \ 'filename': ale#path#GetAbsPath(l:directory, l:match[1]), \ 'lnum': l:match[2] + 0, \ 'text': l:match[3] . ':' . l:match[4], \ 'type': l:match[3] is# 'error' ? 'E' : 'W', \}) endif endfor return l:output endfunction call ale#linter#Define('java', { \ 'name': 'javac', \ 'executable': {b -> ale#Var(b, 'java_javac_executable')}, \ 'cwd': '%s:h', \ 'command': function('ale_linters#java#javac#RunWithImportPaths'), \ 'output_stream': 'stderr', \ 'callback': 'ale_linters#java#javac#Handle', \}) ale-4.0.0/ale_linters/java/javalsp.vim000066400000000000000000000043021476501472200176620ustar00rootroot00000000000000" Author: Horacio Sanson " Description: Support for the Java language server https://github.com/georgewfraser/vscode-javac call ale#Set('java_javalsp_executable', '') call ale#Set('java_javalsp_config', {}) function! ale_linters#java#javalsp#Executable(buffer) abort return ale#Var(a:buffer, 'java_javalsp_executable') endfunction function! ale_linters#java#javalsp#Config(buffer) abort let l:defaults = { 'java': { 'classPath': [], 'externalDependencies': [] } } let l:config = ale#Var(a:buffer, 'java_javalsp_config') " Ensure the config dictionary contains both classPath and " externalDependencies keys to avoid a NPE crash on Java Language Server. call extend(l:config, l:defaults, 'keep') call extend(l:config['java'], l:defaults['java'], 'keep') return l:config endfunction function! ale_linters#java#javalsp#Command(buffer) abort let l:executable = ale_linters#java#javalsp#Executable(a:buffer) if fnamemodify(l:executable, ':t') is# 'java' " For backward compatibility. let l:cmd = [ \ ale#Escape(l:executable), \ '--add-exports jdk.compiler/com.sun.tools.javac.api=javacs', \ '--add-exports jdk.compiler/com.sun.tools.javac.code=javacs', \ '--add-exports jdk.compiler/com.sun.tools.javac.comp=javacs', \ '--add-exports jdk.compiler/com.sun.tools.javac.main=javacs', \ '--add-exports jdk.compiler/com.sun.tools.javac.tree=javacs', \ '--add-exports jdk.compiler/com.sun.tools.javac.model=javacs', \ '--add-exports jdk.compiler/com.sun.tools.javac.util=javacs', \ '--add-opens jdk.compiler/com.sun.tools.javac.api=javacs', \ '-m javacs/org.javacs.Main', \] return join(l:cmd, ' ') else return ale#Escape(l:executable) endif endfunction call ale#linter#Define('java', { \ 'name': 'javalsp', \ 'aliases': ['java_language_server'], \ 'lsp': 'stdio', \ 'executable': function('ale_linters#java#javalsp#Executable'), \ 'command': function('ale_linters#java#javalsp#Command'), \ 'language': 'java', \ 'project_root': function('ale#java#FindProjectRoot'), \ 'lsp_config': function('ale_linters#java#javalsp#Config') \}) ale-4.0.0/ale_linters/java/pmd.vim000066400000000000000000000020041476501472200167770ustar00rootroot00000000000000" Author: Johannes Wienke " Description: PMD for Java files function! ale_linters#java#pmd#Handle(buffer, lines) abort let l:pattern = '"\(\d\+\)",".*","\(.\+\)","\(\d\+\)","\(\d\+\)","\(.\+\)","\(.\+\)","\(.\+\)"$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) call add(l:output, { \ 'type': 'W', \ 'lnum': l:match[4] + 0, \ 'text': l:match[5], \ 'code': l:match[6] . ' - ' . l:match[7], \}) endfor return l:output endfunction function! ale_linters#java#pmd#GetCommand(buffer) abort return 'pmd ' \ . ale#Var(a:buffer, 'java_pmd_options') \ . ' -f csv' \ . ' -d %t' endfunction if !exists('g:ale_java_pmd_options') let g:ale_java_pmd_options = '-R category/java/bestpractices.xml' endif call ale#linter#Define('java', { \ 'name': 'pmd', \ 'executable': 'pmd', \ 'command': function('ale_linters#java#pmd#GetCommand'), \ 'callback': 'ale_linters#java#pmd#Handle', \}) ale-4.0.0/ale_linters/javascript/000077500000000000000000000000001476501472200167335ustar00rootroot00000000000000ale-4.0.0/ale_linters/javascript/biome.vim000066400000000000000000000006121476501472200205420ustar00rootroot00000000000000" Author: Filip Gospodinov " Description: biome for JavaScript files call ale#linter#Define('javascript', { \ 'name': 'biome', \ 'lsp': 'stdio', \ 'language': function('ale#handlers#biome#GetLanguage'), \ 'executable': function('ale#handlers#biome#GetExecutable'), \ 'command': '%e lsp-proxy', \ 'project_root': function('ale#handlers#biome#GetProjectRoot'), \}) ale-4.0.0/ale_linters/javascript/cspell.vim000066400000000000000000000002441476501472200207320ustar00rootroot00000000000000scriptencoding utf-8 " Author: David Houston " Description: cspell support for JavaScript files. call ale#handlers#cspell#DefineLinter('javascript') ale-4.0.0/ale_linters/javascript/deno.vim000066400000000000000000000006531476501472200204010ustar00rootroot00000000000000" Author: Arnold Chand " Description: Deno lsp linter for JavaScript files. call ale#linter#Define('javascript', { \ 'name': 'deno', \ 'lsp': 'stdio', \ 'executable': function('ale#handlers#deno#GetExecutable'), \ 'command': '%e lsp', \ 'project_root': function('ale#handlers#deno#GetProjectRoot'), \ 'initialization_options': function('ale#handlers#deno#GetInitializationOptions'), \}) ale-4.0.0/ale_linters/javascript/eslint.vim000066400000000000000000000006161476501472200207510ustar00rootroot00000000000000" Author: w0rp " Description: eslint for JavaScript files call ale#linter#Define('javascript', { \ 'name': 'eslint', \ 'output_stream': 'both', \ 'executable': function('ale#handlers#eslint#GetExecutable'), \ 'cwd': function('ale#handlers#eslint#GetCwd'), \ 'command': function('ale#handlers#eslint#GetCommand'), \ 'callback': 'ale#handlers#eslint#HandleJSON', \}) ale-4.0.0/ale_linters/javascript/fecs.vim000066400000000000000000000005071476501472200203720ustar00rootroot00000000000000" Author: harttle " Description: fecs for JavaScript files call ale#linter#Define('javascript', { \ 'name': 'fecs', \ 'executable': function('ale#handlers#fecs#GetExecutable'), \ 'command': function('ale#handlers#fecs#GetCommand'), \ 'read_buffer': 0, \ 'callback': 'ale#handlers#fecs#Handle', \}) ale-4.0.0/ale_linters/javascript/flow.vim000066400000000000000000000115641476501472200204260ustar00rootroot00000000000000" Author: Zach Perrault -- @zperrault " Author: Florian Beeres " Description: FlowType checking for JavaScript files call ale#Set('javascript_flow_executable', 'flow') call ale#Set('javascript_flow_use_home_config', 0) call ale#Set('javascript_flow_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('javascript_flow_use_respect_pragma', 1) function! ale_linters#javascript#flow#GetExecutable(buffer) abort let l:flow_config = ale#path#FindNearestFile(a:buffer, '.flowconfig') if empty(l:flow_config) " Don't run Flow if we can't find a .flowconfig file. return '' endif " Don't run Flow with a configuration file from the home directory by " default, which can eat all of your RAM. if fnamemodify(l:flow_config, ':h') is? $HOME \&& !ale#Var(a:buffer, 'javascript_flow_use_home_config') return '' endif return ale#path#FindExecutable(a:buffer, 'javascript_flow', [ \ 'node_modules/.bin/flow', \]) endfunction function! ale_linters#javascript#flow#GetCommand(buffer, version) abort " If we can parse the version number, then only use --respect-pragma " if the version is >= 0.36.0, which added the argument. let l:use_respect_pragma = ale#Var(a:buffer, 'javascript_flow_use_respect_pragma') \ && (empty(a:version) || ale#semver#GTE(a:version, [0, 36])) return '%e check-contents' \ . (l:use_respect_pragma ? ' --respect-pragma': '') \ . ' --json --from ale %s < %t' \ . (!has('win32') ? '; echo' : '') endfunction " Filter lines of flow output until we find the first line where the JSON " output starts. function! s:GetJSONLines(lines) abort let l:start_index = 0 for l:line in a:lines if l:line[:0] is# '{' break endif let l:start_index += 1 endfor return a:lines[l:start_index :] endfunction function! s:ExtraErrorMsg(current, new) abort let l:newMsg = '' if a:current is# '' " extra messages appear to already have a : let l:newMsg = a:new else let l:newMsg = a:current . ' ' . a:new endif return l:newMsg endfunction function! s:GetDetails(error) abort let l:detail = '' for l:extra_error in a:error.extra if has_key(l:extra_error, 'message') for l:extra_message in l:extra_error.message let l:detail = s:ExtraErrorMsg(l:detail, l:extra_message.descr) endfor endif if has_key(l:extra_error, 'children') for l:child in l:extra_error.children for l:child_message in l:child.message let l:detail = l:detail . ' ' . l:child_message.descr endfor endfor endif endfor return l:detail endfunction function! ale_linters#javascript#flow#Handle(buffer, lines) abort let l:str = join(s:GetJSONLines(a:lines), '') if empty(l:str) return [] endif let l:flow_output = json_decode(l:str) let l:output = [] for l:error in get(l:flow_output, 'errors', []) " Each error is broken up into parts let l:text = '' let l:line = 0 let l:col = 0 for l:message in l:error.message " Comments have no line of column information, so we skip them. " In certain cases, `l:message.loc.source` points to a different path " than the buffer one, thus we skip this loc information too. if has_key(l:message, 'loc') \&& l:line is# 0 \&& ale#path#IsBufferPath(a:buffer, l:message.loc.source) let l:line = l:message.loc.start.line + 0 let l:col = l:message.loc.start.column + 0 endif if l:text is# '' let l:text = l:message.descr . ':' else let l:text = l:text . ' ' . l:message.descr endif endfor if has_key(l:error, 'operation') let l:text = l:text . ' See also: ' . l:error.operation.descr endif let l:errorToAdd = { \ 'lnum': l:line, \ 'col': l:col, \ 'text': l:text, \ 'type': has_key(l:error, 'level') && l:error.level is# 'error' ? 'E' : 'W', \} if has_key(l:error, 'extra') let l:errorToAdd.detail = l:errorToAdd.text \ . "\n" . s:GetDetails(l:error) endif call add(l:output, l:errorToAdd) endfor return l:output endfunction call ale#linter#Define('javascript', { \ 'name': 'flow', \ 'executable': function('ale_linters#javascript#flow#GetExecutable'), \ 'command': {buffer -> ale#semver#RunWithVersionCheck( \ buffer, \ ale_linters#javascript#flow#GetExecutable(buffer), \ '%e --version', \ function('ale_linters#javascript#flow#GetCommand'), \ )}, \ 'callback': 'ale_linters#javascript#flow#Handle', \ 'read_buffer': 0, \}) ale-4.0.0/ale_linters/javascript/flow_ls.vim000066400000000000000000000016101476501472200211130ustar00rootroot00000000000000" Author: t_t " Description: Integrate ALE with flow-language-server. call ale#Set('javascript_flow_ls_executable', 'flow') call ale#Set('javascript_flow_ls_use_global', \ get(g:, 'ale_use_global_executables', 0) \) function! ale_linters#javascript#flow_ls#FindProjectRoot(buffer) abort let l:flow_config = ale#path#FindNearestFile(a:buffer, '.flowconfig') if !empty(l:flow_config) return fnamemodify(l:flow_config, ':h') endif return '' endfunction call ale#linter#Define('javascript', { \ 'name': 'flow_ls', \ 'aliaes': ['flow-language-server'], \ 'lsp': 'stdio', \ 'executable': {b -> ale#path#FindExecutable(b, 'javascript_flow_ls', [ \ 'node_modules/.bin/flow', \ ])}, \ 'command': '%e lsp --from ale-lsp', \ 'project_root': function('ale_linters#javascript#flow_ls#FindProjectRoot'), \ 'language': 'javascript', \}) ale-4.0.0/ale_linters/javascript/jscs.vim000066400000000000000000000034141476501472200204140ustar00rootroot00000000000000" Author: Chris Kyrouac - https://github.com/fijshion " Description: jscs for JavaScript files call ale#Set('javascript_jscs_executable', 'jscs') call ale#Set('javascript_jscs_use_global', get(g:, 'ale_use_global_executables', 0)) function! ale_linters#javascript#jscs#GetCommand(buffer) abort " Search for a local JShint config locaation, and default to a global one. let l:jscs_config = ale#path#ResolveLocalPath( \ a:buffer, \ '.jscsrc', \ get(g:, 'ale_jscs_config_loc', '') \) let l:command = '%e --reporter inline --no-colors' if !empty(l:jscs_config) let l:command .= ' --config ' . ale#Escape(l:jscs_config) endif let l:command .= ' -' return l:command endfunction function! ale_linters#javascript#jscs#Handle(buffer, lines) abort " Matches patterns looking like the following " " foobar.js: line 2, col 1, Expected indentation of 1 characters " let l:pattern = '\v^.*:\s+line (\d+),\s+col\s+(\d+),\s+(.*)$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) let l:obj = { \ 'lnum': l:match[1] + 0, \ 'col': l:match[2] + 0, \ 'text': l:match[3] \} let l:code_match = matchlist(l:match[3], '\v([^ :]+): (.+)$') if !empty(l:code_match) let l:obj.code = l:code_match[1] let l:obj.text = l:code_match[2] endif call add(l:output, l:obj) endfor return l:output endfunction call ale#linter#Define('javascript', { \ 'name': 'jscs', \ 'executable': {b -> ale#path#FindExecutable(b, 'javascript_jscs', [ \ 'node_modules/.bin/jscs', \ ])}, \ 'command': function('ale_linters#javascript#jscs#GetCommand'), \ 'callback': 'ale_linters#javascript#jscs#Handle', \}) ale-4.0.0/ale_linters/javascript/jshint.vim000066400000000000000000000020641476501472200207510ustar00rootroot00000000000000" Author: Chris Kyrouac - https://github.com/fijshion " Description: JSHint for Javascript files call ale#Set('javascript_jshint_executable', 'jshint') call ale#Set('javascript_jshint_use_global', get(g:, 'ale_use_global_executables', 0)) function! ale_linters#javascript#jshint#GetCommand(buffer) abort " Search for a local JShint config locaation, and default to a global one. let l:jshint_config = ale#path#ResolveLocalPath( \ a:buffer, \ '.jshintrc', \ get(g:, 'ale_jshint_config_loc', '') \) let l:command = '%e --reporter unix --extract auto' if !empty(l:jshint_config) let l:command .= ' --config ' . ale#Escape(l:jshint_config) endif let l:command .= ' --filename %s -' return l:command endfunction call ale#linter#Define('javascript', { \ 'name': 'jshint', \ 'executable': {b -> ale#path#FindExecutable(b, 'javascript_jshint', [ \ 'node_modules/.bin/jshint', \ ])}, \ 'command': function('ale_linters#javascript#jshint#GetCommand'), \ 'callback': 'ale#handlers#unix#HandleAsError', \}) ale-4.0.0/ale_linters/javascript/standard.vim000066400000000000000000000024251476501472200212530ustar00rootroot00000000000000" Author: Ahmed El Gabri <@ahmedelgabri> " Description: standardjs for JavaScript files call ale#Set('javascript_standard_executable', 'standard') call ale#Set('javascript_standard_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('javascript_standard_options', '') function! ale_linters#javascript#standard#GetExecutable(buffer) abort return ale#path#FindExecutable(a:buffer, 'javascript_standard', [ \ 'node_modules/standardx/bin/cmd.js', \ 'node_modules/standard/bin/cmd.js', \ 'node_modules/semistandard/bin/cmd.js', \ 'node_modules/.bin/standard', \]) endfunction function! ale_linters#javascript#standard#GetCommand(buffer) abort let l:executable = ale_linters#javascript#standard#GetExecutable(a:buffer) let l:options = ale#Var(a:buffer, 'javascript_standard_options') return ale#node#Executable(a:buffer, l:executable) \ . (!empty(l:options) ? ' ' . l:options : '') \ . ' --stdin %s' endfunction " standard uses eslint and the output format is the same call ale#linter#Define('javascript', { \ 'name': 'standard', \ 'executable': function('ale_linters#javascript#standard#GetExecutable'), \ 'command': function('ale_linters#javascript#standard#GetCommand'), \ 'callback': 'ale#handlers#eslint#Handle', \}) ale-4.0.0/ale_linters/javascript/tsserver.vim000066400000000000000000000011511476501472200213230ustar00rootroot00000000000000" Author: Chaucerbao, w0rp " Description: tsserver integration for ALE call ale#Set('javascript_tsserver_executable', 'tsserver') call ale#Set('javascript_tsserver_config_path', '') call ale#Set('javascript_tsserver_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#linter#Define('javascript', { \ 'name': 'tsserver', \ 'lsp': 'tsserver', \ 'executable': {b -> ale#path#FindExecutable(b, 'javascript_tsserver', [ \ 'node_modules/.bin/tsserver', \ ])}, \ 'command': '%e', \ 'project_root': function('ale#handlers#tsserver#GetProjectRoot'), \ 'language': '', \}) ale-4.0.0/ale_linters/javascript/xo.vim000066400000000000000000000004731476501472200201020ustar00rootroot00000000000000" Author: Daniel Lupu " Description: xo for JavaScript files call ale#linter#Define('javascript', { \ 'name': 'xo', \ 'executable': function('ale#handlers#xo#GetExecutable'), \ 'command': function('ale#handlers#xo#GetLintCommand'), \ 'callback': 'ale#handlers#xo#HandleJSON', \}) ale-4.0.0/ale_linters/json/000077500000000000000000000000001476501472200155365ustar00rootroot00000000000000ale-4.0.0/ale_linters/json/biome.vim000066400000000000000000000005211476501472200173440ustar00rootroot00000000000000" Description: biome for json files call ale#linter#Define('json', { \ 'name': 'biome', \ 'lsp': 'stdio', \ 'language': function('ale#handlers#biome#GetLanguage'), \ 'executable': function('ale#handlers#biome#GetExecutable'), \ 'command': '%e lsp-proxy', \ 'project_root': function('ale#handlers#biome#GetProjectRoot'), \}) ale-4.0.0/ale_linters/json/cspell.vim000066400000000000000000000002301476501472200175300ustar00rootroot00000000000000scriptencoding utf-8 " Author: David Houston " Description: cspell support for JSON files. call ale#handlers#cspell#DefineLinter('json') ale-4.0.0/ale_linters/json/eslint.vim000066400000000000000000000010421476501472200175460ustar00rootroot00000000000000" Author: João Pesce " Description: eslint for JSON files. " " Requires eslint-plugin-jsonc or a similar plugin to work " " Uses the same funtcions as ale_linters/javascript/eslint.vim by w0rp " call ale#linter#Define('json', { \ 'name': 'eslint', \ 'output_stream': 'both', \ 'executable': function('ale#handlers#eslint#GetExecutable'), \ 'cwd': function('ale#handlers#eslint#GetCwd'), \ 'command': function('ale#handlers#eslint#GetCommand'), \ 'callback': 'ale#handlers#eslint#HandleJSON', \}) ale-4.0.0/ale_linters/json/jq.vim000066400000000000000000000014021476501472200166620ustar00rootroot00000000000000" Author: jD91mZM2 call ale#Set('json_jq_executable', 'jq') call ale#Set('json_jq_options', '') call ale#Set('json_jq_filters', '.') " Matches patterns like the following: " parse error: Expected another key-value pair at line 4, column 3 let s:pattern = 'parse error: \(.\+\) at line \(\d\+\), column \(\d\+\)$' function! ale_linters#json#jq#Handle(buffer, lines) abort return ale#util#MapMatches(a:lines, s:pattern, {match -> { \ 'text': match[1], \ 'lnum': match[2] + 0, \ 'col': match[3] + 0, \}}) endfunction call ale#linter#Define('json', { \ 'name': 'jq', \ 'executable': {b -> ale#Var(b, 'json_jq_executable')}, \ 'output_stream': 'stderr', \ 'command': '%e', \ 'callback': 'ale_linters#json#jq#Handle', \}) ale-4.0.0/ale_linters/json/jsonlint.vim000066400000000000000000000027071476501472200201210ustar00rootroot00000000000000" Author: KabbAmine , David Sierra call ale#Set('json_jsonlint_executable', 'jsonlint') call ale#Set('json_jsonlint_use_global', get(g:, 'ale_use_global_executables', 0)) function! ale_linters#json#jsonlint#GetExecutable(buffer) abort return ale#path#FindExecutable(a:buffer, 'json_jsonlint', [ \ 'node_modules/.bin/jsonlint', \ 'node_modules/jsonlint/lib/cli.js', \]) endfunction function! ale_linters#json#jsonlint#GetCommand(buffer) abort let l:executable = ale_linters#json#jsonlint#GetExecutable(a:buffer) return ale#node#Executable(a:buffer, l:executable) \ . ' --compact -' endfunction function! ale_linters#json#jsonlint#Handle(buffer, lines) abort " Matches patterns like the following: " line 2, col 15, found: 'STRING' - expected: 'EOF', '}', ',', ']'. let l:pattern = '^line \(\d\+\), col \(\d*\), \(.\+\)$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) call add(l:output, { \ 'lnum': l:match[1] + 0, \ 'col': l:match[2] + 0, \ 'text': l:match[3], \}) endfor return l:output endfunction call ale#linter#Define('json', { \ 'name': 'jsonlint', \ 'executable': function('ale_linters#json#jsonlint#GetExecutable'), \ 'output_stream': 'stderr', \ 'command': function('ale_linters#json#jsonlint#GetCommand'), \ 'callback': 'ale_linters#json#jsonlint#Handle', \}) ale-4.0.0/ale_linters/json/spectral.vim000066400000000000000000000010411476501472200200640ustar00rootroot00000000000000" Author: t2h5 " Description: Integration of Stoplight Spectral CLI with ALE. call ale#Set('json_spectral_executable', 'spectral') call ale#Set('json_spectral_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#linter#Define('json', { \ 'name': 'spectral', \ 'executable': {b -> ale#path#FindExecutable(b, 'json_spectral', [ \ 'node_modules/.bin/spectral', \ ])}, \ 'command': '%e lint --ignore-unknown-format -q -f text %t', \ 'callback': 'ale#handlers#spectral#HandleSpectralOutput' \}) ale-4.0.0/ale_linters/json/vscodejson.vim000066400000000000000000000020721476501472200204310ustar00rootroot00000000000000" Author: Dalius Dobravolskas " Description: VSCode json language server call ale#Set('json_vscodejson_executable', '') function! ale_linters#json#vscodejson#GetExecutable(buffer) abort let l:executable = ale#Var(a:buffer, 'json_vscodejson_executable') if l:executable is# '' if ale#engine#IsExecutable(a:buffer, 'vscode-json-languageserver') let l:executable = 'vscode-json-languageserver' else let l:executable = 'vscode-json-language-server' endif endif return l:executable endfunction function! ale_linters#json#vscodejson#GetProjectRoot(buffer) abort let l:git_path = ale#path#FindNearestDirectory(a:buffer, '.git') return !empty(l:git_path) ? fnamemodify(l:git_path, ':h:h') : '' endfunction call ale#linter#Define('json', { \ 'name': 'vscodejson', \ 'lsp': 'stdio', \ 'executable': function('ale_linters#json#vscodejson#GetExecutable'), \ 'command': '%e --stdio', \ 'project_root': function('ale_linters#json#vscodejson#GetProjectRoot'), \}) ale-4.0.0/ale_linters/json5/000077500000000000000000000000001476501472200156235ustar00rootroot00000000000000ale-4.0.0/ale_linters/json5/eslint.vim000066400000000000000000000010441476501472200176350ustar00rootroot00000000000000" Author: João Pesce " Description: eslint for JSON5 files. " " Requires eslint-plugin-jsonc or a similar plugin to work " " Uses the same funtcions as ale_linters/javascript/eslint.vim by w0rp " call ale#linter#Define('json5', { \ 'name': 'eslint', \ 'output_stream': 'both', \ 'executable': function('ale#handlers#eslint#GetExecutable'), \ 'cwd': function('ale#handlers#eslint#GetCwd'), \ 'command': function('ale#handlers#eslint#GetCommand'), \ 'callback': 'ale#handlers#eslint#HandleJSON', \}) ale-4.0.0/ale_linters/jsonc/000077500000000000000000000000001476501472200157015ustar00rootroot00000000000000ale-4.0.0/ale_linters/jsonc/biome.vim000066400000000000000000000005231476501472200175110ustar00rootroot00000000000000" Description: biome for jsonc files call ale#linter#Define('jsonc', { \ 'name': 'biome', \ 'lsp': 'stdio', \ 'language': function('ale#handlers#biome#GetLanguage'), \ 'executable': function('ale#handlers#biome#GetExecutable'), \ 'command': '%e lsp-proxy', \ 'project_root': function('ale#handlers#biome#GetProjectRoot'), \}) ale-4.0.0/ale_linters/jsonc/eslint.vim000066400000000000000000000010441476501472200177130ustar00rootroot00000000000000" Author: João Pesce " Description: eslint for JSONC files. " " Requires eslint-plugin-jsonc or a similar plugin to work " " Uses the same funtcions as ale_linters/javascript/eslint.vim by w0rp " call ale#linter#Define('jsonc', { \ 'name': 'eslint', \ 'output_stream': 'both', \ 'executable': function('ale#handlers#eslint#GetExecutable'), \ 'cwd': function('ale#handlers#eslint#GetCwd'), \ 'command': function('ale#handlers#eslint#GetCommand'), \ 'callback': 'ale#handlers#eslint#HandleJSON', \}) ale-4.0.0/ale_linters/jsonnet/000077500000000000000000000000001476501472200162455ustar00rootroot00000000000000ale-4.0.0/ale_linters/jsonnet/jsonnet_lint.vim000066400000000000000000000034731476501472200214770ustar00rootroot00000000000000" Author: Trevor Whitney " Description: jsonnet-lint for jsonnet files call ale#Set('jsonnet_jsonnet_lint_executable', 'jsonnet-lint') call ale#Set('jsonnet_jsonnet_lint_options', '') function! ale_linters#jsonnet#jsonnet_lint#GetCommand(buffer) abort let l:options = ale#Var(a:buffer, 'jsonnet_jsonnet_lint_options') return '%e' \ . ale#Pad(l:options) \ . ' %t' endfunction function! ale_linters#jsonnet#jsonnet_lint#Handle(buffer, lines) abort " Matches patterns line the following: " " ERROR: foo.jsonnet:22:3-12 expected token OPERATOR but got (IDENTIFIER, "bar") " ERROR: hoge.jsonnet:20:3 unexpected: "}" while parsing terminal " ERROR: main.jsonnet:212:1-14 Expected , or ; but got (IDENTIFIER, "older_cluster") let l:pattern = '^ERROR: [^:]*:\(\d\+\):\(\d\+\)\(-\d\+\)* \(.*\)' let l:output = [] for l:line in a:lines let l:match = matchlist(l:line, l:pattern) if len(l:match) == 0 continue endif let line_number = l:match[1] + 0 let column = l:match[2] + 0 " l:match[3] has optional -14, when linter is showing a range let text = l:match[4] " vcol is Needed to indicate that the column is a character. call add(l:output, { \ 'bufnr': a:buffer, \ 'lnum': line_number, \ 'vcol': 0, \ 'col': column, \ 'text': text, \ 'type': 'E', \ 'nr': -1, \}) endfor return l:output endfunction call ale#linter#Define('jsonnet', { \ 'name': 'jsonnet_lint', \ 'output_stream': 'stderr', \ 'executable': {b -> ale#Var(b, 'jsonnet_jsonnet_lint_executable')}, \ 'command': function('ale_linters#jsonnet#jsonnet_lint#GetCommand'), \ 'callback': 'ale_linters#jsonnet#jsonnet_lint#Handle', \}) ale-4.0.0/ale_linters/jsonnet/jsonnetfmt.vim000066400000000000000000000031461476501472200211550ustar00rootroot00000000000000" Authors: Trevor Whitney and Takuya Kosugiyama " Description: jsonnetfmt for jsonnet files call ale#Set('jsonnet_jsonnetfmt_executable', 'jsonnetfmt') call ale#Set('jsonnet_jsonnetfmt_options', '') function! ale_linters#jsonnet#jsonnetfmt#GetCommand(buffer) abort let l:options = ale#Var(a:buffer, 'jsonnet_jsonnetfmt_options') return '%e' \ . ale#Pad(l:options) \ . ' %t' endfunction function! ale_linters#jsonnet#jsonnetfmt#Handle(buffer, lines) abort " Matches patterns line the following: " " STATIC ERROR: foo.jsonnet:22:3-12: expected token OPERATOR but got (IDENTIFIER, "bar") " STATIC ERROR: hoge.jsonnet:20:3: unexpected: "}" while parsing terminal let l:pattern = '^STATIC ERROR:[^:]*:\(\d\+\):\(\d\+\):*\(-\d\+\)* \(.*\)' let l:output = [] for l:line in a:lines let l:match = matchlist(l:line, l:pattern) if len(l:match) == 0 continue endif " vcol is Needed to indicate that the column is a character. call add(l:output, { \ 'bufnr': a:buffer, \ 'lnum': l:match[1] + 0, \ 'vcol': 0, \ 'col': l:match[2] + 0, \ 'text': l:match[4], \ 'type': 'E', \ 'nr': -1, \}) endfor return l:output endfunction call ale#linter#Define('jsonnet', { \ 'name': 'jsonnetfmt', \ 'output_stream': 'stderr', \ 'executable': {b -> ale#Var(b, 'jsonnet_jsonnetfmt_executable')}, \ 'command': function('ale_linters#jsonnet#jsonnetfmt#GetCommand'), \ 'callback': 'ale_linters#jsonnet#jsonnetfmt#Handle', \}) ale-4.0.0/ale_linters/julia/000077500000000000000000000000001476501472200156715ustar00rootroot00000000000000ale-4.0.0/ale_linters/julia/languageserver.vim000066400000000000000000000021161476501472200214200ustar00rootroot00000000000000" Author: Bartolomeo Stellato " Description: A language server for Julia " Set julia executable variable call ale#Set('julia_executable', 'julia') function! ale_linters#julia#languageserver#GetCommand(buffer) abort let l:julia_executable = ale#Var(a:buffer, 'julia_executable') let l:cmd_string = 'using LanguageServer; using Pkg; import StaticLint; import SymbolServer; server = LanguageServer.LanguageServerInstance(isdefined(Base, :stdin) ? stdin : STDIN, isdefined(Base, :stdout) ? stdout : STDOUT, dirname(Pkg.Types.Context().env.project_file)); server.runlinter = true; run(server);' return ale#Escape(l:julia_executable) . ' --project=@. --startup-file=no --history-file=no -e ' . ale#Escape(l:cmd_string) endfunction call ale#linter#Define('julia', { \ 'name': 'languageserver', \ 'aliases': ['julials'], \ 'lsp': 'stdio', \ 'executable': {b -> ale#Var(b, 'julia_executable')}, \ 'command': function('ale_linters#julia#languageserver#GetCommand'), \ 'language': 'julia', \ 'project_root': function('ale#julia#FindProjectRoot'), \}) ale-4.0.0/ale_linters/kotlin/000077500000000000000000000000001476501472200160655ustar00rootroot00000000000000ale-4.0.0/ale_linters/kotlin/kotlinc.vim000066400000000000000000000135121476501472200202470ustar00rootroot00000000000000" Author: Francis Agyapong " Description: A linter for the Kotlin programming language that uses kotlinc let g:ale_kotlin_kotlinc_options = get(g:, 'ale_kotlin_kotlinc_options', '') let g:ale_kotlin_kotlinc_enable_config = get(g:, 'ale_kotlin_kotlinc_enable_config', 0) let g:ale_kotlin_kotlinc_config_file = get(g:, 'ale_kotlin_kotlinc_config_file', '.ale_kotlinc_config') let g:ale_kotlin_kotlinc_classpath = get(g:, 'ale_kotlin_kotlinc_classpath', '') let g:ale_kotlin_kotlinc_sourcepath = get(g:, 'ale_kotlin_kotlinc_sourcepath', '') let g:ale_kotlin_kotlinc_use_module_file = get(g:, 'ale_kotlin_kotlinc_use_module_file', 0) let g:ale_kotlin_kotlinc_module_filename = get(g:, 'ale_kotlin_kotlinc_module_filename', 'module.xml') let s:classpath_sep = has('unix') ? ':' : ';' function! ale_linters#kotlin#kotlinc#RunWithImportPaths(buffer) abort let l:command = '' " exec maven/gradle only if classpath is not set if !empty(ale#Var(a:buffer, 'kotlin_kotlinc_classpath')) return ale_linters#kotlin#kotlinc#GetCommand(a:buffer, [], {}) endif let [l:cwd, l:command] = ale#maven#BuildClasspathCommand(a:buffer) " Try to use Gradle if Maven isn't available. if empty(l:command) let [l:cwd, l:command] = ale#gradle#BuildClasspathCommand(a:buffer) endif if empty(l:command) return ale_linters#kotlin#kotlinc#GetCommand(a:buffer, [], {}) endif return ale#command#Run( \ a:buffer, \ l:command, \ function('ale_linters#kotlin#kotlinc#GetCommand'), \ {'cwd': l:cwd}, \) endfunction function! s:BuildClassPathOption(buffer, import_paths) abort " Filter out lines like [INFO], etc. let l:class_paths = filter(a:import_paths[:], 'v:val !~# ''[''') call extend( \ l:class_paths, \ split(ale#Var(a:buffer, 'kotlin_kotlinc_classpath'), s:classpath_sep), \) return !empty(l:class_paths) \ ? ' -cp ' . ale#Escape(join(l:class_paths, s:classpath_sep)) \ : '' endfunction function! ale_linters#kotlin#kotlinc#GetCommand(buffer, import_paths, meta) abort let l:kotlinc_opts = ale#Var(a:buffer, 'kotlin_kotlinc_options') let l:command = 'kotlinc ' " If the config file is enabled and readable, source it if ale#Var(a:buffer, 'kotlin_kotlinc_enable_config') let l:conf = expand(ale#Var(a:buffer, 'kotlin_kotlinc_config_file'), 1) if filereadable(l:conf) execute 'source ' . fnameescape(l:conf) endif endif " If use module and module file is readable use that and return if ale#Var(a:buffer, 'kotlin_kotlinc_use_module_file') let l:module_filename = ale#Escape(expand(ale#Var(a:buffer, 'kotlin_kotlinc_module_filename'), 1)) if filereadable(l:module_filename) let l:kotlinc_opts .= ' -module ' . l:module_filename let l:command .= 'kotlinc ' . l:kotlinc_opts return l:command endif endif " We only get here if not using module or the module file not readable if ale#Var(a:buffer, 'kotlin_kotlinc_classpath') isnot# '' let l:kotlinc_opts .= ' -cp ' . ale#Var(a:buffer, 'kotlin_kotlinc_classpath') else " get classpath from maven/gradle let l:kotlinc_opts .= s:BuildClassPathOption(a:buffer, a:import_paths) endif let l:fname = '' if ale#Var(a:buffer, 'kotlin_kotlinc_sourcepath') isnot# '' let l:fname .= expand(ale#Var(a:buffer, 'kotlin_kotlinc_sourcepath'), 1) . ' ' else " Find the src directory for files in this project. let l:project_root = ale#gradle#FindProjectRoot(a:buffer) if !empty(l:project_root) let l:src_dir = l:project_root else let l:src_dir = ale#path#FindNearestDirectory(a:buffer, 'src/main/java') \ . ' ' . ale#path#FindNearestDirectory(a:buffer, 'src/main/kotlin') endif let l:fname .= expand(l:src_dir, 1) . ' ' endif let l:fname .= ale#Escape(expand('#' . a:buffer . ':p')) let l:command .= l:kotlinc_opts . ' ' . l:fname return l:command endfunction function! ale_linters#kotlin#kotlinc#Handle(buffer, lines) abort let l:code_pattern = '^\(.*\):\([0-9]\+\):\([0-9]\+\):\s\+\(error\|warning\):\s\+\(.*\)' let l:general_pattern = '^\(warning\|error\|info\):\s*\(.*\)' let l:output = [] for l:line in a:lines let l:match = matchlist(l:line, l:code_pattern) if len(l:match) == 0 continue endif let l:file = l:match[1] let l:line = l:match[2] + 0 let l:column = l:match[3] + 0 let l:type = l:match[4] let l:text = l:match[5] let l:buf_abspath = fnamemodify(l:file, ':p') let l:curbuf_abspath = expand('#' . a:buffer . ':p') " Skip if file is not loaded if l:buf_abspath isnot# l:curbuf_abspath continue endif let l:type_marker_str = l:type is# 'warning' ? 'W' : 'E' call add(l:output, { \ 'lnum': l:line, \ 'col': l:column, \ 'text': l:text, \ 'type': l:type_marker_str, \}) endfor " Non-code related messages for l:line in a:lines let l:match = matchlist(l:line, l:general_pattern) if len(l:match) == 0 continue endif let l:type = l:match[1] let l:text = l:match[2] let l:type_marker_str = l:type is# 'warning' || l:type is# 'info' ? 'W' : 'E' call add(l:output, { \ 'lnum': 1, \ 'text': l:text, \ 'type': l:type_marker_str, \}) endfor return l:output endfunction call ale#linter#Define('kotlin', { \ 'name': 'kotlinc', \ 'executable': 'kotlinc', \ 'output_stream': 'stderr', \ 'command': function('ale_linters#kotlin#kotlinc#RunWithImportPaths'), \ 'callback': 'ale_linters#kotlin#kotlinc#Handle', \ 'lint_file': 1, \}) ale-4.0.0/ale_linters/kotlin/ktlint.vim000066400000000000000000000005071476501472200201110ustar00rootroot00000000000000" Author: Francis Agyapong " Description: Lint kotlin files using ktlint call ale#linter#Define('kotlin', { \ 'name': 'ktlint', \ 'executable': 'ktlint', \ 'command': function('ale#handlers#ktlint#GetCommand'), \ 'callback': 'ale#handlers#ktlint#Handle', \ 'output_stream': 'stderr' \}) ale-4.0.0/ale_linters/kotlin/languageserver.vim000066400000000000000000000016671476501472200216260ustar00rootroot00000000000000" Author: MTDL9 " Description: Support for the Kotlin language server https://github.com/fwcd/KotlinLanguageServer call ale#Set('kotlin_languageserver_executable', 'kotlin-language-server') function! ale_linters#kotlin#languageserver#GetProjectRoot(buffer) abort let l:gradle_root = ale#gradle#FindProjectRoot(a:buffer) if !empty(l:gradle_root) return l:gradle_root endif let l:maven_pom_file = ale#path#FindNearestFile(a:buffer, 'pom.xml') if !empty(l:maven_pom_file) return fnamemodify(l:maven_pom_file, ':h') endif return '' endfunction call ale#linter#Define('kotlin', { \ 'name': 'languageserver', \ 'aliaes': ['kotlin_language_server'], \ 'lsp': 'stdio', \ 'executable': {b -> ale#Var(b, 'kotlin_languageserver_executable')}, \ 'command': '%e', \ 'language': 'kotlin', \ 'project_root': function('ale_linters#kotlin#languageserver#GetProjectRoot'), \}) ale-4.0.0/ale_linters/less/000077500000000000000000000000001476501472200155335ustar00rootroot00000000000000ale-4.0.0/ale_linters/less/lessc.vim000066400000000000000000000030371476501472200173640ustar00rootroot00000000000000" Author: zanona , w0rp " Description: This file adds support for checking Less code with lessc. call ale#Set('less_lessc_executable', 'lessc') call ale#Set('less_lessc_options', '') call ale#Set('less_lessc_use_global', get(g:, 'ale_use_global_executables', 0)) function! ale_linters#less#lessc#GetCommand(buffer) abort return '%e --no-color --lint' \ . ' --include-path=' . ale#Escape(expand('#' . a:buffer . ':p:h')) \ . ale#Pad(ale#Var(a:buffer, 'less_lessc_options')) \ . ' -' endfunction function! ale_linters#less#lessc#Handle(buffer, lines) abort let l:dir = expand('#' . a:buffer . ':p:h') " Matches patterns like the following: let l:pattern = '^\(\w\+\): \(.\{-}\) in \(.\{-}\) on line \(\d\+\), column \(\d\+\):$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) let l:item = { \ 'lnum': l:match[4] + 0, \ 'col': l:match[5] + 0, \ 'text': l:match[2], \ 'type': 'E', \} if l:match[3] isnot# '-' let l:item.filename = ale#path#GetAbsPath(l:dir, l:match[3]) endif call add(l:output, l:item) endfor return l:output endfunction call ale#linter#Define('less', { \ 'name': 'lessc', \ 'executable': {b -> ale#path#FindExecutable(b, 'less_lessc', [ \ 'node_modules/.bin/lessc', \ ])}, \ 'command': function('ale_linters#less#lessc#GetCommand'), \ 'callback': 'ale_linters#less#lessc#Handle', \ 'output_stream': 'stderr', \}) ale-4.0.0/ale_linters/less/stylelint.vim000066400000000000000000000014201476501472200202740ustar00rootroot00000000000000" Author: diartyz , w0rp call ale#Set('less_stylelint_executable', 'stylelint') call ale#Set('less_stylelint_options', '') call ale#Set('less_stylelint_use_global', get(g:, 'ale_use_global_executables', 0)) function! ale_linters#less#stylelint#GetCommand(buffer) abort let l:options = ale#Var(a:buffer, 'less_stylelint_options') return '%e' . ale#Pad(l:options) . ' --stdin-filename %s' endfunction call ale#linter#Define('less', { \ 'name': 'stylelint', \ 'output_stream': 'both', \ 'executable': {b -> ale#path#FindExecutable(b, 'less_stylelint', [ \ 'node_modules/.bin/stylelint', \ ])}, \ 'command': function('ale_linters#less#stylelint#GetCommand'), \ 'callback': 'ale#handlers#css#HandleStyleLintFormat', \}) ale-4.0.0/ale_linters/llvm/000077500000000000000000000000001476501472200155375ustar00rootroot00000000000000ale-4.0.0/ale_linters/llvm/llc.vim000066400000000000000000000014441476501472200170310ustar00rootroot00000000000000" Author: rhysd " Description: Support for checking LLVM IR with llc call ale#Set('llvm_llc_executable', 'llc') function! ale_linters#llvm#llc#HandleErrors(buffer, lines) abort " Handle '{path}: {file}:{line}:{col}: error: {message}' format let l:pattern = '\v^[a-zA-Z]?:?[^:]+: [^:]+:(\d+):(\d+): (.+)$' return map(ale#util#GetMatches(a:lines, l:pattern), "{ \ 'lnum': str2nr(v:val[1]), \ 'col': str2nr(v:val[2]), \ 'text': v:val[3], \ 'type': 'E', \}") endfunction call ale#linter#Define('llvm', { \ 'name': 'llc', \ 'executable': {b -> ale#Var(b, 'llvm_llc_executable')}, \ 'output_stream': 'stderr', \ 'command': {-> '%e -filetype=null -o=' . g:ale#util#nul_file}, \ 'callback': 'ale_linters#llvm#llc#HandleErrors', \}) ale-4.0.0/ale_linters/lua/000077500000000000000000000000001476501472200153465ustar00rootroot00000000000000ale-4.0.0/ale_linters/lua/cspell.vim000066400000000000000000000002261476501472200173450ustar00rootroot00000000000000scriptencoding utf-8 " Author: David Houston " Description: cspell support for Lua files. call ale#handlers#cspell#DefineLinter('lua') ale-4.0.0/ale_linters/lua/lua_language_server.vim000066400000000000000000000011301476501472200220700ustar00rootroot00000000000000" Author: w0rp " Description: lua-language-server integration (https://github.com/LuaLS/lua-language-server) call ale#Set('lua_language_server_executable', 'lua-language-server') call ale#Set('lua_language_server_config', {}) call ale#linter#Define('lua', { \ 'name': 'lua_language_server', \ 'aliases': ['lua-language-server', 'lua_ls'], \ 'lsp': 'stdio', \ 'executable': {b -> ale#Var(b, 'lua_language_server_executable')}, \ 'command': '%e', \ 'project_root': function('ale#lua#FindProjectRoot'), \ 'lsp_config': {b -> ale#Var(b, 'lua_language_server_config')}, \}) ale-4.0.0/ale_linters/lua/luac.vim000066400000000000000000000015571476501472200170170ustar00rootroot00000000000000" Author: Jon Xie https://github.com/xiejiangzhi " Description: luac linter for lua files call ale#Set('lua_luac_executable', 'luac') function! ale_linters#lua#luac#Handle(buffer, lines) abort " Matches patterns line the following: " " luac: stdin:5: '=' expected near ')' " luac: stdin:8: ')' expected (to close '(' at line 6) near '123' let l:pattern = '\v^.*:(\d+): (.+)$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) call add(l:output, { \ 'lnum': l:match[1] + 0, \ 'type': 'E', \ 'text': l:match[2], \}) endfor return l:output endfunction call ale#linter#Define('lua', { \ 'name': 'luac', \ 'executable': {b -> ale#Var(b, 'lua_luac_executable')}, \ 'command': '%e -p -', \ 'output_stream': 'stderr', \ 'callback': 'ale_linters#lua#luac#Handle', \}) ale-4.0.0/ale_linters/lua/luacheck.vim000066400000000000000000000046651476501472200176550ustar00rootroot00000000000000" Author: Sol Bekic https://github.com/s-ol " Description: luacheck linter for lua files call ale#Set('lua_luacheck_executable', 'luacheck') call ale#Set('lua_luacheck_options', '') function! s:IsInRuntimepath(buffer) abort let l:runtimepath_dirs = split(&runtimepath, ',') for l:dir in ale#path#Upwards(expand('#' . a:buffer . ':p:h')) for l:runtime_dir in l:runtimepath_dirs if l:dir is# l:runtime_dir return 1 endif endfor endfor return 0 endfunction function! ale_linters#lua#luacheck#GetCommand(buffer) abort let l:options = ale#Var(a:buffer, 'lua_luacheck_options') " Add `--globals vim` by default if the file is in runtimepath. if l:options !~# '--globals' let l:in_runtime = getbufvar(a:buffer, 'ale_in_runtimepath', v:null) if l:in_runtime is v:null let l:in_runtime = s:IsInRuntimepath(a:buffer) " Save the result of check this buffer so we only check once. call setbufvar(a:buffer, 'ale_in_runtimepath', l:in_runtime) endif if l:in_runtime if !empty(l:options) let l:options .= ' ' endif let l:options .= '--globals vim' endif endif return '%e' . ale#Pad(l:options) \ . ' --formatter plain --codes --filename %s -' endfunction function! ale_linters#lua#luacheck#Handle(buffer, lines) abort " Matches patterns line the following: " " artal.lua:159:17: (W111) shadowing definition of loop variable 'i' on line 106 " artal.lua:182:7: (W213) unused loop variable 'i' let l:pattern = '^.*:\(\d\+\):\(\d\+\): (\([WE]\)\(\d\+\)) \(.\+\)$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) if !ale#Var(a:buffer, 'warn_about_trailing_whitespace') \ && l:match[3] is# 'W' \ && index(range(611, 614), str2nr(l:match[4])) >= 0 continue endif call add(l:output, { \ 'lnum': l:match[1] + 0, \ 'col': l:match[2] + 0, \ 'type': l:match[3], \ 'code': l:match[3] . l:match[4], \ 'text': l:match[5], \}) endfor return l:output endfunction call ale#linter#Define('lua', { \ 'name': 'luacheck', \ 'executable': {b -> ale#Var(b, 'lua_luacheck_executable')}, \ 'command': function('ale_linters#lua#luacheck#GetCommand'), \ 'callback': 'ale_linters#lua#luacheck#Handle', \}) ale-4.0.0/ale_linters/lua/selene.vim000066400000000000000000000030641476501472200173410ustar00rootroot00000000000000call ale#Set('lua_selene_executable', 'selene') call ale#Set('lua_selene_options', '') function! ale_linters#lua#selene#GetCommand(buffer) abort return '%e' . ale#Pad(ale#Var(a:buffer, 'lua_selene_options')) \ . ' --display-style=json -' endfunction function! ale_linters#lua#selene#Handle(buffer, lines) abort let l:output = [] for l:line in a:lines " as of version 0.17.0, selene has no way to suppress summary " information when outputting json, so stop processing when we hit it " (PR for this here: https://github.com/Kampfkarren/selene/pull/356) if l:line is# 'Results:' break endif let l:json = json_decode(l:line) let l:lint = { \ 'lnum': l:json.primary_label.span.start_line + 1, \ 'end_lnum': l:json.primary_label.span.end_line + 1, \ 'col': l:json.primary_label.span.start_column + 1, \ 'end_col': l:json.primary_label.span.end_column, \ 'text': l:json.message, \ 'code': l:json.code, \ 'type': l:json.severity is# 'Warning' ? 'W' : 'E', \} if has_key(l:json, 'notes') && len(l:json.notes) > 0 let l:lint.detail = l:lint.text . "\n\n" . join(l:json.notes, "\n") endif call add(l:output, l:lint) endfor return l:output endfunction call ale#linter#Define('lua', { \ 'name': 'selene', \ 'executable': {b -> ale#Var(b, 'lua_selene_executable')}, \ 'command': function('ale_linters#lua#selene#GetCommand'), \ 'callback': 'ale_linters#lua#selene#Handle', \}) ale-4.0.0/ale_linters/mail/000077500000000000000000000000001476501472200155075ustar00rootroot00000000000000ale-4.0.0/ale_linters/mail/alex.vim000066400000000000000000000002131476501472200171510ustar00rootroot00000000000000" Author: Johannes Wienke " Description: alex for mail files call ale#handlers#alex#DefineLinter('mail', '--text') ale-4.0.0/ale_linters/mail/languagetool.vim000066400000000000000000000002121476501472200207000ustar00rootroot00000000000000" Author: Vincent (wahrwolf [at] wolfpit.net) " Description: languagetool for mails call ale#handlers#languagetool#DefineLinter('mail') ale-4.0.0/ale_linters/mail/proselint.vim000066400000000000000000000004211476501472200202400ustar00rootroot00000000000000" Author: Daniel M. Capella https://github.com/polyzen " Description: proselint for mail files call ale#linter#Define('mail', { \ 'name': 'proselint', \ 'executable': 'proselint', \ 'command': 'proselint %t', \ 'callback': 'ale#handlers#unix#HandleAsWarning', \}) ale-4.0.0/ale_linters/mail/vale.vim000066400000000000000000000003721476501472200171550ustar00rootroot00000000000000" Author: chew-z https://github.com/chew-z " Description: vale for Markdown files call ale#linter#Define('mail', { \ 'name': 'vale', \ 'executable': 'vale', \ 'command': 'vale --output=JSON %t', \ 'callback': 'ale#handlers#vale#Handle', \}) ale-4.0.0/ale_linters/make/000077500000000000000000000000001476501472200155025ustar00rootroot00000000000000ale-4.0.0/ale_linters/make/checkmake.vim000066400000000000000000000020701476501472200201310ustar00rootroot00000000000000" Author: aurieh - https://github.com/aurieh call ale#Set('make_checkmake_config', '') function! ale_linters#make#checkmake#Handle(buffer, lines) abort let l:pattern = '\v^(\d+):(.+):(.+)$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) call add(l:output, { \ 'bufnr': a:buffer, \ 'lnum': l:match[1] + 0, \ 'type': 'E', \ 'code': l:match[2], \ 'text': l:match[3], \}) endfor return l:output endfunction function! ale_linters#make#checkmake#GetCommand(buffer) abort let l:config = ale#Var(a:buffer, 'make_checkmake_config') let l:cmd = 'checkmake' \ . ' --format="{{.LineNumber}}:{{.Rule}}:{{.Violation}}{{\"\r\n\"}}"' \ . (!empty(l:config) ? ' --config="' . l:config . '"' : '') \ . ' %s' return l:cmd endfunction call ale#linter#Define('make', { \ 'name': 'checkmake', \ 'executable': 'checkmake', \ 'command': function('ale_linters#make#checkmake#GetCommand'), \ 'callback': 'ale_linters#make#checkmake#Handle', \}) ale-4.0.0/ale_linters/markdown/000077500000000000000000000000001476501472200164075ustar00rootroot00000000000000ale-4.0.0/ale_linters/markdown/alex.vim000066400000000000000000000002151476501472200200530ustar00rootroot00000000000000" Author: Johannes Wienke " Description: alex for markdown files call ale#handlers#alex#DefineLinter('markdown', '') ale-4.0.0/ale_linters/markdown/cspell.vim000066400000000000000000000002401476501472200204020ustar00rootroot00000000000000scriptencoding utf-8 " Author: David Houston " Description: cspell support for Markdown files. call ale#handlers#cspell#DefineLinter('markdown') ale-4.0.0/ale_linters/markdown/languagetool.vim000066400000000000000000000002271476501472200216060ustar00rootroot00000000000000" Author: Vincent (wahrwolf [at] wolfpit.net) " Description: languagetool for markdown files call ale#handlers#languagetool#DefineLinter('markdown') ale-4.0.0/ale_linters/markdown/markdownlint.vim000066400000000000000000000017701476501472200216420ustar00rootroot00000000000000" Author: Ty-Lucas Kelley " Description: Adds support for markdownlint call ale#Set('markdown_markdownlint_executable', 'markdownlint') call ale#Set('markdown_markdownlint_options', '') function! ale_linters#markdown#markdownlint#GetExecutable(buffer) abort return ale#Var(a:buffer, 'markdown_markdownlint_executable') endfunction function! ale_linters#markdown#markdownlint#GetCommand(buffer) abort let l:executable = ale_linters#markdown#markdownlint#GetExecutable(a:buffer) let l:options = ale#Var(a:buffer, 'markdown_markdownlint_options') return ale#Escape(l:executable) \ . (!empty(l:options) ? ' ' . l:options : '') . ' %s' endfunction call ale#linter#Define('markdown', { \ 'name': 'markdownlint', \ 'executable': function('ale_linters#markdown#markdownlint#GetExecutable'), \ 'lint_file': 1, \ 'output_stream': 'both', \ 'command': function('ale_linters#markdown#markdownlint#GetCommand'), \ 'callback': 'ale#handlers#markdownlint#Handle' \}) ale-4.0.0/ale_linters/markdown/marksman.vim000066400000000000000000000021651476501472200207410ustar00rootroot00000000000000" Author: Peter Benjamin " Description: Write Markdown with code assist and intelligence in the comfort of your favourite editor. call ale#Set('markdown_marksman_executable', 'marksman') function! ale_linters#markdown#marksman#GetCommand(buffer) abort return '%e server' endfunction function! ale_linters#markdown#marksman#GetProjectRoot(buffer) abort " Find nearest .marksman.toml let l:marksman_toml = ale#path#FindNearestFile(a:buffer, '.marksman.toml') if !empty(l:marksman_toml) return fnamemodify(l:marksman_toml, ':h') endif " Find nearest .git/ directory let l:project_root = finddir('.git/..', expand('#' . a:buffer . '...').';') if !empty(l:project_root) return l:project_root endif return '' endfunction call ale#linter#Define('markdown', { \ 'name': 'marksman', \ 'lsp': 'stdio', \ 'executable': {b -> ale#Var(b, 'markdown_marksman_executable')}, \ 'command': function('ale_linters#markdown#marksman#GetCommand'), \ 'project_root': function('ale_linters#markdown#marksman#GetProjectRoot'), \ 'initialization_options': {}, \}) ale-4.0.0/ale_linters/markdown/mdl.vim000066400000000000000000000026001476501472200176760ustar00rootroot00000000000000" Author: Steve Dignam , Josh Leeb-du Toit " Description: Support for mdl, a markdown linter. call ale#Set('markdown_mdl_executable', 'mdl') call ale#Set('markdown_mdl_options', '') function! ale_linters#markdown#mdl#GetExecutable(buffer) abort return ale#Var(a:buffer, 'markdown_mdl_executable') endfunction function! ale_linters#markdown#mdl#GetCommand(buffer) abort let l:executable = ale_linters#markdown#mdl#GetExecutable(a:buffer) let l:exec_args = l:executable =~? 'bundle$' \ ? ' exec mdl' \ : '' let l:options = ale#Var(a:buffer, 'markdown_mdl_options') return ale#Escape(l:executable) . l:exec_args \ . ' -j' . (!empty(l:options) ? ' ' . l:options : '') endfunction function! ale_linters#markdown#mdl#Handle(buffer, lines) abort let l:output = [] for l:error in ale#util#FuzzyJSONDecode(a:lines, []) call add(l:output, { \ 'lnum': l:error['line'], \ 'code': l:error['rule'] . '/' . join(l:error['aliases'], '/'), \ 'text': l:error['description'], \ 'type': 'W', \}) endfor return l:output endfunction call ale#linter#Define('markdown', { \ 'name': 'mdl', \ 'executable': function('ale_linters#markdown#mdl#GetExecutable'), \ 'command': function('ale_linters#markdown#mdl#GetCommand'), \ 'callback': 'ale_linters#markdown#mdl#Handle' \}) ale-4.0.0/ale_linters/markdown/proselint.vim000066400000000000000000000004171476501472200211450ustar00rootroot00000000000000" Author: poohzrn https://github.com/poohzrn " Description: proselint for Markdown files call ale#linter#Define('markdown', { \ 'name': 'proselint', \ 'executable': 'proselint', \ 'command': 'proselint %t', \ 'callback': 'ale#handlers#unix#HandleAsWarning', \}) ale-4.0.0/ale_linters/markdown/pymarkdown.vim000066400000000000000000000051151476501472200213210ustar00rootroot00000000000000 call ale#Set('markdown_pymarkdown_executable', 'pymarkdown') call ale#Set('markdown_pymarkdown_options', '') call ale#Set('markdown_pymarkdown_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('markdown_pymarkdown_auto_pipenv', 0) call ale#Set('markdown_pymarkdown_auto_poetry', 0) call ale#Set('markdown_pymarkdown_auto_uv', 0) function! ale_linters#markdown#pymarkdown#GetExecutable(buffer) abort if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'markdown_pymarkdown_auto_pipenv')) \ && ale#python#PipenvPresent(a:buffer) return 'pipenv' endif if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'markdown_pymarkdown_auto_poetry')) \ && ale#python#PoetryPresent(a:buffer) return 'poetry' endif if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'markdown_pymarkdown_auto_uv')) \ && ale#python#UvPresent(a:buffer) return 'uv' endif return ale#python#FindExecutable(a:buffer, 'markdown_pymarkdown', ['pymarkdown']) endfunction function! ale_linters#markdown#pymarkdown#GetCommand(buffer) abort let l:executable = ale_linters#markdown#pymarkdown#GetExecutable(a:buffer) let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$' \ ? ' run pymarkdown' \ : '' return ale#Escape(l:executable) . l:exec_args \ . ' ' \ . ale#Var(a:buffer, 'markdown_pymarkdown_options') \ . 'scan-stdin' endfunction function! ale_linters#markdown#pymarkdown#Handle(buffer, lines) abort let l:pattern = '\v^(\S*):(\d+):(\d+): ([A-Z]+\d+): (.*)$' let l:output = [] " lines are formatted as follows: " sample.md:1:1: MD022: Headings should be surrounded by blank lines. [Expected: 1; Actual: 0; Below] (blanks-around-headings,blanks-around-headers) for l:match in ale#util#GetMatches(a:lines, l:pattern) if(l:match[4] is# 'MD009') \&& !ale#Var(a:buffer, 'warn_about_trailing_whitespace') " Skip warnings for trailing whitespace if the option is off. continue endif let l:item = { \ 'lnum': l:match[2] + 0, \ 'col': l:match[3] + 0, \ 'type': l:match[4][0], \ 'text': l:match[5], \ 'code': l:match[4], \} call add(l:output, l:item) endfor return l:output endfunction call ale#linter#Define('markdown', { \ 'name': 'pymarkdown', \ 'executable': function('ale_linters#markdown#pymarkdown#GetExecutable'), \ 'command': function('ale_linters#markdown#pymarkdown#GetCommand'), \ 'callback': 'ale_linters#markdown#pymarkdown#Handle', \}) ale-4.0.0/ale_linters/markdown/redpen.vim000066400000000000000000000004541476501472200204040ustar00rootroot00000000000000" Author: rhysd https://rhysd.github.io " Description: Redpen, a proofreading tool (http://redpen.cc) call ale#linter#Define('markdown', { \ 'name': 'redpen', \ 'executable': 'redpen', \ 'command': 'redpen -f markdown -r json %t', \ 'callback': 'ale#handlers#redpen#HandleRedpenOutput', \}) ale-4.0.0/ale_linters/markdown/remark_lint.vim000066400000000000000000000034631476501472200214410ustar00rootroot00000000000000scriptencoding utf-8 " Author rhysd https://rhysd.github.io/, Dirk Roorda (dirkroorda), Adrián González Rus (@adrigzr) " Description: remark-lint for Markdown files call ale#Set('markdown_remark_lint_executable', 'remark') call ale#Set('markdown_remark_lint_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('markdown_remark_lint_options', '') function! ale_linters#markdown#remark_lint#GetCommand(buffer) abort let l:options = ale#Var(a:buffer, 'markdown_remark_lint_options') return '%e' . ale#Pad(l:options) . ' --no-stdout --no-color' endfunction function! ale_linters#markdown#remark_lint#Handle(buffer, lines) abort " matches: ' 1:4 warning Incorrect list-item indent: add 1 space list-item-indent remark-lint' " matches: ' 18:71-19:1 error Missing new line after list item list-item-spacing remark-lint', let l:pattern = '^ \+\(\d\+\):\(\d\+\)\(-\(\d\+\):\(\d\+\)\)\? \(warning\|error\) \(.\+\)$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) let l:item = { \ 'lnum': l:match[1] + 0, \ 'col': l:match[2] + 0, \ 'type': l:match[6] is# 'error' ? 'E' : 'W', \ 'text': l:match[7], \} if l:match[3] isnot# '' let l:item.end_lnum = l:match[4] + 0 let l:item.end_col = l:match[5] + 0 endif call add(l:output, l:item) endfor return l:output endfunction call ale#linter#Define('markdown', { \ 'name': 'remark_lint', \ 'aliases': ['remark-lint'], \ 'executable': {b -> ale#path#FindExecutable(b, 'markdown_remark_lint', [ \ 'node_modules/.bin/remark', \ ])}, \ 'command': function('ale_linters#markdown#remark_lint#GetCommand'), \ 'callback': 'ale_linters#markdown#remark_lint#Handle', \ 'output_stream': 'stderr', \}) ale-4.0.0/ale_linters/markdown/textlint.vim000066400000000000000000000006351476501472200210030ustar00rootroot00000000000000" Author: tokida https://rouger.info, Yasuhiro Kiyota " Description: textlint, a proofreading tool (https://textlint.github.io/) call ale#linter#Define('markdown', { \ 'name': 'textlint', \ 'executable': function('ale#handlers#textlint#GetExecutable'), \ 'command': function('ale#handlers#textlint#GetCommand'), \ 'callback': 'ale#handlers#textlint#HandleTextlintOutput', \}) ale-4.0.0/ale_linters/markdown/vale.vim000066400000000000000000000015321476501472200200540ustar00rootroot00000000000000" Author: chew-z https://github.com/chew-z " Description: vale for Markdown files call ale#Set('markdown_vale_executable', 'vale') call ale#Set('markdown_vale_input_file', '%t') call ale#Set('markdown_vale_options', '') function! ale_linters#markdown#vale#GetCommand(buffer) abort let l:executable = ale#Var(a:buffer, 'markdown_vale_executable') let l:input_file = ale#Var(a:buffer, 'markdown_vale_input_file') " Defaults to `vale --output=JSON %t` return ale#Escape(l:executable) \ . ' --output=JSON ' \ . ale#Var(a:buffer, 'markdown_vale_options') \ . ' ' . l:input_file endfunction call ale#linter#Define('markdown', { \ 'name': 'vale', \ 'executable': {b -> ale#Var(b, 'markdown_vale_executable')}, \ 'command': function('ale_linters#markdown#vale#GetCommand'), \ 'callback': 'ale#handlers#vale#Handle', \}) ale-4.0.0/ale_linters/markdown/writegood.vim000066400000000000000000000002251476501472200211260ustar00rootroot00000000000000" Author: Sumner Evans " Description: write-good for Markdown files call ale#handlers#writegood#DefineLinter('markdown') ale-4.0.0/ale_linters/matlab/000077500000000000000000000000001476501472200160255ustar00rootroot00000000000000ale-4.0.0/ale_linters/matlab/mlint.vim000066400000000000000000000024441476501472200176710ustar00rootroot00000000000000" Author: awlayton " Description: mlint for MATLAB files call ale#Set('matlab_mlint_executable', 'mlint') function! ale_linters#matlab#mlint#Handle(buffer, lines) abort " Matches patterns like the following: " " L 27 (C 1): FNDEF: Terminate statement with semicolon to suppress output. " L 30 (C 13-15): FNDEF: A quoted string is unterminated. let l:pattern = '^L \(\d\+\) (C \([0-9-]\+\)): \([A-Z]\+\): \(.\+\)$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) let l:lnum = l:match[1] + 0 let l:col = l:match[2] + 0 let l:code = l:match[3] let l:text = l:match[4] " Suppress erroneous warning about filename " TODO: Enable this error when copying filename is supported if l:code is# 'FNDEF' continue endif call add(l:output, { \ 'bufnr': a:buffer, \ 'lnum': l:lnum, \ 'col': l:col, \ 'text': l:text, \ 'type': 'W', \}) endfor return l:output endfunction call ale#linter#Define('matlab', { \ 'name': 'mlint', \ 'executable': {b -> ale#Var(b, 'matlab_mlint_executable')}, \ 'command': '%e -id %t', \ 'output_stream': 'stderr', \ 'callback': 'ale_linters#matlab#mlint#Handle', \}) ale-4.0.0/ale_linters/mercury/000077500000000000000000000000001476501472200162535ustar00rootroot00000000000000ale-4.0.0/ale_linters/mercury/mmc.vim000066400000000000000000000023301476501472200175420ustar00rootroot00000000000000" Author: stewy33 " Description: Lints mercury files using mmc call ale#Set('mercury_mmc_executable', 'mmc') call ale#Set('mercury_mmc_options', '--make --output-compile-error-lines 100') function! ale_linters#mercury#mmc#GetCommand(buffer) abort return '%e --errorcheck-only ' \ . ale#Var(a:buffer, 'mercury_mmc_options') \ . ' %s:t:r' endfunction function! ale_linters#mercury#mmc#Handle(buffer, lines) abort " output format " :: : let l:pattern = '\v^\w+\.m:(\d+):\s+([W|w]arning|.*[E|e]rror.*): (.*)' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) call add(l:output, { \ 'lnum': substitute(l:match[1], '\v^0*', '', '') + 0, \ 'type': l:match[2][0] =~? 'W' ? 'W' : 'E', \ 'text': l:match[2] . ': ' . l:match[3] \}) endfor return l:output endfunction call ale#linter#Define('mercury', { \ 'name': 'mmc', \ 'output_stream': 'stderr', \ 'executable': {b -> ale#Var(b, 'mercury_mmc_executable')}, \ 'cwd': '%s:h', \ 'command': function('ale_linters#mercury#mmc#GetCommand'), \ 'callback': 'ale_linters#mercury#mmc#Handle', \ 'lint_file': 1, \}) ale-4.0.0/ale_linters/nasm/000077500000000000000000000000001476501472200155235ustar00rootroot00000000000000ale-4.0.0/ale_linters/nasm/nasm.vim000066400000000000000000000024461476501472200172040ustar00rootroot00000000000000" Author: Oyvind Ingvaldsen " Description: NASM linter for asmsyntax nasm. call ale#Set('nasm_nasm_executable', 'nasm') call ale#Set('nasm_nasm_options', '') function! ale_linters#nasm#nasm#GetCommand(buffer) abort " Note that NASM requires a trailing slash for the -I option. let l:separator = has('win32') ? '\' : '/' let l:output_null = has('win32') ? 'NUL' : '/dev/null' return '%e -X gnu -I %s:h' . l:separator \ . ale#Pad(ale#Var(a:buffer, 'nasm_nasm_options')) \ . ' %s' \ . ' -o ' . l:output_null endfunction function! ale_linters#nasm#nasm#Handle(buffer, lines) abort " Note that we treat 'fatal' as errors. let l:pattern = '^.\+:\(\d\+\): \([^:]\+\): \(.\+\)$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) call add(l:output, { \ 'lnum': l:match[1] + 0, \ 'type': l:match[2] =~? 'error\|fatal' ? 'E' : 'W', \ 'text': l:match[3], \}) endfor return l:output endfunction call ale#linter#Define('nasm', { \ 'name': 'nasm', \ 'output_stream': 'stderr', \ 'lint_file': 1, \ 'executable': {b -> ale#Var(b, 'nasm_nasm_executable')}, \ 'command': function('ale_linters#nasm#nasm#GetCommand'), \ 'callback': 'ale_linters#nasm#nasm#Handle', \}) ale-4.0.0/ale_linters/nim/000077500000000000000000000000001476501472200153505ustar00rootroot00000000000000ale-4.0.0/ale_linters/nim/nimcheck.vim000066400000000000000000000047671476501472200176640ustar00rootroot00000000000000" Author: Baabelfish " Description: Typechecking for nim files let s:end_col_patterns = [ \ '\v''([^'']+)'' is declared but not used.*', \ '\videntifier expected, but found ''([^'']+)''', \ '\vimported and not used: ''([^'']+)''.*', \ '\vundeclared identifier: ''([^'']+)''', \ '\v''([^'']+)'' cannot be assigned to', \ '\vredefinition of ''([^'']+)'';', \] function! ale_linters#nim#nimcheck#Handle(buffer, lines) abort let l:buffer_filename = fnamemodify(bufname(a:buffer), ':p:t') let l:pattern = '^\(.\+\.nim\)(\(\d\+\), \(\d\+\)) \(.\+\)' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) " Only show errors of the current buffer " NOTE: Checking filename only is OK because nim enforces unique " module names. let l:temp_buffer_filename = fnamemodify(l:match[1], ':p:t') if l:buffer_filename isnot# '' && l:temp_buffer_filename isnot# l:buffer_filename continue endif let l:item = { \ 'lnum': l:match[2] + 0, \ 'col': l:match[3] + 0, \ 'text': l:match[4], \ 'type': 'W', \} " Extract error type from message of type 'Error: Some error message' let l:error_match = matchlist(l:item.text, '^\(.\{-}\): \(.\+\)$') if !empty(l:error_match) if l:error_match[1] is# 'Error' let l:item.type = 'E' let l:item.text = l:error_match[2] elseif l:error_match[1] is# 'Warning' \|| l:error_match[1] is# 'Hint' let l:item.text = l:error_match[2] endif endif let l:code_match = matchlist(l:item.text, '\v^(.+) \[([^ \[]+)\]$') if !empty(l:code_match) let l:item.text = l:code_match[1] let l:item.code = l:code_match[2] endif " Find position end_col. for l:col_match in ale#util#GetMatches(l:item.text, s:end_col_patterns) let l:item.end_col = l:item.col + len(l:col_match[1]) - 1 endfor call add(l:output, l:item) endfor return l:output endfunction function! ale_linters#nim#nimcheck#GetCommand(buffer) abort return 'nim check --verbosity:0 --colors:off --listFullPaths %s' endfunction call ale#linter#Define('nim', { \ 'name': 'nimcheck', \ 'executable': 'nim', \ 'output_stream': 'both', \ 'command': function('ale_linters#nim#nimcheck#GetCommand'), \ 'callback': 'ale_linters#nim#nimcheck#Handle', \ 'lint_file': 1, \}) ale-4.0.0/ale_linters/nim/nimlsp.vim000066400000000000000000000016621476501472200173740ustar00rootroot00000000000000" Author: jeremija " Description: Support for nimlsp (language server for nim) call ale#Set('nim_nimlsp_nim_sources', '') function! ale_linters#nim#nimlsp#GetProjectRoot(buffer) abort let l:project_root = ale#path#FindNearestDirectory(a:buffer, '.git') if !empty(l:project_root) return fnamemodify(l:project_root, ':h:h') endif return '' endfunction function! ale_linters#nim#nimlsp#GetCommand(buffer) abort let l:nim_sources = ale#Var(a:buffer, 'nim_nimlsp_nim_sources') if !empty(l:nim_sources) let l:nim_sources = ale#Escape(l:nim_sources) endif return '%e' . ale#Pad(l:nim_sources) endfunction call ale#linter#Define('nim', { \ 'name': 'nimlsp', \ 'lsp': 'stdio', \ 'executable': 'nimlsp', \ 'command': function('ale_linters#nim#nimlsp#GetCommand'), \ 'language': 'nim', \ 'project_root': function('ale_linters#nim#nimlsp#GetProjectRoot'), \}) ale-4.0.0/ale_linters/nix/000077500000000000000000000000001476501472200153635ustar00rootroot00000000000000ale-4.0.0/ale_linters/nix/deadnix.vim000066400000000000000000000007421476501472200175170ustar00rootroot00000000000000call ale#Set('nix_deadnix_executable', 'deadnix') call ale#Set('nix_deadnix_options', '') function! ale_linters#nix#deadnix#GetCommand(buffer) abort return '%e -o json' . ale#Pad(ale#Var(a:buffer, 'nix_deadnix_options')) . ' -- %t' endfunction call ale#linter#Define('nix', { \ 'name': 'deadnix', \ 'executable': {b -> ale#Var(b, 'nix_deadnix_executable')}, \ 'command': function('ale_linters#nix#deadnix#GetCommand'), \ 'callback': 'ale#handlers#deadnix#Handle', \}) ale-4.0.0/ale_linters/nix/nix.vim000066400000000000000000000035321476501472200167010ustar00rootroot00000000000000" Author: Alistair Bill <@alibabzo> " Author: Maximilian Bosch " Description: nix-instantiate linter for nix files function! ale_linters#nix#nix#Command(buffer, output, meta) abort let l:version = a:output[0][22:] if l:version =~# '^\(1\|2.[0-3]\.\).*' return 'nix-instantiate --parse -' else return 'nix-instantiate --log-format internal-json --parse -' endif endfunction function! ale_linters#nix#nix#Handle(buffer, lines) abort let l:output = [] if empty(a:lines) return l:output endif if a:lines[0] =~# '^@nix .*' for l:line in a:lines if l:line =~# '^@nix .*' let l:result = json_decode(strpart(l:line, 4)) if has_key(l:result, 'column') call add(l:output, { \ 'type': 'E', \ 'lnum': l:result.line, \ 'col': l:result.column, \ 'text': l:result.raw_msg \}) endif endif endfor else let l:pattern = '^\(.\+\): \(.\+\) at .*:\(\d\+\):\(\d\+\)$' for l:match in ale#util#GetMatches(a:lines, l:pattern) call add(l:output, { \ 'lnum': l:match[3] + 0, \ 'col': l:match[4] + 0, \ 'text': l:match[1] . ': ' . substitute(l:match[2], ',$', '', ''), \ 'type': l:match[1] =~# '^error' ? 'E' : 'W', \}) endfor endif return l:output endfunction call ale#linter#Define('nix', { \ 'name': 'nix', \ 'output_stream': 'stderr', \ 'executable': 'nix-instantiate', \ 'command': {buffer -> ale#command#Run( \ buffer, \ 'nix-instantiate --version', \ function('ale_linters#nix#nix#Command') \ )}, \ 'callback': 'ale_linters#nix#nix#Handle', \}) ale-4.0.0/ale_linters/nix/rnix_lsp.vim000066400000000000000000000010011476501472200177260ustar00rootroot00000000000000" Author: jD91mZM2 " Description: rnix-lsp language client function! ale_linters#nix#rnix_lsp#GetProjectRoot(buffer) abort " rnix-lsp does not yet use the project root, so getting it right is not " important return fnamemodify(a:buffer, ':h') endfunction call ale#linter#Define('nix', { \ 'name': 'rnix_lsp', \ 'aliases': ['rnix'], \ 'lsp': 'stdio', \ 'executable': 'rnix-lsp', \ 'command': '%e', \ 'project_root': function('ale_linters#nix#rnix_lsp#GetProjectRoot'), \}) ale-4.0.0/ale_linters/nix/statix.vim000066400000000000000000000011671476501472200174210ustar00rootroot00000000000000scriptencoding utf-8 " Author: David Houston " Description: statix analysis and suggestions for Nix files call ale#Set('nix_statix_check_executable', 'statix') call ale#Set('nix_statix_check_options', '') function! ale_linters#nix#statix#GetCommand(buffer) abort return '%e check -o errfmt --stdin' \ . ale#Pad(ale#Var(a:buffer, 'nix_statix_check_options')) endfunction call ale#linter#Define('nix', { \ 'name': 'statix', \ 'executable': {b -> ale#Var(b, 'nix_statix_check_executable')}, \ 'command': function('ale_linters#nix#statix#GetCommand'), \ 'callback': 'ale#handlers#statix#Handle', \}) ale-4.0.0/ale_linters/nroff/000077500000000000000000000000001476501472200156775ustar00rootroot00000000000000ale-4.0.0/ale_linters/nroff/alex.vim000066400000000000000000000002151476501472200173430ustar00rootroot00000000000000" Author: Johannes Wienke " Description: alex for nroff files call ale#handlers#alex#DefineLinter('nroff', '--text') ale-4.0.0/ale_linters/nroff/proselint.vim000066400000000000000000000004231476501472200204320ustar00rootroot00000000000000" Author: Daniel M. Capella https://github.com/polyzen " Description: proselint for nroff files call ale#linter#Define('nroff', { \ 'name': 'proselint', \ 'executable': 'proselint', \ 'command': 'proselint %t', \ 'callback': 'ale#handlers#unix#HandleAsWarning', \}) ale-4.0.0/ale_linters/nroff/writegood.vim000066400000000000000000000002171476501472200204170ustar00rootroot00000000000000" Author: Sumner Evans " Description: write-good for nroff files call ale#handlers#writegood#DefineLinter('nroff') ale-4.0.0/ale_linters/objc/000077500000000000000000000000001476501472200155025ustar00rootroot00000000000000ale-4.0.0/ale_linters/objc/ccls.vim000066400000000000000000000011451476501472200171440ustar00rootroot00000000000000" Author: Ye Jingchen , Ben Falconer , jtalowell " Description: A language server for Objective-C call ale#Set('objc_ccls_executable', 'ccls') call ale#Set('objc_ccls_init_options', {}) call ale#Set('c_build_dir', '') call ale#linter#Define('objc', { \ 'name': 'ccls', \ 'lsp': 'stdio', \ 'executable': {b -> ale#Var(b, 'objc_ccls_executable')}, \ 'command': '%e', \ 'project_root': function('ale#handlers#ccls#GetProjectRoot'), \ 'initialization_options': {b -> ale#handlers#ccls#GetInitOpts(b, 'objc_ccls_init_options')}, \}) ale-4.0.0/ale_linters/objc/clang.vim000066400000000000000000000014641476501472200173100ustar00rootroot00000000000000" Author: Bang Lee " Description: clang linter for objc files " Set this option to change the Clang options for warnings for ObjC. if !exists('g:ale_objc_clang_options') let g:ale_objc_clang_options = '-std=c11 -Wall' endif function! ale_linters#objc#clang#GetCommand(buffer) abort " -iquote with the directory the file is in makes #include work for " headers in the same directory. return 'clang -S -x objective-c -fsyntax-only ' \ . '-iquote %s:h' \ . ' ' . ale#Var(a:buffer, 'objc_clang_options') . ' -' endfunction call ale#linter#Define('objc', { \ 'name': 'clang', \ 'output_stream': 'stderr', \ 'executable': 'clang', \ 'command': function('ale_linters#objc#clang#GetCommand'), \ 'callback': 'ale#handlers#gcc#HandleGCCFormatWithIncludes', \}) ale-4.0.0/ale_linters/objc/clangd.vim000066400000000000000000000011161476501472200174460ustar00rootroot00000000000000" Author: Andrey Melentyev " Description: Clangd language server call ale#Set('objc_clangd_executable', 'clangd') call ale#Set('objc_clangd_options', '') function! ale_linters#objc#clangd#GetCommand(buffer) abort return '%e' . ale#Pad(ale#Var(a:buffer, 'objc_clangd_options')) endfunction call ale#linter#Define('objc', { \ 'name': 'clangd', \ 'lsp': 'stdio', \ 'executable': {b -> ale#Var(b, 'objc_clangd_executable')}, \ 'command': function('ale_linters#objc#clangd#GetCommand'), \ 'project_root': function('ale#c#FindProjectRoot'), \}) ale-4.0.0/ale_linters/objcpp/000077500000000000000000000000001476501472200160425ustar00rootroot00000000000000ale-4.0.0/ale_linters/objcpp/clang.vim000066400000000000000000000015141476501472200176440ustar00rootroot00000000000000" Author: Bang Lee " Description: clang linter for objcpp files " Set this option to change the Clang options for warnings for ObjCPP. if !exists('g:ale_objcpp_clang_options') let g:ale_objcpp_clang_options = '-std=c++14 -Wall' endif function! ale_linters#objcpp#clang#GetCommand(buffer) abort " -iquote with the directory the file is in makes #include work for " headers in the same directory. return 'clang++ -S -x objective-c++ -fsyntax-only ' \ . '-iquote %s:h' \ . ' ' . ale#Var(a:buffer, 'objcpp_clang_options') . ' -' endfunction call ale#linter#Define('objcpp', { \ 'name': 'clang', \ 'output_stream': 'stderr', \ 'executable': 'clang++', \ 'command': function('ale_linters#objcpp#clang#GetCommand'), \ 'callback': 'ale#handlers#gcc#HandleGCCFormatWithIncludes', \}) ale-4.0.0/ale_linters/objcpp/clangd.vim000066400000000000000000000011341476501472200200060ustar00rootroot00000000000000" Author: Andrey Melentyev " Description: Clangd language server call ale#Set('objcpp_clangd_executable', 'clangd') call ale#Set('objcpp_clangd_options', '') function! ale_linters#objcpp#clangd#GetCommand(buffer) abort return '%e' . ale#Pad(ale#Var(a:buffer, 'objcpp_clangd_options')) endfunction call ale#linter#Define('objcpp', { \ 'name': 'clangd', \ 'lsp': 'stdio', \ 'executable': {b -> ale#Var(b, 'objcpp_clangd_executable')}, \ 'command': function('ale_linters#objcpp#clangd#GetCommand'), \ 'project_root': function('ale#c#FindProjectRoot'), \}) ale-4.0.0/ale_linters/ocaml/000077500000000000000000000000001476501472200156605ustar00rootroot00000000000000ale-4.0.0/ale_linters/ocaml/merlin.vim000066400000000000000000000006321476501472200176640ustar00rootroot00000000000000" Author: Andrey Popp -- @andreypopp " Description: Report errors in OCaml code with Merlin if !exists('g:merlin') finish endif function! ale_linters#ocaml#merlin#Handle(buffer, lines) abort return merlin#ErrorLocList() endfunction call ale#linter#Define('ocaml', { \ 'name': 'merlin', \ 'executable': 'ocamlmerlin', \ 'command': 'true', \ 'callback': 'ale_linters#ocaml#merlin#Handle', \}) ale-4.0.0/ale_linters/ocaml/ocamllsp.vim000066400000000000000000000007431476501472200202130ustar00rootroot00000000000000" Author: Risto Stevcev " Description: The official language server for OCaml call ale#Set('ocaml_ocamllsp_use_opam', 1) call ale#linter#Define('ocaml', { \ 'name': 'ocamllsp', \ 'lsp': 'stdio', \ 'executable': function('ale#handlers#ocamllsp#GetExecutable'), \ 'command': function('ale#handlers#ocamllsp#GetCommand'), \ 'language': function('ale#handlers#ocamllsp#GetLanguage'), \ 'project_root': function('ale#handlers#ocamllsp#GetProjectRoot'), \}) ale-4.0.0/ale_linters/ocaml/ols.vim000066400000000000000000000011251476501472200171710ustar00rootroot00000000000000" Author: Michael Jungo " Description: A language server for OCaml call ale#Set('ocaml_ols_executable', 'ocaml-language-server') call ale#Set('ocaml_ols_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#linter#Define('ocaml', { \ 'name': 'ols', \ 'aliases': ['ocaml-language-server'], \ 'lsp': 'stdio', \ 'executable': function('ale#handlers#ols#GetExecutable'), \ 'command': function('ale#handlers#ols#GetCommand'), \ 'language': function('ale#handlers#ols#GetLanguage'), \ 'project_root': function('ale#handlers#ols#GetProjectRoot'), \}) ale-4.0.0/ale_linters/ocamlinterface/000077500000000000000000000000001476501472200175415ustar00rootroot00000000000000ale-4.0.0/ale_linters/ocamlinterface/merlin.vim000066400000000000000000000006651476501472200215530ustar00rootroot00000000000000" Author: Andrey Popp -- @andreypopp " Description: Report errors in OCaml code with Merlin if !exists('g:merlin') finish endif function! ale_linters#ocamlinterface#merlin#Handle(buffer, lines) abort return merlin#ErrorLocList() endfunction call ale#linter#Define('ocamlinterface', { \ 'name': 'merlin', \ 'executable': 'ocamlmerlin', \ 'command': 'true', \ 'callback': 'ale_linters#ocamlinterface#merlin#Handle', \}) ale-4.0.0/ale_linters/ocamlinterface/ocamllsp.vim000066400000000000000000000007541476501472200220760ustar00rootroot00000000000000" Author: Risto Stevcev " Description: The official language server for OCaml call ale#Set('ocaml_ocamllsp_use_opam', 1) call ale#linter#Define('ocamlinterface', { \ 'name': 'ocamllsp', \ 'lsp': 'stdio', \ 'executable': function('ale#handlers#ocamllsp#GetExecutable'), \ 'command': function('ale#handlers#ocamllsp#GetCommand'), \ 'language': function('ale#handlers#ocamllsp#GetLanguage'), \ 'project_root': function('ale#handlers#ocamllsp#GetProjectRoot'), \}) ale-4.0.0/ale_linters/odin/000077500000000000000000000000001476501472200155165ustar00rootroot00000000000000ale-4.0.0/ale_linters/odin/ols.vim000066400000000000000000000011251476501472200170270ustar00rootroot00000000000000" Author: Benjamin Block " Description: A language server for Odin. function! ale_linters#odin#ols#GetProjectRoot(buffer) abort return fnamemodify('', ':h') endfunction call ale#Set('odin_ols_executable', 'ols') call ale#Set('odin_ols_config', {}) call ale#linter#Define('odin', { \ 'name': 'ols', \ 'lsp': 'stdio', \ 'language': 'odin', \ 'lsp_config': {b -> ale#Var(b, 'odin_ols_config')}, \ 'executable': {b -> ale#Var(b, 'odin_ols_executable')}, \ 'command': '%e', \ 'project_root': function('ale_linters#odin#ols#GetProjectRoot'), \}) ale-4.0.0/ale_linters/openapi/000077500000000000000000000000001476501472200162205ustar00rootroot00000000000000ale-4.0.0/ale_linters/openapi/ibm_validator.vim000066400000000000000000000030231476501472200215470ustar00rootroot00000000000000" Author: Horacio Sanson call ale#Set('openapi_ibm_validator_executable', 'lint-openapi') call ale#Set('openapi_ibm_validator_options', '') function! ale_linters#openapi#ibm_validator#GetCommand(buffer) abort return '%e' . ale#Pad(ale#Var(a:buffer, 'openapi_ibm_validator_options')) \ . ' %t' endfunction function! ale_linters#openapi#ibm_validator#Handle(buffer, lines) abort let l:output = [] let l:type = 'E' let l:message = '' let l:nr = -1 for l:line in a:lines let l:match = matchlist(l:line, '^errors$') if !empty(l:match) let l:type = 'E' endif let l:match = matchlist(l:line, '^warnings$') if !empty(l:match) let l:type = 'W' endif let l:match = matchlist(l:line, '^ *Message : *\(.\+\)$') if !empty(l:match) let l:message = l:match[1] endif let l:match = matchlist(l:line, '^ *Line *: *\(\d\+\)$') if !empty(l:match) let l:nr = l:match[1] call add(l:output, { \ 'lnum': l:nr + 0, \ 'col': 0, \ 'text': l:message, \ 'type': l:type, \}) endif endfor return l:output endfunction call ale#linter#Define('openapi', { \ 'name': 'ibm_validator', \ 'executable': {b -> ale#Var(b, 'openapi_ibm_validator_executable')}, \ 'command': function('ale_linters#openapi#ibm_validator#GetCommand'), \ 'callback': 'ale_linters#openapi#ibm_validator#Handle', \}) ale-4.0.0/ale_linters/openapi/yamllint.vim000066400000000000000000000005161476501472200205700ustar00rootroot00000000000000call ale#Set('yaml_yamllint_executable', 'yamllint') call ale#Set('yaml_yamllint_options', '') call ale#linter#Define('openapi', { \ 'name': 'yamllint', \ 'executable': {b -> ale#Var(b, 'yaml_yamllint_executable')}, \ 'command': function('ale#handlers#yamllint#GetCommand'), \ 'callback': 'ale#handlers#yamllint#Handle', \}) ale-4.0.0/ale_linters/openscad/000077500000000000000000000000001476501472200163615ustar00rootroot00000000000000ale-4.0.0/ale_linters/openscad/sca2d.vim000066400000000000000000000015211476501472200200710ustar00rootroot00000000000000" Description: SCA2D linter for OpenSCAD files call ale#Set('openscad_sca2d_executable', 'sca2d') call ale#Set('openscad_sca2d_options', '') function! ale_linters#openscad#sca2d#GetExecutable(buffer) abort return ale#Var(a:buffer, 'openscad_sca2d_executable') endfunction function! ale_linters#openscad#sca2d#GetCommand(buffer) abort let l:executable = ale_linters#openscad#sca2d#GetExecutable(a:buffer) let l:options = ale#Var(a:buffer, 'openscad_sca2d_options') return ale#Escape(l:executable) . ale#Pad(l:options) . ' %s' endfunction call ale#linter#Define('openscad', { \ 'name': 'SCA2D', \ 'aliases': ['sca2d'], \ 'executable': function('ale_linters#openscad#sca2d#GetExecutable'), \ 'command': function('ale_linters#openscad#sca2d#GetCommand'), \ 'callback': 'ale#handlers#openscad#SCA2D_callback', \ 'lint_file': 1, \ }) ale-4.0.0/ale_linters/perl/000077500000000000000000000000001476501472200155275ustar00rootroot00000000000000ale-4.0.0/ale_linters/perl/perl.vim000066400000000000000000000033661476501472200172160ustar00rootroot00000000000000" Author: Vincent Lequertier " Description: This file adds support for checking perl syntax call ale#Set('perl_perl_executable', 'perl') call ale#Set('perl_perl_options', '-c -Mwarnings -Ilib') function! ale_linters#perl#perl#GetCommand(buffer) abort return '%e' . ale#Pad(ale#Var(a:buffer, 'perl_perl_options')) . ' %t' endfunction let s:begin_failed_skip_pattern = '\v' . join([ \ '^Compilation failed in require', \ '^Can''t locate', \], '|') function! ale_linters#perl#perl#Handle(buffer, lines) abort if empty(a:lines) return [] endif let l:pattern = '\(..\{-}\) at \(..\{-}\) line \(\d\+\)' let l:output = [] let l:basename = expand('#' . a:buffer . ':t') let l:type = 'E' if a:lines[-1] =~# 'syntax OK' let l:type = 'W' endif let l:seen = {} for l:match in ale#util#GetMatches(a:lines, l:pattern) let l:line = l:match[3] let l:file = l:match[2] let l:text = l:match[1] if ale#path#IsBufferPath(a:buffer, l:file) \ && !has_key(l:seen,l:line) \ && ( \ l:text isnot# 'BEGIN failed--compilation aborted' \ || empty(l:output) \ || match(l:output[-1].text, s:begin_failed_skip_pattern) < 0 \ ) call add(l:output, { \ 'lnum': l:line, \ 'text': l:text, \ 'type': l:type, \}) let l:seen[l:line] = 1 endif endfor return l:output endfunction call ale#linter#Define('perl', { \ 'name': 'perl', \ 'executable': {b -> ale#Var(b, 'perl_perl_executable')}, \ 'output_stream': 'both', \ 'command': function('ale_linters#perl#perl#GetCommand'), \ 'callback': 'ale_linters#perl#perl#Handle', \}) ale-4.0.0/ale_linters/perl/perlcritic.vim000066400000000000000000000036551476501472200204150ustar00rootroot00000000000000" Author: Vincent Lequertier , Chris Weyl " Description: This file adds support for checking perl with perl critic call ale#Set('perl_perlcritic_executable', 'perlcritic') call ale#Set('perl_perlcritic_profile', '.perlcriticrc') call ale#Set('perl_perlcritic_options', '') call ale#Set('perl_perlcritic_showrules', 0) function! ale_linters#perl#perlcritic#GetProfile(buffer) abort " first see if we've been overridden let l:profile = ale#Var(a:buffer, 'perl_perlcritic_profile') if l:profile is? '' return '' endif " otherwise, iterate upwards to find it return ale#path#FindNearestFile(a:buffer, l:profile) endfunction function! ale_linters#perl#perlcritic#GetCommand(buffer) abort let l:critic_verbosity = '%l:%c %m\n' if ale#Var(a:buffer, 'perl_perlcritic_showrules') let l:critic_verbosity = '%l:%c %m [%p]\n' endif let l:profile = ale_linters#perl#perlcritic#GetProfile(a:buffer) let l:options = ale#Var(a:buffer, 'perl_perlcritic_options') return '%e' \ . ' --verbose ' . ale#Escape(l:critic_verbosity) \ . ' --nocolor' \ . (!empty(l:profile) ? ' --profile ' . ale#Escape(l:profile) : '') \ . ale#Pad(l:options) endfunction function! ale_linters#perl#perlcritic#Handle(buffer, lines) abort let l:pattern = '\(\d\+\):\(\d\+\) \(.\+\)' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) call add(l:output, { \ 'lnum': l:match[1], \ 'col': l:match[2], \ 'text': l:match[3], \ 'type': 'W' \}) endfor return l:output endfunction call ale#linter#Define('perl', { \ 'name': 'perlcritic', \ 'output_stream': 'stdout', \ 'executable': {b -> ale#Var(b, 'perl_perlcritic_executable')}, \ 'command': function('ale_linters#perl#perlcritic#GetCommand'), \ 'callback': 'ale_linters#perl#perlcritic#Handle', \}) ale-4.0.0/ale_linters/perl6/000077500000000000000000000000001476501472200156155ustar00rootroot00000000000000ale-4.0.0/ale_linters/perl6/perl6.vim000066400000000000000000000121471476501472200173670ustar00rootroot00000000000000" Author:Travis Gibson " Description: This file adds support for checking perl6 syntax let g:ale_perl6_perl6_executable = \ get(g:, 'ale_perl6_perl6_executable', 'perl6') let g:ale_perl6_perl6_options = \ get(g:, 'ale_perl6_perl6_options', '-c -Ilib') let $PERL6_EXCEPTIONS_HANDLER = 'JSON' let $RAKUDO_ERROR_COLOR = 0 function! ale_linters#perl6#perl6#GetExecutable(buffer) abort return ale#Var(a:buffer, 'perl6_perl6_executable') endfunction function! ale_linters#perl6#perl6#GetCommand(buffer) abort return ale_linters#perl6#perl6#GetExecutable(a:buffer) \ . ' ' . ale#Var(a:buffer, 'perl6_perl6_options') \ . ' %t' endfunction function! ale_linters#perl6#perl6#ExtractError(dict, item, type, buffer) abort let l:file = '' let l:line = 1 let l:column = '' let l:text = '' let l:pre = '' let l:counter = 2 let l:end_line = '' let l:linepatternmessage = 'at\s\+line\s\+\(\d\+\)' if has_key(a:dict[a:item], 'filename') && !empty(a:dict[a:item]['filename']) let l:file = a:dict[a:item]['filename'] endif if has_key(a:dict[a:item], 'line') && !empty(a:dict[a:item]['line']) let l:line = a:dict[a:item]['line'] let l:counter -= 1 endif if has_key(a:dict[a:item], 'column') && !empty(a:dict[a:item]['column']) let l:column = a:dict[a:item]['column'] endif if has_key(a:dict[a:item], 'message') && !empty(a:dict[a:item]['message']) let l:text = substitute(a:dict[a:item]['message'], '\s*\n\s*', ' ', 'g') let l:counter -= 1 endif if has_key(a:dict[a:item], 'line-real') && !empty(a:dict[a:item]['line-real']) let l:end_line = l:line let l:line = a:dict[a:item]['line-real'] endif for l:match in ale#util#GetMatches(l:text, l:linepatternmessage) let l:line = l:match[1] let l:counter -= 1 endfor " Currently, filenames and line numbers are not always given in the error output if l:counter < 2 \&& ( ale#path#IsBufferPath(a:buffer, l:file) || l:file is# '' ) return { \ 'lnum': '' . l:line, \ 'text': l:text, \ 'type': a:type, \ 'col': l:column, \ 'end_lnum': l:end_line, \ 'code': a:item, \} endif return '' endfunction function! ale_linters#perl6#perl6#Handle(buffer, lines) abort let l:output = [] if empty(a:lines) return l:output endif if a:lines[0] is# 'Syntax OK' return l:output endif try let l:json = json_decode(join(a:lines, '')) catch /E474\|E491/ call add(l:output, { \ 'lnum': '1', \ 'text': 'Received output in the default Perl6 error format. See :ALEDetail for details', \ 'detail': join(a:lines, "\n"), \ 'type': 'W', \ }) return l:output endtry if type(l:json) is v:t_dict for l:key in keys(l:json) if has_key(l:json[l:key], 'sorrows') \&& has_key(l:json[l:key], 'worries') if !empty(l:json[l:key]['sorrows']) for l:dictionary in get(l:json[l:key], 'sorrows') for l:item in keys(l:dictionary) let l:result = \ ale_linters#perl6#perl6#ExtractError( \ l:dictionary, \ l:item, \ 'E', \ a:buffer, \ ) if l:result isnot# '' call add(l:output, l:result) endif endfor endfor endif if !empty(l:json[l:key]['worries']) for l:dictionary in get(l:json[l:key], 'worries') for l:item in keys(l:dictionary) let l:result = \ ale_linters#perl6#perl6#ExtractError( \ l:dictionary, \ l:item, \ 'W', \ a:buffer, \ ) if l:result isnot# '' call add(l:output, l:result) endif endfor endfor endif else let l:result = ale_linters#perl6#perl6#ExtractError( \ l:json, \ l:key, \ 'E', \ a:buffer, \ ) if l:result isnot# '' call add(l:output, l:result) endif endif endfor endif return l:output endfunction call ale#linter#Define('perl6', { \ 'name': 'perl6', \ 'executable': function('ale_linters#perl6#perl6#GetExecutable'), \ 'output_stream': 'both', \ 'command': function('ale_linters#perl6#perl6#GetCommand'), \ 'callback': 'ale_linters#perl6#perl6#Handle', \}) ale-4.0.0/ale_linters/php/000077500000000000000000000000001476501472200153545ustar00rootroot00000000000000ale-4.0.0/ale_linters/php/cspell.vim000066400000000000000000000002261476501472200173530ustar00rootroot00000000000000scriptencoding utf-8 " Author: David Houston " Description: cspell support for PHP files. call ale#handlers#cspell#DefineLinter('php') ale-4.0.0/ale_linters/php/intelephense.vim000077500000000000000000000022761476501472200205660ustar00rootroot00000000000000" Author: Eric Stern , " Arnold Chand " Description: Intelephense language server integration for ALE call ale#Set('php_intelephense_executable', 'intelephense') call ale#Set('php_intelephense_use_global', 1) call ale#Set('php_intelephense_config', {}) function! ale_linters#php#intelephense#GetProjectRoot(buffer) abort let l:composer_path = ale#path#FindNearestFile(a:buffer, 'composer.json') if (!empty(l:composer_path)) return fnamemodify(l:composer_path, ':h') endif let l:git_path = ale#path#FindNearestDirectory(a:buffer, '.git') return !empty(l:git_path) ? fnamemodify(l:git_path, ':h:h') : '' endfunction function! ale_linters#php#intelephense#GetInitializationOptions(buffer) abort return ale#Var(a:buffer, 'php_intelephense_config') endfunction call ale#linter#Define('php', { \ 'name': 'intelephense', \ 'lsp': 'stdio', \ 'initialization_options': function('ale_linters#php#intelephense#GetInitializationOptions'), \ 'executable': {b -> ale#path#FindExecutable(b, 'php_intelephense', [])}, \ 'command': '%e --stdio', \ 'project_root': function('ale_linters#php#intelephense#GetProjectRoot'), \}) ale-4.0.0/ale_linters/php/langserver.vim000066400000000000000000000016671476501472200202530ustar00rootroot00000000000000" Author: Eric Stern " Description: PHP Language server integration for ALE call ale#Set('php_langserver_executable', 'php-language-server.php') call ale#Set('php_langserver_use_global', get(g:, 'ale_use_global_executables', 0)) function! ale_linters#php#langserver#GetProjectRoot(buffer) abort let l:composer_path = ale#path#FindNearestFile(a:buffer, 'composer.json') if (!empty(l:composer_path)) return fnamemodify(l:composer_path, ':h') endif let l:git_path = ale#path#FindNearestDirectory(a:buffer, '.git') return !empty(l:git_path) ? fnamemodify(l:git_path, ':h:h') : '' endfunction call ale#linter#Define('php', { \ 'name': 'langserver', \ 'lsp': 'stdio', \ 'executable': {b -> ale#path#FindExecutable(b, 'php_langserver', [ \ 'vendor/bin/php-language-server.php', \ ])}, \ 'command': 'php %e', \ 'project_root': function('ale_linters#php#langserver#GetProjectRoot'), \}) ale-4.0.0/ale_linters/php/phan.vim000066400000000000000000000045761476501472200170330ustar00rootroot00000000000000" Author: diegoholiveira , haginaga " Description: static analyzer for PHP " Define the minimum severity let g:ale_php_phan_minimum_severity = get(g:, 'ale_php_phan_minimum_severity', 0) let g:ale_php_phan_executable = get(g:, 'ale_php_phan_executable', 'phan') let g:ale_php_phan_use_client = get(g:, 'ale_php_phan_use_client', 0) function! ale_linters#php#phan#GetExecutable(buffer) abort let l:executable = ale#Var(a:buffer, 'php_phan_executable') if ale#Var(a:buffer, 'php_phan_use_client') == 1 && l:executable is# 'phan' let l:executable = 'phan_client' endif return l:executable endfunction function! ale_linters#php#phan#GetCommand(buffer) abort if ale#Var(a:buffer, 'php_phan_use_client') == 1 let l:args = '-l ' \ . ' %s' else let l:args = '-y ' \ . ale#Var(a:buffer, 'php_phan_minimum_severity') \ . ' %s' endif let l:executable = ale_linters#php#phan#GetExecutable(a:buffer) return ale#Escape(l:executable) . ' ' . l:args endfunction function! ale_linters#php#phan#Handle(buffer, lines) abort " Matches against lines like the following: if ale#Var(a:buffer, 'php_phan_use_client') == 1 " Phan error: ERRORTYPE: message in /path/to/some-filename.php on line nnn let l:pattern = '^Phan error: \(\w\+\): \(.\+\) in \(.\+\) on line \(\d\+\)$' else " /path/to/some-filename.php:18 ERRORTYPE message let l:pattern = '^\(.*\):\(\d\+\)\s\(\w\+\)\s\(.\+\)$' endif let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) if ale#Var(a:buffer, 'php_phan_use_client') == 1 let l:dict = { \ 'lnum': l:match[4] + 0, \ 'text': l:match[2], \ 'filename': l:match[3], \ 'type': 'W', \} else let l:dict = { \ 'lnum': l:match[2] + 0, \ 'text': l:match[4], \ 'type': 'W', \ 'filename': l:match[1], \} endif call add(l:output, l:dict) endfor return l:output endfunction call ale#linter#Define('php', { \ 'name': 'phan', \ 'executable': function('ale_linters#php#phan#GetExecutable'), \ 'command': function('ale_linters#php#phan#GetCommand'), \ 'callback': 'ale_linters#php#phan#Handle', \}) ale-4.0.0/ale_linters/php/php.vim000066400000000000000000000025741476501472200166700ustar00rootroot00000000000000" Author: Spencer Wood , Adriaan Zonnenberg " Description: This file adds support for checking PHP with php-cli call ale#Set('php_php_executable', 'php') function! ale_linters#php#php#Handle(buffer, lines) abort " Matches patterns like the following: " " PHP 7.1<= - Parse error: syntax error, unexpected ';', expecting ']' in - on line 15 " PHP 7.2>= - Parse error: syntax error, unexpected ';', expecting ']' in Standard input code on line 15 let l:pattern = '\v^%(Fatal|Parse) error:\s+(.+unexpected ''(.+)%(expecting.+)@ ale#Var(b, 'php_php_executable')}, \ 'output_stream': 'stdout', \ 'command': '%e -l -d error_reporting=E_ALL -d display_errors=1 -d log_errors=0 --', \ 'callback': 'ale_linters#php#php#Handle', \}) ale-4.0.0/ale_linters/php/phpactor.vim000066400000000000000000000013321476501472200177100ustar00rootroot00000000000000" Author: Arizard " Description: PHPactor integration for ALE " Copied from langserver.vim function! ale_linters#php#phpactor#GetProjectRoot(buffer) abort let l:composer_path = ale#path#FindNearestFile(a:buffer, 'composer.json') if (!empty(l:composer_path)) return fnamemodify(l:composer_path, ':h') endif let l:git_path = ale#path#FindNearestDirectory(a:buffer, '.git') return !empty(l:git_path) ? fnamemodify(l:git_path, ':h:h') : '' endfunction call ale#linter#Define('php', { \ 'name': 'phpactor', \ 'lsp': 'stdio', \ 'executable': 'phpactor', \ 'command': '%e language-server', \ 'project_root': function('ale_linters#php#phpactor#GetProjectRoot'), \}) ale-4.0.0/ale_linters/php/phpcs.vim000066400000000000000000000035141476501472200172110ustar00rootroot00000000000000" Author: jwilliams108 , Eric Stern " Description: phpcs for PHP files let g:ale_php_phpcs_standard = get(g:, 'ale_php_phpcs_standard', '') call ale#Set('php_phpcs_options', '') call ale#Set('php_phpcs_executable', 'phpcs') call ale#Set('php_phpcs_use_global', get(g:, 'ale_use_global_executables', 0)) function! ale_linters#php#phpcs#GetCommand(buffer) abort let l:standard = ale#Var(a:buffer, 'php_phpcs_standard') let l:standard_option = !empty(l:standard) \ ? '--standard=' . ale#Escape(l:standard) \ : '' return '%e -s --report=emacs --stdin-path=%s' \ . ale#Pad(l:standard_option) \ . ale#Pad(ale#Var(a:buffer, 'php_phpcs_options')) endfunction function! ale_linters#php#phpcs#Handle(buffer, lines) abort " Matches against lines like the following: " " /path/to/some-filename.php:18:3: error - Line indented incorrectly; expected 4 spaces, found 2 (Generic.WhiteSpace.ScopeIndent.IncorrectExact) let l:pattern = '^.*:\(\d\+\):\(\d\+\): \(.\+\) - \(.\+\) (\(.\+\)).*$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) let l:code = l:match[5] let l:text = l:match[4] . ' (' . l:code . ')' let l:type = l:match[3] call add(l:output, { \ 'lnum': l:match[1] + 0, \ 'col': l:match[2] + 0, \ 'text': l:text, \ 'type': l:type is# 'error' ? 'E' : 'W', \ 'sub_type': 'style', \}) endfor return l:output endfunction call ale#linter#Define('php', { \ 'name': 'phpcs', \ 'executable': {b -> ale#path#FindExecutable(b, 'php_phpcs', [ \ 'vendor/bin/phpcs', \ 'phpcs' \ ])}, \ 'cwd': '%s:h', \ 'command': function('ale_linters#php#phpcs#GetCommand'), \ 'callback': 'ale_linters#php#phpcs#Handle', \}) ale-4.0.0/ale_linters/php/phpmd.vim000066400000000000000000000023421476501472200172020ustar00rootroot00000000000000" Author: medains , David Sierra " Description: phpmd for PHP files let g:ale_php_phpmd_executable = get(g:, 'ale_php_phpmd_executable', 'phpmd') " Set to change the ruleset let g:ale_php_phpmd_ruleset = get(g:, 'ale_php_phpmd_ruleset', 'cleancode,codesize,controversial,design,naming,unusedcode') function! ale_linters#php#phpmd#GetCommand(buffer) abort return '%e %t text' \ . ale#Pad(ale#Var(a:buffer, 'php_phpmd_ruleset')) \ . ' --ignore-violations-on-exit' endfunction function! ale_linters#php#phpmd#Handle(buffer, lines) abort " Matches against lines like the following: " " /path/to/some-filename.php:18 message let l:pattern = '^.*:\(\d\+\)\s\+\(.\+\)$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) call add(l:output, { \ 'lnum': l:match[1] + 0, \ 'text': l:match[2], \ 'type': 'W', \}) endfor return l:output endfunction call ale#linter#Define('php', { \ 'name': 'phpmd', \ 'executable': {b -> ale#Var(b, 'php_phpmd_executable')}, \ 'command': function('ale_linters#php#phpmd#GetCommand'), \ 'callback': 'ale_linters#php#phpmd#Handle', \}) ale-4.0.0/ale_linters/php/phpstan.vim000066400000000000000000000067461476501472200175630ustar00rootroot00000000000000" Author: medains , ardis , Arizard " Description: phpstan for PHP files " Set to change the ruleset let g:ale_php_phpstan_executable = get(g:, 'ale_php_phpstan_executable', 'phpstan') let g:ale_php_phpstan_level = get(g:, 'ale_php_phpstan_level', '') let g:ale_php_phpstan_configuration = get(g:, 'ale_php_phpstan_configuration', '') let g:ale_php_phpstan_autoload = get(g:, 'ale_php_phpstan_autoload', '') let g:ale_php_phpstan_memory_limit = get(g:, 'ale_php_phpstan_memory_limit', '') call ale#Set('php_phpstan_use_global', get(g:, 'ale_use_global_executables', 0)) function! ale_linters#php#phpstan#GetCommand(buffer, version) abort let l:configuration = ale#Var(a:buffer, 'php_phpstan_configuration') let l:configuration_option = !empty(l:configuration) \ ? ' -c ' . ale#Escape(l:configuration) \ : '' let l:autoload = ale#Var(a:buffer, 'php_phpstan_autoload') let l:autoload_option = !empty(l:autoload) \ ? ' -a ' . ale#Escape(l:autoload) \ : '' let l:memory_limit = ale#Var(a:buffer, 'php_phpstan_memory_limit') let l:memory_limit_option = !empty(l:memory_limit) \ ? ' --memory-limit=' . ale#Escape(l:memory_limit) \ : '' let l:level = ale#Var(a:buffer, 'php_phpstan_level') if empty(l:level) && empty(ale_linters#php#phpstan#FindConfigFile(a:buffer)) " if no configuration file is found, then use 4 as a default level let l:level = '4' endif let l:level_option = !empty(l:level) \ ? ' -l ' . ale#Escape(l:level) \ : '' let l:error_format = ale#semver#GTE(a:version, [0, 10, 3]) \ ? ' --error-format json' \ : ' --errorFormat json' return '%e analyze --no-progress' \ . l:error_format \ . l:configuration_option \ . l:autoload_option \ . l:level_option \ . l:memory_limit_option \ . ' %s' endfunction function! ale_linters#php#phpstan#Handle(buffer, lines) abort let l:res = ale#util#FuzzyJSONDecode(a:lines, {'files': []}) let l:output = [] if type(l:res.files) is v:t_list return l:output endif for l:key in keys(l:res.files) for l:err in l:res.files[l:key].messages call add(l:output, { \ 'lnum': l:err.line, \ 'text': l:err.message, \ 'type': 'E', \}) endfor endfor return l:output endfunction function! ale_linters#php#phpstan#GetCwd(buffer) abort let l:result = ale#path#Dirname(ale_linters#php#phpstan#FindConfigFile(a:buffer)) return empty(l:result) ? v:null : l:result endfunction function! ale_linters#php#phpstan#FindConfigFile(buffer) abort let l:result = ale#path#FindNearestFile(a:buffer, 'phpstan.neon') if empty(l:result) let l:result = ale#path#FindNearestFile(a:buffer, 'phpstan.neon.dist') endif return l:result endfunction call ale#linter#Define('php', { \ 'name': 'phpstan', \ 'executable': {buffer -> ale#path#FindExecutable(buffer, 'php_phpstan', [ \ 'vendor/bin/phpstan', \ 'phpstan' \ ])}, \ 'command': {buffer -> ale#semver#RunWithVersionCheck( \ buffer, \ ale#path#FindExecutable(buffer, 'php_phpstan', [ \ 'vendor/bin/phpstan', \ 'phpstan' \ ]), \ '%e --version', \ function('ale_linters#php#phpstan#GetCommand'), \ )}, \ 'callback': 'ale_linters#php#phpstan#Handle', \ 'cwd': function('ale_linters#php#phpstan#GetCwd'), \}) ale-4.0.0/ale_linters/php/psalm.vim000066400000000000000000000021421476501472200172040ustar00rootroot00000000000000" Author: Matt Brown " Description: plugin for Psalm, static analyzer for PHP call ale#Set('php_psalm_executable', 'psalm') call ale#Set('php_psalm_options', '') call ale#Set('php_psalm_use_global', get(g:, 'ale_use_global_executables', 0)) function! ale_linters#php#psalm#GetProjectRoot(buffer) abort let l:composer_path = ale#path#FindNearestFile(a:buffer, 'composer.json') if (!empty(l:composer_path)) return fnamemodify(l:composer_path, ':h') endif let l:git_path = ale#path#FindNearestDirectory(a:buffer, '.git') return !empty(l:git_path) ? fnamemodify(l:git_path, ':h:h') : '' endfunction function! ale_linters#php#psalm#GetCommand(buffer) abort return '%e --language-server' . ale#Pad(ale#Var(a:buffer, 'php_psalm_options')) endfunction call ale#linter#Define('php', { \ 'name': 'psalm', \ 'lsp': 'stdio', \ 'executable': {b -> ale#path#FindExecutable(b, 'php_psalm', [ \ 'vendor/bin/psalm', \ ])}, \ 'command': function('ale_linters#php#psalm#GetCommand'), \ 'project_root': function('ale_linters#php#psalm#GetProjectRoot'), \}) ale-4.0.0/ale_linters/php/tlint.vim000066400000000000000000000046551476501472200172350ustar00rootroot00000000000000" Author: Jose Soto " " Description: Tighten Opinionated PHP Linting " Website: https://github.com/tightenco/tlint call ale#Set('php_tlint_executable', 'tlint') call ale#Set('php_tlint_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('php_tlint_options', '') function! ale_linters#php#tlint#GetProjectRoot(buffer) abort let l:composer_path = ale#path#FindNearestFile(a:buffer, 'composer.json') if !empty(l:composer_path) return fnamemodify(l:composer_path, ':h') endif let l:git_path = ale#path#FindNearestDirectory(a:buffer, '.git') return !empty(l:git_path) ? fnamemodify(l:git_path, ':h:h') : '' endfunction function! ale_linters#php#tlint#GetExecutable(buffer) abort return ale#path#FindExecutable(a:buffer, 'php_tlint', [ \ 'vendor/bin/tlint', \ 'tlint', \]) endfunction function! ale_linters#php#tlint#GetCommand(buffer) abort let l:executable = ale_linters#php#tlint#GetExecutable(a:buffer) let l:options = ale#Var(a:buffer, 'php_tlint_options') return ale#node#Executable(a:buffer, l:executable) \ . (!empty(l:options) ? ' ' . l:options : '') \ . ' lint %s' endfunction function! ale_linters#php#tlint#Handle(buffer, lines) abort " Matches against lines like the following: " " ! There should be 1 space around `.` concatenations, and additional lines should always start with a `.` " 22 : ` $something = 'a'.'name';` " let l:loop_count = 0 let l:messages_pattern = '^\! \(.*\)' let l:output = [] let l:pattern = '^\(\d\+\) \:' let l:temp_messages = [] for l:message in ale#util#GetMatches(a:lines, l:messages_pattern) call add(l:temp_messages, l:message) endfor let l:loop_count = 0 for l:match in ale#util#GetMatches(a:lines, l:pattern) let l:num = l:match[1] let l:text = l:temp_messages[l:loop_count] call add(l:output, { \ 'lnum': l:num, \ 'col': 0, \ 'text': l:text, \ 'type': 'W', \ 'sub_type': 'style', \}) let l:loop_count += 1 endfor return l:output endfunction call ale#linter#Define('php', { \ 'name': 'tlint', \ 'executable': function('ale_linters#php#tlint#GetExecutable'), \ 'command': function('ale_linters#php#tlint#GetCommand'), \ 'callback': 'ale_linters#php#tlint#Handle', \ 'project_root': function('ale_linters#php#tlint#GetProjectRoot'), \}) ale-4.0.0/ale_linters/po/000077500000000000000000000000001476501472200152035ustar00rootroot00000000000000ale-4.0.0/ale_linters/po/alex.vim000066400000000000000000000002071476501472200166500ustar00rootroot00000000000000" Author: Cian Butler https://github.com/butlerx " Description: alex for PO files call ale#handlers#alex#DefineLinter('po', '--text') ale-4.0.0/ale_linters/po/msgfmt.vim000066400000000000000000000017361476501472200172240ustar00rootroot00000000000000" Author: Cian Butler https://github.com/butlerx " Description: msgfmt for PO files function! ale_linters#po#msgfmt#Handle(buffer, lines) abort let l:results = ale#handlers#unix#HandleAsWarning(a:buffer, a:lines) let l:index = 0 for l:item in l:results if l:index > 0 && l:item.text =~? 'this is the location of the first definition' let l:last_item = l:results[l:index - 1] if l:last_item.text =~? 'duplicate message definition' let l:last_item.text = 'duplicate of message at line ' . l:item.lnum let l:item.text = 'first location of duplicate of message at line ' . l:last_item.lnum endif endif let l:index += 1 endfor return l:results endfunction call ale#linter#Define('po', { \ 'name': 'msgfmt', \ 'executable': 'msgfmt', \ 'output_stream': 'stderr', \ 'command': 'msgfmt --statistics --output-file=- %t', \ 'callback': 'ale_linters#po#msgfmt#Handle', \}) ale-4.0.0/ale_linters/po/proselint.vim000066400000000000000000000004071476501472200177400ustar00rootroot00000000000000" Author: Cian Butler https://github.com/butlerx " Description: proselint for PO files call ale#linter#Define('po', { \ 'name': 'proselint', \ 'executable': 'proselint', \ 'command': 'proselint %t', \ 'callback': 'ale#handlers#unix#HandleAsWarning', \}) ale-4.0.0/ale_linters/po/writegood.vim000066400000000000000000000002101476501472200177140ustar00rootroot00000000000000" Author: Cian Butler https://github.com/butlerx " Description: write-good for PO files call ale#handlers#writegood#DefineLinter('po') ale-4.0.0/ale_linters/pod/000077500000000000000000000000001476501472200153475ustar00rootroot00000000000000ale-4.0.0/ale_linters/pod/alex.vim000066400000000000000000000002111476501472200170070ustar00rootroot00000000000000" Author: Johannes Wienke " Description: alex for pod files call ale#handlers#alex#DefineLinter('pod', '--text') ale-4.0.0/ale_linters/pod/proselint.vim000066400000000000000000000004171476501472200201050ustar00rootroot00000000000000" Author: Daniel M. Capella https://github.com/polyzen " Description: proselint for Pod files call ale#linter#Define('pod', { \ 'name': 'proselint', \ 'executable': 'proselint', \ 'command': 'proselint %t', \ 'callback': 'ale#handlers#unix#HandleAsWarning', \}) ale-4.0.0/ale_linters/pod/writegood.vim000066400000000000000000000002131476501472200200630ustar00rootroot00000000000000" Author: Sumner Evans " Description: write-good for Pod files call ale#handlers#writegood#DefineLinter('pod') ale-4.0.0/ale_linters/pony/000077500000000000000000000000001476501472200155525ustar00rootroot00000000000000ale-4.0.0/ale_linters/pony/ponyc.vim000066400000000000000000000010451476501472200174170ustar00rootroot00000000000000" Description: ponyc linter for pony files call ale#Set('pony_ponyc_executable', 'ponyc') call ale#Set('pony_ponyc_options', '--pass paint') function! ale_linters#pony#ponyc#GetCommand(buffer) abort return '%e' . ale#Pad(ale#Var(a:buffer, 'pony_ponyc_options')) endfunction call ale#linter#Define('pony', { \ 'name': 'ponyc', \ 'output_stream': 'stderr', \ 'executable': {b -> ale#Var(b, 'pony_ponyc_executable')}, \ 'command': function('ale_linters#pony#ponyc#GetCommand'), \ 'callback': 'ale#handlers#pony#HandlePonycFormat', \}) ale-4.0.0/ale_linters/powershell/000077500000000000000000000000001476501472200167515ustar00rootroot00000000000000ale-4.0.0/ale_linters/powershell/cspell.vim000066400000000000000000000002441476501472200207500ustar00rootroot00000000000000scriptencoding utf-8 " Author: David Houston " Description: cspell support for PowerShell files. call ale#handlers#cspell#DefineLinter('powershell') ale-4.0.0/ale_linters/powershell/powershell.vim000066400000000000000000000071471476501472200216630ustar00rootroot00000000000000" Author: Jesse Harris - https://github.com/zigford " Description: This file adds support for powershell scripts synatax errors call ale#Set('powershell_powershell_executable', 'pwsh') function! ale_linters#powershell#powershell#GetExecutable(buffer) abort return ale#Var(a:buffer, 'powershell_powershell_executable') endfunction " Some powershell magic to show syntax errors without executing the script " thanks to keith hill: " https://rkeithhill.wordpress.com/2007/10/30/powershell-quicktip-preparsing-scripts-to-check-for-syntax-errors/ function! ale_linters#powershell#powershell#GetCommand(buffer) abort let l:script = ['Param($Script); \ $ErrorView = "Normal"; \ trap {$_;continue} & { \ $Contents = Get-Content -Path $Script; \ $Contents = [string]::Join([Environment]::NewLine, $Contents); \ [void]$ExecutionContext.InvokeCommand.NewScriptBlock($Contents); \ };'] return ale#powershell#RunPowerShell( \ a:buffer, 'powershell_powershell', l:script) endfunction " Parse powershell error output using regex into a list of dicts function! ale_linters#powershell#powershell#Handle(buffer, lines) abort let l:output = [] " Our 3 patterns we need to scrape the data for the dicts let l:patterns = [ \ '\v^At line:(\d+) char:(\d+)', \ '\v^(At|\+| )@!.*', \ '\vFullyQualifiedErrorId : (\w+)', \] let l:matchcount = 0 for l:match in ale#util#GetMatches(a:lines, l:patterns) " We want to work with 3 matches per syntax error let l:matchcount = l:matchcount + 1 if l:matchcount == 1 || str2nr(l:match[1]) " First match consists of 2 capture groups, and " can capture the line and col if exists('l:item') " We may be here because the last syntax " didn't emit a code, and so only had 2 " matches call add(l:output, l:item) let l:matchcount = 1 endif " If the match is 0, it was a failed match " probably due to an unexpected token which " contained a newline. Reset matchcount. to " continue to the next match if !empty(l:match[1]) let l:item = { \ 'lnum': str2nr(l:match[1]), \ 'col': str2nr(l:match[2]), \ 'type': 'E', \} else let l:matchcount = 0 endif elseif l:matchcount == 2 " Second match[0] grabs the full line in order " to handles the text let l:item['text'] = l:match[0] else " Final match handles the code, however " powershell only emits 1 code for all errors " so, we get the final code on the last error " and loop over the previously added items to " append the code we now know call add(l:output, l:item) unlet l:item if len(l:match[1]) > 0 for l:i in l:output let l:i['code'] = l:match[1] endfor endif " Reset the matchcount so we can begin gathering " matches for the next syntax error let l:matchcount = 0 endif endfor return l:output endfunction call ale#linter#Define('powershell', { \ 'name': 'powershell', \ 'executable': function('ale_linters#powershell#powershell#GetExecutable'), \ 'command': function('ale_linters#powershell#powershell#GetCommand'), \ 'output_stream': 'stdout', \ 'callback': 'ale_linters#powershell#powershell#Handle', \}) ale-4.0.0/ale_linters/powershell/psscriptanalyzer.vim000066400000000000000000000050631476501472200231070ustar00rootroot00000000000000" Author: Jesse Harris - https://github.com/zigford " Description: This file adds support for lintng powershell scripts " using the PSScriptAnalyzer module. " let g:ale_powershell_psscriptanalyzer_exclusions = " \ 'PSAvoidUsingWriteHost,PSAvoidGlobalVars' call ale#Set('powershell_psscriptanalyzer_exclusions', '') call ale#Set('powershell_psscriptanalyzer_executable', 'pwsh') call ale#Set('powershell_psscriptanalyzer_module', \ 'psscriptanalyzer') function! ale_linters#powershell#psscriptanalyzer#GetExecutable(buffer) abort return ale#Var(a:buffer, 'powershell_psscriptanalyzer_executable') endfunction " Run Invoke-ScriptAnalyzer and output each linting message as 4 separate lines " for each parsing function! ale_linters#powershell#psscriptanalyzer#GetCommand(buffer) abort let l:exclude_option = ale#Var( \ a:buffer, 'powershell_psscriptanalyzer_exclusions') let l:module = ale#Var( \ a:buffer, 'powershell_psscriptanalyzer_module') let l:script = ['Param($Script); \ Invoke-ScriptAnalyzer "$Script" ' \ . (!empty(l:exclude_option) ? '-Exclude ' . l:exclude_option : '') \ . '| ForEach-Object { \ $_.Line; \ $_.Severity; \ $_.Message; \ $_.RuleName}'] return ale#powershell#RunPowerShell( \ a:buffer, \ 'powershell_psscriptanalyzer', \ l:script) endfunction " add every 4 lines to an item(Dict) and every item to a list " return the list function! ale_linters#powershell#psscriptanalyzer#Handle(buffer, lines) abort let l:output = [] let l:lcount = 0 for l:line in a:lines if l:lcount is# 0 " the very first line let l:item = {'lnum': str2nr(l:line)} elseif l:lcount is# 1 if l:line is# 'Error' let l:item['type'] = 'E' elseif l:line is# 'Information' let l:item['type'] = 'I' else let l:item['type'] = 'W' endif elseif l:lcount is# 2 let l:item['text'] = l:line elseif l:lcount is# 3 let l:item['code'] = l:line call add(l:output, l:item) let l:lcount = -1 endif let l:lcount = l:lcount + 1 endfor return l:output endfunction call ale#linter#Define('powershell', { \ 'name': 'psscriptanalyzer', \ 'executable': function('ale_linters#powershell#psscriptanalyzer#GetExecutable'), \ 'command': function('ale_linters#powershell#psscriptanalyzer#GetCommand'), \ 'output_stream': 'stdout', \ 'callback': 'ale_linters#powershell#psscriptanalyzer#Handle', \}) ale-4.0.0/ale_linters/prolog/000077500000000000000000000000001476501472200160675ustar00rootroot00000000000000ale-4.0.0/ale_linters/prolog/swipl.vim000066400000000000000000000065651476501472200177560ustar00rootroot00000000000000" Author: Takuya Fujiwara " Description: swipl syntax / semantic check for Prolog files call ale#Set('prolog_swipl_executable', 'swipl') call ale#Set('prolog_swipl_load', 'current_prolog_flag(argv, [File]), load_files(File, [sandboxed(true)]), halt.') call ale#Set('prolog_swipl_timeout', 3) call ale#Set('prolog_swipl_alarm', 'alarm(%t, (%h), _, [])') call ale#Set('prolog_swipl_alarm_handler', 'writeln(user_error, "ERROR: Exceeded %t seconds, Please change g:prolog_swipl_timeout to modify the limit."), halt(1)') function! ale_linters#prolog#swipl#GetCommand(buffer) abort let l:goals = ale#Var(a:buffer, 'prolog_swipl_load') let l:goals = l:goals =~# '^\s*$' ? 'halt' : l:goals let l:timeout = ale#Var(a:buffer, 'prolog_swipl_timeout') + 0 if l:timeout > 0 let l:goals = s:GetAlarm(a:buffer, l:timeout) . ', ' . l:goals endif return '%e -g ' . ale#Escape(l:goals) . ' -- %s' endfunction function! s:GetAlarm(buffer, timeout) abort let l:handler = ale#Var(a:buffer, 'prolog_swipl_alarm_handler') let l:handler = s:Subst(l:handler, {'t': a:timeout}) let l:alarm = ale#Var(a:buffer, 'prolog_swipl_alarm') let l:alarm = s:Subst(l:alarm, {'t': a:timeout, 'h': l:handler}) return l:alarm endfunction function! s:Subst(format, vars) abort let l:vars = extend(copy(a:vars), {'%': '%'}) return substitute(a:format, '%\(.\)', '\=get(l:vars, submatch(1), "")', 'g') endfunction function! ale_linters#prolog#swipl#Handle(buffer, lines) abort let l:output = [] let l:i = 0 let l:pattern = '\v^(ERROR|Warning)+%(:\s*[^:]+:(\d+)%(:(\d+))?)?:\s*(.*)$' while l:i < len(a:lines) let l:match = matchlist(a:lines[l:i], l:pattern) if empty(l:match) let l:i += 1 continue endif let [l:i, l:text] = s:GetErrMsg(l:i, a:lines, l:match[4]) let l:item = { \ 'lnum': (l:match[2] + 0 ? l:match[2] + 0 : 1), \ 'col': l:match[3] + 0, \ 'text': l:text, \ 'type': (l:match[1] is# 'ERROR' ? 'E' : 'W'), \} if !s:Ignore(l:item) call add(l:output, l:item) endif endwhile return l:output endfunction " This returns [, ] function! s:GetErrMsg(i, lines, text) abort if a:text !~# '^\s*$' return [a:i + 1, a:text] endif let l:i = a:i + 1 let l:text = [] let l:pattern = '\v^(ERROR|Warning)?:?(.*)$' while l:i < len(a:lines) let l:match = matchlist(a:lines[l:i], l:pattern) if empty(l:match) || empty(l:match[2]) let l:i += 1 break endif call add(l:text, s:Trim(l:match[2])) let l:i += 1 endwhile return [l:i, join(l:text, '. ')] endfunction function! s:Trim(str) abort return substitute(a:str, '\v^\s+|\s+$', '', 'g') endfunction " Skip sandbox error which is caused by directives " because what we want is syntactic or semantic check. function! s:Ignore(item) abort return a:item.type is# 'E' \ && a:item.text =~# '\vNo permission to (call|directive|assert) sandboxed' endfunction call ale#linter#Define('prolog', { \ 'name': 'swipl', \ 'output_stream': 'stderr', \ 'executable': {b -> ale#Var(b, 'prolog_swipl_executable')}, \ 'command': function('ale_linters#prolog#swipl#GetCommand'), \ 'callback': 'ale_linters#prolog#swipl#Handle', \}) ale-4.0.0/ale_linters/proto/000077500000000000000000000000001476501472200157305ustar00rootroot00000000000000ale-4.0.0/ale_linters/proto/buf_lint.vim000066400000000000000000000016261476501472200202540ustar00rootroot00000000000000" Author: Alex McKinney " Description: Run buf lint. call ale#Set('proto_buf_lint_executable', 'buf') call ale#Set('proto_buf_lint_config', '') call ale#Set('proto_buf_lint_options', '') function! ale_linters#proto#buf_lint#GetCommand(buffer) abort let l:config = ale#Var(a:buffer, 'proto_buf_lint_config') let l:options = ale#Var(a:buffer, 'proto_buf_lint_options') return '%e lint' \ . (!empty(l:config) ? ' --config=' . ale#Escape(l:config) : '') \ . (!empty(l:options) ? ' ' . l:options : '') \ . ' %s#include_package_files=true' endfunction call ale#linter#Define('proto', { \ 'name': 'buf_lint', \ 'aliases': ['buf-lint'], \ 'lint_file': 1, \ 'output_stream': 'stdout', \ 'executable': {b -> ale#Var(b, 'proto_buf_lint_executable')}, \ 'command': function('ale_linters#proto#buf_lint#GetCommand'), \ 'callback': 'ale#handlers#go#Handler', \}) ale-4.0.0/ale_linters/proto/protoc_gen_lint.vim000066400000000000000000000015531476501472200216360ustar00rootroot00000000000000" Author: Jeff Willette " Description: run the protoc-gen-lint plugin for the protoc binary call ale#Set('proto_protoc_gen_lint_options', '') function! ale_linters#proto#protoc_gen_lint#GetCommand(buffer) abort let l:dirname = expand('#' . a:buffer . ':p:h') let l:options = ['-I ' . ale#Escape(l:dirname)] if !empty(ale#Var(a:buffer, 'proto_protoc_gen_lint_options')) let l:options += [ale#Var(a:buffer, 'proto_protoc_gen_lint_options')] endif let l:options += ['--lint_out=. ' . '%s'] return 'protoc' . ' ' . join(l:options) endfunction call ale#linter#Define('proto', { \ 'name': 'protoc-gen-lint', \ 'lint_file': 1, \ 'output_stream': 'stderr', \ 'executable': 'protoc', \ 'command': function('ale_linters#proto#protoc_gen_lint#GetCommand'), \ 'callback': 'ale#handlers#unix#HandleAsError', \}) ale-4.0.0/ale_linters/proto/protolint.vim000066400000000000000000000014171476501472200205020ustar00rootroot00000000000000" Author: Yohei Yoshimuta " Description: run the protolint for Protocol Buffer files call ale#Set('proto_protolint_executable', 'protolint') call ale#Set('proto_protolint_config', '') function! ale_linters#proto#protolint#GetCommand(buffer) abort let l:config = ale#Var(a:buffer, 'proto_protolint_config') return '%e lint' \ . (!empty(l:config) ? ' -config_path=' . ale#Escape(l:config) : '') \ . ' -reporter=unix' \ . ' %s' endfunction call ale#linter#Define('proto', { \ 'name': 'protolint', \ 'lint_file': 1, \ 'output_stream': 'stderr', \ 'executable': {b -> ale#Var(b, 'proto_protolint_executable')}, \ 'command': function('ale_linters#proto#protolint#GetCommand'), \ 'callback': 'ale#handlers#unix#HandleAsError', \}) ale-4.0.0/ale_linters/pug/000077500000000000000000000000001476501472200153605ustar00rootroot00000000000000ale-4.0.0/ale_linters/pug/puglint.vim000066400000000000000000000032131476501472200175560ustar00rootroot00000000000000" Author: w0rp - " Description: pug-lint for checking Pug/Jade files. call ale#Set('pug_puglint_options', '') call ale#Set('pug_puglint_executable', 'pug-lint') call ale#Set('pug_puglint_use_global', get(g:, 'ale_use_global_executables', 0)) function! s:FindConfig(buffer) abort for l:filename in [ \ '.pug-lintrc', \ '.pug-lintrc.js', \ '.pug-lintrc.json', \ 'package.json', \] let l:config = ale#path#FindNearestFile(a:buffer, l:filename) if !empty(l:config) return l:config endif endfor return '' endfunction function! ale_linters#pug#puglint#GetCommand(buffer) abort let l:options = ale#Var(a:buffer, 'pug_puglint_options') let l:config = s:FindConfig(a:buffer) return '%e' . ale#Pad(l:options) \ . (!empty(l:config) ? ' -c ' . ale#Escape(l:config) : '') \ . ' -r inline %t' endfunction function! ale_linters#pug#puglint#Handle(buffer, lines) abort for l:line in a:lines[:10] if l:line =~# '^SyntaxError: ' return [{ \ 'lnum': 1, \ 'text': 'puglint configuration error (type :ALEDetail for more information)', \ 'detail': join(a:lines, "\n"), \}] endif endfor return ale#handlers#unix#HandleAsError(a:buffer, a:lines) endfunction call ale#linter#Define('pug', { \ 'name': 'puglint', \ 'executable': {b -> ale#path#FindExecutable(b, 'pug_puglint', [ \ 'node_modules/.bin/pug-lint', \ ])}, \ 'output_stream': 'stderr', \ 'command': function('ale_linters#pug#puglint#GetCommand'), \ 'callback': 'ale_linters#pug#puglint#Handle', \}) ale-4.0.0/ale_linters/puppet/000077500000000000000000000000001476501472200161025ustar00rootroot00000000000000ale-4.0.0/ale_linters/puppet/languageserver.vim000066400000000000000000000023271476501472200216350ustar00rootroot00000000000000" Author: Alexander Olofsson " Description: Puppet Language Server integration for ALE call ale#Set('puppet_languageserver_executable', 'puppet-languageserver') function! ale_linters#puppet#languageserver#GetProjectRoot(buffer) abort " Note: The metadata.json file is recommended for Puppet 4+ modules, but " there's no requirement to have it, so fall back to the other possible " Puppet module directories let l:root_path = ale#path#FindNearestFile(a:buffer, 'metadata.json') if !empty(l:root_path) return fnamemodify(l:root_path, ':h') endif for l:test_path in [ \ 'manifests', \ 'templates', \] let l:root_path = ale#path#FindNearestDirectory(a:buffer, l:test_path) if !empty(l:root_path) return fnamemodify(l:root_path, ':h:h') endif endfor return '' endfunction call ale#linter#Define('puppet', { \ 'name': 'languageserver', \ 'aliases': ['puppet_languageserver'], \ 'lsp': 'stdio', \ 'executable': {b -> ale#Var(b, 'puppet_languageserver_executable')}, \ 'command': '%e --stdio', \ 'language': 'puppet', \ 'project_root': function('ale_linters#puppet#languageserver#GetProjectRoot'), \}) ale-4.0.0/ale_linters/puppet/puppet.vim000066400000000000000000000034711476501472200201410ustar00rootroot00000000000000" Author: Alexander Olofsson call ale#Set('puppet_puppet_executable', 'puppet') call ale#Set('puppet_puppet_options', '') function! ale_linters#puppet#puppet#Handle(buffer, lines) abort " Matches patterns like the following: " Error: Could not parse for environment production: Syntax error at ':' at /root/puppetcode/modules/nginx/manifests/init.pp:43:12 " Error: Could not parse for environment production: Syntax error at '='; expected '}' at /root/puppetcode/modules/pancakes/manifests/init.pp:5" " Error: Could not parse for environment production: Syntax error at 'parameter1' (file: /tmp/modules/mariadb/manifests/slave.pp, line: 4, column: 5) " Error: Illegal attempt to assign to 'a Name'. Not an assignable reference (file: /tmp/modules/waffles/manifests/syrup.pp, line: 5, column: 11) " Error: Could not parse for environment production: Syntax error at end of input (file: /tmp/modules/bob/manifests/init.pp) let l:pattern = '^Error:\%(.*:\)\? \(.\+\) \((file:\|at\) .\+\.pp\(\(, line: \|:\)\(\d\+\)\(, column: \|:\)\=\(\d*\)\|)$\)' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) call add(l:output, { \ 'lnum': l:match[5] + 0, \ 'col': l:match[7] + 0, \ 'text': l:match[1], \}) endfor return l:output endfunction function! ale_linters#puppet#puppet#GetCommand(buffer) abort return '%e parser validate --color=false ' \ . ale#Pad(ale#Var(a:buffer, 'puppet_puppet_options')) \ . ' %t' endfunction call ale#linter#Define('puppet', { \ 'name': 'puppet', \ 'executable': {b -> ale#Var(b, 'puppet_puppet_executable')}, \ 'output_stream': 'stderr', \ 'command': function('ale_linters#puppet#puppet#GetCommand'), \ 'callback': 'ale_linters#puppet#puppet#Handle', \}) ale-4.0.0/ale_linters/puppet/puppetlint.vim000066400000000000000000000014171476501472200210260ustar00rootroot00000000000000" Author: Alexander Olofsson , Robert Flechtner " Description: puppet-lint for puppet files call ale#Set('puppet_puppetlint_executable', 'puppet-lint') call ale#Set('puppet_puppetlint_options', '--no-autoloader_layout-check') function! ale_linters#puppet#puppetlint#GetCommand(buffer) abort return '%e' . ale#Pad(ale#Var(a:buffer, 'puppet_puppetlint_options')) \ . ' --log-format "-:%{line}:%{column}: %{kind}: [%{check}] %{message}"' \ . ' %t' endfunction call ale#linter#Define('puppet', { \ 'name': 'puppetlint', \ 'executable': {b -> ale#Var(b, 'puppet_puppetlint_executable')}, \ 'command': function('ale_linters#puppet#puppetlint#GetCommand'), \ 'callback': 'ale#handlers#gcc#HandleGCCFormat', \}) ale-4.0.0/ale_linters/purescript/000077500000000000000000000000001476501472200167655ustar00rootroot00000000000000ale-4.0.0/ale_linters/purescript/ls.vim000066400000000000000000000031661476501472200201260ustar00rootroot00000000000000" Author: Drew Olson " Description: Integrate ALE with purescript-language-server. call ale#Set('purescript_ls_executable', 'purescript-language-server') call ale#Set('purescript_ls_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('purescript_ls_config', {}) function! ale_linters#purescript#ls#GetExecutable(buffer) abort return ale#path#FindExecutable(a:buffer, 'purescript_ls', [ \ 'node_modules/.bin/purescript-language-server', \]) endfunction function! ale_linters#purescript#ls#GetCommand(buffer) abort let l:executable = ale_linters#purescript#ls#GetExecutable(a:buffer) return ale#Escape(l:executable) . ' --stdio' endfunction function! ale_linters#purescript#ls#FindProjectRoot(buffer) abort let l:config = ale#path#FindNearestFile(a:buffer, 'bower.json') if !empty(l:config) return fnamemodify(l:config, ':h') endif let l:config = ale#path#FindNearestFile(a:buffer, 'psc-package.json') if !empty(l:config) return fnamemodify(l:config, ':h') endif let l:config = ale#path#FindNearestFile(a:buffer, 'spago.dhall') if !empty(l:config) return fnamemodify(l:config, ':h') endif return '' endfunction call ale#linter#Define('purescript', { \ 'name': 'purescript-language-server', \ 'aliases': ['purescriptls'], \ 'lsp': 'stdio', \ 'executable': function('ale_linters#purescript#ls#GetExecutable'), \ 'command': function('ale_linters#purescript#ls#GetCommand'), \ 'project_root': function('ale_linters#purescript#ls#FindProjectRoot'), \ 'lsp_config': {b -> ale#Var(b, 'purescript_ls_config')}, \}) ale-4.0.0/ale_linters/pyrex/000077500000000000000000000000001476501472200157345ustar00rootroot00000000000000ale-4.0.0/ale_linters/pyrex/cython.vim000066400000000000000000000022721476501472200177600ustar00rootroot00000000000000" Author: w0rp , " Nicolas Pauss " Description: cython syntax checking for cython files. call ale#Set('pyrex_cython_executable', 'cython') call ale#Set('pyrex_cython_options', '--warning-extra') function! ale_linters#pyrex#cython#GetCommand(buffer) abort return '%e --working %s:h --include-dir %s:h' \ . ale#Pad(ale#Var(a:buffer, 'pyrex_cython_options')) \ . ' --output-file ' . g:ale#util#nul_file . ' %t' endfunction function! ale_linters#pyrex#cython#Handle(buffer, lines) abort let l:pattern = '\v^(\w+: )?[^:]+:(\d+):?(\d+)?:? ?(.+)$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) call add(l:output, { \ 'lnum': l:match[2] + 0, \ 'col': l:match[3] + 0, \ 'text': l:match[4], \ 'type': l:match[1][0] is# 'w' ? 'W' : 'E', \}) endfor return l:output endfunction call ale#linter#Define('pyrex', { \ 'name': 'cython', \ 'output_stream': 'stderr', \ 'executable': {b -> ale#Var(b, 'pyrex_cython_executable')}, \ 'command': function('ale_linters#pyrex#cython#GetCommand'), \ 'callback': 'ale_linters#pyrex#cython#Handle', \}) ale-4.0.0/ale_linters/python/000077500000000000000000000000001476501472200161065ustar00rootroot00000000000000ale-4.0.0/ale_linters/python/bandit.vim000066400000000000000000000053031476501472200200650ustar00rootroot00000000000000" Author: Martino Pilia " Description: bandit linting for python files call ale#Set('python_bandit_executable', 'bandit') call ale#Set('python_bandit_options', '') call ale#Set('python_bandit_use_config', 1) call ale#Set('python_bandit_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('python_bandit_auto_pipenv', 0) call ale#Set('python_bandit_auto_poetry', 0) call ale#Set('python_bandit_auto_uv', 0) function! ale_linters#python#bandit#GetExecutable(buffer) abort if ( \ ale#Var(a:buffer, 'python_auto_pipenv') \ || ale#Var(a:buffer, 'python_bandit_auto_pipenv') \) && ale#python#PipenvPresent(a:buffer) return 'pipenv' endif if ( \ ale#Var(a:buffer, 'python_auto_poetry') \ || ale#Var(a:buffer, 'python_bandit_auto_poetry') \) && ale#python#PoetryPresent(a:buffer) return 'poetry' endif if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_bandit_auto_uv')) \ && ale#python#UvPresent(a:buffer) return 'uv' endif return ale#python#FindExecutable(a:buffer, 'python_bandit', ['bandit']) endfunction function! ale_linters#python#bandit#GetCommand(buffer) abort let l:executable = ale_linters#python#bandit#GetExecutable(a:buffer) let l:flags = ' --format custom' \ . ' --msg-template "{line}:{test_id}:{severity}:{msg}" ' if ale#Var(a:buffer, 'python_bandit_use_config') let l:config_path = ale#path#FindNearestFile(a:buffer, '.bandit') if !empty(l:config_path) let l:flags = ' --ini ' . ale#Escape(l:config_path) . l:flags endif endif let l:exec_args = l:executable =~? '\(pipenv\|poetry\|uv\)$' \ ? ' run bandit' \ : '' return ale#Escape(l:executable) . l:exec_args \ . l:flags \ . ale#Pad(ale#Var(a:buffer, 'python_bandit_options')) \ . ' -' endfunction function! ale_linters#python#bandit#Handle(buffer, lines) abort " Custom format defined in GetCommand via --msg-template let l:pattern = '\v^([0-9]+):(B[0-9]+):([A-Z]+):(.*)$' let l:severity = {'LOW': 'I', 'MEDIUM': 'W', 'HIGH': 'E'} let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) call add(l:output, { \ 'bufnr': a:buffer, \ 'lnum': str2nr(l:match[1]), \ 'code': l:match[2], \ 'type': l:severity[l:match[3]], \ 'text': l:match[4], \}) endfor return l:output endfunction call ale#linter#Define('python', { \ 'name': 'bandit', \ 'executable': function('ale_linters#python#bandit#GetExecutable'), \ 'command': function('ale_linters#python#bandit#GetCommand'), \ 'callback': 'ale_linters#python#bandit#Handle', \}) ale-4.0.0/ale_linters/python/cspell.vim000066400000000000000000000002341476501472200201040ustar00rootroot00000000000000scriptencoding utf-8 " Author: David Houston " Description: cspell support for Python files. call ale#handlers#cspell#DefineLinter('python') ale-4.0.0/ale_linters/python/flake8.vim000066400000000000000000000127601476501472200200030ustar00rootroot00000000000000" Author: w0rp " Description: flake8 for python files call ale#Set('python_flake8_executable', 'flake8') call ale#Set('python_flake8_options', '') call ale#Set('python_flake8_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('python_flake8_change_directory', 'project') call ale#Set('python_flake8_auto_pipenv', 0) call ale#Set('python_flake8_auto_poetry', 0) call ale#Set('python_flake8_auto_uv', 0) function! s:UsingModule(buffer) abort return ale#Var(a:buffer, 'python_flake8_options') =~# ' *-m flake8' endfunction function! ale_linters#python#flake8#GetExecutable(buffer) abort if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_flake8_auto_pipenv')) \ && ale#python#PipenvPresent(a:buffer) return 'pipenv' endif if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_flake8_auto_poetry')) \ && ale#python#PoetryPresent(a:buffer) return 'poetry' endif if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_flake8_auto_uv')) \ && ale#python#UvPresent(a:buffer) return 'uv' endif if !s:UsingModule(a:buffer) return ale#python#FindExecutable(a:buffer, 'python_flake8', ['flake8']) endif return ale#Var(a:buffer, 'python_flake8_executable') endfunction function! ale_linters#python#flake8#RunWithVersionCheck(buffer) abort let l:executable = ale_linters#python#flake8#GetExecutable(a:buffer) let l:module_string = s:UsingModule(a:buffer) ? ' -m flake8' : '' let l:command = ale#Escape(l:executable) . l:module_string . ' --version' return ale#semver#RunWithVersionCheck( \ a:buffer, \ l:executable, \ l:command, \ function('ale_linters#python#flake8#GetCommand'), \) endfunction function! ale_linters#python#flake8#GetCwd(buffer) abort let l:change_directory = ale#Var(a:buffer, 'python_flake8_change_directory') let l:cwd = '' if l:change_directory is# 'project' let l:project_root = ale#python#FindProjectRootIni(a:buffer) if !empty(l:project_root) let l:cwd = l:project_root endif endif if (l:change_directory is# 'project' && empty(l:cwd)) \|| l:change_directory is# 1 \|| l:change_directory is# 'file' let l:cwd = '%s:h' endif return l:cwd endfunction function! ale_linters#python#flake8#GetCommand(buffer, version) abort let l:executable = ale_linters#python#flake8#GetExecutable(a:buffer) let l:exec_args = l:executable =~? '\(pipenv\|poetry\|uv\)$' \ ? ' run flake8' \ : '' " Only include the --stdin-display-name argument if we can parse the " flake8 version, and it is recent enough to support it. let l:display_name_args = ale#semver#GTE(a:version, [3, 0, 0]) \ ? ' --stdin-display-name %s' \ : '' let l:options = ale#Var(a:buffer, 'python_flake8_options') return ale#Escape(l:executable) . l:exec_args \ . (!empty(l:options) ? ' ' . l:options : '') \ . ' --format=default' \ . l:display_name_args . ' -' endfunction let s:end_col_pattern_map = { \ 'F405': '\(.\+\) may be undefined', \ 'F821': 'undefined name ''\([^'']\+\)''', \ 'F999': '^''\([^'']\+\)''', \ 'F841': 'local variable ''\([^'']\+\)''', \} function! ale_linters#python#flake8#Handle(buffer, lines) abort let l:output = ale#python#HandleTraceback(a:lines, 10) if !empty(l:output) return l:output endif " Matches patterns line the following: " " Matches patterns line the following: " " stdin:6:6: E111 indentation is not a multiple of four let l:pattern = '\v^[a-zA-Z]?:?[^:]+:(\d+):?(\d+)?: ([[:alnum:]]+):? (.*)$' for l:match in ale#util#GetMatches(a:lines, l:pattern) let l:code = l:match[3] if (l:code is# 'W291' || l: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: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 let l:item = { \ 'lnum': l:match[1] + 0, \ 'col': l:match[2] + 0, \ 'vcol': 1, \ 'text': l:match[4], \ 'code': l:code, \ 'type': 'W', \} if l:code[:0] is# 'F' if l:code isnot# 'F401' let l:item.type = 'E' endif elseif l:code[:0] is# 'E' let l:item.type = 'E' if l:code isnot# 'E999' && l:code isnot# 'E112' let l:item.sub_type = 'style' endif elseif l:code[:0] is# 'W' let l:item.sub_type = 'style' endif let l:end_col_pattern = get(s:end_col_pattern_map, l:code, '') if !empty(l:end_col_pattern) let l:end_col_match = matchlist(l:match[4], l:end_col_pattern) if !empty(l:end_col_match) let l:item.end_col = l:item.col + len(l:end_col_match[1]) - 1 endif endif call add(l:output, l:item) endfor return l:output endfunction call ale#linter#Define('python', { \ 'name': 'flake8', \ 'executable': function('ale_linters#python#flake8#GetExecutable'), \ 'cwd': function('ale_linters#python#flake8#GetCwd'), \ 'command': function('ale_linters#python#flake8#RunWithVersionCheck'), \ 'callback': 'ale_linters#python#flake8#Handle', \}) ale-4.0.0/ale_linters/python/flakehell.vim000066400000000000000000000133351476501472200205570ustar00rootroot00000000000000" Author: w0rp " Description: flakehell for python files call ale#Set('python_flakehell_executable', 'flakehell') call ale#Set('python_flakehell_options', '') call ale#Set('python_flakehell_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('python_flakehell_change_directory', 'project') call ale#Set('python_flakehell_auto_pipenv', 0) call ale#Set('python_flakehell_auto_poetry', 0) call ale#Set('python_flakehell_auto_uv', 0) function! s:UsingModule(buffer) abort return ale#Var(a:buffer, 'python_flakehell_executable') is? 'python' endfunction function! ale_linters#python#flakehell#GetExecutable(buffer) abort if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_flakehell_auto_pipenv')) \ && ale#python#PipenvPresent(a:buffer) return 'pipenv' endif if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_flakehell_auto_poetry')) \ && ale#python#PoetryPresent(a:buffer) return 'poetry' endif if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_flakehell_auto_uv')) \ && ale#python#UvPresent(a:buffer) return 'uv' endif if !s:UsingModule(a:buffer) return ale#python#FindExecutable(a:buffer, 'python_flakehell', ['flakehell']) endif return ale#Var(a:buffer, 'python_flakehell_executable') endfunction function! ale_linters#python#flakehell#RunWithVersionCheck(buffer) abort let l:executable = ale_linters#python#flakehell#GetExecutable(a:buffer) let l:module_string = s:UsingModule(a:buffer) ? ' -m flakehell' : '' let l:command = ale#Escape(l:executable) . l:module_string . ' --version' return ale#semver#RunWithVersionCheck( \ a:buffer, \ l:executable, \ l:command, \ function('ale_linters#python#flakehell#GetCommand'), \) endfunction function! ale_linters#python#flakehell#GetCwd(buffer) abort let l:change_directory = ale#Var(a:buffer, 'python_flakehell_change_directory') let l:cwd = '' if l:change_directory is# 'project' let l:project_root = ale#python#FindProjectRootIni(a:buffer) if !empty(l:project_root) let l:cwd = l:project_root endif endif if (l:change_directory is# 'project' && empty(l:cwd)) \|| l:change_directory is# 1 \|| l:change_directory is# 'file' let l:cwd = '%s:h' endif return l:cwd endfunction function! ale_linters#python#flakehell#GetCommand(buffer, version) abort let l:executable = ale_linters#python#flakehell#GetExecutable(a:buffer) if (l:executable =~? '\(pipenv\|poetry\|uv\)$') let l:exec_args = ' run flakehell' elseif (l:executable is? 'python') let l:exec_args = ' -m flakehell' else let l:exec_args = '' endif " Only include the --stdin-display-name argument if we can parse the " flakehell version, and it is recent enough to support it. let l:display_name_args = ale#semver#GTE(a:version, [0, 8, 0]) \ ? ' --stdin-display-name %s' \ : '' let l:options = ale#Var(a:buffer, 'python_flakehell_options') return ale#Escape(l:executable) \ . l:exec_args \ . (!empty(l:options) ? ' lint ' . l:options : ' lint') \ . ' --format=default' \ . l:display_name_args . ' -' endfunction let s:end_col_pattern_map = { \ 'F405': '\(.\+\) may be undefined', \ 'F821': 'undefined name ''\([^'']\+\)''', \ 'F999': '^''\([^'']\+\)''', \ 'F841': 'local variable ''\([^'']\+\)''', \} function! ale_linters#python#flakehell#Handle(buffer, lines) abort let l:output = ale#python#HandleTraceback(a:lines, 10) if !empty(l:output) return l:output endif " Matches patterns line the following: " " Matches patterns line the following: " " stdin:6:6: E111 indentation is not a multiple of four let l:pattern = '\v^[a-zA-Z]?:?[^:]+:(\d+):?(\d+)?: ([[:alnum:]]+):? (.*)$' for l:match in ale#util#GetMatches(a:lines, l:pattern) let l:code = l:match[3] if (l:code is# 'W291' || l: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: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 let l:item = { \ 'lnum': l:match[1] + 0, \ 'col': l:match[2] + 0, \ 'vcol': 1, \ 'text': l:match[4], \ 'code': l:code, \ 'type': 'W', \} if l:code[:0] is# 'F' if l:code isnot# 'F401' let l:item.type = 'E' endif elseif l:code[:0] is# 'E' let l:item.type = 'E' if l:code isnot# 'E999' && l:code isnot# 'E112' let l:item.sub_type = 'style' endif elseif l:code[:0] is# 'W' let l:item.sub_type = 'style' endif let l:end_col_pattern = get(s:end_col_pattern_map, l:code, '') if !empty(l:end_col_pattern) let l:end_col_match = matchlist(l:match[4], l:end_col_pattern) if !empty(l:end_col_match) let l:item.end_col = l:item.col + len(l:end_col_match[1]) - 1 endif endif call add(l:output, l:item) endfor return l:output endfunction call ale#linter#Define('python', { \ 'name': 'flakehell', \ 'executable': function('ale_linters#python#flakehell#GetExecutable'), \ 'cwd': function('ale_linters#python#flakehell#GetCwd'), \ 'command': function('ale_linters#python#flakehell#RunWithVersionCheck'), \ 'callback': 'ale_linters#python#flakehell#Handle', \}) ale-4.0.0/ale_linters/python/jedils.vim000066400000000000000000000036621476501472200201040ustar00rootroot00000000000000" Author: Dalius Dobravolskas " Description: https://github.com/pappasam/jedi-language-server call ale#Set('python_jedils_executable', 'jedi-language-server') call ale#Set('python_jedils_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('python_jedils_auto_pipenv', 0) call ale#Set('python_jedils_auto_poetry', 0) call ale#Set('python_jedils_auto_uv', 0) function! ale_linters#python#jedils#GetExecutable(buffer) abort if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_jedils_auto_pipenv')) \ && ale#python#PipenvPresent(a:buffer) return 'pipenv' endif if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_jedils_auto_poetry')) \ && ale#python#PoetryPresent(a:buffer) return 'poetry' endif if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_jedils_auto_uv')) \ && ale#python#UvPresent(a:buffer) return 'uv' endif return ale#python#FindExecutable(a:buffer, 'python_jedils', ['jedi-language-server']) endfunction function! ale_linters#python#jedils#GetCommand(buffer) abort let l:executable = ale_linters#python#jedils#GetExecutable(a:buffer) let l:exec_args = l:executable =~? '\(pipenv\|poetry\|uv\)$' \ ? ' run jedi-language-server' \ : '' let l:env_string = '' if ale#Var(a:buffer, 'python_auto_virtualenv') let l:env_string = ale#python#AutoVirtualenvEnvString(a:buffer) endif return l:env_string . ale#Escape(l:executable) . l:exec_args endfunction call ale#linter#Define('python', { \ 'name': 'jedils', \ 'aliases': ['jedi_language_server'], \ 'lsp': 'stdio', \ 'executable': function('ale_linters#python#jedils#GetExecutable'), \ 'command': function('ale_linters#python#jedils#GetCommand'), \ 'project_root': function('ale#python#FindProjectRoot'), \ 'completion_filter': 'ale#completion#python#CompletionItemFilter', \}) ale-4.0.0/ale_linters/python/mypy.vim000066400000000000000000000072711476501472200176300ustar00rootroot00000000000000" Author: Keith Smiley , w0rp " Description: mypy support for optional python typechecking call ale#Set('python_mypy_executable', 'mypy') call ale#Set('python_mypy_ignore_invalid_syntax', 0) call ale#Set('python_mypy_show_notes', 1) call ale#Set('python_mypy_options', '') call ale#Set('python_mypy_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('python_mypy_auto_pipenv', 0) call ale#Set('python_mypy_auto_poetry', 0) call ale#Set('python_mypy_auto_uv', 0) function! ale_linters#python#mypy#GetExecutable(buffer) abort if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_mypy_auto_pipenv')) \ && ale#python#PipenvPresent(a:buffer) return 'pipenv' endif if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_mypy_auto_poetry')) \ && ale#python#PoetryPresent(a:buffer) return 'poetry' endif if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_mypy_auto_uv')) \ && ale#python#UvPresent(a:buffer) return 'uv' endif return ale#python#FindExecutable(a:buffer, 'python_mypy', ['mypy']) endfunction " The directory to change to before running mypy function! ale_linters#python#mypy#GetCwd(buffer) abort " If we find a directory with "mypy.ini" in it use that, " else try and find the "python project" root, or failing " that, run from the same folder as the current file for l:path in ale#path#Upwards(expand('#' . a:buffer . ':p:h')) if filereadable(l:path . '/mypy.ini') return l:path endif endfor let l:project_root = ale#python#FindProjectRoot(a:buffer) return !empty(l:project_root) \ ? l:project_root \ : expand('#' . a:buffer . ':p:h') endfunction function! ale_linters#python#mypy#GetCommand(buffer) abort let l:executable = ale_linters#python#mypy#GetExecutable(a:buffer) let l:exec_args = l:executable =~? '\(pipenv\|poetry\|uv\)$' \ ? ' run mypy' \ : '' return '%e' . l:exec_args \ . ale#Pad(ale#Var(a:buffer, 'python_mypy_options')) \ . ' --show-column-numbers' \ . ' --shadow-file %s %t %s' endfunction function! ale_linters#python#mypy#Handle(buffer, lines) abort let l:dir = ale_linters#python#mypy#GetCwd(a:buffer) " Look for lines like the following: " " file.py:4: error: No library stub file for module 'django.db' " " Lines like these should be ignored below: " " file.py:4: note: (Stub files are from https://github.com/python/typeshed) let l:types = 'error|warning' if ale#Var(a:buffer, 'python_mypy_show_notes') let l:types = 'error|warning|note' endif let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):?(\d+)?: (' \ . l:types \ . '): (.+)$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) " Skip invalid syntax errors if the option is on. if l:match[5] is# 'invalid syntax' \&& ale#Var(a:buffer, 'python_mypy_ignore_invalid_syntax') continue endif call add(l:output, { \ 'filename': ale#path#GetAbsPath(l:dir, l:match[1]), \ 'lnum': l:match[2] + 0, \ 'col': l:match[3] + 0, \ 'type': l:match[4] is# 'error' ? 'E' : (l:match[4] is# 'note' ? 'I': 'W'), \ 'text': l:match[5], \}) endfor return l:output endfunction call ale#linter#Define('python', { \ 'name': 'mypy', \ 'executable': function('ale_linters#python#mypy#GetExecutable'), \ 'cwd': function('ale_linters#python#mypy#GetCwd'), \ 'command': function('ale_linters#python#mypy#GetCommand'), \ 'callback': 'ale_linters#python#mypy#Handle', \ 'output_stream': 'both' \}) ale-4.0.0/ale_linters/python/prospector.vim000066400000000000000000000072721476501472200210330ustar00rootroot00000000000000" Author: chocoelho " Description: prospector linter python files call ale#Set('python_prospector_auto_pipenv', 0) call ale#Set('python_prospector_auto_poetry', 0) call ale#Set('python_prospector_auto_uv', 0) let g:ale_python_prospector_executable = \ get(g:, 'ale_python_prospector_executable', 'prospector') let g:ale_python_prospector_options = \ get(g:, 'ale_python_prospector_options', '') let g:ale_python_prospector_use_global = get(g:, 'ale_python_prospector_use_global', get(g:, 'ale_use_global_executables', 0)) function! ale_linters#python#prospector#GetExecutable(buffer) abort if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_prospector_auto_pipenv')) \ && ale#python#PipenvPresent(a:buffer) return 'pipenv' endif if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_prospector_auto_poetry')) \ && ale#python#PoetryPresent(a:buffer) return 'poetry' endif if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_prospector_auto_uv')) \ && ale#python#UvPresent(a:buffer) return 'uv' endif return ale#python#FindExecutable(a:buffer, 'python_prospector', ['prospector']) endfunction function! ale_linters#python#prospector#GetCommand(buffer) abort let l:executable = ale_linters#python#prospector#GetExecutable(a:buffer) let l:exec_args = l:executable =~? '\(pipenv\|poetry\|uv\)$' \ ? ' run prospector' \ : '' return ale#Escape(l:executable) \ . l:exec_args \ . ' ' . ale#Var(a:buffer, 'python_prospector_options') \ . ' --messages-only --absolute-paths --zero-exit --output-format json' \ . ' %s' endfunction function! ale_linters#python#prospector#Handle(buffer, lines) abort let l:output = [] if empty(a:lines) return [] endif let l:prospector_error = json_decode(join(a:lines, '')) for l:error in l:prospector_error.messages if (l:error.code is# 'W291' || l:error.code is# 'W293' || l:error.code is# 'trailing-whitespace') \ && !ale#Var(a:buffer, 'warn_about_trailing_whitespace') " Skip warnings for trailing whitespace if the option is off. continue endif if l:error.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 if l:error.source =~# '\v\[%(dodgy|mccabe|pep8|pep257|pyroma)\]$' let l:sub_type = 'style' else let l:sub_type = '' endif if l:error.source =~# '\v\[pylint\]$' let l:type = l:error.code =~? '\m^[CRW]' ? 'W' : 'E' elseif l:error.source =~# '\v\[%(frosted|pep8)\]$' let l:type = l:error.code =~? '\m^W' ? 'W' : 'E' elseif l:error.source =~# '\v\[%(dodgy|pyroma|vulture)\]$' let l:type = 'W' else let l:type = 'E' endif let l:item = { \ 'lnum': l:error.location.line, \ 'col': l:error.location.character + 1, \ 'text': l:error.message, \ 'code': printf('(%s) %s', l:error.source, l:error.code), \ 'type': l:type, \ 'sub_type': l:sub_type, \} if l:sub_type is# '' unlet l:item.sub_type endif call add(l:output, l:item) endfor return l:output endfunction call ale#linter#Define('python', { \ 'name': 'prospector', \ 'executable': function('ale_linters#python#prospector#GetExecutable'), \ 'command': function('ale_linters#python#prospector#GetCommand'), \ 'callback': 'ale_linters#python#prospector#Handle', \ 'lint_file': 1, \}) ale-4.0.0/ale_linters/python/pycln.vim000066400000000000000000000064071476501472200177570ustar00rootroot00000000000000" Author: Yining " Description: pycln as linter for python files call ale#Set('python_pycln_executable', 'pycln') call ale#Set('python_pycln_options', '') call ale#Set('python_pycln_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('python_pycln_change_directory', 1) call ale#Set('python_pycln_auto_pipenv', 0) call ale#Set('python_pycln_auto_poetry', 0) call ale#Set('python_pycln_auto_uv', 0) call ale#Set('python_pycln_config_file', '') function! ale_linters#python#pycln#GetExecutable(buffer) abort if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pycln_auto_pipenv')) \ && ale#python#PipenvPresent(a:buffer) return 'pipenv' endif if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_pycln_auto_poetry')) \ && ale#python#PoetryPresent(a:buffer) return 'poetry' endif if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_pycln_auto_uv')) \ && ale#python#UvPresent(a:buffer) return 'uv' endif return ale#python#FindExecutable(a:buffer, 'python_pycln', ['pycln']) endfunction function! ale_linters#python#pycln#GetCwd(buffer) abort if ale#Var(a:buffer, 'python_pycln_change_directory') " Run from project root if found, else from buffer dir. let l:project_root = ale#python#FindProjectRoot(a:buffer) return !empty(l:project_root) ? l:project_root : '%s:h' endif return '' endfunction function! ale_linters#python#pycln#GetCommand(buffer, version) abort let l:executable = ale_linters#python#pycln#GetExecutable(a:buffer) let l:exec_args = l:executable =~? '\(pipenv\|poetry\|uv\)$' \ ? ' run pycln' \ : '' let l:options = ale#Var(a:buffer, 'python_pycln_options') let l:config_file = ale#Var(a:buffer, 'python_pycln_config_file') let l:config_file = l:options !~# '\v(^| )--config ' && !empty(l:config_file) \ ? ale#Escape(ale#path#Simplify(l:config_file)) \ : '' " NOTE: pycln version `1.3.0` supports liniting input from stdin return ale#Escape(l:executable) . l:exec_args \ . ale#Pad(ale#Var(a:buffer, 'python_pycln_options')) \ . (empty(l:config_file) ? '' : ' --config ' . l:config_file) \ . ' --check' \ . (ale#semver#GTE(a:version, [1, 3, 0]) ? ' -' : ' %s') endfunction function! ale_linters#python#pycln#Handle(buffer, lines) abort " Example: tmp/test.py:3:0 'import os' would be removed! let l:pattern = '\v^[a-zA-Z]?:?[^:]+:(\d+):(\d+):? (.+)$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) call add(l:output, { \ 'lnum': l:match[1] + 0, \ 'col': l:match[2] + 0, \ 'text': l:match[3], \}) endfor return l:output endfunction call ale#linter#Define('python', { \ 'name': 'pycln', \ 'executable': function('ale_linters#python#pycln#GetExecutable'), \ 'cwd': function('ale_linters#python#pycln#GetCwd'), \ 'command': {buffer -> ale#semver#RunWithVersionCheck( \ buffer, \ ale_linters#python#pycln#GetExecutable(buffer), \ '%e --version', \ function('ale_linters#python#pycln#GetCommand'), \ )}, \ 'callback': 'ale_linters#python#pycln#Handle', \ 'output_stream': 'both', \ 'read_buffer': 1, \}) ale-4.0.0/ale_linters/python/pycodestyle.vim000066400000000000000000000057201476501472200211730ustar00rootroot00000000000000" Author: Michael Thiesen " Description: pycodestyle linting for python files call ale#Set('python_pycodestyle_executable', 'pycodestyle') call ale#Set('python_pycodestyle_options', '') call ale#Set('python_pycodestyle_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('python_pycodestyle_auto_pipenv', 0) call ale#Set('python_pycodestyle_auto_poetry', 0) call ale#Set('python_pycodestyle_auto_uv', 0) function! ale_linters#python#pycodestyle#GetExecutable(buffer) abort if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pycodestyle_auto_pipenv')) \ && ale#python#PipenvPresent(a:buffer) return 'pipenv' endif if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_pycodestyle_auto_poetry')) \ && ale#python#PoetryPresent(a:buffer) return 'poetry' endif if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_pycodestyle_auto_uv')) \ && ale#python#UvPresent(a:buffer) return 'uv' endif return ale#python#FindExecutable(a:buffer, 'python_pycodestyle', ['pycodestyle']) endfunction function! ale_linters#python#pycodestyle#GetCommand(buffer) abort let l:executable = ale_linters#python#pycodestyle#GetExecutable(a:buffer) let l:exec_args = l:executable =~? '\(pipenv\|poetry\|uv\)$' \ ? ' run pycodestyle' \ : '' return ale#Escape(l:executable) . l:exec_args \ . ' ' \ . ale#Var(a:buffer, 'python_pycodestyle_options') \ . ' -' endfunction function! ale_linters#python#pycodestyle#Handle(buffer, lines) abort let l:pattern = '\v^(\S*):(\d*):(\d*): ([EW]\d+) (.*)$' let l:output = [] " lines are formatted as follows: " file.py:21:26: W291 trailing whitespace for l:match in ale#util#GetMatches(a:lines, l:pattern) if(l:match[4] is# 'W291' || l:match[4] is# 'W293') \&& !ale#Var(a:buffer, 'warn_about_trailing_whitespace') " Skip warnings for trailing whitespace if the option is off. continue endif if l:match[4] is# 'W391' \&& !ale#Var(a:buffer, 'warn_about_trailing_blank_lines') " Skip warnings for trailing blank lines if the option is off continue endif let l:item = { \ 'lnum': l:match[2] + 0, \ 'col': l:match[3] + 0, \ 'type': l:match[4][0], \ 'sub_type': 'style', \ 'text': l:match[5], \ 'code': l:match[4], \} " E999 and E112 are syntax errors. if l:match[4] is# 'E999' || l:match[4] is# 'E112' unlet l:item.sub_type endif call add(l:output, l:item) endfor return l:output endfunction call ale#linter#Define('python', { \ 'name': 'pycodestyle', \ 'executable': function('ale_linters#python#pycodestyle#GetExecutable'), \ 'command': function('ale_linters#python#pycodestyle#GetCommand'), \ 'callback': 'ale_linters#python#pycodestyle#Handle', \}) ale-4.0.0/ale_linters/python/pydocstyle.vim000066400000000000000000000054401476501472200210250ustar00rootroot00000000000000" Author: Pablo Acosta " Description: pydocstyle for python files call ale#Set('python_pydocstyle_executable', 'pydocstyle') call ale#Set('python_pydocstyle_options', '') call ale#Set('python_pydocstyle_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('python_pydocstyle_auto_pipenv', 0) call ale#Set('python_pydocstyle_auto_poetry', 0) call ale#Set('python_pydocstyle_auto_uv', 0) function! ale_linters#python#pydocstyle#GetExecutable(buffer) abort if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pydocstyle_auto_pipenv')) \ && ale#python#PipenvPresent(a:buffer) return 'pipenv' endif if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_pydocstyle_auto_poetry')) \ && ale#python#PoetryPresent(a:buffer) return 'poetry' endif if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_pydocstyle_auto_uv')) \ && ale#python#UvPresent(a:buffer) return 'uv' endif return ale#python#FindExecutable(a:buffer, 'python_pydocstyle', ['pydocstyle']) endfunction function! ale_linters#python#pydocstyle#GetCommand(buffer) abort let l:executable = ale_linters#python#pydocstyle#GetExecutable(a:buffer) let l:exec_args = l:executable =~? '\(pipenv\|poetry\|uv\)$' \ ? ' run pydocstyle' \ : '' return ale#Escape(l:executable) . l:exec_args \ . ale#Pad(ale#Var(a:buffer, 'python_pydocstyle_options')) \ . ' %s' endfunction function! ale_linters#python#pydocstyle#Handle(buffer, lines) abort " Matches patterns like the following: " mydir/myfile.py:33 in public function `myfunction`: " DXXX: Error description let l:line1_pattern = '\v^.*:\s*(\d+)\s+.*$' let l:line2_pattern = '\v^.*([a-zA-Z]\d+):\s*(.*)$' let l:output = [] let l:num_lines = len(a:lines) let l:index = 0 while l:index < l:num_lines let l:lnum = matchlist(a:lines[l:index], l:line1_pattern) if !empty(l:lnum) && (l:index + 1 < l:num_lines) let l:desc = matchlist(a:lines[l:index + 1], l:line2_pattern) if !empty(l:desc) call add(l:output, { \ 'lnum': l:lnum[1] + 0, \ 'col': 1, \ 'type': 'W', \ 'text': l:desc[2], \ 'code': l:desc[1], \}) endif let l:index = l:index + 2 else let l:index = l:index + 1 endif endwhile return l:output endfunction call ale#linter#Define('python', { \ 'name': 'pydocstyle', \ 'executable': function('ale_linters#python#pydocstyle#GetExecutable'), \ 'cwd': '%s:h', \ 'command': function('ale_linters#python#pydocstyle#GetCommand'), \ 'callback': 'ale_linters#python#pydocstyle#Handle', \}) ale-4.0.0/ale_linters/python/pyflakes.vim000066400000000000000000000040071476501472200204420ustar00rootroot00000000000000" Author: w0rp " Description: pyflakes for python files call ale#Set('python_pyflakes_executable', 'pyflakes') call ale#Set('python_pyflakes_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('python_pyflakes_auto_pipenv', 0) call ale#Set('python_pyflakes_auto_poetry', 0) call ale#Set('python_pyflakes_auto_uv', 0) function! ale_linters#python#pyflakes#GetExecutable(buffer) abort if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pyflakes_auto_pipenv')) \ && ale#python#PipenvPresent(a:buffer) return 'pipenv' endif if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_pyflakes_auto_poetry')) \ && ale#python#PoetryPresent(a:buffer) return 'poetry' endif if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_pyflakes_auto_uv')) \ && ale#python#UvPresent(a:buffer) return 'uv' endif return ale#python#FindExecutable(a:buffer, 'python_pyflakes', ['pyflakes']) endfunction function! ale_linters#python#pyflakes#GetCommand(buffer) abort let l:executable = ale_linters#python#pyflakes#GetExecutable(a:buffer) let l:exec_args = l:executable =~? '\(pipenv\|poetry\|uv\)$' \ ? ' run pyflakes' \ : '' return ale#Escape(l:executable) \ . l:exec_args \ . ' %t' endfunction function! ale_linters#python#pyflakes#Handle(buffer, lines) abort let l:pattern = '\v^[a-zA-Z]?:?[^:]+:(\d+):(\d+)?:? (.+)$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) call add(l:output, { \ 'lnum': l:match[1] + 0, \ 'col': l:match[2] + 0, \ 'text': l:match[3], \}) endfor return l:output endfunction call ale#linter#Define('python', { \ 'name': 'pyflakes', \ 'executable': function('ale_linters#python#pyflakes#GetExecutable'), \ 'command': function('ale_linters#python#pyflakes#GetCommand'), \ 'callback': 'ale_linters#python#pyflakes#Handle', \ 'output_stream': 'both', \}) ale-4.0.0/ale_linters/python/pylama.vim000066400000000000000000000125601476501472200201120ustar00rootroot00000000000000" Author: Kevin Locke " Description: pylama for python files call ale#Set('python_pylama_executable', 'pylama') call ale#Set('python_pylama_options', '') call ale#Set('python_pylama_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('python_pylama_auto_pipenv', 0) call ale#Set('python_pylama_auto_poetry', 0) call ale#Set('python_pylama_auto_uv', 0) call ale#Set('python_pylama_change_directory', 1) function! ale_linters#python#pylama#GetExecutable(buffer) abort if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pylama_auto_pipenv')) \ && ale#python#PipenvPresent(a:buffer) return 'pipenv' endif if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_pylama_auto_poetry')) \ && ale#python#PoetryPresent(a:buffer) return 'poetry' endif if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_pylama_auto_uv')) \ && ale#python#UvPresent(a:buffer) return 'uv' endif return ale#python#FindExecutable(a:buffer, 'python_pylama', ['pylama']) endfunction function! ale_linters#python#pylama#RunWithVersionCheck(buffer) abort let l:executable = ale_linters#python#pylama#GetExecutable(a:buffer) let l:exec_args = l:executable =~? '\(pipenv\|poetry\|uv\)$' \ ? ' run pylama' \ : '' let l:command = ale#Escape(l:executable) . l:exec_args . ' --version' return ale#semver#RunWithVersionCheck( \ a:buffer, \ l:executable, \ l:command, \ function('ale_linters#python#pylama#GetCommand'), \) endfunction function! ale_linters#python#pylama#GetCwd(buffer) abort if ale#Var(a:buffer, 'python_pylama_change_directory') " Pylama loads its configuration from the current directory only, and " applies file masks using paths relative to the current directory. " Run from project root, if found, otherwise buffer dir. let l:project_root = ale#python#FindProjectRoot(a:buffer) return !empty(l:project_root) ? l:project_root : '%s:h' endif return '' endfunction function! ale_linters#python#pylama#GetCommand(buffer, version) abort let l:executable = ale_linters#python#pylama#GetExecutable(a:buffer) let l:exec_args = l:executable =~? '\(pipenv\|poetry\|uv\)$' \ ? ' run pylama' \ : '' " json format is added in version 8.1.4 " https://github.com/klen/pylama/blob/develop/Changelog let l:format_json_args = ale#semver#GTE(a:version, [8, 1, 4]) \ ? ' --format json' \ : '' " Note: Using %t to lint changes would be preferable, but many pylama " checks use surrounding paths (e.g. C0103 module name, E0402 relative " import beyond top, etc.). Neither is ideal. return ale#Escape(l:executable) . l:exec_args \ . ale#Pad(ale#Var(a:buffer, 'python_pylama_options')) \ . l:format_json_args \ . ' %s' endfunction function! ale_linters#python#pylama#Handle(buffer, version, lines) abort if empty(a:lines) return [] endif let l:output = ale#python#HandleTraceback(a:lines, 1) " First letter of error code is a pylint-compatible message type " http://pylint.pycqa.org/en/latest/user_guide/output.html#source-code-analysis-section " D is for Documentation (pydocstyle) let l:pylint_type_to_ale_type = { \ 'I': 'I', \ 'R': 'W', \ 'C': 'W', \ 'W': 'W', \ 'E': 'E', \ 'F': 'E', \ 'D': 'W', \} let l:pylint_type_to_ale_sub_type = { \ 'R': 'style', \ 'C': 'style', \ 'D': 'style', \} if ale#semver#GTE(a:version, [8, 1, 4]) try let l:errors = json_decode(join(a:lines, '')) catch return l:output endtry if empty(l:errors) return l:output endif for l:error in l:errors call add(l:output, { \ 'lnum': l:error['lnum'], \ 'col': l:error['col'], \ 'code': l:error['number'], \ 'type': get(l:pylint_type_to_ale_type, l:error['etype'], 'W'), \ 'sub_type': get(l:pylint_type_to_ale_sub_type, l:error['etype'], ''), \ 'text': printf('%s [%s]', l:error['message'], l:error['source']), \}) endfor else let l:pattern = '\v^.{-}:([0-9]+):([0-9]+): +%(([A-Z][0-9]+):? +)?(.*)$' for l:match in ale#util#GetMatches(a:lines, l:pattern) call add(l:output, { \ 'lnum': str2nr(l:match[1]), \ 'col': str2nr(l:match[2]), \ 'code': l:match[3], \ 'type': get(l:pylint_type_to_ale_type, l:match[3][0], 'W'), \ 'sub_type': get(l:pylint_type_to_ale_sub_type, l:match[3][0], ''), \ 'text': l:match[4], \}) endfor endif return l:output endfunction call ale#linter#Define('python', { \ 'name': 'pylama', \ 'executable': function('ale_linters#python#pylama#GetExecutable'), \ 'cwd': function('ale_linters#python#pylama#GetCwd'), \ 'command': function('ale_linters#python#pylama#RunWithVersionCheck'), \ 'callback': {buffer, lines -> ale#semver#RunWithVersionCheck( \ buffer, \ ale_linters#python#pylama#GetExecutable(buffer), \ '%e --version', \ {buffer, version -> ale_linters#python#pylama#Handle( \ buffer, \ l:version, \ lines)}, \ )}, \ 'lint_file': 1, \}) ale-4.0.0/ale_linters/python/pylint.vim000066400000000000000000000102311476501472200201370ustar00rootroot00000000000000" Author: keith " Description: pylint for python files call ale#Set('python_pylint_executable', 'pylint') call ale#Set('python_pylint_options', '') call ale#Set('python_pylint_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('python_pylint_change_directory', 1) call ale#Set('python_pylint_auto_pipenv', 0) call ale#Set('python_pylint_auto_poetry', 0) call ale#Set('python_pylint_auto_uv', 0) call ale#Set('python_pylint_use_msg_id', 0) function! ale_linters#python#pylint#GetExecutable(buffer) abort if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pylint_auto_pipenv')) \ && ale#python#PipenvPresent(a:buffer) return 'pipenv' endif if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_pylint_auto_poetry')) \ && ale#python#PoetryPresent(a:buffer) return 'poetry' endif if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_pylint_auto_uv')) \ && ale#python#UvPresent(a:buffer) return 'uv' endif return ale#python#FindExecutable(a:buffer, 'python_pylint', ['pylint']) endfunction function! ale_linters#python#pylint#GetCwd(buffer) abort if ale#Var(a:buffer, 'python_pylint_change_directory') " pylint only checks for pylintrc in the packages above its current " directory before falling back to user and global pylintrc. " Run from project root, if found, otherwise buffer dir. let l:project_root = ale#python#FindProjectRoot(a:buffer) return !empty(l:project_root) ? l:project_root : '%s:h' endif return '' endfunction function! ale_linters#python#pylint#GetCommand(buffer, version) abort let l:executable = ale_linters#python#pylint#GetExecutable(a:buffer) let l:exec_args = l:executable =~? '\(pipenv\|poetry\|uv\)$' \ ? ' run pylint' \ : '' return ale#Escape(l:executable) . l:exec_args \ . ale#Pad(ale#Var(a:buffer, 'python_pylint_options')) \ . ' --output-format text --msg-template="{path}:{line}:{column}: {msg_id} ({symbol}) {msg}" --reports n' \ . (ale#semver#GTE(a:version, [2, 4, 0]) ? ' --from-stdin' : '') \ . ' %s' endfunction function! ale_linters#python#pylint#Handle(buffer, lines) abort let l:output = ale#python#HandleTraceback(a:lines, 10) if !empty(l:output) return l:output endif " Matches patterns like the following: " " test.py:4:4: W0101 (unreachable) Unreachable code let l:pattern = '\v^[a-zA-Z]?:?[^:]+:(\d+):(\d+): ([[:alnum:]]+) \(([^(]*)\) (.*)$' for l:match in ale#util#GetMatches(a:lines, l:pattern) "let l:failed = append(0, l:match) let l:code = l:match[3] if (l:code is# 'C0303') \ && !ale#Var(a:buffer, 'warn_about_trailing_whitespace') " Skip warnings for trailing whitespace if the option is off. continue endif if l:code is# 'I0011' " Skip 'Locally disabling' message continue endif if ale#Var(a:buffer, 'python_pylint_use_msg_id') is# 1 let l:code_out = l:code else let l:code_out = l:match[4] endif let l:item = { \ 'lnum': l:match[1] + 0, \ 'col': l:match[2] + 1, \ 'text': l:match[5], \ 'code': l:code_out, \ 'type': 'W', \} if l:code[:0] is# 'E' let l:item.type = 'E' endif call add(l:output, l:item) endfor return l:output endfunction call ale#linter#Define('python', { \ 'name': 'pylint', \ 'executable': function('ale_linters#python#pylint#GetExecutable'), \ 'lint_file': {buffer -> ale#semver#RunWithVersionCheck( \ buffer, \ ale#Var(buffer, 'python_pylint_executable'), \ '%e --version', \ {buffer, version -> !ale#semver#GTE(version, [2, 4, 0])}, \ )}, \ 'cwd': function('ale_linters#python#pylint#GetCwd'), \ 'command': {buffer -> ale#semver#RunWithVersionCheck( \ buffer, \ ale#Var(buffer, 'python_pylint_executable'), \ '%e --version', \ function('ale_linters#python#pylint#GetCommand'), \ )}, \ 'callback': 'ale_linters#python#pylint#Handle', \}) ale-4.0.0/ale_linters/python/pylsp.vim000066400000000000000000000047771476501472200200110ustar00rootroot00000000000000" Author: aurieh " Description: A language server for Python call ale#Set('python_pylsp_executable', 'pylsp') call ale#Set('python_pylsp_options', '') call ale#Set('python_pylsp_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('python_pylsp_auto_pipenv', 0) call ale#Set('python_pylsp_auto_poetry', 0) call ale#Set('python_pylsp_auto_uv', 0) call ale#Set('python_pylsp_config', {}) function! ale_linters#python#pylsp#GetExecutable(buffer) abort if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pylsp_auto_pipenv')) \ && ale#python#PipenvPresent(a:buffer) return 'pipenv' endif if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_pylsp_auto_poetry')) \ && ale#python#PoetryPresent(a:buffer) return 'poetry' endif if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_pylsp_auto_uv')) \ && ale#python#UvPresent(a:buffer) return 'uv' endif return ale#python#FindExecutable(a:buffer, 'python_pylsp', ['pylsp']) endfunction " Force the cwd of the server to be the same as the project root to " fix issues with treating local files matching first or third party library " names being imported incorrectly. function! ale_linters#python#pylsp#GetCwd(buffer) abort let l:fake_linter = { \ 'name': 'pylsp', \ 'project_root': function('ale#python#FindProjectRoot'), \} let l:root = ale#lsp_linter#FindProjectRoot(a:buffer, l:fake_linter) return !empty(l:root) ? l:root : v:null endfunction function! ale_linters#python#pylsp#GetCommand(buffer) abort let l:executable = ale_linters#python#pylsp#GetExecutable(a:buffer) let l:exec_args = l:executable =~? '\(pipenv\|poetry\|uv\)$' \ ? ' run pylsp' \ : '' let l:env_string = '' if ale#Var(a:buffer, 'python_auto_virtualenv') let l:env_string = ale#python#AutoVirtualenvEnvString(a:buffer) endif return l:env_string . ale#Escape(l:executable) . l:exec_args . ale#Pad(ale#Var(a:buffer, 'python_pylsp_options')) endfunction call ale#linter#Define('python', { \ 'name': 'pylsp', \ 'lsp': 'stdio', \ 'executable': function('ale_linters#python#pylsp#GetExecutable'), \ 'cwd': function('ale_linters#python#pylsp#GetCwd'), \ 'command': function('ale_linters#python#pylsp#GetCommand'), \ 'project_root': function('ale#python#FindProjectRoot'), \ 'completion_filter': 'ale#completion#python#CompletionItemFilter', \ 'lsp_config': {b -> ale#Var(b, 'python_pylsp_config')}, \}) ale-4.0.0/ale_linters/python/pyre.vim000066400000000000000000000036271476501472200176120ustar00rootroot00000000000000" Author: dsifford " Description: A performant type-checker supporting LSP for Python 3 created by Facebook call ale#Set('python_pyre_executable', 'pyre') call ale#Set('python_pyre_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('python_pyre_auto_pipenv', 0) call ale#Set('python_pyre_auto_poetry', 0) call ale#Set('python_pyre_auto_uv', 0) function! ale_linters#python#pyre#GetExecutable(buffer) abort if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pyre_auto_pipenv')) \ && ale#python#PipenvPresent(a:buffer) return 'pipenv' endif if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_pyre_auto_poetry')) \ && ale#python#PoetryPresent(a:buffer) return 'poetry' endif if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_pyre_auto_uv')) \ && ale#python#UvPresent(a:buffer) return 'uv' endif return ale#python#FindExecutable(a:buffer, 'python_pyre', ['pyre']) endfunction function! ale_linters#python#pyre#GetCommand(buffer) abort let l:executable = ale_linters#python#pyre#GetExecutable(a:buffer) let l:exec_args = (l:executable =~? '\(pipenv\|poetry\|uv\)$' ? ' run pyre' : '') . ' persistent' return ale#Escape(l:executable) . l:exec_args endfunction function! ale_linters#python#pyre#GetCwd(buffer) abort let l:local_config = ale#path#FindNearestFile(a:buffer, '.pyre_configuration.local') return fnamemodify(l:local_config, ':h') endfunction call ale#linter#Define('python', { \ 'name': 'pyre', \ 'lsp': 'stdio', \ 'executable': function('ale_linters#python#pyre#GetExecutable'), \ 'command': function('ale_linters#python#pyre#GetCommand'), \ 'project_root': function('ale#python#FindProjectRoot'), \ 'completion_filter': 'ale#completion#python#CompletionItemFilter', \ 'cwd': function('ale_linters#python#pyre#GetCwd'), \}) ale-4.0.0/ale_linters/python/pyright.vim000066400000000000000000000066611476501472200203220ustar00rootroot00000000000000call ale#Set('python_pyright_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('python_pyright_executable', 'pyright-langserver') call ale#Set('python_pyright_config', {}) call ale#Set('python_pyright_auto_pipenv', 0) call ale#Set('python_pyright_auto_poetry', 0) call ale#Set('python_pyright_auto_uv', 0) " Force the cwd of the server to be the same as the project root to " fix issues with treating local files matching first or third party library " names being imported incorrectly. function! ale_linters#python#pyright#GetCwd(buffer) abort let l:fake_linter = { \ 'name': 'pyright', \ 'project_root': function('ale#python#FindProjectRoot'), \} let l:root = ale#lsp_linter#FindProjectRoot(a:buffer, l:fake_linter) return !empty(l:root) ? l:root : v:null endfunction function! ale_linters#python#pyright#GetConfig(buffer) abort let l:config = deepcopy(ale#Var(a:buffer, 'python_pyright_config')) if !has_key(l:config, 'python') let l:config.python = {} endif if type(l:config.python) is v:t_dict " Automatically detect the virtualenv path and use it. if !has_key(l:config.python, 'venvPath') let l:venv = ale#python#FindVirtualenv(a:buffer) if !empty(l:venv) let l:config.python.venvPath = l:venv endif endif " Automatically use the version of Python in virtualenv. if type(get(l:config.python, 'venvPath')) is v:t_string \&& !empty(l:config.python.venvPath) \&& !has_key(l:config.python, 'pythonPath') let l:config.python.pythonPath = ale#path#Simplify( \ l:config.python.venvPath \ . (has('win32') ? '/Scripts/python' : '/bin/python') \) endif endif return l:config endfunction function! ale_linters#python#pyright#GetExecutable(buffer) abort if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pyright_auto_pipenv')) \ && ale#python#PipenvPresent(a:buffer) return 'pipenv' endif if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_pyright_auto_poetry')) \ && ale#python#PoetryPresent(a:buffer) return 'poetry' endif if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_pyright_auto_uv')) \ && ale#python#UvPresent(a:buffer) return 'uv' endif return ale#python#FindExecutable(a:buffer, 'python_pyright', ['pyright-langserver']) endfunction function! ale_linters#python#pyright#GetCommand(buffer) abort let l:executable = ale_linters#python#pyright#GetExecutable(a:buffer) let l:exec_args = l:executable =~? '\(pipenv\|poetry\|uv\)$' \ ? ' run pyright-langserver' \ : '' let l:env_string = '' if ale#Var(a:buffer, 'python_auto_virtualenv') let l:env_string = ale#python#AutoVirtualenvEnvString(a:buffer) endif return l:env_string . ale#Escape(l:executable) . l:exec_args . ' --stdio' endfunction call ale#linter#Define('python', { \ 'name': 'pyright', \ 'lsp': 'stdio', \ 'cwd': function('ale_linters#python#pyright#GetCwd'), \ 'executable': function('ale_linters#python#pyright#GetExecutable'), \ 'command': function('ale_linters#python#pyright#GetCommand'), \ 'project_root': function('ale#python#FindProjectRoot'), \ 'completion_filter': 'ale#completion#python#CompletionItemFilter', \ 'lsp_config': function('ale_linters#python#pyright#GetConfig'), \}) ale-4.0.0/ale_linters/python/refurb.vim000066400000000000000000000053251476501472200201150ustar00rootroot00000000000000" Author: Yining " Description: refurb as linter for python files call ale#Set('python_refurb_executable', 'refurb') call ale#Set('python_refurb_options', '') call ale#Set('python_refurb_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('python_refurb_change_directory', 1) call ale#Set('python_refurb_auto_pipenv', 0) call ale#Set('python_refurb_auto_poetry', 0) call ale#Set('python_refurb_auto_uv', 0) function! ale_linters#python#refurb#GetExecutable(buffer) abort if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_refurb_auto_pipenv')) \ && ale#python#PipenvPresent(a:buffer) return 'pipenv' endif if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_refurb_auto_poetry')) \ && ale#python#PoetryPresent(a:buffer) return 'poetry' endif if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_refurb_auto_uv')) \ && ale#python#UvPresent(a:buffer) return 'uv' endif return ale#python#FindExecutable(a:buffer, 'python_refurb', ['refurb']) endfunction function! ale_linters#python#refurb#GetCwd(buffer) abort if ale#Var(a:buffer, 'python_refurb_change_directory') " Run from project root if found, else from buffer dir. let l:project_root = ale#python#FindProjectRoot(a:buffer) return !empty(l:project_root) ? l:project_root : '%s:h' endif return '' endfunction function! ale_linters#python#refurb#GetCommand(buffer) abort let l:executable = ale_linters#python#refurb#GetExecutable(a:buffer) let l:exec_args = l:executable =~? '\(pipenv\|poetry\|uv\)$' \ ? ' run refurb' \ : '' return ale#Escape(l:executable) . l:exec_args \ . ale#Pad(ale#Var(a:buffer, 'python_refurb_options')) \ . ' %s' endfunction function! ale_linters#python#refurb#Handle(buffer, lines) abort "Example: path/to/file.py:3:17 [FURB109]: Replace `in [x, y, z]` with `in (x, y, z)` let l:pattern = '\v^[a-zA-Z]?:?[^:]+:(\d+):(\d+)?:?\s*\[FURB(\d+)\]:\s*(.+)$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) call add(l:output, { \ 'lnum': l:match[1] + 0, \ 'col': l:match[2] + 0, \ 'code': l:match[3] + 0, \ 'text': l:match[4], \ 'type': 'W', \}) endfor return l:output endfunction call ale#linter#Define('python', { \ 'name': 'refurb', \ 'executable': function('ale_linters#python#refurb#GetExecutable'), \ 'cwd': function('ale_linters#python#refurb#GetCwd'), \ 'command': function('ale_linters#python#refurb#GetCommand'), \ 'callback': 'ale_linters#python#refurb#Handle', \ 'output_stream': 'both', \ 'read_buffer': 0, \}) ale-4.0.0/ale_linters/python/ruff.vim000066400000000000000000000072451476501472200175750ustar00rootroot00000000000000" Author: Yining " Description: ruff as linter for python files call ale#Set('python_ruff_executable', 'ruff') call ale#Set('python_ruff_options', '') call ale#Set('python_ruff_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('python_ruff_change_directory', 1) call ale#Set('python_ruff_auto_pipenv', 0) call ale#Set('python_ruff_auto_poetry', 0) call ale#Set('python_ruff_auto_uv', 0) call ale#fix#registry#Add('ruff', \ 'ale#fixers#ruff#Fix', \ ['python'], \ 'A python linter/fixer for Python written in Rust' \) function! ale_linters#python#ruff#GetExecutable(buffer) abort if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_ruff_auto_pipenv')) \ && ale#python#PipenvPresent(a:buffer) return 'pipenv' endif if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_ruff_auto_poetry')) \ && ale#python#PoetryPresent(a:buffer) return 'poetry' endif if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_ruff_auto_uv')) \ && ale#python#UvPresent(a:buffer) return 'uv' endif return ale#python#FindExecutable(a:buffer, 'python_ruff', ['ruff']) endfunction function! ale_linters#python#ruff#GetCwd(buffer) abort if ale#Var(a:buffer, 'python_ruff_change_directory') " Run from project root if found, else from buffer dir. let l:project_root = ale#python#FindProjectRoot(a:buffer) return !empty(l:project_root) ? l:project_root : '%s:h' endif return '' endfunction function! ale_linters#python#ruff#GetCommand(buffer, version) abort let l:executable = ale_linters#python#ruff#GetExecutable(a:buffer) let l:exec_args = l:executable =~? '\(pipenv\|poetry\|uv\)$' \ ? ' run ruff' \ : '' " NOTE: ruff 0.3.0 deprecates `ruff ` in favor of `ruff check ` let l:exec_args = l:exec_args \ . (ale#semver#GTE(a:version, [0, 3, 0]) ? ' check' : '') " NOTE: ruff version `0.0.69` supports linting input from stdin " NOTE: ruff version `0.1.0` deprecates `--format text` return ale#Escape(l:executable) . l:exec_args . ' -q' \ . ' --no-fix' \ . ale#Pad(ale#Var(a:buffer, 'python_ruff_options')) \ . (ale#semver#GTE(a:version, [0, 1, 0]) ? ' --output-format json-lines' : ' --format json-lines') \ . (ale#semver#GTE(a:version, [0, 0, 69]) ? ' --stdin-filename %s -' : ' %s') endfunction function! ale_linters#python#ruff#Handle(buffer, lines) abort let l:output = [] " Read all lines of ruff output and parse use all the valid JSONL lines. for l:line in a:lines try let l:item = json_decode(l:line) catch let l:item = v:null endtry if !empty(l:item) call add(l:output, { \ 'lnum': l:item.location.row, \ 'col': l:item.location.column, \ 'end_lnum': l:item.end_location.row, \ 'end_col': l:item.end_location.column - 1, \ 'code': l:item.code, \ 'text': l:item.message, \ 'type': l:item.code =~? '\vE\d+' ? 'E' : 'W', \}) endif endfor return l:output endfunction call ale#linter#Define('python', { \ 'name': 'ruff', \ 'executable': function('ale_linters#python#ruff#GetExecutable'), \ 'cwd': function('ale_linters#python#ruff#GetCwd'), \ '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', \ 'output_stream': 'both', \ 'read_buffer': 1, \}) ale-4.0.0/ale_linters/python/unimport.vim000066400000000000000000000047671476501472200205160ustar00rootroot00000000000000" Author: Author: Jon Parise call ale#Set('python_unimport_executable', 'unimport') call ale#Set('python_unimport_options', '') call ale#Set('python_unimport_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('python_unimport_auto_pipenv', 0) call ale#Set('python_unimport_auto_poetry', 0) call ale#Set('python_unimport_auto_uv', 0) function! ale_linters#python#unimport#GetExecutable(buffer) abort if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_unimport_auto_pipenv')) \ && 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_linters#python#unimport#GetCommand(buffer) abort let l:executable = ale_linters#python#unimport#GetExecutable(a:buffer) let l:exec_args = l:executable =~? '\(pipenv\|poetry\|uv\)$' \ ? ' run unimport' \ : '' return '%e' . l:exec_args \ . ale#Pad(ale#Var(a:buffer, 'python_unimport_options')) \ . ' --check' \ . ' %t' endfunction function! ale_linters#python#unimport#GetCwd(buffer) abort let l:project_root = ale#python#FindProjectRoot(a:buffer) return !empty(l:project_root) \ ? l:project_root \ : expand('#' . a:buffer . ':p:h') endfunction function! ale_linters#python#unimport#Handle(buffer, lines) abort let l:output = ale#python#HandleTraceback(a:lines, 10) if !empty(l:output) return l:output endif " Matches lines like: " " urllib.parse at path/to/file.py:9 let l:pattern = '\v(.+) at [^:]+:(\d+)$' for l:match in ale#util#GetMatches(a:lines, l:pattern) call add(l:output, { \ 'lnum': l:match[2] + 0, \ 'type': 'W', \ 'text': 'unused: ' . l:match[1], \}) endfor return l:output endfunction call ale#linter#Define('python', { \ 'name': 'unimport', \ 'executable': function('ale_linters#python#unimport#GetExecutable'), \ 'cwd': function('ale_linters#python#unimport#GetCwd'), \ 'command': function('ale_linters#python#unimport#GetCommand'), \ 'callback': 'ale_linters#python#unimport#Handle', \}) ale-4.0.0/ale_linters/python/vulture.vim000066400000000000000000000060571476501472200203410ustar00rootroot00000000000000" Author: Yauheni Kirylau " Description: vulture linting for python files call ale#Set('python_vulture_executable', 'vulture') call ale#Set('python_vulture_options', '') call ale#Set('python_vulture_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('python_vulture_change_directory', 1) call ale#Set('python_vulture_auto_pipenv', 0) call ale#Set('python_vulture_auto_poetry', 0) call ale#Set('python_vulture_auto_uv', 0) " The directory to change to before running vulture function! s:GetDir(buffer) abort let l:project_root = ale#python#FindProjectRoot(a:buffer) return !empty(l:project_root) \ ? l:project_root \ : expand('#' . a:buffer . ':p:h') endfunction function! ale_linters#python#vulture#GetExecutable(buffer) abort if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_vulture_auto_pipenv')) \ && ale#python#PipenvPresent(a:buffer) return 'pipenv' endif if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_vulture_auto_poetry')) \ && ale#python#PoetryPresent(a:buffer) return 'poetry' endif if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_vulture_auto_uv')) \ && ale#python#UvPresent(a:buffer) return 'uv' endif return ale#python#FindExecutable(a:buffer, 'python_vulture', ['vulture']) endfunction function! ale_linters#python#vulture#GetCwd(buffer) abort if !ale#Var(a:buffer, 'python_vulture_change_directory') return '' endif return s:GetDir(a:buffer) endfunction function! ale_linters#python#vulture#GetCommand(buffer) abort let l:executable = ale_linters#python#vulture#GetExecutable(a:buffer) let l:exec_args = l:executable =~? '\(pipenv\|poetry\|uv\)$' \ ? ' run vulture' \ : '' let l:lint_dest = ale#Var(a:buffer, 'python_vulture_change_directory') \ ? ' .' \ : ' %s' return ale#Escape(l:executable) . l:exec_args \ . ' ' \ . ale#Var(a:buffer, 'python_vulture_options') \ . l:lint_dest endfunction function! ale_linters#python#vulture#Handle(buffer, lines) abort let l:output = ale#python#HandleTraceback(a:lines, 10) if !empty(l:output) return l:output endif " Matches patterns line the following: let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+): (.*)$' let l:dir = s:GetDir(a:buffer) for l:match in ale#util#GetMatches(a:lines, l:pattern) let l:abspath = ale#path#GetAbsPath(l:dir, l:match[1]) let l:item = { \ 'filename': l:abspath, \ 'lnum': l:match[2] + 0, \ 'text': l:match[3], \ 'type': 'W', \} call add(l:output, l:item) endfor return l:output endfunction call ale#linter#Define('python', { \ 'name': 'vulture', \ 'executable': function('ale_linters#python#vulture#GetExecutable'), \ 'cwd': function('ale_linters#python#vulture#GetCwd'), \ 'command': function('ale_linters#python#vulture#GetCommand'), \ 'callback': 'ale_linters#python#vulture#Handle', \ 'lint_file': 1, \}) ale-4.0.0/ale_linters/qml/000077500000000000000000000000001476501472200153565ustar00rootroot00000000000000ale-4.0.0/ale_linters/qml/qmlfmt.vim000066400000000000000000000013461476501472200173770ustar00rootroot00000000000000" Author: pylipp (www.github.com/pylipp) " Description: qmlfmt for QML files call ale#Set('qml_qmlfmt_executable', 'qmlfmt') " Find lines like " Error:11:1: Expected token `}' function! ale_linters#qml#qmlfmt#Handle(buffer, lines) abort let l:pattern = '\v^(Error|Warning):(\d+):(\d+): (.+)$' return map(ale#util#GetMatches(a:lines, l:pattern), "{ \ 'lnum': v:val[2] + 0, \ 'col': v:val[3] + 0, \ 'text': v:val[4], \ 'type': v:val[1] is# 'Warning' ? 'W' : 'E', \}") endfunction call ale#linter#Define('qml', { \ 'name': 'qmlfmt', \ 'output_stream': 'stderr', \ 'executable': {b -> ale#Var(b, 'qml_qmlfmt_executable')}, \ 'command': '%e -e', \ 'callback': 'ale_linters#qml#qmlfmt#Handle', \}) ale-4.0.0/ale_linters/qml/qmllint.vim000066400000000000000000000014321476501472200175530ustar00rootroot00000000000000" Author: pylipp (www.github.com/pylipp) " Description: qmllint for QML files " Find lines like " /home/foo_user42/code-base/qml/Screen.qml:11 : Expected token `}' function! ale_linters#qml#qmllint#Handle(buffer, lines) abort let l:pattern = '\v^[/_-a-zA-z0-9\. ]+:(\d+) : (.*)$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) let l:item = { \ 'lnum': l:match[1] + 0, \ 'col': 0, \ 'text': l:match[2], \ 'type': 'E', \} call add(l:output, l:item) endfor return l:output endfunction call ale#linter#Define('qml', { \ 'name': 'qmllint', \ 'output_stream': 'stderr', \ 'executable': 'qmllint', \ 'command': 'qmllint %t', \ 'callback': 'ale_linters#qml#qmllint#Handle', \}) ale-4.0.0/ale_linters/r/000077500000000000000000000000001476501472200150265ustar00rootroot00000000000000ale-4.0.0/ale_linters/r/languageserver.vim000066400000000000000000000021531476501472200205560ustar00rootroot00000000000000" Author: Eric Zhao <21zhaoe@protonmail.com> " Author: ourigen " Description: Implementation of the Language Server Protocol for R. call ale#Set('r_languageserver_cmd', 'languageserver::run()') call ale#Set('r_languageserver_config', {}) function! ale_linters#r#languageserver#GetCommand(buffer) abort let l:cmd_string = ale#Var(a:buffer, 'r_languageserver_cmd') return 'Rscript --no-save --no-restore --no-site-file --no-init-file -e ' . ale#Escape(l:cmd_string) endfunction function! ale_linters#r#languageserver#GetProjectRoot(buffer) abort let l:project_root = ale#path#FindNearestFile(a:buffer, '.Rprofile') return !empty(l:project_root) ? fnamemodify(l:project_root, ':h') : fnamemodify(a:buffer, ':h') endfunction call ale#linter#Define('r', { \ 'name': 'languageserver', \ 'aliases': ['r_language_server'], \ 'lsp': 'stdio', \ 'lsp_config': {b -> ale#Var(b, 'r_languageserver_config')}, \ 'executable': 'Rscript', \ 'command': function('ale_linters#r#languageserver#GetCommand'), \ 'project_root': function('ale_linters#r#languageserver#GetProjectRoot') \}) ale-4.0.0/ale_linters/r/lintr.vim000066400000000000000000000024771476501472200167050ustar00rootroot00000000000000" Author: Michel Lang , w0rp , " Fenner Macrae , " ourigen " Description: This file adds support for checking R code with lintr. let g:ale_r_lintr_options = get(g:, 'ale_r_lintr_options', 'with_defaults()') " A reasonable alternative default: " get(g:, 'ale_r_lintr_options', 'with_defaults(object_usage_linter = NULL)') let g:ale_r_lintr_lint_package = get(g:, 'ale_r_lintr_lint_package', 0) function! ale_linters#r#lintr#GetCommand(buffer) abort if ale#Var(a:buffer, 'r_lintr_lint_package') let l:lint_cmd = 'lint_package(cache = FALSE, linters = ' \ . ale#Var(a:buffer, 'r_lintr_options') . ')' else let l:lint_cmd = 'lint(cache = FALSE, commandArgs(TRUE), ' \ . ale#Var(a:buffer, 'r_lintr_options') . ')' endif let l:cmd_string = 'suppressPackageStartupMessages(library(lintr));' \ . l:lint_cmd return 'Rscript --no-save --no-restore --no-site-file --no-init-file -e ' . ale#Escape(l:cmd_string) . ' %t' endfunction call ale#linter#Define('r', { \ 'name': 'lintr', \ 'executable': 'Rscript', \ 'cwd': '%s:h', \ 'command': function('ale_linters#r#lintr#GetCommand'), \ 'callback': 'ale#handlers#gcc#HandleGCCFormat', \ 'output_stream': 'both', \}) ale-4.0.0/ale_linters/racket/000077500000000000000000000000001476501472200160365ustar00rootroot00000000000000ale-4.0.0/ale_linters/racket/langserver.vim000066400000000000000000000003361476501472200207250ustar00rootroot00000000000000call ale#linter#Define('racket', { \ 'name': 'racket_langserver', \ 'lsp': 'stdio', \ 'executable': 'racket', \ 'command': '%e -l racket-langserver', \ 'project_root': function('ale#racket#FindProjectRoot'), \}) ale-4.0.0/ale_linters/racket/raco.vim000066400000000000000000000022171476501472200175010ustar00rootroot00000000000000" Author: aqui18 " Description: This file adds support for checking Racket code with raco. " This is the same form of syntax-checking used by DrRacket as well. The " downside is that it will only catch the first error, but none of the " subsequent ones. This is due to how evaluation in Racket works. function! ale_linters#racket#raco#Handle(buffer, lines) abort " Matches patterns " :: " eg: " info.rkt:4:0: infotab-module: not a well-formed definition let l:pattern = '^\(\s\)\@!\(.\+\):\(\d\+\):\(\d\+\): \(.\+\)$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) call add(l:output, { \ 'filename': l:match[2], \ 'lnum': l:match[3] + 0, \ 'col': l:match[4] + 0, \ 'type': 'E', \ 'text': l:match[5], \}) endfor return l:output endfunction call ale#linter#Define('racket', { \ 'name': 'raco', \ 'executable': 'raco', \ 'output_stream': 'stderr', \ 'command': 'raco expand %s', \ 'callback': 'ale_linters#racket#raco#Handle', \}) ale-4.0.0/ale_linters/reason/000077500000000000000000000000001476501472200160545ustar00rootroot00000000000000ale-4.0.0/ale_linters/reason/ls.vim000066400000000000000000000013321476501472200172060ustar00rootroot00000000000000" Author: David Buchan-Swanson " Description: Integrate ALE with reason-language-server. call ale#Set('reason_ls_executable', '') function! ale_linters#reason#ls#FindProjectRoot(buffer) abort let l:reason_config = ale#path#FindNearestFile(a:buffer, 'bsconfig.json') if !empty(l:reason_config) return fnamemodify(l:reason_config, ':h') endif return '' endfunction call ale#linter#Define('reason', { \ 'name': 'reason-language-server', \ 'aliases': ['reason_ls'], \ 'lsp': 'stdio', \ 'executable': {buffer -> ale#Var(buffer, 'reason_ls_executable')}, \ 'command': '%e', \ 'project_root': function('ale_linters#reason#ls#FindProjectRoot'), \ 'language': 'reason', \}) ale-4.0.0/ale_linters/reason/merlin.vim000066400000000000000000000006401476501472200200570ustar00rootroot00000000000000" Author: Andrey Popp -- @andreypopp " Description: Report errors in ReasonML code with Merlin if !exists('g:merlin') finish endif function! ale_linters#reason#merlin#Handle(buffer, lines) abort return merlin#ErrorLocList() endfunction call ale#linter#Define('reason', { \ 'name': 'merlin', \ 'executable': 'ocamlmerlin', \ 'command': 'true', \ 'callback': 'ale_linters#reason#merlin#Handle', \}) ale-4.0.0/ale_linters/reason/ols.vim000066400000000000000000000011311476501472200173620ustar00rootroot00000000000000" Author: Michael Jungo " Description: A language server for Reason call ale#Set('reason_ols_executable', 'ocaml-language-server') call ale#Set('reason_ols_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#linter#Define('reason', { \ 'name': 'ols', \ 'aliases': ['ocaml-language-server'], \ 'lsp': 'stdio', \ 'executable': function('ale#handlers#ols#GetExecutable'), \ 'command': function('ale#handlers#ols#GetCommand'), \ 'language': function('ale#handlers#ols#GetLanguage'), \ 'project_root': function('ale#handlers#ols#GetProjectRoot'), \}) ale-4.0.0/ale_linters/rego/000077500000000000000000000000001476501472200155215ustar00rootroot00000000000000ale-4.0.0/ale_linters/rego/cspell.vim000066400000000000000000000001621476501472200175170ustar00rootroot00000000000000scriptencoding utf-8 " Description: cspell support for rego files. call ale#handlers#cspell#DefineLinter('rego') ale-4.0.0/ale_linters/rego/opacheck.vim000066400000000000000000000034741476501472200200230ustar00rootroot00000000000000" Description: opa check for rego files call ale#Set('rego_opacheck_executable', 'opa') call ale#Set('rego_opacheck_options', '') function! ale_linters#rego#opacheck#GetExecutable(buffer) abort return ale#Var(a:buffer, 'rego_opacheck_executable') endfunction function! ale_linters#rego#opacheck#GetCommand(buffer) abort let l:options = ale#Var(a:buffer, 'rego_opacheck_options') return ale#Escape(ale_linters#rego#opacheck#GetExecutable(a:buffer)) \ . ' check %s:h --format json ' \ . (!empty(l:options) ? ' ' . l:options : '') endfunction function! ale_linters#rego#opacheck#Handle(buffer, lines) abort let l:output = [] let l:errors = ale#util#FuzzyJSONDecode(a:lines, {'errors': []}) let l:dir = expand('#' . a:buffer . ':p:h') let l:file = expand('#' . a:buffer . ':p') for l:error in l:errors['errors'] if has_key(l:error, 'location') call add(l:output, { \ 'filename': ale#path#GetAbsPath(l:dir, l:error['location']['file']), \ 'lnum': l:error['location']['row'], \ 'col': l:error['location']['col'], \ 'text': l:error['message'], \ 'code': l:error['code'], \ 'type': 'E', \}) else call add(l:output, { \ 'filename': l:file, \ 'lnum': 0, \ 'col': 0, \ 'text': l:error['message'], \ 'code': l:error['code'], \ 'type': 'E', \}) endif endfor return l:output endfunction call ale#linter#Define('rego', { \ 'name': 'opacheck', \ 'output_stream': 'both', \ 'executable': function('ale_linters#rego#opacheck#GetExecutable'), \ 'command': function('ale_linters#rego#opacheck#GetCommand'), \ 'callback': 'ale_linters#rego#opacheck#Handle', \}) ale-4.0.0/ale_linters/review/000077500000000000000000000000001476501472200160665ustar00rootroot00000000000000ale-4.0.0/ale_linters/review/redpen.vim000066400000000000000000000004501476501472200200570ustar00rootroot00000000000000" Author: rhysd https://rhysd.github.io " Description: Redpen, a proofreading tool (http://redpen.cc) call ale#linter#Define('review', { \ 'name': 'redpen', \ 'executable': 'redpen', \ 'command': 'redpen -f review -r json %t', \ 'callback': 'ale#handlers#redpen#HandleRedpenOutput', \}) ale-4.0.0/ale_linters/robot/000077500000000000000000000000001476501472200157125ustar00rootroot00000000000000ale-4.0.0/ale_linters/robot/rflint.vim000066400000000000000000000026431476501472200177320ustar00rootroot00000000000000" Author: Samuel Branisa " Description: rflint linting for robot framework files call ale#Set('robot_rflint_executable', 'rflint') function! ale_linters#robot#rflint#GetExecutable(buffer) abort return ale#Var(a:buffer, 'robot_rflint_executable') endfunction function! ale_linters#robot#rflint#GetCommand(buffer) abort let l:executable = ale_linters#robot#rflint#GetExecutable(a:buffer) let l:flags = '--format' \ . ' "{filename}:{severity}:{linenumber}:{char}:{rulename}:{message}"' return l:executable \ . ' ' \ . l:flags \ . ' %s' endfunction function! ale_linters#robot#rflint#Handle(buffer, lines) abort let l:pattern = '\v^([[:alnum:][:punct:]]+):(W|E):([[:digit:]]+):([[:digit:]]+):([[:alnum:]]+):(.*)$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) call add(l:output, { \ 'bufnr': a:buffer, \ 'filename': l:match[1], \ 'type': l:match[2], \ 'lnum': str2nr(l:match[3]), \ 'col': str2nr(l:match[4]), \ 'text': l:match[5], \ 'detail': l:match[6], \}) endfor return l:output endfunction call ale#linter#Define('robot', { \ 'name': 'rflint', \ 'executable': function('ale_linters#robot#rflint#GetExecutable'), \ 'command': function('ale_linters#robot#rflint#GetCommand'), \ 'callback': 'ale_linters#robot#rflint#Handle', \}) ale-4.0.0/ale_linters/rst/000077500000000000000000000000001476501472200153755ustar00rootroot00000000000000ale-4.0.0/ale_linters/rst/alex.vim000066400000000000000000000002111476501472200170350ustar00rootroot00000000000000" Author: Johannes Wienke " Description: alex for rst files call ale#handlers#alex#DefineLinter('rst', '--text') ale-4.0.0/ale_linters/rst/cspell.vim000066400000000000000000000002431476501472200173730ustar00rootroot00000000000000scriptencoding utf-8 " Author: David Houston " Description: cspell support for ReStructuredText files. call ale#handlers#cspell#DefineLinter('rst') ale-4.0.0/ale_linters/rst/proselint.vim000066400000000000000000000004341476501472200201320ustar00rootroot00000000000000" Author: Daniel M. Capella https://github.com/polyzen " Description: proselint for reStructuredText files call ale#linter#Define('rst', { \ 'name': 'proselint', \ 'executable': 'proselint', \ 'command': 'proselint %t', \ 'callback': 'ale#handlers#unix#HandleAsWarning', \}) ale-4.0.0/ale_linters/rst/redpen.vim000066400000000000000000000004431476501472200173700ustar00rootroot00000000000000" Author: rhysd https://rhysd.github.io " Description: Redpen, a proofreading tool (http://redpen.cc) call ale#linter#Define('rst', { \ 'name': 'redpen', \ 'executable': 'redpen', \ 'command': 'redpen -f rest -r json %t', \ 'callback': 'ale#handlers#redpen#HandleRedpenOutput', \}) ale-4.0.0/ale_linters/rst/rstcheck.vim000066400000000000000000000016751476501472200177310ustar00rootroot00000000000000" Author: John Nduli https://github.com/jnduli " Description: Rstcheck for reStructuredText files function! ale_linters#rst#rstcheck#Handle(buffer, lines) abort " matches: 'bad_rst.rst:1: (SEVERE/4) Title overline & underline " mismatch.' let l:pattern = '\v^(.+):(\d*): \(([a-zA-Z]*)/\d*\) (.+)$' let l:dir = expand('#' . a:buffer . ':p:h') let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) call add(l:output, { \ 'filename': ale#path#GetAbsPath(l:dir, l:match[1]), \ 'lnum': l:match[2] + 0, \ 'col': 0, \ 'type': l:match[3] is# 'SEVERE' ? 'E' : 'W', \ 'text': l:match[4], \}) endfor return l:output endfunction call ale#linter#Define('rst', { \ 'name': 'rstcheck', \ 'executable': 'rstcheck', \ 'cwd': '%s:h', \ 'command': 'rstcheck %t', \ 'callback': 'ale_linters#rst#rstcheck#Handle', \ 'output_stream': 'both', \}) ale-4.0.0/ale_linters/rst/textlint.vim000066400000000000000000000005671476501472200177750ustar00rootroot00000000000000" Author: hokorobi " Description: textlint, a proofreading tool (https://textlint.github.io/) call ale#linter#Define('rst', { \ 'name': 'textlint', \ 'executable': function('ale#handlers#textlint#GetExecutable'), \ 'command': function('ale#handlers#textlint#GetCommand'), \ 'callback': 'ale#handlers#textlint#HandleTextlintOutput', \}) ale-4.0.0/ale_linters/rst/vale.vim000066400000000000000000000003641476501472200170440ustar00rootroot00000000000000" Author: chew-z https://github.com/chew-z " Description: vale for RST files call ale#linter#Define('rst', { \ 'name': 'vale', \ 'executable': 'vale', \ 'command': 'vale --output=JSON %t', \ 'callback': 'ale#handlers#vale#Handle', \}) ale-4.0.0/ale_linters/rst/writegood.vim000066400000000000000000000002301476501472200201100ustar00rootroot00000000000000" Author: Sumner Evans " Description: write-good for reStructuredText files call ale#handlers#writegood#DefineLinter('rst') ale-4.0.0/ale_linters/ruby/000077500000000000000000000000001476501472200155465ustar00rootroot00000000000000ale-4.0.0/ale_linters/ruby/brakeman.vim000066400000000000000000000032721476501472200200470ustar00rootroot00000000000000" Author: Eddie Lebow https://github.com/elebow " Description: Brakeman, a static analyzer for Rails security call ale#Set('ruby_brakeman_options', '') call ale#Set('ruby_brakeman_executable', 'brakeman') call ale#Set('ruby_brakeman_options', '') function! ale_linters#ruby#brakeman#Handle(buffer, lines) abort let l:output = [] let l:json = ale#util#FuzzyJSONDecode(a:lines, {}) let l:sep = has('win32') ? '\' : '/' " Brakeman always outputs paths relative to the Rails app root let l:rails_root = ale#ruby#FindRailsRoot(a:buffer) for l:warning in get(l:json, 'warnings', []) let l:text = l:warning.warning_type . ' ' . l:warning.message . ' (' . l:warning.confidence . ')' let l:line = l:warning.line != v:null ? l:warning.line : 1 call add(l:output, { \ 'filename': l:rails_root . l:sep . l:warning.file, \ 'lnum': l:line, \ 'type': 'W', \ 'text': l:text, \}) endfor return l:output endfunction function! ale_linters#ruby#brakeman#GetCommand(buffer) abort let l:rails_root = ale#ruby#FindRailsRoot(a:buffer) if l:rails_root is? '' return '' endif let l:executable = ale#Var(a:buffer, 'ruby_brakeman_executable') return ale#ruby#EscapeExecutable(l:executable, 'brakeman') \ . ' -f json -q ' \ . ale#Var(a:buffer, 'ruby_brakeman_options') \ . ' -p ' . ale#Escape(l:rails_root) endfunction call ale#linter#Define('ruby', { \ 'name': 'brakeman', \ 'executable': {b -> ale#Var(b, 'ruby_brakeman_executable')}, \ 'command': function('ale_linters#ruby#brakeman#GetCommand'), \ 'callback': 'ale_linters#ruby#brakeman#Handle', \ 'lint_file': 1, \}) ale-4.0.0/ale_linters/ruby/cspell.vim000066400000000000000000000002301476501472200175400ustar00rootroot00000000000000scriptencoding utf-8 " Author: David Houston " Description: cspell support for Ruby files. call ale#handlers#cspell#DefineLinter('ruby') ale-4.0.0/ale_linters/ruby/debride.vim000066400000000000000000000023321476501472200176610ustar00rootroot00000000000000" Author: Eddie Lebow https://github.com/elebow " Description: debride, a dead method detector for Ruby files call ale#Set('ruby_debride_executable', 'debride') call ale#Set('ruby_debride_options', '') function! ale_linters#ruby#debride#GetCommand(buffer) abort let l:executable = ale#Var(a:buffer, 'ruby_debride_executable') return ale#ruby#EscapeExecutable(l:executable, 'debride') \ . ale#Var(a:buffer, 'ruby_debride_options') \ . ' %s' endfunction function! ale_linters#ruby#debride#HandleOutput(buffer, lines) abort let l:output = [] for l:line in a:lines if l:line !~# '^ ' continue endif let l:elements = split(l:line) let l:method_name = l:elements[0] let l:lnum = split(l:elements[1], ':')[1] call add(l:output, { \ 'lnum': 0 + l:lnum, \ 'text': 'Possible unused method: ' . l:method_name, \ 'type': 'W', \}) endfor return l:output endfunction call ale#linter#Define('ruby', { \ 'name': 'debride', \ 'executable': {b -> ale#Var(b, 'ruby_debride_executable')}, \ 'command': function('ale_linters#ruby#debride#GetCommand'), \ 'callback': 'ale_linters#ruby#debride#HandleOutput', \}) ale-4.0.0/ale_linters/ruby/packwerk.vim000066400000000000000000000033311476501472200200720ustar00rootroot00000000000000" Author: ymap - https://github.com/ymap " Description: Packwerk, a static analyzer used to enforce boundaries and modularize Rails applications. call ale#Set('ruby_packwerk_executable', 'packwerk') call ale#Set('ruby_packwerk_options', '') function! ale_linters#ruby#packwerk#Handle(buffer, lines) abort let l:pattern = '\v^[^:]+:(\d+):(\d+)$' let l:index = 0 let l:output = [] while l:index < len(a:lines) - 1 let l:cleaned_line = substitute(a:lines[l:index], '\v\e\[[0-9;]*m', '', 'g') let l:match = matchlist(l:cleaned_line, l:pattern) if len(l:match) > 0 call add(l:output, { \ 'lnum': l:match[1] + 0, \ 'col': l:match[2] + 0, \ 'text': a:lines[l:index + 1], \}) endif let l:index += 1 endwhile return l:output endfunction function! ale_linters#ruby#packwerk#GetCommand(buffer) abort let l:rails_root = ale#ruby#FindRailsRoot(a:buffer) if l:rails_root is? '' return '' endif let l:executable = ale#Var(a:buffer, 'ruby_packwerk_executable') let l:sep = has('win32') ? '\' : '/' let l:abs_path = expand('#' . a:buffer . ':p') let l:rel_path = substitute(l:abs_path, escape(l:rails_root . l:sep, '\'), '', '') return ale#ruby#EscapeExecutable(l:executable, 'packwerk') \ . ' check' \ . ale#Pad(ale#Var(a:buffer, 'ruby_packwerk_options')) \ . ' ' \ . ale#Escape(rel_path) endfunction call ale#linter#Define('ruby', { \ 'name': 'packwerk', \ 'executable': {b -> ale#Var(b, 'ruby_packwerk_executable')}, \ 'command': function('ale_linters#ruby#packwerk#GetCommand'), \ 'callback': 'ale_linters#ruby#packwerk#Handle', \ 'lint_file': 1, \}) ale-4.0.0/ale_linters/ruby/rails_best_practices.vim000066400000000000000000000032271476501472200224530ustar00rootroot00000000000000" Author: Eddie Lebow https://github.com/elebow " Description: rails_best_practices, a code metric tool for rails projects call ale#Set('ruby_rails_best_practices_options', '') call ale#Set('ruby_rails_best_practices_executable', 'rails_best_practices') function! ale_linters#ruby#rails_best_practices#Handle(buffer, lines) abort let l:output = [] for l:warning in ale#util#FuzzyJSONDecode(a:lines, []) if !ale#path#IsBufferPath(a:buffer, l:warning.filename) continue endif call add(l:output, { \ 'lnum': l:warning.line_number + 0, \ 'type': 'W', \ 'text': l:warning.message, \}) endfor return l:output endfunction function! ale_linters#ruby#rails_best_practices#GetCommand(buffer) abort let l:rails_root = ale#ruby#FindRailsRoot(a:buffer) if l:rails_root is? '' return '' endif let l:executable = ale#Var(a:buffer, 'ruby_rails_best_practices_executable') let l:output_file = has('win32') ? '%t ' : '/dev/stdout ' let l:cat_file = has('win32') ? '; type %t' : '' return ale#ruby#EscapeExecutable(l:executable, 'rails_best_practices') \ . ' --silent -f json --output-file ' . l:output_file \ . ale#Var(a:buffer, 'ruby_rails_best_practices_options') \ . ale#Escape(l:rails_root) \ . l:cat_file endfunction call ale#linter#Define('ruby', { \ 'name': 'rails_best_practices', \ 'executable': {b -> ale#Var(b, 'ruby_rails_best_practices_executable')}, \ 'command': function('ale_linters#ruby#rails_best_practices#GetCommand'), \ 'callback': 'ale_linters#ruby#rails_best_practices#Handle', \ 'lint_file': 1, \}) ale-4.0.0/ale_linters/ruby/reek.vim000066400000000000000000000041121476501472200172070ustar00rootroot00000000000000" Author: Eddie Lebow https://github.com/elebow " Description: Reek, a code smell detector for Ruby files call ale#Set('ruby_reek_show_context', 0) call ale#Set('ruby_reek_show_wiki_link', 0) call ale#Set('ruby_reek_options', '') call ale#Set('ruby_reek_executable', 'reek') function! ale_linters#ruby#reek#GetCommand(buffer, version) abort let l:executable = ale#Var(a:buffer, 'ruby_reek_executable') " Tell reek what the filename is if the version of reek is new enough. let l:display_name_args = ale#semver#GTE(a:version, [5, 0, 0]) \ ? ' --stdin-filename %s' \ : '' return ale#ruby#EscapeExecutable(l:executable, 'reek') \ . ' -f json --no-progress --no-color --force-exclusion' \ . l:display_name_args endfunction function! s:GetDocumentationLink(error) abort return get(a:error, 'documentation_link', get(a:error, 'wiki_link', '')) endfunction function! s:BuildText(buffer, error) abort let l:parts = [] if ale#Var(a:buffer, 'ruby_reek_show_context') call add(l:parts, a:error.context) endif call add(l:parts, a:error.message) if ale#Var(a:buffer, 'ruby_reek_show_wiki_link') call add(l:parts, '[' . s:GetDocumentationLink(a:error) . ']') endif return join(l:parts, ' ') endfunction function! ale_linters#ruby#reek#Handle(buffer, lines) abort let l:output = [] for l:error in ale#util#FuzzyJSONDecode(a:lines, []) for l:location in l:error.lines call add(l:output, { \ 'lnum': l:location, \ 'type': 'W', \ 'text': s:BuildText(a:buffer, l:error), \ 'code': l:error.smell_type, \}) endfor endfor return l:output endfunction call ale#linter#Define('ruby', { \ 'name': 'reek', \ 'executable': {b -> ale#Var(b, 'ruby_reek_executable')}, \ 'command': {buffer -> ale#semver#RunWithVersionCheck( \ buffer, \ ale#Var(buffer, 'ruby_reek_executable'), \ '%e --version', \ function('ale_linters#ruby#reek#GetCommand'), \ )}, \ 'callback': 'ale_linters#ruby#reek#Handle', \}) ale-4.0.0/ale_linters/ruby/rubocop.vim000066400000000000000000000017721476501472200177430ustar00rootroot00000000000000" Author: ynonp - https://github.com/ynonp, Eddie Lebow https://github.com/elebow " Description: RuboCop, a code style analyzer for Ruby files call ale#Set('ruby_rubocop_executable', 'rubocop') call ale#Set('ruby_rubocop_options', '') function! ale_linters#ruby#rubocop#GetCommand(buffer) abort let l:executable = ale#Var(a:buffer, 'ruby_rubocop_executable') return ale#ruby#EscapeExecutable(l:executable, 'rubocop') \ . ' --format json --force-exclusion ' \ . ale#Var(a:buffer, 'ruby_rubocop_options') \ . ' --stdin %s' endfunction function! ale_linters#ruby#rubocop#GetType(severity) abort if a:severity is? 'convention' \|| a:severity is? 'warning' \|| a:severity is? 'refactor' return 'W' endif return 'E' endfunction call ale#linter#Define('ruby', { \ 'name': 'rubocop', \ 'executable': {b -> ale#Var(b, 'ruby_rubocop_executable')}, \ 'command': function('ale_linters#ruby#rubocop#GetCommand'), \ 'callback': 'ale#ruby#HandleRubocopOutput', \}) ale-4.0.0/ale_linters/ruby/ruby.vim000066400000000000000000000005731476501472200172510ustar00rootroot00000000000000" Author: Brandon Roehl - https://github.com/BrandonRoehl " Description: Ruby MRI for Ruby files call ale#Set('ruby_ruby_executable', 'ruby') call ale#linter#Define('ruby', { \ 'name': 'ruby', \ 'executable': {b -> ale#Var(b, 'ruby_ruby_executable')}, \ 'command': '%e -w -c %t', \ 'output_stream': 'stderr', \ 'callback': 'ale#handlers#ruby#HandleSyntaxErrors', \}) ale-4.0.0/ale_linters/ruby/solargraph.vim000066400000000000000000000014351476501472200204300ustar00rootroot00000000000000" Author: Horacio Sanson - https://github.com/hsanson " Description: Solargraph Language Server https://solargraph.org/ " " Author: Devon Meunier " Description: updated to use stdio call ale#Set('ruby_solargraph_executable', 'solargraph') call ale#Set('ruby_solargraph_options', {}) function! ale_linters#ruby#solargraph#GetCommand(buffer) abort return '%e' . ale#Pad('stdio') endfunction call ale#linter#Define('ruby', { \ 'name': 'solargraph', \ 'lsp': 'stdio', \ 'language': 'ruby', \ 'executable': {b -> ale#Var(b, 'ruby_solargraph_executable')}, \ 'command': function('ale_linters#ruby#solargraph#GetCommand'), \ 'project_root': function('ale#ruby#FindProjectRoot'), \ 'initialization_options': {b -> ale#Var(b, 'ruby_solargraph_options')}, \}) ale-4.0.0/ale_linters/ruby/sorbet.vim000066400000000000000000000016401476501472200175620ustar00rootroot00000000000000call ale#Set('ruby_sorbet_executable', 'srb') call ale#Set('ruby_sorbet_options', '') call ale#Set('ruby_sorbet_enable_watchman', 0) function! ale_linters#ruby#sorbet#GetCommand(buffer) abort let l:executable = ale#Var(a:buffer, 'ruby_sorbet_executable') let l:options = ale#Var(a:buffer, 'ruby_sorbet_options') let l:enable_watchman = ale#Var(a:buffer, 'ruby_sorbet_enable_watchman') return ale#ruby#EscapeExecutable(l:executable, 'srb') \ . ' tc' \ . (!empty(l:options) ? ' ' . l:options : '') \ . ' --lsp' \ . (l:enable_watchman ? '' : ' --disable-watchman') endfunction call ale#linter#Define('ruby', { \ 'name': 'sorbet', \ 'aliases': ['srb'], \ 'lsp': 'stdio', \ 'language': 'ruby', \ 'executable': {b -> ale#Var(b, 'ruby_sorbet_executable')}, \ 'command': function('ale_linters#ruby#sorbet#GetCommand'), \ 'project_root': function('ale#ruby#FindProjectRoot') \}) ale-4.0.0/ale_linters/ruby/standardrb.vim000066400000000000000000000017311476501472200204110ustar00rootroot00000000000000" Author: Justin Searls https://github.com/searls, ynonp - https://github.com/ynonp, Eddie Lebow https://github.com/elebow " based on the ale rubocop linter " Description: StandardRB - Ruby Style Guide, with linter & automatic code fixer call ale#Set('ruby_standardrb_executable', 'standardrb') call ale#Set('ruby_standardrb_options', '') function! ale_linters#ruby#standardrb#GetCommand(buffer) abort let l:executable = ale#Var(a:buffer, 'ruby_standardrb_executable') return ale#ruby#EscapeExecutable(l:executable, 'standardrb') \ . ' --format json --force-exclusion ' \ . ale#Var(a:buffer, 'ruby_standardrb_options') \ . ' --stdin %s' endfunction " standardrb is based on RuboCop so the callback is the same call ale#linter#Define('ruby', { \ 'name': 'standardrb', \ 'executable': {b -> ale#Var(b, 'ruby_standardrb_executable')}, \ 'command': function('ale_linters#ruby#standardrb#GetCommand'), \ 'callback': 'ale#ruby#HandleRubocopOutput', \}) ale-4.0.0/ale_linters/ruby/steep.vim000066400000000000000000000124001476501472200174000ustar00rootroot00000000000000call ale#Set('ruby_steep_executable', 'steep') call ale#Set('ruby_steep_options', '') " Find the nearest dir containing a Steepfile function! ale_linters#ruby#steep#FindRoot(buffer) abort for l:name in ['Steepfile'] let l:dir = fnamemodify( \ ale#path#FindNearestFile(a:buffer, l:name), \ ':h' \) if l:dir isnot# '.' && isdirectory(l:dir) return l:dir endif endfor return '' endfunction " Rename path relative to root function! ale_linters#ruby#steep#RelativeToRoot(buffer, path) abort let l:separator = has('win32') ? '\' : '/' let l:steep_root = ale_linters#ruby#steep#FindRoot(a:buffer) " path isn't under root if l:steep_root is# '' return '' endif let l:steep_root_prefix = l:steep_root . l:separator " win32 path separators get interpreted by substitute, escape them if has('win32') let l:steep_root_pat = substitute(l:steep_root_prefix, '\\', '\\\\', 'g') else let l:steep_root_pat = l:steep_root_prefix endif return substitute(a:path, l:steep_root_pat, '', '') endfunction function! ale_linters#ruby#steep#GetCommand(buffer) abort let l:executable = ale#Var(a:buffer, 'ruby_steep_executable') " steep check needs to apply some config from the file path so: " - steep check can't use stdin (no path) " - steep check can't use %t (path outside of project) " => we can only use %s " somehow :ALEInfo shows that ALE still appends '< %t' to the command " => luckily steep check ignores stdin " somehow steep has a problem with absolute path to file but a path " relative to Steepfile directory works: " see https://github.com/soutaro/steep/pull/975 " => change to Steepfile directory and remove leading path let l:buffer_filename = fnamemodify(bufname(a:buffer), ':p') let l:buffer_filename = fnameescape(l:buffer_filename) let l:relative = ale_linters#ruby#steep#RelativeToRoot(a:buffer, l:buffer_filename) " if file is not under steep root, steep can't type check if l:relative is# '' " don't execute return '' endif return ale#ruby#EscapeExecutable(l:executable, 'steep') \ . ' check ' \ . ale#Var(a:buffer, 'ruby_steep_options') \ . ' ' . fnameescape(l:relative) endfunction function! ale_linters#ruby#steep#GetType(severity) abort if a:severity is? 'information' \|| a:severity is? 'hint' return 'I' endif if a:severity is? 'warning' return 'W' endif return 'E' endfunction " Handle output from steep function! ale_linters#ruby#steep#HandleOutput(buffer, lines) abort let l:output = [] let l:in = 0 let l:item = {} for l:line in a:lines " Look for first line of a message block " If not in-message (l:in == 0) that's expected " If in-message (l:in > 0) that's less expected but let's recover let l:match = matchlist(l:line, '^\([^:]*\):\([0-9]*\):\([0-9]*\): \[\([^]]*\)\] \(.*\)') if len(l:match) > 0 " Something is lingering: recover by pushing what is there if len(l:item) > 0 call add(l:output, l:item) let l:item = {} endif let l:filename = l:match[1] " Steep's reported column is offset by 1 (zero-indexed?) let l:item = { \ 'lnum': l:match[2] + 0, \ 'col': l:match[3] + 1, \ 'type': ale_linters#ruby#steep#GetType(l:match[4]), \ 'text': l:match[5], \} " Done with this line, mark being in-message and go on with next line let l:in = 1 continue endif " We're past the first line of a message block if l:in > 0 " Look for code in subsequent lines of the message block if l:line =~# '^│ Diagnostic ID:' let l:match = matchlist(l:line, '^│ Diagnostic ID: \(.*\)') if len(l:match) > 0 let l:item.code = l:match[1] endif " Done with the line continue endif " Look for last line of the message block if l:line =~# '^└' " Done with the line, mark looking for underline and go on with the next line let l:in = 2 continue endif " Look for underline right after last line if l:in == 2 let l:match = matchlist(l:line, '\([~][~]*\)') if len(l:match) > 0 let l:item.end_col = l:item['col'] + len(l:match[1]) - 1 endif call add(l:output, l:item) " Done with the line, mark looking for first line and go on with the next line let l:in = 0 let l:item = {} continue endif endif endfor return l:output endfunction call ale#linter#Define('ruby', { \ 'name': 'steep', \ 'executable': {b -> ale#Var(b, 'ruby_steep_executable')}, \ 'language': 'ruby', \ 'command': function('ale_linters#ruby#steep#GetCommand'), \ 'project_root': function('ale_linters#ruby#steep#FindRoot'), \ 'callback': 'ale_linters#ruby#steep#HandleOutput', \}) ale-4.0.0/ale_linters/rust/000077500000000000000000000000001476501472200155625ustar00rootroot00000000000000ale-4.0.0/ale_linters/rust/analyzer.vim000066400000000000000000000023261476501472200201270ustar00rootroot00000000000000" Author: Jon Gjengset " Description: The next generation language server for Rust call ale#Set('rust_analyzer_executable', 'rust-analyzer') call ale#Set('rust_analyzer_config', {}) function! ale_linters#rust#analyzer#GetCommand(buffer) abort return '%e' endfunction function! ale_linters#rust#analyzer#GetProjectRoot(buffer) abort " Try to find nearest Cargo.toml for cargo projects let l:cargo_file = ale#path#FindNearestFile(a:buffer, 'Cargo.toml') if !empty(l:cargo_file) return fnamemodify(l:cargo_file, ':h') endif " Try to find nearest rust-project.json for non-cargo projects let l:rust_project = ale#path#FindNearestFile(a:buffer, 'rust-project.json') if !empty(l:rust_project) return fnamemodify(l:rust_project, ':h') endif return '' endfunction call ale#linter#Define('rust', { \ 'name': 'analyzer', \ 'aliases': ['rust_analyzer'], \ 'lsp': 'stdio', \ 'initialization_options': {b -> ale#Var(b, 'rust_analyzer_config')}, \ 'executable': {b -> ale#Var(b, 'rust_analyzer_executable')}, \ 'command': function('ale_linters#rust#analyzer#GetCommand'), \ 'project_root': function('ale_linters#rust#analyzer#GetProjectRoot'), \}) ale-4.0.0/ale_linters/rust/cargo.vim000066400000000000000000000077741476501472200174110ustar00rootroot00000000000000" Author: Daniel Schemala , " Ivan Petkov " Description: rustc invoked by cargo for rust files call ale#Set('rust_cargo_use_check', 1) call ale#Set('rust_cargo_check_all_targets', 0) call ale#Set('rust_cargo_check_examples', 0) call ale#Set('rust_cargo_check_tests', 0) call ale#Set('rust_cargo_avoid_whole_workspace', 1) call ale#Set('rust_cargo_default_feature_behavior', 'default') call ale#Set('rust_cargo_include_features', '') call ale#Set('rust_cargo_use_clippy', 0) call ale#Set('rust_cargo_clippy_options', '') call ale#Set('rust_cargo_target_dir', '') function! ale_linters#rust#cargo#GetCargoExecutable(bufnr) abort if ale#path#FindNearestFile(a:bufnr, 'Cargo.toml') isnot# '' return 'cargo' else " if there is no Cargo.toml file, we don't use cargo even if it exists, " so we return '', because executable('') apparently always fails return '' endif endfunction function! ale_linters#rust#cargo#GetCwd(buffer) abort if ale#Var(a:buffer, 'rust_cargo_avoid_whole_workspace') let l:nearest_cargo = ale#path#FindNearestFile(a:buffer, 'Cargo.toml') let l:nearest_cargo_dir = fnamemodify(l:nearest_cargo, ':h') if l:nearest_cargo_dir isnot# '.' return l:nearest_cargo_dir endif endif return '' endfunction function! ale_linters#rust#cargo#GetCommand(buffer, version) abort let l:use_check = ale#Var(a:buffer, 'rust_cargo_use_check') \ && ale#semver#GTE(a:version, [0, 17, 0]) let l:use_all_targets = ale#Var(a:buffer, 'rust_cargo_check_all_targets') \ && ale#semver#GTE(a:version, [0, 22, 0]) let l:use_examples = ale#Var(a:buffer, 'rust_cargo_check_examples') \ && ale#semver#GTE(a:version, [0, 22, 0]) let l:use_tests = ale#Var(a:buffer, 'rust_cargo_check_tests') \ && ale#semver#GTE(a:version, [0, 22, 0]) let l:target_dir = ale#Var(a:buffer, 'rust_cargo_target_dir') let l:use_target_dir = !empty(l:target_dir) \ && ale#semver#GTE(a:version, [0, 17, 0]) let l:include_features = ale#Var(a:buffer, 'rust_cargo_include_features') if !empty(l:include_features) let l:include_features = ' --features ' . ale#Escape(l:include_features) endif let l:default_feature_behavior = ale#Var(a:buffer, 'rust_cargo_default_feature_behavior') if l:default_feature_behavior is# 'all' let l:include_features = '' let l:default_feature = ' --all-features' elseif l:default_feature_behavior is# 'none' let l:default_feature = ' --no-default-features' else let l:default_feature = '' endif let l:subcommand = l:use_check ? 'check' : 'build' let l:clippy_options = '' if ale#Var(a:buffer, 'rust_cargo_use_clippy') let l:subcommand = 'clippy' let l:clippy_options = ale#Var(a:buffer, 'rust_cargo_clippy_options') if l:clippy_options =~# '^-- ' let l:clippy_options = join(split(l:clippy_options, '-- ')) endif if l:clippy_options isnot# '' let l:clippy_options = ' -- ' . l:clippy_options endif endif return 'cargo ' \ . l:subcommand \ . (l:use_all_targets ? ' --all-targets' : '') \ . (l:use_examples ? ' --examples' : '') \ . (l:use_tests ? ' --tests' : '') \ . (l:use_target_dir ? (' --target-dir ' . ale#Escape(l:target_dir)) : '') \ . ' --frozen --message-format=json -q' \ . l:default_feature \ . l:include_features \ . l:clippy_options endfunction call ale#linter#Define('rust', { \ 'name': 'cargo', \ 'executable': function('ale_linters#rust#cargo#GetCargoExecutable'), \ 'cwd': function('ale_linters#rust#cargo#GetCwd'), \ 'command': {buffer -> ale#semver#RunWithVersionCheck( \ buffer, \ ale_linters#rust#cargo#GetCargoExecutable(buffer), \ '%e --version', \ function('ale_linters#rust#cargo#GetCommand'), \ )}, \ 'callback': 'ale#handlers#rust#HandleRustErrors', \ 'output_stream': 'both', \ 'lint_file': 1, \}) ale-4.0.0/ale_linters/rust/cspell.vim000066400000000000000000000002301476501472200175540ustar00rootroot00000000000000scriptencoding utf-8 " Author: David Houston " Description: cspell support for Rust files. call ale#handlers#cspell#DefineLinter('rust') ale-4.0.0/ale_linters/rust/rls.vim000066400000000000000000000016611476501472200171030ustar00rootroot00000000000000" Author: w0rp " Description: A language server for Rust call ale#Set('rust_rls_executable', 'rls') call ale#Set('rust_rls_toolchain', '') call ale#Set('rust_rls_config', {}) function! ale_linters#rust#rls#GetCommand(buffer) abort let l:toolchain = ale#Var(a:buffer, 'rust_rls_toolchain') return '%e' . (!empty(l:toolchain) ? ' +' . ale#Escape(l:toolchain) : '') endfunction function! ale_linters#rust#rls#GetProjectRoot(buffer) abort let l:cargo_file = ale#path#FindNearestFile(a:buffer, 'Cargo.toml') return !empty(l:cargo_file) ? fnamemodify(l:cargo_file, ':h') : '' endfunction call ale#linter#Define('rust', { \ 'name': 'rls', \ 'lsp': 'stdio', \ 'lsp_config': {b -> ale#Var(b, 'rust_rls_config')}, \ 'executable': {b -> ale#Var(b, 'rust_rls_executable')}, \ 'command': function('ale_linters#rust#rls#GetCommand'), \ 'project_root': function('ale_linters#rust#rls#GetProjectRoot'), \}) ale-4.0.0/ale_linters/rust/rustc.vim000066400000000000000000000023041476501472200174360ustar00rootroot00000000000000" Author: Daniel Schemala " Description: rustc for rust files call ale#Set('rust_rustc_options', '--emit=mir -o /dev/null') function! ale_linters#rust#rustc#RustcCommand(buffer) abort " Try to guess the library search path. If the project is managed by cargo, " it's usually /target/debug/deps/ or " /target/release/deps/ let l:cargo_file = ale#path#FindNearestFile(a:buffer, 'Cargo.toml') if l:cargo_file isnot# '' let l:root = fnamemodify(l:cargo_file, ':h') let l:dependencies = ' -L ' . ale#Escape(ale#path#GetAbsPath(l:root, 'target/debug/deps')) \ . ' -L ' . ale#Escape(ale#path#GetAbsPath(l:root, 'target/release/deps')) else let l:dependencies = '' endif let l:options = ale#Var(a:buffer, 'rust_rustc_options') return 'rustc --error-format=json' \ . (!empty(l:options) ? ' ' . l:options : '') \ . l:dependencies . ' -' endfunction call ale#linter#Define('rust', { \ 'name': 'rustc', \ 'executable': 'rustc', \ 'command': function('ale_linters#rust#rustc#RustcCommand'), \ 'callback': 'ale#handlers#rust#HandleRustErrors', \ 'output_stream': 'stderr', \}) ale-4.0.0/ale_linters/salt/000077500000000000000000000000001476501472200155305ustar00rootroot00000000000000ale-4.0.0/ale_linters/salt/salt_lint.vim000066400000000000000000000020231476501472200202330ustar00rootroot00000000000000" Author: Benjamin BINIER " Description: salt-lint, saltstack linter call ale#Set('salt_salt_lint_executable', 'salt-lint') call ale#Set('salt_salt_lint_options', '') function! ale_linters#salt#salt_lint#GetCommand(buffer) abort return '%e' . ale#Pad(ale#Var(a:buffer, 'salt_salt_lint_options')) \ . ' --json' endfunction function! ale_linters#salt#salt_lint#Handle(buffer, lines) abort let l:output = [] for l:error in ale#util#FuzzyJSONDecode(a:lines, []) call add(l:output, { \ 'lnum': l:error.linenumber + 0, \ 'code': l:error.id + 0, \ 'text': l:error.message, \ 'type': l:error.severity is# 'HIGH' ? 'E' : 'W', \}) endfor return l:output endfunction call ale#linter#Define('salt', { \ 'name': 'salt_lint', \ 'aliases': ['salt-lint'], \ 'executable': {b -> ale#Var(b, 'salt_salt_lint_executable')}, \ 'command': function('ale_linters#salt#salt_lint#GetCommand'), \ 'callback': 'ale_linters#salt#salt_lint#Handle' \}) ale-4.0.0/ale_linters/sass/000077500000000000000000000000001476501472200155365ustar00rootroot00000000000000ale-4.0.0/ale_linters/sass/sasslint.vim000066400000000000000000000020521476501472200201120ustar00rootroot00000000000000" Author: sQVe - https://github.com/sQVe call ale#Set('sass_sasslint_executable', 'sass-lint') call ale#Set('sass_sasslint_options', '') call ale#Set('sass_sasslint_use_global', get(g:, 'ale_use_global_executables', 0)) function! ale_linters#sass#sasslint#GetExecutable(buffer) abort return ale#path#FindExecutable(a:buffer, 'sass_sasslint', [ \ 'node_modules/sass-lint/bin/sass-lint.js', \ 'node_modules/.bin/sass-lint', \]) endfunction function! ale_linters#sass#sasslint#GetCommand(buffer) abort let l:executable = ale_linters#sass#sasslint#GetExecutable(a:buffer) let l:options = ale#Var(a:buffer, 'sass_sasslint_options') return ale#node#Executable(a:buffer, l:executable) \ . (!empty(l:options) ? ' ' . l:options : '') \ . ' -v -q -f compact %t' endfunction call ale#linter#Define('sass', { \ 'name': 'sasslint', \ 'executable': function('ale_linters#sass#sasslint#GetExecutable'), \ 'command': function('ale_linters#sass#sasslint#GetCommand'), \ 'callback': 'ale#handlers#css#HandleCSSLintFormat', \}) ale-4.0.0/ale_linters/sass/stylelint.vim000066400000000000000000000007501476501472200203040ustar00rootroot00000000000000" Author: diartyz call ale#Set('sass_stylelint_executable', 'stylelint') call ale#Set('sass_stylelint_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#linter#Define('sass', { \ 'name': 'stylelint', \ 'output_stream': 'both', \ 'executable': {b -> ale#path#FindExecutable(b, 'sass_stylelint', [ \ 'node_modules/.bin/stylelint', \ ])}, \ 'command': '%e --stdin-filename %s', \ 'callback': 'ale#handlers#css#HandleStyleLintFormat', \}) ale-4.0.0/ale_linters/scala/000077500000000000000000000000001476501472200156505ustar00rootroot00000000000000ale-4.0.0/ale_linters/scala/cspell.vim000066400000000000000000000002321476501472200176440ustar00rootroot00000000000000scriptencoding utf-8 " Author: David Houston " Description: cspell support for Scala files. call ale#handlers#cspell#DefineLinter('scala') ale-4.0.0/ale_linters/scala/fsc.vim000066400000000000000000000007311476501472200171410ustar00rootroot00000000000000" Author: Nils Leuzinger - https://github.com/PawkyPenguin " Description: Basic scala support using fsc function! s:IsSbt(buffer) abort return index(split(getbufvar(a:buffer, '&filetype'), '\.'), 'sbt') >= 0 endfunction call ale#linter#Define('scala', { \ 'name': 'fsc', \ 'executable': {buf -> s:IsSbt(buf) ? '' : 'fsc'}, \ 'command': '%e -Ystop-after:parser %t', \ 'callback': 'ale#handlers#scala#HandleScalacLintFormat', \ 'output_stream': 'stderr', \}) ale-4.0.0/ale_linters/scala/metals.vim000066400000000000000000000024441476501472200176560ustar00rootroot00000000000000" Author: Jeffrey Lau - https://github.com/zoonfafer " Description: Metals Language Server for Scala https://scalameta.org/metals/ call ale#Set('scala_metals_executable', 'metals') call ale#Set('scala_metals_project_root', '') function! ale_linters#scala#metals#GetProjectRoot(buffer) abort let l:project_root = ale#Var(a:buffer, 'scala_metals_project_root') if !empty(l:project_root) return l:project_root endif let l:potential_roots = [ \ 'build.sc', \ 'build.sbt', \ '.bloop', \ '.metals', \] for l:root in l:potential_roots let l:project_root = ale#path#ResolveLocalPath( \ a:buffer, \ l:root, \ '' \) if !empty(l:project_root) return fnamemodify( \ l:project_root, \ ':h', \) endif endfor return '' endfunction function! ale_linters#scala#metals#GetCommand(buffer) abort return '%e' . ale#Pad('stdio') endfunction call ale#linter#Define('scala', { \ 'name': 'metals', \ 'lsp': 'stdio', \ 'language': 'scala', \ 'executable': {b -> ale#Var(b, 'scala_metals_executable')}, \ 'command': function('ale_linters#scala#metals#GetCommand'), \ 'project_root': function('ale_linters#scala#metals#GetProjectRoot'), \}) ale-4.0.0/ale_linters/scala/sbtserver.vim000066400000000000000000000017361476501472200204130ustar00rootroot00000000000000" Author: ophirr33 " Description: TCP lsp client for sbt Server call ale#Set('scala_sbtserver_address', '127.0.0.1:4273') call ale#Set('scala_sbtserver_project_root', '') function! ale_linters#scala#sbtserver#GetProjectRoot(buffer) abort let l:project_root = ale#Var(a:buffer, 'scala_sbtserver_project_root') if l:project_root is? '' let l:project_root = ale#path#FindNearestFile(a:buffer, 'build.sbt') return !empty(l:project_root) ? fnamemodify(l:project_root, ':h') : '' endif return l:project_root endfunction function! ale_linters#scala#sbtserver#GetAddress(buffer) abort let l:address = ale#Var(a:buffer, 'scala_sbtserver_address') return l:address endfunction call ale#linter#Define('scala', { \ 'name': 'sbtserver', \ 'lsp': 'socket', \ 'address': function('ale_linters#scala#sbtserver#GetAddress'), \ 'language': 'scala', \ 'project_root': function('ale_linters#scala#sbtserver#GetProjectRoot'), \}) ale-4.0.0/ale_linters/scala/scalac.vim000066400000000000000000000007771476501472200176260ustar00rootroot00000000000000" Author: Zoltan Kalmar - https://github.com/kalmiz, " w0rp " Description: Basic scala support using scalac function! s:IsSbt(buffer) abort return index(split(getbufvar(a:buffer, '&filetype'), '\.'), 'sbt') >= 0 endfunction call ale#linter#Define('scala', { \ 'name': 'scalac', \ 'executable': {buf -> s:IsSbt(buf) ? '' : 'scalac'}, \ 'command': '%e -Ystop-after:parser %t', \ 'callback': 'ale#handlers#scala#HandleScalacLintFormat', \ 'output_stream': 'stderr', \}) ale-4.0.0/ale_linters/scala/scalastyle.vim000066400000000000000000000051141476501472200205320ustar00rootroot00000000000000" Author: Kevin Kays - https://github.com/okkays " Description: Support for the scalastyle checker. call ale#Set('scala_scalastyle_options', '') " TODO: Remove support for the old option name in ALE 3.0. call ale#Set('scala_scalastyle_config', \ get(g:, 'ale_scalastyle_config_loc', '') \) function! ale_linters#scala#scalastyle#Handle(buffer, lines) abort " Look for help output from scalastyle first, which indicates that no " configuration file was found. for l:line in a:lines[:10] if l:line =~# '-c, --config' return [{ \ 'lnum': 1, \ 'text': '(See :help ale-scala-scalastyle)' \ . ' No scalastyle configuration file was found.', \}] endif endfor " Matches patterns like the following: " " warning file=/home/blurble/Doop.scala message=Missing or badly formed ScalaDoc: Extra @param foobles line=190 let l:patterns = [ \ '^\(.\+\) .\+ message=\(.\+\) line=\(\d\+\)$', \ '^\(.\+\) .\+ message=\(.\+\) line=\(\d\+\) column=\(\d\+\)$', \] let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:patterns) let l:args = { \ 'lnum': l:match[3] + 0, \ 'type': l:match[1] =~? 'error' ? 'E' : 'W', \ 'text': l:match[2] \} if !empty(l:match[4]) let l:args['col'] = l:match[4] + 1 endif call add(l:output, l:args) endfor return l:output endfunction function! ale_linters#scala#scalastyle#GetCommand(buffer) abort " Search for scalastyle config in parent directories. let l:scalastyle_config = '' let l:potential_configs = [ \ 'scalastyle_config.xml', \ 'scalastyle-config.xml' \] for l:config in l:potential_configs let l:scalastyle_config = ale#path#ResolveLocalPath( \ a:buffer, \ l:config, \ '' \) if !empty(l:scalastyle_config) break endif endfor " If all else fails, try the global config. if empty(l:scalastyle_config) let l:scalastyle_config = ale#Var(a:buffer, 'scala_scalastyle_config') endif return 'scalastyle' \ . (!empty(l:scalastyle_config) ? ' --config ' . ale#Escape(l:scalastyle_config) : '') \ . ale#Pad(ale#Var(a:buffer, 'scala_scalastyle_options')) \ . ' %t' endfunction call ale#linter#Define('scala', { \ 'name': 'scalastyle', \ 'executable': 'scalastyle', \ 'output_stream': 'stdout', \ 'command': function('ale_linters#scala#scalastyle#GetCommand'), \ 'callback': 'ale_linters#scala#scalastyle#Handle', \}) ale-4.0.0/ale_linters/scss/000077500000000000000000000000001476501472200155405ustar00rootroot00000000000000ale-4.0.0/ale_linters/scss/sasslint.vim000066400000000000000000000020521476501472200201140ustar00rootroot00000000000000" Author: sQVe - https://github.com/sQVe call ale#Set('scss_sasslint_executable', 'sass-lint') call ale#Set('scss_sasslint_options', '') call ale#Set('scss_sasslint_use_global', get(g:, 'ale_use_global_executables', 0)) function! ale_linters#scss#sasslint#GetExecutable(buffer) abort return ale#path#FindExecutable(a:buffer, 'scss_sasslint', [ \ 'node_modules/sass-lint/bin/sass-lint.js', \ 'node_modules/.bin/sass-lint', \]) endfunction function! ale_linters#scss#sasslint#GetCommand(buffer) abort let l:executable = ale_linters#scss#sasslint#GetExecutable(a:buffer) let l:options = ale#Var(a:buffer, 'scss_sasslint_options') return ale#node#Executable(a:buffer, l:executable) \ . (!empty(l:options) ? ' ' . l:options : '') \ . ' -v -q -f compact %t' endfunction call ale#linter#Define('scss', { \ 'name': 'sasslint', \ 'executable': function('ale_linters#scss#sasslint#GetExecutable'), \ 'command': function('ale_linters#scss#sasslint#GetCommand'), \ 'callback': 'ale#handlers#css#HandleCSSLintFormat', \}) ale-4.0.0/ale_linters/scss/scsslint.vim000066400000000000000000000021311476501472200201140ustar00rootroot00000000000000" Author: w0rp " Description: This file add scsslint support for SCSS support function! ale_linters#scss#scsslint#Handle(buffer, lines) abort " Matches patterns like the following: " " test.scss:2:1 [W] Indentation: Line should be indented 2 spaces, but was indented 4 spaces let l:pattern = '^.*:\(\d\+\):\(\d*\) \[\([^\]]\+\)\] \(.\+\)$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) if !ale#Var(a:buffer, 'warn_about_trailing_whitespace') \&& l:match[4] =~# '^TrailingWhitespace' " Skip trailing whitespace warnings if that option is off. continue endif call add(l:output, { \ 'lnum': l:match[1] + 0, \ 'col': l:match[2] + 0, \ 'text': l:match[4], \ 'type': l:match[3] is# 'E' ? 'E' : 'W', \}) endfor return l:output endfunction call ale#linter#Define('scss', { \ 'name': 'scsslint', \ 'executable': 'scss-lint', \ 'command': 'scss-lint --stdin-file-path=%s', \ 'callback': 'ale_linters#scss#scsslint#Handle', \}) ale-4.0.0/ale_linters/scss/stylelint.vim000066400000000000000000000013401476501472200203020ustar00rootroot00000000000000" Author: diartyz call ale#Set('scss_stylelint_executable', 'stylelint') call ale#Set('scss_stylelint_options', '') call ale#Set('scss_stylelint_use_global', get(g:, 'ale_use_global_executables', 0)) function! ale_linters#scss#stylelint#GetCommand(buffer) abort return '%e ' . ale#Pad(ale#Var(a:buffer, 'scss_stylelint_options')) \ . ' --stdin-filename %s' endfunction call ale#linter#Define('scss', { \ 'name': 'stylelint', \ 'output_stream': 'both', \ 'executable': {b -> ale#path#FindExecutable(b, 'scss_stylelint', [ \ 'node_modules/.bin/stylelint', \ ])}, \ 'command': function('ale_linters#scss#stylelint#GetCommand'), \ 'callback': 'ale#handlers#css#HandleStyleLintFormat', \}) ale-4.0.0/ale_linters/sh/000077500000000000000000000000001476501472200151775ustar00rootroot00000000000000ale-4.0.0/ale_linters/sh/bashate.vim000066400000000000000000000025501476501472200173250ustar00rootroot00000000000000" Author: hsanson " Description: Lints sh files using bashate " URL: https://github.com/openstack/bashate call ale#Set('sh_bashate_executable', 'bashate') call ale#Set('sh_bashate_options', '') function! ale_linters#sh#bashate#GetExecutable(buffer) abort return ale#Var(a:buffer, 'sh_bashate_executable') endfunction function! ale_linters#sh#bashate#GetCommand(buffer) abort let l:options = ale#Var(a:buffer, 'sh_bashate_options') let l:executable = ale_linters#sh#bashate#GetExecutable(a:buffer) return ale#Escape(l:executable) . ' ' . l:options . ' ' . '%t' endfunction function! ale_linters#sh#bashate#Handle(buffer, lines) abort " Matches patterns line the following: " " /path/to/script/file:694:1: E003 Indent not multiple of 4 let l:pattern = ':\(\d\+\):\(\d\+\): \(.*\)$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) call add(l:output, { \ 'lnum': str2nr(l:match[1]), \ 'col': str2nr(l:match[2]), \ 'text': l:match[3], \}) endfor return l:output endfunction call ale#linter#Define('sh', { \ 'name': 'bashate', \ 'output_stream': 'stdout', \ 'executable': function('ale_linters#sh#bashate#GetExecutable'), \ 'command': function('ale_linters#sh#bashate#GetCommand'), \ 'callback': 'ale_linters#sh#bashate#Handle', \}) ale-4.0.0/ale_linters/sh/cspell.vim000066400000000000000000000002311476501472200171720ustar00rootroot00000000000000scriptencoding utf-8 " Author: David Houston " Description: cspell support for shell scripts. call ale#handlers#cspell#DefineLinter('sh') ale-4.0.0/ale_linters/sh/language_server.vim000066400000000000000000000023051476501472200210650ustar00rootroot00000000000000" Author: Christian Höltje (https://docwhat.org/) " Description: BASH Language server integration for ALE scriptencoding utf-8 call ale#Set('sh_language_server_executable', 'bash-language-server') call ale#Set('sh_language_server_use_global', get(g:, 'ale_use_global_executables', 0)) function! ale_linters#sh#language_server#GetExecutable(buffer) abort return ale#path#FindExecutable(a:buffer, 'sh_language_server', [ \ 'node_modules/.bin/bash-language-server', \]) endfunction function! ale_linters#sh#language_server#GetCommand(buffer) abort let l:exe = ale#Escape(ale_linters#sh#language_server#GetExecutable(a:buffer)) return l:exe . ' start' endfunction function! ale_linters#sh#language_server#GetProjectRoot(buffer) abort let l:git_path = ale#path#FindNearestDirectory(a:buffer, '.git') return !empty(l:git_path) ? fnamemodify(l:git_path, ':h:h') : '' endfunction call ale#linter#Define('sh', { \ 'name': 'language_server', \ 'lsp': 'stdio', \ 'executable': function('ale_linters#sh#language_server#GetExecutable'), \ 'command': function('ale_linters#sh#language_server#GetCommand'), \ 'project_root': function('ale_linters#sh#language_server#GetProjectRoot'), \}) ale-4.0.0/ale_linters/sh/shell.vim000066400000000000000000000033601476501472200170250ustar00rootroot00000000000000" Author: w0rp " Description: Lints shell files by invoking the shell with -n " This option can be changed to change the default shell when the shell " cannot be taken from the hashbang line. if !exists('g:ale_sh_shell_default_shell') let g:ale_sh_shell_default_shell = fnamemodify($SHELL, ':t') if g:ale_sh_shell_default_shell is# '' || g:ale_sh_shell_default_shell is# 'fish' let g:ale_sh_shell_default_shell = 'bash' endif endif function! ale_linters#sh#shell#GetExecutable(buffer) abort let l:shell_type = ale#handlers#sh#GetShellType(a:buffer) if !empty(l:shell_type) return l:shell_type endif return ale#Var(a:buffer, 'sh_shell_default_shell') endfunction function! ale_linters#sh#shell#GetCommand(buffer) abort return ale_linters#sh#shell#GetExecutable(a:buffer) . ' -n %t' endfunction function! ale_linters#sh#shell#Handle(buffer, lines) abort " Matches patterns line the following: " " bash: line 13: syntax error near unexpected token `d' " bash:行0: 未预期的符号“done”附近有语法错误 " bash: 列 90: 尋找匹配的「"」時遇到了未預期的檔案結束符 " sh: 11: Syntax error: "(" unexpected let l:pattern = '\v([^:]+:\D*)(\d+): (.+)$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) call add(l:output, { \ 'lnum': str2nr(l:match[2]), \ 'text': l:match[3], \}) endfor return l:output endfunction call ale#linter#Define('sh', { \ 'name': 'shell', \ 'output_stream': 'stderr', \ 'executable': function('ale_linters#sh#shell#GetExecutable'), \ 'command': function('ale_linters#sh#shell#GetCommand'), \ 'callback': 'ale_linters#sh#shell#Handle', \}) ale-4.0.0/ale_linters/sh/shellcheck.vim000066400000000000000000000002101476501472200200120ustar00rootroot00000000000000" Author: w0rp " Description: shellcheck linter for shell scripts. call ale#handlers#shellcheck#DefineLinter('sh') ale-4.0.0/ale_linters/slim/000077500000000000000000000000001476501472200155315ustar00rootroot00000000000000ale-4.0.0/ale_linters/slim/slimlint.vim000066400000000000000000000033251476501472200201040ustar00rootroot00000000000000" Author: Markus Doits - https://github.com/doits " Description: slim-lint for Slim files function! ale_linters#slim#slimlint#GetCommand(buffer) abort let l:command = 'slim-lint %t' let l:rubocop_config = ale#path#FindNearestFile(a:buffer, '.rubocop.yml') " Set SLIM_LINT_RUBOCOP_CONF variable as it is needed for slim-lint to " pick up the rubocop config. " " See https://github.com/sds/slim-lint/blob/master/lib/slim_lint/linter/README.md#rubocop if !empty(l:rubocop_config) if has('win32') let l:command = 'set SLIM_LINT_RUBOCOP_CONF=' . ale#Escape(l:rubocop_config) . ' && ' . l:command else let l:command = 'SLIM_LINT_RUBOCOP_CONF=' . ale#Escape(l:rubocop_config) . ' ' . l:command endif endif return l:command endfunction function! ale_linters#slim#slimlint#Handle(buffer, lines) abort " Matches patterns like the following: " :5 [W] LineLength: Line is too long. [150/120] let l:pattern = '\v^.*:(\d+) \[([EW])\] (.+)$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) let l:item = { \ 'lnum': l:match[1] + 0, \ 'type': l:match[2], \ 'text': l:match[3] \} let l:code_match = matchlist(l:item.text, '\v^([^:]+): (.+)$') if !empty(l:code_match) let l:item.code = l:code_match[1] let l:item.text = l:code_match[2] endif call add(l:output, l:item) endfor return l:output endfunction call ale#linter#Define('slim', { \ 'name': 'slimlint', \ 'executable': 'slim-lint', \ 'command': function('ale_linters#slim#slimlint#GetCommand'), \ 'callback': 'ale_linters#slim#slimlint#Handle' \}) ale-4.0.0/ale_linters/sml/000077500000000000000000000000001476501472200153605ustar00rootroot00000000000000ale-4.0.0/ale_linters/sml/smlnj.vim000066400000000000000000000005171476501472200172230ustar00rootroot00000000000000" Author: Paulo Alem , Jake Zimmerman " Description: Single-file SML checking with SML/NJ compiler call ale#linter#Define('sml', { \ 'name': 'smlnj', \ 'executable': function('ale#handlers#sml#GetExecutableSmlnjFile'), \ 'command': 'sml', \ 'callback': 'ale#handlers#sml#Handle', \}) ale-4.0.0/ale_linters/sml/smlnj_cm.vim000066400000000000000000000012621476501472200177000ustar00rootroot00000000000000" Author: Jake Zimmerman " Description: SML checking with SML/NJ Compilation Manager function! ale_linters#sml#smlnj_cm#GetCommand(buffer) abort let l:cmfile = ale#handlers#sml#GetCmFile(a:buffer) return 'sml -m ' . l:cmfile . ' < /dev/null' endfunction " Using CM requires that we set "lint_file: 1", since it reads the files " from the disk itself. call ale#linter#Define('sml', { \ 'name': 'smlnj_cm', \ 'aliases': ['smlnj-cm'], \ 'executable': function('ale#handlers#sml#GetExecutableSmlnjCm'), \ 'lint_file': 1, \ 'command': function('ale_linters#sml#smlnj_cm#GetCommand'), \ 'callback': 'ale#handlers#sml#Handle', \}) " vim:ts=4:sts=4:sw=4 ale-4.0.0/ale_linters/solidity/000077500000000000000000000000001476501472200164255ustar00rootroot00000000000000ale-4.0.0/ale_linters/solidity/solc.vim000066400000000000000000000033241476501472200201040ustar00rootroot00000000000000" Author: Karl Bartel - http://karl.berlin/ " Description: Report solc compiler errors in Solidity code call ale#Set('solidity_solc_executable', 'solc') call ale#Set('solidity_solc_options', '') function! ale_linters#solidity#solc#Handle(buffer, lines) abort " Matches patterns like the following: " Error: Expected ';' but got '(' " --> /path/to/file/file.sol:1:10:) let l:pattern = '\v(Error|Warning): (.*)$' let l:line_and_column_pattern = '\v\.sol:(\d+):(\d+):' let l:output = [] for l:line in a:lines let l:match = matchlist(l:line, l:pattern) if len(l:match) == 0 let l:match = matchlist(l:line, l:line_and_column_pattern) if len(l:match) > 0 let l:index = len(l:output) - 1 let l:output[l:index]['lnum'] = l:match[1] + 0 let l:output[l:index]['col'] = l:match[2] + 0 endif else let l:isError = l:match[1] is? 'Error' call add(l:output, { \ 'lnum': 0, \ 'col': 0, \ 'text': l:match[2], \ 'type': l:isError ? 'E' : 'W', \}) endif endfor return l:output endfunction function! ale_linters#solidity#solc#GetCommand(buffer) abort let l:executable = ale#Var(a:buffer, 'solidity_solc_executable') return l:executable . ale#Pad(ale#Var(a:buffer, 'solidity_solc_options')) . ' %s' endfunction call ale#linter#Define('solidity', { \ 'name': 'solc', \ 'executable': {b -> ale#Var(b, 'solidity_solc_executable')}, \ 'command': function('ale_linters#solidity#solc#GetCommand'), \ 'callback': 'ale_linters#solidity#solc#Handle', \ 'output_stream': 'stderr', \}) ale-4.0.0/ale_linters/solidity/solhint.vim000066400000000000000000000061511476501472200206250ustar00rootroot00000000000000" Authors: Franco Victorio <@fvictorio>, Henrique Barcelos <@hbarcelos> " Description: Report errors in Solidity code with solhint call ale#Set('solidity_solhint_options', '') call ale#Set('solidity_solhint_executable', 'solhint') call ale#Set('solidity_solhint_use_global', get(g:, 'ale_use_global_executables', 0)) function! ale_linters#solidity#solhint#Handle(buffer, lines) abort let l:output = [] " Matches lines like the following: " contracts/Bounty.sol:14:3: Expected indentation of 4 spaces but found 2 [Error/indent] let l:lint_pattern = '\v^[^:]+:(\d+):(\d+): %(Parse error: )@ \ ale#node#Executable(b, ale_linters#solidity#solhint#GetExecutable(b)) \ . ale#Pad(ale#Var(b, 'solidity_solhint_options')) \ . ' --formatter unix %s' \ }, \ 'callback': 'ale_linters#solidity#solhint#Handle', \}) ale-4.0.0/ale_linters/solidity/solium.vim000066400000000000000000000004701476501472200204530ustar00rootroot00000000000000" Author: Jeff Sutherland - https://github.com/jdsutherland " Description: Report errors in Solidity code with solium call ale#linter#Define('solidity', { \ 'name': 'solium', \ 'executable': 'solium', \ 'command': 'solium --reporter gcc --file %t', \ 'callback': 'ale#handlers#gcc#HandleGCCFormat', \}) ale-4.0.0/ale_linters/spec/000077500000000000000000000000001476501472200155175ustar00rootroot00000000000000ale-4.0.0/ale_linters/spec/rpmlint.vim000066400000000000000000000062521476501472200177260ustar00rootroot00000000000000" Author: Jason Tibbitts " Description: Adds support for checking RPM spec files with rpmlint " rpmlint will produce varions types of output: " " Lines like the following are output when the file is simply not able to be " parsed by rpmspec -P: " apcupsd.spec: E: specfile-error warning: bogus date in %changelog: Mon Oct 1 2005 - Foo " apcupsd.spec: E: specfile-error error: %changelog not in descending chronological order " They do not contain a line number, and there's not a whole lot that can be " done to locate them besides grep for them. rpmlint is just passing the " output from rpm along with the filename, an error indicator, and an error " type. " " Lines like the following: " cyrus-imapd.spec:23: W: macro-in-comment %version " cyrus-imapd.spec:18: E: hardcoded-library-path in %_prefix/lib/%name " indicate warnings and errors, respectively. No column numbers are provided " " Lines like: " apcupsd.spec: I: checking " apcupsd.spec: I: checking-url https://downloads.sourceforge.net/apcupsd/apcupsd-3.14.14.tar.gz (timeout 10 seconds) " are merely informational and are only output when -v is passed. But they " may be useful in a log to know why things are taking so long. " " And this is always output at the end and should just be ignored: " 0 packages and 1 specfiles checked; 4 errors, 0 warnings. call ale#Set('spec_rpmlint_executable', 'rpmlint') call ale#Set('spec_rpmlint_options', '') function! ale_linters#spec#rpmlint#GetCommand(buffer, version) abort if ale#semver#GTE(a:version, [2, 0, 0]) " The -o/--option flag was removed in version 2.0.0 let l:version_dependent_args = '' else let l:version_dependent_args = ' -o "NetworkEnabled False"' endif return '%e' \ . ale#Pad(ale#Var(a:buffer, 'spec_rpmlint_options')) \ . ' -v' \ . l:version_dependent_args \ . ' %t' endfunction function! ale_linters#spec#rpmlint#Handle(buffer, lines) abort " let l:pat_inform = '^.\+: I: \(.+\)' let l:pat_errwarn = '^.\+:\(\d\+\): \([EW]\): \(.\+\)' let l:pat_baderr = '^.\+: E: \(.\+\)' let l:output = [] for l:line in a:lines let l:match_errwarn = matchlist(l:line, l:pat_errwarn) let l:match_baderr = matchlist(l:line, l:pat_baderr) if len(l:match_errwarn) > 0 let l:text = l:match_errwarn[3] let l:type = l:match_errwarn[2] let l:lnum = l:match_errwarn[1] + 0 elseif len(l:match_baderr) > 0 let l:text = l:match_baderr[1] let l:type = 'E' let l:lnum = 1 else continue endif call add(l:output, { \ 'bufnr': a:buffer, \ 'lnum': l:lnum, \ 'text': l:text, \ 'type': l:type, \}) endfor return l:output endfunction call ale#linter#Define('spec', { \ 'name': 'rpmlint', \ 'executable': {b -> ale#Var(b, 'spec_rpmlint_executable')}, \ 'command': {buffer -> ale#semver#RunWithVersionCheck( \ buffer, \ ale#Var(buffer, 'spec_rpmlint_executable'), \ '%e --version', \ function('ale_linters#spec#rpmlint#GetCommand'), \ )}, \ 'callback': 'ale_linters#spec#rpmlint#Handle', \}) ale-4.0.0/ale_linters/sql/000077500000000000000000000000001476501472200153645ustar00rootroot00000000000000ale-4.0.0/ale_linters/sql/sqlfluff.vim000066400000000000000000000061341476501472200177270ustar00rootroot00000000000000" Author: Carl Smedstad " Description: sqlfluff for SQL files let g:ale_sql_sqlfluff_executable = \ get(g:, 'ale_sql_sqlfluff_executable', 'sqlfluff') let g:ale_sql_sqlfluff_options = \ get(g:, 'ale_sql_sqlfluff_options', '') function! ale_linters#sql#sqlfluff#Executable(buffer) abort return ale#Var(a:buffer, 'sql_sqlfluff_executable') endfunction function! ale_linters#sql#sqlfluff#Command(buffer, version) abort let l:executable = ale_linters#sql#sqlfluff#Executable(a:buffer) let l:options = ale#Var(a:buffer, 'sql_sqlfluff_options') let l:cmd = \ ale#Escape(l:executable) \ . ' lint' let l:config_file = ale#path#FindNearestFile(a:buffer, '.sqlfluff') if !empty(l:config_file) let l:cmd .= ' --config ' . ale#Escape(l:config_file) else let l:cmd .= ' --dialect ansi' endif let l:cmd .= \ ' --format json ' \ . l:options \ . ' %t' return l:cmd endfunction function! ale_linters#sql#sqlfluff#Handle(buffer, version, lines) abort let l:output = [] let l:json_lines = ale#util#FuzzyJSONDecode(a:lines, []) if empty(l:json_lines) return l:output endif let l:json = l:json_lines[0] " if there's no warning, 'result' is `null`. if empty(get(l:json, 'violations')) return l:output endif if ale#semver#GTE(a:version, [3, 0, 0]) for l:violation in get(l:json, 'violations', []) let l:err = { \ 'filename': l:json.filepath, \ 'lnum': l:violation.start_line_no, \ 'col': l:violation.start_line_pos, \ 'text': l:violation.description, \ 'code': l:violation.code, \ 'type': 'W', \} if has_key(l:violation, 'end_line_no') let l:err.end_lnum = l:violation.end_line_no endif if has_key(l:violation, 'end_line_pos') let l:err.end_col = l:violation.end_line_pos endif call add(l:output, l:err) endfor else for l:violation in get(l:json, 'violations', []) call add(l:output, { \ 'filename': l:json.filepath, \ 'lnum': l:violation.line_no, \ 'col': l:violation.line_pos, \ 'text': l:violation.description, \ 'code': l:violation.code, \ 'type': 'W', \}) endfor endif return l:output endfunction call ale#linter#Define('sql', { \ 'name': 'sqlfluff', \ 'executable': function('ale_linters#sql#sqlfluff#Executable'), \ 'command': {buffer -> ale#semver#RunWithVersionCheck( \ buffer, \ ale_linters#sql#sqlfluff#Executable(buffer), \ '%e --version', \ function('ale_linters#sql#sqlfluff#Command'), \ )}, \ 'callback': {buffer, lines -> ale#semver#RunWithVersionCheck( \ buffer, \ ale_linters#sql#sqlfluff#Executable(buffer), \ '%e --version', \ {buffer, version -> ale_linters#sql#sqlfluff#Handle( \ buffer, \ l:version, \ lines)}, \ )}, \}) ale-4.0.0/ale_linters/sql/sqlint.vim000066400000000000000000000014011476501472200174070ustar00rootroot00000000000000" Author: Adriaan Zonnenberg " Description: sqlint for SQL files function! ale_linters#sql#sqlint#Handle(buffer, lines) abort " Matches patterns like the following: " " stdin:3:1:ERROR syntax error at or near "WIBBLE" let l:pattern = '\v^[^:]+:(\d+):(\d+):(\u+) (.*)' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) call add(l:output, { \ 'lnum': l:match[1] + 0, \ 'col': l:match[2] + 0, \ 'type': l:match[3][0], \ 'text': l:match[4], \}) endfor return l:output endfunction call ale#linter#Define('sql', { \ 'name': 'sqlint', \ 'executable': 'sqlint', \ 'command': 'sqlint', \ 'callback': 'ale_linters#sql#sqlint#Handle', \}) ale-4.0.0/ale_linters/sql/sqllint.vim000066400000000000000000000017161476501472200175740ustar00rootroot00000000000000" ale_linters/sql/sqllint.vim " Author: Joe Reynolds " Description: sql-lint for SQL files. " sql-lint can be found at " https://www.npmjs.com/package/sql-lint " https://github.com/joereynolds/sql-lint function! ale_linters#sql#sqllint#Handle(buffer, lines) abort " Matches patterns like the following: " " stdin:1 [ER_NO_DB_ERROR] No database selected let l:pattern = '\v^[^:]+:(\d+) (.*)' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) call add(l:output, { \ 'lnum': l:match[1] + 0, \ 'col': l:match[2] + 0, \ 'type': l:match[3][0], \ 'text': l:match[0], \}) endfor return l:output endfunction call ale#linter#Define('sql', { \ 'name': 'sqllint', \ 'aliases': ['sql-lint'], \ 'executable': 'sql-lint', \ 'command': 'sql-lint', \ 'callback': 'ale_linters#sql#sqllint#Handle', \}) ale-4.0.0/ale_linters/stylus/000077500000000000000000000000001476501472200161305ustar00rootroot00000000000000ale-4.0.0/ale_linters/stylus/stylelint.vim000066400000000000000000000014211476501472200206720ustar00rootroot00000000000000" Author: diartyz , w0rp call ale#Set('stylus_stylelint_executable', 'stylelint') call ale#Set('stylus_stylelint_options', '') call ale#Set('stylus_stylelint_use_global', get(g:, 'ale_use_global_executables', 0)) function! ale_linters#stylus#stylelint#GetCommand(buffer) abort return '%e' \ . ale#Pad(ale#Var(a:buffer, 'stylus_stylelint_options')) \ . ' --stdin-filename %s' endfunction call ale#linter#Define('stylus', { \ 'name': 'stylelint', \ 'output_stream': 'both', \ 'executable': {b -> ale#path#FindExecutable(b, 'stylus_stylelint', [ \ 'node_modules/.bin/stylelint', \ ])}, \ 'command': function('ale_linters#stylus#stylelint#GetCommand'), \ 'callback': 'ale#handlers#css#HandleStyleLintFormat', \}) ale-4.0.0/ale_linters/sugarss/000077500000000000000000000000001476501472200162545ustar00rootroot00000000000000ale-4.0.0/ale_linters/sugarss/stylelint.vim000066400000000000000000000015171476501472200210240ustar00rootroot00000000000000" Author: toastal " Description: `stylelint` linter for SugarSS files call ale#Set('sugarss_stylelint_executable', 'stylelint') call ale#Set('sugarss_stylelint_options', '') call ale#Set('sugarss_stylelint_use_global', get(g:, 'ale_use_global_executables', 0)) function! ale_linters#sugarss#stylelint#GetCommand(buffer) abort return '%e ' . ale#Pad(ale#Var(a:buffer, 'sugarss_stylelint_options')) \ . ' --syntax=sugarss' \ . ' --stdin-filename %s' endfunction call ale#linter#Define('sugarss', { \ 'name': 'stylelint', \ 'output_stream': 'both', \ 'executable': {b -> ale#path#FindExecutable(b, 'sugarss_stylelint', [ \ 'node_modules/.bin/stylelint', \ ])}, \ 'command': function('ale_linters#sugarss#stylelint#GetCommand'), \ 'callback': 'ale#handlers#css#HandleStyleLintFormat', \}) ale-4.0.0/ale_linters/svelte/000077500000000000000000000000001476501472200160675ustar00rootroot00000000000000ale-4.0.0/ale_linters/svelte/svelteserver.vim000066400000000000000000000014611476501472200213370ustar00rootroot00000000000000" Author: Joakim Repomaa " Description: Svelte Language Server integration for ALE call ale#Set('svelte_svelteserver_executable', 'svelteserver') call ale#Set('svelte_svelteserver_use_global', get(g:, 'ale_use_global_executables', 0)) function! ale_linters#svelte#svelteserver#GetProjectRoot(buffer) abort let l:package_path = ale#path#FindNearestFile(a:buffer, 'package.json') return !empty(l:package_path) ? fnamemodify(l:package_path, ':h') : '' endfunction call ale#linter#Define('svelte', { \ 'name': 'svelteserver', \ 'lsp': 'stdio', \ 'executable': {b -> ale#path#FindExecutable(b, 'svelte_svelteserver', [ \ 'node_modules/.bin/svelteserver', \ ])}, \ 'command': '%e --stdio', \ 'project_root': function('ale_linters#svelte#svelteserver#GetProjectRoot'), \}) ale-4.0.0/ale_linters/swift/000077500000000000000000000000001476501472200157215ustar00rootroot00000000000000ale-4.0.0/ale_linters/swift/appleswiftformat.vim000066400000000000000000000031731476501472200220310ustar00rootroot00000000000000" Authors: Klaas Pieter Annema , bosr " Description: Support for swift-format https://github.com/apple/swift-format function! ale_linters#swift#appleswiftformat#GetLinterCommand(buffer) abort let l:command_args = ale#swift#GetAppleSwiftFormatCommand(a:buffer) . ' lint %t' let l:config_args = ale#swift#GetAppleSwiftFormatConfigArgs(a:buffer) if l:config_args isnot# '' let l:command_args = l:command_args . ' ' . l:config_args endif return l:command_args endfunction function! ale_linters#swift#appleswiftformat#Handle(buffer, lines) abort " Matches the typical output of swift-format, that is lines of the following pattern: " " Sources/main.swift:4:21: warning: [DoNotUseSemicolons] remove ';' and move the next statement to the new line " Sources/main.swift:3:12: warning: [Spacing] remove 1 space let l:pattern = '\v^.*:(\d+):(\d+): (\S+): \[(\S+)\] (.*)$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) call add(l:output, { \ 'lnum': l:match[1] + 0, \ 'col': l:match[2] + 0, \ 'type': l:match[3] is# 'error' ? 'E' : 'W', \ 'code': l:match[4], \ 'text': l:match[5], \}) endfor return l:output endfunction call ale#linter#Define('swift', { \ 'name': 'apple-swift-format', \ 'executable': function('ale#swift#GetAppleSwiftFormatExecutable'), \ 'command': function('ale_linters#swift#appleswiftformat#GetLinterCommand'), \ 'output_stream': 'stderr', \ 'language': 'swift', \ 'callback': 'ale_linters#swift#appleswiftformat#Handle' \}) ale-4.0.0/ale_linters/swift/cspell.vim000066400000000000000000000002321476501472200177150ustar00rootroot00000000000000scriptencoding utf-8 " Author: David Houston " Description: cspell support for Swift files. call ale#handlers#cspell#DefineLinter('swift') ale-4.0.0/ale_linters/swift/sourcekitlsp.vim000066400000000000000000000007341476501472200211710ustar00rootroot00000000000000" Author: Dan Loman " Description: Support for sourcekit-lsp https://github.com/apple/sourcekit-lsp call ale#Set('sourcekit_lsp_executable', 'sourcekit-lsp') call ale#linter#Define('swift', { \ 'name': 'sourcekitlsp', \ 'aliases': ['sourcekit'], \ 'lsp': 'stdio', \ 'executable': {b -> ale#Var(b, 'sourcekit_lsp_executable')}, \ 'command': '%e', \ 'project_root': function('ale#swift#FindProjectRoot'), \ 'language': 'swift', \}) ale-4.0.0/ale_linters/swift/swiftlint.vim000066400000000000000000000042631476501472200204660ustar00rootroot00000000000000" Author: David Mohundro , Gordon Fontenot " Description: swiftlint for swift files call ale#Set('swift_swiftlint_executable', 'swiftlint') call ale#Set('swift_swiftlint_use_global', get(g:, 'ale_use_global_executables', 0)) function! ale_linters#swift#swiftlint#GetExecutable(buffer) abort return ale#path#FindExecutable(a:buffer, 'swift_swiftlint', [ \ 'Pods/SwiftLint/swiftlint', \ 'ios/Pods/SwiftLint/swiftlint', \ 'swiftlint', \]) endfunction function! ale_linters#swift#swiftlint#GetCommand(buffer) abort let l:executable = ale_linters#swift#swiftlint#GetExecutable(a:buffer) let l:args = 'lint --use-stdin' return ale#Escape(l:executable) \ . ' ' .l:args endfunction function! ale_linters#swift#swiftlint#Handle(buffer, lines) abort let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):(\d+)?:? ([^:]+): (.+)$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) let l:item = { \ 'lnum': str2nr(l:match[2]), \ 'type': l:match[4] is# 'error' ? 'E' : 'W', \ 'text': l:match[5], \} if l:match[4] is# 'error' let l:item.type = 'E' elseif l:match[4] is# 'note' let l:item.type = 'I' endif if !empty(l:match[3]) let l:item.col = str2nr(l:match[3]) endif " If the filename is something like , or -, then " this is an error for the file we checked. if l:match[1] isnot# '-' && l:match[1][0] isnot# '<' let l:item['filename'] = l:match[1] endif " Parse the code if it's there. let l:code_match = matchlist(l:item.text, '\v^(.+) \(([^ (]+)\)$') if !empty(l:code_match) let l:item.text = l:code_match[1] let l:item.code = l:code_match[2] endif call add(l:output, l:item) endfor return l:output endfunction call ale#linter#Define('swift', { \ 'name': 'swiftlint', \ 'executable': function('ale_linters#swift#swiftlint#GetExecutable'), \ 'command': function('ale_linters#swift#swiftlint#GetCommand'), \ 'callback': 'ale_linters#swift#swiftlint#Handle', \}) ale-4.0.0/ale_linters/systemd/000077500000000000000000000000001476501472200162555ustar00rootroot00000000000000ale-4.0.0/ale_linters/systemd/systemd_analyze.vim000066400000000000000000000011111476501472200221770ustar00rootroot00000000000000function! ale_linters#systemd#systemd_analyze#Handle(buffer, lines) abort return ale#util#MapMatches(a:lines, '\v(.+):([0-9]+): (.+)', {match -> { \ 'lnum': str2nr(match[2]), \ 'col': 1, \ 'type': 'W', \ 'text': match[3], \}}) endfunction call ale#linter#Define('systemd', { \ 'name': 'systemd_analyze', \ 'aliases': ['systemd-analyze'], \ 'executable': 'systemd-analyze', \ 'command': 'SYSTEMD_LOG_COLOR=0 %e --user verify %s', \ 'callback': 'ale_linters#systemd#systemd_analyze#Handle', \ 'output_stream': 'both', \ 'lint_file': 1, \}) ale-4.0.0/ale_linters/tcl/000077500000000000000000000000001476501472200153475ustar00rootroot00000000000000ale-4.0.0/ale_linters/tcl/nagelfar.vim000066400000000000000000000024261476501472200176470ustar00rootroot00000000000000" Author: Nick James " Description: nagelfar linter for tcl files call ale#Set('tcl_nagelfar_executable', 'nagelfar.tcl') call ale#Set('tcl_nagelfar_options', '') function! ale_linters#tcl#nagelfar#GetCommand(buffer) abort let l:options = ale#Var(a:buffer, 'tcl_nagelfar_options') return '%e' . ale#Pad(l:options) . ' %s' endfunction function! ale_linters#tcl#nagelfar#Handle(buffer, lines) abort " Matches patterns like the following: " Line 5: W Found constant "bepa" which is also a variable. " Line 13: E Wrong number of arguments (3) to "set" " Line 93: N Close brace not aligned with line 90 (4 0) let l:pattern = '^Line\s\+\([0-9]\+\): \([NEW]\) \(.*\)$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) call add(l:output, { \ 'lnum': l:match[1] + 0, \ 'type': l:match[2] is# 'N' ? 'W' : l:match[2], \ 'text': l:match[3], \}) endfor return l:output endfunction call ale#linter#Define('tcl', { \ 'name': 'nagelfar', \ 'output_stream': 'stdout', \ 'executable': {b -> ale#Var(b, 'tcl_nagelfar_executable')}, \ 'command': function('ale_linters#tcl#nagelfar#GetCommand'), \ 'callback': 'ale_linters#tcl#nagelfar#Handle', \ 'lint_file': 1, \}) ale-4.0.0/ale_linters/terraform/000077500000000000000000000000001476501472200165665ustar00rootroot00000000000000ale-4.0.0/ale_linters/terraform/checkov.vim000066400000000000000000000030451476501472200207270ustar00rootroot00000000000000" Author: Thyme-87 " Description: use checkov for providing warnings via ale call ale#Set('terraform_checkov_executable', 'checkov') call ale#Set('terraform_checkov_options', '') function! ale_linters#terraform#checkov#GetExecutable(buffer) abort return ale#Var(a:buffer, 'terraform_checkov_executable') endfunction function! ale_linters#terraform#checkov#GetCommand(buffer) abort return '%e ' . '-f %t -o json --quiet ' . ale#Var(a:buffer, 'terraform_checkov_options') endfunction function! ale_linters#terraform#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('terraform', { \ 'name': 'checkov', \ 'output_stream': 'stdout', \ 'executable': function('ale_linters#terraform#checkov#GetExecutable'), \ 'command': function('ale_linters#terraform#checkov#GetCommand'), \ 'callback': 'ale_linters#terraform#checkov#Handle', \}) ale-4.0.0/ale_linters/terraform/terraform.vim000066400000000000000000000044371476501472200213140ustar00rootroot00000000000000" Author: Keith Maxwell " Description: terraform fmt to check for errors call ale#Set('terraform_terraform_executable', 'terraform') function! ale_linters#terraform#terraform#GetExecutable(buffer) abort return ale#Var(a:buffer, 'terraform_terraform_executable') endfunction function! ale_linters#terraform#terraform#GetCommand(buffer) abort return ale#Escape(ale_linters#terraform#terraform#GetExecutable(a:buffer)) \ . ' validate -no-color -json ' endfunction function! ale_linters#terraform#terraform#GetType(severity) abort if a:severity is? 'warning' return 'W' endif return 'E' endfunction function! ale_linters#terraform#terraform#GetDetail(error) abort let l:detail = get(a:error, 'detail', '') if strlen(l:detail) > 0 return l:detail else return get(a:error, 'summary', '') endif endfunction function! ale_linters#terraform#terraform#Handle(buffer, lines) abort let l:output = [] let l:errors = ale#util#FuzzyJSONDecode(a:lines, {'diagnostics': []}) let l:dir = expand('#' . a:buffer . ':p:h') let l:file = expand('#' . a:buffer . ':p') for l:error in l:errors['diagnostics'] if has_key(l:error, 'range') call add(l:output, { \ 'filename': ale#path#GetAbsPath(l:dir, l:error['range']['filename']), \ 'lnum': l:error['range']['start']['line'], \ 'col': l:error['range']['start']['column'], \ 'text': ale_linters#terraform#terraform#GetDetail(l:error), \ 'type': ale_linters#terraform#terraform#GetType(l:error['severity']), \}) else call add(l:output, { \ 'filename': l:file, \ 'lnum': 0, \ 'col': 0, \ 'text': ale_linters#terraform#terraform#GetDetail(l:error), \ 'type': ale_linters#terraform#terraform#GetType(l:error['severity']), \}) endif endfor return l:output endfunction call ale#linter#Define('terraform', { \ 'name': 'terraform', \ 'output_stream': 'stdout', \ 'executable': function('ale_linters#terraform#terraform#GetExecutable'), \ 'command': function('ale_linters#terraform#terraform#GetCommand'), \ 'callback': 'ale_linters#terraform#terraform#Handle', \}) ale-4.0.0/ale_linters/terraform/terraform_ls.vim000066400000000000000000000027041476501472200220050ustar00rootroot00000000000000" Author: Horacio Sanson " Description: terraform-ls integration for ALE (cf. https://github.com/hashicorp/terraform-ls) call ale#Set('terraform_terraform_executable', 'terraform') call ale#Set('terraform_ls_executable', 'terraform-ls') call ale#Set('terraform_ls_options', '') function! ale_linters#terraform#terraform_ls#GetTerraformExecutable(buffer) abort let l:terraform_executable = ale#Var(a:buffer, 'terraform_terraform_executable') if(ale#path#IsAbsolute(l:terraform_executable)) return '-tf-exec ' . l:terraform_executable endif return '' endfunction function! ale_linters#terraform#terraform_ls#GetCommand(buffer) abort return '%e' \ . ale#Pad('serve') \ . ale#Pad(ale_linters#terraform#terraform_ls#GetTerraformExecutable(a:buffer)) \ . ale#Pad(ale#Var(a:buffer, 'terraform_ls_options')) endfunction function! ale_linters#terraform#terraform_ls#GetProjectRoot(buffer) abort let l:tf_dir = ale#path#FindNearestDirectory(a:buffer, '.terraform') return !empty(l:tf_dir) ? fnamemodify(l:tf_dir, ':h:h') : '' endfunction call ale#linter#Define('terraform', { \ 'name': 'terraform_ls', \ 'aliases': ['terraformls'], \ 'lsp': 'stdio', \ 'executable': {b -> ale#Var(b, 'terraform_ls_executable')}, \ 'command': function('ale_linters#terraform#terraform_ls#GetCommand'), \ 'project_root': function('ale_linters#terraform#terraform_ls#GetProjectRoot'), \ 'language': 'terraform', \}) ale-4.0.0/ale_linters/terraform/terraform_lsp.vim000066400000000000000000000017461476501472200221720ustar00rootroot00000000000000" Author: OJFord " Description: terraform-lsp integration for ALE (cf. https://github.com/juliosueiras/terraform-lsp) call ale#Set('terraform_langserver_executable', 'terraform-lsp') call ale#Set('terraform_langserver_options', '') function! ale_linters#terraform#terraform_lsp#GetCommand(buffer) abort return '%e' \ . ale#Pad(ale#Var(a:buffer, 'terraform_langserver_options')) endfunction function! ale_linters#terraform#terraform_lsp#GetProjectRoot(buffer) abort let l:tf_dir = ale#path#FindNearestDirectory(a:buffer, '.terraform') return !empty(l:tf_dir) ? fnamemodify(l:tf_dir, ':h:h') : '' endfunction call ale#linter#Define('terraform', { \ 'name': 'terraform_lsp', \ 'lsp': 'stdio', \ 'executable': {b -> ale#Var(b, 'terraform_langserver_executable')}, \ 'command': function('ale_linters#terraform#terraform_lsp#GetCommand'), \ 'project_root': function('ale_linters#terraform#terraform_lsp#GetProjectRoot'), \ 'language': 'terraform', \}) ale-4.0.0/ale_linters/terraform/tflint.vim000066400000000000000000000063451476501472200206130ustar00rootroot00000000000000" Author: Nat Williams " Description: tflint for Terraform files " " See: https://www.terraform.io/ " https://github.com/wata727/tflint call ale#Set('terraform_tflint_options', '') call ale#Set('terraform_tflint_executable', 'tflint') function! ale_linters#terraform#tflint#Handle(buffer, lines) abort let l:output = [] let l:pattern = '\v^(.*):(\d+),(\d+)-(\d+)?,?(\d+): (.{-1,}); (.+)$' let l:json = ale#util#FuzzyJSONDecode(a:lines, {}) " This is a rough test for tflint's output format " On versions prior to 0.11 it outputs all errors as a single level list if type(l:json) is v:t_list for l:error in l:json if l:error.type is# 'ERROR' let l:type = 'E' elseif l:error.type is# 'NOTICE' let l:type = 'I' else let l:type = 'W' endif call add(l:output, { \ 'lnum': l:error.line, \ 'text': l:error.message, \ 'type': l:type, \ 'code': l:error.detector, \}) endfor else for l:error in get(l:json, 'errors', []) for l:match in ale#util#GetMatches(l:error.message, [l:pattern]) if l:match[4] is# '' let l:match[4] = l:match[2] endif call add(l:output, { \ 'filename': l:match[1], \ 'lnum': str2nr(l:match[2]), \ 'col': str2nr(l:match[3]), \ 'end_lnum': str2nr(l:match[4]), \ 'end_col': str2nr(l:match[5]), \ 'text': l:match[7], \ 'code': l:match[6], \ 'type': 'E', \}) endfor endfor for l:error in get(l:json, 'issues', []) if l:error.rule.severity is# 'ERROR' let l:type = 'E' elseif l:error.rule.severity is# 'NOTICE' let l:type = 'I' else let l:type = 'W' endif call add(l:output, { \ 'filename': l:error.range.filename, \ 'lnum': l:error.range.start.line, \ 'col': l:error.range.start.column, \ 'end_lnum': l:error.range.end.line, \ 'end_col': l:error.range.end.column, \ 'text': l:error.message, \ 'code': l:error.rule.name, \ 'type': l:type, \}) endfor endif return l:output endfunction function! ale_linters#terraform#tflint#GetCommand(buffer) abort let l:cmd = '%e' let l:config_file = ale#path#FindNearestFile(a:buffer, '.tflint.hcl') if !empty(l:config_file) let l:cmd .= ' --config ' . ale#Escape(l:config_file) endif let l:opts = ale#Var(a:buffer, 'terraform_tflint_options') if !empty(l:opts) let l:cmd .= ' ' . l:opts endif let l:cmd .= ' -f json' return l:cmd endfunction call ale#linter#Define('terraform', { \ 'name': 'tflint', \ 'executable': {b -> ale#Var(b, 'terraform_tflint_executable')}, \ 'cwd': '%s:h', \ 'command': function('ale_linters#terraform#tflint#GetCommand'), \ 'callback': 'ale_linters#terraform#tflint#Handle', \}) ale-4.0.0/ale_linters/terraform/tfsec.vim000066400000000000000000000047031476501472200204130ustar00rootroot00000000000000" Description: tfsec for Terraform files " " See: https://www.terraform.io/ " https://github.com/aquasecurity/tfsec call ale#Set('terraform_tfsec_options', '') call ale#Set('terraform_tfsec_executable', 'tfsec') let s:separator = has('win32') ? '\' : '/' function! ale_linters#terraform#tfsec#Handle(buffer, lines) abort let l:output = [] let l:json = ale#util#FuzzyJSONDecode(a:lines, {}) " if there's no warning, 'result' is `null`. if empty(get(l:json, 'results')) return l:output endif for l:result in get(l:json, 'results', []) if l:result.severity is# 'LOW' let l:type = 'I' elseif l:result.severity is# 'CRITICAL' let l:type = 'E' else let l:type = 'W' endif call add(l:output, { \ 'filename': l:result.location.filename, \ 'lnum': l:result.location.start_line, \ 'end_lnum': l:result.location.end_line, \ 'text': l:result.description, \ 'code': l:result.long_id, \ 'type': l:type, \}) endfor return l:output endfunction " Construct command arguments to tfsec with `terraform_tfsec_options`. function! ale_linters#terraform#tfsec#GetCommand(buffer) abort let l:cmd = '%e' let l:config = ale_linters#terraform#tfsec#FindConfig(a:buffer) if !empty(l:config) let l:cmd .= ' --config-file ' . l:config endif let l:opts = ale#Var(a:buffer, 'terraform_tfsec_options') if !empty(l:opts) let l:cmd .= ' ' . l:opts endif let l:cmd .= ' --format json' return l:cmd endfunction " Find the nearest configuration file of tfsec. function! ale_linters#terraform#tfsec#FindConfig(buffer) abort let l:config_dir = ale#path#FindNearestDirectory(a:buffer, '.tfsec') if !empty(l:config_dir) " https://aquasecurity.github.io/tfsec/v1.28.0/guides/configuration/config/ for l:basename in ['config.yml', 'config.json'] let l:config = ale#path#Simplify(join([l:config_dir, l:basename], s:separator)) if filereadable(l:config) return ale#Escape(l:config) endif endfor endif return '' endfunction call ale#linter#Define('terraform', { \ 'name': 'tfsec', \ 'executable': {b -> ale#Var(b, 'terraform_tfsec_executable')}, \ 'cwd': '%s:h', \ 'command': function('ale_linters#terraform#tfsec#GetCommand'), \ 'callback': 'ale_linters#terraform#tfsec#Handle', \}) ale-4.0.0/ale_linters/testft/000077500000000000000000000000001476501472200160765ustar00rootroot00000000000000ale-4.0.0/ale_linters/testft/testlinter.vim000066400000000000000000000004221476501472200210060ustar00rootroot00000000000000" Author: neersighted " Description: dummy linter to use in tests call ale#linter#Define('testft', { \ 'name': 'testlinter', \ 'output_stream': 'stdout', \ 'executable': 'testlinter', \ 'command': 'testlinter', \ 'callback': 'testCB', \}) ale-4.0.0/ale_linters/tex/000077500000000000000000000000001476501472200153655ustar00rootroot00000000000000ale-4.0.0/ale_linters/tex/alex.vim000066400000000000000000000002111476501472200170250ustar00rootroot00000000000000" Author: Johannes Wienke " Description: alex for TeX files call ale#handlers#alex#DefineLinter('tex', '--text') ale-4.0.0/ale_linters/tex/chktex.vim000066400000000000000000000037551476501472200174020ustar00rootroot00000000000000" Author: Andrew Balmos - " Description: chktex for LaTeX files call ale#Set('tex_chktex_executable', 'chktex') call ale#Set('tex_chktex_options', '-I') function! ale_linters#tex#chktex#GetExecutable(buffer) abort return ale#Var(a:buffer, 'tex_chktex_executable') endfunction function! ale_linters#tex#chktex#GetCommand(buffer, version) abort let l:options = '' " Avoid bug when used without -p (last warning has gibberish for a filename) let l:options .= ' -v0 -p stdin -q' " Avoid bug of reporting wrong column when using tabs (issue #723) if ale#semver#GTE(a:version, [1, 7, 7]) let l:options .= ' -S TabSize=1' endif " Check for optional .chktexrc let l:chktex_config = ale#path#FindNearestFile(a:buffer, '.chktexrc') if !empty(l:chktex_config) let l:options .= ' -l ' . ale#Escape(l:chktex_config) endif let l:options .= ' ' . ale#Var(a:buffer, 'tex_chktex_options') return '%e' . l:options endfunction function! ale_linters#tex#chktex#Handle(buffer, lines) abort " Mattes lines like: " " stdin:499:2:24:Delete this space to maintain correct pagereferences. " stdin:507:81:3:You should enclose the previous parenthesis with `{}'. let l:pattern = '^stdin:\(\d\+\):\(\d\+\):\(\d\+\):\(.\+\)$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) call add(l:output, { \ 'lnum': l:match[1] + 0, \ 'col': l:match[2] + 0, \ 'text': l:match[4] . ' (' . (l:match[3]+0) . ')', \ 'type': 'W', \}) endfor return l:output endfunction call ale#linter#Define('tex', { \ 'name': 'chktex', \ 'executable': function('ale_linters#tex#chktex#GetExecutable'), \ 'command': {buffer -> ale#semver#RunWithVersionCheck( \ buffer, \ ale_linters#tex#chktex#GetExecutable(buffer), \ '%e --version', \ function('ale_linters#tex#chktex#GetCommand'), \ )}, \ 'callback': 'ale_linters#tex#chktex#Handle' \}) ale-4.0.0/ale_linters/tex/cspell.vim000066400000000000000000000002261476501472200173640ustar00rootroot00000000000000scriptencoding utf-8 " Author: David Houston " Description: cspell support for TeX files. call ale#handlers#cspell#DefineLinter('tex') ale-4.0.0/ale_linters/tex/lacheck.vim000066400000000000000000000026301476501472200174750ustar00rootroot00000000000000" Author: Andrew Balmos - " Description: lacheck for LaTeX files call ale#Set('tex_lacheck_executable', 'lacheck') function! ale_linters#tex#lacheck#Handle(buffer, lines) abort " Mattes lines like: " " "book.tex", line 37: possible unwanted space at "{" " "book.tex", line 38: missing `\ ' after "etc." let l:pattern = '^"\(.\+\)", line \(\d\+\): \(.\+\)$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) " lacheck follows `\input{}` commands. If the cwd is not the same as the " file in the buffer then it will fail to find the inputted items. We do not " want warnings from those items anyway if !empty(matchstr(l:match[3], '^Could not open ".\+"$')) continue endif " lacheck follows `\input{}` commands. We are only interested in " reporting errors for the current buffer only. if empty(matchstr(fnamemodify(l:match[1], ':t'), fnamemodify(bufname(a:buffer), ':t'))) continue endif call add(l:output, { \ 'lnum': l:match[2] + 0, \ 'text': l:match[3], \ 'type': 'W', \}) endfor return l:output endfunction call ale#linter#Define('tex', { \ 'name': 'lacheck', \ 'executable': {b -> ale#Var(b, 'tex_lacheck_executable')}, \ 'command': '%e %t', \ 'callback': 'ale_linters#tex#lacheck#Handle' \}) ale-4.0.0/ale_linters/tex/proselint.vim000066400000000000000000000004051476501472200201200ustar00rootroot00000000000000" Author: poohzrn https://github.com/poohzrn " Description: proselint for TeX files call ale#linter#Define('tex', { \ 'name': 'proselint', \ 'executable': 'proselint', \ 'command': 'proselint %t', \ 'callback': 'ale#handlers#unix#HandleAsWarning', \}) ale-4.0.0/ale_linters/tex/redpen.vim000066400000000000000000000004441476501472200173610ustar00rootroot00000000000000" Author: rhysd https://rhysd.github.io " Description: Redpen, a proofreading tool (http://redpen.cc) call ale#linter#Define('tex', { \ 'name': 'redpen', \ 'executable': 'redpen', \ 'command': 'redpen -f latex -r json %t', \ 'callback': 'ale#handlers#redpen#HandleRedpenOutput', \}) ale-4.0.0/ale_linters/tex/texlab.vim000066400000000000000000000016771476501472200173740ustar00rootroot00000000000000" Author: Ricardo Liang " Author: ourigen " Description: Texlab language server (Rust rewrite) call ale#Set('tex_texlab_executable', 'texlab') call ale#Set('tex_texlab_options', '') call ale#Set('tex_texlab_config', {}) function! ale_linters#tex#texlab#GetProjectRoot(buffer) abort let l:git_path = ale#path#FindNearestDirectory(a:buffer, '.git') return !empty(l:git_path) ? fnamemodify(l:git_path, ':h:h') : '' endfunction function! ale_linters#tex#texlab#GetCommand(buffer) abort return '%e' . ale#Pad(ale#Var(a:buffer, 'tex_texlab_options')) endfunction call ale#linter#Define('tex', { \ 'name': 'texlab', \ 'lsp': 'stdio', \ 'executable': {b -> ale#Var(b, 'tex_texlab_executable')}, \ 'command': function('ale_linters#tex#texlab#GetCommand'), \ 'project_root': function('ale_linters#tex#texlab#GetProjectRoot'), \ 'lsp_config': {b -> ale#Var(b, 'tex_texlab_config')}, \}) ale-4.0.0/ale_linters/tex/textlint.vim000066400000000000000000000005211476501472200177530ustar00rootroot00000000000000" Author: TANIGUCHI Masaya " Description: textlint for LaTeX files call ale#linter#Define('tex', { \ 'name': 'textlint', \ 'executable': function('ale#handlers#textlint#GetExecutable'), \ 'command': function('ale#handlers#textlint#GetCommand'), \ 'callback': 'ale#handlers#textlint#HandleTextlintOutput', \}) ale-4.0.0/ale_linters/tex/vale.vim000066400000000000000000000003661476501472200170360ustar00rootroot00000000000000" Author: chew-z https://github.com/chew-z " Description: vale for LaTeX files call ale#linter#Define('tex', { \ 'name': 'vale', \ 'executable': 'vale', \ 'command': 'vale --output=JSON %t', \ 'callback': 'ale#handlers#vale#Handle', \}) ale-4.0.0/ale_linters/tex/writegood.vim000066400000000000000000000002131476501472200201010ustar00rootroot00000000000000" Author: Sumner Evans " Description: write-good for TeX files call ale#handlers#writegood#DefineLinter('tex') ale-4.0.0/ale_linters/texinfo/000077500000000000000000000000001476501472200162415ustar00rootroot00000000000000ale-4.0.0/ale_linters/texinfo/alex.vim000066400000000000000000000002211476501472200177020ustar00rootroot00000000000000" Author: Johannes Wienke " Description: alex for texinfo files call ale#handlers#alex#DefineLinter('texinfo', '--text') ale-4.0.0/ale_linters/texinfo/cspell.vim000066400000000000000000000002361476501472200202410ustar00rootroot00000000000000scriptencoding utf-8 " Author: David Houston " Description: cspell support for TeXInfo files. call ale#handlers#cspell#DefineLinter('texinfo') ale-4.0.0/ale_linters/texinfo/proselint.vim000066400000000000000000000004271476501472200210000ustar00rootroot00000000000000" Author: Daniel M. Capella https://github.com/polyzen " Description: proselint for Texinfo files call ale#linter#Define('texinfo', { \ 'name': 'proselint', \ 'executable': 'proselint', \ 'command': 'proselint %t', \ 'callback': 'ale#handlers#unix#HandleAsWarning', \}) ale-4.0.0/ale_linters/texinfo/writegood.vim000066400000000000000000000002231476501472200207560ustar00rootroot00000000000000" Author: Sumner Evans " Description: write-good for Texinfo files call ale#handlers#writegood#DefineLinter('texinfo') ale-4.0.0/ale_linters/text/000077500000000000000000000000001476501472200155515ustar00rootroot00000000000000ale-4.0.0/ale_linters/text/alex.vim000066400000000000000000000002131476501472200172130ustar00rootroot00000000000000" Author: Johannes Wienke " Description: alex for text files call ale#handlers#alex#DefineLinter('text', '--text') ale-4.0.0/ale_linters/text/cspell.vim000066400000000000000000000002401476501472200175440ustar00rootroot00000000000000scriptencoding utf-8 " Author: David Houston " Description: cspell support for general text files. call ale#handlers#cspell#DefineLinter('text') ale-4.0.0/ale_linters/text/languagetool.vim000066400000000000000000000002171476501472200207470ustar00rootroot00000000000000" Author: Vincent (wahrwolf [ät] wolfpit.net) " Description: languagetool for text files call ale#handlers#languagetool#DefineLinter('text') ale-4.0.0/ale_linters/text/proselint.vim000066400000000000000000000004071476501472200203060ustar00rootroot00000000000000" Author: poohzrn https://github.com/poohzrn " Description: proselint for text files call ale#linter#Define('text', { \ 'name': 'proselint', \ 'executable': 'proselint', \ 'command': 'proselint %t', \ 'callback': 'ale#handlers#unix#HandleAsWarning', \}) ale-4.0.0/ale_linters/text/redpen.vim000066400000000000000000000004451476501472200175460ustar00rootroot00000000000000" Author: rhysd https://rhysd.github.io " Description: Redpen, a proofreading tool (http://redpen.cc) call ale#linter#Define('text', { \ 'name': 'redpen', \ 'executable': 'redpen', \ 'command': 'redpen -f plain -r json %t', \ 'callback': 'ale#handlers#redpen#HandleRedpenOutput', \}) ale-4.0.0/ale_linters/text/textlint.vim000066400000000000000000000005751476501472200201500ustar00rootroot00000000000000" Author: Yasuhiro Kiyota " Description: textlint, a proofreading tool (https://textlint.github.io/) call ale#linter#Define('text', { \ 'name': 'textlint', \ 'executable': function('ale#handlers#textlint#GetExecutable'), \ 'command': function('ale#handlers#textlint#GetCommand'), \ 'callback': 'ale#handlers#textlint#HandleTextlintOutput', \}) ale-4.0.0/ale_linters/text/vale.vim000066400000000000000000000003661476501472200172220ustar00rootroot00000000000000" Author: chew-z https://github.com/chew-z " Description: vale for text files call ale#linter#Define('text', { \ 'name': 'vale', \ 'executable': 'vale', \ 'command': 'vale --output=JSON %t', \ 'callback': 'ale#handlers#vale#Handle', \}) ale-4.0.0/ale_linters/text/writegood.vim000066400000000000000000000002151476501472200202670ustar00rootroot00000000000000" Author: Sumner Evans " Description: write-good for text files call ale#handlers#writegood#DefineLinter('text') ale-4.0.0/ale_linters/thrift/000077500000000000000000000000001476501472200160655ustar00rootroot00000000000000ale-4.0.0/ale_linters/thrift/thrift.vim000066400000000000000000000052631476501472200201100ustar00rootroot00000000000000" Author: Jon Parise call ale#Set('thrift_thrift_executable', 'thrift') call ale#Set('thrift_thrift_generators', ['cpp']) call ale#Set('thrift_thrift_includes', ['.']) call ale#Set('thrift_thrift_options', '-strict') function! ale_linters#thrift#thrift#GetCommand(buffer) abort let l:generators = ale#Var(a:buffer, 'thrift_thrift_generators') let l:includes = ale#Var(a:buffer, 'thrift_thrift_includes') " The thrift compiler requires at least one generator. If none are set, " fall back to our default value to avoid silently failing. We could also " `throw` here, but that seems even less helpful. if empty(l:generators) let l:generators = ['cpp'] endif let l:output_dir = ale#command#CreateDirectory(a:buffer) return '%e' \ . ale#Pad(join(map(copy(l:generators), "'--gen ' . v:val"))) \ . ale#Pad(join(map(copy(l:includes), "'-I ' . v:val"))) \ . ale#Pad(ale#Var(a:buffer, 'thrift_thrift_options')) \ . ' -out ' . ale#Escape(l:output_dir) \ . ' %t' endfunction function! ale_linters#thrift#thrift#Handle(buffer, lines) abort " Matches lines like the following: " " [SEVERITY:/path/filename.thrift:31] Message text " [ERROR:/path/filename.thrift:31] (last token was ';') let l:pattern = '\v^\[(\u+):(.*):(\d+)\] (.*)$' let l:index = 0 let l:output = [] " Roll our own output-matching loop instead of using ale#util#GetMatches " because we need to support error messages that span multiple lines. while l:index < len(a:lines) let l:line = a:lines[l:index] let l:match = matchlist(l:line, l:pattern) if empty(l:match) let l:index += 1 continue endif let l:severity = l:match[1] if l:severity is# 'WARNING' let l:type = 'W' else let l:type = 'E' endif " If our text looks like "(last token was ';')", the *next* line " should contain a more descriptive error message. let l:text = l:match[4] if l:text =~# '\(last token was .*\)' let l:index += 1 let l:text = get(a:lines, l:index, 'Unknown error ' . l:text) endif call add(l:output, { \ 'lnum': l:match[3] + 0, \ 'col': 0, \ 'type': l:type, \ 'text': l:text, \}) let l:index += 1 endwhile return l:output endfunction call ale#linter#Define('thrift', { \ 'name': 'thrift', \ 'output_stream': 'both', \ 'executable': {b -> ale#Var(b, 'thrift_thrift_executable')}, \ 'command': function('ale_linters#thrift#thrift#GetCommand'), \ 'callback': 'ale_linters#thrift#thrift#Handle', \}) ale-4.0.0/ale_linters/thrift/thriftcheck.vim000066400000000000000000000027021476501472200211010ustar00rootroot00000000000000" Author: Jon Parise call ale#Set('thrift_thriftcheck_executable', 'thriftcheck') call ale#Set('thrift_thriftcheck_options', '') function! ale_linters#thrift#thriftcheck#GetCommand(buffer) abort return '%e' \ . ale#Pad(ale#Var(a:buffer, 'thrift_thriftcheck_options')) \ . ' --stdin-filename %s' \ . ' %t' endfunction function! ale_linters#thrift#thriftcheck#Handle(buffer, lines) abort " Matches lines like the following: " " file.thrift:1:1: error: "py" namespace must match "^idl\\." (namespace.pattern) " file.thrift:3:5: warning: 64-bit integer constant -2147483649 may not work in all languages (int.64bit) let l:pattern = '\v^[a-zA-Z]?:?[^:]+:(\d+):(\d+): ?([^:]+): (.+) \(([^\)]+)\)$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) if l:match[3] is# 'warning' let l:type = 'W' else let l:type = 'E' endif call add(l:output, { \ 'lnum': l:match[1] + 0, \ 'col': l:match[2] + 0, \ 'type': l:type, \ 'text': l:match[4], \ 'code': l:match[5], \}) endfor return l:output endfunction call ale#linter#Define('thrift', { \ 'name': 'thriftcheck', \ 'executable': {b -> ale#Var(b, 'thrift_thriftcheck_executable')}, \ 'command': function('ale_linters#thrift#thriftcheck#GetCommand'), \ 'callback': 'ale_linters#thrift#thriftcheck#Handle', \}) ale-4.0.0/ale_linters/typescript/000077500000000000000000000000001476501472200167735ustar00rootroot00000000000000ale-4.0.0/ale_linters/typescript/biome.vim000066400000000000000000000006121476501472200206020ustar00rootroot00000000000000" Author: Filip Gospodinov " Description: biome for TypeScript files call ale#linter#Define('typescript', { \ 'name': 'biome', \ 'lsp': 'stdio', \ 'language': function('ale#handlers#biome#GetLanguage'), \ 'executable': function('ale#handlers#biome#GetExecutable'), \ 'command': '%e lsp-proxy', \ 'project_root': function('ale#handlers#biome#GetProjectRoot'), \}) ale-4.0.0/ale_linters/typescript/cspell.vim000066400000000000000000000002441476501472200207720ustar00rootroot00000000000000scriptencoding utf-8 " Author: David Houston " Description: cspell support for TypeScript files. call ale#handlers#cspell#DefineLinter('typescript') ale-4.0.0/ale_linters/typescript/deno.vim000066400000000000000000000007441476501472200204420ustar00rootroot00000000000000" Author: Mohammed Chelouti - https://github.com/motato1 " Arnold Chand " Description: Deno lsp linter for TypeScript files. call ale#linter#Define('typescript', { \ 'name': 'deno', \ 'lsp': 'stdio', \ 'executable': function('ale#handlers#deno#GetExecutable'), \ 'command': '%e lsp', \ 'project_root': function('ale#handlers#deno#GetProjectRoot'), \ 'initialization_options': function('ale#handlers#deno#GetInitializationOptions'), \}) ale-4.0.0/ale_linters/typescript/eslint.vim000066400000000000000000000005611476501472200210100ustar00rootroot00000000000000" Author: w0rp " Description: eslint for JavaScript files call ale#linter#Define('typescript', { \ 'name': 'eslint', \ 'executable': function('ale#handlers#eslint#GetExecutable'), \ 'cwd': function('ale#handlers#eslint#GetCwd'), \ 'command': function('ale#handlers#eslint#GetCommand'), \ 'callback': 'ale#handlers#eslint#HandleJSON', \}) ale-4.0.0/ale_linters/typescript/standard.vim000066400000000000000000000023451476501472200213140ustar00rootroot00000000000000" Author: Ahmed El Gabri <@ahmedelgabri> " Description: standardjs for typescript files call ale#Set('typescript_standard_executable', 'standard') call ale#Set('typescript_standard_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('typescript_standard_options', '') function! ale_linters#typescript#standard#GetExecutable(buffer) abort return ale#path#FindExecutable(a:buffer, 'typescript_standard', [ \ 'node_modules/standardx/bin/cmd.js', \ 'node_modules/standard/bin/cmd.js', \ 'node_modules/.bin/standard', \]) endfunction function! ale_linters#typescript#standard#GetCommand(buffer) abort let l:executable = ale_linters#typescript#standard#GetExecutable(a:buffer) let l:options = ale#Var(a:buffer, 'typescript_standard_options') return ale#node#Executable(a:buffer, l:executable) \ . (!empty(l:options) ? ' ' . l:options : '') \ . ' --stdin %s' endfunction " standard uses eslint and the output format is the same call ale#linter#Define('typescript', { \ 'name': 'standard', \ 'executable': function('ale_linters#typescript#standard#GetExecutable'), \ 'command': function('ale_linters#typescript#standard#GetCommand'), \ 'callback': 'ale#handlers#eslint#Handle', \}) ale-4.0.0/ale_linters/typescript/tslint.vim000066400000000000000000000046621476501472200210350ustar00rootroot00000000000000" Author: Prashanth Chandra , Jonathan Clem " Description: tslint for TypeScript files call ale#handlers#tslint#InitVariables() function! ale_linters#typescript#tslint#Handle(buffer, lines) abort " Do not output any errors for empty files if the option is on. if ale#Var(a:buffer, 'typescript_tslint_ignore_empty_files') \&& getbufline(a:buffer, 1, '$') == [''] return [] endif let l:dir = expand('#' . a:buffer . ':p:h') let l:output = [] for l:error in ale#util#FuzzyJSONDecode(a:lines, []) if get(l:error, 'ruleName', '') is# 'no-implicit-dependencies' continue endif let l:item = { \ 'type': (get(l:error, 'ruleSeverity', '') is# 'WARNING' ? 'W' : 'E'), \ 'text': l:error.failure, \ 'lnum': l:error.startPosition.line + 1, \ 'col': l:error.startPosition.character + 1, \ 'end_lnum': l:error.endPosition.line + 1, \ 'end_col': l:error.endPosition.character + 1, \} let l:filename = ale#path#GetAbsPath(l:dir, l:error.name) " Assume temporary files are this file. if !ale#path#IsTempName(l:filename) let l:item.filename = l:filename endif if has_key(l:error, 'ruleName') let l:item.code = l:error.ruleName endif call add(l:output, l:item) endfor return l:output endfunction function! ale_linters#typescript#tslint#GetCommand(buffer) abort let l:tslint_config_path = ale#path#ResolveLocalPath( \ a:buffer, \ 'tslint.json', \ ale#Var(a:buffer, 'typescript_tslint_config_path') \) let l:tslint_config_option = !empty(l:tslint_config_path) \ ? ' -c ' . ale#Escape(l:tslint_config_path) \ : '' let l:tslint_rules_dir = ale#Var(a:buffer, 'typescript_tslint_rules_dir') let l:tslint_rules_option = !empty(l:tslint_rules_dir) \ ? ' -r ' . ale#Escape(l:tslint_rules_dir) \ : '' return ale#Escape(ale#handlers#tslint#GetExecutable(a:buffer)) \ . ' --format json' \ . l:tslint_config_option \ . l:tslint_rules_option \ . ' %t' endfunction call ale#linter#Define('typescript', { \ 'name': 'tslint', \ 'executable': function('ale#handlers#tslint#GetExecutable'), \ 'cwd': '%s:h', \ 'command': function('ale_linters#typescript#tslint#GetCommand'), \ 'callback': 'ale_linters#typescript#tslint#Handle', \}) ale-4.0.0/ale_linters/typescript/tsserver.vim000066400000000000000000000012131476501472200213620ustar00rootroot00000000000000" Author: w0rp " Description: tsserver integration for ALE call ale#Set('typescript_tsserver_executable', 'tsserver') call ale#Set('typescript_tsserver_config_path', '') call ale#Set('typescript_tsserver_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#linter#Define('typescript', { \ 'name': 'tsserver', \ 'lsp': 'tsserver', \ 'executable': {b -> ale#path#FindExecutable(b, 'typescript_tsserver', [ \ '.yarn/sdks/typescript/bin/tsserver', \ 'node_modules/.bin/tsserver', \ ])}, \ 'command': '%e', \ 'project_root': function('ale#handlers#tsserver#GetProjectRoot'), \ 'language': '', \}) ale-4.0.0/ale_linters/typescript/typecheck.vim000066400000000000000000000017611476501472200214740ustar00rootroot00000000000000" Author: Prashanth Chandra https://github.com/prashcr, Aleh Kashnikau https://github.com/mkusher " Description: type checker for TypeScript files function! ale_linters#typescript#typecheck#Handle(buffer, lines) abort " Matches patterns like the following: " " hello.ts[7, 41]: Property 'a' does not exist on type 'A' " hello.ts[16, 7]: Type 'A' is not assignable to type 'B' " let l:pattern = '.\+\.ts\[\(\d\+\), \(\d\+\)\]: \(.\+\)' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) let l:line = l:match[1] + 0 let l:column = l:match[2] + 0 let l:text = l:match[3] call add(l:output, { \ 'lnum': l:line, \ 'col': l:column, \ 'text': l:text, \}) endfor return l:output endfunction call ale#linter#Define('typescript', { \ 'name': 'typecheck', \ 'executable': 'typecheck', \ 'command': 'typecheck %s', \ 'callback': 'ale_linters#typescript#typecheck#Handle', \}) ale-4.0.0/ale_linters/typescript/xo.vim000066400000000000000000000003431476501472200201360ustar00rootroot00000000000000call ale#linter#Define('typescript', { \ 'name': 'xo', \ 'executable': function('ale#handlers#xo#GetExecutable'), \ 'command': function('ale#handlers#xo#GetLintCommand'), \ 'callback': 'ale#handlers#xo#HandleJSON', \}) ale-4.0.0/ale_linters/v/000077500000000000000000000000001476501472200150325ustar00rootroot00000000000000ale-4.0.0/ale_linters/v/v.vim000066400000000000000000000042211476501472200160130ustar00rootroot00000000000000" Author: fiatjaf " Description: v build for V files call ale#Set('v_v_executable', 'v') call ale#Set('v_v_options', '') function! ale_linters#v#v#Handler(buffer, lines) abort let l:dir = expand('#' . a:buffer . ':p:h') let l:output = [] " Matches patterns like the following: " " ./const.v:4:3: warning: const names cannot contain uppercase letters, use snake_case instead " 2 | " 3 | const ( " 4 | BUTTON_TEXT = 'OK' " | ~~~~~~~~~~~ " 5 | ) " ./main.v:4:8: warning: module 'os' is imported but never used " 2 | " 3 | import ui " 4 | import os " | ~~ " 5 | " 6 | const ( " ./main.v:20:10: error: undefined ident: `win_widt` " 18 | mut app := &App{} " 19 | app.window = ui.window({ " 20 | width: win_widt " | ~~~~~~~~ " 21 | height: win_height " 22 | title: 'Counter' let l:current = {} for l:line in a:lines " matches basic error description let l:match = matchlist(l:line, \ '\([^:]\+\):\([^:]\+\):\([^:]\+\): \([^:]\+\): \(.*\)') if !empty(l:match) let l:current = { \ 'filename': ale#path#GetAbsPath(l:dir, l:match[1]), \ 'lnum': l:match[2] + 0, \ 'col': l:match[3] + 0, \ 'text': l:match[5], \ 'type': l:match[4] is# 'error' ? 'E' : 'W', \} call add(l:output, l:current) continue endif " try to get information about the ending column let l:tildematch = matchstr(l:line, '\~\+') if !empty(l:tildematch) let l:current['end_col'] = l:current['col'] + len(l:tildematch) endif endfor return l:output endfunction call ale#linter#Define('v', { \ 'name': 'v', \ 'executable': {b -> ale#Var(b, 'v_v_executable')}, \ 'command': {b -> \ '%e' . ale#Pad(ale#Var(b, 'v_v_options')) \ . ' . -o /tmp/vim-ale-v' \ }, \ 'output_stream': 'stderr', \ 'callback': 'ale_linters#v#v#Handler', \ 'lint_file': 1, \}) ale-4.0.0/ale_linters/vala/000077500000000000000000000000001476501472200155105ustar00rootroot00000000000000ale-4.0.0/ale_linters/vala/vala_lint.vim000066400000000000000000000041671476501472200202060ustar00rootroot00000000000000" Author: Atsuya Takagi " Description: A linter for Vala using Vala-Lint. call ale#Set('vala_vala_lint_config_filename', 'vala-lint.conf') call ale#Set('vala_vala_lint_executable', 'io.elementary.vala-lint') function! ale_linters#vala#vala_lint#GetExecutable(buffer) abort return ale#Var(a:buffer, 'vala_vala_lint_executable') endfunction function! ale_linters#vala#vala_lint#GetCommand(buffer) abort let l:command = ale_linters#vala#vala_lint#GetExecutable(a:buffer) let l:config_filename = ale#Var(a:buffer, 'vala_vala_lint_config_filename') let l:config_path = ale#path#FindNearestFile(a:buffer, l:config_filename) if !empty(l:config_path) let l:command .= ' -c ' . l:config_path endif return l:command . ' %s' endfunction function! ale_linters#vala#vala_lint#Handle(buffer, lines) abort let l:pattern = '^\s*\(\d\+\)\.\(\d\+\)\s\+\(error\|warn\)\s\+\(.\+\)\s\([A-Za-z0-9_\-]\+\)' let l:output = [] for l:line in a:lines " remove color escape sequences since vala-lint doesn't support " output without colors let l:cleaned_line = substitute(l:line, '\e\[[0-9;]\+[mK]', '', 'g') let l:match = matchlist(l:cleaned_line, l:pattern) if len(l:match) == 0 continue endif let l:refined_type = l:match[3] is# 'warn' ? 'W' : 'E' let l:cleaned_text = substitute(l:match[4], '^\s*\(.\{-}\)\s*$', '\1', '') let l:lnum = l:match[1] + 0 let l:column = l:match[2] + 0 let l:type = l:refined_type let l:text = l:cleaned_text let l:code = l:match[5] call add(l:output, { \ 'lnum': l:lnum, \ 'col': l:column, \ 'text': l:text, \ 'type': l:type, \ 'code': l:code, \}) endfor return l:output endfunction call ale#linter#Define('vala', { \ 'name': 'vala_lint', \ 'output_stream': 'stdout', \ 'executable': function('ale_linters#vala#vala_lint#GetExecutable'), \ 'command': function('ale_linters#vala#vala_lint#GetCommand'), \ 'callback': 'ale_linters#vala#vala_lint#Handle', \ 'lint_file': 1, \}) ale-4.0.0/ale_linters/verilog/000077500000000000000000000000001476501472200162345ustar00rootroot00000000000000ale-4.0.0/ale_linters/verilog/hdl_checker.vim000066400000000000000000000003721476501472200212060ustar00rootroot00000000000000" Author: suoto " Description: Adds support for HDL Code Checker, which wraps vcom/vlog, ghdl " or xvhdl. More info on https://github.com/suoto/hdl_checker call ale#handlers#hdl_checker#DefineLinter('verilog') ale-4.0.0/ale_linters/verilog/iverilog.vim000066400000000000000000000026621476501472200205770ustar00rootroot00000000000000" Author: Masahiro H https://github.com/mshr-h " Description: iverilog for verilog files call ale#Set('verilog_iverilog_options', '') function! ale_linters#verilog#iverilog#GetCommand(buffer) abort return 'iverilog -t null -Wall ' \ . '-y%s:h ' \ . ale#Var(a:buffer, 'verilog_iverilog_options') \ . ' %t' endfunction function! ale_linters#verilog#iverilog#Handle(buffer, lines) abort " Look for lines like the following. " " tb_me_top.v:37: warning: Instantiating module me_top with dangling input port 1 (rst_n) floating. " tb_me_top.v:17: syntax error " memory_single_port.v:2: syntax error " tb_me_top.v:17: error: Invalid module instantiation let l:pattern = '^[^:]\+:\(\d\+\): \(warning\|error\|syntax error\)\(: \(.\+\)\)\?' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) let l:line = l:match[1] + 0 let l:type = l:match[2] =~# 'error' ? 'E' : 'W' let l:text = l:match[2] is# 'syntax error' ? 'syntax error' : l:match[4] call add(l:output, { \ 'lnum': l:line, \ 'text': l:text, \ 'type': l:type, \}) endfor return l:output endfunction call ale#linter#Define('verilog', { \ 'name': 'iverilog', \ 'output_stream': 'stderr', \ 'executable': 'iverilog', \ 'command': function('ale_linters#verilog#iverilog#GetCommand'), \ 'callback': 'ale_linters#verilog#iverilog#Handle', \}) ale-4.0.0/ale_linters/verilog/slang.vim000066400000000000000000000027351476501472200200640ustar00rootroot00000000000000" Author: Alvin Rolling " Description: slang for verilog files " Set this option to change Slang lint options if !exists('g:ale_verilog_slang_options') let g:ale_verilog_slang_options = '' endif " --lint-only function! ale_linters#verilog#slang#GetCommand(buffer) abort return 'slang -Weverything ' \ . '-I%s:h ' \ . ale#Var(a:buffer, 'verilog_slang_options') .' ' \ . '%t' endfunction function! s:RemoveUnicodeQuotes(text) abort let l:text = a:text let l:text = substitute(l:text, '[`´‘’]', '''', 'g') let l:text = substitute(l:text, '[“”]', '"', 'g') return l:text endfunction function! ale_linters#verilog#slang#Handle(buffer, lines) abort let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+)?:?(\d+)?:? ([^:]+): (.+)$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) let l:item = { \ 'lnum': str2nr(l:match[2]), \ 'type': (l:match[4] is# 'error') ? 'E' : 'W', \ 'text': s:RemoveUnicodeQuotes(l:match[5]), \} if !empty(l:match[3]) let l:item.col = str2nr(l:match[3]) endif call add(l:output, l:item) endfor return l:output endfunction call ale#linter#Define('verilog', { \ 'name': 'slang', \ 'output_stream': 'stderr', \ 'executable': 'slang', \ 'command': function('ale_linters#verilog#slang#GetCommand'), \ 'callback': 'ale_linters#verilog#slang#Handle', \ 'read_buffer': 0, \}) ale-4.0.0/ale_linters/verilog/verilator.vim000066400000000000000000000044201476501472200207600ustar00rootroot00000000000000" Author: Masahiro H https://github.com/mshr-h " Description: verilator for verilog files " Set this option to change Verilator lint options if !exists('g:ale_verilog_verilator_options') let g:ale_verilog_verilator_options = '' endif function! ale_linters#verilog#verilator#GetCommand(buffer) abort " the path to the current file is systematically added to the search path return 'verilator --lint-only -Wall -Wno-DECLFILENAME ' \ . '-I%s:h ' \ . ale#Var(a:buffer, 'verilog_verilator_options') .' ' \ . '%t' endfunction function! ale_linters#verilog#verilator#Handle(buffer, lines) abort " Look for lines like the following. " " %Error: addr_gen.v:3: syntax error, unexpected IDENTIFIER " %Warning-WIDTH: addr_gen.v:26: Operator ASSIGNDLY expects 12 bits on the Assign RHS, but Assign RHS's CONST '20'h0' generates 20 bits. " %Warning-UNUSED: test.v:3: Signal is not used: a " %Warning-UNDRIVEN: test.v:3: Signal is not driven: clk " %Warning-UNUSED: test.v:4: Signal is not used: dout " %Warning-BLKSEQ: test.v:10: Blocking assignments (=) in sequential (flop or latch) block; suggest delayed assignments (<=). " Since version 4.032 (04/2020) verilator linter messages also contain the column number, " and look like: " %Error: /tmp/test.sv:3:1: syntax error, unexpected endmodule, expecting ';' " " to stay compatible with old versions of the tool, the column number is " optional in the researched pattern let l:pattern = '^%\(Warning\|Error\)[^:]*:\s*\([^:]\+\):\(\d\+\):\(\d\+\)\?:\? \(.\+\)$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) let l:item = { \ 'lnum': str2nr(l:match[3]), \ 'text': l:match[5], \ 'type': l:match[1] is# 'Error' ? 'E' : 'W', \ 'filename': l:match[2], \} if !empty(l:match[4]) let l:item.col = str2nr(l:match[4]) endif call add(l:output, l:item) endfor return l:output endfunction call ale#linter#Define('verilog', { \ 'name': 'verilator', \ 'output_stream': 'stderr', \ 'executable': 'verilator', \ 'command': function('ale_linters#verilog#verilator#GetCommand'), \ 'callback': 'ale_linters#verilog#verilator#Handle', \ 'read_buffer': 0, \}) ale-4.0.0/ale_linters/verilog/vlog.vim000066400000000000000000000037661476501472200177340ustar00rootroot00000000000000" Author: John Gentile " Description: Adds support for Mentor Graphics Questa/ModelSim `vlog` Verilog compiler/checker call ale#Set('verilog_vlog_executable', 'vlog') " See `$ vlog -h` for more options call ale#Set('verilog_vlog_options', '-quiet -lint') function! ale_linters#verilog#vlog#GetCommand(buffer) abort return '%e ' . ale#Pad(ale#Var(a:buffer, 'verilog_vlog_options')) . ' %t' endfunction function! ale_linters#verilog#vlog#Handle(buffer, lines) abort "Matches patterns like the following: "** Warning: add.v(7): (vlog-2623) Undefined variable: C. "** Error: file.v(1): (vlog-13294) Identifier must be declared with a port mode: C. let l:pattern = '^**\s\(\w*\): \([a-zA-Z0-9\-\.\_\/ ]\+\)(\(\d\+\)):\s\+\(.*\)' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) call add(l:output, { \ 'lnum': l:match[3] + 0, \ 'type': l:match[1] is? 'Error' ? 'E' : 'W', \ 'text': l:match[4], \ 'filename': l:match[2], \}) endfor "Matches patterns like the following: "** Warning: (vlog-2623) add.v(7): Undefined variable: C. "** Error: (vlog-13294) file.v(1): Identifier must be declared with a port mode: C. " let l:pattern = '^**\s\(\w*\):[a-zA-Z0-9\-\.\_\/ ]\+(\(\d\+\)):\s\+\(.*\)' let l:pattern = '^**\s\(\w*\):\s\([^)]*)\) \([a-zA-Z0-9\-\.\_\/ ]\+\)(\(\d\+\)):\s\+\(.*\)' for l:match in ale#util#GetMatches(a:lines, l:pattern) call add(l:output, { \ 'lnum': l:match[4] + 0, \ 'type': l:match[1] is? 'Error' ? 'E' : 'W', \ 'text': l:match[2] . ' ' . l:match[5], \ 'filename': l:match[3], \}) endfor return l:output endfunction call ale#linter#Define('verilog', { \ 'name': 'vlog', \ 'output_stream': 'stdout', \ 'executable': {b -> ale#Var(b, 'verilog_vlog_executable')}, \ 'command': function('ale_linters#verilog#vlog#GetCommand'), \ 'callback': 'ale_linters#verilog#vlog#Handle', \}) ale-4.0.0/ale_linters/verilog/xvlog.vim000066400000000000000000000022771476501472200201200ustar00rootroot00000000000000" Author: John Gentile " Description: Adds support for Xilinx Vivado `xvlog` Verilog compiler/checker call ale#Set('verilog_xvlog_executable', 'xvlog') call ale#Set('verilog_xvlog_options', '') function! ale_linters#verilog#xvlog#GetCommand(buffer) abort return '%e ' . ale#Pad(ale#Var(a:buffer, 'verilog_xvlog_options')) . ' %t' endfunction function! ale_linters#verilog#xvlog#Handle(buffer, lines) abort "Matches patterns like the following: " ERROR: [VRFC 10-1412] syntax error near output [/path/to/file.v:5] let l:pattern = '^ERROR:\s\+\(\[.*\)\[.*:\([0-9]\+\)\]' let l:output = [] " NOTE: `xvlog` only prints 'INFO' and 'ERROR' messages for l:match in ale#util#GetMatches(a:lines, l:pattern) call add(l:output, { \ 'lnum': l:match[2] + 0, \ 'type': 'E', \ 'text': l:match[1], \}) endfor return l:output endfunction call ale#linter#Define('verilog', { \ 'name': 'xvlog', \ 'output_stream': 'stdout', \ 'executable': {b -> ale#Var(b, 'verilog_xvlog_executable')}, \ 'command': function('ale_linters#verilog#xvlog#GetCommand'), \ 'callback': 'ale_linters#verilog#xvlog#Handle', \}) ale-4.0.0/ale_linters/verilog/yosys.vim000066400000000000000000000024771476501472200201510ustar00rootroot00000000000000" Author: Nathan Sharp " Description: Yosys for Verilog files call ale#Set('verilog_yosys_executable', 'yosys') call ale#Set('verilog_yosys_options', '-Q -T -p ''read_verilog %s''') function! ale_linters#verilog#yosys#GetCommand(buffer) abort return '%e ' . ale#Var(a:buffer, 'verilog_yosys_options') . ' 2>&1' endfunction function! ale_linters#verilog#yosys#Handle(buffer, lines) abort let l:output = [] let l:path = fnamemodify(bufname(a:buffer), ':p') for l:match in ale#util#GetMatches(a:lines, '^\([^:]\+\):\(\d\+\): \(WARNING\|ERROR\): \(.\+\)$') call add(l:output, { \ 'lnum': str2nr(l:match[2]), \ 'text': l:match[4], \ 'type': l:match[3][0], \ 'filename': l:match[1], \}) endfor for l:match in ale#util#GetMatches(a:lines, '^\(Warning\|ERROR\): \(.\+\)$') call add(l:output, { \ 'lnum': 1, \ 'text': l:match[2], \ 'type': l:match[1][0], \}) endfor return l:output endfunction call ale#linter#Define('verilog', { \ 'name': 'yosys', \ 'output_stream': 'stdout', \ 'executable': {b -> ale#Var(b, 'verilog_yosys_executable')}, \ 'command': function('ale_linters#verilog#yosys#GetCommand'), \ 'callback': 'ale_linters#verilog#yosys#Handle', \ 'lint_file': 1, \}) ale-4.0.0/ale_linters/vhdl/000077500000000000000000000000001476501472200155225ustar00rootroot00000000000000ale-4.0.0/ale_linters/vhdl/ghdl.vim000066400000000000000000000023251476501472200171570ustar00rootroot00000000000000" Author: John Gentile " Description: Adds support for `ghdl` VHDL compiler/checker call ale#Set('vhdl_ghdl_executable', 'ghdl') " Compile w/VHDL-2008 support call ale#Set('vhdl_ghdl_options', '--std=08') function! ale_linters#vhdl#ghdl#GetCommand(buffer) abort return '%e -s ' . ale#Pad(ale#Var(a:buffer, 'vhdl_ghdl_options')) . ' %t' endfunction function! ale_linters#vhdl#ghdl#Handle(buffer, lines) abort " Look for 'error' lines like the following: " dff_en.vhd:41:5:error: 'begin' is expected instead of 'if' " /path/to/file.vhdl:12:8: no declaration for "i0" let l:pattern = '^[a-zA-Z0-9\-\.\_\/ ]\+:\(\d\+\):\(\d\+\):\(.*\)' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) call add(l:output, { \ 'lnum': l:match[1] + 0, \ 'col' : l:match[2] + 0, \ 'text': l:match[3], \ 'type': 'E', \}) endfor return l:output endfunction call ale#linter#Define('vhdl', { \ 'name': 'ghdl', \ 'output_stream': 'stderr', \ 'executable': {b -> ale#Var(b, 'vhdl_ghdl_executable')}, \ 'command': function('ale_linters#vhdl#ghdl#GetCommand'), \ 'callback': 'ale_linters#vhdl#ghdl#Handle', \}) ale-4.0.0/ale_linters/vhdl/hdl_checker.vim000066400000000000000000000003671476501472200205000ustar00rootroot00000000000000" Author: suoto " Description: Adds support for HDL Code Checker, which wraps vcom/vlog, ghdl " or xvhdl. More info on https://github.com/suoto/hdl_checker call ale#handlers#hdl_checker#DefineLinter('vhdl') ale-4.0.0/ale_linters/vhdl/vcom.vim000066400000000000000000000027521476501472200172110ustar00rootroot00000000000000" Author: John Gentile " Description: Adds support for Mentor Graphics Questa/ModelSim `vcom` VHDL compiler/checker call ale#Set('vhdl_vcom_executable', 'vcom') " Use VHDL-2008. See `$ vcom -h` for more options call ale#Set('vhdl_vcom_options', '-2008 -quiet -lint') function! ale_linters#vhdl#vcom#GetCommand(buffer) abort return '%e ' . ale#Pad(ale#Var(a:buffer, 'vhdl_vcom_options')) . ' %t' endfunction function! ale_linters#vhdl#vcom#Handle(buffer, lines) abort "Matches patterns like the following: "** Warning: ../path/to/file.vhd(218): (vcom-1236) Shared variables must be of a protected type. "** Error: tb_file.vhd(73): (vcom-1136) Unknown identifier "aresetn". "** Error: tb_file.vhd(73): Bad resolution function (STD_LOGIC) for type (error). "** Error: tb_file.vhd(73): near ":": (vcom-1576) expecting ';' or ')'. let l:pattern = '^**\s\(\w*\):[a-zA-Z0-9\-\.\_\/ ]\+(\(\d\+\)):\s\+\(.*\)' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) call add(l:output, { \ 'lnum': l:match[2] + 0, \ 'type': l:match[1] is? 'Error' ? 'E' : 'W', \ 'text': l:match[3], \}) endfor return l:output endfunction call ale#linter#Define('vhdl', { \ 'name': 'vcom', \ 'output_stream': 'stdout', \ 'executable': {b -> ale#Var(b, 'vhdl_vcom_executable')}, \ 'command': function('ale_linters#vhdl#vcom#GetCommand'), \ 'callback': 'ale_linters#vhdl#vcom#Handle', \}) ale-4.0.0/ale_linters/vhdl/xvhdl.vim000066400000000000000000000024611476501472200173670ustar00rootroot00000000000000" Author: John Gentile " Description: Adds support for Xilinx Vivado `xvhdl` VHDL compiler/checker call ale#Set('vhdl_xvhdl_executable', 'xvhdl') " Use VHDL-2008. See `$ xvhdl -h` for more options call ale#Set('vhdl_xvhdl_options', '--2008') function! ale_linters#vhdl#xvhdl#GetCommand(buffer) abort return '%e ' . ale#Pad(ale#Var(a:buffer, 'vhdl_xvhdl_options')) . ' %t' endfunction function! ale_linters#vhdl#xvhdl#Handle(buffer, lines) abort "Matches patterns like the following: " ERROR: [VRFC 10-91] aresetn is not declared [/path/to/file.vhd:17] " ERROR: [VRFC 10-91] m_axis_tx_tdata is not declared [/home/user/tx_data.vhd:128] let l:pattern = '^ERROR:\s\+\(\[.*\)\[.*:\([0-9]\+\)\]' let l:output = [] " NOTE: `xvhdl` only prints 'INFO' and 'ERROR' messages for l:match in ale#util#GetMatches(a:lines, l:pattern) call add(l:output, { \ 'lnum': l:match[2] + 0, \ 'type': 'E', \ 'text': l:match[1], \}) endfor return l:output endfunction call ale#linter#Define('vhdl', { \ 'name': 'xvhdl', \ 'output_stream': 'stdout', \ 'executable': {b -> ale#Var(b, 'vhdl_xvhdl_executable')}, \ 'command': function('ale_linters#vhdl#xvhdl#GetCommand'), \ 'callback': 'ale_linters#vhdl#xvhdl#Handle', \}) ale-4.0.0/ale_linters/vim/000077500000000000000000000000001476501472200153605ustar00rootroot00000000000000ale-4.0.0/ale_linters/vim/ale_custom_linting_rules.vim000066400000000000000000000045731476501472200231770ustar00rootroot00000000000000" Author: w0rp " Description: A linter for checking ALE project code itself. function! ale_linters#vim#ale_custom_linting_rules#GetExecutable(buffer) abort let l:filename = expand('#' . a:buffer . ':p') let l:dir_list = [] for l:dir in split(&runtimepath, ',') if l:filename[:len(l:dir) - 1] is# l:dir call add(l:dir_list, l:dir) endif endfor return !empty(l:dir_list) \ ? findfile('test/script/custom-linting-rules', join(l:dir_list, ',')) \ : '' endfunction function! s:GetALEProjectDir(buffer) abort let l:executable = ale_linters#vim#ale_custom_linting_rules#GetExecutable(a:buffer) return ale#path#Dirname(ale#path#Dirname(ale#path#Dirname(l:executable))) endfunction function! ale_linters#vim#ale_custom_linting_rules#GetCwd(buffer) abort let l:executable = ale_linters#vim#ale_custom_linting_rules#GetExecutable(a:buffer) return ale#path#Dirname(ale#path#Dirname(ale#path#Dirname(l:executable))) endfunction function! ale_linters#vim#ale_custom_linting_rules#GetCommand(buffer) abort let l:temp_dir = ale#command#CreateDirectory(a:buffer) let l:temp_file = l:temp_dir . '/example.vim' let l:lines = getbufline(a:buffer, 1, '$') call ale#util#Writefile(a:buffer, l:lines, l:temp_file) return '%e ' . ale#Escape(l:temp_dir) endfunction function! ale_linters#vim#ale_custom_linting_rules#Handle(buffer, lines) abort let l:dir = s:GetALEProjectDir(a:buffer) let l:output = [] let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+) (.+)$' for l:match in ale#util#GetMatches(a:lines, l:pattern) " Ignore trailing whitespace errors if we've turned them off. if !ale#Var(a:buffer, 'warn_about_trailing_whitespace') \&& l:match[3] is# 'Trailing whitespace' continue endif call add(l:output, { \ 'lnum': l:match[2], \ 'text': l:match[3], \ 'type': 'W', \}) endfor return l:output endfunction call ale#linter#Define('vim', { \ 'name': 'ale_custom_linting_rules', \ 'executable': function('ale_linters#vim#ale_custom_linting_rules#GetExecutable'), \ 'cwd': function('ale_linters#vim#ale_custom_linting_rules#GetCwd'), \ 'command': function('ale_linters#vim#ale_custom_linting_rules#GetCommand'), \ 'callback': 'ale_linters#vim#ale_custom_linting_rules#Handle', \ 'read_buffer': 0, \}) ale-4.0.0/ale_linters/vim/vimls.vim000066400000000000000000000032571476501472200172360ustar00rootroot00000000000000" Author: Jeffrey Lau - https://github.com/zoonfafer " Description: Vim Language Server integration for ALE call ale#Set('vim_vimls_executable', 'vim-language-server') call ale#Set('vim_vimls_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('vim_vimls_config', {}) function! ale_linters#vim#vimls#GetProjectRoot(buffer) abort let l:trigger_file_candidates = [ \ '.vimrc', \ 'init.vim', \] for l:candidate in l:trigger_file_candidates let l:trigger_file = fnamemodify(bufname(a:buffer), ':t') if l:trigger_file is# l:candidate return fnamemodify( \ bufname(a:buffer), \ ':h', \) endif endfor let l:trigger_dir_candidates = [ \ 'autoload', \ 'plugin', \ '.git', \] let l:path_upwards = ale#path#Upwards(fnamemodify(bufname(a:buffer), ':p:h')) for l:path in l:path_upwards for l:candidate in l:trigger_dir_candidates let l:trigger_dir = ale#path#Simplify( \ l:path . '/' . l:candidate, \) if isdirectory(l:trigger_dir) return fnamemodify( \ l:trigger_dir, \ ':p:h:h', \) endif endfor endfor return '' endfunction call ale#linter#Define('vim', { \ 'name': 'vimls', \ 'lsp': 'stdio', \ 'lsp_config': {b -> ale#Var(b, 'vim_vimls_config')}, \ 'executable': {b -> ale#path#FindExecutable(b, 'vim_vimls', [ \ 'node_modules/.bin/vim-language-server', \ ])}, \ 'command': '%e --stdio', \ 'language': 'vim', \ 'project_root': function('ale_linters#vim#vimls#GetProjectRoot'), \}) ale-4.0.0/ale_linters/vim/vint.vim000066400000000000000000000042371476501472200170630ustar00rootroot00000000000000" Author: w0rp , KabbAmine " Description: This file adds support for checking Vim code with Vint. " This flag can be used to change enable/disable style issues. call ale#Set('vim_vint_show_style_issues', 1) call ale#Set('vim_vint_executable', 'vint') let s:enable_neovim = has('nvim') ? ' --enable-neovim' : '' let s:format = '-f "{file_path}:{line_number}:{column_number}: {severity}: {policy_name} - {description} (see {reference})"' function! ale_linters#vim#vint#GetCommand(buffer, version) abort let l:can_use_no_color_flag = empty(a:version) \ || ale#semver#GTE(a:version, [0, 3, 7]) let l:warning_flag = ale#Var(a:buffer, 'vim_vint_show_style_issues') ? '-s' : '-w' " Use the --stdin-display-name argument if supported, temp file otherwise. let l:stdin_or_temp = ale#semver#GTE(a:version, [0, 4, 0]) \ ? ' --stdin-display-name %s -' \ : ' %t' return '%e' \ . ' ' . l:warning_flag \ . (l:can_use_no_color_flag ? ' --no-color' : '') \ . s:enable_neovim \ . ' ' . s:format \ . l:stdin_or_temp endfunction let s:word_regex_list = [ \ '\v^Undefined variable: ([^ ]+)', \ '\v^Make the scope explicit like ...([^ ]+). ', \ '\v^.*start with a capital or contain a colon: ([^ ]+)', \ '\v.*instead of .(\=[=~]).', \] function! ale_linters#vim#vint#Handle(buffer, lines) abort let l:loclist = ale#handlers#gcc#HandleGCCFormat(a:buffer, a:lines) for l:item in l:loclist let l:match = [] for l:regex in s:word_regex_list let l:match = matchlist(l:item.text, l:regex) if !empty(l:match) let l:item.end_col = l:item.col + len(l:match[1]) - 1 break endif endfor endfor return l:loclist endfunction call ale#linter#Define('vim', { \ 'name': 'vint', \ 'executable': {buffer -> ale#Var(buffer, 'vim_vint_executable')}, \ 'command': {buffer -> ale#semver#RunWithVersionCheck( \ buffer, \ ale#Var(buffer, 'vim_vint_executable'), \ '%e --version', \ function('ale_linters#vim#vint#GetCommand'), \ )}, \ 'callback': 'ale_linters#vim#vint#Handle', \}) ale-4.0.0/ale_linters/vue/000077500000000000000000000000001476501472200153645ustar00rootroot00000000000000ale-4.0.0/ale_linters/vue/cspell.vim000066400000000000000000000002261476501472200173630ustar00rootroot00000000000000scriptencoding utf-8 " Author: David Houston " Description: cspell support for Vue files. call ale#handlers#cspell#DefineLinter('vue') ale-4.0.0/ale_linters/vue/vls.vim000066400000000000000000000014241476501472200167060ustar00rootroot00000000000000" Author: Alexander Olofsson " Description: Vue vls Language Server integration for ALE call ale#Set('vue_vls_executable', 'vls') call ale#Set('vue_vls_use_global', get(g:, 'ale_use_global_executables', 0)) function! ale_linters#vue#vls#GetProjectRoot(buffer) abort let l:package_path = ale#path#FindNearestFile(a:buffer, 'package.json') return !empty(l:package_path) ? fnamemodify(l:package_path, ':h') : '' endfunction call ale#linter#Define('vue', { \ 'name': 'vls', \ 'aliases': ['vuels'], \ 'lsp': 'stdio', \ 'executable': {b -> ale#path#FindExecutable(b, 'vue_vls', [ \ 'node_modules/.bin/vls', \ ])}, \ 'command': '%e --stdio', \ 'language': 'vue', \ 'project_root': function('ale_linters#vue#vls#GetProjectRoot'), \}) ale-4.0.0/ale_linters/vue/volar.vim000066400000000000000000000036121476501472200172260ustar00rootroot00000000000000" Author: Arnold Chand " Description: Volar Language Server integration for ALE adopted from " nvim-lspconfig and volar/packages/shared/src/types.ts call ale#Set('vue_volar_executable', 'vue-language-server') call ale#Set('vue_volar_use_global', 1) call ale#Set('vue_volar_init_options', { \ 'typescript': { 'tsdk': '' }, \}) function! ale_linters#vue#volar#GetProjectRoot(buffer) abort let l:project_roots = [ \ 'package.json', \ 'vite.config.js', \ 'vite.config.mjs', \ 'vite.config.cjs', \ 'vite.config.ts', \ '.git', \ bufname(a:buffer) \] for l:project_root in l:project_roots let l:nearest_filepath = ale#path#FindNearestFile(a:buffer, l:project_root) if !empty(l:nearest_filepath) return fnamemodify(l:nearest_filepath, ':h') endif endfor return '' endfunction function! ale_linters#vue#volar#GetInitializationOptions(buffer) abort let l:tsserver_path = ale#path#FindNearestDirectory(a:buffer, 'node_modules/typescript/lib') if l:tsserver_path is# '' " no-custom-checks echohl WarningMsg " no-custom-checks echom '[volar] Must have typescript installed in project, please install via `npm install -D typescript`.' " no-custom-checks echohl None endif let l:init_options = ale#Var(a:buffer, 'vue_volar_init_options') let l:init_options.typescript.tsdk = l:tsserver_path return l:init_options endfunction call ale#linter#Define('vue', { \ 'name': 'volar', \ 'language': 'vue', \ 'lsp': 'stdio', \ 'executable': {b -> ale#path#FindExecutable(b, 'vue_volar', ['node_modules/.bin/vue-language-server'])}, \ 'command': '%e --stdio', \ 'project_root': function('ale_linters#vue#volar#GetProjectRoot'), \ 'initialization_options': function('ale_linters#vue#volar#GetInitializationOptions'), \}) ale-4.0.0/ale_linters/wgsl/000077500000000000000000000000001476501472200155415ustar00rootroot00000000000000ale-4.0.0/ale_linters/wgsl/naga.vim000066400000000000000000000005741476501472200171720ustar00rootroot00000000000000" Author: rhysd " Description: naga-cli linter for WGSL syntax. call ale#Set('wgsl_naga_executable', 'naga') call ale#linter#Define('wgsl', { \ 'name': 'naga', \ 'executable': {b -> ale#Var(b, 'wgsl_naga_executable')}, \ 'output_stream': 'stderr', \ 'command': {b -> '%e --stdin-file-path %s'}, \ 'callback': 'ale#handlers#naga#Handle', \}) ale-4.0.0/ale_linters/xhtml/000077500000000000000000000000001476501472200157215ustar00rootroot00000000000000ale-4.0.0/ale_linters/xhtml/alex.vim000066400000000000000000000002151476501472200173650ustar00rootroot00000000000000" Author: Johannes Wienke " Description: alex for XHTML files call ale#handlers#alex#DefineLinter('xhtml', '--text') ale-4.0.0/ale_linters/xhtml/cspell.vim000066400000000000000000000002321476501472200177150ustar00rootroot00000000000000scriptencoding utf-8 " Author: David Houston " Description: cspell support for XHTML files. call ale#handlers#cspell#DefineLinter('xhtml') ale-4.0.0/ale_linters/xhtml/proselint.vim000066400000000000000000000004231476501472200204540ustar00rootroot00000000000000" Author: Daniel M. Capella https://github.com/polyzen " Description: proselint for XHTML files call ale#linter#Define('xhtml', { \ 'name': 'proselint', \ 'executable': 'proselint', \ 'command': 'proselint %t', \ 'callback': 'ale#handlers#unix#HandleAsWarning', \}) ale-4.0.0/ale_linters/xhtml/writegood.vim000066400000000000000000000002171476501472200204410ustar00rootroot00000000000000" Author: Sumner Evans " Description: write-good for XHTML files call ale#handlers#writegood#DefineLinter('xhtml') ale-4.0.0/ale_linters/xml/000077500000000000000000000000001476501472200153655ustar00rootroot00000000000000ale-4.0.0/ale_linters/xml/xmllint.vim000066400000000000000000000040141476501472200175700ustar00rootroot00000000000000" Author: q12321q " Description: This file adds support for checking XML code with xmllint. " CLI options let g:ale_xml_xmllint_executable = get(g:, 'ale_xml_xmllint_executable', 'xmllint') let g:ale_xml_xmllint_options = get(g:, 'ale_xml_xmllint_options', '') function! ale_linters#xml#xmllint#GetCommand(buffer) abort return '%e' \ . ale#Pad(ale#Var(a:buffer, 'xml_xmllint_options')) \ . ' --noout -' endfunction function! ale_linters#xml#xmllint#Handle(buffer, lines) abort " Matches patterns lines like the following: " file/path:123: error level : error message let l:pattern_message = '\v^([^:]+):(\d+):\s*(([^:]+)\s*:\s+.*)$' " parse column token line like that: " file/path:123: parser error : Opening and ending tag mismatch: foo line 1 and bar " " ^ let l:pattern_column_token = '\v^\s*\^$' let l:output = [] for l:line in a:lines " Parse error/warning lines let l:match_message = matchlist(l:line, l:pattern_message) if !empty(l:match_message) let l:line = l:match_message[2] + 0 let l:type = l:match_message[4] =~? 'warning' ? 'W' : 'E' let l:text = l:match_message[3] call add(l:output, { \ 'lnum': l:line, \ 'text': l:text, \ 'type': l:type, \}) continue endif " Parse column position let l:match_column_token = matchlist(l:line, l:pattern_column_token) if !empty(l:output) && !empty(l:match_column_token) let l:previous = l:output[len(l:output) - 1] let l:previous['col'] = len(l:match_column_token[0]) continue endif endfor return l:output endfunction call ale#linter#Define('xml', { \ 'name': 'xmllint', \ 'output_stream': 'stderr', \ 'executable': {b -> ale#Var(b, 'xml_xmllint_executable')}, \ 'command': function('ale_linters#xml#xmllint#GetCommand'), \ 'callback': 'ale_linters#xml#xmllint#Handle', \ }) ale-4.0.0/ale_linters/yaml/000077500000000000000000000000001476501472200155275ustar00rootroot00000000000000ale-4.0.0/ale_linters/yaml/actionlint.vim000066400000000000000000000054551476501472200204210ustar00rootroot00000000000000" Author: Peter Benjamin " Description: Linter for GitHub Workflows call ale#Set('yaml_actionlint_executable', 'actionlint') call ale#Set('yaml_actionlint_options', '') function! ale_linters#yaml#actionlint#GetCommand(buffer) abort " Only execute actionlint on YAML files in /.github/ paths. if expand('#' . a:buffer . ':p') !~# '\v[/\\]\.github[/\\]' return '' endif let l:options = ale#Var(a:buffer, 'yaml_actionlint_options') if l:options !~# '-no-color' let l:options .= ale#Pad('-no-color') endif if l:options !~# '-oneline' let l:options .= ale#Pad('-oneline') endif let l:configfile = ale_linters#yaml#actionlint#GitRepoHasConfig(a:buffer) if !empty(l:configfile) let l:options .= ale#Pad('-config-file ' . l:configfile) endif return '%e' . ale#Pad(l:options) . ' - ' endfunction " If we have a actionlint.yml or actionlint.yaml in our github directory " use that as our config file. function! ale_linters#yaml#actionlint#GitRepoHasConfig(buffer) abort let l:filename = expand('#' . a:buffer . ':p') let l:configfilebase = substitute(l:filename, '\.github/.*', '.github/actionlint.','') for l:ext in ['yml', 'yaml'] let l:configfile = l:configfilebase . l:ext if filereadable(l:configfile) return l:configfile endif endfor return '' endfunction function! ale_linters#yaml#actionlint#Handle(buffer, lines) abort " Matches patterns line the following: ".github/workflows/main.yml:19:0: could not parse as YAML: yaml: line 19: mapping values are not allowed in this context [yaml-syntax] let l:pattern = '\v^.{-}:(\d+):(\d+): (.+) \[(.+)\]$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) let l:code = l:match[4] let l:text = l:match[3] " Handle sub-linter errors like the following: "validate.yml:19:9: shellcheck reported issue in this script: SC2086:info:1:15: Double quote to prevent globbing and word splitting [shellcheck] if l:code is# 'shellcheck' let l:shellcheck_match = matchlist(l:text, '\v^.+: (SC\d{4}):.+:\d+:\d+: (.+)$') let l:text = l:shellcheck_match[2] let l:code = 'shellcheck ' . l:shellcheck_match[1] endif let l:item = { \ 'lnum': l:match[1] + 0, \ 'col': l:match[2] + 0, \ 'text': l:text, \ 'code': l:code, \ 'type': 'E', \} call add(l:output, l:item) endfor return l:output endfunction call ale#linter#Define('yaml', { \ 'name': 'actionlint', \ 'executable': {b -> ale#Var(b, 'yaml_actionlint_executable')}, \ 'command': function('ale_linters#yaml#actionlint#GetCommand'), \ 'callback': 'ale_linters#yaml#actionlint#Handle', \}) ale-4.0.0/ale_linters/yaml/circleci.vim000066400000000000000000000020121476501472200200140ustar00rootroot00000000000000function! ale_linters#yaml#circleci#Handle(buffer, lines) abort let l:match_index = -1 let l:output = [] for l:index in range(len(a:lines)) let l:line = a:lines[l:index] if l:line =~? 'Error: ERROR IN CONFIG FILE:' let l:match_index = l:index + 1 break endif endfor if l:match_index > 0 return [{ \ 'type': 'E', \ 'lnum': 1, \ 'text': a:lines[l:match_index], \ 'detail': join(a:lines[l:match_index :], "\n"), \}] endif return [] endfunction " The circleci validate requires network requests, so we'll only run it when " files are saved to prevent the server from being hammered. call ale#linter#Define('yaml', { \ 'name': 'circleci', \ 'executable': {b -> expand('#' . b . ':p') =~? '\.circleci' ? 'circleci' : ''}, \ 'command': 'circleci --skip-update-check config validate - < %s', \ 'callback': 'ale_linters#yaml#circleci#Handle', \ 'output_stream': 'stderr', \ 'lint_file': 1, \}) ale-4.0.0/ale_linters/yaml/gitlablint.vim000066400000000000000000000030661476501472200204020ustar00rootroot00000000000000call ale#Set('yaml_gitlablint_executable', 'gll') call ale#Set('yaml_gitlablint_options', '') function! ale_linters#yaml#gitlablint#GetCommand(buffer) abort return '%e' . ale#Pad(ale#Var(a:buffer, 'yaml_gitlablint_options')) \ . ' -p %t' endfunction function! ale_linters#yaml#gitlablint#Handle(buffer, lines) abort " Matches patterns line the following: " (): mapping values are not allowed in this context at line 68 column 8 " jobs:build:dev config contains unknown keys: ony let l:pattern = '^\(.*\) at line \(\d\+\) column \(\d\+\)$' let l:output = [] for l:line in a:lines let l:match = matchlist(l:line, l:pattern) if !empty(l:match) let l:item = { \ 'lnum': l:match[2] + 0, \ 'col': l:match[3] + 0, \ 'text': l:match[1], \ 'type': 'E', \} call add(l:output, l:item) else if l:line isnot# 'GitLab CI configuration is invalid' let l:item = { \ 'lnum': 0, \ 'col': 0, \ 'text': l:line, \ 'type': 'E', \} call add(l:output, l:item) endif endif endfor return l:output endfunction call ale#linter#Define('yaml', { \ 'name': 'gitlablint', \ 'executable': {b -> ale#Var(b, 'yaml_gitlablint_executable')}, \ 'command': function('ale_linters#yaml#gitlablint#GetCommand'), \ 'callback': 'ale_linters#yaml#gitlablint#Handle', \ 'output_stream': 'stderr', \}) ale-4.0.0/ale_linters/yaml/ls.vim000066400000000000000000000023551476501472200166670ustar00rootroot00000000000000" Author: Jeffrey Lau - https://github.com/zoonfafer " Description: YAML Language Server https://github.com/redhat-developer/yaml-language-server call ale#Set('yaml_ls_executable', 'yaml-language-server') call ale#Set('yaml_ls_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('yaml_ls_config', {}) function! ale_linters#yaml#ls#GetExecutable(buffer) abort return ale#path#FindExecutable(a:buffer, 'yaml_ls', [ \ 'node_modules/.bin/yaml-language-server', \]) endfunction function! ale_linters#yaml#ls#GetCommand(buffer) abort let l:executable = ale_linters#yaml#ls#GetExecutable(a:buffer) return ale#Escape(l:executable) . ' --stdio' endfunction " Just use the current file function! ale_linters#yaml#ls#FindProjectRoot(buffer) abort let l:project_file = expand('#' . a:buffer . ':p') return fnamemodify(l:project_file, ':h') endfunction call ale#linter#Define('yaml', { \ 'name': 'yaml-language-server', \ 'aliases': ['yamlls'], \ 'lsp': 'stdio', \ 'executable': function('ale_linters#yaml#ls#GetExecutable'), \ 'command': function('ale_linters#yaml#ls#GetCommand'), \ 'project_root': function('ale_linters#yaml#ls#FindProjectRoot'), \ 'lsp_config': {b -> ale#Var(b, 'yaml_ls_config')}, \}) ale-4.0.0/ale_linters/yaml/spectral.vim000066400000000000000000000010411476501472200200550ustar00rootroot00000000000000" Author: t2h5 " Description: Integration of Stoplight Spectral CLI with ALE. call ale#Set('yaml_spectral_executable', 'spectral') call ale#Set('yaml_spectral_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#linter#Define('yaml', { \ 'name': 'spectral', \ 'executable': {b -> ale#path#FindExecutable(b, 'yaml_spectral', [ \ 'node_modules/.bin/spectral', \ ])}, \ 'command': '%e lint --ignore-unknown-format -q -f text %t', \ 'callback': 'ale#handlers#spectral#HandleSpectralOutput' \}) ale-4.0.0/ale_linters/yaml/swaglint.vim000066400000000000000000000024141476501472200200750ustar00rootroot00000000000000" Author: Matthew Turland " Description: This file adds support for linting Swagger / OpenAPI documents using swaglint call ale#Set('yaml_swaglint_executable', 'swaglint') call ale#Set('yaml_swaglint_use_global', get(g:, 'ale_use_global_executables', 0)) function! ale_linters#yaml#swaglint#Handle(buffer, lines) abort let l:pattern = ': \([^\s]\+\) @ \(\d\+\):\(\d\+\) - \(.\+\)$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) let l:obj = { \ 'type': l:match[1] is# 'error' ? 'E' : 'W', \ 'lnum': l:match[2] + 0, \ 'col': l:match[3] + 0, \ 'text': l:match[4], \} " Parse the code if it's there. let l:code_match = matchlist(l:obj.text, '\v^(.+) \(([^ (]+)\)$') if !empty(l:code_match) let l:obj.text = l:code_match[1] let l:obj.code = l:code_match[2] endif call add(l:output, l:obj) endfor return l:output endfunction call ale#linter#Define('yaml', { \ 'name': 'swaglint', \ 'executable': {b -> ale#path#FindExecutable(b, 'yaml_swaglint', [ \ 'node_modules/.bin/swaglint', \ ])}, \ 'command': '%e -r compact --stdin', \ 'callback': 'ale_linters#yaml#swaglint#Handle', \}) ale-4.0.0/ale_linters/yaml/yamllint.vim000066400000000000000000000005671476501472200201050ustar00rootroot00000000000000" Author: KabbAmine call ale#Set('yaml_yamllint_executable', 'yamllint') call ale#Set('yaml_yamllint_options', '') call ale#linter#Define('yaml', { \ 'name': 'yamllint', \ 'executable': {b -> ale#Var(b, 'yaml_yamllint_executable')}, \ 'command': function('ale#handlers#yamllint#GetCommand'), \ 'callback': 'ale#handlers#yamllint#Handle', \}) ale-4.0.0/ale_linters/yaml/yq.vim000066400000000000000000000012171476501472200166760ustar00rootroot00000000000000" Author: axhav call ale#Set('yaml_yq_executable', 'yq') call ale#Set('yaml_yq_options', '') call ale#Set('yaml_yq_filters', '.') " Matches patterns like the following: let s:pattern = '^Error\:.* line \(\d\+\)\: \(.\+\)$' function! ale_linters#yaml#yq#Handle(buffer, lines) abort return ale#util#MapMatches(a:lines, s:pattern, {match -> { \ 'lnum': match[1] + 0, \ 'text': match[2], \}}) endfunction call ale#linter#Define('yaml', { \ 'name': 'yq', \ 'executable': {b -> ale#Var(b, 'yaml_yq_executable')}, \ 'output_stream': 'stderr', \ 'command': '%e', \ 'callback': 'ale_linters#yaml#yq#Handle', \}) ale-4.0.0/ale_linters/yang/000077500000000000000000000000001476501472200155235ustar00rootroot00000000000000ale-4.0.0/ale_linters/yang/yang_lsp.vim000066400000000000000000000010201476501472200200450ustar00rootroot00000000000000call ale#Set('yang_lsp_executable', 'yang-language-server') function! ale_linters#yang#yang_lsp#GetProjectRoot(buffer) abort let l:project_root = ale#path#FindNearestFile(a:buffer, 'yang.settings') return !empty(l:project_root) ? fnamemodify(l:project_root, ':h') : '' endfunction call ale#linter#Define('yang', { \ 'name': 'yang_lsp', \ 'lsp': 'stdio', \ 'executable': {b -> ale#Var(b, 'yang_lsp_executable')}, \ 'project_root': function('ale_linters#yang#yang_lsp#GetProjectRoot'), \ 'command': '%e', \}) ale-4.0.0/ale_linters/yara/000077500000000000000000000000001476501472200155215ustar00rootroot00000000000000ale-4.0.0/ale_linters/yara/yls.vim000066400000000000000000000010631476501472200170450ustar00rootroot00000000000000" Author: TcM1911 " Description: A language server for Yara. call ale#Set('yara_yls_executable', 'yls') function! ale_linters#yara#yls#FindProjectRoot(buffer) abort let l:project_root = ale#path#FindNearestDirectory(a:buffer, '.git') return !empty(l:project_root) ? (ale#path#Upwards(l:project_root)[1]) : '' endfunction call ale#linter#Define('yara', { \ 'name': 'yls', \ 'lsp': 'stdio', \ 'executable': {b -> ale#Var(b, 'yara_yls_executable')}, \ 'command': '%e -v', \ 'project_root': function('ale_linters#yara#yls#FindProjectRoot'), \}) ale-4.0.0/ale_linters/zeek/000077500000000000000000000000001476501472200155235ustar00rootroot00000000000000ale-4.0.0/ale_linters/zeek/zeek.vim000066400000000000000000000013401476501472200171740ustar00rootroot00000000000000" Author: Benjamin Bannier " Description: Support for checking Zeek files. " call ale#Set('zeek_zeek_executable', 'zeek') function! ale_linters#zeek#zeek#HandleErrors(buffer, lines) abort let l:pattern = '\(error\|warning\) in \v.*, line (\d+): (.*)$' return map(ale#util#GetMatches(a:lines, l:pattern), "{ \ 'lnum': str2nr(v:val[2]), \ 'text': v:val[3], \ 'type': (v:val[1] is# 'error') ? 'E': 'W', \}") endfunction call ale#linter#Define('zeek', { \ 'name': 'zeek', \ 'executable': {b -> ale#Var(b, 'zeek_zeek_executable')}, \ 'output_stream': 'stderr', \ 'command': {-> '%e --parse-only %s'}, \ 'callback': 'ale_linters#zeek#zeek#HandleErrors', \ 'lint_file': 1, \}) ale-4.0.0/ale_linters/zig/000077500000000000000000000000001476501472200153565ustar00rootroot00000000000000ale-4.0.0/ale_linters/zig/zls.vim000066400000000000000000000012131476501472200167000ustar00rootroot00000000000000" Author: CherryMan " Description: A language server for Zig call ale#Set('zig_zls_executable', 'zls') call ale#Set('zig_zls_config', {}) function! ale_linters#zig#zls#GetProjectRoot(buffer) abort let l:build_rs = ale#path#FindNearestFile(a:buffer, 'build.zig') return !empty(l:build_rs) ? fnamemodify(l:build_rs, ':h') : '' endfunction call ale#linter#Define('zig', { \ 'name': 'zls', \ 'lsp': 'stdio', \ 'lsp_config': {b -> ale#Var(b, 'zig_zls_config')}, \ 'executable': {b -> ale#Var(b, 'zig_zls_executable')}, \ 'command': '%e', \ 'project_root': function('ale_linters#zig#zls#GetProjectRoot'), \}) ale-4.0.0/autoload/000077500000000000000000000000001476501472200140745ustar00rootroot00000000000000ale-4.0.0/autoload/ale.vim000066400000000000000000000227651476501472200153660ustar00rootroot00000000000000" Author: w0rp , David Alexander " Description: Primary code path for the plugin " Manages execution of linters when requested by autocommands " Strings used for severity in the echoed message let g:ale_echo_msg_error_str = get(g:, 'ale_echo_msg_error_str', 'Error') let g:ale_echo_msg_info_str = get(g:, 'ale_echo_msg_info_str', 'Info') let g:ale_echo_msg_log_str = get(g:, 'ale_echo_msg_log_str', 'Log') let g:ale_echo_msg_warning_str = get(g:, 'ale_echo_msg_warning_str', 'Warning') " LSP window/showMessage format let g:ale_lsp_show_message_format = get(g:, 'ale_lsp_show_message_format', '%severity%:%linter%: %s') " Valid values mimic LSP definitions (error, warning and information; log is " never shown) let g:ale_lsp_show_message_severity = get(g:, 'ale_lsp_show_message_severity', 'error') let s:lint_timer = -1 let s:getcmdwintype_exists = exists('*getcmdwintype') " Return 1 if a file is too large for ALE to handle. function! ale#FileTooLarge(buffer) abort let l:max = getbufvar(a:buffer, 'ale_maximum_file_size', get(g:, 'ale_maximum_file_size', 0)) return l:max > 0 ? (line2byte(line('$') + 1) > l:max) : 0 endfunction " A function for checking various conditions whereby ALE just shouldn't " attempt to do anything, say if particular buffer types are open in Vim. function! ale#ShouldDoNothing(buffer) abort " The checks are split into separate if statements to make it possible to " profile each check individually with Vim's profiling tools. " " Do nothing if ALE is disabled. if !getbufvar(a:buffer, 'ale_enabled', get(g:, 'ale_enabled', 0)) return 1 endif " Don't perform any checks when newer NeoVim versions are exiting. if get(v:, 'exiting', v:null) isnot v:null return 1 endif let l:filetype = getbufvar(a:buffer, '&filetype') " Do nothing when there's no filetype. if l:filetype is# '' return 1 endif " Do nothing for diff buffers. if getbufvar(a:buffer, '&diff') return 1 endif " Do nothing for blacklisted files. if index(get(g:, 'ale_filetype_blacklist', []), l:filetype) >= 0 return 1 endif " Do nothing if running from command mode. if s:getcmdwintype_exists && !empty(getcmdwintype()) return 1 endif let l:filename = fnamemodify(bufname(a:buffer), ':t') " Do nothing for directories. if l:filename is# '.' return 1 endif " Don't start linting and so on when an operator is pending. if ale#util#Mode(1) is# 'no' return 1 endif " Do nothing if running in the sandbox. if ale#util#InSandbox() return 1 endif " Do nothing if the file is too large. if ale#FileTooLarge(a:buffer) return 1 endif " Do nothing from CtrlP buffers with CtrlP-funky. if exists(':CtrlPFunky') is 2 \&& getbufvar(a:buffer, '&l:statusline') =~# 'CtrlPMode.*funky' return 1 endif return 0 endfunction function! s:Lint(buffer, should_lint_file, timer_id) abort " Use the filetype from the buffer let l:filetype = getbufvar(a:buffer, '&filetype') let l:linters = ale#linter#Get(l:filetype) let l:ignore_config = ale#Var(a:buffer, 'linters_ignore') let l:disable_lsp = ale#Var(a:buffer, 'disable_lsp') " Load code to ignore linters only if we need to. if ( \ !empty(l:ignore_config) \ || l:disable_lsp is 1 \ || l:disable_lsp is v:true \ || (l:disable_lsp is# 'auto' && get(g:, 'lspconfig', 0)) \) let l:linters = ale#engine#ignore#Exclude( \ l:filetype, \ l:linters, \ l:ignore_config, \ l:disable_lsp, \) endif " Tell other sources that they can start checking the buffer now. let g:ale_want_results_buffer = a:buffer silent doautocmd User ALEWantResults unlet! g:ale_want_results_buffer " Don't set up buffer data and so on if there are no linters to run. if !has_key(g:ale_buffer_info, a:buffer) && empty(l:linters) return endif " Clear lint_file linters, or only run them if the file exists. let l:lint_file = empty(l:linters) \ || (a:should_lint_file && filereadable(expand('#' . a:buffer . ':p'))) call ale#engine#RunLinters(a:buffer, l:linters, l:lint_file) endfunction " (delay, [linting_flag, buffer_number]) function! ale#Queue(delay, ...) abort if a:0 > 2 throw 'too many arguments!' endif let l:buffer = get(a:000, 1, v:null) if l:buffer is v:null let l:buffer = bufnr('') endif if type(l:buffer) isnot v:t_number throw 'buffer_number must be a Number' endif if ale#ShouldDoNothing(l:buffer) return endif " Default linting_flag to '' let l:should_lint_file = get(a:000, 0) is# 'lint_file' if s:lint_timer != -1 call timer_stop(s:lint_timer) let s:lint_timer = -1 endif if a:delay > 0 let s:lint_timer = timer_start( \ a:delay, \ function('s:Lint', [l:buffer, l:should_lint_file]) \) else call s:Lint(l:buffer, l:should_lint_file, 0) endif endfunction let s:current_ale_version = [4, 0, 0] " A function used to check for ALE features in files outside of the project. function! ale#Has(feature) abort let l:match = matchlist(a:feature, '\c\v^ale-(\d+)\.(\d+)(\.(\d+))?$') if !empty(l:match) let l:version = [l:match[1] + 0, l:match[2] + 0, l:match[4] + 0] return ale#semver#GTE(s:current_ale_version, l:version) endif return 0 endfunction " Given a buffer number and a variable name, look for that variable in the " buffer scope, then in global scope. If the name does not exist in the global " scope, an exception will be thrown. " " Every variable name will be prefixed with 'ale_'. function! ale#Var(buffer, variable_name) abort let l:full_name = 'ale_' . a:variable_name let l:vars = getbufvar(str2nr(a:buffer), '', {}) return get(l:vars, l:full_name, g:[l:full_name]) endfunction " Initialize a variable with a default value, if it isn't already set. " " Every variable name will be prefixed with 'ale_'. function! ale#Set(variable_name, default) abort let l:full_name = 'ale_' . a:variable_name if !has_key(g:, l:full_name) let g:[l:full_name] = a:default endif endfunction " Given a string for adding to a command, return the string padded with a " space on the left if it is not empty. Otherwise return an empty string. " " This can be used for making command strings cleaner and easier to test. function! ale#Pad(string) abort return !empty(a:string) ? ' ' . a:string : '' endfunction " Given a environment variable name and a value, produce part of a command for " setting an environment variable before running a command. The syntax will be " valid for cmd on Windows, or most shells on Unix. function! ale#Env(variable_name, value) abort if has('win32') return 'set ' . ale#Escape(a:variable_name . '=' . a:value) . ' && ' endif return a:variable_name . '=' . ale#Escape(a:value) . ' ' endfunction " Escape a string suitably for each platform. " shellescape does not work on Windows. function! ale#Escape(str) abort if fnamemodify(&shell, ':t') is? 'cmd.exe' " If the string contains spaces, it will be surrounded by quotes. " Otherwise, special characters will be escaped with carets (^). return substitute( \ a:str =~# ' ' \ ? '"' . substitute(a:str, '"', '""', 'g') . '"' \ : substitute(a:str, '\v([&|<>^])', '^\1', 'g'), \ '%', \ '%%', \ 'g', \) endif return shellescape (a:str) endfunction " Get the loclist item message according to a given format string. " " See `:help g:ale_loclist_msg_format` and `:help g:ale_echo_msg_format` function! ale#GetLocItemMessage(item, format_string) abort let l:msg = a:format_string let l:severity = g:ale_echo_msg_warning_str let l:code = get(a:item, 'code', '') let l:type = get(a:item, 'type', 'E') let l:linter_name = get(a:item, 'linter_name', '') let l:code_repl = !empty(l:code) ? '\=submatch(1) . l:code . submatch(2)' : '' if l:type is# 'E' let l:severity = g:ale_echo_msg_error_str elseif l:type is# 'I' let l:severity = g:ale_echo_msg_info_str endif " Replace special markers with certain information. " \=l:variable is used to avoid escaping issues. let l:msg = substitute(l:msg, '\v\%([^\%]*)code([^\%]*)\%', l:code_repl, 'g') let l:msg = substitute(l:msg, '\V%severity%', '\=l:severity', 'g') let l:msg = substitute(l:msg, '\V%type%', '\=l:type', 'g') let l:msg = substitute(l:msg, '\V%linter%', '\=l:linter_name', 'g') " Replace %s with the text. let l:msg = substitute(l:msg, '\V%s', '\=a:item.text', 'g') " Windows may insert carriage return line endings (^M), strip these characters. let l:msg = substitute(l:msg, '\r', '', 'g') return l:msg endfunction " Given a buffer and a linter or fixer name, return an Array of two-item " Arrays describing how to map filenames to and from the local to foreign file " systems. function! ale#GetFilenameMappings(buffer, name) abort let l:linter_mappings = ale#Var(a:buffer, 'filename_mappings') if type(l:linter_mappings) is v:t_list return l:linter_mappings endif let l:name = a:name if !has_key(l:linter_mappings, l:name) " Use * as a default setting for all tools. let l:name = '*' endif return get(l:linter_mappings, l:name, []) endfunction ale-4.0.0/autoload/ale/000077500000000000000000000000001476501472200146355ustar00rootroot00000000000000ale-4.0.0/autoload/ale/ant.vim000066400000000000000000000024511476501472200161360ustar00rootroot00000000000000" Author: Andrew Lee . " Inspired by ale/gradle.vim by Michael Pardo " Description: Functions for working with Ant projects. " Given a buffer number, find an Ant project root function! ale#ant#FindProjectRoot(buffer) abort let l:build_xml_path = ale#path#FindNearestFile(a:buffer, 'build.xml') if !empty(l:build_xml_path) return fnamemodify(l:build_xml_path, ':h') endif return '' endfunction " Given a buffer number, find the path to the `ant` executable. Returns an empty " string if cannot find the executable. function! ale#ant#FindExecutable(buffer) abort if executable('ant') return 'ant' endif return '' endfunction " Given a buffer number, get a working directory and command to print the " classpath of the root project. " " Returns an empty string for the command if Ant is not detected. function! ale#ant#BuildClasspathCommand(buffer) abort let l:executable = ale#ant#FindExecutable(a:buffer) if !empty(l:executable) let l:project_root = ale#ant#FindProjectRoot(a:buffer) if !empty(l:project_root) return [ \ l:project_root, \ ale#Escape(l:executable) .' classpath -S -q' \] endif endif return ['', ''] endfunction ale-4.0.0/autoload/ale/args.vim000066400000000000000000000022661476501472200163140ustar00rootroot00000000000000" Author: w0rp " Description: This module implements a function for parsing arguments for " commands. " Given a list of valid arguments like ['foo', 'bar'] and a string to parse, " parse the arguments from the string and return [parsed_args, remainder]. " " Arguments must be prefixed in the string with a single minus (-), and a " double minus (--) denotes the end of arguments. function! ale#args#Parse(arg_list, string) abort let l:parsed = {} let l:end_of_args = 0 let l:word_list = split(a:string, ' ') let l:index = 0 while l:index < len(l:word_list) let l:word = l:word_list[l:index] if l:word[:0] is# '-' let l:index += 1 if l:word is# '--' break endif let l:arg = l:word[1:] if index(a:arg_list, l:arg) >= 0 let l:parsed[l:arg] = '' else throw 'Invalid argument: ' . l:word endif elseif l:word is# '' let l:index += 1 else break endif endwhile let l:new_string = join(l:word_list[l:index :], ' ') return [l:parsed, l:new_string] endfunction ale-4.0.0/autoload/ale/assert.vim000066400000000000000000000305701476501472200166600ustar00rootroot00000000000000let s:command_output = [] function! ale#assert#GivenCommandOutput(...) abort let s:command_output = a:000 endfunction function! s:GetLinter() abort let l:linters = ale#linter#GetLintersLoaded() let l:filetype_linters = get(values(l:linters), 0, []) if len(l:linters) is 0 || len(l:filetype_linters) is 0 throw 'No linters were loaded' endif if len(l:linters) > 1 || len(l:filetype_linters) > 1 throw 'More than one linter was loaded' endif return l:filetype_linters[0] endfunction function! s:FormatExe(command, executable) abort return substitute(a:command, '%e', '\=ale#Escape(a:executable)', 'g') endfunction function! s:ProcessDeferredCommands(initial_result) abort let l:result = a:initial_result let l:command_index = 0 let l:command = [] while ale#command#IsDeferred(l:result) call add(l:command, s:FormatExe(l:result.command, l:result.executable)) if get(g:, 'ale_run_synchronously_emulate_commands') " Don't run commands, but simulate the results. let l:Callback = g:ale_run_synchronously_callbacks[0] let l:output = get(s:command_output, l:command_index, []) call l:Callback(0, l:output) unlet g:ale_run_synchronously_callbacks let l:command_index += 1 else " Run the commands in the shell, synchronously. call ale#test#FlushJobs() endif let l:result = l:result.value endwhile call add(l:command, l:result) return l:command endfunction function! s:ProcessDeferredCwds(initial_command, initial_cwd) abort let l:result = a:initial_command let l:last_cwd = v:null let l:command_index = 0 let l:cwd_list = [] while ale#command#IsDeferred(l:result) call add(l:cwd_list, l:result.cwd) if get(g:, 'ale_run_synchronously_emulate_commands') " Don't run commands, but simulate the results. let l:Callback = g:ale_run_synchronously_callbacks[0] let l:output = get(s:command_output, l:command_index, []) call l:Callback(0, l:output) unlet g:ale_run_synchronously_callbacks let l:command_index += 1 else " Run the commands in the shell, synchronously. call ale#test#FlushJobs() endif let l:result = l:result.value endwhile call add(l:cwd_list, a:initial_cwd is v:null ? l:last_cwd : a:initial_cwd) return l:cwd_list endfunction " Load the currently loaded linter for a test case, and check that the command " matches the given string. function! ale#assert#Linter(expected_executable, expected_command) abort let l:buffer = bufnr('') let l:linter = s:GetLinter() let l:executable = ale#linter#GetExecutable(l:buffer, l:linter) while ale#command#IsDeferred(l:executable) call ale#test#FlushJobs() let l:executable = l:executable.value endwhile let l:command = s:ProcessDeferredCommands( \ ale#linter#GetCommand(l:buffer, l:linter), \) if type(a:expected_command) isnot v:t_list let l:command = l:command[-1] endif if type(l:command) is v:t_string " Replace %e with the escaped executable, so tests keep passing after " linters are changed to use %e. let l:command = s:FormatExe(l:command, l:executable) elseif type(l:command) is v:t_list call map(l:command, 's:FormatExe(v:val, l:executable)') endif AssertEqual \ [a:expected_executable, a:expected_command], \ [l:executable, l:command] endfunction function! ale#assert#LinterCwd(expected_cwd) abort let l:buffer = bufnr('') let l:linter = s:GetLinter() let l:initial_cwd = ale#linter#GetCwd(l:buffer, l:linter) call ale#command#SetCwd(l:buffer, l:initial_cwd) let l:cwd = s:ProcessDeferredCwds( \ ale#linter#GetCommand(l:buffer, l:linter), \ l:initial_cwd, \) call ale#command#ResetCwd(l:buffer) if type(a:expected_cwd) isnot v:t_list let l:cwd = l:cwd[-1] endif AssertEqual a:expected_cwd, l:cwd endfunction function! ale#assert#FixerCwd(expected_cwd) abort let l:buffer = bufnr('') let l:cwd = s:ProcessDeferredCwds(s:FixerFunction(l:buffer), v:null) if type(a:expected_cwd) isnot v:t_list let l:cwd = l:cwd[-1] endif AssertEqual a:expected_cwd, l:cwd endfunction function! ale#assert#Fixer(expected_result) abort let l:buffer = bufnr('') let l:result = s:ProcessDeferredCommands(s:FixerFunction(l:buffer)) if type(a:expected_result) isnot v:t_list let l:result = l:result[-1] endif AssertEqual a:expected_result, l:result endfunction function! ale#assert#FixerNotExecuted() abort let l:buffer = bufnr('') let l:result = s:ProcessDeferredCommands(s:FixerFunction(l:buffer))[-1] Assert empty(l:result), "The fixer will be executed when it shouldn't be" endfunction function! ale#assert#LinterNotExecuted() abort let l:buffer = bufnr('') let l:linter = s:GetLinter() let l:executable = ale#linter#GetExecutable(l:buffer, l:linter) let l:executed = 1 if !empty(l:executable) let l:command = ale#linter#GetCommand(l:buffer, l:linter) if type(l:command) is v:t_list let l:command = l:command[-1] endif let l:executed = !empty(l:command) else let l:executed = 0 endif Assert !l:executed, "The linter will be executed when it shouldn't be" endfunction function! ale#assert#LSPOptions(expected_options) abort let l:buffer = bufnr('') let l:linter = s:GetLinter() let l:initialization_options = ale#lsp_linter#GetOptions(l:buffer, l:linter) AssertEqual a:expected_options, l:initialization_options endfunction function! ale#assert#LSPConfig(expected_config) abort let l:buffer = bufnr('') let l:linter = s:GetLinter() let l:config = ale#lsp_linter#GetConfig(l:buffer, l:linter) AssertEqual a:expected_config, l:config endfunction function! ale#assert#LSPLanguage(expected_language) abort let l:buffer = bufnr('') let l:linter = s:GetLinter() let l:language = ale#linter#GetLanguage(l:buffer, l:linter) AssertEqual a:expected_language, l:language endfunction function! ale#assert#LSPProject(expected_root) abort let l:buffer = bufnr('') let l:linter = s:GetLinter() let l:root = ale#lsp_linter#FindProjectRoot(l:buffer, l:linter) AssertEqual a:expected_root, l:root endfunction function! ale#assert#LSPAddress(expected_address) abort let l:buffer = bufnr('') let l:linter = s:GetLinter() let l:address = ale#linter#GetAddress(l:buffer, l:linter) AssertEqual a:expected_address, l:address endfunction function! ale#assert#SetUpLinterTestCommands() abort command! -nargs=+ GivenCommandOutput :call ale#assert#GivenCommandOutput() command! -nargs=+ AssertLinterCwd :call ale#assert#LinterCwd() command! -nargs=+ AssertLinter :call ale#assert#Linter() command! -nargs=0 AssertLinterNotExecuted :call ale#assert#LinterNotExecuted() command! -nargs=+ AssertLSPOptions :call ale#assert#LSPOptions() command! -nargs=+ AssertLSPConfig :call ale#assert#LSPConfig() command! -nargs=+ AssertLSPLanguage :call ale#assert#LSPLanguage() command! -nargs=+ AssertLSPProject :call ale#assert#LSPProject() command! -nargs=+ AssertLSPAddress :call ale#assert#LSPAddress() endfunction function! ale#assert#SetUpFixerTestCommands() abort command! -nargs=+ GivenCommandOutput :call ale#assert#GivenCommandOutput() command! -nargs=+ AssertFixerCwd :call ale#assert#FixerCwd() command! -nargs=+ AssertFixer :call ale#assert#Fixer() command! -nargs=0 AssertFixerNotExecuted :call ale#assert#FixerNotExecuted() endfunction function! ale#assert#ResetVariables(filetype, name, ...) abort " If the suffix of the option names format is different, an additional " argument can be used for that instead. if a:0 > 1 throw 'Too many arguments' endif let l:option_suffix = get(a:000, 0, a:name) let l:prefix = 'ale_' . a:filetype . '_' \ . substitute(l:option_suffix, '-', '_', 'g') let l:filter_expr = 'v:val[: len(l:prefix) - 1] is# l:prefix' " Save and clear linter variables. " We'll load the runtime file to reset them to defaults. for l:key in filter(keys(g:), l:filter_expr) execute 'Save g:' . l:key unlet g:[l:key] endfor for l:key in filter(keys(b:), l:filter_expr) unlet b:[l:key] endfor endfunction " A dummy function for making sure this module is loaded. function! ale#assert#SetUpLinterTest(filetype, name) abort " Set up a marker so ALE doesn't create real random temporary filenames. let g:ale_create_dummy_temporary_file = 1 " Remove current linters. call ale#linter#Reset() call ale#linter#PreventLoading(a:filetype) Save g:ale_root let g:ale_root = {} Save b:ale_root unlet! b:ale_root call ale#assert#ResetVariables(a:filetype, a:name) Save g:ale_c_build_dir unlet! g:ale_c_build_dir unlet! b:ale_c_build_dir execute 'runtime ale_linters/' . a:filetype . '/' . a:name . '.vim' if !exists('g:dir') call ale#test#SetDirectory('/testplugin/test/linter') endif call ale#assert#SetUpLinterTestCommands() let g:ale_run_synchronously = 1 let g:ale_run_synchronously_emulate_commands = 1 endfunction function! ale#assert#TearDownLinterTest() abort unlet! g:ale_create_dummy_temporary_file unlet! g:ale_run_synchronously unlet! g:ale_run_synchronously_callbacks unlet! g:ale_run_synchronously_emulate_commands unlet! g:ale_run_synchronously_command_results let s:command_output = [] if exists(':GivenCommandOutput') delcommand GivenCommandOutput endif if exists(':AssertLinterCwd') delcommand AssertLinterCwd endif if exists(':AssertLinter') delcommand AssertLinter endif if exists(':AssertLinterNotExecuted') delcommand AssertLinterNotExecuted endif if exists(':AssertLSPOptions') delcommand AssertLSPOptions endif if exists(':AssertLSPConfig') delcommand AssertLSPConfig endif if exists(':AssertLSPLanguage') delcommand AssertLSPLanguage endif if exists(':AssertLSPProject') delcommand AssertLSPProject endif if exists(':AssertLSPAddress') delcommand AssertLSPAddress endif if exists('g:dir') call ale#test#RestoreDirectory() endif Restore call ale#linter#Reset() if exists('*ale#semver#ResetVersionCache') call ale#semver#ResetVersionCache() endif endfunction function! ale#assert#SetUpFixerTest(filetype, name, ...) abort " If the suffix of the option names format is different, an additional " argument can be used for that instead. if a:0 > 1 throw 'Too many arguments' endif " Set up a marker so ALE doesn't create real random temporary filenames. let g:ale_create_dummy_temporary_file = 1 let l:function_name = ale#fix#registry#GetFunc(a:name) let s:FixerFunction = function(l:function_name) let l:option_suffix = get(a:000, 0, a:name) call ale#assert#ResetVariables(a:filetype, a:name, l:option_suffix) execute 'runtime autoload/ale/fixers/' . substitute(a:name, '-', '_', 'g') . '.vim' if !exists('g:dir') call ale#test#SetDirectory('/testplugin/test/fixers') endif call ale#assert#SetUpFixerTestCommands() let g:ale_run_synchronously = 1 let g:ale_run_synchronously_emulate_commands = 1 endfunction function! ale#assert#TearDownFixerTest() abort unlet! g:ale_create_dummy_temporary_file unlet! g:ale_run_synchronously unlet! g:ale_run_synchronously_callbacks unlet! g:ale_run_synchronously_emulate_commands unlet! g:ale_run_synchronously_command_results let s:command_output = [] unlet! s:FixerFunction if exists('g:dir') call ale#test#RestoreDirectory() endif Restore if exists('*ale#semver#ResetVersionCache') call ale#semver#ResetVersionCache() endif if exists(':GivenCommandOutput') delcommand GivenCommandOutput endif if exists(':AssertFixerCwd') delcommand AssertFixerCwd endif if exists(':AssertFixer') delcommand AssertFixer endif if exists(':AssertFixerNotExecuted') delcommand AssertFixerNotExecuted endif endfunction ale-4.0.0/autoload/ale/balloon.vim000066400000000000000000000041101476501472200167740ustar00rootroot00000000000000" Author: w0rp " Description: balloonexpr support for ALE. function! ale#balloon#MessageForPos(bufnr, lnum, col) abort let l:set_balloons = ale#Var(a:bufnr, 'set_balloons') let l:show_problems = 0 let l:show_hover = 0 if l:set_balloons is 1 let l:show_problems = 1 let l:show_hover = 1 elseif l:set_balloons is# 'hover' let l:show_hover = 1 endif " Don't show balloons if they are disabled, or linting is disabled. if !(l:show_problems || l:show_hover) \|| !g:ale_enabled \|| !getbufvar(a:bufnr, 'ale_enabled', 1) return '' endif if l:show_problems let l:loclist = get(g:ale_buffer_info, a:bufnr, {'loclist': []}).loclist let l:index = ale#util#BinarySearch(l:loclist, a:bufnr, a:lnum, a:col) endif " Show the diagnostics message if found, 'Hover' output otherwise if l:show_problems && l:index >= 0 return l:loclist[l:index].text elseif l:show_hover && ( \ exists('*balloon_show') \ || getbufvar( \ a:bufnr, \ 'ale_set_balloons_legacy_echo', \ get(g:, 'ale_set_balloons_legacy_echo', 0) \ ) \) " Request LSP/tsserver hover information, but only if this version of " Vim supports the balloon_show function, or if we turned a legacy " setting on. call ale#hover#Show(a:bufnr, a:lnum, a:col, {'called_from_balloonexpr': 1}) endif return '' endfunction function! ale#balloon#Expr() abort return ale#balloon#MessageForPos(v:beval_bufnr, v:beval_lnum, v:beval_col) endfunction function! ale#balloon#Disable() abort if has('balloon_eval') set noballooneval set balloonexpr= endif if has('balloon_eval_term') set noballoonevalterm set balloonexpr= endif endfunction function! ale#balloon#Enable() abort if has('balloon_eval') set ballooneval set balloonexpr=ale#balloon#Expr() endif if has('balloon_eval_term') set balloonevalterm set balloonexpr=ale#balloon#Expr() endif endfunction ale-4.0.0/autoload/ale/c.vim000066400000000000000000000517501476501472200156040ustar00rootroot00000000000000" Author: gagbo , w0rp , roel0 " Description: Functions for integrating with C-family linters. call ale#Set('c_parse_makefile', 0) call ale#Set('c_always_make', has('unix') && !has('macunix')) call ale#Set('c_parse_compile_commands', 1) let s:sep = has('win32') ? '\' : '/' " Set just so tests can override it. let g:__ale_c_project_filenames = ['.git/HEAD', 'configure', 'Makefile', 'CMakeLists.txt'] let g:ale_c_build_dir_names = get(g:, 'ale_c_build_dir_names', [ \ 'build', \ 'bin', \]) function! s:CanParseMakefile(buffer) abort " Something somewhere seems to delete this setting in tests, so ensure we " always have a default value. call ale#Set('c_parse_makefile', 0) return ale#Var(a:buffer, 'c_parse_makefile') endfunction function! ale#c#GetBuildDirectory(buffer) abort let l:build_dir = ale#Var(a:buffer, 'c_build_dir') " c_build_dir has the priority if defined if !empty(l:build_dir) return l:build_dir endif let [l:root, l:json_file] = ale#c#FindCompileCommands(a:buffer) return ale#path#Dirname(l:json_file) endfunction function! ale#c#ShellSplit(line) abort let l:stack = [] let l:args = [''] let l:prev = '' for l:char in split(a:line, '\zs') if l:char is# '''' if len(l:stack) > 0 && get(l:stack, -1) is# '''' call remove(l:stack, -1) elseif (len(l:stack) == 0 || get(l:stack, -1) isnot# '"') && l:prev isnot# '\' call add(l:stack, l:char) endif elseif (l:char is# '"' || l:char is# '`') && l:prev isnot# '\' if len(l:stack) > 0 && get(l:stack, -1) is# l:char call remove(l:stack, -1) elseif len(l:stack) == 0 || get(l:stack, -1) isnot# '''' call add(l:stack, l:char) endif elseif (l:char is# '(' || l:char is# '[' || l:char is# '{') && l:prev isnot# '\' if len(l:stack) == 0 || get(l:stack, -1) isnot# '''' call add(l:stack, l:char) endif elseif (l:char is# ')' || l:char is# ']' || l:char is# '}') && l:prev isnot# '\' if len(l:stack) > 0 && get(l:stack, -1) is# {')': '(', ']': '[', '}': '{'}[l:char] call remove(l:stack, -1) endif elseif l:char is# ' ' && len(l:stack) == 0 if len(get(l:args, -1)) > 0 call add(l:args, '') endif continue endif let l:args[-1] = get(l:args, -1) . l:char endfor return l:args endfunction " Takes the path prefix and a list of cflags and expands @file arguments to " the contents of the file. " " @file arguments are command line arguments recognised by gcc and clang. For " instance, if @./path/to/file was given to gcc, it would load .path/to/file " and use the contents of that file as arguments. function! ale#c#ExpandAtArgs(path_prefix, raw_split_lines) abort let l:out_lines = [] for l:option in a:raw_split_lines if stridx(l:option, '@') == 0 " This is an argument specifying a location of a file containing other arguments let l:path = join(split(l:option, '\zs')[1:], '') " Make path absolute if !ale#path#IsAbsolute(l:path) let l:rel_path = substitute(l:path, '"', '', 'g') let l:rel_path = substitute(l:rel_path, '''', '', 'g') let l:path = ale#path#GetAbsPath(a:path_prefix, l:rel_path) endif " Read the file and add all the arguments try let l:additional_args = readfile(l:path) catch continue " All we can really do is skip this argument endtry let l:file_lines = [] for l:line in l:additional_args let l:file_lines += ale#c#ShellSplit(l:line) endfor " @file arguments can include other @file arguments, so we must " recurse. let l:out_lines += ale#c#ExpandAtArgs(a:path_prefix, l:file_lines) else " This is not an @file argument, so don't touch it. let l:out_lines += [l:option] endif endfor return l:out_lines endfunction " Quote C/C++ a compiler argument, if needed. " " Quoting arguments might cause issues with some systems/compilers, so we only " quote them if we need to. function! ale#c#QuoteArg(arg) abort if a:arg !~# '\v[#$&*()\\|[\]{};''"<>/?! ^%]' return a:arg endif return ale#Escape(a:arg) endfunction function! ale#c#ParseCFlags(path_prefix, should_quote, raw_arguments) abort " Expand @file arguments now before parsing let l:arguments = ale#c#ExpandAtArgs(a:path_prefix, a:raw_arguments) " A list of [already_quoted, argument] let l:items = [] let l:option_index = 0 while l:option_index < len(l:arguments) let l:option = l:arguments[l:option_index] let l:option_index = l:option_index + 1 " Include options, that may need relative path fix if stridx(l:option, '-I') == 0 \ || stridx(l:option, '-iquote') == 0 \ || stridx(l:option, '-isystem') == 0 \ || stridx(l:option, '-idirafter') == 0 \ || stridx(l:option, '-iframework') == 0 if stridx(l:option, '-I') == 0 && l:option isnot# '-I' let l:arg = join(split(l:option, '\zs')[2:], '') let l:option = '-I' else let l:arg = l:arguments[l:option_index] let l:option_index = l:option_index + 1 endif " Fix relative paths if needed if !ale#path#IsAbsolute(l:arg) let l:rel_path = substitute(l:arg, '"', '', 'g') let l:rel_path = substitute(l:rel_path, '''', '', 'g') let l:arg = ale#path#GetAbsPath(a:path_prefix, l:rel_path) endif call add(l:items, [1, l:option]) call add(l:items, [1, ale#Escape(l:arg)]) " Options with arg that can be grouped with the option or separate elseif stridx(l:option, '-D') == 0 || stridx(l:option, '-B') == 0 if l:option is# '-D' || l:option is# '-B' call add(l:items, [1, l:option]) call add(l:items, [0, l:arguments[l:option_index]]) let l:option_index = l:option_index + 1 else call add(l:items, [0, l:option]) endif " Options that have an argument (always separate) elseif l:option is# '-iprefix' || stridx(l:option, '-iwithprefix') == 0 \ || l:option is# '-isysroot' || l:option is# '-imultilib' \ || l:option is# '-include' || l:option is# '-imacros' call add(l:items, [0, l:option]) call add(l:items, [0, l:arguments[l:option_index]]) let l:option_index = l:option_index + 1 " Options without argument elseif (stridx(l:option, '-W') == 0 && stridx(l:option, '-Wa,') != 0 && stridx(l:option, '-Wl,') != 0 && stridx(l:option, '-Wp,') != 0) \ || l:option is# '-w' || stridx(l:option, '-pedantic') == 0 \ || l:option is# '-ansi' || stridx(l:option, '-std=') == 0 \ || stridx(l:option, '-f') == 0 && l:option !~# '\v^-f(dump|diagnostics|no-show-column|stack-usage)' \ || stridx(l:option, '-O') == 0 \ || l:option is# '-C' || l:option is# '-CC' || l:option is# '-trigraphs' \ || stridx(l:option, '-nostdinc') == 0 || stridx(l:option, '-iplugindir=') == 0 \ || stridx(l:option, '--sysroot=') == 0 || l:option is# '--no-sysroot-suffix' \ || stridx(l:option, '-m') == 0 call add(l:items, [0, l:option]) endif endwhile if a:should_quote " Quote C arguments that haven't already been quoted above. " If and only if we've been asked to quote them. call map(l:items, 'v:val[0] ? v:val[1] : ale#c#QuoteArg(v:val[1])') else call map(l:items, 'v:val[1]') endif return join(l:items, ' ') endfunction function! ale#c#ParseCFlagsFromMakeOutput(buffer, make_output) abort if !s:CanParseMakefile(a:buffer) return v:null endif let l:buffer_filename = expand('#' . a:buffer . ':t') let l:cflag_line = '' " Find a line matching this buffer's filename in the make output. for l:line in a:make_output if stridx(l:line, l:buffer_filename) >= 0 let l:cflag_line = l:line break endif endfor let l:makefile_path = ale#path#FindNearestFile(a:buffer, 'Makefile') let l:makefile_dir = fnamemodify(l:makefile_path, ':p:h') return ale#c#ParseCFlags(l:makefile_dir, 0, ale#c#ShellSplit(l:cflag_line)) endfunction " Given a buffer number, find the project directory containing " compile_commands.json, and the path to the compile_commands.json file. " " If compile_commands.json cannot be found, two empty strings will be " returned. function! ale#c#FindCompileCommands(buffer) abort " Look above the current source file to find compile_commands.json let l:json_file = ale#path#FindNearestFile(a:buffer, 'compile_commands.json') if !empty(l:json_file) return [fnamemodify(l:json_file, ':h'), l:json_file] endif " Search in build directories if we can't find it in the project. for l:path in ale#path#Upwards(expand('#' . a:buffer . ':p:h')) for l:dirname in ale#Var(a:buffer, 'c_build_dir_names') let l:c_build_dir = l:path . s:sep . l:dirname let l:json_file = l:c_build_dir . s:sep . 'compile_commands.json' if filereadable(l:json_file) return [l:path, l:json_file] endif endfor endfor return ['', ''] endfunction " Find the project root for C/C++ projects. " " The location of compile_commands.json will be used to find project roots. " " If compile_commands.json cannot be found, other common configuration files " will be used to detect the project root. function! ale#c#FindProjectRoot(buffer) abort let [l:root, l:json_file] = ale#c#FindCompileCommands(a:buffer) " Fall back on detecting the project root based on other filenames. if empty(l:root) for l:project_filename in g:__ale_c_project_filenames let l:full_path = ale#path#FindNearestFile(a:buffer, l:project_filename) if !empty(l:full_path) let l:path = fnamemodify(l:full_path, ':h') " Correct .git path detection. if fnamemodify(l:path, ':t') is# '.git' let l:path = fnamemodify(l:path, ':h') endif return l:path endif endfor endif return l:root endfunction " Cache compile_commands.json data in a Dictionary, so we don't need to read " the same files over and over again. The key in the dictionary will include " the last modified time of the file. if !exists('s:compile_commands_cache') let s:compile_commands_cache = {} endif function! ale#c#ResetCompileCommandsCache() abort let s:compile_commands_cache = {} endfunction function! s:GetLookupFromCompileCommandsFile(compile_commands_file) abort let l:empty = [{}, {}] if empty(a:compile_commands_file) return l:empty endif let l:time = getftime(a:compile_commands_file) if l:time < 0 return l:empty endif let l:key = a:compile_commands_file . ':' . l:time if has_key(s:compile_commands_cache, l:key) return s:compile_commands_cache[l:key] endif let l:raw_data = [] silent! let l:raw_data = json_decode(join(readfile(a:compile_commands_file), '')) if type(l:raw_data) isnot v:t_list let l:raw_data = [] endif let l:file_lookup = {} let l:dir_lookup = {} for l:entry in (type(l:raw_data) is v:t_list ? l:raw_data : []) let l:filename = ale#path#GetAbsPath(l:entry.directory, l:entry.file) " Store a key for lookups by the absolute path to the filename. let l:file_lookup[l:filename] = get(l:file_lookup, l:filename, []) + [l:entry] " Store a key for fuzzy lookups by the absolute path to the directory. let l:dirname = fnamemodify(l:filename, ':h') let l:dir_lookup[l:dirname] = get(l:dir_lookup, l:dirname, []) + [l:entry] " Store a key for fuzzy lookups by just the basename of the file. let l:basename = tolower(fnamemodify(l:entry.file, ':t')) let l:file_lookup[l:basename] = get(l:file_lookup, l:basename, []) + [l:entry] " Store a key for fuzzy lookups by just the basename of the directory. let l:dirbasename = tolower(fnamemodify(l:entry.directory, ':p:h:t')) let l:dir_lookup[l:dirbasename] = get(l:dir_lookup, l:dirbasename, []) + [l:entry] endfor if !empty(l:file_lookup) && !empty(l:dir_lookup) let l:result = [l:file_lookup, l:dir_lookup] let s:compile_commands_cache[l:key] = l:result return l:result endif return l:empty endfunction " Get [should_quote, arguments] from either 'command' or 'arguments' " 'arguments' should be quoted later, the split 'command' strings should not. function! s:GetArguments(json_item) abort if has_key(a:json_item, 'arguments') return [1, a:json_item.arguments] elseif has_key(a:json_item, 'command') return [0, ale#c#ShellSplit(a:json_item.command)] endif return [0, []] endfunction function! ale#c#ParseCompileCommandsFlags(buffer, file_lookup, dir_lookup) abort let l:buffer_filename = ale#path#Simplify(expand('#' . a:buffer . ':p')) let l:basename = tolower(fnamemodify(l:buffer_filename, ':t')) " Look for any file in the same directory if we can't find an exact match. let l:dir = fnamemodify(l:buffer_filename, ':h') " Search for an exact file match first. let l:file_list = get(a:file_lookup, l:buffer_filename, []) " We may have to look for /foo/bar instead of C:\foo\bar if empty(l:file_list) && has('win32') let l:file_list = get( \ a:file_lookup, \ ale#path#RemoveDriveLetter(l:buffer_filename), \ [] \) endif " Try the absolute path to the directory second. let l:dir_list = get(a:dir_lookup, l:dir, []) if empty(l:dir_list) && has('win32') let l:dir_list = get( \ a:dir_lookup, \ ale#path#RemoveDriveLetter(l:dir), \ [] \) endif if empty(l:file_list) && empty(l:dir_list) " If we can't find matches with the path to the file, try a " case-insensitive match for any similarly-named file. let l:file_list = get(a:file_lookup, l:basename, []) " If we can't find matches with the path to the directory, try a " case-insensitive match for anything in similarly-named directory. let l:dir_list = get(a:dir_lookup, tolower(fnamemodify(l:dir, ':t')), []) endif " A source file matching the header filename. let l:source_file = '' if empty(l:file_list) && l:basename =~? '\.h$\|\.hpp$' for l:suffix in ['.c', '.cpp'] " Try to find a source file by an absolute path first. let l:key = fnamemodify(l:buffer_filename, ':r') . l:suffix let l:file_list = get(a:file_lookup, l:key, []) if empty(l:file_list) && has('win32') let l:file_list = get( \ a:file_lookup, \ ale#path#RemoveDriveLetter(l:key), \ [] \) endif if empty(l:file_list) " Look fuzzy matches on the basename second. let l:key = fnamemodify(l:basename, ':r') . l:suffix let l:file_list = get(a:file_lookup, l:key, []) endif if !empty(l:file_list) let l:source_file = l:key break endif endfor endif for l:item in l:file_list let l:filename = ale#path#GetAbsPath(l:item.directory, l:item.file) " Load the flags for this file, or for a source file matching the " header file. if ( \ bufnr(l:filename) is a:buffer \ || ( \ !empty(l:source_file) \ && l:filename[-len(l:source_file):] is? l:source_file \ ) \) let [l:should_quote, l:args] = s:GetArguments(l:item) return ale#c#ParseCFlags(l:item.directory, l:should_quote, l:args) endif endfor for l:item in l:dir_list let l:filename = ale#path#GetAbsPath(l:item.directory, l:item.file) if ale#path#RemoveDriveLetter(fnamemodify(l:filename, ':h')) \ is? ale#path#RemoveDriveLetter(l:dir) let [l:should_quote, l:args] = s:GetArguments(l:item) return ale#c#ParseCFlags(l:item.directory, l:should_quote, l:args) endif endfor return '' endfunction function! ale#c#FlagsFromCompileCommands(buffer, compile_commands_file) abort let l:lookups = s:GetLookupFromCompileCommandsFile(a:compile_commands_file) let l:file_lookup = l:lookups[0] let l:dir_lookup = l:lookups[1] return ale#c#ParseCompileCommandsFlags(a:buffer, l:file_lookup, l:dir_lookup) endfunction function! ale#c#GetCFlags(buffer, output) abort let l:cflags = v:null if ale#Var(a:buffer, 'c_parse_compile_commands') let [l:root, l:json_file] = ale#c#FindCompileCommands(a:buffer) if !empty(l:json_file) let l:cflags = ale#c#FlagsFromCompileCommands(a:buffer, l:json_file) endif endif if empty(l:cflags) && s:CanParseMakefile(a:buffer) && !empty(a:output) let l:cflags = ale#c#ParseCFlagsFromMakeOutput(a:buffer, a:output) endif if l:cflags is v:null let l:cflags = ale#c#IncludeOptions(ale#c#FindLocalHeaderPaths(a:buffer)) endif return l:cflags isnot v:null ? l:cflags : '' endfunction function! ale#c#GetMakeCommand(buffer) abort if s:CanParseMakefile(a:buffer) let l:path = ale#path#FindNearestFile(a:buffer, 'Makefile') if empty(l:path) let l:path = ale#path#FindNearestFile(a:buffer, 'GNUmakefile') endif if !empty(l:path) let l:always_make = ale#Var(a:buffer, 'c_always_make') return [ \ fnamemodify(l:path, ':h'), \ 'make -n' . (l:always_make ? ' --always-make' : ''), \] endif endif return ['', ''] endfunction function! ale#c#RunMakeCommand(buffer, Callback) abort let [l:cwd, l:command] = ale#c#GetMakeCommand(a:buffer) if empty(l:command) return a:Callback(a:buffer, []) endif return ale#command#Run( \ a:buffer, \ l:command, \ {b, output -> a:Callback(a:buffer, output)}, \ {'cwd': l:cwd}, \) endfunction " Given a buffer number, search for a project root, and output a List " of directories to include based on some heuristics. " " For projects with headers in the project root, the project root will " be returned. " " For projects with an 'include' directory, that directory will be returned. function! ale#c#FindLocalHeaderPaths(buffer) abort let l:project_root = ale#c#FindProjectRoot(a:buffer) if empty(l:project_root) return [] endif " See if we can find .h files directory in the project root. " If we can, that's our include directory. if !empty(globpath(l:project_root, '*.h', 0)) return [l:project_root] endif " Look for .hpp files too. if !empty(globpath(l:project_root, '*.hpp', 0)) return [l:project_root] endif " If we find an 'include' directory in the project root, then use that. if isdirectory(l:project_root . '/include') return [ale#path#Simplify(l:project_root . s:sep . 'include')] endif return [] endfunction " Given a List of include paths, create a string containing the -I include " options for those paths, with the paths escaped for use in the shell. function! ale#c#IncludeOptions(include_paths) abort let l:option_list = [] for l:path in a:include_paths call add(l:option_list, '-I' . ale#Escape(l:path)) endfor if empty(l:option_list) return '' endif return join(l:option_list) endfunction " Get the language flag depending on on the executable, options and " file extension function! ale#c#GetLanguageFlag( \ buffer, \ executable, \ use_header_lang_flag, \ header_exts, \ linter_lang_flag \) abort " Use only '-header' if the executable is 'clang' by default if a:use_header_lang_flag == -1 let l:use_header_lang_flag = a:executable =~# 'clang' else let l:use_header_lang_flag = a:use_header_lang_flag endif " If we don't use the header language flag, return the default linter " language flag if !l:use_header_lang_flag return a:linter_lang_flag endif " Get the buffer file extension let l:buf_ext = expand('#' . a:buffer . ':e') " If the buffer file is an header according to its extension, use " the linter language flag + '-header', ex: 'c-header' if index(a:header_exts, l:buf_ext) >= 0 return a:linter_lang_flag . '-header' endif " Else, use the default linter language flag return a:linter_lang_flag endfunction ale-4.0.0/autoload/ale/code_action.vim000066400000000000000000000276571476501472200176420ustar00rootroot00000000000000" Author: Jerko Steiner " Description: Code action support for LSP / tsserver function! ale#code_action#ReloadBuffer() abort let l:buffer = bufnr('') execute 'augroup ALECodeActionReloadGroup' . l:buffer autocmd! augroup END silent! execute 'augroup! ALECodeActionReloadGroup' . l:buffer call ale#util#Execute(':e!') endfunction function! ale#code_action#HandleCodeAction(code_action, options) abort let l:current_buffer = bufnr('') let l:changes = a:code_action.changes for l:file_code_edit in l:changes call ale#code_action#ApplyChanges( \ l:file_code_edit.fileName, \ l:file_code_edit.textChanges, \ a:options, \) endfor endfunction function! s:ChangeCmp(left, right) abort if a:left.start.line < a:right.start.line return -1 endif if a:left.start.line > a:right.start.line return 1 endif if a:left.start.offset < a:right.start.offset return -1 endif if a:left.start.offset > a:right.start.offset return 1 endif if a:left.end.line < a:right.end.line return -1 endif if a:left.end.line > a:right.end.line return 1 endif if a:left.end.offset < a:right.end.offset return -1 endif if a:left.end.offset > a:right.end.offset return 1 endif return 0 endfunction function! ale#code_action#ApplyChanges(filename, changes, options) abort let l:should_save = get(a:options, 'should_save') let l:conn_id = get(a:options, 'conn_id') let l:orig_buffer = bufnr('') " The buffer is used to determine the fileformat, if available. let l:buffer = bufnr(a:filename) if l:buffer != l:orig_buffer call ale#util#Execute('silent edit ' . a:filename) let l:buffer = bufnr('') endif let l:lines = getbufline(l:buffer, 1, '$') " Add empty line if there's trailing newline, like readfile() does. if getbufvar(l:buffer, '&eol') let l:lines += [''] endif let l:pos = getpos('.')[1:2] " Changes have to be sorted so we apply them from bottom-to-top for l:code_edit in reverse(sort(copy(a:changes), function('s:ChangeCmp'))) let l:line = l:code_edit.start.line let l:column = l:code_edit.start.offset let l:end_line = l:code_edit.end.line let l:end_column = l:code_edit.end.offset let l:text = l:code_edit.newText let l:insertions = split(l:text, '\n', 1) " Fix invalid columns let l:column = l:column > 0 ? l:column : 1 let l:end_column = l:end_column > 0 ? l:end_column : 1 " Clamp start to BOF if l:line < 1 let [l:line, l:column] = [1, 1] endif " Clamp start to EOF if l:line > len(l:lines) || l:line == len(l:lines) && l:column > len(l:lines[-1]) + 1 let [l:line, l:column] = [len(l:lines), len(l:lines[-1]) + 1] " Special case when start is after EOL elseif l:line < len(l:lines) && l:column > len(l:lines[l:line - 1]) + 1 let [l:line, l:column] = [l:line + 1, 1] endif " Adjust end: clamp if invalid and/or adjust if we moved start if l:end_line < l:line || l:end_line == l:line && l:end_column < l:column let [l:end_line, l:end_column] = [l:line, l:column] endif " Clamp end to EOF if l:end_line > len(l:lines) || l:end_line == len(l:lines) && l:end_column > len(l:lines[-1]) + 1 let [l:end_line, l:end_column] = [len(l:lines), len(l:lines[-1]) + 1] " Special case when end is after EOL elseif l:end_line < len(l:lines) && l:end_column > len(l:lines[l:end_line - 1]) + 1 let [l:end_line, l:end_column] = [l:end_line + 1, 1] endif " Careful, [:-1] is not an empty list let l:start = l:line is 1 ? [] : l:lines[: l:line - 2] let l:middle = l:column is 1 ? [''] : [l:lines[l:line - 1][: l:column - 2]] let l:middle[-1] .= l:insertions[0] let l:middle += l:insertions[1:] let l:middle[-1] .= l:lines[l:end_line - 1][l:end_column - 1 :] let l:end_line_len = len(l:lines[l:end_line - 1]) let l:lines_before_change = len(l:lines) let l:lines = l:start + l:middle + l:lines[l:end_line :] let l:current_line_offset = len(l:lines) - l:lines_before_change let l:column_offset = len(l:middle[-1]) - l:end_line_len " Keep cursor where it was (if outside of changes) or move it after " the changed text (if inside), but don't touch it when the change " spans the entire buffer, in which case we have no clue and it's " better to not do anything. if l:line isnot 1 || l:column isnot 1 \|| l:end_line < l:lines_before_change \|| l:end_line == l:lines_before_change && l:end_column <= l:end_line_len let l:pos = s:UpdateCursor(l:pos, \ [l:line, l:column], \ [l:end_line, l:end_column], \ [l:current_line_offset, l:column_offset]) endif endfor " Make sure to add a trailing newline if and only if it should be added. if l:lines[-1] is# '' && getbufvar(l:buffer, '&eol') call remove(l:lines, -1) else call setbufvar(l:buffer, '&eol', 0) endif call ale#util#SetBufferContents(l:buffer, l:lines) call ale#lsp#NotifyForChanges(l:conn_id, l:buffer) if l:should_save call ale#util#Execute('silent w!') endif call setpos('.', [0, l:pos[0], l:pos[1], 0]) if l:orig_buffer != l:buffer && bufexists(l:orig_buffer) call ale#util#Execute('silent buf ' . string(l:orig_buffer)) endif endfunction function! s:UpdateCursor(cursor, start, end, offset) abort let l:cur_line = a:cursor[0] let l:cur_column = a:cursor[1] let l:line = a:start[0] let l:column = a:start[1] let l:end_line = a:end[0] let l:end_column = a:end[1] let l:line_offset = a:offset[0] let l:column_offset = a:offset[1] if l:end_line < l:cur_line " both start and end lines are before the cursor. only line offset " needs to be updated let l:cur_line += l:line_offset elseif l:end_line == l:cur_line " end line is at the same location as cursor, which means " l:line <= l:cur_line if l:line < l:cur_line || l:column <= l:cur_column " updates are happening either before or around the cursor if l:end_column < l:cur_column " updates are happening before the cursor, update the " column offset for cursor let l:cur_line += l:line_offset let l:cur_column += l:column_offset else " updates are happening around the cursor, move the cursor " to the end of the changes let l:cur_line += l:line_offset let l:cur_column = l:end_column + l:column_offset endif " else is not necessary, it means modifications are happening " after the cursor so no cursor updates need to be done endif else " end line is after the cursor if l:line < l:cur_line || l:line == l:cur_line && l:column <= l:cur_column " changes are happening around the cursor, move the cursor " to the end of the changes let l:cur_line = l:end_line + l:line_offset let l:cur_column = l:end_column + l:column_offset " else is not necessary, it means modifications are happening " after the cursor so no cursor updates need to be done endif endif return [l:cur_line, l:cur_column] endfunction function! ale#code_action#GetChanges(workspace_edit) abort if a:workspace_edit is v:null return {} endif let l:changes = {} if has_key(a:workspace_edit, 'changes') && !empty(a:workspace_edit.changes) return a:workspace_edit.changes elseif has_key(a:workspace_edit, 'documentChanges') let l:document_changes = [] if type(a:workspace_edit.documentChanges) is v:t_dict \ && has_key(a:workspace_edit.documentChanges, 'edits') call add(l:document_changes, a:workspace_edit.documentChanges) elseif type(a:workspace_edit.documentChanges) is v:t_list let l:document_changes = a:workspace_edit.documentChanges endif for l:text_document_edit in l:document_changes let l:filename = l:text_document_edit.textDocument.uri let l:edits = l:text_document_edit.edits let l:changes[l:filename] = l:edits endfor endif return l:changes endfunction function! ale#code_action#BuildChangesList(changes_map) abort let l:changes = [] for l:file_name in keys(a:changes_map) let l:text_edits = a:changes_map[l:file_name] let l:text_changes = [] for l:edit in l:text_edits let l:range = l:edit.range let l:new_text = l:edit.newText call add(l:text_changes, { \ 'start': { \ 'line': l:range.start.line + 1, \ 'offset': l:range.start.character + 1, \ }, \ 'end': { \ 'line': l:range.end.line + 1, \ 'offset': l:range.end.character + 1, \ }, \ 'newText': l:new_text, \}) endfor call add(l:changes, { \ 'fileName': ale#util#ToResource(l:file_name), \ 'textChanges': l:text_changes, \}) endfor return l:changes endfunction function! s:EscapeMenuName(text) abort return substitute(a:text, '\\\| \|\.\|&', '\\\0', 'g') endfunction function! s:UpdateMenu(data, menu_items) abort silent! aunmenu PopUp.Refactor\.\.\. if empty(a:data) return endif for [l:type, l:item] in a:menu_items let l:name = l:type is# 'tsserver' ? l:item.name : l:item.title let l:func_name = l:type is# 'tsserver' \ ? 'ale#codefix#ApplyTSServerCodeAction' \ : 'ale#codefix#ApplyLSPCodeAction' execute printf( \ 'anoremenu PopUp.&Refactor\.\.\..%s' \ . ' :call %s(%s, %s)', \ s:EscapeMenuName(l:name), \ l:func_name, \ string(a:data), \ string(l:item), \) endfor if empty(a:menu_items) silent! anoremenu PopUp.Refactor\.\.\..(None) :silent endif endfunction function! s:GetCodeActions(linter, options) abort let l:buffer = bufnr('') let [l:line, l:column] = getpos('.')[1:2] let l:column = min([l:column, len(getline(l:line))]) let l:location = { \ 'buffer': l:buffer, \ 'line': l:line, \ 'column': l:column, \ 'end_line': l:line, \ 'end_column': l:column, \} let l:Callback = function('s:OnReady', [l:location, a:options]) call ale#lsp_linter#StartLSP(l:buffer, a:linter, l:Callback) endfunction function! ale#code_action#GetCodeActions(options) abort silent! aunmenu PopUp.Rename silent! aunmenu PopUp.Refactor\.\.\. " Only display the menu items if there's an LSP server. if len(ale#lsp_linter#GetEnabled(bufnr(''))) > 0 if !empty(expand('')) silent! anoremenu PopUp.Rename :ALERename endif silent! anoremenu PopUp.Refactor\.\.\..(None) :silent call ale#codefix#Execute( \ mode() is# 'v' || mode() is# "\", \ function('s:UpdateMenu') \) endif endfunction function! s:Setup(enabled) abort augroup ALECodeActionsGroup autocmd! if a:enabled autocmd MenuPopup * :call ale#code_action#GetCodeActions({}) endif augroup END if !a:enabled silent! augroup! ALECodeActionsGroup silent! aunmenu PopUp.Rename silent! aunmenu PopUp.Refactor\.\.\. endif endfunction function! ale#code_action#EnablePopUpMenu() abort call s:Setup(1) endfunction function! ale#code_action#DisablePopUpMenu() abort call s:Setup(0) endfunction ale-4.0.0/autoload/ale/codefix.vim000066400000000000000000000343231476501472200170000ustar00rootroot00000000000000" Author: Dalius Dobravolskas " Description: Code Fix support for tsserver and LSP servers let s:codefix_map = {} " Used to get the codefix map in tests. function! ale#codefix#GetMap() abort return deepcopy(s:codefix_map) endfunction " Used to set the codefix map in tests. function! ale#codefix#SetMap(map) abort let s:codefix_map = a:map endfunction function! ale#codefix#ClearLSPData() abort let s:codefix_map = {} endfunction function! s:message(message) abort call ale#util#Execute('echom ' . string(a:message)) endfunction function! ale#codefix#ApplyTSServerCodeAction(data, item) abort if has_key(a:item, 'changes') let l:changes = a:item.changes call ale#code_action#HandleCodeAction( \ { \ 'description': 'codefix', \ 'changes': l:changes, \ }, \ {}, \) else let l:message = ale#lsp#tsserver_message#GetEditsForRefactor( \ a:data.buffer, \ a:data.line, \ a:data.column, \ a:data.end_line, \ a:data.end_column, \ a:item.id[0], \ a:item.id[1], \) let l:request_id = ale#lsp#Send(a:data.connection_id, l:message) let s:codefix_map[l:request_id] = a:data endif endfunction function! ale#codefix#HandleTSServerResponse(conn_id, response) abort if !has_key(a:response, 'request_seq') \ || !has_key(s:codefix_map, a:response.request_seq) return endif let l:data = remove(s:codefix_map, a:response.request_seq) let l:MenuCallback = get(l:data, 'menu_callback', v:null) if get(a:response, 'command', '') is# 'getCodeFixes' if get(a:response, 'success', v:false) is v:false \&& l:MenuCallback is v:null let l:message = get(a:response, 'message', 'unknown') call s:message('Error while getting code fixes. Reason: ' . l:message) return endif let l:result = get(a:response, 'body', []) call filter(l:result, 'has_key(v:val, ''changes'')') if l:MenuCallback isnot v:null call l:MenuCallback( \ l:data, \ map(copy(l:result), '[''tsserver'', v:val]') \) return endif if len(l:result) == 0 call s:message('No code fixes available.') return endif let l:code_fix_to_apply = 0 if len(l:result) == 1 let l:code_fix_to_apply = 1 else let l:codefix_no = 1 let l:codefixstring = "Code Fixes:\n" for l:codefix in l:result let l:codefixstring .= l:codefix_no . ') ' \ . l:codefix.description . "\n" let l:codefix_no += 1 endfor let l:codefixstring .= 'Type number and (empty cancels): ' let l:code_fix_to_apply = ale#util#Input(l:codefixstring, '') let l:code_fix_to_apply = str2nr(l:code_fix_to_apply) if l:code_fix_to_apply == 0 return endif endif call ale#codefix#ApplyTSServerCodeAction( \ l:data, \ l:result[l:code_fix_to_apply - 1], \) elseif get(a:response, 'command', '') is# 'getApplicableRefactors' if get(a:response, 'success', v:false) is v:false \&& l:MenuCallback is v:null let l:message = get(a:response, 'message', 'unknown') call s:message('Error while getting applicable refactors. Reason: ' . l:message) return endif let l:result = get(a:response, 'body', []) if len(l:result) == 0 call s:message('No applicable refactors available.') return endif let l:refactors = [] for l:item in l:result for l:action in l:item.actions call add(l:refactors, { \ 'name': l:action.description, \ 'id': [l:item.name, l:action.name], \}) endfor endfor if l:MenuCallback isnot v:null call l:MenuCallback( \ l:data, \ map(copy(l:refactors), '[''tsserver'', v:val]') \) return endif let l:refactor_no = 1 let l:refactorstring = "Applicable refactors:\n" for l:refactor in l:refactors let l:refactorstring .= l:refactor_no . ') ' \ . l:refactor.name . "\n" let l:refactor_no += 1 endfor let l:refactorstring .= 'Type number and (empty cancels): ' let l:refactor_to_apply = ale#util#Input(l:refactorstring, '') let l:refactor_to_apply = str2nr(l:refactor_to_apply) if l:refactor_to_apply == 0 return endif let l:id = l:refactors[l:refactor_to_apply - 1].id call ale#codefix#ApplyTSServerCodeAction( \ l:data, \ l:refactors[l:refactor_to_apply - 1], \) elseif get(a:response, 'command', '') is# 'getEditsForRefactor' if get(a:response, 'success', v:false) is v:false let l:message = get(a:response, 'message', 'unknown') call s:message('Error while getting edits for refactor. Reason: ' . l:message) return endif call ale#code_action#HandleCodeAction( \ { \ 'description': 'editsForRefactor', \ 'changes': a:response.body.edits, \ }, \ {}, \) endif endfunction function! ale#codefix#ApplyLSPCodeAction(data, item) abort if has_key(a:item, 'command') \&& type(a:item.command) == v:t_dict let l:command = a:item.command let l:message = ale#lsp#message#ExecuteCommand( \ l:command.command, \ l:command.arguments, \) let l:request_id = ale#lsp#Send(a:data.connection_id, l:message) elseif has_key(a:item, 'command') && has_key(a:item, 'arguments') \&& type(a:item.command) == v:t_string let l:message = ale#lsp#message#ExecuteCommand( \ a:item.command, \ a:item.arguments, \) let l:request_id = ale#lsp#Send(a:data.connection_id, l:message) elseif has_key(a:item, 'edit') || has_key(a:item, 'arguments') if has_key(a:item, 'edit') let l:topass = a:item.edit else let l:topass = a:item.arguments[0] endif let l:changes_map = ale#code_action#GetChanges(l:topass) if empty(l:changes_map) return endif let l:changes = ale#code_action#BuildChangesList(l:changes_map) call ale#code_action#HandleCodeAction( \ { \ 'description': 'codeaction', \ 'changes': l:changes, \ }, \ {}, \) endif endfunction function! ale#codefix#HandleLSPResponse(conn_id, response) abort if has_key(a:response, 'method') \ && a:response.method is# 'workspace/applyEdit' \ && has_key(a:response, 'params') let l:params = a:response.params let l:changes_map = ale#code_action#GetChanges(l:params.edit) if empty(l:changes_map) return endif let l:changes = ale#code_action#BuildChangesList(l:changes_map) call ale#code_action#HandleCodeAction( \ { \ 'description': 'applyEdit', \ 'changes': l:changes, \ }, \ {} \) elseif has_key(a:response, 'id') \&& has_key(s:codefix_map, a:response.id) let l:data = remove(s:codefix_map, a:response.id) let l:MenuCallback = get(l:data, 'menu_callback', v:null) let l:result = get(a:response, 'result') if type(l:result) != v:t_list let l:result = [] endif " Send the results to the menu callback, if set. if l:MenuCallback isnot v:null call l:MenuCallback( \ l:data, \ map(copy(l:result), '[''lsp'', v:val]') \) return endif if len(l:result) == 0 call s:message('No code actions received from server') return endif let l:codeaction_no = 1 let l:codeactionstring = "Code Fixes:\n" for l:codeaction in l:result let l:codeactionstring .= l:codeaction_no . ') ' \ . l:codeaction.title . "\n" let l:codeaction_no += 1 endfor let l:codeactionstring .= 'Type number and (empty cancels): ' let l:codeaction_to_apply = ale#util#Input(l:codeactionstring, '') let l:codeaction_to_apply = str2nr(l:codeaction_to_apply) if l:codeaction_to_apply == 0 return endif let l:item = l:result[l:codeaction_to_apply - 1] call ale#codefix#ApplyLSPCodeAction(l:data, l:item) endif endfunction function! s:FindError(buffer, line, column, end_line, end_column, linter_name) abort let l:nearest_error = v:null if a:line == a:end_line \&& a:column == a:end_column \&& has_key(g:ale_buffer_info, a:buffer) let l:nearest_error_diff = -1 for l:error in get(g:ale_buffer_info[a:buffer], 'loclist', []) if has_key(l:error, 'code') \ && (a:linter_name is v:null || l:error.linter_name is# a:linter_name) \ && l:error.lnum == a:line let l:diff = abs(l:error.col - a:column) if l:nearest_error_diff == -1 || l:diff < l:nearest_error_diff let l:nearest_error_diff = l:diff let l:nearest_error = l:error endif endif endfor endif return l:nearest_error endfunction function! s:OnReady( \ line, \ column, \ end_line, \ end_column, \ MenuCallback, \ linter, \ lsp_details, \) abort let l:id = a:lsp_details.connection_id if !ale#lsp#HasCapability(l:id, 'code_actions') return endif let l:buffer = a:lsp_details.buffer if a:linter.lsp is# 'tsserver' let l:nearest_error = \ s:FindError(l:buffer, a:line, a:column, a:end_line, a:end_column, a:linter.lsp) if l:nearest_error isnot v:null let l:message = ale#lsp#tsserver_message#GetCodeFixes( \ l:buffer, \ a:line, \ a:column, \ a:line, \ a:column, \ [l:nearest_error.code], \) else let l:message = ale#lsp#tsserver_message#GetApplicableRefactors( \ l:buffer, \ a:line, \ a:column, \ a:end_line, \ a:end_column, \) endif else " Send a message saying the buffer has changed first, otherwise " completions won't know what text is nearby. call ale#lsp#NotifyForChanges(l:id, l:buffer) let l:diagnostics = [] let l:nearest_error = \ s:FindError(l:buffer, a:line, a:column, a:end_line, a:end_column, v:null) if l:nearest_error isnot v:null let l:diagnostics = [ \ { \ 'code': l:nearest_error.code, \ 'message': l:nearest_error.text, \ 'range': { \ 'start': { \ 'line': l:nearest_error.lnum - 1, \ 'character': l:nearest_error.col - 1, \ }, \ 'end': { \ 'line': get(l:nearest_error, 'end_lnum', 1) - 1, \ 'character': get(l:nearest_error, 'end_col', 0) \ }, \ }, \ }, \] endif let l:message = ale#lsp#message#CodeAction( \ l:buffer, \ a:line, \ a:column, \ a:end_line, \ a:end_column, \ l:diagnostics, \) endif let l:Callback = a:linter.lsp is# 'tsserver' \ ? function('ale#codefix#HandleTSServerResponse') \ : function('ale#codefix#HandleLSPResponse') call ale#lsp#RegisterCallback(l:id, l:Callback) let l:request_id = ale#lsp#Send(l:id, l:message) let s:codefix_map[l:request_id] = { \ 'connection_id': l:id, \ 'buffer': l:buffer, \ 'line': a:line, \ 'column': a:column, \ 'end_line': a:end_line, \ 'end_column': a:end_column, \ 'menu_callback': a:MenuCallback, \} endfunction function! s:ExecuteGetCodeFix(linter, range, MenuCallback) abort let l:buffer = bufnr('') if a:range == 0 let [l:line, l:column] = getpos('.')[1:2] let l:end_line = l:line let l:end_column = l:column " Expand the range to cover the current word, if there is one. let l:cword = expand('') if !empty(l:cword) let l:search_pos = searchpos('\V' . l:cword, 'bn', l:line) if l:search_pos != [0, 0] let l:column = l:search_pos[1] let l:end_column = l:column + len(l:cword) - 1 endif endif elseif mode() is# 'v' || mode() is# "\" " You need to get the start and end in a different way when you're in " visual mode. let [l:line, l:column] = getpos('v')[1:2] let [l:end_line, l:end_column] = getpos('.')[1:2] else let [l:line, l:column] = getpos("'<")[1:2] let [l:end_line, l:end_column] = getpos("'>")[1:2] endif let l:column = max([min([l:column, len(getline(l:line))]), 1]) let l:end_column = min([l:end_column, len(getline(l:end_line))]) let l:Callback = function( \ 's:OnReady', [l:line, l:column, l:end_line, l:end_column, a:MenuCallback] \) call ale#lsp_linter#StartLSP(l:buffer, a:linter, l:Callback) endfunction function! ale#codefix#Execute(range, ...) abort if a:0 > 1 throw 'Too many arguments' endif let l:MenuCallback = get(a:000, 0, v:null) let l:linters = ale#lsp_linter#GetEnabled(bufnr('')) if empty(l:linters) if l:MenuCallback is v:null call s:message('No active LSPs') else call l:MenuCallback({}, []) endif return endif for l:linter in l:linters call s:ExecuteGetCodeFix(l:linter, a:range, l:MenuCallback) endfor endfunction ale-4.0.0/autoload/ale/command.vim000066400000000000000000000357561476501472200170100ustar00rootroot00000000000000" Author: w0rp " Description: Functions for formatting command strings, running commands, and " managing files during linting and fixing cycles. " This dictionary holds lists of files and directories to remove later. if !exists('s:buffer_data') let s:buffer_data = {} endif " The regular expression used for formatting filenames with modifiers. let s:path_format_regex = '\v\%s(%(:h|:t|:r|:e)*)' " Used to get the data in tests. function! ale#command#GetData() abort return deepcopy(s:buffer_data) endfunction function! ale#command#ClearData() abort let s:buffer_data = {} endfunction function! ale#command#InitData(buffer) abort if !has_key(s:buffer_data, a:buffer) let s:buffer_data[a:buffer] = { \ 'jobs': {}, \ 'file_list': [], \ 'directory_list': [], \} endif endfunction " Set the cwd for commands that are about to run. " Used internally. function! ale#command#SetCwd(buffer, cwd) abort call ale#command#InitData(a:buffer) let s:buffer_data[a:buffer].cwd = a:cwd endfunction function! ale#command#ResetCwd(buffer) abort if has_key(s:buffer_data, a:buffer) let s:buffer_data[a:buffer].cwd = v:null endif endfunction function! ale#command#ManageFile(buffer, file) abort call ale#command#InitData(a:buffer) call add(s:buffer_data[a:buffer].file_list, a:file) endfunction function! ale#command#ManageDirectory(buffer, directory) abort call ale#command#InitData(a:buffer) call add(s:buffer_data[a:buffer].directory_list, a:directory) endfunction function! ale#command#CreateFile(buffer) abort " This variable can be set to 1 in tests to stub this out. if get(g:, 'ale_create_dummy_temporary_file') return 'TEMP' endif let l:temporary_file = ale#util#Tempname() call ale#command#ManageFile(a:buffer, l:temporary_file) return l:temporary_file endfunction " Create a new temporary directory and manage it in one go. function! ale#command#CreateDirectory(buffer) abort " This variable can be set to 1 in tests to stub this out. if get(g:, 'ale_create_dummy_temporary_file') return 'TEMP_DIR' endif let l:temporary_directory = ale#util#Tempname() " Create the temporary directory for the file, unreadable by 'other' " users. call mkdir(l:temporary_directory, '', 0750) call ale#command#ManageDirectory(a:buffer, l:temporary_directory) return l:temporary_directory endfunction function! ale#command#RemoveManagedFiles(buffer) abort let l:info = get(s:buffer_data, a:buffer, {}) if !empty(l:info) && empty(l:info.jobs) " We can't delete anything in a sandbox, so wait until we escape from " it to delete temporary files and directories. if ale#util#InSandbox() return endif " Delete files with a call akin to a plan `rm` command. for l:filename in l:info.file_list call delete(l:filename) endfor " Delete directories like `rm -rf`. " Directories are handled differently from files, so paths that are " intended to be single files can be set up for automatic deletion " without accidentally deleting entire directories. for l:directory in l:info.directory_list call delete(l:directory, 'rf') endfor call remove(s:buffer_data, a:buffer) endif endfunction function! ale#command#CreateTempFile(buffer, temporary_file, input) abort if empty(a:temporary_file) " There is no file, so we didn't create anything. return 0 endif " Use an existing list of lines of input if we have it, or get the lines " from the file. let l:lines = a:input isnot v:null ? a:input : getbufline(a:buffer, 1, '$') let l:temporary_directory = fnamemodify(a:temporary_file, ':h') " Create the temporary directory for the file, unreadable by 'other' " users. call mkdir(l:temporary_directory, '', 0750) " Automatically delete the directory later. call ale#command#ManageDirectory(a:buffer, l:temporary_directory) " Write the buffer out to a file. call ale#util#Writefile(a:buffer, l:lines, a:temporary_file) return 1 endfunction function! s:TemporaryFilename(buffer) abort let l:filename = fnamemodify(bufname(a:buffer), ':t') if empty(l:filename) " If the buffer's filename is empty, create a dummy filename. let l:ft = getbufvar(a:buffer, '&filetype') let l:filename = 'file' . ale#filetypes#GuessExtension(l:ft) endif " Create a temporary filename, / " The file itself will not be created by this function. return ale#util#Tempname() . (has('win32') ? '\' : '/') . l:filename endfunction " Given part of a command, replace any % with %%, so that no characters in " the string will be replaced with filenames, etc. function! ale#command#EscapeCommandPart(command_part) abort return substitute(a:command_part, '%', '%%', 'g') endfunction " Format a filename, converting it with filename mappings, if non-empty, " and escaping it for putting into a command string. " " The filename can be modified. function! s:FormatFilename(filename, mappings, modifiers) abort let l:filename = a:filename if !empty(a:mappings) let l:filename = ale#filename_mapping#Map(l:filename, a:mappings) endif if !empty(a:modifiers) let l:filename = fnamemodify(l:filename, a:modifiers) endif return ale#Escape(l:filename) endfunction " Produce a command prefix to check to a particular directory for a command. " %s format markers with filename-modifiers can be used as the directory, and " will be returned verbatim for formatting in paths relative to files. function! ale#command#CdString(directory) abort let l:match = matchstrpos(a:directory, s:path_format_regex) " Do not escape the directory here if it's a valid format string. " This allows us to use sequences like %s:h, %s:h:h, etc. let l:directory = l:match[1:] == [0, len(a:directory)] \ ? a:directory \ : ale#Escape(a:directory) if has('win32') return 'cd /d ' . l:directory . ' && ' endif return 'cd ' . l:directory . ' && ' endfunction " Given a command string, replace every... " %s -> with the current filename " %t -> with the name of an unused file in a temporary directory " %% -> with a literal % function! ale#command#FormatCommand( \ buffer, \ executable, \ command, \ pipe_file_if_needed, \ input, \ cwd, \ mappings, \) abort let l:temporary_file = '' let l:command = a:command if !empty(a:cwd) let l:command = ale#command#CdString(a:cwd) . l:command endif " First replace all uses of %%, used for literal percent characters, " with an ugly string. let l:command = substitute(l:command, '%%', '<>', 'g') " Replace %e with the escaped executable, if available. if !empty(a:executable) && l:command =~# '%e' let l:command = substitute(l:command, '%e', '\=ale#Escape(a:executable)', 'g') endif " Replace all %s occurrences in the string with the name of the current " file. if l:command =~# '%s' let l:filename = fnamemodify(bufname(a:buffer), ':p') let l:command = substitute( \ l:command, \ s:path_format_regex, \ '\=s:FormatFilename(l:filename, a:mappings, submatch(1))', \ 'g' \) endif if a:input isnot v:false && l:command =~# '%t' " Create a temporary filename, / " The file itself will not be created by this function. let l:temporary_file = s:TemporaryFilename(a:buffer) let l:command = substitute( \ l:command, \ '\v\%t(%(:h|:t|:r|:e)*)', \ '\=s:FormatFilename(l:temporary_file, a:mappings, submatch(1))', \ 'g' \) endif " Finish formatting so %% becomes %. let l:command = substitute(l:command, '<>', '%', 'g') if a:pipe_file_if_needed && empty(l:temporary_file) " If we are to send the Vim buffer to a command, we'll do it " in the shell. We'll write out the file to a temporary file, " and then read it back in, in the shell. let l:temporary_file = s:TemporaryFilename(a:buffer) let l:command = l:command . ' < ' . ale#Escape(l:temporary_file) endif let l:file_created = ale#command#CreateTempFile( \ a:buffer, \ l:temporary_file, \ a:input, \) return [l:temporary_file, l:command, l:file_created] endfunction function! ale#command#StopJobs(buffer, job_type) abort let l:info = get(s:buffer_data, a:buffer, {}) if !empty(l:info) let l:new_map = {} for [l:job_id, l:job_type] in items(l:info.jobs) let l:job_id = str2nr(l:job_id) if a:job_type is# 'all' || a:job_type is# l:job_type call ale#job#Stop(l:job_id) else let l:new_map[l:job_id] = l:job_type endif endfor let l:info.jobs = l:new_map endif endfunction function! s:GatherOutput(line_list, job_id, line) abort call add(a:line_list, a:line) endfunction function! s:ExitCallback(buffer, line_list, Callback, data) abort if !has_key(s:buffer_data, a:buffer) return endif let l:jobs = s:buffer_data[a:buffer].jobs if !has_key(l:jobs, a:data.job_id) return endif let l:job_type = remove(l:jobs, a:data.job_id) if g:ale_history_enabled call ale#history#SetExitCode(a:buffer, a:data.job_id, a:data.exit_code) " Log the output of the command for ALEInfo if we should. if g:ale_history_log_output && a:data.log_output is 1 call ale#history#RememberOutput( \ a:buffer, \ a:data.job_id, \ a:line_list[:] \) endif endif " If the callback starts any new jobs, use the same job type for them. call setbufvar(a:buffer, 'ale_job_type', l:job_type) let l:value = a:Callback(a:buffer, a:line_list, { \ 'exit_code': a:data.exit_code, \ 'temporary_file': a:data.temporary_file, \}) let l:result = a:data.result let l:result.value = l:value " Set the default cwd for this buffer in this call stack. call ale#command#SetCwd(a:buffer, l:result.cwd) try if get(l:result, 'result_callback', v:null) isnot v:null call call(l:result.result_callback, [l:value]) endif finally call ale#command#ResetCwd(a:buffer) endtry endfunction function! ale#command#Run(buffer, command, Callback, ...) abort let l:options = get(a:000, 0, {}) if len(a:000) > 1 throw 'Too many arguments!' endif let l:output_stream = get(l:options, 'output_stream', 'stdout') let l:line_list = [] let l:cwd = get(l:options, 'cwd', v:null) if l:cwd is v:null " Default the working directory to whatever it was for the last " command run in the chain. let l:cwd = get(get(s:buffer_data, a:buffer, {}), 'cwd', v:null) endif let [l:temporary_file, l:command, l:file_created] = ale#command#FormatCommand( \ a:buffer, \ get(l:options, 'executable', ''), \ a:command, \ get(l:options, 'read_buffer', 0), \ get(l:options, 'input', v:null), \ l:cwd, \ get(l:options, 'filename_mappings', []), \) let l:command = ale#job#PrepareCommand(a:buffer, l:command) let l:job_options = { \ 'exit_cb': {job_id, exit_code -> s:ExitCallback( \ a:buffer, \ l:line_list, \ a:Callback, \ { \ 'job_id': job_id, \ 'exit_code': exit_code, \ 'temporary_file': l:temporary_file, \ 'log_output': get(l:options, 'log_output', 1), \ 'result': l:result, \ } \ )}, \ 'mode': 'nl', \} if l:output_stream is# 'stdout' let l:job_options.out_cb = function('s:GatherOutput', [l:line_list]) elseif l:output_stream is# 'stderr' let l:job_options.err_cb = function('s:GatherOutput', [l:line_list]) elseif l:output_stream is# 'both' let l:job_options.out_cb = function('s:GatherOutput', [l:line_list]) let l:job_options.err_cb = function('s:GatherOutput', [l:line_list]) endif let l:status = 'failed' if get(g:, 'ale_run_synchronously') == 1 if get(g:, 'ale_emulate_job_failure') == 1 let l:job_id = 0 else " Generate a fake job ID for tests. let s:fake_job_id = get(s:, 'fake_job_id', 0) + 1 let l:job_id = s:fake_job_id endif elseif has('win32') let l:job_id = ale#job#StartWithCmd(l:command, l:job_options) else let l:job_id = ale#job#Start(l:command, l:job_options) endif if l:job_id let l:status = 'started' let l:job_type = getbufvar(a:buffer, 'ale_job_type', 'all') call ale#command#InitData(a:buffer) let s:buffer_data[a:buffer].jobs[l:job_id] = l:job_type endif if g:ale_history_enabled call ale#history#Add(a:buffer, l:status, l:job_id, l:command) endif if !l:job_id return 0 endif " We'll return this Dictionary. A `result_callback` can be assigned to it " later for capturing the result of a:Callback. " " The `_deferred_job_id` is used for both checking the type of object, and " for checking the job ID and status. " " The cwd is kept and used as the default value for the next command in " the chain. " " The original command here is used in tests. let l:result = { \ '_deferred_job_id': l:job_id, \ 'executable': get(l:options, 'executable', ''), \ 'cwd': l:cwd, \ 'command': a:command, \} if get(g:, 'ale_run_synchronously') == 1 && l:job_id if !exists('g:ale_run_synchronously_callbacks') let g:ale_run_synchronously_callbacks = [] endif if get(g:, 'ale_run_synchronously_emulate_commands', 0) call add( \ g:ale_run_synchronously_callbacks, \ {exit_code, output -> [ \ extend(l:line_list, output), \ l:job_options.exit_cb(l:job_id, exit_code), \ ]} \) else " Run a command synchronously if this test option is set. call extend(l:line_list, systemlist( \ type(l:command) is v:t_list \ ? join(l:command[0:1]) . ' ' . ale#Escape(l:command[2]) \ : l:command \)) " Don't capture output when the callbacks aren't set. if !has_key(l:job_options, 'out_cb') \&& !has_key(l:job_options, 'err_cb') let l:line_list = [] endif call add( \ g:ale_run_synchronously_callbacks, \ {-> l:job_options.exit_cb(l:job_id, v:shell_error)} \) endif endif return l:result endfunction function! ale#command#IsDeferred(value) abort return type(a:value) is v:t_dict && has_key(a:value, '_deferred_job_id') endfunction ale-4.0.0/autoload/ale/completion.vim000066400000000000000000001004321476501472200175230ustar00rootroot00000000000000" Author: w0rp " Description: Completion support for LSP linters scriptencoding utf-8 " The omnicompletion menu is shown through a special Plug mapping which is " only valid in Insert mode. This way, feedkeys() won't send these keys if you " quit Insert mode quickly enough. inoremap (ale_show_completion_menu) " If we hit the key sequence in normal mode, then we won't show the menu, so " we should restore the old settings right away. nnoremap (ale_show_completion_menu) :call ale#completion#RestoreCompletionOptions() cnoremap (ale_show_completion_menu) vnoremap (ale_show_completion_menu) onoremap (ale_show_completion_menu) let g:ale_completion_delay = get(g:, 'ale_completion_delay', 100) let g:ale_completion_excluded_words = get(g:, 'ale_completion_excluded_words', []) let g:ale_completion_max_suggestions = get(g:, 'ale_completion_max_suggestions', 50) let g:ale_completion_autoimport = get(g:, 'ale_completion_autoimport', 1) let g:ale_completion_tsserver_remove_warnings = get(g:, 'ale_completion_tsserver_remove_warnings', 0) let s:timer_id = -1 let s:last_done_pos = [] " CompletionItemKind values from the LSP protocol. let g:ale_lsp_types = { \ 1: 'text', \ 2: 'method', \ 3: 'function', \ 4: 'constructor', \ 5: 'field', \ 6: 'variable', \ 7: 'class', \ 8: 'interface', \ 9: 'module', \ 10: 'property', \ 11: 'unit', \ 12: 'value', \ 13: 'enum', \ 14: 'keyword', \ 15: 'snippet', \ 16: 'color', \ 17: 'file', \ 18: 'reference', \ 19: 'folder', \ 20: 'enum_member', \ 21: 'constant', \ 22: 'struct', \ 23: 'event', \ 24: 'operator', \ 25: 'type_parameter', \ } " from https://github.com/microsoft/TypeScript/blob/29becf05012bfa7ba20d50b0d16813971e46b8a6/lib/protocol.d.ts#L2472 let g:ale_tsserver_types = { \ 'warning': 'text', \ 'keyword': 'keyword', \ 'script': 'file', \ 'module': 'module', \ 'class': 'class', \ 'local class': 'class', \ 'interface': 'interface', \ 'type': 'class', \ 'enum': 'enum', \ 'enum member': 'enum_member', \ 'var': 'variable', \ 'local var': 'variable', \ 'function': 'function', \ 'local function': 'function', \ 'method': 'method', \ 'getter': 'property', \ 'setter': 'method', \ 'property': 'property', \ 'constructor': 'constructor', \ 'call': 'method', \ 'index': 'index', \ 'construct': 'constructor', \ 'parameter': 'parameter', \ 'type parameter': 'type_parameter', \ 'primitive type': 'unit', \ 'label': 'text', \ 'alias': 'class', \ 'const': 'constant', \ 'let': 'variable', \ 'directory': 'folder', \ 'external module name': 'text', \ 'JSX attribute': 'parameter', \ 'string': 'text' \ } " For compatibility reasons, we only use built in VIM completion kinds " See :help complete-items for Vim completion kinds let g:ale_completion_symbols = get(g:, 'ale_completion_symbols', { \ 'text': 'v', \ 'method': 'f', \ 'function': 'f', \ 'constructor': 'f', \ 'field': 'm', \ 'variable': 'v', \ 'class': 't', \ 'interface': 't', \ 'module': 'd', \ 'property': 'm', \ 'unit': 'v', \ 'value': 'v', \ 'enum': 't', \ 'keyword': 'v', \ 'snippet': 'v', \ 'color': 'v', \ 'file': 'v', \ 'reference': 'v', \ 'folder': 'v', \ 'enum_member': 'm', \ 'constant': 'm', \ 'struct': 't', \ 'event': 'v', \ 'operator': 'f', \ 'type_parameter': 'p', \ '': 'v' \ }) let s:LSP_INSERT_TEXT_FORMAT_PLAIN = 1 let s:LSP_INSERT_TEXT_FORMAT_SNIPPET = 2 let s:lisp_regex = '\v[a-zA-Z_\-][a-zA-Z_\-0-9]*$' " Regular expressions for checking the characters in the line before where " the insert cursor is. If one of these matches, we'll check for completions. let s:should_complete_map = { \ '': '\v[a-zA-Z$_][a-zA-Z$_0-9]*$|\.$', \ 'clojure': s:lisp_regex, \ 'lisp': s:lisp_regex, \ 'racket': '\k\+$', \ 'typescript': '\v[a-zA-Z$_][a-zA-Z$_0-9]*$|\.$|''$|"$', \ 'rust': '\v[a-zA-Z$_][a-zA-Z$_0-9]*$|\.$|::$', \ 'cpp': '\v[a-zA-Z$_][a-zA-Z$_0-9]*$|\.$|::$|-\>$', \ 'c': '\v[a-zA-Z$_][a-zA-Z$_0-9]*$|\.$|-\>$', \} " Regular expressions for finding the start column to replace with completion. let s:omni_start_map = { \ '': '\v[a-zA-Z$_][a-zA-Z$_0-9]*$', \ 'racket': '\k\+$', \} " A map of exact characters for triggering LSP completions. Do not forget to " update self.input_patterns in ale.py in updating entries in this map. let s:trigger_character_map = { \ '': ['.'], \ 'typescript': ['.', '''', '"'], \ 'rust': ['.', '::'], \ 'cpp': ['.', '::', '->'], \ 'c': ['.', '->'], \} function! s:GetFiletypeValue(map, filetype) abort for l:part in reverse(split(a:filetype, '\.')) let l:regex = get(a:map, l:part, []) if !empty(l:regex) return l:regex endif endfor " Use the default regex for other files. return a:map[''] endfunction " Check if we should look for completions for a language. function! ale#completion#GetPrefix(filetype, line, column) abort let l:regex = s:GetFiletypeValue(s:should_complete_map, a:filetype) " The column we're using completions for is where we are inserting text, " like so: " abc " ^ " So we need check the text in the column before that position. return matchstr(getline(a:line)[: a:column - 2], l:regex) endfunction function! ale#completion#GetTriggerCharacter(filetype, prefix) abort if empty(a:prefix) return '' endif let l:char_list = s:GetFiletypeValue(s:trigger_character_map, a:filetype) if index(l:char_list, a:prefix) >= 0 return a:prefix endif return '' endfunction function! ale#completion#Filter( \ buffer, \ filetype, \ suggestions, \ prefix, \ exact_prefix_match, \) abort let l:excluded_words = ale#Var(a:buffer, 'completion_excluded_words') if empty(a:prefix) let l:filtered_suggestions = a:suggestions else let l:triggers = s:GetFiletypeValue(s:trigger_character_map, a:filetype) " For completing... " foo. " ^ " We need to include all of the given suggestions. if index(l:triggers, a:prefix) >= 0 || empty(a:prefix) let l:filtered_suggestions = a:suggestions else let l:filtered_suggestions = [] " Filter suggestions down to those starting with the prefix we " used for finding suggestions in the first place. " " Some completion tools will include suggestions which don't even " start with the characters we have already typed. for l:item in a:suggestions " A List of String values or a List of completion item " Dictionaries is accepted here. let l:word = type(l:item) is v:t_string ? l:item : l:item.word if a:exact_prefix_match " Add suggestions if the word is an exact match. if l:word is# a:prefix call add(l:filtered_suggestions, l:item) endif else " Add suggestions if the suggestion starts with a " case-insensitive match for the prefix. if l:word[: len(a:prefix) - 1] is? a:prefix call add(l:filtered_suggestions, l:item) endif endif endfor endif endif if !empty(l:excluded_words) " Copy the List if needed. We don't want to modify the argument. " We shouldn't make a copy if we don't need to. if l:filtered_suggestions is a:suggestions let l:filtered_suggestions = copy(a:suggestions) endif " Remove suggestions with words in the exclusion List. call filter( \ l:filtered_suggestions, \ 'index(l:excluded_words, type(v:val) is v:t_string ? v:val : v:val.word) < 0', \) endif return l:filtered_suggestions endfunction function! s:ReplaceCompletionOptions(source) abort " Remember the old omnifunc value, if there is one. " If we don't store an old one, we'll just never reset the option. " This will stop some random exceptions from appearing. if !exists('b:ale_old_omnifunc') && !empty(&l:omnifunc) let b:ale_old_omnifunc = &l:omnifunc endif let &l:omnifunc = 'ale#completion#AutomaticOmniFunc' if a:source is# 'ale-automatic' if !exists('b:ale_old_completeopt') let b:ale_old_completeopt = &l:completeopt endif let l:opt_list = split(&l:completeopt, ',') " The menu and noinsert options must be set, or automatic completion " will be annoying. let l:new_opt_list = ['menu', 'menuone', 'noinsert'] " Permit some other completion options, provided users have set them. for l:opt in ['preview', 'popup', 'noselect'] if index(l:opt_list, l:opt) >= 0 call add(l:new_opt_list, l:opt) endif endfor let &l:completeopt = join(l:new_opt_list, ',') endif endfunction function! ale#completion#RestoreCompletionOptions() abort " Reset settings when completion is done. if exists('b:ale_old_omnifunc') if b:ale_old_omnifunc isnot# 'pythoncomplete#Complete' let &l:omnifunc = b:ale_old_omnifunc endif unlet b:ale_old_omnifunc endif if exists('b:ale_old_completeopt') let &l:completeopt = b:ale_old_completeopt unlet b:ale_old_completeopt endif endfunction function! ale#completion#GetCompletionPosition() abort if !exists('b:ale_completion_info') return 0 endif let l:line = b:ale_completion_info.line let l:column = b:ale_completion_info.column let l:regex = s:GetFiletypeValue(s:omni_start_map, &filetype) let l:up_to_column = getline(l:line)[: l:column - 2] let l:match = matchstr(l:up_to_column, l:regex) return l:column - len(l:match) - 1 endfunction function! ale#completion#GetCompletionPositionForDeoplete(input) abort return match(a:input, '\k*$') endfunction function! ale#completion#GetCompletionResult() abort if exists('b:ale_completion_result') return b:ale_completion_result endif return v:null endfunction function! ale#completion#AutomaticOmniFunc(findstart, base) abort if a:findstart return ale#completion#GetCompletionPosition() else let l:result = ale#completion#GetCompletionResult() let l:source = get(get(b:, 'ale_completion_info', {}), 'source', '') if l:source is# 'ale-automatic' || l:source is# 'ale-manual' call s:ReplaceCompletionOptions(l:source) endif return l:result isnot v:null ? l:result : [] endif endfunction function! s:OpenCompletionMenu(...) abort if !&l:paste call ale#util#FeedKeys("\(ale_show_completion_menu)") endif endfunction function! ale#completion#Show(result) abort let l:source = get(get(b:, 'ale_completion_info', {}), 'source', '') if ale#util#Mode() isnot# 'i' && l:source isnot# 'ale-import' return endif " Set the list in the buffer. let b:ale_completion_result = a:result " Don't try to open the completion menu if there's nothing to show. if empty(b:ale_completion_result) if l:source is# 'ale-import' " If we ran completion from :ALEImport, " tell the user that nothing is going to happen. call s:message('No possible imports found.') endif return endif " Replace completion options shortly before opening the menu. if l:source is# 'ale-automatic' || l:source is# 'ale-manual' call s:ReplaceCompletionOptions(l:source) call timer_start(0, function('s:OpenCompletionMenu')) endif if l:source is# 'ale-callback' call b:CompleteCallback(b:ale_completion_result) endif if l:source is# 'ale-import' call ale#completion#HandleUserData(b:ale_completion_result[0]) let l:text_changed = '' . g:ale_lint_on_text_changed " Check the buffer again right away, if linting is enabled. if g:ale_enabled \&& ( \ l:text_changed is# '1' \ || l:text_changed is# 'always' \ || l:text_changed is# 'normal' \ || l:text_changed is# 'insert' \) call ale#Queue(0, '') endif endif endfunction function! ale#completion#GetAllTriggers() abort return deepcopy(s:trigger_character_map) endfunction function! ale#completion#GetCompletionKind(kind) abort let l:lsp_symbol = get(g:ale_lsp_types, a:kind, '') if !empty(l:lsp_symbol) return l:lsp_symbol endif return get(g:ale_tsserver_types, a:kind, '') endfunction function! ale#completion#GetCompletionSymbols(kind) abort let l:kind = ale#completion#GetCompletionKind(a:kind) let l:symbol = get(g:ale_completion_symbols, l:kind, '') if !empty(l:symbol) return l:symbol endif return get(g:ale_completion_symbols, '', 'v') endfunction function! s:CompletionStillValid(request_id) abort let [l:line, l:column] = getpos('.')[1:2] return has_key(b:, 'ale_completion_info') \&& ( \ ale#util#Mode() is# 'i' \ || b:ale_completion_info.source is# 'ale-import' \) \&& b:ale_completion_info.request_id == a:request_id \&& b:ale_completion_info.line == l:line \&& ( \ b:ale_completion_info.column == l:column \ || b:ale_completion_info.source is# 'ale-omnifunc' \ || b:ale_completion_info.source is# 'ale-callback' \ || b:ale_completion_info.source is# 'ale-import' \) endfunction function! ale#completion#ParseTSServerCompletions(response) abort let l:names = [] for l:suggestion in a:response.body let l:kind = get(l:suggestion, 'kind', '') if g:ale_completion_tsserver_remove_warnings == 0 || l:kind isnot# 'warning' call add(l:names, { \ 'word': l:suggestion.name, \ 'source': get(l:suggestion, 'source', ''), \}) endif endfor return l:names endfunction function! ale#completion#ParseTSServerCompletionEntryDetails(response) abort let l:buffer = bufnr('') let l:results = [] let l:names_with_details = [] let l:info = get(b:, 'ale_completion_info', {}) for l:suggestion in a:response.body let l:displayParts = [] let l:local_name = v:null for l:action in get(l:suggestion, 'codeActions', []) call add(l:displayParts, l:action.description . ' ') endfor for l:part in l:suggestion.displayParts " Stop on stop on line breaks for the menu. if get(l:part, 'kind') is# 'lineBreak' break endif if get(l:part, 'kind') is# 'localName' let l:local_name = l:part.text endif call add(l:displayParts, l:part.text) endfor " Each one of these parts has 'kind' properties let l:documentationParts = [] for l:part in get(l:suggestion, 'documentation', []) call add(l:documentationParts, l:part.text) endfor " See :help complete-items let l:result = { \ 'word': ( \ l:suggestion.name is# 'default' \ && l:suggestion.kind is# 'alias' \ && !empty(l:local_name) \ ? l:local_name \ : l:suggestion.name \ ), \ 'kind': ale#completion#GetCompletionSymbols(l:suggestion.kind), \ 'icase': 1, \ 'menu': join(l:displayParts, ''), \ 'dup': get(l:info, 'additional_edits_only', 0) \ || g:ale_completion_autoimport, \ 'info': join(l:documentationParts, ''), \} " This flag is used to tell if this completion came from ALE or not. let l:user_data = {'_ale_completion_item': 1} if has_key(l:suggestion, 'codeActions') let l:user_data.code_actions = l:suggestion.codeActions endif let l:result.user_data = json_encode(l:user_data) " Include this item if we'll accept any items, " or if we only want items with additional edits, and this has them. if !get(l:info, 'additional_edits_only', 0) \|| has_key(l:user_data, 'code_actions') call add(l:results, l:result) endif endfor let l:names = getbufvar(l:buffer, 'ale_tsserver_completion_names', []) if !empty(l:names) && len(l:names) != len(l:results) let l:names_with_details = map(copy(l:results), 'v:val.word') let l:missing_names = filter( \ copy(l:names), \ 'index(l:names_with_details, v:val.word) < 0', \) for l:name in l:missing_names call add(l:results, { \ 'word': l:name.word, \ 'kind': 'v', \ 'icase': 1, \ 'menu': '', \ 'info': '', \ 'user_data': json_encode({'_ale_completion_item': 1}), \}) endfor endif return l:results endfunction function! ale#completion#NullFilter(buffer, item) abort return 1 endfunction function! ale#completion#ParseLSPCompletions(response) abort let l:buffer = bufnr('') let l:info = get(b:, 'ale_completion_info', {}) let l:Filter = get(l:info, 'completion_filter', v:null) if l:Filter is v:null let l:Filter = function('ale#completion#NullFilter') else let l:Filter = ale#util#GetFunction(l:Filter) endif let l:item_list = [] if type(get(a:response, 'result')) is v:t_list let l:item_list = a:response.result elseif type(get(a:response, 'result')) is v:t_dict \&& type(get(a:response.result, 'items')) is v:t_list let l:item_list = a:response.result.items endif let l:results = [] for l:item in l:item_list if !call(l:Filter, [l:buffer, l:item]) continue endif if get(l:item, 'insertTextFormat', s:LSP_INSERT_TEXT_FORMAT_PLAIN) is s:LSP_INSERT_TEXT_FORMAT_PLAIN \&& type(get(l:item, 'textEdit')) is v:t_dict let l:text = l:item.textEdit.newText elseif type(get(l:item, 'insertText')) is v:t_string let l:text = l:item.insertText else let l:text = l:item.label endif let l:word = matchstr(l:text, '\v^[^(]+') if empty(l:word) continue endif " Don't use LSP items with additional text edits when autoimport for " completions is turned off. if !empty(get(l:item, 'additionalTextEdits')) \&& !( \ get(l:info, 'additional_edits_only', 0) \ || g:ale_completion_autoimport \) continue endif let l:doc = get(l:item, 'documentation', '') if type(l:doc) is v:t_dict && has_key(l:doc, 'value') let l:doc = l:doc.value endif " Collapse whitespaces and line breaks into a single space. let l:detail = substitute(get(l:item, 'detail', ''), '\_s\+', ' ', 'g') let l:result = { \ 'word': l:word, \ 'kind': ale#completion#GetCompletionSymbols(get(l:item, 'kind', '')), \ 'icase': 1, \ 'menu': l:detail, \ 'dup': get(l:info, 'additional_edits_only', 0) \ || g:ale_completion_autoimport, \ 'info': (type(l:doc) is v:t_string ? l:doc : ''), \} " This flag is used to tell if this completion came from ALE or not. let l:user_data = {'_ale_completion_item': 1} if has_key(l:item, 'additionalTextEdits') \ && l:item.additionalTextEdits isnot v:null let l:text_changes = [] for l:edit in l:item.additionalTextEdits call add(l:text_changes, { \ 'start': { \ 'line': l:edit.range.start.line + 1, \ 'offset': l:edit.range.start.character + 1, \ }, \ 'end': { \ 'line': l:edit.range.end.line + 1, \ 'offset': l:edit.range.end.character + 1, \ }, \ 'newText': l:edit.newText, \}) endfor if !empty(l:text_changes) let l:user_data.code_actions = [{ \ 'description': 'completion', \ 'changes': [ \ { \ 'fileName': expand('#' . l:buffer . ':p'), \ 'textChanges': l:text_changes, \ }, \ ], \}] endif endif let l:result.user_data = json_encode(l:user_data) " Include this item if we'll accept any items, " or if we only want items with additional edits, and this has them. if !get(l:info, 'additional_edits_only', 0) \|| has_key(l:user_data, 'code_actions') call add(l:results, l:result) endif endfor if has_key(l:info, 'prefix') let l:results = ale#completion#Filter( \ l:buffer, \ &filetype, \ l:results, \ l:info.prefix, \ get(l:info, 'additional_edits_only', 0), \) endif return l:results[: g:ale_completion_max_suggestions - 1] endfunction function! ale#completion#HandleTSServerResponse(conn_id, response) abort if !s:CompletionStillValid(get(a:response, 'request_seq')) return endif if !has_key(a:response, 'body') return endif let l:buffer = bufnr('') let l:command = get(a:response, 'command', '') if l:command is# 'completions' let l:names = ale#completion#Filter( \ l:buffer, \ &filetype, \ ale#completion#ParseTSServerCompletions(a:response), \ b:ale_completion_info.prefix, \ get(b:ale_completion_info, 'additional_edits_only', 0), \)[: g:ale_completion_max_suggestions - 1] " We need to remember some names for tsserver, as it doesn't send " details back for everything we send. call setbufvar(l:buffer, 'ale_tsserver_completion_names', l:names) if empty(l:names) " Response with no results now and skip making a redundant request " for nothing. call ale#completion#Show([]) else let l:identifiers = [] for l:name in l:names let l:identifier = { \ 'name': l:name.word, \} let l:source = get(l:name, 'source', '') " Empty source results in no details for the completed item if !empty(l:source) call extend(l:identifier, { 'source': l:source }) endif call add(l:identifiers, l:identifier) endfor let b:ale_completion_info.request_id = ale#lsp#Send( \ b:ale_completion_info.conn_id, \ ale#lsp#tsserver_message#CompletionEntryDetails( \ l:buffer, \ b:ale_completion_info.line, \ b:ale_completion_info.column, \ l:identifiers, \ ), \) endif elseif l:command is# 'completionEntryDetails' call ale#completion#Show( \ ale#completion#ParseTSServerCompletionEntryDetails(a:response), \) endif endfunction function! ale#completion#HandleLSPResponse(conn_id, response) abort if !s:CompletionStillValid(get(a:response, 'id')) return endif call ale#completion#Show( \ ale#completion#ParseLSPCompletions(a:response), \) endfunction function! s:OnReady(linter, lsp_details) abort let l:id = a:lsp_details.connection_id if !ale#lsp#HasCapability(l:id, 'completion') return endif let l:buffer = a:lsp_details.buffer " If we have sent a completion request already, don't send another. if b:ale_completion_info.request_id return endif let l:Callback = a:linter.lsp is# 'tsserver' \ ? function('ale#completion#HandleTSServerResponse') \ : function('ale#completion#HandleLSPResponse') call ale#lsp#RegisterCallback(l:id, l:Callback) if a:linter.lsp is# 'tsserver' if get(g:, 'ale_completion_tsserver_autoimport') is 1 " no-custom-checks echom '`g:ale_completion_tsserver_autoimport` is deprecated. Use `g:ale_completion_autoimport` instead.' endif let l:message = ale#lsp#tsserver_message#Completions( \ l:buffer, \ b:ale_completion_info.line, \ b:ale_completion_info.column, \ b:ale_completion_info.prefix, \ get(b:ale_completion_info, 'additional_edits_only', 0) \ || g:ale_completion_autoimport, \) else " Send a message saying the buffer has changed first, otherwise " completions won't know what text is nearby. call ale#lsp#NotifyForChanges(l:id, l:buffer) " For LSP completions, we need to clamp the column to the length of " the line. python-language-server and perhaps others do not implement " this correctly. let l:message = ale#lsp#message#Completion( \ l:buffer, \ b:ale_completion_info.line, \ b:ale_completion_info.column, \ ale#completion#GetTriggerCharacter(&filetype, b:ale_completion_info.prefix), \) endif let l:request_id = ale#lsp#Send(l:id, l:message) if l:request_id let b:ale_completion_info.conn_id = l:id let b:ale_completion_info.request_id = l:request_id if has_key(a:linter, 'completion_filter') let b:ale_completion_info.completion_filter = a:linter.completion_filter endif endif endfunction " This function can be called to check if ALE can provide completion data for " the current buffer. 1 will be returned if there's a potential source of " completion data ALE can use, and 0 will be returned otherwise. function! ale#completion#CanProvideCompletions() abort " NOTE: We can report that ALE can provide completions to Deoplete from " here, and we might ignore linters still below. for l:linter in ale#linter#Get(&filetype) if !empty(l:linter.lsp) return 1 endif endfor return 0 endfunction " This function can be used to manually trigger autocomplete, even when " g:ale_completion_enabled is set to false function! ale#completion#GetCompletions(...) abort let l:source = get(a:000, 0, '') let l:options = get(a:000, 1, {}) if len(a:000) > 2 throw 'Too many arguments!' endif let l:CompleteCallback = get(l:options, 'callback', v:null) if l:CompleteCallback isnot v:null let b:CompleteCallback = l:CompleteCallback endif if has_key(l:options, 'line') && has_key(l:options, 'column') " Use a provided line and column, if given. let l:line = l:options.line let l:column = l:options.column else let [l:line, l:column] = getpos('.')[1:2] endif if has_key(l:options, 'prefix') let l:prefix = l:options.prefix else let l:prefix = ale#completion#GetPrefix(&filetype, l:line, l:column) endif if l:source is# 'ale-automatic' && empty(l:prefix) return 0 endif let l:line_length = len(getline('.')) let b:ale_completion_info = { \ 'line': l:line, \ 'line_length': l:line_length, \ 'column': l:column, \ 'prefix': l:prefix, \ 'conn_id': 0, \ 'request_id': 0, \ 'source': l:source, \} unlet! b:ale_completion_result if has_key(l:options, 'additional_edits_only') let b:ale_completion_info.additional_edits_only = \ l:options.additional_edits_only endif let l:buffer = bufnr('') let l:Callback = function('s:OnReady') let l:started = 0 for l:linter in ale#lsp_linter#GetEnabled(l:buffer) if ale#lsp_linter#StartLSP(l:buffer, l:linter, l:Callback) let l:started = 1 endif endfor return l:started endfunction function! s:message(message) abort call ale#util#Execute('echom ' . string(a:message)) endfunction " This function implements the :ALEImport command. function! ale#completion#Import() abort let l:word = expand('') if empty(l:word) call s:message('Nothing to complete at cursor!') return endif let [l:line, l:column] = getpos('.')[1:2] let l:column = searchpos('\V' . escape(l:word, '/\'), 'bnc', l:line)[1] let l:column = l:column + len(l:word) - 1 if l:column isnot 0 let l:started = ale#completion#GetCompletions('ale-import', { \ 'line': l:line, \ 'column': l:column, \ 'prefix': l:word, \ 'additional_edits_only': 1, \}) if !l:started call s:message('No completion providers are available.') endif endif endfunction function! ale#completion#OmniFunc(findstart, base) abort if a:findstart let l:started = ale#completion#GetCompletions('ale-omnifunc') if !l:started " This is the special value for cancelling completions silently. " See :help complete-functions return -3 endif return ale#completion#GetCompletionPosition() else let l:result = ale#completion#GetCompletionResult() while l:result is v:null && !complete_check() sleep 2ms let l:result = ale#completion#GetCompletionResult() endwhile return l:result isnot v:null ? l:result : [] endif endfunction function! s:TimerHandler(...) abort if !get(b:, 'ale_completion_enabled', g:ale_completion_enabled) return endif let s:timer_id = -1 let [l:line, l:column] = getpos('.')[1:2] " When running the timer callback, we have to be sure that the cursor " hasn't moved from where it was when we requested completions by typing. if s:timer_pos == [l:line, l:column] && ale#util#Mode() is# 'i' call ale#completion#GetCompletions('ale-automatic') endif endfunction " Stop any completion timer that is queued. This is useful for tests. function! ale#completion#StopTimer() abort if s:timer_id != -1 call timer_stop(s:timer_id) endif let s:timer_id = -1 endfunction function! ale#completion#Queue() abort if !get(b:, 'ale_completion_enabled', g:ale_completion_enabled) return endif let s:timer_pos = getpos('.')[1:2] if s:timer_pos == s:last_done_pos " Do not ask for completions if the cursor rests on the position we " last completed on. return endif " If we changed the text again while we're still waiting for a response, " then invalidate the requests before the timer ticks again. if exists('b:ale_completion_info') let b:ale_completion_info.request_id = 0 endif call ale#completion#StopTimer() let s:timer_id = timer_start(g:ale_completion_delay, function('s:TimerHandler')) endfunction function! ale#completion#HandleUserData(completed_item) abort let l:user_data_json = get(a:completed_item, 'user_data', '') let l:user_data = type(l:user_data_json) is v:t_dict \ ? l:user_data_json \ : ale#util#FuzzyJSONDecode(l:user_data_json, {}) if !has_key(l:user_data, '_ale_completion_item') return endif let l:source = get(get(b:, 'ale_completion_info', {}), 'source', '') if l:source is# 'ale-automatic' \|| l:source is# 'ale-manual' \|| l:source is# 'ale-callback' \|| l:source is# 'ale-import' \|| l:source is# 'ale-omnifunc' for l:code_action in get(l:user_data, 'code_actions', []) call ale#code_action#HandleCodeAction(l:code_action, {}) endfor endif silent doautocmd User ALECompletePost endfunction function! ale#completion#Done() abort silent! pclose call ale#completion#RestoreCompletionOptions() let s:last_done_pos = getpos('.')[1:2] endfunction augroup ALECompletionActions autocmd! autocmd CompleteDone * call ale#completion#HandleUserData(v:completed_item) augroup END function! s:Setup(enabled) abort augroup ALECompletionGroup autocmd! if a:enabled autocmd TextChangedI * call ale#completion#Queue() autocmd CompleteDone * call ale#completion#Done() endif augroup END if !a:enabled augroup! ALECompletionGroup endif endfunction function! ale#completion#Enable() abort let g:ale_completion_enabled = 1 call s:Setup(1) endfunction function! ale#completion#Disable() abort let g:ale_completion_enabled = 0 call s:Setup(0) endfunction ale-4.0.0/autoload/ale/completion/000077500000000000000000000000001476501472200170065ustar00rootroot00000000000000ale-4.0.0/autoload/ale/completion/python.vim000066400000000000000000000002021476501472200210360ustar00rootroot00000000000000function! ale#completion#python#CompletionItemFilter(buffer, item) abort return a:item.label !~# '\v^__[a-z_]+__' endfunction ale-4.0.0/autoload/ale/cursor.vim000066400000000000000000000130551476501472200166730ustar00rootroot00000000000000scriptencoding utf-8 " Author: w0rp " Author: João Paulo S. de Souza " Description: Echoes lint message for the current line, if any " Controls the milliseconds delay before echoing a message. let g:ale_echo_delay = get(g:, 'ale_echo_delay', 10) " A string format for the echoed message. let g:ale_echo_msg_format = get(g:, 'ale_echo_msg_format', '%code: %%s') let s:cursor_timer = -1 " A wrapper for echon so we can test messages we echo in Vader tests. function! ale#cursor#Echom(message) abort if mode() is# 'n' " no-custom-checks exec "norm! :echom a:message\n" endif endfunction function! ale#cursor#TruncatedEcho(original_message) abort let l:message = a:original_message " Change tabs to spaces. let l:message = substitute(l:message, "\t", ' ', 'g') " Remove any newlines in the message. let l:message = substitute(l:message, "\n", '', 'g') " Convert indentation groups into single spaces for better legibility when " put on a single line let l:message = substitute(l:message, ' \+', ' ', 'g') " We need to remember the setting for shortmess and reset it again. let l:shortmess_options = &l:shortmess try let l:cursor_position = getpos('.') " The message is truncated and saved to the history. silent! setlocal shortmess+=T try call ale#cursor#Echom(l:message) catch /^Vim\%((\a\+)\)\=:E523/ " Fallback into manual truncate (#1987) let l:winwidth = winwidth(0) if l:winwidth < strdisplaywidth(l:message) " Truncate message longer than window width with trailing '...' let l:message = l:message[:l:winwidth - 4] . '...' endif exec 'echomsg l:message' catch /E481/ " Do nothing if running from a visual selection. endtry " Reset the cursor position if we moved off the end of the line. " Using :norm and :echomsg can move the cursor off the end of the " line. if l:cursor_position != getpos('.') call setpos('.', l:cursor_position) endif finally let &l:shortmess = l:shortmess_options endtry endfunction function! s:StopCursorTimer() abort if s:cursor_timer != -1 call timer_stop(s:cursor_timer) let s:cursor_timer = -1 endif endfunction function! ale#cursor#EchoCursorWarning(...) abort let l:buffer = bufnr('') if !g:ale_echo_cursor && !g:ale_cursor_detail return endif " Only echo the warnings in normal mode, otherwise we will get problems. if mode(1) isnot# 'n' return endif if ale#ShouldDoNothing(l:buffer) return endif let [l:info, l:loc] = ale#util#FindItemAtCursor(l:buffer) if g:ale_echo_cursor if !empty(l:loc) let l:format = ale#Var(l:buffer, 'echo_msg_format') let l:msg = ale#GetLocItemMessage(l:loc, l:format) call ale#cursor#TruncatedEcho(l:msg) let l:info.echoed = 1 elseif get(l:info, 'echoed') " We'll only clear the echoed message when moving off errors once, " so we don't continually clear the echo line. " " no-custom-checks echo let l:info.echoed = 0 endif endif if g:ale_cursor_detail if !empty(l:loc) call s:ShowCursorDetailForItem(l:loc, {'stay_here': 1}) else call ale#preview#CloseIfTypeMatches('ale-preview') endif endif endfunction function! ale#cursor#EchoCursorWarningWithDelay() abort let l:buffer = bufnr('') if !g:ale_echo_cursor && !g:ale_cursor_detail return endif " Only echo the warnings in normal mode, otherwise we will get problems. if mode(1) isnot# 'n' return endif call s:StopCursorTimer() let l:pos = getpos('.')[0:2] if !exists('w:last_pos') let w:last_pos = [0, 0, 0] endif " Check the current buffer, line, and column number against the last " recorded position. If the position has actually changed, *then* " we should echo something. Otherwise we can end up doing processing " the echo message far too frequently. if l:pos != w:last_pos let l:delay = ale#Var(l:buffer, 'echo_delay') let w:last_pos = l:pos let s:cursor_timer = timer_start( \ l:delay, \ function('ale#cursor#EchoCursorWarning') \) endif endfunction function! s:ShowCursorDetailForItem(loc, options) abort let l:stay_here = get(a:options, 'stay_here', 0) let s:last_detailed_line = line('.') let l:message = get(a:loc, 'detail', a:loc.text) let l:lines = split(l:message, "\n") if g:ale_floating_preview || g:ale_detail_to_floating_preview call ale#floating_preview#Show(l:lines) else call ale#preview#Show(l:lines, {'stay_here': l:stay_here}) " Clear the echo message if we manually displayed details. if !l:stay_here " no-custom-checks echo endif endif endfunction function! ale#cursor#ShowCursorDetail() abort let l:buffer = bufnr('') " Only echo the warnings in normal mode, otherwise we will get problems. if mode() isnot# 'n' return endif if ale#ShouldDoNothing(l:buffer) return endif call s:StopCursorTimer() let [l:info, l:loc] = ale#util#FindItemAtCursor(l:buffer) if !empty(l:loc) call s:ShowCursorDetailForItem(l:loc, {'stay_here': 0}) endif endfunction ale-4.0.0/autoload/ale/d.vim000066400000000000000000000007731476501472200156040ustar00rootroot00000000000000" Author: Auri " Description: Functions for integrating with D linters. function! ale#d#FindDUBConfig(buffer) abort " Find a DUB configuration file in ancestor paths. " The most DUB-specific names will be tried first. for l:possible_filename in ['dub.sdl', 'dub.json', 'package.json'] let l:dub_file = ale#path#FindNearestFile(a:buffer, l:possible_filename) if !empty(l:dub_file) return l:dub_file endif endfor return '' endfunction ale-4.0.0/autoload/ale/debugging.vim000066400000000000000000000250131476501472200173060ustar00rootroot00000000000000" Author: w0rp " Description: This file implements debugging information for ALE let g:ale_info_default_mode = get(g:, 'ale_info_default_mode', 'preview') let s:global_variable_list = [ \ 'ale_cache_executable_check_failures', \ 'ale_change_sign_column_color', \ 'ale_command_wrapper', \ 'ale_completion_delay', \ 'ale_completion_enabled', \ 'ale_completion_max_suggestions', \ 'ale_disable_lsp', \ 'ale_echo_cursor', \ 'ale_echo_msg_error_str', \ 'ale_echo_msg_format', \ 'ale_echo_msg_info_str', \ 'ale_echo_msg_warning_str', \ 'ale_enabled', \ 'ale_fix_on_save', \ 'ale_fixers', \ 'ale_history_enabled', \ 'ale_info_default_mode', \ 'ale_history_log_output', \ 'ale_keep_list_window_open', \ 'ale_lint_delay', \ 'ale_lint_on_enter', \ 'ale_lint_on_filetype_changed', \ 'ale_lint_on_insert_leave', \ 'ale_lint_on_save', \ 'ale_lint_on_text_changed', \ 'ale_linter_aliases', \ 'ale_linters', \ 'ale_linters_explicit', \ 'ale_linters_ignore', \ 'ale_list_vertical', \ 'ale_list_window_size', \ 'ale_loclist_msg_format', \ 'ale_max_buffer_history_size', \ 'ale_max_signs', \ 'ale_maximum_file_size', \ 'ale_open_list', \ 'ale_pattern_options', \ 'ale_pattern_options_enabled', \ 'ale_root', \ 'ale_set_balloons', \ 'ale_set_highlights', \ 'ale_set_loclist', \ 'ale_set_quickfix', \ 'ale_set_signs', \ 'ale_sign_column_always', \ 'ale_sign_error', \ 'ale_sign_info', \ 'ale_sign_offset', \ 'ale_sign_style_error', \ 'ale_sign_style_warning', \ 'ale_sign_warning', \ 'ale_sign_highlight_linenrs', \ 'ale_type_map', \ 'ale_use_neovim_diagnostics_api', \ 'ale_use_global_executables', \ 'ale_virtualtext_cursor', \ 'ale_warn_about_trailing_blank_lines', \ 'ale_warn_about_trailing_whitespace', \] function! s:Echo(message) abort " no-custom-checks echo a:message endfunction function! s:GetLinterVariables(filetype, exclude_linter_names) abort let l:variable_list = [] let l:filetype_parts = split(a:filetype, '\.') for l:key in keys(g:) " Extract variable names like: 'ale_python_flake8_executable' let l:match = matchlist(l:key, '\v^ale_([^_]+)_([^_]+)_.+$') " Include matching variables. if !empty(l:match) \&& index(l:filetype_parts, l:match[1]) >= 0 \&& index(a:exclude_linter_names, l:match[2]) == -1 call add(l:variable_list, l:key) endif endfor call sort(l:variable_list) return l:variable_list endfunction function! s:EchoLinterVariables(variable_list) abort for l:key in a:variable_list call s:Echo('let g:' . l:key . ' = ' . string(g:[l:key])) if has_key(b:, l:key) call s:Echo('let b:' . l:key . ' = ' . string(b:[l:key])) endif endfor endfunction function! s:EchoGlobalVariables() abort for l:key in s:global_variable_list call s:Echo('let g:' . l:key . ' = ' . string(get(g:, l:key, v:null))) if has_key(b:, l:key) call s:Echo('let b:' . l:key . ' = ' . string(b:[l:key])) endif endfor endfunction " Echo a command that was run. function! s:EchoCommand(item) abort let l:status_message = a:item.status " Include the exit code in output if we have it. if a:item.status is# 'finished' let l:status_message .= ' - exit code ' . a:item.exit_code endif call s:Echo('(' . l:status_message . ') ' . string(a:item.command)) if g:ale_history_log_output && has_key(a:item, 'output') if empty(a:item.output) call s:Echo('') call s:Echo('<<>>') call s:Echo('') else call s:Echo('') call s:Echo('<<>>') for l:line in a:item.output call s:Echo(l:line) endfor call s:Echo('<<>>') call s:Echo('') endif endif endfunction " Echo the results of an executable check. function! s:EchoExecutable(item) abort call s:Echo(printf( \ '(executable check - %s) %s', \ a:item.status ? 'success' : 'failure', \ a:item.command, \)) endfunction function! s:EchoCommandHistory() abort let l:buffer = bufnr('%') for l:item in ale#history#Get(l:buffer) if l:item.job_id is# 'executable' call s:EchoExecutable(l:item) else call s:EchoCommand(l:item) endif endfor endfunction function! s:EchoLinterAliases(all_linters) abort let l:first = 1 for l:linter in a:all_linters if !empty(l:linter.aliases) if l:first call s:Echo(' Linter Aliases:') endif let l:first = 0 call s:Echo(string(l:linter.name) . ' -> ' . string(l:linter.aliases)) endif endfor endfunction function! s:EchoLSPErrorMessages(all_linter_names) abort let l:lsp_error_messages = get(g:, 'ale_lsp_error_messages', {}) let l:header_echoed = 0 for l:linter_name in a:all_linter_names let l:error_list = get(l:lsp_error_messages, l:linter_name, []) if !empty(l:error_list) if !l:header_echoed call s:Echo(' LSP Error Messages:') call s:Echo('') endif call s:Echo('(Errors for ' . l:linter_name . ')') for l:message in l:error_list for l:line in split(l:message, "\n") call s:Echo(l:line) endfor endfor endif endfor endfunction function! s:GetIgnoredLinters(buffer, enabled_linters) abort let l:filetype = &filetype let l:ignore_config = ale#Var(a:buffer, 'linters_ignore') let l:disable_lsp = ale#Var(a:buffer, 'disable_lsp') if ( \ !empty(l:ignore_config) \ || l:disable_lsp is 1 \ || l:disable_lsp is v:true \ || (l:disable_lsp is# 'auto' && get(g:, 'lspconfig', 0)) \) let l:non_ignored = ale#engine#ignore#Exclude( \ l:filetype, \ a:enabled_linters, \ l:ignore_config, \ l:disable_lsp, \) else let l:non_ignored = copy(a:enabled_linters) endif call map(l:non_ignored, 'v:val.name') return filter( \ copy(a:enabled_linters), \ 'index(l:non_ignored, v:val.name) < 0' \) endfunction function! ale#debugging#Info(...) abort let l:options = (a:0 > 0) ? a:1 : {} let l:show_preview_info = get(l:options, 'preview') let l:buffer = bufnr('') let l:filetype = &filetype let l:enabled_linters = deepcopy(ale#linter#Get(l:filetype)) " But have to build the list of available linters ourselves. let l:all_linters = [] let l:linter_variable_list = [] for l:part in split(l:filetype, '\.') let l:aliased_filetype = ale#linter#ResolveFiletype(l:part) call extend(l:all_linters, ale#linter#GetAll(l:aliased_filetype)) endfor let l:all_names = map(copy(l:all_linters), 'v:val[''name'']') let l:enabled_names = map(copy(l:enabled_linters), 'v:val[''name'']') let l:exclude_names = filter(copy(l:all_names), 'index(l:enabled_names, v:val) == -1') " Load linter variables to display " This must be done after linters are loaded. let l:variable_list = s:GetLinterVariables(l:filetype, l:exclude_names) let l:fixers = ale#fix#registry#SuggestedFixers(l:filetype) let l:fixers = uniq(sort(l:fixers[0] + l:fixers[1])) let l:fixers_string = join(map(copy(l:fixers), '"\n " . v:val'), '') " Get the names of ignored linters. let l:ignored_names = map( \ s:GetIgnoredLinters(l:buffer, l:enabled_linters), \ 'v:val.name' \) call s:Echo(' Current Filetype: ' . l:filetype) call s:Echo('Available Linters: ' . string(l:all_names)) call s:EchoLinterAliases(l:all_linters) call s:Echo(' Enabled Linters: ' . string(l:enabled_names)) call s:Echo(' Ignored Linters: ' . string(l:ignored_names)) call s:Echo(' Suggested Fixers:' . l:fixers_string) " We use this line with only a space to know where to end highlights. call s:Echo(' ') " Only show Linter Variables directive if there are any. if !empty(l:variable_list) call s:Echo(' Linter Variables:') if l:show_preview_info call s:Echo('" Press Space to read :help for a setting') endif call s:EchoLinterVariables(l:variable_list) " We use this line with only a space to know where to end highlights. call s:Echo(' ') endif call s:Echo(' Global Variables:') if l:show_preview_info call s:Echo('" Press Space to read :help for a setting') endif call s:EchoGlobalVariables() call s:Echo(' ') call s:EchoLSPErrorMessages(l:all_names) call s:Echo(' Command History:') call s:Echo('') call s:EchoCommandHistory() endfunction function! ale#debugging#InfoToClipboard() abort if !has('clipboard') call s:Echo('clipboard not available. Try :ALEInfoToFile instead.') return endif let l:output = execute('call ale#debugging#Info()') let @+ = l:output call s:Echo('ALEInfo copied to your clipboard') endfunction function! ale#debugging#InfoToFile(filename) abort let l:expanded_filename = expand(a:filename) let l:output = execute('call ale#debugging#Info()') call writefile(split(l:output, "\n"), l:expanded_filename) call s:Echo('ALEInfo written to ' . l:expanded_filename) endfunction function! ale#debugging#InfoToPreview() abort let l:output = execute('call ale#debugging#Info({''preview'': 1})') call ale#preview#Show(split(l:output, "\n"), { \ 'filetype': 'ale-info', \}) endfunction function! ale#debugging#InfoCommand(...) abort if len(a:000) > 1 " no-custom-checks echom 'Invalid ALEInfo arguments!' return endif " Do not show info for the info window itself. if &filetype is# 'ale-info' return endif " Get 'echo' from '-echo', if there's an argument. let l:mode = get(a:000, '')[1:] if empty(l:mode) let l:mode = ale#Var(bufnr(''), 'info_default_mode') endif if l:mode is# 'echo' call ale#debugging#Info() elseif l:mode is# 'clip' || l:mode is# 'clipboard' call ale#debugging#InfoToClipboard() else call ale#debugging#InfoToPreview() endif endfunction function! ale#debugging#InfoToClipboardDeprecatedCommand() abort " no-custom-checks echom 'ALEInfoToClipboard is deprecated. Use ALEInfo -clipboard instead.' call ale#debugging#InfoToClipboard() endfunction ale-4.0.0/autoload/ale/definition.vim000066400000000000000000000245551476501472200175150ustar00rootroot00000000000000" Author: w0rp " Description: Go to definition support for LSP linters. let s:go_to_definition_map = {} " Enable automatic updates of the tagstack let g:ale_update_tagstack = get(g:, 'ale_update_tagstack', 1) let g:ale_default_navigation = get(g:, 'ale_default_navigation', 'buffer') " Used to get the definition map in tests. function! ale#definition#GetMap() abort return deepcopy(s:go_to_definition_map) endfunction " Used to set the definition map in tests. function! ale#definition#SetMap(map) abort let s:go_to_definition_map = a:map endfunction function! ale#definition#ClearLSPData() abort let s:go_to_definition_map = {} endfunction function! ale#definition#UpdateTagStack() abort let l:should_update_tagstack = exists('*gettagstack') && exists('*settagstack') && g:ale_update_tagstack if l:should_update_tagstack " Grab the old location (to jump back to) and the word under the " cursor (as a label for the tagstack) let l:old_location = [bufnr('%'), line('.'), col('.'), 0] let l:tagname = expand('') let l:winid = win_getid() call settagstack(l:winid, {'items': [{'from': l:old_location, 'tagname': l:tagname}]}, 'a') call settagstack(l:winid, {'curidx': len(gettagstack(l:winid)['items']) + 1}) endif endfunction function! ale#definition#FormatTSServerResponse(response_item, options) abort if get(a:options, 'open_in') is# 'quickfix' return { \ 'filename': a:response_item.file, \ 'lnum': a:response_item.start.line, \ 'col': a:response_item.start.offset, \} else return { \ 'filename': a:response_item.file, \ 'line': a:response_item.start.line, \ 'column': a:response_item.start.offset, \} endif endfunction function! ale#definition#HandleTSServerResponse(conn_id, response) abort if has_key(a:response, 'request_seq') \&& has_key(s:go_to_definition_map, a:response.request_seq) let l:options = remove(s:go_to_definition_map, a:response.request_seq) if get(a:response, 'success', v:false) is v:true && !empty(a:response.body) let l:item_list = [] for l:response_item in a:response.body call add( \ l:item_list, \ ale#definition#FormatTSServerResponse(l:response_item, l:options) \) endfor if empty(l:item_list) call ale#util#Execute('echom ''No definitions found''') elseif len(l:item_list) == 1 let l:filename = l:item_list[0].filename if get(l:options, 'open_in') is# 'quickfix' let l:line = l:item_list[0].lnum let l:column = l:item_list[0].col else let l:line = l:item_list[0].line let l:column = l:item_list[0].column endif call ale#definition#UpdateTagStack() call ale#util#Open(l:filename, l:line, l:column, l:options) 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#definition#UpdateTagStack() call ale#preview#ShowSelection(l:item_list, l:options) endif endif endif endif endfunction function! ale#definition#FormatLSPResponse(response_item, options) abort if has_key(a:response_item, 'targetUri') " LocationLink items use targetUri let l:uri = a:response_item.targetUri let l:line = a:response_item.targetRange.start.line + 1 let l:column = a:response_item.targetRange.start.character + 1 else " LocationLink items use uri let l:uri = a:response_item.uri let l:line = a:response_item.range.start.line + 1 let l:column = a:response_item.range.start.character + 1 endif if get(a:options, 'open_in') is# 'quickfix' return { \ 'filename': ale#util#ToResource(l:uri), \ 'lnum': l:line, \ 'col': l:column, \} else return { \ 'filename': ale#util#ToResource(l:uri), \ 'line': l:line, \ 'column': l:column, \} endif endfunction function! ale#definition#HandleLSPResponse(conn_id, response) abort if has_key(a:response, 'id') \&& has_key(s:go_to_definition_map, a:response.id) let l:options = remove(s:go_to_definition_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', v:null) if type(l:result) is v:t_dict let l:result = [l:result] elseif type(l:result) isnot v:t_list let l:result = [] endif let l:item_list = [] for l:response_item in l:result call add(l:item_list, \ ale#definition#FormatLSPResponse(l:response_item, l:options) \) endfor if empty(l:item_list) call ale#util#Execute('echom ''No definitions found''') elseif len(l:item_list) == 1 call ale#definition#UpdateTagStack() let l:uri = ale#util#ToURI(l:item_list[0].filename) if get(l:options, 'open_in') is# 'quickfix' let l:line = l:item_list[0].lnum let l:column = l:item_list[0].col else let l:line = l:item_list[0].line let l:column = l:item_list[0].column endif let l:uri_handler = ale#uri#GetURIHandler(l:uri) if l:uri_handler is# v:null let l:filename = ale#path#FromFileURI(l:uri) call ale#util#Open(l:filename, l:line, l:column, l:options) else call l:uri_handler.OpenURILink(l:uri, l:line, l:column, l:options, a:conn_id) endif 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#definition#UpdateTagStack() call ale#preview#ShowSelection(l:item_list, l:options) endif endif endif endfunction function! s:OnReady(line, column, options, capability, linter, lsp_details) abort let l:id = a:lsp_details.connection_id if !ale#lsp#HasCapability(l:id, a:capability) return endif let l:buffer = a:lsp_details.buffer let l:Callback = a:linter.lsp is# 'tsserver' \ ? function('ale#definition#HandleTSServerResponse') \ : function('ale#definition#HandleLSPResponse') call ale#lsp#RegisterCallback(l:id, l:Callback) if a:linter.lsp is# 'tsserver' if a:capability is# 'definition' let l:message = ale#lsp#tsserver_message#Definition( \ l:buffer, \ a:line, \ a:column \) elseif a:capability is# 'typeDefinition' let l:message = ale#lsp#tsserver_message#TypeDefinition( \ l:buffer, \ a:line, \ a:column \) elseif a:capability is# 'implementation' let l:message = ale#lsp#tsserver_message#Implementation( \ l:buffer, \ a:line, \ a:column \) endif else " Send a message saying the buffer has changed first, or the " definition position probably won't make sense. call ale#lsp#NotifyForChanges(l:id, l:buffer) " For LSP completions, we need to clamp the column to the length of " the line. python-language-server and perhaps others do not implement " this correctly. if a:capability is# 'definition' let l:message = ale#lsp#message#Definition(l:buffer, a:line, a:column) elseif a:capability is# 'typeDefinition' let l:message = ale#lsp#message#TypeDefinition(l:buffer, a:line, a:column) elseif a:capability is# 'implementation' let l:message = ale#lsp#message#Implementation(l:buffer, a:line, a:column) else " XXX: log here? return endif endif let l:request_id = ale#lsp#Send(l:id, l:message) let s:go_to_definition_map[l:request_id] = { \ 'open_in': get(a:options, 'open_in', 'current-buffer'), \} endfunction function! s:GoToLSPDefinition(linter, options, capability) abort let l:buffer = bufnr('') let [l:line, l:column] = getpos('.')[1:2] let l:column = min([l:column, len(getline(l:line))]) let l:Callback = function( \ 's:OnReady', \ [l:line, l:column, a:options, a:capability] \) call ale#lsp_linter#StartLSP(l:buffer, a:linter, l:Callback) endfunction function! ale#definition#GoTo(options) abort for l:linter in ale#lsp_linter#GetEnabled(bufnr('')) call s:GoToLSPDefinition(l:linter, a:options, 'definition') endfor endfunction function! ale#definition#GoToType(options) abort for l:linter in ale#lsp_linter#GetEnabled(bufnr('')) call s:GoToLSPDefinition(l:linter, a:options, 'typeDefinition') endfor endfunction function! ale#definition#GoToImpl(options) abort for l:linter in ale#lsp_linter#GetEnabled(bufnr('')) call s:GoToLSPDefinition(l:linter, a:options, 'implementation') endfor endfunction function! ale#definition#GoToCommandHandler(command, ...) abort let l:options = {} if len(a:000) > 0 for l:option in a:000 if l:option is? '-tab' let l:options.open_in = 'tab' elseif l:option is? '-split' let l:options.open_in = 'split' elseif l:option is? '-vsplit' let l:options.open_in = 'vsplit' endif endfor endif if !has_key(l:options, 'open_in') let l:default_navigation = ale#Var(bufnr(''), 'default_navigation') if index(['tab', 'split', 'vsplit'], l:default_navigation) >= 0 let l:options.open_in = l:default_navigation endif endif if a:command is# 'type' call ale#definition#GoToType(l:options) elseif a:command is# 'implementation' call ale#definition#GoToImpl(l:options) else call ale#definition#GoTo(l:options) endif endfunction ale-4.0.0/autoload/ale/dhall.vim000066400000000000000000000015721476501472200164430ustar00rootroot00000000000000" Author: Pat Brisbin , toastal " Description: Functions for working with Dhall’s executable call ale#Set('dhall_executable', 'dhall') call ale#Set('dhall_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('dhall_options', '') function! ale#dhall#GetExecutable(buffer) abort let l:executable = ale#Var(a:buffer, 'dhall_executable') " Dhall is written in Haskell and commonly installed with Stack return ale#handlers#haskell_stack#EscapeExecutable(l:executable, 'dhall') endfunction function! ale#dhall#GetExecutableWithOptions(buffer) abort let l:executable = ale#dhall#GetExecutable(a:buffer) return l:executable \ . ale#Pad(ale#Var(a:buffer, 'dhall_options')) endfunction function! ale#dhall#GetCommand(buffer) abort return '%e ' . ale#Pad(ale#Var(a:buffer, 'dhall_options')) endfunction ale-4.0.0/autoload/ale/engine.vim000066400000000000000000000607361476501472200166330ustar00rootroot00000000000000" Author: w0rp " Description: Backend execution and job management " Executes linters in the background, using NeoVim or Vim 8 jobs " Remapping of linter problems. let g:ale_type_map = get(g:, 'ale_type_map', {}) let g:ale_filename_mappings = get(g:, 'ale_filename_mappings', {}) if !has_key(s:, 'executable_cache_map') let s:executable_cache_map = {} endif function! ale#engine#CleanupEveryBuffer() abort for l:key in keys(g:ale_buffer_info) " The key could be a filename or a buffer number, so try and " convert it to a number. We need a number for the other " functions. let l:buffer = str2nr(l:key) if l:buffer > 0 " Stop all jobs and clear the results for everything, and delete " all of the data we stored for the buffer. call ale#engine#Cleanup(l:buffer) endif endfor endfunction function! ale#engine#MarkLinterActive(info, linter) abort let l:found = 0 for l:other_linter in a:info.active_linter_list if l:other_linter.name is# a:linter.name let l:found = 1 break endif endfor if !l:found call add(a:info.active_linter_list, a:linter) endif endfunction function! ale#engine#MarkLinterInactive(info, linter_name) abort call filter(a:info.active_linter_list, 'v:val.name isnot# a:linter_name') endfunction function! ale#engine#ResetExecutableCache() abort let s:executable_cache_map = {} endfunction " Check if files are executable, and if they are, remember that they are " for subsequent calls. We'll keep checking until programs can be executed. function! ale#engine#IsExecutable(buffer, executable) abort if empty(a:executable) " Don't log the executable check if the executable string is empty. return 0 endif " Check for a cached executable() check. let l:result = get(s:executable_cache_map, a:executable, v:null) if l:result isnot v:null return l:result endif " Check if the file is executable, and convert -1 to 1. let l:result = executable(a:executable) isnot 0 " Cache the executable check if we found it, or if the option to cache " failing checks is on. if l:result || get(g:, 'ale_cache_executable_check_failures', 0) let s:executable_cache_map[a:executable] = l:result endif if g:ale_history_enabled call ale#history#Add(a:buffer, l:result, 'executable', a:executable) endif return l:result endfunction function! ale#engine#InitBufferInfo(buffer) abort if !has_key(g:ale_buffer_info, a:buffer) " active_linter_list will hold the list of active linter names " loclist holds the loclist items after all jobs have completed. let g:ale_buffer_info[a:buffer] = { \ 'active_linter_list': [], \ 'active_other_sources_list': [], \ 'loclist': [], \} return 1 endif return 0 endfunction " This function is documented and part of the public API. " " Return 1 if ALE is busy checking a given buffer function! ale#engine#IsCheckingBuffer(buffer) abort let l:info = get(g:ale_buffer_info, a:buffer, {}) return !empty(get(l:info, 'active_linter_list', [])) \ || !empty(get(l:info, 'active_other_sources_list', [])) endfunction function! ale#engine#HandleLoclist(linter_name, buffer, loclist, from_other_source) abort let l:info = get(g:ale_buffer_info, a:buffer, {}) if empty(l:info) return endif if !a:from_other_source " Remove this linter from the list of active linters. " This may have already been done when the job exits. call filter(l:info.active_linter_list, 'v:val.name isnot# a:linter_name') endif " Make some adjustments to the loclists to fix common problems, and also " to set default values for loclist items. let l:linter_loclist = ale#engine#FixLocList( \ a:buffer, \ a:linter_name, \ a:from_other_source, \ a:loclist, \) " Remove previous items for this linter. call filter(l:info.loclist, 'v:val.linter_name isnot# a:linter_name') " We don't need to add items or sort the list when this list is empty. if !empty(l:linter_loclist) " Add the new items. call extend(l:info.loclist, l:linter_loclist) " Sort the loclist again. " We need a sorted list so we can run a binary search against it " for efficient lookup of the messages in the cursor handler. call sort(l:info.loclist, 'ale#util#LocItemCompare') endif if ale#ShouldDoNothing(a:buffer) return endif call ale#engine#SetResults(a:buffer, l:info.loclist) endfunction function! s:HandleExit(job_info, buffer, output, data) abort let l:buffer_info = get(g:ale_buffer_info, a:buffer) if empty(l:buffer_info) return endif let l:linter = a:job_info.linter let l:executable = a:job_info.executable " Remove this job from the list. call ale#engine#MarkLinterInactive(l:buffer_info, l:linter.name) " Stop here if we land in the handle for a job completing if we're in " a sandbox. if ale#util#InSandbox() return endif if has('nvim') && !empty(a:output) && empty(a:output[-1]) call remove(a:output, -1) endif try let l:loclist = ale#util#GetFunction(l:linter.callback)(a:buffer, a:output) " Handle the function being unknown, or being deleted. catch /E700/ let l:loclist = [] endtry if type(l:loclist) isnot# v:t_list " we only expect the list type; don't pass anything else down to " `ale#engine#HandleLoclist` since it won't understand it let l:loclist = [] endif call ale#engine#HandleLoclist(l:linter.name, a:buffer, l:loclist, 0) endfunction function! ale#engine#SetResults(buffer, loclist) abort let l:linting_is_done = !ale#engine#IsCheckingBuffer(a:buffer) if g:ale_use_neovim_diagnostics_api call ale#engine#SendResultsToNeovimDiagnostics(a:buffer, a:loclist) endif " Set signs first. This could potentially fix some line numbers. " The List could be sorted again here by SetSigns. if !g:ale_use_neovim_diagnostics_api && g:ale_set_signs call ale#sign#SetSigns(a:buffer, a:loclist) endif if g:ale_set_quickfix || g:ale_set_loclist call ale#list#SetLists(a:buffer, a:loclist) endif if exists('*ale#statusline#Update') " Don't load/run if not already loaded. call ale#statusline#Update(a:buffer, a:loclist) endif if !g:ale_use_neovim_diagnostics_api && g:ale_set_highlights call ale#highlight#SetHighlights(a:buffer, a:loclist) endif if !g:ale_use_neovim_diagnostics_api \&& (g:ale_virtualtext_cursor is# 'all' || g:ale_virtualtext_cursor == 2) call ale#virtualtext#SetTexts(a:buffer, a:loclist) endif if l:linting_is_done if g:ale_echo_cursor " Try and echo the warning now. " This will only do something meaningful if we're in normal mode. call ale#cursor#EchoCursorWarning() endif if !g:ale_use_neovim_diagnostics_api \&& (g:ale_virtualtext_cursor is# 'current' || g:ale_virtualtext_cursor == 1) " Try and show the warning now. " This will only do something meaningful if we're in normal mode. call ale#virtualtext#ShowCursorWarning() endif " Reset the save event marker, used for opening windows, etc. call setbufvar(a:buffer, 'ale_save_event_fired', 0) " Set a marker showing how many times a buffer has been checked. call setbufvar( \ a:buffer, \ 'ale_linted', \ getbufvar(a:buffer, 'ale_linted', 0) + 1 \) " Automatically remove all managed temporary files and directories " now that all jobs have completed. call ale#command#RemoveManagedFiles(a:buffer) " Call user autocommands. This allows users to hook into ALE's lint cycle. silent doautocmd User ALELintPost endif endfunction function! ale#engine#SendResultsToNeovimDiagnostics(buffer, loclist) abort if !has('nvim-0.6') " We will warn the user on startup as well if they try to set " g:ale_use_neovim_diagnostics_api outside of a Neovim context. return endif " Keep the Lua surface area really small in the VimL part of ALE, " and just require the diagnostics.lua module on demand. let l:SendDiagnostics = luaeval('require("ale.diagnostics").sendAleResultsToDiagnostics') call l:SendDiagnostics(a:buffer, a:loclist) endfunction function! s:RemapItemTypes(type_map, loclist) abort for l:item in a:loclist let l:key = l:item.type \ . (get(l:item, 'sub_type', '') is# 'style' ? 'S' : '') let l:new_key = get(a:type_map, l:key, '') if l:new_key is# 'E' \|| l:new_key is# 'ES' \|| l:new_key is# 'W' \|| l:new_key is# 'WS' \|| l:new_key is# 'I' let l:item.type = l:new_key[0] if l:new_key is# 'ES' || l:new_key is# 'WS' let l:item.sub_type = 'style' elseif has_key(l:item, 'sub_type') call remove(l:item, 'sub_type') endif endif endfor endfunction function! ale#engine#FixLocList(buffer, linter_name, from_other_source, loclist) abort let l:mappings = ale#GetFilenameMappings(a:buffer, a:linter_name) if !empty(l:mappings) " We need to apply reverse filename mapping here. let l:mappings = ale#filename_mapping#Invert(l:mappings) endif let l:bufnr_map = {} let l:new_loclist = [] " Some errors have line numbers beyond the end of the file, " so we need to adjust them so they set the error at the last line " of the file instead. let l:last_line_number = ale#util#GetLineCount(a:buffer) for l:old_item in a:loclist " Copy the loclist item with some default values and corrections. " " line and column numbers will be converted to numbers. " The buffer will default to the buffer being checked. " The vcol setting will default to 0, a byte index. " The error type will default to 'E' for errors. " The error number will default to -1. " " The line number and text are the only required keys. " " The linter_name will be set on the errors so it can be used in " output, filtering, etc.. let l:item = { \ 'bufnr': a:buffer, \ 'text': l:old_item.text, \ 'lnum': str2nr(l:old_item.lnum), \ 'col': str2nr(get(l:old_item, 'col', 0)), \ 'vcol': 0, \ 'type': get(l:old_item, 'type', 'E'), \ 'nr': get(l:old_item, 'nr', -1), \ 'linter_name': a:linter_name, \} if a:from_other_source let l:item.from_other_source = 1 endif if has_key(l:old_item, 'code') let l:item.code = l:old_item.code endif let l:old_name = get(l:old_item, 'filename', '') " Map parsed from output to local filesystem files. if !empty(l:old_name) && !empty(l:mappings) let l:old_name = ale#filename_mapping#Map(l:old_name, l:mappings) endif if !empty(l:old_name) && !ale#path#IsTempName(l:old_name) " Use the filename given. " Temporary files are assumed to be for this buffer, " and the filename is not included then, because it looks bad " in the loclist window. let l:filename = l:old_name let l:item.filename = l:filename if has_key(l:old_item, 'bufnr') " If a buffer number is also given, include that too. " If Vim detects that he buffer number is valid, it will " be used instead of the filename. let l:item.bufnr = l:old_item.bufnr elseif has_key(l:bufnr_map, l:filename) " Get the buffer number from the map, which can be faster. let l:item.bufnr = l:bufnr_map[l:filename] else " Look up the buffer number. let l:item.bufnr = bufnr(l:filename) let l:bufnr_map[l:filename] = l:item.bufnr endif elseif has_key(l:old_item, 'bufnr') let l:item.bufnr = l:old_item.bufnr endif if has_key(l:old_item, 'detail') let l:item.detail = l:old_item.detail endif " Pass on a end_col key if set, used for highlights. if has_key(l:old_item, 'end_col') let l:item.end_col = str2nr(l:old_item.end_col) endif if has_key(l:old_item, 'end_lnum') let l:item.end_lnum = str2nr(l:old_item.end_lnum) " When the error ends after the end of the file, put it at the " end. This is only done for the current buffer. if l:item.bufnr == a:buffer && l:item.end_lnum > l:last_line_number let l:item.end_lnum = l:last_line_number endif endif if has_key(l:old_item, 'sub_type') let l:item.sub_type = l:old_item.sub_type endif if l:item.lnum < 1 " When errors appear before line 1, put them at line 1. let l:item.lnum = 1 elseif l:item.bufnr == a:buffer && l:item.lnum > l:last_line_number " When errors go beyond the end of the file, put them at the end. " This is only done for the current buffer. let l:item.lnum = l:last_line_number elseif get(l:old_item, 'vcol', 0) " Convert virtual column positions to byte positions. " The positions will be off if the buffer has changed recently. let l:line = getbufline(a:buffer, l:item.lnum)[0] let l:item.col = ale#util#Col(l:line, l:item.col) if has_key(l:item, 'end_col') let l:end_line = get(l:item, 'end_lnum', l:line) != l:line \ ? getbufline(a:buffer, l:item.end_lnum)[0] \ : l:line let l:item.end_col = ale#util#Col(l:end_line, l:item.end_col) endif endif call add(l:new_loclist, l:item) endfor let l:type_map = get(ale#Var(a:buffer, 'type_map'), a:linter_name, {}) if !empty(l:type_map) call s:RemapItemTypes(l:type_map, l:new_loclist) endif return l:new_loclist endfunction " Given part of a command, replace any % with %%, so that no characters in " the string will be replaced with filenames, etc. function! ale#engine#EscapeCommandPart(command_part) abort " TODO: Emit deprecation warning here later. return ale#command#EscapeCommandPart(a:command_part) endfunction " Run a job. " " Returns 1 when a job was started successfully. function! s:RunJob(command, options) abort if ale#command#IsDeferred(a:command) let a:command.result_callback = { \ command -> s:RunJob(command, a:options) \} return 1 endif let l:command = a:command if empty(l:command) return 0 endif let l:cwd = a:options.cwd let l:executable = a:options.executable let l:buffer = a:options.buffer let l:linter = a:options.linter let l:output_stream = a:options.output_stream let l:read_buffer = a:options.read_buffer && !a:options.lint_file let l:info = g:ale_buffer_info[l:buffer] let l:Callback = function('s:HandleExit', [{ \ 'linter': l:linter, \ 'executable': l:executable, \}]) let l:result = ale#command#Run(l:buffer, l:command, l:Callback, { \ 'cwd': l:cwd, \ 'output_stream': l:output_stream, \ 'executable': l:executable, \ 'read_buffer': l:read_buffer, \ 'log_output': 1, \ 'filename_mappings': ale#GetFilenameMappings(l:buffer, l:linter.name), \}) " Only proceed if the job is being run. if empty(l:result) return 0 endif call ale#engine#MarkLinterActive(l:info, l:linter) silent doautocmd User ALEJobStarted return 1 endfunction function! s:StopCurrentJobs(buffer, clear_lint_file_jobs, linter_slots) abort let l:info = get(g:ale_buffer_info, a:buffer, {}) call ale#command#StopJobs(a:buffer, 'linter') " Update the active linter list, clearing out anything not running. if a:clear_lint_file_jobs call ale#command#StopJobs(a:buffer, 'file_linter') let l:info.active_linter_list = [] else let l:lint_file_map = {} " Use a previously computed map of `lint_file` values to find " linters that are used for linting files. for [l:lint_file, l:linter] in a:linter_slots if l:lint_file is 1 let l:lint_file_map[l:linter.name] = 1 endif endfor " Keep jobs for linting files when we're only linting buffers. call filter(l:info.active_linter_list, 'get(l:lint_file_map, v:val.name)') endif endfunction function! ale#engine#Stop(buffer) abort call s:StopCurrentJobs(a:buffer, 1, []) endfunction function! s:RemoveProblemsForDisabledLinters(buffer, linters) abort " Figure out which linters are still enabled, and remove " problems for linters which are no longer enabled. " Problems from other sources will be kept. let l:name_map = {} for l:linter in a:linters let l:name_map[l:linter.name] = 1 endfor call filter( \ get(g:ale_buffer_info[a:buffer], 'loclist', []), \ 'get(v:val, ''from_other_source'') || get(l:name_map, get(v:val, ''linter_name''))', \) endfunction function! s:AddProblemsFromOtherBuffers(buffer, linters) abort let l:filename = expand('#' . a:buffer . ':p') let l:loclist = [] let l:name_map = {} " Build a map of the active linters. for l:linter in a:linters let l:name_map[l:linter.name] = 1 endfor " Find the items from other buffers, for the linters that are enabled. for l:info in values(g:ale_buffer_info) for l:item in l:info.loclist if has_key(l:item, 'filename') \&& l:item.filename is# l:filename \&& has_key(l:name_map, l:item.linter_name) " Copy the items and set the buffer numbers to this one. let l:new_item = copy(l:item) let l:new_item.bufnr = a:buffer call add(l:loclist, l:new_item) endif endfor endfor if !empty(l:loclist) call sort(l:loclist, function('ale#util#LocItemCompareWithText')) call uniq(l:loclist, function('ale#util#LocItemCompareWithText')) " Set the loclist variable, used by some parts of ALE. let g:ale_buffer_info[a:buffer].loclist = l:loclist call ale#engine#SetResults(a:buffer, l:loclist) endif endfunction function! s:RunIfExecutable(buffer, linter, lint_file, executable) abort if ale#command#IsDeferred(a:executable) let a:executable.result_callback = { \ executable -> s:RunIfExecutable( \ a:buffer, \ a:linter, \ a:lint_file, \ executable \ ) \} return 1 endif if ale#engine#IsExecutable(a:buffer, a:executable) " Use different job types for file or linter jobs. let l:job_type = a:lint_file ? 'file_linter' : 'linter' call setbufvar(a:buffer, 'ale_job_type', l:job_type) " Get the cwd for the linter and set it before we call GetCommand. " This will ensure that ale#command#Run uses it by default. let l:cwd = ale#linter#GetCwd(a:buffer, a:linter) if l:cwd isnot v:null call ale#command#SetCwd(a:buffer, l:cwd) endif let l:command = ale#linter#GetCommand(a:buffer, a:linter) if l:cwd isnot v:null call ale#command#ResetCwd(a:buffer) endif let l:options = { \ 'cwd': l:cwd, \ 'executable': a:executable, \ 'buffer': a:buffer, \ 'linter': a:linter, \ 'output_stream': get(a:linter, 'output_stream', 'stdout'), \ 'read_buffer': a:linter.read_buffer, \ 'lint_file': a:lint_file, \} return s:RunJob(l:command, l:options) endif return 0 endfunction " Run a linter for a buffer. " " Returns 1 if the linter was successfully run. function! s:RunLinter(buffer, linter, lint_file) abort if !empty(a:linter.lsp) return ale#lsp_linter#CheckWithLSP(a:buffer, a:linter) else let l:executable = ale#linter#GetExecutable(a:buffer, a:linter) return s:RunIfExecutable(a:buffer, a:linter, a:lint_file, l:executable) endif return 0 endfunction function! s:GetLintFileSlots(buffer, linters) abort let l:linter_slots = [] for l:linter in a:linters let l:LintFile = l:linter.lint_file if type(l:LintFile) is v:t_func let l:LintFile = l:LintFile(a:buffer) endif call add(l:linter_slots, [l:LintFile, l:linter]) endfor return l:linter_slots endfunction function! s:GetLintFileValues(slots, Callback) abort let l:deferred_list = [] let l:new_slots = [] for [l:lint_file, l:linter] in a:slots while ale#command#IsDeferred(l:lint_file) && has_key(l:lint_file, 'value') " If we've already computed the return value, use it. let l:lint_file = l:lint_file.value endwhile if ale#command#IsDeferred(l:lint_file) " If we are going to return the result later, wait for it. call add(l:deferred_list, l:lint_file) else " If we have the value now, coerce it to 0 or 1. let l:lint_file = l:lint_file is 1 endif call add(l:new_slots, [l:lint_file, l:linter]) endfor if !empty(l:deferred_list) for l:deferred in l:deferred_list let l:deferred.result_callback = \ {-> s:GetLintFileValues(l:new_slots, a:Callback)} endfor else call a:Callback(l:new_slots) endif endfunction function! s:RunLinters( \ buffer, \ linters, \ slots, \ should_lint_file, \ new_buffer, \) abort call s:StopCurrentJobs(a:buffer, a:should_lint_file, a:slots) call s:RemoveProblemsForDisabledLinters(a:buffer, a:linters) " We can only clear the results if we aren't checking the buffer. let l:can_clear_results = !ale#engine#IsCheckingBuffer(a:buffer) silent doautocmd User ALELintPre for [l:lint_file, l:linter] in a:slots " Only run lint_file linters if we should. if !l:lint_file || a:should_lint_file if s:RunLinter(a:buffer, l:linter, l:lint_file) " If a single linter ran, we shouldn't clear everything. let l:can_clear_results = 0 endif else " If we skipped running a lint_file linter still in the list, " we shouldn't clear everything. let l:can_clear_results = 0 endif endfor " Clear the results if we can. This needs to be done when linters are " disabled, or ALE itself is disabled. if l:can_clear_results call ale#engine#SetResults(a:buffer, []) elseif a:new_buffer call s:AddProblemsFromOtherBuffers( \ a:buffer, \ map(copy(a:slots), 'v:val[1]') \) endif endfunction function! ale#engine#RunLinters(buffer, linters, should_lint_file) abort " Initialise the buffer information if needed. let l:new_buffer = ale#engine#InitBufferInfo(a:buffer) call s:GetLintFileValues( \ s:GetLintFileSlots(a:buffer, a:linters), \ { \ slots -> s:RunLinters( \ a:buffer, \ a:linters, \ slots, \ a:should_lint_file, \ l:new_buffer, \ ) \ } \) endfunction " Clean up a buffer. " " This function will stop all current jobs for the buffer, " clear the state of everything, and remove the Dictionary for managing " the buffer. function! ale#engine#Cleanup(buffer) abort " Don't bother with cleanup code when newer NeoVim versions are exiting. if get(v:, 'exiting', v:null) isnot v:null return endif if exists('*ale#lsp#CloseDocument') call ale#lsp#CloseDocument(a:buffer) endif if !has_key(g:ale_buffer_info, a:buffer) return endif call ale#engine#RunLinters(a:buffer, [], 1) call remove(g:ale_buffer_info, a:buffer) endfunction " Given a buffer number, return the warnings and errors for a given buffer. function! ale#engine#GetLoclist(buffer) abort if !has_key(g:ale_buffer_info, a:buffer) return [] endif return g:ale_buffer_info[a:buffer].loclist endfunction ale-4.0.0/autoload/ale/engine/000077500000000000000000000000001476501472200161025ustar00rootroot00000000000000ale-4.0.0/autoload/ale/engine/ignore.vim000066400000000000000000000061161476501472200201060ustar00rootroot00000000000000" Author: w0rp " Description: Code for ignoring linters. Only loaded and if configured. " A map for remapping lspconfig server names to linter names or aliases in " ALE. We should change the names where they will conflict with names in ALE. " " Notes on names from nvim-lspconfig not included here. " " * 'rubocop' is run in a language server mode " * 'eslint' is run via 'vscode-eslint-language-server' let s:lspconfig_map = { \ 'als': 'adals', \ 'ansiblels': 'ansible-language-server', \ 'bicep': 'bicep_language_server', \ 'cmake': 'cmake_language_server', \ 'denols': 'deno', \ 'erlangls': 'erlang_ls', \ 'html': 'vscodehtml', \ 'ocamlls': 'ocaml-language-server', \ 'ols': 'odin-lsp', \ 'puppet': 'puppet_languageserver', \} " Given a filetype and a configuration for ignoring linters, return a List of " Strings for linter names to ignore. function! ale#engine#ignore#GetList(filetype, config) abort if type(a:config) is v:t_list return a:config endif if type(a:config) is v:t_dict let l:names_to_remove = [] for l:part in split(a:filetype , '\.') call extend(l:names_to_remove, get(a:config, l:part, [])) endfor return l:names_to_remove endif return [] endfunction " This function can be mocked in tests. function! ale#engine#ignore#GetLSPConfigNames() abort return luaeval('require ''ale.util''.configured_lspconfig_servers()') endfunction function! s:GetMappedLSPConfigNames() abort " Check the lspconfig flag before calling luaeval. if !get(g:, 'lspconfig', 0) return [] endif let l:lspconfig_servers = ale#engine#ignore#GetLSPConfigNames() return map( \ !empty(l:lspconfig_servers) ? l:lspconfig_servers : [], \ {_, val -> get(s:lspconfig_map, val, val) } \) endfunction " Given a List of linter descriptions, exclude the linters to be ignored. function! ale#engine#ignore#Exclude(filetype, all_linters, config, disable_lsp) abort let l:names_to_remove = ale#engine#ignore#GetList(a:filetype, a:config) " If configured to automatically ignore otherwise configured LSP linter " names, add them to the names to remove. This could ignore linters " with matching names that are not marked as LSP linters. if a:disable_lsp is# 'auto' call extend(l:names_to_remove, s:GetMappedLSPConfigNames()) endif let l:ignore_all_lsps = a:disable_lsp is 1 || a:disable_lsp is v:true let l:filtered_linters = [] for l:linter in a:all_linters let l:should_include = index(l:names_to_remove, l:linter.name) == -1 let l:i = 0 while l:should_include && l:i < len(l:linter.aliases) let l:name = l:linter.aliases[l:i] let l:should_include = index(l:names_to_remove, l:name) == -1 let l:i += 1 endwhile if l:should_include && l:ignore_all_lsps let l:should_include = empty(get(l:linter, 'lsp')) endif if l:should_include call add(l:filtered_linters, l:linter) endif endfor return l:filtered_linters endfunction ale-4.0.0/autoload/ale/events.vim000066400000000000000000000231711476501472200166620ustar00rootroot00000000000000" Author: w0rp " Description: ALE functions for autocmd events. " Get the number of milliseconds since some vague, but consistent, point in " the past. " " This function can be used for timing execution, etc. " " The time will be returned as a Number. function! ale#events#ClockMilliseconds() abort return float2nr(reltimefloat(reltime()) * 1000) endfunction function! ale#events#QuitEvent(buffer) abort " Remember when ALE is quitting for BufWrite, etc. call setbufvar(a:buffer, 'ale_quitting', ale#events#ClockMilliseconds()) endfunction function! ale#events#QuitRecently(buffer) abort let l:time = getbufvar(a:buffer, 'ale_quitting', 0) return l:time && ale#events#ClockMilliseconds() - l:time < 1000 endfunction function! ale#events#SaveEvent(buffer) abort let l:should_lint = ale#Var(a:buffer, 'enabled') && g:ale_lint_on_save if l:should_lint call setbufvar(a:buffer, 'ale_save_event_fired', 1) endif if ale#Var(a:buffer, 'fix_on_save') && !ale#events#QuitRecently(a:buffer) let l:will_fix = ale#fix#Fix(a:buffer, 'save_file') let l:should_lint = l:should_lint && !l:will_fix endif if l:should_lint && !ale#events#QuitRecently(a:buffer) call ale#Queue(0, 'lint_file', a:buffer) endif endfunction function! ale#events#LintOnEnter(buffer) abort " Unmark a file as being changed outside of Vim after we try to check it. call setbufvar(a:buffer, 'ale_file_changed', 0) if ale#Var(a:buffer, 'enabled') && g:ale_lint_on_enter call ale#Queue(0, 'lint_file', a:buffer) endif endfunction function! ale#events#ReadOrEnterEvent(buffer) abort " Apply pattern options if the variable is set. if get(g:, 'ale_pattern_options_enabled', 1) \&& !empty(get(g:, 'ale_pattern_options')) call ale#pattern_options#SetOptions(a:buffer) endif " When entering a buffer, we are no longer quitting it. call setbufvar(a:buffer, 'ale_quitting', 0) let l:filetype = getbufvar(a:buffer, '&filetype') call setbufvar(a:buffer, 'ale_original_filetype', l:filetype) " If the file changed outside of Vim, check it on BufEnter,BufRead if getbufvar(a:buffer, 'ale_file_changed') call ale#events#LintOnEnter(a:buffer) endif endfunction function! ale#events#FileTypeEvent(buffer, new_filetype) abort " The old filetype will be set to an empty string by the BuFEnter event, " and not linting when the old filetype hasn't been set yet prevents " buffers being checked when you enter them when linting on enter is off. let l:old_filetype = getbufvar(a:buffer, 'ale_original_filetype', v:null) if l:old_filetype isnot v:null \&& !empty(a:new_filetype) \&& a:new_filetype isnot# l:old_filetype " Remember what the new filetype is. call setbufvar(a:buffer, 'ale_original_filetype', a:new_filetype) if g:ale_lint_on_filetype_changed call ale#Queue(300, 'lint_file', a:buffer) endif endif endfunction function! ale#events#FileChangedEvent(buffer) abort call setbufvar(a:buffer, 'ale_file_changed', 1) if bufnr('') == a:buffer call ale#events#LintOnEnter(a:buffer) endif endfunction " A timer for emulating InsertLeave. " " We only need a single timer, and we'll lint the last buffer we entered " insert mode on. if !exists('s:insert_leave_timer') let s:insert_leave_timer = -1 endif " True if the ModeChanged event exists. " In this case, ModeChanged will be used instead of InsertLeave emulation. let s:mode_changed_exists = exists('##ModeChanged') function! ale#events#EmulateInsertLeave(buffer) abort if mode() is# 'n' call timer_stop(s:insert_leave_timer) call ale#Queue(0, '', a:buffer) endif endfunction function! ale#events#InsertEnterEvent(buffer) abort if g:ale_close_preview_on_insert && exists('*ale#preview#CloseIfTypeMatches') call ale#preview#CloseIfTypeMatches('ale-preview') endif " Start a repeating timer if the use might not trigger InsertLeave, so we " can emulate its behavior. " If the ModeChanged autocmd exists, it will be used instead of this " timer; as ModeChanged will be sent regardless of how the insert mode is " exited, including , and . if ale#Var(a:buffer, 'lint_on_insert_leave') \&& maparg("\", 'i') isnot# '' \&& !s:mode_changed_exists call timer_stop(s:insert_leave_timer) let s:insert_leave_timer = timer_start( \ 100, \ {-> ale#events#EmulateInsertLeave(a:buffer) }, \ {'repeat': -1} \) endif endfunction function! ale#events#InsertLeaveEvent(buffer) abort " Kill the InsertLeave emulation if the event fired. " If the ModeChanged event is available, it will be used instead of " a timer. if !s:mode_changed_exists call timer_stop(s:insert_leave_timer) endif if ale#Var(a:buffer, 'lint_on_insert_leave') call ale#Queue(0, '', a:buffer) endif " Look for a warning to echo as soon as we leave Insert mode. " The script's position variable used when moving the cursor will " not be changed here. " " We don't echo this message in emulated insert leave mode, as the user " may want less work to happen on pressing versus if exists('*ale#engine#Cleanup') call ale#cursor#EchoCursorWarning() if g:ale_virtualtext_cursor is# 'current' || g:ale_virtualtext_cursor is# 1 || g:ale_virtualtext_cursor is# '1' " Show a virtualtext message if enabled. call ale#virtualtext#ShowCursorWarning() endif endif endfunction function! ale#events#Init() abort " This value used to be a Boolean as a Number, and is now a String. let l:text_changed = '' . g:ale_lint_on_text_changed augroup ALEEvents autocmd! " These events always need to be set up. autocmd BufEnter,BufRead * call ale#events#ReadOrEnterEvent(str2nr(expand(''))) autocmd BufWritePost * call ale#events#SaveEvent(str2nr(expand(''))) if g:ale_enabled if l:text_changed is? 'always' || l:text_changed is# '1' autocmd TextChanged,TextChangedI * call ale#Queue(ale#Var(str2nr(expand('')), 'lint_delay')) elseif l:text_changed is? 'normal' autocmd TextChanged * call ale#Queue(ale#Var(str2nr(expand('')), 'lint_delay')) elseif l:text_changed is? 'insert' autocmd TextChangedI * call ale#Queue(ale#Var(str2nr(expand('')), 'lint_delay')) endif if g:ale_lint_on_enter autocmd BufWinEnter * call ale#events#LintOnEnter(str2nr(expand(''))) " Track when the file is changed outside of Vim. autocmd FileChangedShellPost * call ale#events#FileChangedEvent(str2nr(expand(''))) endif if g:ale_lint_on_filetype_changed " Only start linting if the FileType actually changes after " opening a buffer. The FileType will fire when buffers are opened. autocmd FileType * call ale#events#FileTypeEvent( \ str2nr(expand('')), \ expand('') \) endif " Add an InsertEnter event if we need to close the preview window " on entering insert mode, or if we want to run ALE on leaving " insert mode and is not the same as . " " We will emulate leaving insert mode for users that might not " trigger InsertLeave. " " If the ModeChanged event is available, this timer will not " be used. if g:ale_close_preview_on_insert \|| (g:ale_lint_on_insert_leave && maparg("\", 'i') isnot# '' && !s:mode_changed_exists) autocmd InsertEnter * call ale#events#InsertEnterEvent(str2nr(expand(''))) endif let l:add_insert_leave_event = g:ale_lint_on_insert_leave if g:ale_echo_cursor || g:ale_cursor_detail " We need to make the message display on InsertLeave let l:add_insert_leave_event = 1 autocmd CursorMoved,CursorHold * if exists('*ale#engine#Cleanup') | call ale#cursor#EchoCursorWarningWithDelay() | endif endif if g:ale_virtualtext_cursor is# 'current' || g:ale_virtualtext_cursor is# 1 || g:ale_virtualtext_cursor is# '1' " We need to make the message display on InsertLeave let l:add_insert_leave_event = 1 autocmd CursorMoved,CursorHold * if exists('*ale#engine#Cleanup') | call ale#virtualtext#ShowCursorWarningWithDelay() | endif endif if l:add_insert_leave_event if s:mode_changed_exists " If the ModeChanged event is available, handle any " transition from the Insert mode to any other mode. autocmd ModeChanged i*:* call ale#events#InsertLeaveEvent(str2nr(expand(''))) else " If ModeChanged is not available, handle InsertLeave events. autocmd InsertLeave * call ale#events#InsertLeaveEvent(str2nr(expand(''))) endif endif if g:ale_hover_cursor autocmd CursorHold * if exists('*ale#lsp#Send') | call ale#hover#ShowTruncatedMessageAtCursor() | endif endif endif augroup END augroup AleURISchemes autocmd! autocmd BufNewFile,BufReadPre jdt://** call ale#uri#jdt#ReadJDTLink(expand('')) augroup END endfunction ale-4.0.0/autoload/ale/filename_mapping.vim000066400000000000000000000015041476501472200206450ustar00rootroot00000000000000" Author: w0rp " Description: Logic for handling mappings between files " Invert filesystem mappings so they can be mapped in reverse. function! ale#filename_mapping#Invert(filename_mappings) abort return map(copy(a:filename_mappings), '[v:val[1], v:val[0]]') endfunction " Given a filename and some filename_mappings, map a filename. function! ale#filename_mapping#Map(filename, filename_mappings) abort let l:simplified_filename = ale#path#Simplify(a:filename) for [l:mapping_from, l:mapping_to] in a:filename_mappings let l:mapping_from = ale#path#Simplify(l:mapping_from) if l:simplified_filename[:len(l:mapping_from) - 1] is# l:mapping_from return l:mapping_to . l:simplified_filename[len(l:mapping_from):] endif endfor return a:filename endfunction ale-4.0.0/autoload/ale/filerename.vim000066400000000000000000000066411476501472200174700ustar00rootroot00000000000000" Author: Dalius Dobravolskas " Description: Rename file support for tsserver let s:filerename_map = {} " Used to get the rename map in tests. function! ale#filerename#GetMap() abort return deepcopy(s:filerename_map) endfunction " Used to set the rename map in tests. function! ale#filerename#SetMap(map) abort let s:filerename_map = a:map endfunction function! ale#filerename#ClearLSPData() abort let s:filerename_map = {} endfunction function! s:message(message) abort call ale#util#Execute('echom ' . string(a:message)) endfunction function! ale#filerename#HandleTSServerResponse(conn_id, response) abort if get(a:response, 'command', '') isnot# 'getEditsForFileRename' return endif if !has_key(s:filerename_map, a:response.request_seq) return endif let l:options = remove(s:filerename_map, a:response.request_seq) let l:old_name = l:options.old_name let l:new_name = l:options.new_name if get(a:response, 'success', v:false) is v:false let l:message = get(a:response, 'message', 'unknown') call s:message('Error renaming file "' . l:old_name . '" to "' . l:new_name \ . '". Reason: ' . l:message) return endif let l:changes = a:response.body if empty(l:changes) call s:message('No changes while renaming "' . l:old_name . '" to "' . l:new_name . '"') else call ale#code_action#HandleCodeAction( \ { \ 'description': 'filerename', \ 'changes': l:changes, \ }, \ { \ 'should_save': 1, \ }, \) endif silent! noautocmd execute 'saveas ' . l:new_name call delete(l:old_name) endfunction function! s:OnReady(options, linter, lsp_details) abort let l:id = a:lsp_details.connection_id if !ale#lsp#HasCapability(l:id, 'filerename') return endif let l:buffer = a:lsp_details.buffer let l:Callback = function('ale#filerename#HandleTSServerResponse') call ale#lsp#RegisterCallback(l:id, l:Callback) let l:message = ale#lsp#tsserver_message#GetEditsForFileRename( \ a:options.old_name, \ a:options.new_name, \) let l:request_id = ale#lsp#Send(l:id, l:message) let s:filerename_map[l:request_id] = a:options endfunction function! s:ExecuteFileRename(linter, options) abort let l:buffer = bufnr('') let l:Callback = function('s:OnReady', [a:options]) call ale#lsp_linter#StartLSP(l:buffer, a:linter, l:Callback) endfunction function! ale#filerename#Execute() abort let l:buffer = bufnr('') let l:lsp_linters = [] for l:linter in ale#lsp_linter#GetEnabled(l:buffer) if l:linter.lsp is# 'tsserver' call add(l:lsp_linters, l:linter) endif endfor if empty(l:lsp_linters) call s:message('No active tsserver LSPs') return endif let l:old_name = expand('#' . l:buffer . ':p') let l:new_name = ale#util#Input('New file name: ', l:old_name, 'file') if l:old_name is# l:new_name call s:message('New file name matches old file name') return endif if empty(l:new_name) call s:message('New name cannot be empty!') return endif for l:lsp_linter in l:lsp_linters call s:ExecuteFileRename(l:lsp_linter, { \ 'old_name': l:old_name, \ 'new_name': l:new_name, \}) endfor endfunction ale-4.0.0/autoload/ale/filetypes.vim000066400000000000000000000030301476501472200173520ustar00rootroot00000000000000" Author: w0rp " Description: This file handles guessing file extensions for filetypes, etc. function! ale#filetypes#LoadExtensionMap() abort " Output includes: " '*.erl setf erlang' let l:output = execute('exec "autocmd"') let l:map = {} for l:line in split(l:output, "\n") " Parse filetypes, like so: " " *.erl setf erlang " *.md set filetype=markdown " *.snippet setlocal filetype=snippets let l:match = matchlist(l:line, '\v^ *\*(\.[^ ]+).*set(f *| *filetype=|local *filetype=)([^ ]+)') if !empty(l:match) let l:map[substitute(l:match[3], '^=', '', '')] = l:match[1] endif endfor return l:map endfunction let s:cached_map = {} function! s:GetCachedExtensionMap() abort if empty(s:cached_map) let s:cached_map = ale#filetypes#LoadExtensionMap() endif return s:cached_map endfunction function! ale#filetypes#GuessExtension(filetype) abort let l:map = s:GetCachedExtensionMap() let l:ext = get(l:map, a:filetype, '') " If we have an exact match, like something for javascript.jsx, use that. if !empty(l:ext) return l:ext endif " If we don't have an exact match, use the first filetype in the compound " filetype. for l:part in split(a:filetype, '\.') let l:ext = get(l:map, l:part, '') if !empty(l:ext) return l:ext endif endfor " Return an empty string if we don't find anything. return '' endfunction ale-4.0.0/autoload/ale/fix.vim000066400000000000000000000277321476501472200161530ustar00rootroot00000000000000" Author: w0rp " Description: Functions for fixing code with programs, or other means. let g:ale_fix_on_save_ignore = get(g:, 'ale_fix_on_save_ignore', {}) let g:ale_filename_mappings = get(g:, 'ale_filename_mappings', {}) " Apply fixes queued up for buffers which may be hidden. " Vim doesn't let you modify hidden buffers. function! ale#fix#ApplyQueuedFixes(buffer) abort let l:data = get(g:ale_fix_buffer_data, a:buffer, {'done': 0}) if !l:data.done || (!ale#util#HasBuflineApi() && a:buffer isnot bufnr('')) return endif call remove(g:ale_fix_buffer_data, a:buffer) try if l:data.changes_made let l:new_lines = ale#util#SetBufferContents(a:buffer, l:data.output) if l:data.should_save if a:buffer is bufnr('') if empty(&buftype) noautocmd :w! else set nomodified endif else call writefile(l:new_lines, expand('#' . a:buffer . ':p')) " no-custom-checks call setbufvar(a:buffer, '&modified', 0) endif endif endif catch /E21\|E5555/ " If we cannot modify the buffer now, try again later. let g:ale_fix_buffer_data[a:buffer] = l:data return endtry if l:data.should_save let l:should_lint = ale#Var(a:buffer, 'fix_on_save') \ && ale#Var(a:buffer, 'lint_on_save') else let l:should_lint = l:data.changes_made endif silent doautocmd User ALEFixPost " If ALE linting is enabled, check for problems with the file again after " fixing problems. if g:ale_enabled \&& l:should_lint \&& !ale#events#QuitRecently(a:buffer) call ale#Queue(0, l:data.should_save ? 'lint_file' : '') endif endfunction function! ale#fix#ApplyFixes(buffer, output) abort let l:data = g:ale_fix_buffer_data[a:buffer] let l:data.output = a:output let l:data.changes_made = l:data.lines_before !=# l:data.output " no-custom-checks let l:data.done = 1 call ale#command#RemoveManagedFiles(a:buffer) if !bufexists(a:buffer) " Remove the buffer data when it doesn't exist. call remove(g:ale_fix_buffer_data, a:buffer) endif if l:data.changes_made && bufexists(a:buffer) let l:lines = getbufline(a:buffer, 1, '$') if l:data.lines_before != l:lines call remove(g:ale_fix_buffer_data, a:buffer) if !l:data.ignore_file_changed_errors " no-custom-checks echoerr 'The file was changed before fixing finished' endif return endif endif " We can only change the lines of a buffer which is currently open, " so try and apply the fixes to the current buffer. call ale#fix#ApplyQueuedFixes(a:buffer) endfunction function! s:HandleExit(job_info, buffer, job_output, data) abort let l:buffer_info = get(g:ale_fix_buffer_data, a:buffer, {}) if empty(l:buffer_info) return endif if a:job_info.read_temporary_file let l:output = !empty(a:data.temporary_file) \ ? readfile(a:data.temporary_file) \ : [] else let l:output = a:job_output endif let l:ProcessWith = get(a:job_info, 'process_with', v:null) " Post-process the output with a function if we have one. if l:ProcessWith isnot v:null let l:output = call(l:ProcessWith, [a:buffer, l:output]) endif " Use the output of the job for changing the file if it isn't empty, " otherwise skip this job and use the input from before. " " We'll use the input from before for chained commands. if !empty(split(join(l:output))) let l:input = l:output else let l:input = a:job_info.input endif call s:RunFixer({ \ 'buffer': a:buffer, \ 'input': l:input, \ 'callback_list': a:job_info.callback_list, \ 'callback_index': a:job_info.callback_index + 1, \}) endfunction function! s:RunJob(result, options) abort if ale#command#IsDeferred(a:result) let a:result.result_callback = {x -> s:RunJob(x, a:options)} return endif let l:buffer = a:options.buffer let l:input = a:options.input let l:fixer_name = a:options.fixer_name if a:result is 0 || type(a:result) is v:t_list if type(a:result) is v:t_list let l:input = a:result endif call s:RunFixer({ \ 'buffer': l:buffer, \ 'input': l:input, \ 'callback_index': a:options.callback_index + 1, \ 'callback_list': a:options.callback_list, \}) return endif let l:command = get(a:result, 'command', '') if empty(l:command) " If the command is empty, skip to the next item. call s:RunFixer({ \ 'buffer': l:buffer, \ 'input': l:input, \ 'callback_index': a:options.callback_index, \ 'callback_list': a:options.callback_list, \}) return endif let l:read_temporary_file = get(a:result, 'read_temporary_file', 0) let l:read_buffer = get(a:result, 'read_buffer', 1) let l:output_stream = get(a:result, 'output_stream', 'stdout') let l:cwd = get(a:result, 'cwd', v:null) if l:read_temporary_file let l:output_stream = 'none' endif let l:Callback = function('s:HandleExit', [{ \ 'input': l:input, \ 'callback_index': a:options.callback_index, \ 'callback_list': a:options.callback_list, \ 'process_with': get(a:result, 'process_with', v:null), \ 'read_temporary_file': l:read_temporary_file, \}]) let l:run_result = ale#command#Run(l:buffer, l:command, l:Callback, { \ 'output_stream': l:output_stream, \ 'executable': '', \ 'read_buffer': l:read_buffer, \ 'input': l:input, \ 'log_output': 0, \ 'cwd': l:cwd, \ 'filename_mappings': ale#GetFilenameMappings(l:buffer, l:fixer_name), \}) if empty(l:run_result) call s:RunFixer({ \ 'buffer': l:buffer, \ 'input': l:input, \ 'callback_index': a:options.callback_index + 1, \ 'callback_list': a:options.callback_list, \}) endif endfunction function! s:RunFixer(options) abort let l:buffer = a:options.buffer let l:input = a:options.input let l:index = a:options.callback_index if len(a:options.callback_list) <= l:index call ale#fix#ApplyFixes(l:buffer, l:input) return endif let [l:fixer_name, l:Function] = a:options.callback_list[l:index] " Record new jobs started as fixer jobs. call setbufvar(l:buffer, 'ale_job_type', 'fixer') " Regular fixer commands accept (buffer, [input]) let l:result = ale#util#FunctionArgCount(l:Function) == 1 \ ? call(l:Function, [l:buffer]) \ : call(l:Function, [l:buffer, copy(l:input)]) call s:RunJob(l:result, { \ 'buffer': l:buffer, \ 'input': l:input, \ 'callback_list': a:options.callback_list, \ 'callback_index': l:index, \ 'fixer_name': l:fixer_name, \}) endfunction function! s:AddSubCallbacks(full_list, callbacks) abort if type(a:callbacks) is v:t_string call add(a:full_list, a:callbacks) elseif type(a:callbacks) is v:t_list call extend(a:full_list, a:callbacks) else return 0 endif return 1 endfunction function! s:IgnoreFixers(callback_list, filetype, config) abort if type(a:config) is v:t_list let l:ignore_list = a:config else let l:ignore_list = [] for l:part in split(a:filetype , '\.') call extend(l:ignore_list, get(a:config, l:part, [])) endfor endif call filter(a:callback_list, 'index(l:ignore_list, v:val) < 0') endfunction function! s:GetCallbacks(buffer, fixing_flag, fixers) abort if len(a:fixers) let l:callback_list = a:fixers elseif type(get(b:, 'ale_fixers')) is v:t_list " Lists can be used for buffer-local variables only let l:callback_list = b:ale_fixers else " buffer and global options can use dictionaries mapping filetypes to " callbacks to run. let l:fixers = ale#Var(a:buffer, 'fixers') let l:callback_list = [] let l:matched = 0 for l:sub_type in split(&filetype, '\.') if s:AddSubCallbacks(l:callback_list, get(l:fixers, l:sub_type)) let l:matched = 1 endif endfor " If we couldn't find fixers for a filetype, default to '*' fixers. if !l:matched call s:AddSubCallbacks(l:callback_list, get(l:fixers, '*')) endif endif if a:fixing_flag is# 'save_file' let l:config = ale#Var(a:buffer, 'fix_on_save_ignore') if !empty(l:config) call s:IgnoreFixers(l:callback_list, &filetype, l:config) endif endif let l:corrected_list = [] " Variables with capital characters are needed, or Vim will complain about " funcref variables. for l:Item in l:callback_list " Try to capture the names of registered fixer names, so we can use " them for filename mapping or other purposes later. let l:fixer_name = v:null if type(l:Item) is v:t_string let l:Func = ale#fix#registry#GetFunc(l:Item) if !empty(l:Func) let l:fixer_name = l:Item let l:Item = l:Func endif endif try call add(l:corrected_list, [ \ l:fixer_name, \ ale#util#GetFunction(l:Item) \]) catch /E475/ " Rethrow exceptions for failing to get a function so we can print " a friendly message about it. throw 'BADNAME ' . v:exception endtry endfor return l:corrected_list endfunction function! ale#fix#InitBufferData(buffer, fixing_flag) abort " The 'done' flag tells the function for applying changes when fixing " is complete. let g:ale_fix_buffer_data[a:buffer] = { \ 'lines_before': getbufline(a:buffer, 1, '$'), \ 'done': 0, \ 'should_save': a:fixing_flag is# 'save_file', \ 'ignore_file_changed_errors': a:fixing_flag is# '!', \ 'temporary_directory_list': [], \} endfunction " Accepts an optional argument for what to do when fixing. " " Returns 0 if no fixes can be applied, and 1 if fixing can be done. function! ale#fix#Fix(buffer, fixing_flag, ...) abort if a:fixing_flag isnot# '' \&& a:fixing_flag isnot# '!' \&& a:fixing_flag isnot# 'save_file' throw "fixing_flag must be '', '!', or 'save_file'" endif try let l:callback_list = s:GetCallbacks(a:buffer, a:fixing_flag, a:000) catch /E700\|BADNAME/ if a:fixing_flag isnot# '!' let l:function_name = join(split(split(v:exception, ':')[3])) let l:echo_message = printf( \ 'There is no fixer named `%s`. Check :ALEFixSuggest', \ l:function_name, \) " no-custom-checks echom l:echo_message endif return 0 endtry if empty(l:callback_list) if a:fixing_flag is# '' " no-custom-checks echom 'No fixers have been defined. Try :ALEFixSuggest' endif return 0 endif call ale#command#StopJobs(a:buffer, 'fixer') " Clean up any files we might have left behind from a previous run. call ale#command#RemoveManagedFiles(a:buffer) call ale#fix#InitBufferData(a:buffer, a:fixing_flag) silent doautocmd User ALEFixPre call s:RunFixer({ \ 'buffer': a:buffer, \ 'input': g:ale_fix_buffer_data[a:buffer].lines_before, \ 'callback_index': 0, \ 'callback_list': l:callback_list, \}) return 1 endfunction " Set up an autocmd command to try and apply buffer fixes when available. augroup ALEBufferFixGroup autocmd! autocmd BufEnter * call ale#fix#ApplyQueuedFixes(str2nr(expand(''))) augroup END ale-4.0.0/autoload/ale/fix/000077500000000000000000000000001476501472200154235ustar00rootroot00000000000000ale-4.0.0/autoload/ale/fix/registry.vim000066400000000000000000000757701476501472200200300ustar00rootroot00000000000000" Author: w0rp " Description: A registry of functions for fixing things. let s:default_registry = { \ 'add_blank_lines_for_python_control_statements': { \ 'function': 'ale#fixers#generic_python#AddLinesBeforeControlStatements', \ 'suggested_filetypes': ['python'], \ 'description': 'Add blank lines before control statements.', \ }, \ 'alejandra': { \ 'function': 'ale#fixers#alejandra#Fix', \ 'suggested_filetypes': ['nix'], \ 'description': 'The Uncompromising Nix Code Formatter', \ }, \ 'align_help_tags': { \ 'function': 'ale#fixers#help#AlignTags', \ 'suggested_filetypes': ['help'], \ 'description': 'Align help tags to the right margin', \ }, \ 'apkbuild-fixer': { \ 'function': 'ale#fixers#apkbuild_fixer#Fix', \ 'suggested_filetypes': ['apkbuild'], \ 'description': 'Fix policy violations found by apkbuild-lint in APKBUILDs', \ }, \ 'autoimport': { \ 'function': 'ale#fixers#autoimport#Fix', \ 'suggested_filetypes': ['python'], \ 'description': 'Fix import issues with autoimport.', \ }, \ 'autoflake': { \ 'function': 'ale#fixers#autoflake#Fix', \ 'suggested_filetypes': ['python'], \ 'description': 'Fix flake issues with autoflake.', \ }, \ 'autopep8': { \ 'function': 'ale#fixers#autopep8#Fix', \ 'suggested_filetypes': ['python'], \ 'description': 'Fix PEP8 issues with autopep8.', \ }, \ 'bibclean': { \ 'function': 'ale#fixers#bibclean#Fix', \ 'suggested_filetypes': ['bib'], \ 'description': 'Format bib files using bibclean.', \ }, \ 'biome': { \ 'function': 'ale#fixers#biome#Fix', \ 'suggested_filetypes': ['javascript', 'typescript', 'json', 'jsonc', 'css', 'graphql'], \ 'description': 'Fix JavaScript and TypeScript using biome.', \ }, \ 'black': { \ 'function': 'ale#fixers#black#Fix', \ 'suggested_filetypes': ['python'], \ 'description': 'Fix PEP8 issues with black.', \ }, \ 'buf-format': { \ 'function': 'ale#fixers#buf_format#Fix', \ 'suggested_filetypes': ['proto'], \ 'description': 'Fix .proto files with buf format.', \ }, \ 'buildifier': { \ 'function': 'ale#fixers#buildifier#Fix', \ 'suggested_filetypes': ['bzl'], \ 'description': 'Format BUILD and .bzl files with buildifier.', \ }, \ 'css-beautify': { \ 'function': 'ale#fixers#css_beautify#Fix', \ 'suggested_filetypes': ['css'], \ 'description': 'Format CSS using css-beautify from js-beautify.', \ }, \ 'deno': { \ 'function': 'ale#fixers#deno#Fix', \ 'suggested_filetypes': ['typescript'], \ 'description': 'Fix TypeScript using deno fmt.', \ }, \ 'dfmt': { \ 'function': 'ale#fixers#dfmt#Fix', \ 'suggested_filetypes': ['d'], \ 'description': 'Fix D files with dfmt.', \ }, \ 'dhall': { \ 'function': 'ale#fixers#dhall#Fix', \ 'suggested_filetypes': ['dhall'], \ 'description': 'Fix Dhall files with dhall-format.', \ }, \ 'dhall-format': { \ 'function': 'ale#fixers#dhall_format#Fix', \ 'suggested_filetypes': ['dhall'], \ 'description': 'Standard code formatter for the Dhall language', \ 'aliases': ['dhall'], \ }, \ 'dhall-freeze': { \ 'function': 'ale#fixers#dhall_freeze#Freeze', \ 'suggested_filetypes': ['dhall'], \ 'description': 'Add integrity checks to remote import statements of an expression for the Dhall language', \ }, \ 'dhall-lint': { \ 'function': 'ale#fixers#dhall_lint#Fix', \ 'suggested_filetypes': ['dhall'], \ 'description': 'Standard code formatter for the Dhall language and removing dead code', \ }, \ 'dune': { \ 'function': 'ale#fixers#dune#Fix', \ 'suggested_filetypes': ['dune'], \ 'description': 'Fix dune files with dune format', \ }, \ 'erlang_mode': { \ 'function': 'ale#fixers#erlang_mode#Fix', \ 'suggested_filetypes': ['erlang'], \ 'description': 'Indent with the Erlang mode for Emacs', \ 'aliases': ['erlang-mode'], \ }, \ 'erlfmt': { \ 'function': 'ale#fixers#erlfmt#Fix', \ 'suggested_filetypes': ['erlang'], \ 'description': 'Format Erlang code with erlfmt', \ }, \ 'fecs': { \ 'function': 'ale#fixers#fecs#Fix', \ 'suggested_filetypes': ['javascript', 'css', 'html'], \ 'description': 'Apply fecs format to a file.', \ }, \ 'hurlfmt': { \ 'function': 'ale#fixers#hurlfmt#Fix', \ 'suggested_filetypes': ['hurl'], \ 'description': 'Fix hurl files with hurlfmt.', \ }, \ 'tidy': { \ 'function': 'ale#fixers#tidy#Fix', \ 'suggested_filetypes': ['html'], \ 'description': 'Fix HTML files with tidy.', \ }, \ 'prettier_standard': { \ 'function': 'ale#fixers#prettier_standard#Fix', \ 'suggested_filetypes': ['javascript'], \ 'description': 'Apply prettier-standard to a file.', \ 'aliases': ['prettier-standard'], \ }, \ 'elm-format': { \ 'function': 'ale#fixers#elm_format#Fix', \ 'suggested_filetypes': ['elm'], \ 'description': 'Apply elm-format to a file.', \ 'aliases': ['format'], \ }, \ 'nimpretty': { \ 'function': 'ale#fixers#nimpretty#Fix', \ 'suggested_filetypes': ['nim'], \ 'description': 'Apply nimpretty to a file.', \ }, \ 'erblint': { \ 'function': 'ale#fixers#erblint#Fix', \ 'suggested_filetypes': ['eruby'], \ 'description': 'Apply erblint --autocorrect to a file.', \ }, \ 'eslint': { \ 'function': 'ale#fixers#eslint#Fix', \ 'suggested_filetypes': ['javascript', 'typescript', 'astro'], \ 'description': 'Apply eslint --fix to a file.', \ }, \ 'mix_format': { \ 'function': 'ale#fixers#mix_format#Fix', \ 'suggested_filetypes': ['elixir'], \ 'description': 'Apply mix format to a file.', \ }, \ 'isort': { \ 'function': 'ale#fixers#isort#Fix', \ 'suggested_filetypes': ['python'], \ 'description': 'Sort Python imports with isort.', \ }, \ 'prettier': { \ 'function': 'ale#fixers#prettier#Fix', \ 'suggested_filetypes': ['javascript', 'typescript', 'css', 'less', 'scss', 'json', 'json5', 'graphql', 'markdown', 'vue', 'svelte', 'html', 'yaml', 'openapi', 'ruby', 'astro'], \ 'description': 'Apply prettier to a file.', \ }, \ 'prettier_eslint': { \ 'function': 'ale#fixers#prettier_eslint#Fix', \ 'suggested_filetypes': ['javascript'], \ 'description': 'Apply prettier-eslint to a file.', \ 'aliases': ['prettier-eslint'], \ }, \ 'pyflyby': { \ 'function': 'ale#fixers#pyflyby#Fix', \ 'suggested_filetypes': ['python'], \ 'description': 'Tidy Python imports with pyflyby.', \ }, \ 'importjs': { \ 'function': 'ale#fixers#importjs#Fix', \ 'suggested_filetypes': ['javascript'], \ 'description': 'automatic imports for javascript', \ }, \ 'puppetlint': { \ 'function': 'ale#fixers#puppetlint#Fix', \ 'suggested_filetypes': ['puppet'], \ 'description': 'Run puppet-lint -f on a file.', \ }, \ 'remove_trailing_lines': { \ 'function': 'ale#fixers#generic#RemoveTrailingBlankLines', \ 'suggested_filetypes': [], \ 'description': 'Remove all blank lines at the end of a file.', \ }, \ 'trim_whitespace': { \ 'function': 'ale#fixers#generic#TrimWhitespace', \ 'suggested_filetypes': [], \ 'description': 'Remove all trailing whitespace characters at the end of every line.', \ }, \ 'yamlfix': { \ 'function': 'ale#fixers#yamlfix#Fix', \ 'suggested_filetypes': ['yaml'], \ 'description': 'Fix YAML files with yamlfix.', \ }, \ 'yamlfmt': { \ 'function': 'ale#fixers#yamlfmt#Fix', \ 'suggested_filetypes': ['yaml'], \ 'description': 'Format YAML files with yamlfmt.', \ }, \ 'yapf': { \ 'function': 'ale#fixers#yapf#Fix', \ 'suggested_filetypes': ['python'], \ 'description': 'Fix Python files with yapf.', \ }, \ 'yq': { \ 'function': 'ale#fixers#yq#Fix', \ 'suggested_filetypes': ['yaml'], \ 'description': 'Fix YAML files with yq.', \ }, \ 'rubocop': { \ 'function': 'ale#fixers#rubocop#Fix', \ 'suggested_filetypes': ['ruby'], \ 'description': 'Fix ruby files with rubocop --auto-correct.', \ }, \ 'rufo': { \ 'function': 'ale#fixers#rufo#Fix', \ 'suggested_filetypes': ['ruby'], \ 'description': 'Fix ruby files with rufo', \ }, \ 'scalafmt': { \ 'function': 'ale#fixers#scalafmt#Fix', \ 'suggested_filetypes': ['sbt', 'scala'], \ 'description': 'Fix Scala files using scalafmt', \ }, \ 'sorbet': { \ 'function': 'ale#fixers#sorbet#Fix', \ 'suggested_filetypes': ['ruby'], \ 'description': 'Fix ruby files with srb tc --autocorrect.', \ }, \ 'standard': { \ 'function': 'ale#fixers#standard#Fix', \ 'suggested_filetypes': ['javascript'], \ 'description': 'Fix JavaScript files using standard --fix', \ }, \ 'standardrb': { \ 'function': 'ale#fixers#standardrb#Fix', \ 'suggested_filetypes': ['ruby'], \ 'description': 'Fix ruby files with standardrb --fix', \ }, \ 'statix': { \ 'function': 'ale#fixers#statix#Fix', \ 'suggested_filetypes': ['nix'], \ 'description': 'Fix common Nix antipatterns with statix fix', \ }, \ 'stylelint': { \ 'function': 'ale#fixers#stylelint#Fix', \ 'suggested_filetypes': ['css', 'sass', 'scss', 'sugarss', 'stylus'], \ 'description': 'Fix stylesheet files using stylelint --fix.', \ }, \ 'swiftformat': { \ 'function': 'ale#fixers#swiftformat#Fix', \ 'suggested_filetypes': ['swift'], \ 'description': 'Apply SwiftFormat to a file.', \ }, \ 'syntax_tree': { \ 'function': 'ale#fixers#syntax_tree#Fix', \ 'suggested_filetypes': ['ruby'], \ 'description': 'Fix ruby files with stree write', \ }, \ 'apple-swift-format': { \ 'function': 'ale#fixers#appleswiftformat#Fix', \ 'suggested_filetypes': ['swift'], \ 'description': 'Apply apple/swift-format to a file.', \ }, \ 'phpcbf': { \ 'function': 'ale#fixers#phpcbf#Fix', \ 'suggested_filetypes': ['php'], \ 'description': 'Fix PHP files with phpcbf.', \ }, \ 'php_cs_fixer': { \ 'function': 'ale#fixers#php_cs_fixer#Fix', \ 'suggested_filetypes': ['php'], \ 'description': 'Fix PHP files with php-cs-fixer.', \ }, \ 'pint': { \ 'function': 'ale#fixers#pint#Fix', \ 'suggested_filetypes': ['php'], \ 'description': 'Fix PHP files with Laravel Pint.', \ }, \ 'astyle': { \ 'function': 'ale#fixers#astyle#Fix', \ 'suggested_filetypes': ['c', 'cpp'], \ 'description': 'Fix C/C++ with astyle.', \ }, \ 'clangtidy': { \ 'function': 'ale#fixers#clangtidy#Fix', \ 'suggested_filetypes': ['c', 'cpp', 'objc'], \ 'description': 'Fix C/C++ and ObjectiveC files with clang-tidy.', \ }, \ 'clang-format': { \ 'function': 'ale#fixers#clangformat#Fix', \ 'suggested_filetypes': ['c', 'cpp', 'cs', 'cuda', 'java', 'javascript', 'json', 'objc', 'proto'], \ 'description': 'Fix C, C++, C#, CUDA, Java, JavaScript, JSON, ObjectiveC and Protobuf files with clang-format.', \ }, \ 'cmakeformat': { \ 'function': 'ale#fixers#cmakeformat#Fix', \ 'suggested_filetypes': ['cmake'], \ 'description': 'Fix CMake files with cmake-format.', \ }, \ 'fish_indent': { \ 'function': 'ale#fixers#fish_indent#Fix', \ 'suggested_filetypes': ['fish'], \ 'description': 'Format fish scripts using fish_indent.', \ }, \ 'forge': { \ 'function': 'ale#fixers#forge#Fix', \ 'suggested_filetypes': ['solidity'], \ 'description': 'Fix Solidity files with forge fmt.', \ }, \ 'gleam_format': { \ 'function': 'ale#fixers#gleam_format#Fix', \ 'suggested_filetypes': ['gleam'], \ 'description': 'Fix Gleam files with gleam format.', \ }, \ 'gofmt': { \ 'function': 'ale#fixers#gofmt#Fix', \ 'suggested_filetypes': ['go'], \ 'description': 'Fix Go files with go fmt.', \ }, \ 'gofumpt': { \ 'function': 'ale#fixers#gofumpt#Fix', \ 'suggested_filetypes': ['go'], \ 'description': 'Fix Go files with gofumpt, a stricter go fmt.', \ }, \ 'goimports': { \ 'function': 'ale#fixers#goimports#Fix', \ 'suggested_filetypes': ['go'], \ 'description': 'Fix Go files imports with goimports.', \ }, \ 'golangci_lint': { \ 'function': 'ale#fixers#golangci_lint#Fix', \ 'suggested_filetypes': ['go'], \ 'description': 'Fix Go files with golangci-lint.', \ }, \ 'golines': { \ 'function': 'ale#fixers#golines#Fix', \ 'suggested_filetypes': ['go'], \ 'description': 'Fix Go file long lines with golines', \ }, \ 'gomod': { \ 'function': 'ale#fixers#gomod#Fix', \ 'suggested_filetypes': ['gomod'], \ 'description': 'Fix Go module files with go mod edit -fmt.', \ }, \ 'gopls': { \ 'function': 'ale#fixers#gopls#Fix', \ 'suggested_filetypes': ['go'], \ 'description': 'Fix Go files with gopls.', \ }, \ 'tslint': { \ 'function': 'ale#fixers#tslint#Fix', \ 'suggested_filetypes': ['typescript'], \ 'description': 'Fix typescript files with tslint --fix.', \ }, \ 'rustfmt': { \ 'function': 'ale#fixers#rustfmt#Fix', \ 'suggested_filetypes': ['rust'], \ 'description': 'Fix Rust files with Rustfmt.', \ }, \ 'textlint': { \ 'function': 'ale#fixers#textlint#Fix', \ 'suggested_filetypes': ['text','markdown','asciidoc','tex'], \ 'description': 'Fix text files with textlint --fix', \ }, \ 'hackfmt': { \ 'function': 'ale#fixers#hackfmt#Fix', \ 'suggested_filetypes': ['hack'], \ 'description': 'Fix Hack files with hackfmt.', \ }, \ 'floskell': { \ 'function': 'ale#fixers#floskell#Fix', \ 'suggested_filetypes': ['haskell'], \ 'description': 'Fix Haskell files with floskell.', \ }, \ 'hfmt': { \ 'function': 'ale#fixers#hfmt#Fix', \ 'suggested_filetypes': ['haskell'], \ 'description': 'Fix Haskell files with hfmt.', \ }, \ 'brittany': { \ 'function': 'ale#fixers#brittany#Fix', \ 'suggested_filetypes': ['haskell'], \ 'description': 'Fix Haskell files with brittany.', \ }, \ 'hindent': { \ 'function': 'ale#fixers#hindent#Fix', \ 'suggested_filetypes': ['haskell'], \ 'description': 'Fix Haskell files with hindent.', \ }, \ 'hlint': { \ 'function': 'ale#fixers#hlint#Fix', \ 'suggested_filetypes': ['haskell'], \ 'description': 'Refactor Haskell files with hlint.', \ }, \ 'stylish-haskell': { \ 'function': 'ale#fixers#stylish_haskell#Fix', \ 'suggested_filetypes': ['haskell'], \ 'description': 'Refactor Haskell files with stylish-haskell.', \ }, \ 'purs-tidy': { \ 'function': 'ale#fixers#purs_tidy#Fix', \ 'suggested_filetypes': ['purescript'], \ 'description': 'Format PureScript files with purs-tidy.', \ }, \ 'purty': { \ 'function': 'ale#fixers#purty#Fix', \ 'suggested_filetypes': ['purescript'], \ 'description': 'Format PureScript files with purty.', \ }, \ 'ocamlformat': { \ 'function': 'ale#fixers#ocamlformat#Fix', \ 'suggested_filetypes': ['ocaml', 'ocamlinterface'], \ 'description': 'Fix OCaml files with ocamlformat.', \ }, \ 'ocp-indent': { \ 'function': 'ale#fixers#ocp_indent#Fix', \ 'suggested_filetypes': ['ocaml', 'ocamlinterface'], \ 'description': 'Fix OCaml files with ocp-indent.', \ }, \ 'refmt': { \ 'function': 'ale#fixers#refmt#Fix', \ 'suggested_filetypes': ['reason'], \ 'description': 'Fix ReasonML files with refmt.', \ }, \ 'pandoc': { \ 'function': 'ale#fixers#pandoc#Fix', \ 'suggested_filetypes': ['markdown'], \ 'description': 'Fix markdown files with pandoc.', \ }, \ 'shfmt': { \ 'function': 'ale#fixers#shfmt#Fix', \ 'suggested_filetypes': ['sh'], \ 'description': 'Fix sh files with shfmt.', \ }, \ 'sqlfluff': { \ 'function': 'ale#fixers#sqlfluff#Fix', \ 'suggested_filetypes': ['sql'], \ 'description': 'Fix SQL files with sqlfluff.', \ }, \ 'sqlfmt': { \ 'function': 'ale#fixers#sqlfmt#Fix', \ 'suggested_filetypes': ['sql'], \ 'description': 'Fix SQL files with sqlfmt.', \ }, \ 'sqlformat': { \ 'function': 'ale#fixers#sqlformat#Fix', \ 'suggested_filetypes': ['sql'], \ 'description': 'Fix SQL files with sqlformat.', \ }, \ 'google_java_format': { \ 'function': 'ale#fixers#google_java_format#Fix', \ 'suggested_filetypes': ['java'], \ 'description': 'Fix Java files with google-java-format.', \ }, \ 'fixjson': { \ 'function': 'ale#fixers#fixjson#Fix', \ 'suggested_filetypes': ['json'], \ 'description': 'Fix JSON files with fixjson.', \ }, \ 'jq': { \ 'function': 'ale#fixers#jq#Fix', \ 'suggested_filetypes': ['json'], \ 'description': 'Fix JSON files with jq.', \ }, \ 'json_pytool': { \ 'function': 'ale#fixers#json_pytool#Fix', \ 'suggested_filetypes': ['json'], \ 'description': "Fix JSON files with python's built-in json.tool module.", \ }, \ 'protolint': { \ 'function': 'ale#fixers#protolint#Fix', \ 'suggested_filetypes': ['proto'], \ 'description': 'Fix Protocol Buffer files with protolint.', \ }, \ 'perltidy': { \ 'function': 'ale#fixers#perltidy#Fix', \ 'suggested_filetypes': ['perl'], \ 'description': 'Fix Perl files with perltidy.', \ }, \ 'xo': { \ 'function': 'ale#fixers#xo#Fix', \ 'suggested_filetypes': ['javascript', 'typescript'], \ 'description': 'Fix JavaScript/TypeScript files using xo --fix.', \ }, \ 'qmlfmt': { \ 'function': 'ale#fixers#qmlfmt#Fix', \ 'suggested_filetypes': ['qml'], \ 'description': 'Fix QML files with qmlfmt.', \ }, \ 'dartfmt': { \ 'function': 'ale#fixers#dartfmt#Fix', \ 'suggested_filetypes': ['dart'], \ 'description': 'Fix Dart files with dartfmt.', \ }, \ 'dart-format': { \ 'function': 'ale#fixers#dart_format#Fix', \ 'suggested_filetypes': ['dart'], \ 'description': 'Fix Dart files with dart format.', \ }, \ 'dotnet-format': { \ 'function': 'ale#fixers#dotnet_format#Fix', \ 'suggested_filetypes': ['cs'], \ 'description': 'Fix C# files with dotnet format.', \ }, \ 'xmllint': { \ 'function': 'ale#fixers#xmllint#Fix', \ 'suggested_filetypes': ['xml'], \ 'description': 'Fix XML files with xmllint.', \ }, \ 'uncrustify': { \ 'function': 'ale#fixers#uncrustify#Fix', \ 'suggested_filetypes': ['c', 'cpp', 'cs', 'objc', 'objcpp', 'd', 'java', 'p', 'vala' ], \ 'description': 'Fix C, C++, C#, ObjectiveC, ObjectiveC++, D, Java, Pawn, and VALA files with uncrustify.', \ }, \ 'terraform': { \ 'function': 'ale#fixers#terraform#Fix', \ 'suggested_filetypes': ['hcl', 'terraform'], \ 'description': 'Fix tf and hcl files with terraform fmt.', \ }, \ 'packer': { \ 'function': 'ale#fixers#packer#Fix', \ 'suggested_filetypes': ['hcl', 'packer'], \ 'description': 'Fix Packer HCL files with packer fmt.', \ }, \ 'crystal': { \ 'function': 'ale#fixers#crystal#Fix', \ 'suggested_filetypes': ['cr'], \ 'description': 'Fix cr (crystal).', \ }, \ 'ktlint': { \ 'function': 'ale#fixers#ktlint#Fix', \ 'suggested_filetypes': ['kt', 'kotlin'], \ 'description': 'Fix Kotlin files with ktlint.', \ }, \ 'styler': { \ 'function': 'ale#fixers#styler#Fix', \ 'suggested_filetypes': ['r', 'rmarkdown', 'rmd'], \ 'description': 'Fix R files with styler.', \ }, \ 'latexindent': { \ 'function': 'ale#fixers#latexindent#Fix', \ 'suggested_filetypes': ['tex'], \ 'description' : 'Indent code within environments, commands, after headings and within special code blocks.', \ }, \ 'pgformatter': { \ 'function': 'ale#fixers#pgformatter#Fix', \ 'suggested_filetypes': ['sql'], \ 'description': 'A PostgreSQL SQL syntax beautifier', \ }, \ 'reorder-python-imports': { \ 'function': 'ale#fixers#reorder_python_imports#Fix', \ 'suggested_filetypes': ['python'], \ 'description': 'Sort Python imports with reorder-python-imports.', \ }, \ 'gnatpp': { \ 'function': 'ale#fixers#gnatpp#Fix', \ 'suggested_filetypes': ['ada'], \ 'description': 'Format Ada files with gnatpp.', \ }, \ 'nixfmt': { \ 'function': 'ale#fixers#nixfmt#Fix', \ 'suggested_filetypes': ['nix'], \ 'description': 'A nix formatter written in Haskell.', \ }, \ 'nixpkgs-fmt': { \ 'function': 'ale#fixers#nixpkgsfmt#Fix', \ 'suggested_filetypes': ['nix'], \ 'description': 'A formatter for Nix code', \ }, \ 'remark-lint': { \ 'function': 'ale#fixers#remark_lint#Fix', \ 'suggested_filetypes': ['markdown'], \ 'description': 'Fix markdown files with remark-lint', \ }, \ 'html-beautify': { \ 'function': 'ale#fixers#html_beautify#Fix', \ 'suggested_filetypes': ['html', 'htmldjango'], \ 'description': 'Fix HTML files with html-beautify from js-beautify.', \ }, \ 'htmlbeautifier': { \ 'function': 'ale#fixers#htmlbeautifier#Fix', \ 'suggested_filetypes': ['eruby'], \ 'description': 'Fix ERB files with htmlbeautifier gem.', \ }, \ 'lua-format': { \ 'function': 'ale#fixers#lua_format#Fix', \ 'suggested_filetypes': ['lua'], \ 'description': 'Fix Lua files with lua-format.', \ }, \ 'luafmt': { \ 'function': 'ale#fixers#luafmt#Fix', \ 'suggested_filetypes': ['lua'], \ 'description': 'Fix Lua files with luafmt.', \ }, \ 'dprint': { \ 'function': 'ale#fixers#dprint#Fix', \ 'suggested_filetypes': ['dockerfile', 'javascript', 'json', 'markdown', 'toml', 'typescript'], \ 'description': 'Pluggable and configurable code formatting platform', \ }, \ 'stylua': { \ 'function': 'ale#fixers#stylua#Fix', \ 'suggested_filetypes': ['lua'], \ 'description': 'Fix Lua files with stylua.', \ }, \ 'ormolu': { \ 'function': 'ale#fixers#ormolu#Fix', \ 'suggested_filetypes': ['haskell'], \ 'description': 'A formatter for Haskell source code.', \ }, \ 'fourmolu': { \ 'function': 'ale#fixers#fourmolu#Fix', \ 'suggested_filetypes': ['haskell'], \ 'description': 'A formatter for Haskell source code.', \ }, \ 'jsonnetfmt': { \ 'function': 'ale#fixers#jsonnetfmt#Fix', \ 'suggested_filetypes': ['jsonnet'], \ 'description': 'Fix jsonnet files with jsonnetfmt', \ }, \ 'ptop': { \ 'function': 'ale#fixers#ptop#Fix', \ 'suggested_filetypes': ['pascal'], \ 'description': 'Fix Pascal files with ptop.', \ }, \ 'opafmt': { \ 'function': 'ale#fixers#opafmt#Fix', \ 'suggested_filetypes': ['rego'], \ 'description': 'Fix rego files with opa fmt.', \ }, \ 'vfmt': { \ 'function': 'ale#fixers#vfmt#Fix', \ 'suggested_filetypes': ['v'], \ 'description': 'A formatter for V source code.', \ }, \ 'zigfmt': { \ 'function': 'ale#fixers#zigfmt#Fix', \ 'suggested_filetypes': ['zig'], \ 'description': 'Official formatter for Zig', \ }, \ 'raco_fmt': { \ 'function': 'ale#fixers#raco_fmt#Fix', \ 'suggested_filetypes': ['racket'], \ 'description': 'Fix Racket files with raco fmt.', \ }, \ 'ruff': { \ 'function': 'ale#fixers#ruff#Fix', \ 'suggested_filetypes': ['python'], \ 'description': 'Fix python files with ruff.', \ }, \ 'ruff_format': { \ 'function': 'ale#fixers#ruff_format#Fix', \ 'suggested_filetypes': ['python'], \ 'description': 'Fix python files with the ruff formatter.', \ }, \ 'pycln': { \ 'function': 'ale#fixers#pycln#Fix', \ 'suggested_filetypes': ['python'], \ 'description': 'remove unused python import statements', \ }, \ 'rustywind': { \ 'function': 'ale#fixers#rustywind#Fix', \ 'suggested_filetypes': ['html'], \ 'description': 'Sort Tailwind CSS classes', \ }, \ 'npm-groovy-lint': { \ 'function': 'ale#fixers#npmgroovylint#Fix', \ 'suggested_filetypes': ['groovy'], \ 'description': 'Fix Groovy files with npm-groovy-fix.', \ }, \ 'erb-formatter': { \ 'function': 'ale#fixers#erbformatter#Fix', \ 'suggested_filetypes': ['eruby'], \ 'description': 'Apply erb-formatter -w to eruby/erb files.', \ }, \ 'nickel_format': { \ 'function': 'ale#fixers#nickel_format#Fix', \ 'suggested_filetypes': ['nickel'], \ 'description': 'Fix nickel files with nickel format', \ }, \ 'rubyfmt': { \ 'function': 'ale#fixers#rubyfmt#Fix', \ 'suggested_filetypes': ['ruby'], \ 'description': 'A formatter for Ruby source code', \ }, \ 'scadformat': { \ 'function': 'ale#fixers#scadformat#Fix', \ 'suggested_filetypes': ['openscad'], \ 'description': 'Formatter for scad files', \ }, \ 'cljfmt': { \ 'function': 'ale#fixers#cljfmt#Fix', \ 'suggested_filetypes': ['clojure'], \ 'description': 'formatter and linter for clojure files', \ }, \} " Reset the function registry to the default entries. function! ale#fix#registry#ResetToDefaults() abort let s:entries = deepcopy(s:default_registry) let s:aliases = {} " Set up aliases for fixers too. for [l:key, l:entry] in items(s:entries) for l:alias in get(l:entry, 'aliases', []) let s:aliases[l:alias] = l:key endfor endfor endfunction " Set up entries now. call ale#fix#registry#ResetToDefaults() " Remove everything from the registry, useful for tests. function! ale#fix#registry#Clear() abort let s:entries = {} let s:aliases = {} endfunction " Add a function for fixing problems to the registry. " (name, func, filetypes, desc, aliases) function! ale#fix#registry#Add(name, func, filetypes, desc, ...) abort " This command will throw from the sandbox. let &l:equalprg=&l:equalprg if type(a:name) isnot v:t_string throw '''name'' must be a String' endif if type(a:func) isnot v:t_string throw '''func'' must be a String' endif if type(a:filetypes) isnot v:t_list throw '''filetypes'' must be a List' endif for l:type in a:filetypes if type(l:type) isnot v:t_string throw 'Each entry of ''filetypes'' must be a String' endif endfor if type(a:desc) isnot v:t_string throw '''desc'' must be a String' endif let l:aliases = get(a:000, 0, []) if type(l:aliases) isnot v:t_list \|| !empty(filter(copy(l:aliases), 'type(v:val) isnot v:t_string')) throw '''aliases'' must be a List of String values' endif let s:entries[a:name] = { \ 'function': a:func, \ 'suggested_filetypes': a:filetypes, \ 'description': a:desc, \} " Set up aliases for the fixer. if !empty(l:aliases) let s:entries[a:name].aliases = l:aliases for l:alias in l:aliases let s:aliases[l:alias] = a:name endfor endif endfunction " Get a function from the registry by its short name. function! ale#fix#registry#GetFunc(name) abort " Use the exact name, or an alias. let l:resolved_name = !has_key(s:entries, a:name) \ ? get(s:aliases, a:name, a:name) \ : a:name return get(s:entries, l:resolved_name, {'function': ''}).function endfunction function! s:ShouldSuggestForType(suggested_filetypes, type_list) abort for l:type in a:type_list if index(a:suggested_filetypes, l:type) >= 0 return 1 endif endfor return 0 endfunction function! s:IsGenericFixer(suggested_filetypes) abort if empty(a:suggested_filetypes) return 1 endif return 0 endfunction function! s:FormatEntry(key, entry) abort let l:aliases_str = '' " Show aliases in :ALEFixSuggest if they are there. if !empty(get(a:entry, 'aliases', [])) let l:aliases_str = ', ' . join( \ map(copy(a:entry.aliases), 'string(v:val)'), \ ',' \) endif return printf( \ '%s%s - %s', \ string(a:key), \ l:aliases_str, \ a:entry.description, \) endfunction " Get list of applicable fixers for filetype, including generic fixers function! ale#fix#registry#GetApplicableFixers(filetype) abort let l:type_list = split(a:filetype, '\.') let l:fixer_name_list = [] for l:key in sort(keys(s:entries)) let l:suggested_filetypes = s:entries[l:key].suggested_filetypes if s:IsGenericFixer(l:suggested_filetypes) || s:ShouldSuggestForType(l:suggested_filetypes, l:type_list) call add(l:fixer_name_list, l:key) endif endfor return l:fixer_name_list endfunction " Function that returns autocomplete candidates for ALEFix command function! ale#fix#registry#CompleteFixers(ArgLead, CmdLine, CursorPos) abort return filter(ale#fix#registry#GetApplicableFixers(&filetype), 'v:val =~? a:ArgLead') endfunction function! ale#fix#registry#SuggestedFixers(filetype) abort let l:type_list = split(a:filetype, '\.') let l:filetype_fixer_list = [] for l:key in sort(keys(s:entries)) let l:suggested_filetypes = s:entries[l:key].suggested_filetypes if s:ShouldSuggestForType(l:suggested_filetypes, l:type_list) call add( \ l:filetype_fixer_list, \ s:FormatEntry(l:key, s:entries[l:key]), \) endif endfor let l:generic_fixer_list = [] for l:key in sort(keys(s:entries)) if s:IsGenericFixer(s:entries[l:key].suggested_filetypes) call add( \ l:generic_fixer_list, \ s:FormatEntry(l:key, s:entries[l:key]), \) endif endfor return [l:filetype_fixer_list, l:generic_fixer_list] endfunction " Suggest functions to use from the registry. function! ale#fix#registry#Suggest(filetype) abort let l:suggested = ale#fix#registry#SuggestedFixers(a:filetype) let l:filetype_fixer_list = l:suggested[0] let l:generic_fixer_list = l:suggested[1] let l:filetype_fixer_header = !empty(l:filetype_fixer_list) \ ? ['Try the following fixers appropriate for the filetype:', ''] \ : [] let l:generic_fixer_header = !empty(l:generic_fixer_list) \ ? ['Try the following generic fixers:', ''] \ : [] let l:has_both_lists = !empty(l:filetype_fixer_list) && !empty(l:generic_fixer_list) let l:lines = \ l:filetype_fixer_header \ + l:filetype_fixer_list \ + (l:has_both_lists ? [''] : []) \ + l:generic_fixer_header \ + l:generic_fixer_list if empty(l:lines) let l:lines = ['There is nothing in the registry to suggest.'] else let l:lines += ['', 'See :help ale-fix-configuration'] endif let l:lines += ['', 'Press q to close this window'] new +set\ filetype=ale-fix-suggest call setline(1, l:lines) setlocal nomodified setlocal nomodifiable endfunction ale-4.0.0/autoload/ale/fixers/000077500000000000000000000000001476501472200161355ustar00rootroot00000000000000ale-4.0.0/autoload/ale/fixers/alejandra.vim000066400000000000000000000006611476501472200205760ustar00rootroot00000000000000call ale#Set('nix_alejandra_executable', 'alejandra') call ale#Set('nix_alejandra_options', '') function! ale#fixers#alejandra#Fix(buffer) abort let l:executable = ale#Var(a:buffer, 'nix_alejandra_executable') let l:options = ale#Var(a:buffer, 'nix_alejandra_options') return { \ 'command': ale#Escape(l:executable) \ . (empty(l:options) ? '' : ' ' . l:options) \ . ' -- -' \} endfunction ale-4.0.0/autoload/ale/fixers/apkbuild_fixer.vim000066400000000000000000000014501476501472200216420ustar00rootroot00000000000000" Author: Leo " Description: Fix policy violations found by apkbuild-lint call ale#Set('apkbuild_apkbuild_fixer_executable', 'apkbuild-fixer') call ale#Set('apkbuild_apkbuild_fixer_lint_executable', get(g:, 'ale_apkbuild_apkbuild_lint_executable')) call ale#Set('apkbuild_apkbuild_fixer_options', '') function! ale#fixers#apkbuild_fixer#Fix(buffer) abort let l:executable = ale#Var(a:buffer, 'apkbuild_apkbuild_fixer_executable') let l:options = ale#Var(a:buffer, 'apkbuild_apkbuild_fixer_options') return { \ 'command': ale#Escape(l:executable) \ . ' -p ' . ale#Var(a:buffer, 'apkbuild_apkbuild_fixer_lint_executable') \ . (empty(l:options) ? '' : ' ' . l:options) \ . ' %t', \ 'read_temporary_file': 1, \} endfunction ale-4.0.0/autoload/ale/fixers/appleswiftformat.vim000066400000000000000000000010341476501472200222370ustar00rootroot00000000000000" Author: (bosr) " Description: Integration of apple/swift-format formatter with ALE. function! ale#fixers#appleswiftformat#Fix(buffer) abort let l:command_args = ale#swift#GetAppleSwiftFormatCommand(a:buffer) . ' format --in-place %t' let l:config_args = ale#swift#GetAppleSwiftFormatConfigArgs(a:buffer) if l:config_args isnot# '' let l:command_args = l:command_args . ' ' . l:config_args endif return { \ 'read_temporary_file': 1, \ 'command': l:command_args, \} endfunction ale-4.0.0/autoload/ale/fixers/astyle.vim000066400000000000000000000035551476501472200201630ustar00rootroot00000000000000" Author: James Kim " Description: Fix C/C++ files with astyle. function! s:set_variables() abort for l:ft in ['c', 'cpp'] call ale#Set(l:ft . '_astyle_executable', 'astyle') call ale#Set(l:ft . '_astyle_project_options', '') endfor endfunction call s:set_variables() function! ale#fixers#astyle#Var(buffer, name) abort let l:ft = getbufvar(str2nr(a:buffer), '&filetype') let l:ft = l:ft =~# 'cpp' ? 'cpp' : 'c' return ale#Var(a:buffer, l:ft . '_astyle_' . a:name) endfunction " Try to find a project options file. function! ale#fixers#astyle#FindProjectOptions(buffer) abort let l:proj_options = ale#fixers#astyle#Var(a:buffer, 'project_options') " If user has set project options variable then use it and skip any searching. " This would allow users to use project files named differently than .astylerc. if !empty(l:proj_options) return l:proj_options endif " Try to find nearest .astylerc file. let l:proj_options = fnamemodify(ale#path#FindNearestFile(a:buffer, '.astylerc'), ':t') if !empty(l:proj_options) return l:proj_options endif " Try to find nearest _astylerc file. let l:proj_options = fnamemodify(ale#path#FindNearestFile(a:buffer, '_astylerc'), ':t') if !empty(l:proj_options) return l:proj_options endif " If no project options file is found return an empty string. return '' endfunction function! ale#fixers#astyle#Fix(buffer) abort let l:executable = ale#fixers#astyle#Var(a:buffer, 'executable') let l:proj_options = ale#fixers#astyle#FindProjectOptions(a:buffer) let l:command = ' --stdin=' . ale#Escape(expand('#' . a:buffer)) return { \ 'command': ale#Escape(l:executable) \ . (empty(l:proj_options) ? '' : ' --project=' . l:proj_options) \ . l:command \} endfunction ale-4.0.0/autoload/ale/fixers/autoflake.vim000066400000000000000000000031161476501472200206260ustar00rootroot00000000000000" Author: circld " Description: Fixing files with autoflake. call ale#Set('python_autoflake_executable', 'autoflake') call ale#Set('python_autoflake_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('python_autoflake_options', '') call ale#Set('python_autoflake_auto_pipenv', 0) call ale#Set('python_autoflake_auto_poetry', 0) call ale#Set('python_autoflake_auto_uv', 0) function! ale#fixers#autoflake#GetExecutable(buffer) abort if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_autoflake_auto_pipenv')) \ && ale#python#PipenvPresent(a:buffer) return 'pipenv' endif if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_autoflake_auto_poetry')) \ && ale#python#PoetryPresent(a:buffer) return 'poetry' endif if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_autoflake_auto_uv')) \ && ale#python#UvPresent(a:buffer) return 'uv' endif return ale#python#FindExecutable(a:buffer, 'python_autoflake', ['autoflake']) endfunction function! ale#fixers#autoflake#Fix(buffer) abort let l:executable = ale#fixers#autoflake#GetExecutable(a:buffer) let l:exec_args = l:executable =~? '\(pipenv\|poetry\|uv\)$' \ ? ' run autoflake' \ : '' let l:options = ale#Var(a:buffer, 'python_autoflake_options') return { \ 'command': ale#Escape(l:executable) . l:exec_args \ . (!empty(l:options) ? ' ' . l:options : '') \ . ' --in-place ' \ . ' %t', \ 'read_temporary_file': 1, \} endfunction ale-4.0.0/autoload/ale/fixers/autoimport.vim000066400000000000000000000030561476501472200210610ustar00rootroot00000000000000" Author: lyz-code " Description: Fixing Python imports with autoimport. call ale#Set('python_autoimport_executable', 'autoimport') call ale#Set('python_autoimport_options', '') call ale#Set('python_autoimport_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('python_autoimport_auto_pipenv', 0) call ale#Set('python_autoimport_auto_poetry', 0) call ale#Set('python_autoimport_auto_uv', 0) function! ale#fixers#autoimport#GetExecutable(buffer) abort if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_autoimport_auto_pipenv')) \ && ale#python#PipenvPresent(a:buffer) return 'pipenv' endif if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_autoimport_auto_poetry')) \ && ale#python#PoetryPresent(a:buffer) return 'poetry' endif if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_autoimport_auto_uv')) \ && ale#python#UvPresent(a:buffer) return 'uv' endif return ale#python#FindExecutable(a:buffer, 'python_autoimport', ['autoimport']) endfunction function! ale#fixers#autoimport#Fix(buffer) abort let l:executable = ale#fixers#autoimport#GetExecutable(a:buffer) let l:exec_args = l:executable =~? '\(pipenv\|poetry\|uv\)$' \ ? ' run autoimport' \ : '' let l:options = ale#Var(a:buffer, 'python_autoimport_options') return { \ 'cwd': '%s:h', \ 'command': ale#Escape(l:executable) . l:exec_args \ . (!empty(l:options) ? ' ' . l:options : '') \ . ' -', \} endfunction ale-4.0.0/autoload/ale/fixers/autopep8.vim000066400000000000000000000027721476501472200204270ustar00rootroot00000000000000" Author: w0rp " Description: Fixing files with autopep8. call ale#Set('python_autopep8_executable', 'autopep8') call ale#Set('python_autopep8_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('python_autopep8_options', '') call ale#Set('python_autopep8_auto_pipenv', 0) call ale#Set('python_autopep8_auto_poetry', 0) call ale#Set('python_autopep8_auto_uv', 0) function! ale#fixers#autopep8#GetExecutable(buffer) abort if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_autopep8_auto_pipenv')) \ && ale#python#PipenvPresent(a:buffer) return 'pipenv' endif if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_autopep8_auto_poetry')) \ && ale#python#PoetryPresent(a:buffer) return 'poetry' endif if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_autopep8_auto_uv')) \ && ale#python#UvPresent(a:buffer) return 'uv' endif return ale#python#FindExecutable(a:buffer, 'python_autopep8', ['autopep8']) endfunction function! ale#fixers#autopep8#Fix(buffer) abort let l:executable = ale#fixers#autopep8#GetExecutable(a:buffer) let l:exec_args = l:executable =~? '\(pipenv\|poetry\|uv\)$' \ ? ' run autopep8' \ : '' let l:options = ale#Var(a:buffer, 'python_autopep8_options') return { \ 'command': ale#Escape(l:executable) . l:exec_args \ . (!empty(l:options) ? ' ' . l:options : '') \ . ' -', \} endfunction ale-4.0.0/autoload/ale/fixers/bibclean.vim000066400000000000000000000010261476501472200204100ustar00rootroot00000000000000" Author: Horacio Sanson - https://github.com/hsanson " Description: Support for bibclean fixer for BibTeX files. call ale#Set('bib_bibclean_executable', 'bibclean') call ale#Set('bib_bibclean_options', '-align-equals') function! ale#fixers#bibclean#Fix(buffer) abort let l:options = ale#Var(a:buffer, 'bib_bibclean_options') let l:executable = ale#Var(a:buffer, 'bib_bibclean_executable') return { \ 'command': ale#Escape(l:executable) \ . ' ' . (empty(l:options) ? '' : l:options), \} endfunction ale-4.0.0/autoload/ale/fixers/biome.vim000066400000000000000000000007271476501472200177530ustar00rootroot00000000000000function! ale#fixers#biome#Fix(buffer) abort let l:executable = ale#handlers#biome#GetExecutable(a:buffer) let l:options = ale#Var(a:buffer, 'biome_options') let l:apply = ale#Var(a:buffer, 'biome_fixer_apply_unsafe') ? '--apply-unsafe' : '--apply' return { \ 'read_temporary_file': 1, \ 'command': ale#Escape(l:executable) . ' check ' . l:apply \ . (!empty(l:options) ? ' ' . l:options : '') \ . ' %t' \} endfunction ale-4.0.0/autoload/ale/fixers/black.vim000066400000000000000000000035741476501472200177370ustar00rootroot00000000000000" Author: w0rp " Description: Fixing Python files with black. " call ale#Set('python_black_executable', 'black') call ale#Set('python_black_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('python_black_options', '') call ale#Set('python_black_auto_pipenv', 0) call ale#Set('python_black_auto_poetry', 0) call ale#Set('python_black_auto_uv', 0) call ale#Set('python_black_change_directory', 1) function! ale#fixers#black#GetExecutable(buffer) abort if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_black_auto_pipenv')) \ && ale#python#PipenvPresent(a:buffer) return 'pipenv' endif if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_black_auto_poetry')) \ && ale#python#PoetryPresent(a:buffer) return 'poetry' endif if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_black_auto_uv')) \ && ale#python#UvPresent(a:buffer) return 'uv' endif return ale#python#FindExecutable(a:buffer, 'python_black', ['black']) endfunction function! ale#fixers#black#Fix(buffer) abort let l:executable = ale#fixers#black#GetExecutable(a:buffer) let l:cmd = [ale#Escape(l:executable)] if l:executable =~? '\(pipenv\|poetry\|uv\)$' call extend(l:cmd, ['run', 'black']) endif let l:options = ale#Var(a:buffer, 'python_black_options') if !empty(l:options) call add(l:cmd, l:options) endif let l:fname = expand('#' . a:buffer . '...') call add(l:cmd, '--stdin-filename '.ale#Escape(ale#path#Simplify(l:fname))) if expand('#' . a:buffer . ':e') is? 'pyi' call add(l:cmd, '--pyi') endif call add(l:cmd, '-') let l:result = {'command': join(l:cmd, ' ')} if ale#Var(a:buffer, 'python_black_change_directory') let l:result.cwd = '%s:h' endif return l:result endfunction ale-4.0.0/autoload/ale/fixers/brittany.vim000066400000000000000000000013231476501472200205050ustar00rootroot00000000000000" Author: eborden , ifyouseewendy , aspidiets " Description: Integration of brittany with ALE. call ale#Set('haskell_brittany_executable', 'brittany') function! ale#fixers#brittany#GetExecutable(buffer) abort let l:executable = ale#Var(a:buffer, 'haskell_brittany_executable') return ale#handlers#haskell_stack#EscapeExecutable(l:executable, 'brittany') endfunction function! ale#fixers#brittany#Fix(buffer) abort let l:executable = ale#fixers#brittany#GetExecutable(a:buffer) return { \ 'command': l:executable \ . ' --write-mode inplace' \ . ' %t', \ 'read_temporary_file': 1, \} endfunction ale-4.0.0/autoload/ale/fixers/buf_format.vim000066400000000000000000000005361476501472200210020ustar00rootroot00000000000000" Author: Alex McKinney " Description: Run buf format. call ale#Set('proto_buf_format_executable', 'buf') function! ale#fixers#buf_format#Fix(buffer) abort let l:executable = ale#Var(a:buffer, 'proto_buf_format_executable') return { \ 'command': ale#Escape(l:executable) . ' format %t', \} endfunction ale-4.0.0/autoload/ale/fixers/buildifier.vim000066400000000000000000000016411476501472200207720ustar00rootroot00000000000000" Author: Jon Parise " Description: Format Bazel BUILD and .bzl files with buildifier. " call ale#Set('bazel_buildifier_executable', 'buildifier') call ale#Set('bazel_buildifier_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('bazel_buildifier_options', '') function! ale#fixers#buildifier#GetExecutable(buffer) abort return ale#path#FindExecutable(a:buffer, 'bazel_buildifier', [ \ 'buildifier', \]) endfunction function! ale#fixers#buildifier#Fix(buffer) abort let l:executable = ale#Escape(ale#fixers#buildifier#GetExecutable(a:buffer)) let l:options = ale#Var(a:buffer, 'bazel_buildifier_options') let l:filename = ale#Escape(bufname(a:buffer)) let l:command = l:executable . ' -mode fix -lint fix -path ' . l:filename if l:options isnot# '' let l:command .= ' ' . l:options endif return {'command': l:command . ' -'} endfunction ale-4.0.0/autoload/ale/fixers/clangformat.vim000066400000000000000000000030421476501472200211460ustar00rootroot00000000000000scriptencoding utf-8 " Author: Peter Renström " Description: Fixing C/C++ files with clang-format. call ale#Set('c_clangformat_executable', 'clang-format') call ale#Set('c_clangformat_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('c_clangformat_options', '') call ale#Set('c_clangformat_style_option', '') call ale#Set('c_clangformat_use_local_file', 0) function! ale#fixers#clangformat#GetExecutable(buffer) abort return ale#path#FindExecutable(a:buffer, 'c_clangformat', [ \ 'clang-format', \]) endfunction function! ale#fixers#clangformat#Fix(buffer) abort let l:executable = ale#Escape(ale#fixers#clangformat#GetExecutable(a:buffer)) let l:filename = ale#Escape(bufname(a:buffer)) let l:options = ale#Var(a:buffer, 'c_clangformat_options') let l:style_option = ale#Var(a:buffer, 'c_clangformat_style_option') let l:use_local_file = ale#Var(a:buffer, 'c_clangformat_use_local_file') if l:style_option isnot# '' let l:style_option = '-style=' . "'" . l:style_option . "'" endif if l:use_local_file let l:config = ale#path#FindNearestFile(a:buffer, '.clang-format') if !empty(l:config) let l:style_option = '-style=file' endif endif if l:style_option isnot# '' let l:options .= ' ' . l:style_option endif let l:command = l:executable . ' --assume-filename=' . l:filename if l:options isnot# '' let l:command .= ' ' . l:options endif return {'command': l:command} endfunction ale-4.0.0/autoload/ale/fixers/clangtidy.vim000066400000000000000000000037311476501472200206340ustar00rootroot00000000000000scriptencoding utf-8 " Author: ObserverOfTime " Description: Fixing C/C++ files with clang-tidy. function! s:set_variables() abort let l:use_global = get(g:, 'ale_use_global_executables', 0) for l:ft in ['c', 'cpp'] call ale#Set(l:ft . '_clangtidy_executable', 'clang-tidy') call ale#Set(l:ft . '_clangtidy_use_global', l:use_global) call ale#Set(l:ft . '_clangtidy_checks', []) call ale#Set(l:ft . '_clangtidy_options', '') call ale#Set(l:ft . '_clangtidy_extra_options', '') call ale#Set(l:ft . '_clangtidy_fix_errors', 1) endfor call ale#Set('c_build_dir', '') endfunction call s:set_variables() function! ale#fixers#clangtidy#Var(buffer, name) abort let l:ft = getbufvar(str2nr(a:buffer), '&filetype') let l:ft = l:ft =~# 'cpp' ? 'cpp' : 'c' return ale#Var(a:buffer, l:ft . '_clangtidy_' . a:name) endfunction function! ale#fixers#clangtidy#GetCommand(buffer) abort let l:checks = join(ale#fixers#clangtidy#Var(a:buffer, 'checks'), ',') let l:extra_options = ale#fixers#clangtidy#Var(a:buffer, 'extra_options') let l:build_dir = ale#c#GetBuildDirectory(a:buffer) let l:options = empty(l:build_dir) \ ? ale#fixers#clangtidy#Var(a:buffer, 'options') : '' let l:fix_errors = ale#fixers#clangtidy#Var(a:buffer, 'fix_errors') return ' -fix' . (l:fix_errors ? ' -fix-errors' : '') \ . (empty(l:checks) ? '' : ' -checks=' . ale#Escape(l:checks)) \ . (empty(l:extra_options) ? '' : ' ' . l:extra_options) \ . (empty(l:build_dir) ? '' : ' -p ' . ale#Escape(l:build_dir)) \ . ' %t' . (empty(l:options) ? '' : ' -- ' . l:options) endfunction function! ale#fixers#clangtidy#Fix(buffer) abort let l:executable = ale#fixers#clangtidy#Var(a:buffer, 'executable') let l:command = ale#fixers#clangtidy#GetCommand(a:buffer) return { \ 'command': ale#Escape(l:executable) . l:command, \ 'read_temporary_file': 1, \} endfunction ale-4.0.0/autoload/ale/fixers/cljfmt.vim000066400000000000000000000006471476501472200201400ustar00rootroot00000000000000" Author: rudolf ordoyne " Description: Support for cljfmt https://github.com/weavejester/cljfmt call ale#Set('clojure_cljfmt_executable', 'cljfmt') function! ale#fixers#cljfmt#Fix(buffer) abort let l:executable = ale#Var(a:buffer, 'clojure_cljfmt_executable') return { \ 'command': ale#Escape(l:executable) . ' fix %t', \ 'read_temporary_file': 1, \} endfunction ale-4.0.0/autoload/ale/fixers/cmakeformat.vim000066400000000000000000000010431476501472200211410ustar00rootroot00000000000000" Author: Attila Maczak " Description: Integration of cmakeformat with ALE. call ale#Set('cmake_cmakeformat_executable', 'cmake-format') call ale#Set('cmake_cmakeformat_options', '') function! ale#fixers#cmakeformat#Fix(buffer) abort let l:executable = ale#Var(a:buffer, 'cmake_cmakeformat_executable') let l:options = ale#Var(a:buffer, 'cmake_cmakeformat_options') return { \ 'command': ale#Escape(l:executable) \ . (empty(l:options) ? '' : ' ' . l:options) \ . ' -' \} endfunction ale-4.0.0/autoload/ale/fixers/crystal.vim000066400000000000000000000006641476501472200203410ustar00rootroot00000000000000call ale#Set('crystal_format_executable', 'crystal') call ale#Set('crystal_format_options', '') function! ale#fixers#crystal#Fix(buffer) abort let l:executable = ale#Var(a:buffer, 'crystal_format_executable') let l:options = ale#Var(a:buffer, 'crystal_format_options') return { \ 'command': ale#Escape(l:executable) \ . ' tool format' \ . ale#Pad(l:options) \ . ' -' \} endfunction ale-4.0.0/autoload/ale/fixers/css_beautify.vim000066400000000000000000000012061476501472200213310ustar00rootroot00000000000000" Author: https://github.com/Spixmaster " Description: Format CSS using css-beautify from js-beautify. call ale#Set('css_css_beautify_executable', 'css-beautify') call ale#Set('css_css_beautify_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('css_css_beautify_options', '') function! ale#fixers#css_beautify#Fix(buffer) abort let l:executable = ale#python#FindExecutable( \ a:buffer, \ 'css_css_beautify', \ ['css-beautify'] \) let l:options = ale#Var(a:buffer, 'css_css_beautify_options') return { \ 'command': ale#Escape(l:executable) . ' ' . l:options . ' -', \} endfunction ale-4.0.0/autoload/ale/fixers/dart_format.vim000066400000000000000000000010761476501472200211600ustar00rootroot00000000000000" Author: ghsang " Description: Integration of dart format with ALE. call ale#Set('dart_format_executable', 'dart') call ale#Set('dart_format_options', '') function! ale#fixers#dart_format#Fix(buffer) abort let l:executable = ale#Var(a:buffer, 'dart_format_executable') let l:options = ale#Var(a:buffer, 'dart_format_options') return { \ 'command': ale#Escape(l:executable) \ . ' format' \ . (empty(l:options) ? '' : ' ' . l:options) \ . ' %t', \ 'read_temporary_file': 1, \} endfunction ale-4.0.0/autoload/ale/fixers/dartfmt.vim000066400000000000000000000010651476501472200203150ustar00rootroot00000000000000" Author: reisub0 " Description: Integration of dartfmt with ALE. call ale#Set('dart_dartfmt_executable', 'dartfmt') call ale#Set('dart_dartfmt_options', '') function! ale#fixers#dartfmt#Fix(buffer) abort let l:executable = ale#Var(a:buffer, 'dart_dartfmt_executable') let l:options = ale#Var(a:buffer, 'dart_dartfmt_options') return { \ 'command': ale#Escape(l:executable) \ . ' -w' \ . (empty(l:options) ? '' : ' ' . l:options) \ . ' %t', \ 'read_temporary_file': 1, \} endfunction ale-4.0.0/autoload/ale/fixers/deno.vim000066400000000000000000000006101476501472200175740ustar00rootroot00000000000000function! ale#fixers#deno#Fix(buffer) abort let l:executable = ale#handlers#deno#GetExecutable(a:buffer) if !executable(l:executable) return 0 endif let l:options = ' fmt -' if ale#Var(a:buffer, 'deno_unstable') let l:options = l:options . ' --unstable' endif return { \ 'command': ale#Escape(l:executable) . l:options \} endfunction ale-4.0.0/autoload/ale/fixers/dfmt.vim000066400000000000000000000010071476501472200176020ustar00rootroot00000000000000" Author: theoldmoon0602 " Description: Integration of dfmt with ALE. call ale#Set('d_dfmt_executable', 'dfmt') call ale#Set('d_dfmt_options', '') function! ale#fixers#dfmt#Fix(buffer) abort let l:executable = ale#Var(a:buffer, 'd_dfmt_executable') let l:options = ale#Var(a:buffer, 'd_dfmt_options') return { \ 'command': ale#Escape(l:executable) \ . ' -i' \ . (empty(l:options) ? '' : ' ' . l:options) \ . ' %t', \ 'read_temporary_file': 1, \} endfunction ale-4.0.0/autoload/ale/fixers/dhall_format.vim000066400000000000000000000004461476501472200213120ustar00rootroot00000000000000" Author: toastal " Description: Dhall’s built-in formatter " function! ale#fixers#dhall_format#Fix(buffer) abort let l:executable = ale#dhall#GetExecutableWithOptions(a:buffer) return { \ 'command': l:executable \ . ' format' \} endfunction ale-4.0.0/autoload/ale/fixers/dhall_freeze.vim000066400000000000000000000006211476501472200212750ustar00rootroot00000000000000" Author: toastal " Description: Dhall’s package freezing call ale#Set('dhall_freeze_options', '') function! ale#fixers#dhall_freeze#Freeze(buffer) abort let l:executable = ale#dhall#GetExecutableWithOptions(a:buffer) return { \ 'command': l:executable \ . ' freeze' \ . ale#Pad(ale#Var(a:buffer, 'dhall_freeze_options')) \} endfunction ale-4.0.0/autoload/ale/fixers/dhall_lint.vim000066400000000000000000000004501476501472200207630ustar00rootroot00000000000000" Author: toastal " Description: Dhall’s built-in linter/formatter function! ale#fixers#dhall_lint#Fix(buffer) abort let l:executable = ale#dhall#GetExecutableWithOptions(a:buffer) return { \ 'command': l:executable \ . ' lint' \} endfunction ale-4.0.0/autoload/ale/fixers/dotnet_format.vim000066400000000000000000000011731476501472200215210ustar00rootroot00000000000000" Author: ghsang " Description: Integration of dotnet format with ALE. call ale#Set('cs_dotnet_format_executable', 'dotnet') call ale#Set('cs_dotnet_format_options', '') function! ale#fixers#dotnet_format#Fix(buffer) abort let l:executable = ale#Var(a:buffer, 'cs_dotnet_format_executable') let l:options = ale#Var(a:buffer, 'cs_dotnet_format_options') return { \ 'command': ale#Escape(l:executable) \ . ' format' \ . (empty(l:options) ? '' : ' ' . l:options) \ . ' --folder --include %t "$(dirname %t)"', \ 'read_temporary_file': 1, \} endfunction ale-4.0.0/autoload/ale/fixers/dprint.vim000066400000000000000000000016711476501472200201570ustar00rootroot00000000000000call ale#Set('dprint_executable', 'dprint') call ale#Set('dprint_executable_override', 0) call ale#Set('dprint_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('dprint_options', '') call ale#Set('dprint_config', 'dprint.json') function! ale#fixers#dprint#Fix(buffer) abort let l:executable = ale#path#FindExecutable(a:buffer, 'dprint', ['dprint']) let l:executable_override = ale#Var(a:buffer, 'dprint_executable_override') if !executable(l:executable) && !l:executable_override return 0 endif let l:options = ale#Var(a:buffer, 'dprint_options') let l:config = ale#path#FindNearestFile(a:buffer, ale#Var(a:buffer, 'dprint_config')) if !empty(l:config) let l:options = l:options . ' -c ' . ale#Escape(l:config) endif let l:options = l:options . ' --stdin %s' return { \ 'command': ale#Escape(l:executable) \ . ' fmt ' \ . l:options \} endfunction ale-4.0.0/autoload/ale/fixers/dune.vim000066400000000000000000000007701476501472200176110ustar00rootroot00000000000000" Author: Albert Peschar " Description: Fix files with dune format. call ale#Set('ocaml_dune_executable', 'dune') call ale#Set('ocaml_dune_options', '') function! ale#fixers#dune#Fix(buffer) abort let l:executable = ale#Var(a:buffer, 'ocaml_dune_executable') let l:options = ale#Var(a:buffer, 'ocaml_dune_options') return { \ 'command': ale#Escape(l:executable) \ . ' format' \ . (empty(l:options) ? '' : ' ' . l:options), \} endfunction ale-4.0.0/autoload/ale/fixers/elm_format.vim000066400000000000000000000014211476501472200207750ustar00rootroot00000000000000" Author: soywod " Description: Integration of elm-format with ALE. call ale#Set('elm_format_executable', 'elm-format') call ale#Set('elm_format_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('elm_format_options', '--yes') function! ale#fixers#elm_format#GetExecutable(buffer) abort return ale#path#FindExecutable(a:buffer, 'elm_format', [ \ 'node_modules/.bin/elm-format', \]) endfunction function! ale#fixers#elm_format#Fix(buffer) abort let l:options = ale#Var(a:buffer, 'elm_format_options') return { \ 'command': ale#Escape(ale#fixers#elm_format#GetExecutable(a:buffer)) \ . ' %t' \ . (empty(l:options) ? '' : ' ' . l:options), \ 'read_temporary_file': 1, \} endfunction ale-4.0.0/autoload/ale/fixers/erbformatter.vim000066400000000000000000000006571476501472200213560ustar00rootroot00000000000000" Author: Arash Mousavi " Description: Support for ERB::Formetter https://github.com/nebulab/erb-formatter call ale#Set('eruby_erbformatter_executable', 'erb-formatter') function! ale#fixers#erbformatter#Fix(buffer) abort let l:executable = ale#Var(a:buffer, 'eruby_erbformatter_executable') return { \ 'command': ale#Escape(l:executable) . ' -w %t', \ 'read_temporary_file': 1, \} endfunction ale-4.0.0/autoload/ale/fixers/erblint.vim000066400000000000000000000023551476501472200203160ustar00rootroot00000000000000" Author: Roeland Moors - https://github.com/roelandmoors " Description: ERB Lint, support for https://github.com/Shopify/erb-lint call ale#Set('eruby_erblint_executable', 'erblint') call ale#Set('eruby_erblint_options', '') " Erblint fixer outputs diagnostics first and then the fixed " output. These are delimited by something like this: " ================ /path/to/demo.html.erb ================== " We only need the output after this function! ale#fixers#erblint#PostProcess(buffer, output) abort let l:line = 0 for l:output in a:output let l:line = l:line + 1 if l:output =~# "^=\\+.*=\\+$" break endif endfor return a:output[l:line :] endfunction function! ale#fixers#erblint#GetCommand(buffer) abort let l:executable = ale#Var(a:buffer, 'eruby_erblint_executable') let l:options = ale#Var(a:buffer, 'eruby_erblint_options') return ale#ruby#EscapeExecutable(l:executable, 'erblint') \ . (!empty(l:options) ? ' ' . l:options : '') \ . ' --autocorrect --stdin %s' endfunction function! ale#fixers#erblint#Fix(buffer) abort return { \ 'command': ale#fixers#erblint#GetCommand(a:buffer), \ 'process_with': 'ale#fixers#erblint#PostProcess' \} endfunction ale-4.0.0/autoload/ale/fixers/erlang_mode.vim000066400000000000000000000033651476501472200211350ustar00rootroot00000000000000" Author: Dmitri Vereshchagin " Description: Indent with the Erlang mode for Emacs call ale#Set('erlang_erlang_mode_emacs_executable', 'emacs') call ale#Set('erlang_erlang_mode_indent_level', 4) call ale#Set('erlang_erlang_mode_icr_indent', 'nil') call ale#Set('erlang_erlang_mode_indent_guard', 2) call ale#Set('erlang_erlang_mode_argument_indent', 2) call ale#Set('erlang_erlang_mode_indent_tabs_mode', 'nil') let s:variables = { \ 'erlang-indent-level': 'erlang_erlang_mode_indent_level', \ 'erlang-icr-indent': 'erlang_erlang_mode_icr_indent', \ 'erlang-indent-guard': 'erlang_erlang_mode_indent_guard', \ 'erlang-argument-indent': 'erlang_erlang_mode_argument_indent', \ 'indent-tabs-mode': 'erlang_erlang_mode_indent_tabs_mode', \} function! ale#fixers#erlang_mode#Fix(buffer) abort let emacs_executable = \ ale#Var(a:buffer, 'erlang_erlang_mode_emacs_executable') let l:exprs = [ \ s:SetqDefault(a:buffer, s:variables), \ '(erlang-mode)', \ '(font-lock-fontify-region (point-min) (point-max))', \ '(indent-region (point-min) (point-max))', \ '(funcall (if indent-tabs-mode ''tabify ''untabify)' \ . ' (point-min) (point-max))', \ '(save-buffer 0)', \] let l:command = ale#Escape(l:emacs_executable) \ . ' --batch' \ . ' --find-file=%t' \ . join(map(l:exprs, '" --eval=" . ale#Escape(v:val)'), '') return {'command': l:command, 'read_temporary_file': 1} endfunction function! s:SetqDefault(buffer, variables) abort let l:args = [] for [l:emacs_name, l:ale_name] in items(a:variables) let l:args += [l:emacs_name, ale#Var(a:buffer, l:ale_name)] endfor return '(setq-default ' . join(l:args) . ')' endfunction ale-4.0.0/autoload/ale/fixers/erlfmt.vim000066400000000000000000000013201476501472200201370ustar00rootroot00000000000000" Author: AntoineGagne - https://github.com/AntoineGagne " Description: Integration of erlfmt with ALE. call ale#Set('erlang_erlfmt_executable', 'erlfmt') call ale#Set('erlang_erlfmt_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('erlang_erlfmt_options', '') function! ale#fixers#erlfmt#GetExecutable(buffer) abort return ale#path#FindExecutable(a:buffer, 'erlang_erlfmt', ['erlfmt']) endfunction function! ale#fixers#erlfmt#Fix(buffer) abort let l:options = ale#Var(a:buffer, 'erlang_erlfmt_options') let l:executable = ale#fixers#erlfmt#GetExecutable(a:buffer) let l:command = ale#Escape(l:executable) . ale#Pad(l:options) . ' -' return {'command': l:command} endfunction ale-4.0.0/autoload/ale/fixers/eslint.vim000066400000000000000000000052561476501472200201600ustar00rootroot00000000000000" Author: w0rp " Description: Fixing files with eslint. function! ale#fixers#eslint#Fix(buffer) abort let l:executable = ale#handlers#eslint#GetExecutable(a:buffer) let l:command = ale#node#Executable(a:buffer, l:executable) \ . ' --version' return ale#semver#RunWithVersionCheck( \ a:buffer, \ l:executable, \ l:command, \ function('ale#fixers#eslint#ApplyFixForVersion'), \) endfunction function! ale#fixers#eslint#ProcessFixDryRunOutput(buffer, output) abort for l:item in ale#util#FuzzyJSONDecode(a:output, []) return split(get(l:item, 'output', ''), "\n") endfor return [] endfunction function! ale#fixers#eslint#ProcessEslintDOutput(buffer, output) abort " If the output is an error message, don't use it. for l:line in a:output[:10] if l:line =~# '\v^Error:|^Could not connect' return [] endif endfor return a:output endfunction function! ale#fixers#eslint#ApplyFixForVersion(buffer, version) abort let l:executable = ale#handlers#eslint#GetExecutable(a:buffer) let l:options = ale#Var(a:buffer, 'javascript_eslint_options') " Use the configuration file from the options, if configured. if l:options =~# '\v(^| )-c|(^| )--config' let l:config = '' let l:has_config = 1 else let l:config = ale#handlers#eslint#FindConfig(a:buffer) let l:has_config = !empty(l:config) endif if !l:has_config return 0 endif " Use --fix-to-stdout with eslint_d if l:executable =~# 'eslint_d$' && ale#semver#GTE(a:version, [3, 19, 0]) return { \ 'cwd': ale#handlers#eslint#GetCwd(a:buffer), \ 'command': ale#node#Executable(a:buffer, l:executable) \ . ale#Pad(l:options) \ . ' --stdin-filename %s --stdin --fix-to-stdout', \ 'process_with': 'ale#fixers#eslint#ProcessEslintDOutput', \} endif " 4.9.0 is the first version with --fix-dry-run if ale#semver#GTE(a:version, [4, 9, 0]) return { \ 'cwd': ale#handlers#eslint#GetCwd(a:buffer), \ 'command': ale#node#Executable(a:buffer, l:executable) \ . ale#Pad(l:options) \ . ' --stdin-filename %s --stdin --fix-dry-run --format=json', \ 'process_with': 'ale#fixers#eslint#ProcessFixDryRunOutput', \} endif return { \ 'cwd': ale#handlers#eslint#GetCwd(a:buffer), \ 'command': ale#node#Executable(a:buffer, l:executable) \ . ale#Pad(l:options) \ . (!empty(l:config) ? ' -c ' . ale#Escape(l:config) : '') \ . ' --fix %t', \ 'read_temporary_file': 1, \} endfunction ale-4.0.0/autoload/ale/fixers/fecs.vim000066400000000000000000000006661476501472200176020ustar00rootroot00000000000000" Author: harttle " Description: Apply fecs format to a file. function! ale#fixers#fecs#Fix(buffer) abort let l:executable = ale#handlers#fecs#GetExecutable(a:buffer) if !executable(l:executable) return 0 endif let l:config_options = ' format --replace=true %t' return { \ 'command': ale#Escape(l:executable) . l:config_options, \ 'read_temporary_file': 1, \} endfunction ale-4.0.0/autoload/ale/fixers/fish_indent.vim000066400000000000000000000012151476501472200211430ustar00rootroot00000000000000" Author: Chen YuanYuan " Description: Integration of fish_indent with ALE. call ale#Set('fish_fish_indent_executable', 'fish_indent') call ale#Set('fish_fish_indent_options', '') function! ale#fixers#fish_indent#Fix(buffer) abort let l:executable = ale#Var(a:buffer, 'fish_fish_indent_executable') let l:options = ale#Var(a:buffer, 'fish_fish_indent_options') let l:filename = ale#Escape(bufname(a:buffer)) return { \ 'command': ale#Escape(l:executable) \ . ' -w ' \ . (empty(l:options) ? '' : ' ' . l:options) \ . ' %t', \ 'read_temporary_file': 1, \} endfunction ale-4.0.0/autoload/ale/fixers/fixjson.vim000066400000000000000000000015751476501472200203420ustar00rootroot00000000000000" Author: rhysd " Description: Integration of fixjson with ALE. call ale#Set('json_fixjson_executable', 'fixjson') call ale#Set('json_fixjson_options', '') call ale#Set('json_fixjson_use_global', get(g:, 'ale_use_global_executables', 0)) function! ale#fixers#fixjson#GetExecutable(buffer) abort return ale#path#FindExecutable(a:buffer, 'json_fixjson', [ \ 'node_modules/.bin/fixjson', \]) endfunction function! ale#fixers#fixjson#Fix(buffer) abort let l:executable = ale#Escape(ale#fixers#fixjson#GetExecutable(a:buffer)) let l:filename = ale#Escape(bufname(a:buffer)) let l:command = l:executable . ' --stdin-filename ' . l:filename let l:options = ale#Var(a:buffer, 'json_fixjson_options') if l:options isnot# '' let l:command .= ' ' . l:options endif return { \ 'command': l:command \} endfunction ale-4.0.0/autoload/ale/fixers/floskell.vim000066400000000000000000000011471476501472200204700ustar00rootroot00000000000000" Author: robertjlooby " Description: Integration of floskell with ALE. call ale#Set('haskell_floskell_executable', 'floskell') function! ale#fixers#floskell#GetExecutable(buffer) abort let l:executable = ale#Var(a:buffer, 'haskell_floskell_executable') return ale#handlers#haskell_stack#EscapeExecutable(l:executable, 'floskell') endfunction function! ale#fixers#floskell#Fix(buffer) abort let l:executable = ale#fixers#floskell#GetExecutable(a:buffer) return { \ 'command': l:executable \ . ' %t', \ 'read_temporary_file': 1, \} endfunction ale-4.0.0/autoload/ale/fixers/forge.vim000066400000000000000000000004561476501472200177610ustar00rootroot00000000000000call ale#Set('solidity_forge_executable', 'forge') function! ale#fixers#forge#Fix(buffer) abort let l:executable = ale#Var(a:buffer, 'solidity_forge_executable') return { \ 'command': ale#Escape(l:executable) \ . ' fmt %t', \ 'read_temporary_file': 1, \} endfunction ale-4.0.0/autoload/ale/fixers/fourmolu.vim000066400000000000000000000012701476501472200205220ustar00rootroot00000000000000call ale#Set('haskell_fourmolu_executable', 'fourmolu') call ale#Set('haskell_fourmolu_options', '') function! ale#fixers#fourmolu#GetExecutable(buffer) abort let l:executable = ale#Var(a:buffer, 'haskell_fourmolu_executable') return ale#handlers#haskell_stack#EscapeExecutable(l:executable, 'fourmolu') endfunction function! ale#fixers#fourmolu#Fix(buffer) abort let l:executable = ale#fixers#fourmolu#GetExecutable(a:buffer) let l:options = ale#Var(a:buffer, 'haskell_fourmolu_options') return { \ 'command': l:executable \ . (empty(l:options) ? '' : ' ' . l:options) \ . ' --stdin-input-file ' \ . ale#Escape(@%), \} endfunction ale-4.0.0/autoload/ale/fixers/generic.vim000066400000000000000000000013011476501472200202610ustar00rootroot00000000000000" Author: w0rp " Description: Generic functions for fixing files with. function! ale#fixers#generic#RemoveTrailingBlankLines(buffer, lines) abort let l:end_index = len(a:lines) - 1 while l:end_index > 0 && empty(a:lines[l:end_index]) let l:end_index -= 1 endwhile return a:lines[:l:end_index] endfunction " Remove all whitespaces at the end of lines function! ale#fixers#generic#TrimWhitespace(buffer, lines) abort let l:index = 0 let l:lines_new = range(len(a:lines)) for l:line in a:lines let l:lines_new[l:index] = substitute(l:line, '\s\+$', '', 'g') let l:index = l:index + 1 endfor return l:lines_new endfunction ale-4.0.0/autoload/ale/fixers/generic_python.vim000066400000000000000000000046541476501472200217000ustar00rootroot00000000000000" Author: w0rp " Description: Generic fixer functions for Python. " Add blank lines before control statements. function! ale#fixers#generic_python#AddLinesBeforeControlStatements(buffer, lines) abort let l:new_lines = [] let l:last_indent_size = 0 let l:last_line_is_blank = 0 let l:in_docstring = 0 for l:line in a:lines let l:indent_size = len(matchstr(l:line, '^ *')) if !l:in_docstring " Make sure it is not just a single line docstring and then verify " it's starting a new docstring if match(l:line, '\v^ *("""|'''''').*("""|'''''')') == -1 \&& match(l:line, '\v^ *("""|'''''')') >= 0 let l:in_docstring = 1 endif else if match(l:line, '\v^ *.*("""|'''''')') >= 0 let l:in_docstring = 0 endif endif if !l:last_line_is_blank \&& !l:in_docstring \&& l:indent_size <= l:last_indent_size \&& match(l:line, '\v^ *(return|if|for|while|break|continue)(\(| |$)') >= 0 call add(l:new_lines, '') endif call add(l:new_lines, l:line) let l:last_indent_size = l:indent_size let l:last_line_is_blank = empty(split(l:line)) endfor return l:new_lines endfunction " This function breaks up long lines so that autopep8 or other tools can " fix the badly-indented code which is produced as a result. function! ale#fixers#generic_python#BreakUpLongLines(buffer, lines) abort " Default to a maximum line length of 79 let l:max_line_length = 79 let l:conf = ale#path#FindNearestFile(a:buffer, 'setup.cfg') " Read the maximum line length from setup.cfg if !empty(l:conf) for l:match in ale#util#GetMatches( \ readfile(l:conf), \ '\v^ *max-line-length *\= *(\d+)', \) let l:max_line_length = str2nr(l:match[1]) endfor endif let l:new_list = [] for l:line in a:lines if len(l:line) > l:max_line_length && l:line !~# '# *noqa' let l:line = substitute(l:line, '\v([(,])([^)])', '\1\n\2', 'g') let l:line = substitute(l:line, '\v([^(])([)])', '\1,\n\2', 'g') for l:split_line in split(l:line, "\n") call add(l:new_list, l:split_line) endfor else call add(l:new_list, l:line) endif endfor return l:new_list endfunction ale-4.0.0/autoload/ale/fixers/gleam_format.vim000066400000000000000000000011031476501472200213020ustar00rootroot00000000000000" Author: Jonathan Palardt https://github.com/jpalardy " Description: Integration of 'gleam format' with ALE. call ale#Set('gleam_format_executable', 'gleam') function! ale#fixers#gleam_format#GetExecutable(buffer) abort let l:executable = ale#Var(a:buffer, 'gleam_format_executable') return ale#Escape(l:executable) endfunction function! ale#fixers#gleam_format#Fix(buffer) abort let l:executable = ale#fixers#gleam_format#GetExecutable(a:buffer) return { \ 'command': l:executable . ' format %t', \ 'read_temporary_file': 1, \} endfunction ale-4.0.0/autoload/ale/fixers/gnatpp.vim000066400000000000000000000010071476501472200201410ustar00rootroot00000000000000" Author: tim " Description: Fix files with gnatpp. call ale#Set('ada_gnatpp_executable', 'gnatpp') call ale#Set('ada_gnatpp_options', '') function! ale#fixers#gnatpp#Fix(buffer) abort let l:executable = ale#Var(a:buffer, 'ada_gnatpp_executable') let l:options = ale#Var(a:buffer, 'ada_gnatpp_options') return { \ 'command': ale#Escape(l:executable) \ . (!empty(l:options) ? ' ' . l:options : '') \ . ' %t', \ 'read_temporary_file': 1, \} endfunction ale-4.0.0/autoload/ale/fixers/gofmt.vim000066400000000000000000000010011476501472200177560ustar00rootroot00000000000000" Author: aliou " Description: Integration of gofmt with ALE. call ale#Set('go_gofmt_executable', 'gofmt') call ale#Set('go_gofmt_options', '') function! ale#fixers#gofmt#Fix(buffer) abort let l:executable = ale#Var(a:buffer, 'go_gofmt_executable') let l:options = ale#Var(a:buffer, 'go_gofmt_options') let l:env = ale#go#EnvString(a:buffer) return { \ 'command': l:env . ale#Escape(l:executable) \ . (empty(l:options) ? '' : ' ' . l:options) \} endfunction ale-4.0.0/autoload/ale/fixers/gofumpt.vim000066400000000000000000000010101476501472200203230ustar00rootroot00000000000000" Author: David Houston " Description: A stricter gofmt implementation. call ale#Set('go_gofumpt_executable', 'gofumpt') call ale#Set('go_gofumpt_options', '') function! ale#fixers#gofumpt#Fix(buffer) abort let l:executable = ale#Var(a:buffer, 'go_gofumpt_executable') let l:options = ale#Var(a:buffer, 'go_gofumpt_options') return { \ 'command': ale#Escape(l:executable) \ . ale#Pad(l:options) \ . ' -w -- %t', \ 'read_temporary_file': 1, \} endfunction ale-4.0.0/autoload/ale/fixers/goimports.vim000066400000000000000000000013041476501472200206730ustar00rootroot00000000000000" Author: Jeff Willette " Description: Integration of goimports with ALE. call ale#Set('go_goimports_executable', 'goimports') call ale#Set('go_goimports_options', '') function! ale#fixers#goimports#Fix(buffer) abort let l:executable = ale#Var(a:buffer, 'go_goimports_executable') let l:options = ale#Var(a:buffer, 'go_goimports_options') let l:env = ale#go#EnvString(a:buffer) if !executable(l:executable) return 0 endif return { \ 'command': l:env . ale#Escape(l:executable) \ . ' -l -w -srcdir %s' \ . (empty(l:options) ? '' : ' ' . l:options) \ . ' %t', \ 'read_temporary_file': 1, \} endfunction ale-4.0.0/autoload/ale/fixers/golangci_lint.vim000066400000000000000000000020661476501472200214670ustar00rootroot00000000000000" Author: Ian Stapleton Cordasco " Description: Run golangci-lint with the --fix flag to autofix some issues call ale#Set('go_golangci_lint_options', '') call ale#Set('go_golangci_lint_executable', 'golangci-lint') call ale#Set('go_golangci_lint_package', 1) function! ale#fixers#golangci_lint#GetCommand(buffer) abort let l:filename = expand('#' . a:buffer . ':t') let l:executable = ale#Var(a:buffer, 'go_golangci_lint_executable') 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) if l:package_mode return l:env . ale#Escape(l:executable) \ . ' run ' \ . l:options endif return l:env . ale#Escape(l:executable) \ . ' run ' \ . l:options \ . ' ' . ale#Escape(l:filename) endfunction function! ale#fixers#golangci_lint#Fix(buffer) abort return { \ 'command': ale#fixers#golangci_lint#GetCommand(a:buffer), \} endfunction ale-4.0.0/autoload/ale/fixers/golines.vim000066400000000000000000000011371476501472200203140ustar00rootroot00000000000000" Author Pig Frown " Description: Fix Go files long lines with golines" call ale#Set('go_golines_executable', 'golines') call ale#Set('go_golines_options', '') function! ale#fixers#golines#Fix(buffer) abort let l:executable = ale#Var(a:buffer, 'go_golines_executable') let l:options = ale#Var(a:buffer, 'go_golines_options') let l:env = ale#go#EnvString(a:buffer) if !executable(l:executable) return 0 endif return { \ 'command': l:env . ale#Escape(l:executable) \ . (empty(l:options) ? '' : ' ' . l:options) \} endfunction ale-4.0.0/autoload/ale/fixers/gomod.vim000066400000000000000000000005131476501472200177560ustar00rootroot00000000000000call ale#Set('go_go_executable', 'go') function! ale#fixers#gomod#Fix(buffer) abort let l:executable = ale#Var(a:buffer, 'go_go_executable') let l:env = ale#go#EnvString(a:buffer) return { \ 'command': l:env . ale#Escape(l:executable) . ' mod edit -fmt %t', \ 'read_temporary_file': 1, \} endfunction ale-4.0.0/autoload/ale/fixers/google_java_format.vim000066400000000000000000000014541476501472200225030ustar00rootroot00000000000000" Author: butlerx " Description: Integration of Google-java-format with ALE. call ale#Set('java_google_java_format_executable', 'google-java-format') call ale#Set('java_google_java_format_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('java_google_java_format_options', '') function! ale#fixers#google_java_format#Fix(buffer) abort let l:options = ale#Var(a:buffer, 'java_google_java_format_options') let l:executable = ale#Var(a:buffer, 'java_google_java_format_executable') if !executable(l:executable) return 0 endif return { \ 'command': ale#Escape(l:executable) \ . ' ' . (empty(l:options) ? '' : ' ' . l:options) \ . ' --replace' \ . ' %t', \ 'read_temporary_file': 1, \} endfunction ale-4.0.0/autoload/ale/fixers/gopls.vim000066400000000000000000000012371476501472200200010ustar00rootroot00000000000000" Author: Sean Enck " Description: Integration of gopls format with ALE. call ale#Set('go_gopls_fix_executable', 'gopls') call ale#Set('go_gopls_fix_options', '') function! ale#fixers#gopls#Fix(buffer) abort let l:executable = ale#Var(a:buffer, 'go_gopls_fix_executable') let l:options = ale#Var(a:buffer, 'go_gopls_fix_options') let l:env = ale#go#EnvString(a:buffer) if !executable(l:executable) return 0 endif return { \ 'command': l:env . ale#Escape(l:executable) \ . ' format' \ . ale#Pad(l:options) \ . ' -l -w %t', \ 'read_temporary_file': 1, \} endfunction ale-4.0.0/autoload/ale/fixers/hackfmt.vim000066400000000000000000000010701476501472200202650ustar00rootroot00000000000000" Author: Sam Howie " Description: Integration of hackfmt with ALE. call ale#Set('hack_hackfmt_executable', 'hackfmt') call ale#Set('hack_hackfmt_options', '') function! ale#fixers#hackfmt#Fix(buffer) abort let l:executable = ale#Var(a:buffer, 'hack_hackfmt_executable') let l:options = ale#Var(a:buffer, 'hack_hackfmt_options') return { \ 'command': ale#Escape(l:executable) \ . ' -i' \ . (empty(l:options) ? '' : ' ' . l:options) \ . ' %t', \ 'read_temporary_file': 1, \} endfunction ale-4.0.0/autoload/ale/fixers/help.vim000066400000000000000000000012521476501472200176020ustar00rootroot00000000000000" Author: w0rp " Description: Generic fixer functions for Vim help documents. function! ale#fixers#help#AlignTags(buffer, lines) abort let l:new_lines = [] for l:line in a:lines if len(l:line) != 79 let l:match = matchlist(l:line, '\v +(\*[^*]+\*)$') if !empty(l:match) let l:start = l:line[:-len(l:match[0]) - 1] let l:tag = l:match[1] let l:spaces = repeat(' ', 79 - len(l:start) - len(l:tag)) let l:line = l:start . l:spaces . l:tag endif endif call add(l:new_lines, l:line) endfor return l:new_lines endfunction ale-4.0.0/autoload/ale/fixers/hfmt.vim000066400000000000000000000006631476501472200176150ustar00rootroot00000000000000" Author: zack " Description: Integration of hfmt with ALE. call ale#Set('haskell_hfmt_executable', 'hfmt') function! ale#fixers#hfmt#Fix(buffer) abort let l:executable = ale#Var(a:buffer, 'haskell_hfmt_executable') return { \ 'command': ale#handlers#haskell_stack#EscapeExecutable(l:executable, 'hfmt') \ . ' -w' \ . ' %t', \ 'read_temporary_file': 1, \} endfunction ale-4.0.0/autoload/ale/fixers/hindent.vim000066400000000000000000000011521476501472200203020ustar00rootroot00000000000000" Author: AlexeiDrake " Description: Integration of hindent formatting with ALE. " call ale#Set('haskell_hindent_executable', 'hindent') function! ale#fixers#hindent#GetExecutable(buffer) abort let l:executable = ale#Var(a:buffer, 'haskell_hindent_executable') return ale#handlers#haskell_stack#EscapeExecutable(l:executable, 'hindent') endfunction function! ale#fixers#hindent#Fix(buffer) abort let l:executable = ale#fixers#hindent#GetExecutable(a:buffer) return { \ 'command': l:executable \ . ' %t', \ 'read_temporary_file': 1, \} endfunction ale-4.0.0/autoload/ale/fixers/hlint.vim000066400000000000000000000005611476501472200177720ustar00rootroot00000000000000" Author: eborden " Description: Integration of hlint refactor with ALE. " function! ale#fixers#hlint#Fix(buffer) abort return { \ 'command': ale#handlers#hlint#GetExecutable(a:buffer) \ . ' --refactor' \ . ' --refactor-options="--inplace"' \ . ' %t', \ 'read_temporary_file': 1, \} endfunction ale-4.0.0/autoload/ale/fixers/html_beautify.vim000066400000000000000000000011571476501472200215120ustar00rootroot00000000000000" Author: WhyNotHugo " Description: Format HTML files with html-beautify. call ale#Set('html_beautify_executable', 'html-beautify') call ale#Set('html_beautify_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('html_beautify_options', '') function! ale#fixers#html_beautify#Fix(buffer) abort let l:executable = ale#python#FindExecutable( \ a:buffer, \ 'html_beautify', \ ['html-beautify'] \) let l:options = ale#Var(a:buffer, 'html_beautify_options') return { \ 'command': ale#Escape(l:executable) . ' ' . l:options . ' -', \} endfunction ale-4.0.0/autoload/ale/fixers/htmlbeautifier.vim000066400000000000000000000006721476501472200216630ustar00rootroot00000000000000" Author: Arash Mousavi " Description: Support for HTML Beautifier https://github.com/threedaymonk/htmlbeautifier call ale#Set('eruby_htmlbeautifier_executable', 'htmlbeautifier') function! ale#fixers#htmlbeautifier#Fix(buffer) abort let l:executable = ale#Var(a:buffer, 'eruby_htmlbeautifier_executable') return { \ 'command': ale#Escape(l:executable) . ' %t', \ 'read_temporary_file': 1, \} endfunction ale-4.0.0/autoload/ale/fixers/hurlfmt.vim000066400000000000000000000006031476501472200203320ustar00rootroot00000000000000call ale#Set('hurl_hurlfmt_executable', 'hurlfmt') function! ale#fixers#hurlfmt#GetCommand(buffer) abort let l:executable = ale#Var(a:buffer, 'hurl_hurlfmt_executable') return ale#Escape(l:executable) \ . ' --out hurl' endfunction function! ale#fixers#hurlfmt#Fix(buffer) abort return { \ 'command': ale#fixers#hurlfmt#GetCommand(a:buffer) \} endfunction ale-4.0.0/autoload/ale/fixers/importjs.vim000066400000000000000000000013161476501472200205220ustar00rootroot00000000000000" Author: Jeff Willette " Description: Integration of importjs with ALE. call ale#Set('javascript_importjs_executable', 'importjs') function! ale#fixers#importjs#ProcessOutput(buffer, output) abort let l:result = ale#util#FuzzyJSONDecode(a:output, []) return split(get(l:result, 'fileContent', ''), "\n") endfunction function! ale#fixers#importjs#Fix(buffer) abort let l:executable = ale#Var(a:buffer, 'javascript_importjs_executable') if !executable(l:executable) return 0 endif return { \ 'command': ale#Escape(l:executable) \ . ' fix' \ . ' %s', \ 'process_with': 'ale#fixers#importjs#ProcessOutput', \} endfunction ale-4.0.0/autoload/ale/fixers/isort.vim000066400000000000000000000044451476501472200200210ustar00rootroot00000000000000" Author: w0rp " Description: Fixing Python imports with isort. call ale#Set('python_isort_executable', 'isort') call ale#Set('python_isort_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('python_isort_options', '') call ale#Set('python_isort_auto_pipenv', 0) call ale#Set('python_isort_auto_poetry', 0) call ale#Set('python_isort_auto_uv', 0) function! ale#fixers#isort#GetExecutable(buffer) abort if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_isort_auto_pipenv')) \ && ale#python#PipenvPresent(a:buffer) return 'pipenv' endif if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_isort_auto_poetry')) \ && ale#python#PoetryPresent(a:buffer) return 'poetry' endif if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_isort_auto_uv')) \ && ale#python#UvPresent(a:buffer) return 'uv' endif return ale#python#FindExecutable(a:buffer, 'python_isort', ['isort']) endfunction function! ale#fixers#isort#GetCmd(buffer) abort let l:executable = ale#fixers#isort#GetExecutable(a:buffer) let l:cmd = [ale#Escape(l:executable)] if l:executable =~? '\(pipenv\|poetry\|uv\)$' call extend(l:cmd, ['run', 'isort']) endif return join(l:cmd, ' ') endfunction function! ale#fixers#isort#FixForVersion(buffer, version) abort let l:executable = ale#fixers#isort#GetExecutable(a:buffer) let l:cmd = [ale#Escape(l:executable)] if l:executable =~? '\(pipenv\|poetry\|uv\)$' call extend(l:cmd, ['run', 'isort']) endif if ale#semver#GTE(a:version, [5, 7, 0]) call add(l:cmd, '--filename %s') endif let l:options = ale#Var(a:buffer, 'python_isort_options') if !empty(l:options) call add(l:cmd, l:options) endif call add(l:cmd, '-') return { \ 'cwd': '%s:h', \ 'command': join(l:cmd, ' '), \} endfunction function! ale#fixers#isort#Fix(buffer) abort let l:executable = ale#fixers#isort#GetExecutable(a:buffer) let l:command = ale#fixers#isort#GetCmd(a:buffer) . ale#Pad('--version') return ale#semver#RunWithVersionCheck( \ a:buffer, \ l:executable, \ l:command, \ function('ale#fixers#isort#FixForVersion'), \) endfunction ale-4.0.0/autoload/ale/fixers/jq.vim000066400000000000000000000011271476501472200172650ustar00rootroot00000000000000call ale#Set('json_jq_executable', 'jq') call ale#Set('json_jq_options', '') call ale#Set('json_jq_filters', '.') function! ale#fixers#jq#GetExecutable(buffer) abort return ale#Var(a:buffer, 'json_jq_executable') endfunction function! ale#fixers#jq#Fix(buffer) abort let l:options = ale#Var(a:buffer, 'json_jq_options') let l:filters = ale#Var(a:buffer, 'json_jq_filters') if empty(l:filters) return 0 endif return { \ 'command': ale#Escape(ale#fixers#jq#GetExecutable(a:buffer)) \ . ' ' . l:filters . ' ' \ . l:options, \} endfunction ale-4.0.0/autoload/ale/fixers/json_pytool.vim000066400000000000000000000013321476501472200212300ustar00rootroot00000000000000" Author: idbrii " Description: json formatter as ALE fixer using python's json.tool call ale#Set('json_pytool_executable', 'python') call ale#Set('json_pytool_options', '') call ale#Set('json_pytool_use_global', get(g:, 'ale_use_global_executables', 0)) function! ale#fixers#json_pytool#GetExecutable(buffer) abort return ale#path#FindExecutable(a:buffer, 'json_pytool', ['python']) endfunction function! ale#fixers#json_pytool#Fix(buffer) abort let l:executable = ale#Escape(ale#fixers#json_pytool#GetExecutable(a:buffer)) let l:opts = ale#Var(a:buffer, 'json_pytool_options') let l:command = printf('%s -m json.tool %s -', l:executable, l:opts) return { \ 'command': l:command \ } endfunction ale-4.0.0/autoload/ale/fixers/jsonnetfmt.vim000066400000000000000000000011611476501472200210400ustar00rootroot00000000000000" Authors: Trevor Whitney and Takuya Kosugiyama " Description: Integration of jsonnetfmt with ALE. call ale#Set('jsonnet_jsonnetfmt_executable', 'jsonnetfmt') call ale#Set('jsonnet_jsonnetfmt_options', '') function! ale#fixers#jsonnetfmt#Fix(buffer) abort let l:executable = ale#Var(a:buffer, 'jsonnet_jsonnetfmt_executable') let l:options = ale#Var(a:buffer, 'jsonnet_jsonnetfmt_options') return { \ 'command': ale#Escape(l:executable) \ . ' -i' \ . ale#Pad(l:options) \ . ' %t', \ 'read_temporary_file': 1, \} endfunction ale-4.0.0/autoload/ale/fixers/ktlint.vim000066400000000000000000000004011476501472200201520ustar00rootroot00000000000000" Author: Michael Phillips " Description: Fix Kotlin files with ktlint. function! ale#fixers#ktlint#Fix(buffer) abort return { \ 'command': ale#handlers#ktlint#GetCommand(a:buffer) . ' --format' \} endfunction ale-4.0.0/autoload/ale/fixers/latexindent.vim000066400000000000000000000010471476501472200211730ustar00rootroot00000000000000" Author: riley-martine " Description: Integration of latexindent with ALE. call ale#Set('tex_latexindent_executable', 'latexindent') call ale#Set('tex_latexindent_options', '') function! ale#fixers#latexindent#Fix(buffer) abort let l:executable = ale#Var(a:buffer, 'tex_latexindent_executable') let l:options = ale#Var(a:buffer, 'tex_latexindent_options') return { \ 'command': ale#Escape(l:executable) \ . ' -l' \ . (empty(l:options) ? '' : ' ' . l:options) \} endfunction ale-4.0.0/autoload/ale/fixers/lua_format.vim000066400000000000000000000010061476501472200210000ustar00rootroot00000000000000" Author: Mathias Jean Johansen " Description: Integration of LuaFormatter with ALE. call ale#Set('lua_lua_format_executable', 'lua-format') call ale#Set('lua_lua_format_options', '') function! ale#fixers#lua_format#Fix(buffer) abort let l:executable = ale#Var(a:buffer, 'lua_lua_format_executable') let l:options = ale#Var(a:buffer, 'lua_lua_format_options') return { \ 'command': ale#Escape(l:executable) \ . ale#Pad(l:options) \ . ' -i', \} endfunction ale-4.0.0/autoload/ale/fixers/luafmt.vim000066400000000000000000000006431476501472200201450ustar00rootroot00000000000000call ale#Set('lua_luafmt_executable', 'luafmt') call ale#Set('lua_luafmt_options', '') function! ale#fixers#luafmt#Fix(buffer) abort let l:executable = ale#Var(a:buffer, 'lua_luafmt_executable') let l:options = ale#Var(a:buffer, 'lua_luafmt_options') return { \ 'command': ale#Escape(l:executable) \ . (empty(l:options) ? '' : ' ' . l:options) \ . ' --stdin', \} endfunction ale-4.0.0/autoload/ale/fixers/mix_format.vim000066400000000000000000000015421476501472200210210ustar00rootroot00000000000000" Author: carakan , Fernando Mendes " Description: Fixing files with elixir formatter 'mix format'. call ale#Set('elixir_mix_executable', 'mix') call ale#Set('elixir_mix_format_options', '') function! ale#fixers#mix_format#GetExecutable(buffer) abort return ale#Var(a:buffer, 'elixir_mix_executable') endfunction function! ale#fixers#mix_format#GetCommand(buffer) abort let l:executable = ale#Escape(ale#fixers#mix_format#GetExecutable(a:buffer)) let l:options = ale#Var(a:buffer, 'elixir_mix_format_options') return l:executable . ' format' \ . (!empty(l:options) ? ' ' . l:options : '') \ . ' %t' endfunction function! ale#fixers#mix_format#Fix(buffer) abort return { \ 'command': ale#fixers#mix_format#GetCommand(a:buffer), \ 'read_temporary_file': 1, \} endfunction ale-4.0.0/autoload/ale/fixers/nickel_format.vim000066400000000000000000000010531476501472200214660ustar00rootroot00000000000000" Author: Yining " Description: nickel format as ALE fixer for Nickel files call ale#Set('nickel_nickel_format_executable', 'nickel') call ale#Set('nickel_nickel_format_options', '') function! ale#fixers#nickel_format#Fix(buffer) abort let l:executable = ale#Var(a:buffer, 'nickel_nickel_format_executable') let l:options = ale#Var(a:buffer, 'nickel_nickel_format_options') return { \ 'command': ale#Escape(l:executable) . ' format' \ . (empty(l:options) ? '' : ' ' . l:options) \} endfunction ale-4.0.0/autoload/ale/fixers/nimpretty.vim000066400000000000000000000010041476501472200207000ustar00rootroot00000000000000" Author: Nhan " Description: Integration of nimpretty with ALE. call ale#Set('nim_nimpretty_executable', 'nimpretty') call ale#Set('nim_nimpretty_options', '--maxLineLen:80') function! ale#fixers#nimpretty#Fix(buffer) abort let l:executable = ale#Var(a:buffer, 'nim_nimpretty_executable') let l:options = ale#Var(a:buffer, 'nim_nimpretty_options') return { \ 'command': ale#Escape(l:executable) . ' %t' . ale#Pad(l:options), \ 'read_temporary_file': 1, \} endfunction ale-4.0.0/autoload/ale/fixers/nixfmt.vim000066400000000000000000000007171476501472200201640ustar00rootroot00000000000000scriptencoding utf-8 " Author: houstdav000 " Description: Fix files with nixfmt call ale#Set('nix_nixfmt_executable', 'nixfmt') call ale#Set('nix_nixfmt_options', '') function! ale#fixers#nixfmt#Fix(buffer) abort let l:executable = ale#Var(a:buffer, 'nix_nixfmt_executable') let l:options = ale#Var(a:buffer, 'nix_nixfmt_options') return { \ 'command': ale#Escape(l:executable) . ale#Pad(l:options), \} endfunction ale-4.0.0/autoload/ale/fixers/nixpkgsfmt.vim000066400000000000000000000006431476501472200210470ustar00rootroot00000000000000call ale#Set('nix_nixpkgsfmt_executable', 'nixpkgs-fmt') call ale#Set('nix_nixpkgsfmt_options', '') function! ale#fixers#nixpkgsfmt#Fix(buffer) abort let l:executable = ale#Var(a:buffer, 'nix_nixpkgsfmt_executable') let l:options = ale#Var(a:buffer, 'nix_nixpkgsfmt_options') return { \ 'command': ale#Escape(l:executable) \ . (empty(l:options) ? '' : ' ' . l:options), \} endfunction ale-4.0.0/autoload/ale/fixers/npmgroovylint.vim000066400000000000000000000010571476501472200216040ustar00rootroot00000000000000" Author: lucas-str " Description: Integration of npm-groovy-lint for Groovy files. call ale#Set('groovy_npmgroovylint_fix_options', '--fix') function! ale#fixers#npmgroovylint#Fix(buffer) abort let l:executable = ale#Var(a:buffer, 'groovy_npmgroovylint_executable') let l:options = ale#Var(a:buffer, 'groovy_npmgroovylint_fix_options') return { \ 'command': ale#Escape(l:executable) \ . (!empty(l:options) ? ' ' . l:options : '') \ . ' %t', \ 'read_temporary_file': 1, \} endfunction ale-4.0.0/autoload/ale/fixers/ocamlformat.vim000066400000000000000000000010631476501472200211560ustar00rootroot00000000000000" Author: Stephen Lumenta <@sbl> " Description: Integration of ocamlformat with ALE. call ale#Set('ocaml_ocamlformat_executable', 'ocamlformat') call ale#Set('ocaml_ocamlformat_options', '') function! ale#fixers#ocamlformat#Fix(buffer) abort let l:executable = ale#Var(a:buffer, 'ocaml_ocamlformat_executable') let l:options = ale#Var(a:buffer, 'ocaml_ocamlformat_options') return { \ 'command': ale#Escape(l:executable) \ . (empty(l:options) ? '' : ' ' . l:options) \ . ' --name=%s' \ . ' -' \} endfunction ale-4.0.0/autoload/ale/fixers/ocp_indent.vim000066400000000000000000000012561476501472200210000ustar00rootroot00000000000000" Author: Kanenobu Mitsuru " Description: Integration of ocp-indent with ALE. call ale#Set('ocaml_ocp_indent_executable', 'ocp-indent') call ale#Set('ocaml_ocp_indent_options', '') call ale#Set('ocaml_ocp_indent_config', '') function! ale#fixers#ocp_indent#Fix(buffer) abort let l:executable = ale#Var(a:buffer, 'ocaml_ocp_indent_executable') let l:config = ale#Var(a:buffer, 'ocaml_ocp_indent_config') let l:options = ale#Var(a:buffer, 'ocaml_ocp_indent_options') return { \ 'command': ale#Escape(l:executable) \ . (empty(l:config) ? '' : ' --config=' . ale#Escape(l:config)) \ . (empty(l:options) ? '': ' ' . l:options) \} endfunction ale-4.0.0/autoload/ale/fixers/opafmt.vim000066400000000000000000000006641476501472200201460ustar00rootroot00000000000000" Description: Fixer for rego files call ale#Set('opa_fmt_executable', 'opa') call ale#Set('opa_fmt_options', '') function! ale#fixers#opafmt#Fix(buffer) abort let l:executable = ale#Var(a:buffer, 'opa_fmt_executable') let l:options = ale#Var(a:buffer, 'opa_fmt_options') return { \ 'command': ale#Escape(l:executable) \ . ' fmt' \ . (empty(l:options) ? '' : ' ' . l:options) \} endfunction ale-4.0.0/autoload/ale/fixers/ormolu.vim000066400000000000000000000006321476501472200201700ustar00rootroot00000000000000call ale#Set('haskell_ormolu_executable', 'ormolu') call ale#Set('haskell_ormolu_options', '') function! ale#fixers#ormolu#Fix(buffer) abort let l:executable = ale#Var(a:buffer, 'haskell_ormolu_executable') let l:options = ale#Var(a:buffer, 'haskell_ormolu_options') return { \ 'command': ale#Escape(l:executable) \ . (empty(l:options) ? '' : ' ' . l:options), \} endfunction ale-4.0.0/autoload/ale/fixers/packer.vim000066400000000000000000000010061476501472200201140ustar00rootroot00000000000000" Author: Zhuoyun Wei " Description: Fixer for Packer HCL files call ale#Set('packer_fmt_executable', 'packer') call ale#Set('packer_fmt_options', '') function! ale#fixers#packer#Fix(buffer) abort let l:executable = ale#Var(a:buffer, 'packer_fmt_executable') let l:options = ale#Var(a:buffer, 'packer_fmt_options') return { \ 'command': ale#Escape(l:executable) \ . ' fmt' \ . (empty(l:options) ? '' : ' ' . l:options) \ . ' -' \} endfunction ale-4.0.0/autoload/ale/fixers/pandoc.vim000066400000000000000000000010141476501472200201120ustar00rootroot00000000000000scriptencoding utf-8 " Author: Jesse Hathaway " Description: Fix markdown files with pandoc. call ale#Set('markdown_pandoc_executable', 'pandoc') call ale#Set('markdown_pandoc_options', '-f gfm -t gfm -s -') function! ale#fixers#pandoc#Fix(buffer) abort let l:executable = ale#Var(a:buffer, 'markdown_pandoc_executable') let l:options = ale#Var(a:buffer, 'markdown_pandoc_options') return { \ 'command': ale#Escape(l:executable) \ . ' ' . l:options, \} endfunction ale-4.0.0/autoload/ale/fixers/perltidy.vim000066400000000000000000000010751476501472200205110ustar00rootroot00000000000000" Author: kfly8 " Description: Integration of perltidy with ALE. call ale#Set('perl_perltidy_executable', 'perltidy') call ale#Set('perl_perltidy_options', '') function! ale#fixers#perltidy#Fix(buffer) abort let l:executable = ale#Var(a:buffer, 'perl_perltidy_executable') let l:options = ale#Var(a:buffer, 'perl_perltidy_options') return { \ 'command': ale#Escape(l:executable) \ . ' -b' \ . (empty(l:options) ? '' : ' ' . l:options) \ . ' %t', \ 'read_temporary_file': 1, \} endfunction ale-4.0.0/autoload/ale/fixers/pgformatter.vim000066400000000000000000000006461476501472200212120ustar00rootroot00000000000000call ale#Set('sql_pgformatter_executable', 'pg_format') call ale#Set('sql_pgformatter_options', '') function! ale#fixers#pgformatter#Fix(buffer) abort let l:executable = ale#Var(a:buffer, 'sql_pgformatter_executable') let l:options = ale#Var(a:buffer, 'sql_pgformatter_options') return { \ 'command': ale#Escape(l:executable) \ . (empty(l:options) ? '' : ' ' . l:options), \} endfunction ale-4.0.0/autoload/ale/fixers/php_cs_fixer.vim000066400000000000000000000016221476501472200213240ustar00rootroot00000000000000" Author: Julien Deniau " Description: Fixing files with php-cs-fixer. call ale#Set('php_cs_fixer_executable', 'php-cs-fixer') call ale#Set('php_cs_fixer_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('php_cs_fixer_options', '') call ale#Set('php_cs_fixer_fix_options', '') function! ale#fixers#php_cs_fixer#GetExecutable(buffer) abort return ale#path#FindExecutable(a:buffer, 'php_cs_fixer', [ \ 'vendor/bin/php-cs-fixer', \ 'php-cs-fixer' \]) endfunction function! ale#fixers#php_cs_fixer#Fix(buffer) abort let l:executable = ale#fixers#php_cs_fixer#GetExecutable(a:buffer) return { \ 'command': ale#Escape(l:executable) \ . ' ' . ale#Var(a:buffer, 'php_cs_fixer_options') \ . ' fix ' . ale#Var(a:buffer, 'php_cs_fixer_fix_options') \ . ' %t', \ 'read_temporary_file': 1, \} endfunction ale-4.0.0/autoload/ale/fixers/phpcbf.vim000066400000000000000000000016341476501472200201200ustar00rootroot00000000000000" Author: notomo " Description: Fixing files with phpcbf. call ale#Set('php_phpcbf_standard', '') call ale#Set('php_phpcbf_options', '') call ale#Set('php_phpcbf_executable', 'phpcbf') call ale#Set('php_phpcbf_use_global', get(g:, 'ale_use_global_executables', 0)) function! ale#fixers#phpcbf#GetExecutable(buffer) abort return ale#path#FindExecutable(a:buffer, 'php_phpcbf', [ \ 'vendor/bin/phpcbf', \ 'phpcbf' \]) endfunction function! ale#fixers#phpcbf#Fix(buffer) abort let l:executable = ale#fixers#phpcbf#GetExecutable(a:buffer) let l:standard = ale#Var(a:buffer, 'php_phpcbf_standard') let l:standard_option = !empty(l:standard) \ ? '--standard=' . l:standard \ : '' return { \ 'command': ale#Escape(l:executable) . ' --stdin-path=%s ' . l:standard_option . ale#Pad(ale#Var(a:buffer, 'php_phpcbf_options')) . ' -' \} endfunction ale-4.0.0/autoload/ale/fixers/pint.vim000066400000000000000000000013351476501472200176260ustar00rootroot00000000000000" Author: Michael Dyrynda " Description: Fixing files with Laravel Pint. call ale#Set('php_pint_executable', 'pint') call ale#Set('php_pint_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('php_pint_options', '') function! ale#fixers#pint#GetExecutable(buffer) abort return ale#path#FindExecutable(a:buffer, 'php_pint', [ \ 'vendor/bin/pint', \ 'pint' \]) endfunction function! ale#fixers#pint#Fix(buffer) abort let l:executable = ale#fixers#pint#GetExecutable(a:buffer) return { \ 'command': ale#Escape(l:executable) \ . ' ' . ale#Var(a:buffer, 'php_pint_options') \ . ' %t', \ 'read_temporary_file': 1, \} endfunction ale-4.0.0/autoload/ale/fixers/prettier.vim000066400000000000000000000102161476501472200205100ustar00rootroot00000000000000" Author: tunnckoCore (Charlike Mike Reagent) , " w0rp , morhetz (Pavel Pertsev) " Description: Integration of Prettier with ALE. call ale#Set('javascript_prettier_executable', 'prettier') call ale#Set('javascript_prettier_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('javascript_prettier_options', '') function! ale#fixers#prettier#GetExecutable(buffer) abort return ale#path#FindExecutable(a:buffer, 'javascript_prettier', [ \ 'node_modules/.bin/prettier_d', \ 'node_modules/prettier-cli/index.js', \ 'node_modules/.bin/prettier', \]) endfunction function! ale#fixers#prettier#Fix(buffer) abort return ale#semver#RunWithVersionCheck( \ a:buffer, \ ale#fixers#prettier#GetExecutable(a:buffer), \ '%e --version', \ function('ale#fixers#prettier#ApplyFixForVersion'), \) endfunction function! ale#fixers#prettier#ProcessPrettierDOutput(buffer, output) abort " If the output is an error message, don't use it. for l:line in a:output[:10] if l:line =~# '^\w*Error:' return [] endif endfor return a:output endfunction function! ale#fixers#prettier#GetCwd(buffer) abort let l:config = ale#path#FindNearestFile(a:buffer, '.prettierignore') " Fall back to the directory of the buffer return !empty(l:config) ? fnamemodify(l:config, ':h') : '%s:h' endfunction function! ale#fixers#prettier#ApplyFixForVersion(buffer, version) abort let l:executable = ale#fixers#prettier#GetExecutable(a:buffer) let l:options = ale#Var(a:buffer, 'javascript_prettier_options') let l:parser = '' let l:filetypes = split(getbufvar(a:buffer, '&filetype'), '\.') if index(l:filetypes, 'handlebars') > -1 let l:parser = 'glimmer' endif " Append the --parser flag depending on the current filetype (unless it's " already set in g:javascript_prettier_options). if empty(expand('#' . a:buffer . ':e')) && l:parser is# '' && match(l:options, '--parser') == -1 " Mimic Prettier's defaults. In cases without a file extension or " filetype (scratch buffer), Prettier needs `parser` set to know how " to process the buffer. if ale#semver#GTE(a:version, [1, 16, 0]) let l:parser = 'babel' else let l:parser = 'babylon' endif let l:prettier_parsers = { \ 'typescript': 'typescript', \ 'css': 'css', \ 'less': 'less', \ 'scss': 'scss', \ 'json': 'json', \ 'json5': 'json5', \ 'graphql': 'graphql', \ 'markdown': 'markdown', \ 'vue': 'vue', \ 'svelte': 'svelte', \ 'yaml': 'yaml', \ 'openapi': 'yaml', \ 'html': 'html', \ 'ruby': 'ruby', \ 'astro': 'astro', \} for l:filetype in l:filetypes if has_key(l:prettier_parsers, l:filetype) let l:parser = l:prettier_parsers[l:filetype] break endif endfor endif if !empty(l:parser) let l:options = (!empty(l:options) ? l:options . ' ' : '') . '--parser ' . l:parser endif " Special error handling needed for prettier_d if l:executable =~# 'prettier_d$' return { \ 'cwd': '%s:h', \ 'command':ale#Escape(l:executable) \ . (!empty(l:options) ? ' ' . l:options : '') \ . ' --stdin-filepath %s --stdin', \ 'process_with': 'ale#fixers#prettier#ProcessPrettierDOutput', \} endif " 1.4.0 is the first version with --stdin-filepath if ale#semver#GTE(a:version, [1, 4, 0]) return { \ 'cwd': ale#fixers#prettier#GetCwd(a:buffer), \ 'command': ale#Escape(l:executable) \ . (!empty(l:options) ? ' ' . l:options : '') \ . ' --stdin-filepath %s --stdin', \} endif return { \ 'command': ale#Escape(l:executable) \ . ' %t' \ . (!empty(l:options) ? ' ' . l:options : '') \ . ' --write', \ 'read_temporary_file': 1, \} endfunction ale-4.0.0/autoload/ale/fixers/prettier_eslint.vim000066400000000000000000000041231476501472200220660ustar00rootroot00000000000000" Author: tunnckoCore (Charlike Mike Reagent) , " w0rp , morhetz (Pavel Pertsev) " Description: Integration between Prettier and ESLint. call ale#Set('javascript_prettier_eslint_executable', 'prettier-eslint') call ale#Set('javascript_prettier_eslint_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('javascript_prettier_eslint_options', '') function! ale#fixers#prettier_eslint#GetExecutable(buffer) abort return ale#path#FindExecutable(a:buffer, 'javascript_prettier_eslint', [ \ 'node_modules/prettier-eslint-cli/dist/index.js', \ 'node_modules/.bin/prettier-eslint', \]) endfunction function! ale#fixers#prettier_eslint#Fix(buffer) abort return ale#semver#RunWithVersionCheck( \ a:buffer, \ ale#fixers#prettier_eslint#GetExecutable(a:buffer), \ '%e --version', \ function('ale#fixers#prettier_eslint#ApplyFixForVersion'), \) endfunction function! ale#fixers#prettier_eslint#ApplyFixForVersion(buffer, version) abort let l:options = ale#Var(a:buffer, 'javascript_prettier_eslint_options') let l:executable = ale#fixers#prettier_eslint#GetExecutable(a:buffer) " 4.2.0 is the first version with --eslint-config-path let l:config = ale#semver#GTE(a:version, [4, 2, 0]) \ ? ale#handlers#eslint#FindConfig(a:buffer) \ : '' let l:eslint_config_option = !empty(l:config) \ ? ' --eslint-config-path ' . ale#Escape(l:config) \ : '' " 4.4.0 is the first version with --stdin-filepath if ale#semver#GTE(a:version, [4, 4, 0]) return { \ 'cwd': '%s:h', \ 'command': ale#Escape(l:executable) \ . l:eslint_config_option \ . (!empty(l:options) ? ' ' . l:options : '') \ . ' --stdin-filepath %s --stdin', \} endif return { \ 'command': ale#Escape(l:executable) \ . ' %t' \ . l:eslint_config_option \ . (!empty(l:options) ? ' ' . l:options : '') \ . ' --write', \ 'read_temporary_file': 1, \} endfunction ale-4.0.0/autoload/ale/fixers/prettier_standard.vim000066400000000000000000000017011476501472200223670ustar00rootroot00000000000000" Author: sheerun (Adam Stankiewicz) " Description: Integration of Prettier Standard with ALE. call ale#Set('javascript_prettier_standard_executable', 'prettier-standard') call ale#Set('javascript_prettier_standard_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('javascript_prettier_standard_options', '') function! ale#fixers#prettier_standard#GetExecutable(buffer) abort return ale#path#FindExecutable(a:buffer, 'javascript_prettier_standard', [ \ 'node_modules/prettier-standard/lib/index.js', \ 'node_modules/.bin/prettier-standard', \]) endfunction function! ale#fixers#prettier_standard#Fix(buffer) abort let l:options = ale#Var(a:buffer, 'javascript_prettier_standard_options') return { \ 'command': ale#Escape(ale#fixers#prettier_standard#GetExecutable(a:buffer)) \ . ' --stdin' \ . ' --stdin-filepath=%s' \ . ' ' . l:options, \} endfunction ale-4.0.0/autoload/ale/fixers/protolint.vim000066400000000000000000000014171476501472200207070ustar00rootroot00000000000000" Author: Yohei Yoshimuta " Description: Integration of protolint with ALE. call ale#Set('proto_protolint_executable', 'protolint') call ale#Set('proto_protolint_config', '') function! ale#fixers#protolint#GetExecutable(buffer) abort let l:executable = ale#Var(a:buffer, 'proto_protolint_executable') return ale#Escape(l:executable) endfunction function! ale#fixers#protolint#Fix(buffer) abort let l:executable = ale#fixers#protolint#GetExecutable(a:buffer) let l:config = ale#Var(a:buffer, 'proto_protolint_config') return { \ 'command': l:executable \ . (!empty(l:config) ? ' -config_path=' . ale#Escape(l:config) : '') \ . ' -fix' \ . ' %t', \ 'read_temporary_file': 1, \} endfunction ale-4.0.0/autoload/ale/fixers/ptop.vim000066400000000000000000000010361476501472200176340ustar00rootroot00000000000000" Author: BarrOff https://github.com/BarrOff " Description: Integration of ptop with ALE. call ale#Set('pascal_ptop_executable', 'ptop') call ale#Set('pascal_ptop_options', '') function! ale#fixers#ptop#Fix(buffer) abort let l:executable = ale#Var(a:buffer, 'pascal_ptop_executable') let l:options = ale#Var(a:buffer, 'pascal_ptop_options') return { \ 'command': ale#Escape(l:executable) \ . (empty(l:options) ? '' : ' ' . l:options) \ . ' %s %t', \ 'read_temporary_file': 1, \} endfunction ale-4.0.0/autoload/ale/fixers/puppetlint.vim000066400000000000000000000012111476501472200210510ustar00rootroot00000000000000" Author: Alexander Olofsson " Description: puppet-lint fixer if !exists('g:ale_puppet_puppetlint_executable') let g:ale_puppet_puppetlint_executable = 'puppet-lint' endif if !exists('g:ale_puppet_puppetlint_options') let g:ale_puppet_puppetlint_options = '' endif function! ale#fixers#puppetlint#Fix(buffer) abort let l:executable = ale#Var(a:buffer, 'puppet_puppetlint_executable') return { \ 'command': ale#Escape(l:executable) \ . ' ' . ale#Var(a:buffer, 'puppet_puppetlint_options') \ . ' --fix' \ . ' %t', \ 'read_temporary_file': 1, \} endfunction ale-4.0.0/autoload/ale/fixers/purs_tidy.vim000066400000000000000000000014761476501472200207040ustar00rootroot00000000000000" Author: toastal " Description: Integration of purs-tidy with ALE. call ale#Set('purescript_tidy_executable', 'purs-tidy') call ale#Set('purescript_tidy_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('purescript_tidy_options', '') function! ale#fixers#purs_tidy#GetExecutable(buffer) abort return ale#path#FindExecutable(a:buffer, 'purescript_tidy', [ \ 'node_modules/purescript-tidy/bin/index.js', \ 'node_modules/.bin/purs-tidy', \]) endfunction function! ale#fixers#purs_tidy#Fix(buffer) abort let l:executable = ale#fixers#purs_tidy#GetExecutable(a:buffer) let l:options = ale#Var(a:buffer, 'purescript_tidy_options') return { \ 'command': ale#Escape(l:executable) \ . ' format' \ . ale#Pad(l:options) \} endfunction ale-4.0.0/autoload/ale/fixers/purty.vim000066400000000000000000000010751476501472200200400ustar00rootroot00000000000000" Author: iclanzan " Description: Integration of purty with ALE. call ale#Set('purescript_purty_executable', 'purty') function! ale#fixers#purty#GetExecutable(buffer) abort let l:executable = ale#Var(a:buffer, 'purescript_purty_executable') return ale#Escape(l:executable) endfunction function! ale#fixers#purty#Fix(buffer) abort let l:executable = ale#fixers#purty#GetExecutable(a:buffer) return { \ 'command': l:executable \ . ' --write' \ . ' %t', \ 'read_temporary_file': 1, \} endfunction ale-4.0.0/autoload/ale/fixers/pycln.vim000066400000000000000000000061231476501472200200010ustar00rootroot00000000000000" Author: Yining " Description: pycln as ALE fixer for python files call ale#Set('python_pycln_executable', 'pycln') call ale#Set('python_pycln_options', '') call ale#Set('python_pycln_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('python_pycln_change_directory', 1) call ale#Set('python_pycln_auto_pipenv', 0) call ale#Set('python_pycln_auto_poetry', 0) call ale#Set('python_pycln_auto_uv', 0) call ale#Set('python_pycln_config_file', '') function! ale#fixers#pycln#GetCwd(buffer) abort if ale#Var(a:buffer, 'python_pycln_change_directory') " Run from project root if found, else from buffer dir. let l:project_root = ale#python#FindProjectRoot(a:buffer) return !empty(l:project_root) ? l:project_root : '%s:h' endif return '%s:h' endfunction function! ale#fixers#pycln#GetExecutable(buffer) abort if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pycln_auto_pipenv')) \ && ale#python#PipenvPresent(a:buffer) return 'pipenv' endif if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_pycln_auto_poetry')) \ && ale#python#PoetryPresent(a:buffer) return 'poetry' endif if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_pycln_auto_uv')) \ && ale#python#UvPresent(a:buffer) return 'uv' endif return ale#python#FindExecutable(a:buffer, 'python_pycln', ['pycln']) endfunction function! ale#fixers#pycln#GetCommand(buffer) abort let l:executable = ale#fixers#pycln#GetExecutable(a:buffer) let l:exec_args = l:executable =~? '\(pipenv\|poetry\|uv\)$' \ ? ' run pycln' \ : '' return ale#Escape(l:executable) . l:exec_args endfunction function! ale#fixers#pycln#FixForVersion(buffer, version) abort let l:executable = ale#fixers#pycln#GetExecutable(a:buffer) let l:cmd = [ale#Escape(l:executable)] if l:executable =~? '\(pipenv\|poetry\|uv\)$' call extend(l:cmd, ['run', 'pycln']) endif let l:options = ale#Var(a:buffer, 'python_pycln_options') if !empty(l:options) call add(l:cmd, l:options) endif let l:config_file = ale#Var(a:buffer, 'python_pycln_config_file') let l:config_file = l:options !~# '\v(^| )--config ' && !empty(l:config_file) \ ? ale#Escape(ale#path#Simplify(l:config_file)) \ : '' if !empty(l:config_file) call add(l:cmd, '--config ' . l:config_file) endif call add(l:cmd, '--silence') " NOTE: pycln version `1.3.0` support reading from stdin call add(l:cmd, ale#semver#GTE(a:version, [1, 3, 0]) ? '-' : '%s') return { \ 'cwd': ale#fixers#pycln#GetCwd(a:buffer), \ 'command': join(l:cmd, ' '), \} endfunction function! ale#fixers#pycln#Fix(buffer) abort let l:executable = ale#fixers#pycln#GetExecutable(a:buffer) let l:command = ale#fixers#pycln#GetCommand(a:buffer) . ale#Pad('--version') return ale#semver#RunWithVersionCheck( \ a:buffer, \ l:executable, \ l:command, \ function('ale#fixers#pycln#FixForVersion'), \) endfunction ale-4.0.0/autoload/ale/fixers/pyflyby.vim000066400000000000000000000031771476501472200203600ustar00rootroot00000000000000" Author: infokiller " Description: Tidy imports using pyflyby's tidy-import script " https://github.com/deshaw/pyflyby call ale#Set('python_pyflyby_executable', 'tidy-imports') call ale#Set('python_pyflyby_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('python_pyflyby_options', '') call ale#Set('python_pyflyby_auto_pipenv', 0) call ale#Set('python_pyflyby_auto_poetry', 0) call ale#Set('python_pyflyby_auto_uv', 0) function! ale#fixers#pyflyby#GetExecutable(buffer) abort if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pyflyby_auto_pipenv')) \ && ale#python#PipenvPresent(a:buffer) return 'pipenv' endif if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_pyflyby_auto_poetry')) \ && ale#python#PoetryPresent(a:buffer) return 'poetry' endif if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_pyflyby_auto_uv')) \ && ale#python#UvPresent(a:buffer) return 'uv' endif return ale#python#FindExecutable(a:buffer, 'python_pyflyby', ['tidy-imports']) endfunction function! ale#fixers#pyflyby#Fix(buffer) abort " let l:executable = ale#fixers#pyflyby#GetExecutable(a:buffer) let l:executable = ale#fixers#pyflyby#GetExecutable(a:buffer) let l:cmd = [ale#Escape(l:executable)] if l:executable =~? '\(pipenv\|poetry\|uv\)$' call extend(l:cmd, ['run', 'tidy-imports']) endif let l:options = ale#Var(a:buffer, 'python_pyflyby_options') if !empty(l:options) call add(l:cmd, l:options) endif return {'command': join(l:cmd, ' ')} endfunction ale-4.0.0/autoload/ale/fixers/qmlfmt.vim000066400000000000000000000005031476501472200201500ustar00rootroot00000000000000call ale#Set('qml_qmlfmt_executable', 'qmlfmt') function! ale#fixers#qmlfmt#GetExecutable(buffer) abort return ale#Var(a:buffer, 'qml_qmlfmt_executable') endfunction function! ale#fixers#qmlfmt#Fix(buffer) abort return { \ 'command': ale#Escape(ale#fixers#qmlfmt#GetExecutable(a:buffer)), \} endfunction ale-4.0.0/autoload/ale/fixers/raco_fmt.vim000066400000000000000000000010121476501472200204360ustar00rootroot00000000000000" Author: Jeremy Cantrell " Description: Integration of raco fmt with ALE. call ale#Set('racket_raco_fmt_executable', 'raco') call ale#Set('racket_raco_fmt_options', '') function! ale#fixers#raco_fmt#Fix(buffer) abort let l:executable = ale#Var(a:buffer, 'racket_raco_fmt_executable') let l:options = ale#Var(a:buffer, 'racket_raco_fmt_options') return { \ 'command': ale#Escape(l:executable) . ' fmt' \ . (empty(l:options) ? '' : ' ' . l:options), \} endfunction ale-4.0.0/autoload/ale/fixers/refmt.vim000066400000000000000000000011021476501472200177610ustar00rootroot00000000000000" Author: Ahmed El Gabri <@ahmedelgabri> " Description: Integration of refmt with ALE. call ale#Set('reasonml_refmt_executable', 'refmt') call ale#Set('reasonml_refmt_options', '') function! ale#fixers#refmt#Fix(buffer) abort let l:executable = ale#Var(a:buffer, 'reasonml_refmt_executable') let l:options = ale#Var(a:buffer, 'reasonml_refmt_options') return { \ 'command': ale#Escape(l:executable) \ . (empty(l:options) ? '' : ' ' . l:options) \ . ' --in-place' \ . ' %t', \ 'read_temporary_file': 1, \} endfunction ale-4.0.0/autoload/ale/fixers/remark_lint.vim000066400000000000000000000015101476501472200211560ustar00rootroot00000000000000" Author: blyoa " Description: Fixing files with remark-lint. call ale#Set('markdown_remark_lint_executable', 'remark') call ale#Set('markdown_remark_lint_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('markdown_remark_lint_options', '') function! ale#fixers#remark_lint#GetExecutable(buffer) abort return ale#path#FindExecutable(a:buffer, 'markdown_remark_lint', [ \ 'node_modules/remark-cli/cli.js', \ 'node_modules/.bin/remark', \]) endfunction function! ale#fixers#remark_lint#Fix(buffer) abort let l:executable = ale#fixers#remark_lint#GetExecutable(a:buffer) let l:options = ale#Var(a:buffer, 'markdown_remark_lint_options') return { \ 'command': ale#Escape(l:executable) \ . (!empty(l:options) ? ' ' . l:options : ''), \} endfunction ale-4.0.0/autoload/ale/fixers/reorder_python_imports.vim000066400000000000000000000033621476501472200234760ustar00rootroot00000000000000" Author: jake " Description: Fixing Python imports with reorder-python-imports. call ale#Set('python_reorder_python_imports_executable', 'reorder-python-imports') call ale#Set('python_reorder_python_imports_options', '') call ale#Set('python_reorder_python_imports_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('python_reorder_python_imports_auto_pipenv', 0) call ale#Set('python_reorder_python_imports_auto_poetry', 0) call ale#Set('python_reorder_python_imports_auto_uv', 0) function! ale#fixers#reorder_python_imports#GetExecutable(buffer) abort if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_reorder_python_imports_auto_pipenv')) \ && ale#python#PipenvPresent(a:buffer) return 'pipenv' endif if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_reorder_python_imports_auto_poetry')) \ && ale#python#PoetryPresent(a:buffer) return 'poetry' endif if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_reorder_python_imports_auto_uv')) \ && ale#python#UvPresent(a:buffer) return 'uv' endif return ale#python#FindExecutable(a:buffer, 'python_reorder_python_imports', ['reorder-python-imports']) endfunction function! ale#fixers#reorder_python_imports#Fix(buffer) abort let l:executable = ale#fixers#reorder_python_imports#GetExecutable(a:buffer) let l:exec_args = l:executable =~? '\(pipenv\|poetry\|uv\)$' \ ? ' run reorder-python-imports' \ : '' let l:options = ale#Var(a:buffer, 'python_reorder_python_imports_options') return { \ 'command': ale#Escape(l:executable) . l:exec_args \ . (!empty(l:options) ? ' ' . l:options : '') . ' -', \} endfunction ale-4.0.0/autoload/ale/fixers/rubocop.vim000066400000000000000000000023751476501472200203320ustar00rootroot00000000000000call ale#Set('ruby_rubocop_options', '') call ale#Set('ruby_rubocop_auto_correct_all', 0) call ale#Set('ruby_rubocop_executable', 'rubocop') " Rubocop fixer outputs diagnostics first and then the fixed " output. These are delimited by a "=======" string that we " look for to remove everything before it. function! ale#fixers#rubocop#PostProcess(buffer, output) abort let l:line = 0 for l:output in a:output let l:line = l:line + 1 if l:output =~# "^=\\+$" break endif endfor return a:output[l:line :] endfunction function! ale#fixers#rubocop#GetCommand(buffer) abort let l:executable = ale#Var(a:buffer, 'ruby_rubocop_executable') let l:options = ale#Var(a:buffer, 'ruby_rubocop_options') let l:auto_correct_all = ale#Var(a:buffer, 'ruby_rubocop_auto_correct_all') return ale#ruby#EscapeExecutable(l:executable, 'rubocop') \ . (!empty(l:options) ? ' ' . l:options : '') \ . (l:auto_correct_all ? ' --auto-correct-all' : ' --auto-correct') \ . ' --force-exclusion --stdin %s' endfunction function! ale#fixers#rubocop#Fix(buffer) abort return { \ 'command': ale#fixers#rubocop#GetCommand(a:buffer), \ 'process_with': 'ale#fixers#rubocop#PostProcess' \} endfunction ale-4.0.0/autoload/ale/fixers/rubyfmt.vim000066400000000000000000000007721476501472200203500ustar00rootroot00000000000000" Author: Yining " Description: support rubyfmt as ALE fixer for Ruby files call ale#Set('ruby_rubyfmt_executable', 'rubyfmt') call ale#Set('ruby_rubyfmt_options', '') function! ale#fixers#rubyfmt#Fix(buffer) abort let l:executable = ale#Var(a:buffer, 'ruby_rubyfmt_executable') let l:options = ale#Var(a:buffer, 'ruby_rubyfmt_options') return { \ 'command': ale#Escape(l:executable) \ . (empty(l:options) ? '' : ' ' . l:options) \} endfunction ale-4.0.0/autoload/ale/fixers/ruff.vim000066400000000000000000000062631476501472200176230ustar00rootroot00000000000000" Author: Yining " Description: ruff as ALE fixer for python files call ale#Set('python_ruff_executable', 'ruff') call ale#Set('python_ruff_options', '') call ale#Set('python_ruff_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('python_ruff_change_directory', 1) call ale#Set('python_ruff_auto_pipenv', 0) call ale#Set('python_ruff_auto_poetry', 0) call ale#Set('python_ruff_auto_uv', 0) function! ale#fixers#ruff#GetCwd(buffer) abort if ale#Var(a:buffer, 'python_ruff_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 '%s:h' endfunction function! ale#fixers#ruff#GetExecutable(buffer) abort if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_ruff_auto_pipenv')) \ && ale#python#PipenvPresent(a:buffer) return 'pipenv' endif if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_ruff_auto_poetry')) \ && ale#python#PoetryPresent(a:buffer) return 'poetry' endif if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_ruff_auto_uv')) \ && ale#python#UvPresent(a:buffer) return 'uv' endif return ale#python#FindExecutable(a:buffer, 'python_ruff', ['ruff']) endfunction function! ale#fixers#ruff#GetCommand(buffer) abort let l:executable = ale#fixers#ruff#GetExecutable(a:buffer) let l:exec_args = l:executable =~? '\(pipenv\|poetry\|uv\)$' \ ? ' run ruff' \ : '' return ale#Escape(l:executable) . l:exec_args endfunction function! ale#fixers#ruff#FixForVersion(buffer, version) abort let l:executable = ale#fixers#ruff#GetExecutable(a:buffer) let l:cmd = [ale#Escape(l:executable)] if l:executable =~? '\(pipenv\|poetry\|uv\)$' call extend(l:cmd, ['run', 'ruff']) endif " NOTE: ruff 0.5.0 removes `ruff ` in favor of `ruff check ` if ale#semver#GTE(a:version, [0, 5, 0]) call extend(l:cmd, ['check']) endif let l:options = ale#Var(a:buffer, 'python_ruff_options') if !empty(l:options) call add(l:cmd, l:options) endif " when --stdin-filename present, ruff will use it for proj root resolution " https://github.com/charliermarsh/ruff/pull/1281 let l:fname = expand('#' . a:buffer . '...') call add(l:cmd, '--stdin-filename '.ale#Escape(ale#path#Simplify(l:fname))) call add(l:cmd, '--fix') " NOTE: ruff version `0.0.72` implements `--fix` with stdin if ale#semver#GTE(a:version, [0, 0, 72]) call add(l:cmd, '-') else call add(l:cmd, '%s') endif return { \ 'cwd': ale#fixers#ruff#GetCwd(a:buffer), \ 'command': join(l:cmd, ' '), \} endfunction function! ale#fixers#ruff#Fix(buffer) abort let l:executable = ale#fixers#ruff#GetExecutable(a:buffer) let l:command = ale#fixers#ruff#GetCommand(a:buffer) . ale#Pad('--version') return ale#semver#RunWithVersionCheck( \ a:buffer, \ l:executable, \ l:command, \ function('ale#fixers#ruff#FixForVersion'), \) endfunction ale-4.0.0/autoload/ale/fixers/ruff_format.vim000066400000000000000000000052431476501472200211700ustar00rootroot00000000000000" Author: Yining , Joseph Henrich " Description: ruff formatter as ALE fixer for python files call ale#Set('python_ruff_format_executable', 'ruff') call ale#Set('python_ruff_format_options', '') call ale#Set('python_ruff_format_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('python_ruff_format_change_directory', 1) call ale#Set('python_ruff_format_auto_pipenv', 0) call ale#Set('python_ruff_format_auto_poetry', 0) call ale#Set('python_ruff_format_auto_uv', 0) function! ale#fixers#ruff_format#GetCwd(buffer) abort if ale#Var(a:buffer, 'python_ruff_format_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 '%s:h' endfunction function! ale#fixers#ruff_format#GetExecutable(buffer) abort if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_ruff_format_auto_pipenv')) \ && ale#python#PipenvPresent(a:buffer) return 'pipenv' endif if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_ruff_format_auto_poetry')) \ && ale#python#PoetryPresent(a:buffer) return 'poetry' endif if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_ruff_format_auto_uv')) \ && ale#python#UvPresent(a:buffer) return 'uv' endif return ale#python#FindExecutable(a:buffer, 'python_ruff_format', ['ruff']) endfunction function! ale#fixers#ruff_format#GetCommand(buffer) abort let l:executable = ale#fixers#ruff_format#GetExecutable(a:buffer) let l:exec_args = l:executable =~? '\(pipenv\|poetry\|uv\)$' \ ? ' run ruff' \ : '' return ale#Escape(l:executable) . l:exec_args endfunction function! ale#fixers#ruff_format#Fix(buffer) abort let l:executable = ale#fixers#ruff_format#GetExecutable(a:buffer) let l:cmd = [ale#Escape(l:executable)] if l:executable =~? '\(pipenv\|poetry\|uv\)$' call extend(l:cmd, ['run', 'ruff']) endif let l:options = ale#Var(a:buffer, 'python_ruff_format_options') " when --stdin-filename present, ruff will use it for proj root resolution " https://github.com/charliermarsh/ruff/pull/1281 let l:fname = expand('#' . a:buffer . '...') call add(l:cmd, 'format') if !empty(l:options) call add(l:cmd, l:options) endif call add(l:cmd, '--stdin-filename '.ale#Escape(ale#path#Simplify(l:fname))) call add(l:cmd, '-') return { \ 'cwd': ale#fixers#ruff_format#GetCwd(a:buffer), \ 'command': join(l:cmd, ' '), \} endfunction ale-4.0.0/autoload/ale/fixers/rufo.vim000066400000000000000000000011141476501472200176220ustar00rootroot00000000000000" Author: Fohte (Hayato Kawai) https://github.com/fohte " Description: Integration of Rufo with ALE. call ale#Set('ruby_rufo_executable', 'rufo') function! ale#fixers#rufo#GetCommand(buffer) abort let l:executable = ale#Var(a:buffer, 'ruby_rufo_executable') let l:exec_args = l:executable =~? 'bundle$' \ ? ' exec rufo' \ : '' return ale#Escape(l:executable) . l:exec_args . ' %t' endfunction function! ale#fixers#rufo#Fix(buffer) abort return { \ 'command': ale#fixers#rufo#GetCommand(a:buffer), \ 'read_temporary_file': 1, \} endfunction ale-4.0.0/autoload/ale/fixers/rustfmt.vim000066400000000000000000000007601476501472200203610ustar00rootroot00000000000000" Author: Kelly Fox " Description: Integration of rustfmt with ALE. call ale#Set('rust_rustfmt_executable', 'rustfmt') call ale#Set('rust_rustfmt_options', '') function! ale#fixers#rustfmt#Fix(buffer) abort let l:executable = ale#Var(a:buffer, 'rust_rustfmt_executable') let l:options = ale#Var(a:buffer, 'rust_rustfmt_options') return { \ 'command': ale#Escape(l:executable) \ . (empty(l:options) ? '' : ' ' . l:options), \} endfunction ale-4.0.0/autoload/ale/fixers/rustywind.vim000066400000000000000000000010651476501472200207240ustar00rootroot00000000000000scriptencoding utf-8 " Author: Guillermo Roig " Description: Sort TailwindCSS classes with rustywind call ale#Set('html_rustywind_executable', 'rustywind') call ale#Set('html_rustywind_options', '') function! ale#fixers#rustywind#Fix(buffer) abort let l:executable = ale#Var(a:buffer, 'html_rustywind_executable') let l:options = ale#Var(a:buffer, 'html_rustywind_options') return { \ 'command': ale#Escape(l:executable) \ . (empty(l:options) ? '' : ' ' . l:options) \ . ' --stdin' \} endfunction ale-4.0.0/autoload/ale/fixers/scadformat.vim000066400000000000000000000010211476501472200207670ustar00rootroot00000000000000" Author: tony o'dell " Description: Fix scad files with scadformat call ale#Set('openscad_scadformat_executable', 'scadformat') call ale#Set('openscad_scadformat_options', '') function! ale#fixers#scadformat#Fix(buffer) abort let l:executable = ale#Var(a:buffer, 'openscad_scadformat_executable') let l:options = ale#Var(a:buffer, 'openscad_scadformat_options') return { \ 'command': ale#Escape(l:executable) \ . (empty(l:options) ? '' : ' ' . l:options), \} endfunction ale-4.0.0/autoload/ale/fixers/scalafmt.vim000066400000000000000000000015331476501472200204460ustar00rootroot00000000000000" Author: Jeffrey Lau https://github.com/zoonfafer " Description: Integration of Scalafmt with ALE. call ale#Set('scala_scalafmt_executable', 'scalafmt') call ale#Set('scala_scalafmt_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('scala_scalafmt_options', '') function! ale#fixers#scalafmt#GetCommand(buffer) abort let l:executable = ale#Var(a:buffer, 'scala_scalafmt_executable') let l:options = ale#Var(a:buffer, 'scala_scalafmt_options') let l:exec_args = l:executable =~? 'ng$' \ ? ' scalafmt' \ : '' return ale#Escape(l:executable) . l:exec_args \ . (empty(l:options) ? '' : ' ' . l:options) \ . ' %t' endfunction function! ale#fixers#scalafmt#Fix(buffer) abort return { \ 'command': ale#fixers#scalafmt#GetCommand(a:buffer), \ 'read_temporary_file': 1, \} endfunction ale-4.0.0/autoload/ale/fixers/shfmt.vim000066400000000000000000000010131476501472200177660ustar00rootroot00000000000000scriptencoding utf-8 " Author: Simon Bugert " Description: Fix sh files with shfmt. call ale#Set('sh_shfmt_executable', 'shfmt') call ale#Set('sh_shfmt_options', '') function! ale#fixers#shfmt#Fix(buffer) abort let l:executable = ale#Var(a:buffer, 'sh_shfmt_executable') let l:options = ale#Var(a:buffer, 'sh_shfmt_options') return { \ 'command': ale#Escape(l:executable) \ . ' -filename=%s' \ . (empty(l:options) ? '' : ' ' . l:options) \} endfunction ale-4.0.0/autoload/ale/fixers/sorbet.vim000066400000000000000000000011511476501472200201460ustar00rootroot00000000000000call ale#Set('ruby_sorbet_executable', 'srb') call ale#Set('ruby_sorbet_options', '') function! ale#fixers#sorbet#GetCommand(buffer) abort let l:executable = ale#Var(a:buffer, 'ruby_sorbet_executable') let l:options = ale#Var(a:buffer, 'ruby_sorbet_options') return ale#ruby#EscapeExecutable(l:executable, 'srb') \ . ' tc' \ . (!empty(l:options) ? ' ' . l:options : '') \ . ' --autocorrect --file %t' endfunction function! ale#fixers#sorbet#Fix(buffer) abort return { \ 'command': ale#fixers#sorbet#GetCommand(a:buffer), \ 'read_temporary_file': 1, \} endfunction ale-4.0.0/autoload/ale/fixers/sqlfluff.vim000066400000000000000000000012631476501472200204760ustar00rootroot00000000000000" Author: Carl Smedstad " Description: Fixing SQL files with sqlfluff call ale#Set('sql_sqlfluff_executable', 'sqlfluff') function! ale#fixers#sqlfluff#Fix(buffer) abort let l:executable = ale#Var(a:buffer, 'sql_sqlfluff_executable') let l:cmd = \ ale#Escape(l:executable) \ . ' fix --force' let l:config_file = ale#path#FindNearestFile(a:buffer, '.sqlfluff') if !empty(l:config_file) let l:cmd .= ' --config ' . ale#Escape(l:config_file) else let l:cmd .= ' --dialect ansi' endif return { \ 'command': l:cmd . ' %t > /dev/null', \ 'read_temporary_file': 1, \} endfunction ale-4.0.0/autoload/ale/fixers/sqlfmt.vim000066400000000000000000000006361476501472200201650ustar00rootroot00000000000000call ale#Set('sql_sqlfmt_executable', 'sqlfmt') call ale#Set('sql_sqlfmt_options', '') function! ale#fixers#sqlfmt#Fix(buffer) abort let l:executable = ale#Var(a:buffer, 'sql_sqlfmt_executable') let l:options = ale#Var(a:buffer, 'sql_sqlfmt_options') return { \ 'command': ale#Escape(l:executable) \ . ' -w' \ . (empty(l:options) ? '' : ' ' . l:options), \} endfunction ale-4.0.0/autoload/ale/fixers/sqlformat.vim000066400000000000000000000007561476501472200206720ustar00rootroot00000000000000" Author: Cluas " Description: Fixing files with sqlformat. call ale#Set('sql_sqlformat_executable', 'sqlformat') call ale#Set('sql_sqlformat_options', '') function! ale#fixers#sqlformat#Fix(buffer) abort let l:executable = ale#Var(a:buffer, 'sql_sqlformat_executable') let l:options = ale#Var(a:buffer, 'sql_sqlformat_options') return { \ 'command': ale#Escape(l:executable) \ . (!empty(l:options) ? ' ' . l:options : '') \ . ' -' \} endfunction ale-4.0.0/autoload/ale/fixers/standard.vim000066400000000000000000000022301476501472200204470ustar00rootroot00000000000000" Author: Sumner Evans " Description: Fixing files with Standard. call ale#Set('javascript_standard_executable', 'standard') call ale#Set('javascript_standard_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('javascript_standard_options', '') function! ale#fixers#standard#GetExecutable(buffer) abort return ale#path#FindExecutable(a:buffer, 'javascript_standard', [ \ 'node_modules/standardx/bin/cmd.js', \ 'node_modules/standard/bin/cmd.js', \ 'node_modules/.bin/standard', \]) endfunction function! ale#fixers#standard#Fix(buffer) abort let l:executable = ale#fixers#standard#GetExecutable(a:buffer) let l:filetype = getbufvar(a:buffer, '&filetype') let l:options_type = 'javascript_standard_options' if l:filetype =~# 'typescript' let l:options_type = 'typescript_standard_options' endif let l:options = ale#Var(a:buffer, l:options_type) return { \ 'command': ale#node#Executable(a:buffer, l:executable) \ . (!empty(l:options) ? ' ' . l:options : '') \ . ' --fix --stdin < %s > %t', \ 'read_temporary_file': 1, \} endfunction ale-4.0.0/autoload/ale/fixers/standardrb.vim000066400000000000000000000016301476501472200207760ustar00rootroot00000000000000" Author: Justin Searls - https://github.com/searls " Description: Fix Ruby files with StandardRB. call ale#Set('ruby_standardrb_options', '') call ale#Set('ruby_standardrb_executable', 'standardrb') function! ale#fixers#standardrb#GetCommand(buffer) abort let l:executable = ale#Var(a:buffer, 'ruby_standardrb_executable') let l:config = ale#path#FindNearestFile(a:buffer, '.standard.yml') let l:options = ale#Var(a:buffer, 'ruby_standardrb_options') return ale#ruby#EscapeExecutable(l:executable, 'standardrb') \ . (!empty(l:config) ? ' --config ' . ale#Escape(l:config) : '') \ . (!empty(l:options) ? ' ' . l:options : '') \ . ' --fix --force-exclusion --stdin %s' endfunction function! ale#fixers#standardrb#Fix(buffer) abort return { \ 'command': ale#fixers#standardrb#GetCommand(a:buffer), \ 'process_with': 'ale#fixers#rubocop#PostProcess' \} endfunction ale-4.0.0/autoload/ale/fixers/statix.vim000066400000000000000000000010621476501472200201650ustar00rootroot00000000000000" Author: David Houston " Description: Provide statix fix as a fixer for simple Nix antipatterns. call ale#Set('nix_statix_fix_executable', 'statix') call ale#Set('nix_statix_fix_options', '') function! ale#fixers#statix#Fix(buffer) abort let l:executable = ale#Var(a:buffer, 'nix_statix_fix_executable') let l:options = ale#Var(a:buffer, 'nix_statix_fix_options') return { \ 'command': ale#Escape(l:executable) \ . ale#Pad('fix') \ . ale#Pad('--stdin') \ . ale#Pad(l:options), \} endfunction ale-4.0.0/autoload/ale/fixers/stylelint.vim000066400000000000000000000016031476501472200207010ustar00rootroot00000000000000" Author: Mahmoud Mostafa " Description: Fixing files with stylelint. call ale#Set('stylelint_executable', 'stylelint') call ale#Set('stylelint_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('stylelint_options', '') function! ale#fixers#stylelint#GetExecutable(buffer) abort return ale#path#FindExecutable(a:buffer, 'stylelint', [ \ 'node_modules/stylelint/bin/stylelint.js', \ 'node_modules/.bin/stylelint', \]) endfunction function! ale#fixers#stylelint#Fix(buffer) abort let l:executable = ale#fixers#stylelint#GetExecutable(a:buffer) let l:options = ale#Var(a:buffer, 'stylelint_options') return { \ 'cwd': '%s:h', \ 'command': ale#node#Executable(a:buffer, l:executable) \ . ale#Pad(l:options) \ . ' --fix --stdin --stdin-filename %s', \ 'read_temporary_file': 0, \} endfunction ale-4.0.0/autoload/ale/fixers/styler.vim000066400000000000000000000010531476501472200201730ustar00rootroot00000000000000" Author: tvatter " Description: Fixing R files with styler. call ale#Set('r_styler_executable', 'Rscript') call ale#Set('r_styler_options', 'tidyverse_style()') function! ale#fixers#styler#Fix(buffer) abort return { \ 'command': 'Rscript --vanilla -e ' \ . '"suppressPackageStartupMessages(library(styler));' \ . 'style_file(commandArgs(TRUE), transformers = ' \ . ale#Var(a:buffer, 'r_styler_options') . ')"' \ . ' %t', \ 'read_temporary_file': 1, \} endfunction ale-4.0.0/autoload/ale/fixers/stylish_haskell.vim000066400000000000000000000012771476501472200220630ustar00rootroot00000000000000" Author: eborden " Description: Integration of stylish-haskell formatting with ALE. " call ale#Set('haskell_stylish_haskell_executable', 'stylish-haskell') function! ale#fixers#stylish_haskell#GetExecutable(buffer) abort let l:executable = ale#Var(a:buffer, 'haskell_stylish_haskell_executable') return ale#handlers#haskell_stack#EscapeExecutable(l:executable, 'stylish-haskell') endfunction function! ale#fixers#stylish_haskell#Fix(buffer) abort let l:executable = ale#fixers#stylish_haskell#GetExecutable(a:buffer) return { \ 'command': l:executable \ . ' --inplace' \ . ' %t', \ 'read_temporary_file': 1, \} endfunction ale-4.0.0/autoload/ale/fixers/stylua.vim000066400000000000000000000015431476501472200201760ustar00rootroot00000000000000" Author: Robert Liebowitz " Description: https://github.com/johnnymorganz/stylua call ale#Set('lua_stylua_executable', 'stylua') call ale#Set('lua_stylua_options', '') function! ale#fixers#stylua#GetCwd(buffer) abort for l:possible_configfile in ['stylua.toml', '.stylua.toml'] let l:config = ale#path#FindNearestFile(a:buffer, l:possible_configfile) if !empty(l:config) return fnamemodify(l:config, ':h') endif endfor return '%s:h' endfunction function! ale#fixers#stylua#Fix(buffer) abort let l:executable = ale#Var(a:buffer, 'lua_stylua_executable') let l:options = ale#Var(a:buffer, 'lua_stylua_options') return { \ 'cwd': ale#fixers#stylua#GetCwd(a:buffer), \ 'command': ale#Escape(l:executable) . ale#Pad(l:options) . ' --stdin-filepath %s -', \} endfunction ale-4.0.0/autoload/ale/fixers/swiftformat.vim000066400000000000000000000016131476501472200212200ustar00rootroot00000000000000" Author: gfontenot (Gordon Fontenot) " Description: Integration of SwiftFormat with ALE. call ale#Set('swift_swiftformat_executable', 'swiftformat') call ale#Set('swift_swiftformat_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('swift_swiftformat_options', '') function! ale#fixers#swiftformat#GetExecutable(buffer) abort return ale#path#FindExecutable(a:buffer, 'swift_swiftformat', [ \ 'Pods/SwiftFormat/CommandLineTool/swiftformat', \ 'ios/Pods/SwiftFormat/CommandLineTool/swiftformat', \ 'swiftformat', \]) endfunction function! ale#fixers#swiftformat#Fix(buffer) abort let l:options = ale#Var(a:buffer, 'swift_swiftformat_options') return { \ 'read_temporary_file': 1, \ 'command': ale#Escape(ale#fixers#swiftformat#GetExecutable(a:buffer)) \ . ' %t' \ . ' ' . l:options, \} endfunction ale-4.0.0/autoload/ale/fixers/syntax_tree.vim000066400000000000000000000011351476501472200212170ustar00rootroot00000000000000call ale#Set('ruby_syntax_tree_options', '') call ale#Set('ruby_syntax_tree_executable', 'stree') function! ale#fixers#syntax_tree#GetCommand(buffer) abort let l:executable = ale#Var(a:buffer, 'ruby_syntax_tree_executable') let l:options = ale#Var(a:buffer, 'ruby_syntax_tree_options') return ale#ruby#EscapeExecutable(l:executable, 'stree') \ . ' format' \ . (!empty(l:options) ? ' ' . l:options : '') \ . ' %t' endfunction function! ale#fixers#syntax_tree#Fix(buffer) abort return { \ 'command': ale#fixers#syntax_tree#GetCommand(a:buffer), \} endfunction ale-4.0.0/autoload/ale/fixers/terraform.vim000066400000000000000000000010421476501472200206500ustar00rootroot00000000000000" Author: dsifford " Description: Fixer for terraform and .hcl files call ale#Set('terraform_fmt_executable', 'terraform') call ale#Set('terraform_fmt_options', '') function! ale#fixers#terraform#Fix(buffer) abort let l:executable = ale#Var(a:buffer, 'terraform_fmt_executable') let l:options = ale#Var(a:buffer, 'terraform_fmt_options') return { \ 'command': ale#Escape(l:executable) \ . ' fmt' \ . (empty(l:options) ? '' : ' ' . l:options) \ . ' -' \} endfunction ale-4.0.0/autoload/ale/fixers/textlint.vim000066400000000000000000000007421476501472200205300ustar00rootroot00000000000000" Author: TANIGUCHI Masaya " Description: Integration of textlint with ALE. function! ale#fixers#textlint#Fix(buffer) abort let l:executable = ale#handlers#textlint#GetExecutable(a:buffer) let l:options = ale#Var(a:buffer, 'textlint_options') return { \ 'command': ale#Escape(l:executable) \ . ' --fix' \ . (empty(l:options) ? '' : ' ' . l:options) \ . ' %t', \ 'read_temporary_file': 1, \} endfunction ale-4.0.0/autoload/ale/fixers/tidy.vim000066400000000000000000000014341476501472200176250ustar00rootroot00000000000000" Author: meain " Description: Fixing HTML files with tidy. call ale#Set('html_tidy_executable', 'tidy') call ale#Set('html_tidy_use_global', get(g:, 'ale_use_global_executables', 0)) function! ale#fixers#tidy#Fix(buffer) abort let l:executable = ale#path#FindExecutable( \ a:buffer, \ 'html_tidy', \ ['tidy'], \) if !executable(l:executable) return 0 endif let l:config = ale#path#FindNearestFile(a:buffer, '.tidyrc') let l:config_options = !empty(l:config) \ ? ' -q --tidy-mark no --show-errors 0 --show-warnings 0 -config ' . ale#Escape(l:config) \ : ' -q --tidy-mark no --show-errors 0 --show-warnings 0' return { \ 'command': ale#Escape(l:executable) . l:config_options, \} endfunction ale-4.0.0/autoload/ale/fixers/tslint.vim000066400000000000000000000012761476501472200201750ustar00rootroot00000000000000" Author: carakan " Description: Fixing files with tslint. function! ale#fixers#tslint#Fix(buffer) abort let l:executable = ale#handlers#tslint#GetExecutable(a:buffer) let l:tslint_config_path = ale#path#ResolveLocalPath( \ a:buffer, \ 'tslint.json', \ ale#Var(a:buffer, 'typescript_tslint_config_path') \) let l:tslint_config_option = !empty(l:tslint_config_path) \ ? ' -c ' . ale#Escape(l:tslint_config_path) \ : '' return { \ 'command': ale#node#Executable(a:buffer, l:executable) \ . l:tslint_config_option \ . ' --outputAbsolutePaths --fix %t', \ 'read_temporary_file': 1, \} endfunction ale-4.0.0/autoload/ale/fixers/uncrustify.vim000066400000000000000000000016131476501472200210660ustar00rootroot00000000000000" Author: Derek P Sifford " Description: Fixer for C, C++, C#, ObjectiveC, D, Java, Pawn, and VALA. call ale#Set('c_uncrustify_executable', 'uncrustify') call ale#Set('c_uncrustify_options', '') let s:languages = { \ 'c': 'C', \ 'cpp': 'CPP', \ 'cs': 'CS', \ 'objc': 'OC', \ 'objcpp': 'OC+', \ 'd': 'D', \ 'java': 'JAVA', \ 'vala': 'VALA', \ 'p': 'PAWN', \} function! ale#fixers#uncrustify#Language(buffer) abort return get(s:languages, &filetype, 'C') endfunction function! ale#fixers#uncrustify#Fix(buffer) abort let l:executable = ale#Var(a:buffer, 'c_uncrustify_executable') let l:options = ale#Var(a:buffer, 'c_uncrustify_options') return { \ 'command': ale#Escape(l:executable) \ . ' --no-backup ' \ . '-l' . ale#Pad(ale#fixers#uncrustify#Language(a:buffer)) \ . ale#Pad(l:options) \} endfunction ale-4.0.0/autoload/ale/fixers/vfmt.vim000066400000000000000000000006041476501472200176260ustar00rootroot00000000000000" Author: fiatjaf " Description: Integration of `v fmt` with ALE. call ale#Set('v_vfmt_options', '') function! ale#fixers#vfmt#Fix(buffer) abort let l:executable = ale#Var(a:buffer, 'v_v_executable') let l:options = ale#Var(a:buffer, 'v_vfmt_options') return { \ 'command': ale#Escape(l:executable) . ' fmt' . ale#Pad(l:options) \} endfunction ale-4.0.0/autoload/ale/fixers/xmllint.vim000066400000000000000000000015201476501472200203370ustar00rootroot00000000000000" Author: Cyril Roelandt , jiz4oh " Description: Integration of xmllint with ALE. call ale#Set('xml_xmllint_executable', 'xmllint') call ale#Set('xml_xmllint_options', '') call ale#Set('xml_xmllint_indentsize', 2) function! ale#fixers#xmllint#Fix(buffer) abort let l:executable = ale#Escape(ale#Var(a:buffer, 'xml_xmllint_executable')) let l:command = l:executable . ' --format' let l:indent = ale#Var(a:buffer, 'xml_xmllint_indentsize') if l:indent isnot# '' let l:env = ale#Env('XMLLINT_INDENT', repeat(' ', l:indent)) let l:command = l:env . l:command endif let l:options = ale#Var(a:buffer, 'xml_xmllint_options') if l:options isnot# '' let l:command .= ' ' . l:options endif return { \ 'command': l:command . ' -' \} endfunction ale-4.0.0/autoload/ale/fixers/xo.vim000066400000000000000000000021111476501472200172730ustar00rootroot00000000000000" Author: Albert Marquez - https://github.com/a-marquez " Description: Fixing files with XO. function! ale#fixers#xo#Fix(buffer) abort let l:executable = ale#handlers#xo#GetExecutable(a:buffer) let l:options = ale#handlers#xo#GetOptions(a:buffer) return ale#semver#RunWithVersionCheck( \ a:buffer, \ l:executable, \ '%e --version', \ {b, v -> ale#fixers#xo#ApplyFixForVersion(b, v, l:executable, l:options)} \) endfunction function! ale#fixers#xo#ApplyFixForVersion(buffer, version, executable, options) abort let l:executable = ale#node#Executable(a:buffer, a:executable) let l:options = ale#Pad(a:options) " 0.30.0 is the first version with a working --stdin --fix if ale#semver#GTE(a:version, [0, 30, 0]) return { \ 'command': l:executable \ . ' --stdin --stdin-filename %s' \ . ' --fix' \ . l:options, \} endif return { \ 'command': l:executable \ . ' --fix %t' \ . l:options, \ 'read_temporary_file': 1, \} endfunction ale-4.0.0/autoload/ale/fixers/yamlfix.vim000066400000000000000000000012711476501472200203240ustar00rootroot00000000000000" Author: lyz-code " Description: Fixing yaml files with yamlfix. call ale#Set('yaml_yamlfix_executable', 'yamlfix') call ale#Set('yaml_yamlfix_options', '') call ale#Set('yaml_yamlfix_use_global', get(g:, 'ale_use_global_executables', 0)) function! ale#fixers#yamlfix#Fix(buffer) abort let l:options = ale#Var(a:buffer, 'yaml_yamlfix_options') let l:executable = ale#python#FindExecutable( \ a:buffer, \ 'yaml_yamlfix', \ ['yamlfix'], \) if !executable(l:executable) return 0 endif return { \ 'cwd': '%s:h', \ 'command': ale#Escape(l:executable) \ . (!empty(l:options) ? ' ' . l:options : '') . ' -', \} endfunction ale-4.0.0/autoload/ale/fixers/yamlfmt.vim000066400000000000000000000011251476501472200203220ustar00rootroot00000000000000" Author: https://github.com/Spixmaster " Description: Format YAML files with yamlfmt. call ale#Set('yaml_yamlfmt_executable', 'yamlfmt') call ale#Set('yaml_yamlfmt_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('yaml_yamlfmt_options', '') function! ale#fixers#yamlfmt#Fix(buffer) abort let l:executable = ale#python#FindExecutable( \ a:buffer, \ 'yaml_yamlfmt', \ ['yamlfmt'] \) let l:options = ale#Var(a:buffer, 'yaml_yamlfmt_options') return { \ 'command': ale#Escape(l:executable) . ' ' . l:options . ' -in', \} endfunction ale-4.0.0/autoload/ale/fixers/yapf.vim000066400000000000000000000027271476501472200176210ustar00rootroot00000000000000" Author: w0rp " Description: Fixing Python files with yapf. call ale#Set('python_yapf_executable', 'yapf') call ale#Set('python_yapf_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('python_yapf_auto_pipenv', 0) call ale#Set('python_yapf_auto_poetry', 0) call ale#Set('python_yapf_auto_uv', 0) function! ale#fixers#yapf#GetExecutable(buffer) abort if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_yapf_auto_pipenv')) \ && ale#python#PipenvPresent(a:buffer) return 'pipenv' endif if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_yapf_auto_poetry')) \ && ale#python#PoetryPresent(a:buffer) return 'poetry' endif if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_yapf_auto_uv')) \ && ale#python#UvPresent(a:buffer) return 'uv' endif return ale#python#FindExecutable(a:buffer, 'python_yapf', ['yapf']) endfunction function! ale#fixers#yapf#Fix(buffer) abort let l:executable = ale#fixers#yapf#GetExecutable(a:buffer) let l:exec_args = l:executable =~? '\(pipenv\|poetry\|uv\)$' \ ? ' run yapf' \ : '' let l:config = ale#path#FindNearestFile(a:buffer, '.style.yapf') let l:config_options = !empty(l:config) \ ? ' --no-local-style --style ' . ale#Escape(l:config) \ : '' return { \ 'command': ale#Escape(l:executable) . l:exec_args . l:config_options, \} endfunction ale-4.0.0/autoload/ale/fixers/yq.vim000066400000000000000000000011271476501472200173040ustar00rootroot00000000000000call ale#Set('yaml_yq_executable', 'yq') call ale#Set('yaml_yq_options', '') call ale#Set('yaml_yq_filters', '.') function! ale#fixers#yq#GetExecutable(buffer) abort return ale#Var(a:buffer, 'yaml_yq_executable') endfunction function! ale#fixers#yq#Fix(buffer) abort let l:options = ale#Var(a:buffer, 'yaml_yq_options') let l:filters = ale#Var(a:buffer, 'yaml_yq_filters') if empty(l:filters) return 0 endif return { \ 'command': ale#Escape(ale#fixers#yq#GetExecutable(a:buffer)) \ . ' ' . l:filters . ' ' \ . l:options, \} endfunction ale-4.0.0/autoload/ale/fixers/zigfmt.vim000066400000000000000000000005751476501472200201610ustar00rootroot00000000000000scriptencoding utf-8 " Author: Arash Mousavi " Description: Official formatter for Zig. call ale#Set('zig_zigfmt_executable', 'zig') function! ale#fixers#zigfmt#Fix(buffer) abort let l:executable = ale#Var(a:buffer, 'zig_zigfmt_executable') return { \ 'command': ale#Escape(l:executable) . ' fmt %t', \ 'read_temporary_file': 1, \} endfunction ale-4.0.0/autoload/ale/floating_preview.vim000066400000000000000000000155431476501472200207260ustar00rootroot00000000000000" Author: Jan-Grimo Sobez " Author: Kevin Clark " Author: D. Ben Knoble " Author: Shaun Duncan " Description: Floating preview window for showing whatever information in. " Precondition: exists('*nvim_open_win') || has('popupwin') function! ale#floating_preview#Show(lines, ...) abort if !exists('*nvim_open_win') && !has('popupwin') " no-custom-checks echom 'Floating windows not supported in this vim instance.' return endif let l:options = get(a:000, 0, {}) if has('nvim') call s:NvimShow(a:lines, l:options) else call s:VimShow(a:lines, l:options) endif return w:preview.id endfunction function! s:NvimShow(lines, options) abort " Remove the close autocmd so it doesn't happen mid update augroup ale_floating_preview_window autocmd! augroup END " Only create a new window if we need it if !exists('w:preview') || index(nvim_list_wins(), w:preview['id']) is# -1 call s:NvimCreate(a:options) else call nvim_buf_set_option(w:preview['buffer'], 'modifiable', v:true) endif " Execute commands in window context if exists('*win_execute') for l:command in get(a:options, 'commands', []) call win_execute(w:preview['id'], l:command) endfor else let l:parent_window = nvim_get_current_win() call nvim_set_current_win(w:preview['id']) for l:command in get(a:options, 'commands', []) call execute(l:command) endfor call nvim_set_current_win(l:parent_window) endif " Return to parent context on move augroup ale_floating_preview_window autocmd! if g:ale_close_preview_on_insert autocmd CursorMoved,TabLeave,WinLeave,BufWinLeave,WinScrolled,InsertEnter ++once call s:NvimClose() else autocmd CursorMoved,TabLeave,WinLeave,BufWinLeave,WinScrolled ++once call s:NvimClose() endif augroup END let [l:lines, l:width, l:height] = s:NvimPrepareWindowContent(a:lines) call nvim_win_set_width(w:preview['id'], l:width) call nvim_win_set_height(w:preview['id'], l:height) call nvim_buf_set_lines(w:preview['buffer'], 0, -1, v:false, l:lines) call nvim_buf_set_option(w:preview['buffer'], 'modified', v:false) call nvim_buf_set_option(w:preview['buffer'], 'modifiable', v:false) endfunction function! s:VimShow(lines, options) abort if g:ale_close_preview_on_insert " Remove the close autocmd so it doesn't happen mid update silent! autocmd! ale_floating_preview_window endif " Only create a new window if we need it if !exists('w:preview') || index(popup_list(), w:preview['id']) is# -1 call s:VimCreate(a:options) endif " Execute commands in window context for l:command in get(a:options, 'commands', []) call win_execute(w:preview['id'], l:command) endfor call popup_settext(w:preview['id'], a:lines) if g:ale_close_preview_on_insert augroup ale_floating_preview_window autocmd! autocmd InsertEnter * ++once call s:VimClose() augroup END endif endfunction function! s:NvimPrepareWindowContent(lines) abort let l:max_height = 10 let l:width = max(map(copy(a:lines), 'strdisplaywidth(v:val)')) let l:height = min([len(a:lines), l:max_height]) return [a:lines[0:l:height-1], l:width, l:height] endfunction function! s:NvimCreate(options) abort let l:left = get(g:ale_floating_window_border, 0, '|') let l:top = get(g:ale_floating_window_border, 1, '-') let l:popup_opts = extend({ \ 'relative': 'cursor', \ 'row': 1, \ 'col': 0, \ 'width': 42, \ 'height': 4, \ 'style': 'minimal', \ 'border': empty(g:ale_floating_window_border) ? 'none' : [ \ get(g:ale_floating_window_border, 2, '+'), \ l:top, \ get(g:ale_floating_window_border, 3, '+'), \ get(g:ale_floating_window_border, 6, l:left), \ get(g:ale_floating_window_border, 4, '+'), \ get(g:ale_floating_window_border, 7, l:top), \ get(g:ale_floating_window_border, 5, '+'), \ l:left, \ ], \ }, s:GetPopupOpts()) let l:buffer = nvim_create_buf(v:false, v:false) let l:winid = nvim_open_win(l:buffer, v:false, l:popup_opts) call nvim_buf_set_option(l:buffer, 'buftype', 'acwrite') call nvim_buf_set_option(l:buffer, 'bufhidden', 'delete') call nvim_buf_set_option(l:buffer, 'swapfile', v:false) call nvim_buf_set_option(l:buffer, 'filetype', get(a:options, 'filetype', 'ale-preview')) let w:preview = {'id': l:winid, 'buffer': l:buffer} endfunction function! s:VimCreate(options) abort " default options let l:popup_opts = extend({ \ 'line': 'cursor+1', \ 'col': 'cursor', \ 'drag': v:true, \ 'resize': v:true, \ 'close': 'button', \ 'padding': [0, 1, 0, 1], \ 'border': [], \ 'borderchars': empty(g:ale_floating_window_border) ? [' '] : [ \ get(g:ale_floating_window_border, 1, '-'), \ get(g:ale_floating_window_border, 6, '|'), \ get(g:ale_floating_window_border, 7, '-'), \ get(g:ale_floating_window_border, 0, '|'), \ get(g:ale_floating_window_border, 2, '+'), \ get(g:ale_floating_window_border, 3, '+'), \ get(g:ale_floating_window_border, 4, '+'), \ get(g:ale_floating_window_border, 5, '+'), \ ], \ 'moved': 'any', \ }, s:GetPopupOpts()) let l:popup_id = popup_create([], l:popup_opts) call setbufvar(winbufnr(l:popup_id), '&filetype', get(a:options, 'filetype', 'ale-preview')) let w:preview = {'id': l:popup_id} endfunction function! s:NvimClose() abort let l:mode = mode() let l:restore_visual = l:mode is# 'v' || l:mode is# 'V' || l:mode is# "\" if !exists('w:preview') return endif call setbufvar(w:preview['buffer'], '&modified', 0) if win_id2win(w:preview['id']) > 0 execute win_id2win(w:preview['id']).'wincmd c' endif unlet w:preview if l:restore_visual normal! gv endif endfunction function! s:VimClose() abort if !exists('w:preview') return endif call popup_close(w:preview['id']) unlet w:preview endfunction " get either the results of a function callback or dictionary for popup overrides function! s:GetPopupOpts() abort if exists('g:ale_floating_preview_popup_opts') let l:ref = g:ale_floating_preview_popup_opts if type(l:ref) is# v:t_dict return l:ref elseif type(l:ref) is# v:t_string try return function(l:ref)() catch /E700/ endtry endif endif return {} endfunction ale-4.0.0/autoload/ale/go.vim000066400000000000000000000030111476501472200157520ustar00rootroot00000000000000" Author: Horacio Sanson https://github.com/hsanson " Description: Functions for integrating with Go tools " Find the nearest dir listed in GOPATH and assume it the root of the go " project. function! ale#go#FindProjectRoot(buffer) abort let l:sep = has('win32') ? ';' : ':' let l:filename = ale#path#Simplify(expand('#' . a:buffer . ':p')) for l:name in split($GOPATH, l:sep) let l:path_dir = ale#path#Simplify(l:name) " Use the directory from GOPATH if the current filename starts with it. if l:filename[: len(l:path_dir) - 1] is? l:path_dir return l:path_dir endif endfor let l:default_go_path = ale#path#Simplify(expand('~/go')) if isdirectory(l:default_go_path) return l:default_go_path endif return '' endfunction call ale#Set('go_go111module', '') " Return a string setting Go-specific environment variables function! ale#go#EnvString(buffer) abort let l:env = '' " GO111MODULE - turn go modules behavior on/off let l:go111module = ale#Var(a:buffer, 'go_go111module') if !empty(l:go111module) let l:env = ale#Env('GO111MODULE', l:go111module) . l:env endif return l:env endfunction function! ale#go#GetGoPathExecutable(suffix) abort let l:prefix = $GOPATH if !empty($GOPATH) let l:prefix = $GOPATH elseif has('win32') let l:prefix = $USERPROFILE . '/go' else let l:prefix = $HOME . '/go' endif return ale#path#Simplify(l:prefix . '/' . a:suffix) endfunction ale-4.0.0/autoload/ale/gradle.vim000066400000000000000000000041701476501472200166120ustar00rootroot00000000000000" Author: Michael Pardo " Description: Functions for working with Gradle projects. let s:script_path = fnamemodify(resolve(expand(':p')), ':h') let s:init_path = has('win32') \ ? s:script_path . '\gradle\init.gradle' \ : s:script_path . '/gradle/init.gradle' function! ale#gradle#GetInitPath() abort return s:init_path endfunction " Given a buffer number, find a Gradle project root. function! ale#gradle#FindProjectRoot(buffer) abort let l:gradlew_path = ale#path#FindNearestFile(a:buffer, 'gradlew') if !empty(l:gradlew_path) return fnamemodify(l:gradlew_path, ':h') endif let l:settings_path = ale#path#FindNearestFile(a:buffer, 'settings.gradle') if !empty(l:settings_path) return fnamemodify(l:settings_path, ':h') endif let l:build_path = ale#path#FindNearestFile(a:buffer, 'build.gradle') if !empty(l:build_path) return fnamemodify(l:build_path, ':h') endif return '' endfunction " Given a buffer number, find the path to the executable. " First search on the path for 'gradlew', if nothing is found, try the global " command. Returns an empty string if cannot find the executable. function! ale#gradle#FindExecutable(buffer) abort let l:gradlew_path = ale#path#FindNearestFile(a:buffer, 'gradlew') if !empty(l:gradlew_path) return l:gradlew_path endif if executable('gradle') return 'gradle' endif return '' endfunction " Given a buffer number, get a working directory and command to print the " classpath of the root project. " " Returns an empty string for the command if Gradle is not detected. function! ale#gradle#BuildClasspathCommand(buffer) abort let l:executable = ale#gradle#FindExecutable(a:buffer) if !empty(l:executable) let l:project_root = ale#gradle#FindProjectRoot(a:buffer) if !empty(l:project_root) return [ \ l:project_root, \ ale#Escape(l:executable) \ . ' -I ' . ale#Escape(s:init_path) \ . ' -q printClasspath' \] endif endif return ['', ''] endfunction ale-4.0.0/autoload/ale/gradle/000077500000000000000000000000001476501472200160735ustar00rootroot00000000000000ale-4.0.0/autoload/ale/gradle/init.gradle000066400000000000000000000012031476501472200202120ustar00rootroot00000000000000class ClasspathPlugin implements Plugin { void apply(Project project) { project.task('printClasspath') { doLast { project .rootProject .allprojects .configurations .flatten() .findAll { it.name.endsWith('Classpath') } .collect { it.resolve() } .flatten() .unique() .findAll { it.exists() } .each { println it } } } } } rootProject { apply plugin: ClasspathPlugin } ale-4.0.0/autoload/ale/handlers/000077500000000000000000000000001476501472200164355ustar00rootroot00000000000000ale-4.0.0/autoload/ale/handlers/alex.vim000066400000000000000000000036701476501472200201110ustar00rootroot00000000000000scriptencoding utf-8 " Author: Johannes Wienke " Description: Error handling for errors in alex output format function! ale#handlers#alex#GetExecutable(buffer) abort return ale#path#FindExecutable(a:buffer, 'alex', [ \ 'node_modules/.bin/alex', \ 'node_modules/alex/cli.js', \]) endfunction function! ale#handlers#alex#CreateCommandCallback(flags) abort return {b -> ale#node#Executable(b, ale#handlers#alex#GetExecutable(b)) \ . ' --stdin ' \ . a:flags \} endfunction function! ale#handlers#alex#Handle(buffer, lines) abort " Example output: " 6:256-6:262 warning Be careful with “killed”, it’s profane in some cases killed retext-profanities let l:pattern = '\v^ *(\d+):(\d+)-(\d+):(\d+) +warning +(.{-}) +(.{-}) +(.{-})$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) call add(l:output, { \ 'lnum': l:match[1] + 0, \ 'col': l:match[2] + 0, \ 'end_lnum': l:match[3] + 0, \ 'end_col': l:match[4] - 1, \ 'text': l:match[5] . ' (' . (l:match[7]) . ')', \ 'type': 'W', \}) endfor return l:output endfunction " Define a linter for a specific filetype. Accept flags to adapt to the filetype. " no flags treat input as markdown " --html treat input as HTML " --mdx treat input as MDX " --text treat input as plaintext function! ale#handlers#alex#DefineLinter(filetype, flags) abort call ale#Set('alex_executable', 'alex') call ale#Set('alex_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#linter#Define(a:filetype, { \ 'name': 'alex', \ 'executable': function('ale#handlers#alex#GetExecutable'), \ 'command': ale#handlers#alex#CreateCommandCallback(a:flags), \ 'output_stream': 'stderr', \ 'callback': 'ale#handlers#alex#Handle', \}) endfunction ale-4.0.0/autoload/ale/handlers/atools.vim000066400000000000000000000025741476501472200204630ustar00rootroot00000000000000" Author: Leo " Description: Handlers for output expected from atools function! ale#handlers#atools#Handle(buffer, lines) abort " Format: SEVERITY:[TAG]:PATH:LINENUM:MSG " Example: MC:[AL5]:./APKBUILD:12:variable set to empty string: install= let l:pattern = '\([^:]\+\):\([^:]\+\):\([^:]\+\):\(\d\+\):\(.\+\)$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) " We are expected to receive 2 characters, the first character " can be 'S', 'I', 'M' 'T', which are respectively: " Serious (Error) " Important (Error) " Minor (Warning) " Style (Warning) " " The second character can be either 'C' or 'P', which are respectively: " Certain (Error) " Possible (Warning) let l:severity = matchstr(l:match[1], '^.') let l:certainty = matchstr(l:match[1], '.$') let l:type = 'E' " If the tag returns 'Minor' or 'Style' or is 'Possible' " then return a warning if l:severity is# 'M' || l:severity is# 'T' || l:certainty is# 'P' let l:type = 'W' endif call add(l:output, { \ 'lnum': l:match[4] + 0, \ 'text': l:match[5], \ 'type': l:type, \ 'code': matchstr(l:match[2], 'AL[0-9]*'), \}) endfor return l:output endfunction ale-4.0.0/autoload/ale/handlers/biome.vim000066400000000000000000000037511476501472200202530ustar00rootroot00000000000000" Author: Filip Gospodinov " Description: Functions for working with biome, for checking or fixing files. call ale#Set('biome_executable', 'biome') call ale#Set('biome_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('biome_options', '') call ale#Set('biome_fixer_apply_unsafe', 0) call ale#Set('biome_lsp_project_root', '') function! ale#handlers#biome#GetExecutable(buffer) abort return ale#path#FindExecutable(a:buffer, 'biome', [ \ 'node_modules/@biomejs/cli-linux-x64/biome', \ 'node_modules/@biomejs/cli-linux-arm64/biome', \ 'node_modules/@biomejs/cli-win32-x64/biome.exe', \ 'node_modules/@biomejs/cli-win32-arm64/biome.exe', \ 'node_modules/@biomejs/cli-darwin-x64/biome', \ 'node_modules/@biomejs/cli-darwin-arm64/biome', \ 'node_modules/.bin/biome', \]) endfunction function! ale#handlers#biome#GetLanguage(buffer) abort return getbufvar(a:buffer, '&filetype') endfunction function! ale#handlers#biome#GetProjectRoot(buffer) abort let l:project_root = ale#Var(a:buffer, 'biome_lsp_project_root') if !empty(l:project_root) return l:project_root endif let l:possible_project_roots = [ \ 'biome.json', \ 'biome.jsonc', \ 'package.json', \ '.git', \ bufname(a:buffer), \] for l:possible_root in l:possible_project_roots let l:project_root = ale#path#FindNearestFile(a:buffer, l:possible_root) if empty(l:project_root) let l:project_root = ale#path#FindNearestDirectory(a:buffer, l:possible_root) endif if !empty(l:project_root) " dir:p expands to /full/path/to/dir/ whereas " file:p expands to /full/path/to/file (no trailing slash) " Appending '/' ensures that :h:h removes the path's last segment " regardless of whether it is a directory or not. return fnamemodify(l:project_root . '/', ':p:h:h') endif endfor return '' endfunction ale-4.0.0/autoload/ale/handlers/c3lsp.vim000066400000000000000000000010471476501472200202000ustar00rootroot00000000000000scriptencoding utf-8 " Author: Koni Marti " Description: Utilities for c3lsp function! ale#handlers#c3lsp#GetProjectRoot(buffer) abort let l:config = ale#path#FindNearestFile(a:buffer, 'project.json') if !empty(l:config) return fnamemodify(l:config, ':h') endif return expand('#' . a:buffer . ':p:h') endfunction function! ale#handlers#c3lsp#GetInitOpts(buffer, init_options_var) abort let l:init_options = {} return extend(l:init_options, ale#Var(a:buffer, a:init_options_var)) endfunction ale-4.0.0/autoload/ale/handlers/cairo.vim000066400000000000000000000024371476501472200202550ustar00rootroot00000000000000" Author: 0xhyoga <0xhyoga@gmx.com>, " Description: This file implements handlers specific to Cairo " function! ale#handlers#cairo#HandleCairoErrors(buffer, lines) abort " Matches patterns like the following: " Error: Expected ';' but got '(' " --> /path/to/file/file.cairo:1:10:) let l:pattern = '\v(error|warning): (.*)$' let l:line_and_column_pattern = '\v\.cairo:(\d+):(\d+)' let l:exclude_pattern = '\vcould not compile.*' let l:output = [] for l:line in a:lines let l:match = matchlist(l:line, l:pattern) if len(l:match) == 0 let l:match = matchlist(l:line, l:line_and_column_pattern) if len(l:match) > 0 let l:index = len(l:output) - 1 let l:output[l:index]['lnum'] = l:match[1] + 0 let l:output[l:index]['col'] = l:match[2] + 0 endif else let l:text = l:match[2] if l:text !~# l:exclude_pattern let l:isError = l:match[1] is? 'Error' call add(l:output, { \ 'lnum': 0, \ 'col': 0, \ 'text': l:text, \ 'type': l:isError ? 'E' : 'W', \}) endif endif endfor return l:output endfunction ale-4.0.0/autoload/ale/handlers/ccls.vim000066400000000000000000000015531476501472200201020ustar00rootroot00000000000000scriptencoding utf-8 " Author: Ye Jingchen " Description: Utilities for ccls function! ale#handlers#ccls#GetProjectRoot(buffer) abort " Try to find ccls configuration files first. let l:config = ale#path#FindNearestFile(a:buffer, '.ccls-root') if empty(l:config) let l:config = ale#path#FindNearestFile(a:buffer, '.ccls') endif if !empty(l:config) return fnamemodify(l:config, ':h') endif " Fall back on default project root detection. return ale#c#FindProjectRoot(a:buffer) endfunction function! ale#handlers#ccls#GetInitOpts(buffer, init_options_var) abort let l:build_dir = ale#c#GetBuildDirectory(a:buffer) let l:init_options = empty(l:build_dir) ? {} : {'compilationDatabaseDirectory': l:build_dir} return extend(l:init_options, ale#Var(a:buffer, a:init_options_var)) endfunction ale-4.0.0/autoload/ale/handlers/cppcheck.vim000066400000000000000000000071771476501472200207460ustar00rootroot00000000000000" Description: Handle errors for cppcheck. function! ale#handlers#cppcheck#GetCwd(buffer) abort let [l:dir, l:json_path] = ale#c#FindCompileCommands(a:buffer) return !empty(l:dir) ? l:dir : '' endfunction function! ale#handlers#cppcheck#GetBufferPathIncludeOptions(buffer) abort let l:buffer_path_include = '' " Get path to this buffer so we can include it into cppcheck with -I " This could be expanded to get more -I directives from the compile " command in compile_commands.json, if it's found. let l:buffer_path = fnamemodify(bufname(a:buffer), ':p:h') let l:buffer_path_include = ' -I' . ale#Escape(l:buffer_path) return l:buffer_path_include endfunction function! ale#handlers#cppcheck#GetCompileCommandsOptions(buffer) abort " The compile_commands.json doesn't apply to headers and cppheck will " bail out if it cannot find a file matching the filter, below. Skip out " now, for headers. Also, suppress FPs; cppcheck is not meant to " process lone header files. let b:buffer_name = bufname(a:buffer) let b:file_extension = fnamemodify(b:buffer_name, ':e') if b:file_extension is# 'h' || b:file_extension is# 'hpp' return ale#handlers#cppcheck#GetBufferPathIncludeOptions(a:buffer) \ . ' --suppress=unusedStructMember' endif " If the current buffer is modified, using compile_commands.json does no " good, so include the file's directory instead. It's not quite as good as " using --project, but is at least equivalent to running cppcheck on this " file manually from the file's directory. let l:modified = getbufvar(a:buffer, '&modified') if l:modified return '' endif " Search upwards from the file for compile_commands.json. " " If we find it, we'll `cd` to where the compile_commands.json file is, " then use the file to set up import paths, etc. let [l:dir, l:json_path] = ale#c#FindCompileCommands(a:buffer) " By default, cppcheck processes every config in compile_commands.json. " Use --file-filter to limit to just the buffer file. return !empty(l:json_path) \ ? '--project=' . ale#Escape(l:json_path[len(l:dir) + 1: ]) . ' --file-filter=' . ale#Escape(bufname(a:buffer)) \ : '' endfunction function! ale#handlers#cppcheck#HandleCppCheckFormat(buffer, lines) abort " Look for lines like the following. " "test.cpp:974:6: error:inconclusive Array 'n[3]' accessed at index 3, which is out of bounds. [arrayIndexOutOfBounds]\ " n[3]=3; " ^ "" OR if cppcheck doesn't support {column} or {inconclusive:text}: "test.cpp:974:{column}: error:{inconclusive:inconclusive} Array 'n[3]' accessed at index 3, which is out of bounds. [arrayIndexOutOfBounds]\ " n[3]=3; " ^ " "" OR if using the misra addon: "test.c:1:16: style: misra violation (use --rule-texts= to get proper output) [misra-c2012-2.7]\' "void test( int parm ) {} " ^ let l:pattern = '\v(\f+):(\d+):(\d+|\{column\}): (\w+):(\{inconclusive:inconclusive\})? ?(.*) \[(%(\w[-.]?)+)\]\' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) if ale#path#IsBufferPath(a:buffer, l:match[1]) call add(l:output, { \ 'lnum': str2nr(l:match[2]), \ 'col': match(l:match[3],'{column}') >= 0 ? 1 : str2nr(l:match[3]), \ 'type': l:match[4] is# 'error' ? 'E' : 'W', \ 'sub_type': l:match[4] is# 'style' ? 'style' : '', \ 'text': l:match[6], \ 'code': l:match[7] \}) endif endfor return l:output endfunction ale-4.0.0/autoload/ale/handlers/cpplint.vim000066400000000000000000000012451476501472200206250ustar00rootroot00000000000000" Author: Dawid Kurek https://github.com/dawikur " Description: Handle errors for cpplint. function! ale#handlers#cpplint#HandleCppLintFormat(buffer, lines) abort " Look for lines like the following. " test.cpp:5: Estra space after ( in function call [whitespace/parents] [4] let l:pattern = '^.\{-}:\(\d\+\): *\(.\+\) *\[\(.*/.*\)\] ' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) call add(l:output, { \ 'lnum': l:match[1] + 0, \ 'col': 0, \ 'text': join(split(l:match[2])), \ 'code': l:match[3], \ 'type': 'W', \}) endfor return l:output endfunction ale-4.0.0/autoload/ale/handlers/cspell.vim000066400000000000000000000050011476501472200204300ustar00rootroot00000000000000scriptencoding utf-8 " Author: David Houston " Description: Define a handler function for cspell's output function! ale#handlers#cspell#GetExecutable(buffer) abort return ale#path#FindExecutable(a:buffer, \ 'cspell', [ \ 'node_modules/.bin/cspell', \ 'node_modules/cspell/bin.js', \ ] \) endfunction function! ale#handlers#cspell#GetLanguageId(buffer) abort let l:filetype = getbufvar(a:buffer, '&filetype') if l:filetype is# 'tex' " Vim's tex corresponds to latex language-id in cspell return 'latex' elseif l:filetype is# 'plaintex' " Vim's plaintex corresponds to tex language-id in cspell return 'tex' else " Fallback to filetype for everything else. return l:filetype endif endfunction function! ale#handlers#cspell#GetCommand(buffer) abort let l:executable = ale#handlers#cspell#GetExecutable(a:buffer) let l:options = ale#Var(a:buffer, 'cspell_options') let l:language_id = ale#handlers#cspell#GetLanguageId(a:buffer) let l:language_id_option = empty(l:language_id) ? '' : '--language-id="' . l:language_id . '"' return ale#node#Executable(a:buffer, l:executable) \ . ' lint --no-color --no-progress --no-summary' \ . ale#Pad(l:language_id_option) \ . ale#Pad(l:options) \ . ' -- stdin' endfunction function! ale#handlers#cspell#Handle(buffer, lines) abort " Look for lines like the following: " " /home/user/repos/ale/README.md:3:128 - Unknown word (Neovim) " match1: 3 " match2: 128 " match3: Unknown word (Neovim) " match4: Neovim let l:pattern = '\v^.*:(\d+):(\d+) - ([^\(]+\(([^\)]+)\).*)$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) call add(l:output, { \ 'lnum': l:match[1] + 0, \ 'col': l:match[2] + 0, \ 'end_col': l:match[2] + len(l:match[4]) - 1, \ 'text': l:match[3], \ 'type': 'W', \}) endfor return l:output endfunction function! ale#handlers#cspell#DefineLinter(filetype) abort call ale#Set('cspell_executable', 'cspell') call ale#Set('cspell_options', '') call ale#Set('cspell_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#linter#Define(a:filetype, { \ 'name': 'cspell', \ 'executable': function('ale#handlers#cspell#GetExecutable'), \ 'command': function('ale#handlers#cspell#GetCommand'), \ 'callback': 'ale#handlers#cspell#Handle', \}) endfunction ale-4.0.0/autoload/ale/handlers/css.vim000066400000000000000000000057041476501472200177500ustar00rootroot00000000000000scriptencoding utf-8 " Author: w0rp " Description: Error handling for CSS linters. function! ale#handlers#css#HandleCSSLintFormat(buffer, lines) abort " Matches patterns line the following: " " something.css: line 2, col 1, Error - Expected RBRACE at line 2, col 1. (errors) " something.css: line 2, col 5, Warning - Expected (inline | block | list-item | inline-block | table | inline-table | table-row-group | table-header-group | table-footer-group | table-row | table-column-group | table-column | table-cell | table-caption | grid | inline-grid | run-in | ruby | ruby-base | ruby-text | ruby-base-container | ruby-text-container | contents | none | -moz-box | -moz-inline-block | -moz-inline-box | -moz-inline-grid | -moz-inline-stack | -moz-inline-table | -moz-grid | -moz-grid-group | -moz-grid-line | -moz-groupbox | -moz-deck | -moz-popup | -moz-stack | -moz-marker | -webkit-box | -webkit-inline-box | -ms-flexbox | -ms-inline-flexbox | flex | -webkit-flex | inline-flex | -webkit-inline-flex) but found 'wat'. (known-properties) " " These errors can be very massive, so the type will be moved to the front " so you can actually read the error type. let l:pattern = '\v^.*: line (\d+), col (\d+), (Error|Warning) - (.+)$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) let l:item = { \ 'lnum': l:match[1] + 0, \ 'col': l:match[2] + 0, \ 'type': l:match[3] is# 'Warning' ? 'W' : 'E', \ 'text': l:match[4], \} let l:code_match = matchlist(l:match[4], '\v(.+) \(([^(]+)\)$') " Split up the error code and the text if we find one. if !empty(l:code_match) let l:item.text = l:code_match[1] let l:item.code = l:code_match[2] endif call add(l:output, l:item) endfor return l:output endfunction function! ale#handlers#css#HandleStyleLintFormat(buffer, lines) abort let l:exception_pattern = '\v^Error:' for l:line in a:lines[:10] if len(matchlist(l:line, l:exception_pattern)) > 0 return [{ \ 'lnum': 1, \ 'text': 'stylelint exception thrown (type :ALEDetail for more information)', \ 'detail': join(a:lines, "\n"), \}] endif endfor " Matches patterns line the following: " " src/main.css " 108:10 ✖ Unexpected leading zero number-leading-zero " 116:20 ✖ Expected a trailing semicolon declaration-block-trailing-semicolon let l:pattern = '\v^.* (\d+):(\d+) \s+(\S+)\s+ (.*[^ ])\s+([^ ]+)\s*$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) call add(l:output, { \ 'lnum': l:match[1] + 0, \ 'col': l:match[2] + 0, \ 'type': l:match[3] is# '✖' ? 'E' : 'W', \ 'text': l:match[4], \ 'code': l:match[5], \}) endfor return l:output endfunction ale-4.0.0/autoload/ale/handlers/deadnix.vim000066400000000000000000000014571476501472200205750ustar00rootroot00000000000000function! ale#handlers#deadnix#Handle(buffer, lines) abort let l:output = [] for l:line in a:lines try let l:file = ale#util#FuzzyJSONDecode(l:line, v:null) catch continue endtry if type(l:file) isnot v:t_dict continue endif for l:error in l:file['results'] try let l:ale_error = { \ 'lnum': l:error['line'], \ 'col': l:error['column'], \ 'end_col': l:error['endColumn'], \ 'text': l:error['message'], \ 'type': 'W', \} catch continue endtry call add(l:output, l:ale_error) endfor endfor return l:output endfunction ale-4.0.0/autoload/ale/handlers/deno.vim000066400000000000000000000053061476501472200201030ustar00rootroot00000000000000" Author: Mohammed Chelouti - https://github.com/motato1 " Arnold Chand " Description: Handler functions for Deno. call ale#Set('deno_executable', 'deno') call ale#Set('deno_unstable', 0) call ale#Set('deno_import_map', 'import_map.json') call ale#Set('deno_lsp_project_root', '') function! ale#handlers#deno#GetExecutable(buffer) abort return ale#Var(a:buffer, 'deno_executable') endfunction " Find project root for Deno's language server. " " Deno projects do not require a project or configuration file at the project root. " This means the root directory has to be guessed, " unless it is explicitly specified by the user. " " The project root is determined by ... " 1. using a user-specified value from deno_lsp_project_root " 2. looking for common top-level files/dirs " 3. using the buffer's directory function! ale#handlers#deno#GetProjectRoot(buffer) abort let l:project_root = ale#Var(a:buffer, 'deno_lsp_project_root') if !empty(l:project_root) return l:project_root endif let l:possible_project_roots = [ \ 'deno.json', \ 'deno.jsonc', \ 'tsconfig.json', \ '.git', \ bufname(a:buffer), \] for l:possible_root in l:possible_project_roots let l:project_root = ale#path#FindNearestFile(a:buffer, l:possible_root) if empty(l:project_root) let l:project_root = ale#path#FindNearestDirectory(a:buffer, l:possible_root) endif if !empty(l:project_root) " dir:p expands to /full/path/to/dir/ whereas " file:p expands to /full/path/to/file (no trailing slash) " Appending '/' ensures that :h:h removes the path's last segment " regardless of whether it is a directory or not. return fnamemodify(l:project_root . '/', ':p:h:h') endif endfor return '' endfunction " Initialization Options for deno, for javascript and typescript function! ale#handlers#deno#GetInitializationOptions(buffer) abort let l:options = { \ 'enable': v:true, \ 'lint': v:true, \ 'unstable': v:false, \ 'importMap': ale#path#FindNearestFile(a:buffer, 'import_map.json'), \ } if ale#Var(a:buffer, 'deno_unstable') let l:options.unstable = v:true endif " Look for a value set using the historical option name. let l:import_map = getbufvar( \ a:buffer, \ 'ale_deno_importMap', \ get(g:, 'ale_deno_importMap', '') \) if empty(l:import_map) let l:import_map = ale#Var(a:buffer, 'deno_import_map') endif if !empty(l:import_map) let l:options.importMap = ale#path#FindNearestFile(a:buffer, l:import_map) endif return l:options endfunction ale-4.0.0/autoload/ale/handlers/elixir.vim000066400000000000000000000017471476501472200204570ustar00rootroot00000000000000" Author: Matteo Centenaro (bugant) - https://github.com/bugant " Author: Jon Parise " Description: Functions for working with Elixir projects " Find the root directory for an elixir project that uses mix. function! ale#handlers#elixir#FindMixProjectRoot(buffer) abort let l:mix_file = ale#path#FindNearestFile(a:buffer, 'mix.exs') if !empty(l:mix_file) return fnamemodify(l:mix_file, ':p:h') endif return '.' endfunction " Similar to ale#handlers#elixir#FindMixProjectRoot but also continue the " search upward for a potential umbrella project root. If an umbrella root " does not exist, the initial project root will be returned. function! ale#handlers#elixir#FindMixUmbrellaRoot(buffer) abort let l:app_root = ale#handlers#elixir#FindMixProjectRoot(a:buffer) let l:umbrella_root = fnamemodify(l:app_root, ':h:h') if filereadable(l:umbrella_root . '/mix.exs') return l:umbrella_root endif return l:app_root endfunction ale-4.0.0/autoload/ale/handlers/embertemplatelint.vim000066400000000000000000000045261476501472200226760ustar00rootroot00000000000000" Author: Adrian Zalewski " Description: Ember-template-lint for checking Handlebars files function! ale#handlers#embertemplatelint#GetExecutable(buffer) abort return ale#path#FindExecutable(a:buffer, 'handlebars_embertemplatelint', [ \ 'node_modules/.bin/ember-template-lint', \]) endfunction function! ale#handlers#embertemplatelint#GetCommand(buffer, version) abort if ale#semver#GTE(a:version, [4, 0, 0]) " --json was removed in favor of --format=json in ember-template-lint@4.0.0 return '%e --format=json --filename %s' endif return '%e --json --filename %s' endfunction function! ale#handlers#embertemplatelint#GetCommandWithVersionCheck(buffer) abort return ale#semver#RunWithVersionCheck( \ a:buffer, \ ale#handlers#embertemplatelint#GetExecutable(a:buffer), \ '%e --version', \ function('ale#handlers#embertemplatelint#GetCommand'), \) endfunction function! ale#handlers#embertemplatelint#Handle(buffer, lines) abort let l:output = [] let l:json = ale#util#FuzzyJSONDecode(a:lines, {}) for l:error in get(values(l:json), 0, []) if has_key(l:error, 'fatal') call add(l:output, { \ 'lnum': get(l:error, 'line', 1), \ 'col': get(l:error, 'column', 1), \ 'text': l:error.message, \ 'type': l:error.severity == 1 ? 'W' : 'E', \}) else call add(l:output, { \ 'lnum': l:error.line, \ 'col': l:error.column, \ 'text': l:error.rule . ': ' . l:error.message, \ 'type': l:error.severity == 1 ? 'W' : 'E', \}) endif endfor return l:output endfunction function! ale#handlers#embertemplatelint#DefineLinter(filetype) abort call ale#Set('handlebars_embertemplatelint_executable', 'ember-template-lint') call ale#Set('handlebars_embertemplatelint_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#linter#Define(a:filetype, { \ 'name': 'embertemplatelint', \ 'aliases': ['ember-template-lint'], \ 'executable': function('ale#handlers#embertemplatelint#GetExecutable'), \ 'command': function('ale#handlers#embertemplatelint#GetCommandWithVersionCheck'), \ 'callback': 'ale#handlers#embertemplatelint#Handle', \}) endfunction ale-4.0.0/autoload/ale/handlers/eslint.vim000066400000000000000000000170251476501472200204550ustar00rootroot00000000000000" Author: w0rp " Description: Functions for working with eslint, for checking or fixing files. let s:executables = [ \ '.yarn/sdks/eslint/bin/eslint.js', \ 'node_modules/.bin/eslint_d', \ 'node_modules/eslint/bin/eslint.js', \ 'node_modules/.bin/eslint', \] let s:sep = has('win32') ? '\' : '/' call ale#Set('javascript_eslint_options', '') call ale#Set('javascript_eslint_executable', 'eslint') call ale#Set('javascript_eslint_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('javascript_eslint_suppress_eslintignore', 0) call ale#Set('javascript_eslint_suppress_missing_config', 0) function! ale#handlers#eslint#FindConfig(buffer) abort for l:path in ale#path#Upwards(expand('#' . a:buffer . ':p:h')) for l:basename in [ \ 'eslint.config.js', \ 'eslint.config.mjs', \ 'eslint.config.cjs', \ '.eslintrc.js', \ '.eslintrc.cjs', \ '.eslintrc.yaml', \ '.eslintrc.yml', \ '.eslintrc.json', \ '.eslintrc', \] let l:config = ale#path#Simplify(join([l:path, l:basename], s:sep)) if filereadable(l:config) return l:config endif endfor endfor return ale#path#FindNearestFile(a:buffer, 'package.json') endfunction function! ale#handlers#eslint#GetExecutable(buffer) abort return ale#path#FindExecutable(a:buffer, 'javascript_eslint', s:executables) endfunction " Given a buffer, return an appropriate working directory for ESLint. function! ale#handlers#eslint#GetCwd(buffer) abort return ale#path#Dirname(ale#handlers#eslint#FindConfig(a:buffer)) endfunction function! ale#handlers#eslint#GetCommand(buffer) abort let l:executable = ale#handlers#eslint#GetExecutable(a:buffer) let l:options = ale#Var(a:buffer, 'javascript_eslint_options') return ale#node#Executable(a:buffer, l:executable) \ . (!empty(l:options) ? ' ' . l:options : '') \ . ' -f json --stdin --stdin-filename %s' endfunction function! s:AddHintsForTypeScriptParsingErrors(output) abort for l:item in a:output let l:item.text = substitute( \ l:item.text, \ '^\(Parsing error\)', \ '\1 (You may need configure typescript-eslint-parser)', \ '', \) endfor endfunction function! s:CheckForBadConfig(buffer, lines) abort let l:config_error_pattern = '\v^ESLint couldn''t find a configuration file' \ . '|^Cannot read config file' \ . '|^.*Configuration for rule .* is invalid' \ . '|^ImportDeclaration should appear' " Look for a message in the first few lines which indicates that " a configuration file couldn't be found. for l:line in a:lines[:10] let l:match = matchlist(l:line, l:config_error_pattern) if len(l:match) > 0 " Don't show the missing config error if we've disabled it. if ale#Var(a:buffer, 'javascript_eslint_suppress_missing_config') \&& l:match[0] is# 'ESLint couldn''t find a configuration file' return 0 endif return 1 endif endfor return 0 endfunction function! s:parseJSON(buffer, lines) abort let l:parsed = [] for l:line in a:lines try let l:parsed = extend(l:parsed, json_decode(l:line)) catch endtry endfor if type(l:parsed) != v:t_list || empty(l:parsed) return [] endif let l:errors = l:parsed[0]['messages'] if empty(l:errors) return [] endif let l:output = [] for l:error in l:errors let l:obj = ({ \ 'lnum': get(l:error, 'line', 0), \ 'text': get(l:error, 'message', ''), \ 'type': 'E', \}) if get(l:error, 'severity', 0) is# 1 let l:obj.type = 'W' endif if has_key(l:error, 'ruleId') let l:code = l:error['ruleId'] " Sometimes ESLint returns null here if !empty(l:code) let l:obj.code = l:code endif endif if has_key(l:error, 'column') let l:obj.col = l:error['column'] endif if has_key(l:error, 'endColumn') let l:obj.end_col = l:error['endColumn'] - 1 endif if has_key(l:error, 'endLine') let l:obj.end_lnum = l:error['endLine'] endif call add(l:output, l:obj) endfor return l:output endfunction let s:col_end_patterns = [ \ '\vParsing error: Unexpected token (.+) ?', \ '\v''(.+)'' is not defined.', \ '\v%(Unexpected|Redundant use of) [''`](.+)[''`]', \ '\vUnexpected (console) statement', \] function! s:parseLines(buffer, lines) abort " Matches patterns line the following: " " /path/to/some-filename.js:47:14: Missing trailing comma. [Warning/comma-dangle] " /path/to/some-filename.js:56:41: Missing semicolon. [Error/semi] let l:pattern = '^.*:\(\d\+\):\(\d\+\): \(.\+\) \[\(.\+\)\]$' " This second pattern matches lines like the following: " " /path/to/some-filename.js:13:3: Parsing error: Unexpected token let l:parsing_pattern = '^.*:\(\d\+\):\(\d\+\): \(.\+\)$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, [l:pattern, l:parsing_pattern]) let l:text = l:match[3] let l:obj = { \ 'lnum': l:match[1] + 0, \ 'col': l:match[2] + 0, \ 'text': l:text, \ 'type': 'E', \} " Take the error type from the output if available. let l:split_code = split(l:match[4], '/') if get(l:split_code, 0, '') is# 'Warning' let l:obj.type = 'W' endif " The code can be something like 'Error/foo/bar', or just 'Error' if !empty(get(l:split_code, 1)) let l:obj.code = join(l:split_code[1:], '/') endif for l:col_match in ale#util#GetMatches(l:text, s:col_end_patterns) let l:obj.end_col = l:obj.col + len(l:col_match[1]) - 1 endfor call add(l:output, l:obj) endfor return l:output endfunction function! s:FilterResult(buffer, obj) abort if ale#Var(a:buffer, 'javascript_eslint_suppress_eslintignore') if a:obj.text =~# '^File ignored' return 0 endif endif if has_key(a:obj, 'code') && a:obj.code is# 'no-trailing-spaces' \&& !ale#Var(a:buffer, 'warn_about_trailing_whitespace') return 0 endif return 1 endfunction function! s:HandleESLintOutput(buffer, lines, type) abort if s:CheckForBadConfig(a:buffer, a:lines) return [{ \ 'lnum': 1, \ 'text': 'eslint configuration error (type :ALEDetail for more information)', \ 'detail': join(a:lines, "\n"), \}] endif if a:lines == ['Could not connect'] return [{ \ 'lnum': 1, \ 'text': 'Could not connect to eslint_d. Try updating eslint_d or killing it.', \}] endif if a:type is# 'json' let l:output = s:parseJSON(a:buffer, a:lines) else let l:output = s:parseLines(a:buffer, a:lines) endif call filter(l:output, {idx, obj -> s:FilterResult(a:buffer, obj)}) if expand('#' . a:buffer . ':t') =~? '\.tsx\?$' call s:AddHintsForTypeScriptParsingErrors(l:output) endif return l:output endfunction function! ale#handlers#eslint#HandleJSON(buffer, lines) abort return s:HandleESLintOutput(a:buffer, a:lines, 'json') endfunction function! ale#handlers#eslint#Handle(buffer, lines) abort return s:HandleESLintOutput(a:buffer, a:lines, 'lines') endfunction ale-4.0.0/autoload/ale/handlers/fecs.vim000066400000000000000000000030411476501472200200700ustar00rootroot00000000000000" Author: harttle " Description: fecs http://fecs.baidu.com/ call ale#Set('javascript_fecs_executable', 'fecs') call ale#Set('javascript_fecs_use_global', get(g:, 'ale_use_global_executables', 0)) function! ale#handlers#fecs#GetCommand(buffer) abort return '%e check --colors=false --rule=true %t' endfunction function! ale#handlers#fecs#GetExecutable(buffer) abort return ale#path#FindExecutable(a:buffer, 'javascript_fecs', [ \ 'node_modules/.bin/fecs', \ 'node_modules/fecs/bin/fecs', \]) endfunction function! ale#handlers#fecs#Handle(buffer, lines) abort " Matches patterns looking like the following " " fecs WARN → line 20, col 25: Unexpected console statement. (no-console) " fecs ERROR → line 24, col 36: Missing radix parameter. (radix) " let l:pattern = '\v^.*(WARN|ERROR)\s+→\s+line (\d+),\s+col\s+(\d+):\s+(.*)$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) let l:obj = { \ 'lnum': l:match[2] + 0, \ 'col': l:match[3] + 0, \ 'text': l:match[4] \} let l:code_match = matchlist(l:match[4], '\v^(.{-})\s*\((.+)\)$') if !empty(l:code_match) let l:obj.code = l:code_match[2] let l:obj.text = l:code_match[1] endif if l:match[1] is# 'WARN' let l:obj.type = 'W' elseif l:match[1] is# 'ERROR' let l:obj.type = 'E' endif call add(l:output, l:obj) endfor return l:output endfunction ale-4.0.0/autoload/ale/handlers/flawfinder.vim000066400000000000000000000041211476501472200212710ustar00rootroot00000000000000scriptencoding utf-8 " Author: Christian Gibbons " Description: This file defines a handler function that should work for the " flawfinder format with the -CDQS flags. " Swiped this function from the GCC handler. Not sure if needed, but doesn't " hurt to have it. function! s:RemoveUnicodeQuotes(text) abort let l:text = a:text let l:text = substitute(l:text, '[`´‘’]', '''', 'g') let l:text = substitute(l:text, '\v\\u2018([^\\]+)\\u2019', '''\1''', 'g') let l:text = substitute(l:text, '[“”]', '"', 'g') return l:text endfunction function! ale#handlers#flawfinder#HandleFlawfinderFormat(buffer, lines) abort " Look for lines like the following. " " :12:4: [2] (buffer) char:Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. " :31:4: [1] (buffer) strncpy:Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):(\d+)?:? ( \[[0-5]\] [^:]+):(.+)$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) " Use severity level to determine if it should be considered a warning " or error. let l:severity = str2nr(matchstr(split(l:match[4])[0], '[0-5]')) let l:item = { \ 'lnum': str2nr(l:match[2]), \ 'col': str2nr(l:match[3]), \ 'type': (l:severity < ale#Var(a:buffer, 'c_flawfinder_error_severity')) \ ? 'W' : 'E', \ 'text': s:RemoveUnicodeQuotes(join(split(l:match[4])[1:]) . ': ' . l:match[5]), \} " If the filename is something like , or -, then " this is an error for the file we checked. if l:match[1] isnot# '-' && l:match[1][0] isnot# '<' let l:item['filename'] = l:match[1] endif call add(l:output, l:item) endfor return l:output endfunction ale-4.0.0/autoload/ale/handlers/gawk.vim000066400000000000000000000014071476501472200201050ustar00rootroot00000000000000" Author: Anthony DeDominic " Description: Handle output from gawk's --lint option function! ale#handlers#gawk#HandleGawkFormat(buffer, lines) abort " Look for lines like the following: " gawk: /tmp/v0fddXz/1/something.awk:1: ^ invalid char ''' in expression let l:pattern = '^.\{-}:\(\d\+\):\s\+\(warning:\|\^\)\s*\(.*\)' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) let l:ecode = 'E' if l:match[2] is? 'warning:' let l:ecode = 'W' endif call add(l:output, { \ 'lnum': l:match[1] + 0, \ 'col': 0, \ 'text': l:match[3], \ 'code': 0, \ 'type': l:ecode, \}) endfor return l:output endfunction ale-4.0.0/autoload/ale/handlers/gcc.vim000066400000000000000000000140461476501472200177130ustar00rootroot00000000000000scriptencoding utf-8 " Author: w0rp " Description: This file defines a handler function which ought to work for " any program which outputs errors in the format that GCC uses. let s:pragma_error = '#pragma once in main file' " Look for lines like the following. " " :8:5: warning: conversion lacks type at end of format [-Wformat=] " :10:27: error: invalid operands to binary - (have ‘int’ and ‘char *’) " -:189:7: note: $/${} is unnecessary on arithmetic variables. [SC2004] let s:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+)?:?(\d+)?:? ([^:]+): (.+)$' let s:inline_pattern = '\v inlined from .* at \:(\d+):(\d+):$' function! s:IsHeaderFile(filename) abort return a:filename =~? '\v\.(h|hpp)$' endfunction function! s:RemoveUnicodeQuotes(text) abort let l:text = a:text let l:text = substitute(l:text, '[`´‘’]', '''', 'g') let l:text = substitute(l:text, '\v\\u2018([^\\]+)\\u2019', '''\1''', 'g') let l:text = substitute(l:text, '[“”]', '"', 'g') return l:text endfunction function! s:ParseInlinedFunctionProblems(buffer, lines) abort let l:output = [] let l:pos_match = [] for l:line in a:lines let l:match = matchlist(l:line, s:pattern) if !empty(l:match) && !empty(l:pos_match) call add(l:output, { \ 'lnum': str2nr(l:pos_match[1]), \ 'col': str2nr(l:pos_match[2]), \ 'type': (l:match[4] is# 'error' || l:match[4] is# 'fatal error') ? 'E' : 'W', \ 'text': s:RemoveUnicodeQuotes(l:match[5]), \}) endif let l:pos_match = matchlist(l:line, s:inline_pattern) endfor return l:output endfunction " Report problems inside of header files just for gcc and clang function! s:ParseProblemsInHeaders(buffer, lines) abort let l:output = [] let l:include_item = {} for l:line in a:lines[: -2] let l:include_match = matchlist(l:line, '\v^In file included from') if !empty(l:include_item) let l:pattern_match = matchlist(l:line, s:pattern) if !empty(l:pattern_match) && l:pattern_match[1] is# '' if has_key(l:include_item, 'lnum') call add(l:output, l:include_item) endif let l:include_item = {} continue endif let l:include_item.detail .= "\n" . l:line endif if !empty(l:include_match) if empty(l:include_item) let l:include_item = { \ 'text': 'Error found in header. See :ALEDetail', \ 'detail': l:line, \} endif endif if !empty(l:include_item) let l:stdin_match = matchlist(l:line, '\vfrom \:(\d+):(\d*):?$') if !empty(l:stdin_match) let l:include_item.lnum = str2nr(l:stdin_match[1]) if str2nr(l:stdin_match[2]) let l:include_item.col = str2nr(l:stdin_match[2]) endif endif endif endfor if !empty(l:include_item) && has_key(l:include_item, 'lnum') call add(l:output, l:include_item) endif return l:output endfunction function! ale#handlers#gcc#HandleGCCFormat(buffer, lines) abort let l:output = [] for l:match in ale#util#GetMatches(a:lines, s:pattern) " Filter out the pragma errors if s:IsHeaderFile(bufname(bufnr(''))) \&& l:match[5][:len(s:pragma_error) - 1] is# s:pragma_error continue endif " If the 'error type' is a note, make it detail related to " the previous error parsed in output if l:match[4] is# 'note' if !empty(l:output) if !has_key(l:output[-1], 'detail') let l:output[-1].detail = l:output[-1].text " handle macro expansion errors/notes if l:match[5] =~? '^in expansion of macro ‘\w*\w’$' " if the macro expansion is in the file we're in, add " the lnum and col keys to the previous error if l:match[1] is# '' \ && !has_key(l:output[-1], 'col') let l:output[-1].lnum = str2nr(l:match[2]) let l:output[-1].col = str2nr(l:match[3]) else " the error is not in the current file, and since " macro expansion errors don't show the full path to " the error from the current file, we have to just " give out a generic error message let l:output[-1].text = 'Error found in macro expansion. See :ALEDetail' endif endif endif let l:output[-1].detail = l:output[-1].detail . "\n" \ . s:RemoveUnicodeQuotes(l:match[0]) endif continue endif let l:item = { \ 'lnum': str2nr(l:match[2]), \ 'type': (l:match[4] is# 'error' || l:match[4] is# 'fatal error') ? 'E' : 'W', \ 'text': s:RemoveUnicodeQuotes(l:match[5]), \} if !empty(l:match[3]) let l:item.col = str2nr(l:match[3]) endif " If the filename is something like , or -, then " this is an error for the file we checked. if l:match[1] isnot# '-' && l:match[1][0] isnot# '<' let l:item['filename'] = l:match[1] endif call add(l:output, l:item) endfor return l:output endfunction " Handle problems with the GCC format, but report problems inside of headers. function! ale#handlers#gcc#HandleGCCFormatWithIncludes(buffer, lines) abort let l:output = ale#handlers#gcc#HandleGCCFormat(a:buffer, a:lines) call extend(l:output, s:ParseInlinedFunctionProblems(a:buffer, a:lines)) call extend(l:output, s:ParseProblemsInHeaders(a:buffer, a:lines)) return l:output endfunction ale-4.0.0/autoload/ale/handlers/go.vim000066400000000000000000000016031476501472200175570ustar00rootroot00000000000000" Author: neersighted " Description: go vet for Go files " " Author: John Eikenberry " Description: updated to work with go1.10 " " Author: Ben Paxton " Description: moved to generic Golang file from govet " " Author: mostfunkyduck " Description: updated to work with go 1.14 function! ale#handlers#go#Handler(buffer, lines) abort let l:pattern = '\v^%(vet: )?([a-zA-Z]?:?[^:]+):(\d+):?(\d+)?:? ?(.+)$' let l:output = [] let l:dir = expand('#' . a:buffer . ':p:h') for l:match in ale#util#GetMatches(a:lines, l:pattern) call add(l:output, { \ 'filename': ale#path#GetAbsPath(l:dir, l:match[1]), \ 'lnum': l:match[2] + 0, \ 'col': l:match[3] + 0, \ 'text': l:match[4], \ 'type': 'E', \}) endfor return l:output endfunction ale-4.0.0/autoload/ale/handlers/haskell.vim000066400000000000000000000070661476501472200206060ustar00rootroot00000000000000" Author: w0rp " Description: Error handling for the format GHC outputs. " function! ale#handlers#haskell#GetStackExecutable(bufnr) abort if ale#path#FindNearestFile(a:bufnr, 'stack.yaml') isnot# '' return 'stack' endif " if there is no stack.yaml file, we don't use stack even if it exists, " so we return '', because executable('') apparently always fails return '' endfunction " Remember the directory used for temporary files for Vim. let s:temp_dir = fnamemodify(ale#util#Tempname(), ':h') " Build part of a regular expression for matching ALE temporary filenames. let s:temp_regex_prefix = \ '\M' \ . substitute(s:temp_dir, '\\', '\\\\', 'g') \ . '\.\{-}' function! s:PanicOutput(lines) abort return [{ \ 'lnum': 1, \ 'col': 1, \ 'text': 'ghc panic!', \ 'type': 'E', \ 'detail' : join(a:lines, "\n"), \}] endfunction function! ale#handlers#haskell#HandleGHCFormat(buffer, lines) abort " Look for lines like the following. " "Appoint/Lib.hs:8:1: warning: "Appoint/Lib.hs:8:1: let l:basename = expand('#' . a:buffer . ':t') " Build a complete regular expression for replacing temporary filenames " in Haskell error messages with the basename for this file. let l:temp_filename_regex = s:temp_regex_prefix . l:basename let l:pattern = '\v^\s*([a-zA-Z]?:?[^:]+):(\d+):(\d+):(.*)?$' let l:output = [] let l:corrected_lines = [] " If ghc panic error, put the whole message in details and exit. let l:panic_position = match(a:lines,'ghc: panic!') let l:panic_end = match(a:lines,'Please report this as a GHC bug:') if l:panic_position >= 0 return s:PanicOutput(a:lines[l:panic_position : l:panic_end]) endif " Group the lines into smaller lists. for l:line in a:lines if len(matchlist(l:line, l:pattern)) > 0 call add(l:corrected_lines, [l:line]) elseif l:line is# '' call add(l:corrected_lines, [l:line]) elseif len(l:corrected_lines) > 0 call add(l:corrected_lines[-1], l:line) endif endfor for l:line_list in l:corrected_lines " Join the smaller lists into one large line to parse. let l:line = l:line_list[0] for l:extra_line in l:line_list[1:] let l:line .= substitute(l:extra_line, '\v^\s+', ' ', '') endfor let l:match = matchlist(l:line, l:pattern) if len(l:match) == 0 continue endif if !ale#path#IsBufferPath(a:buffer, l:match[1]) continue endif let l:errors = matchlist(l:match[4], '\v([wW]arning|[eE]rror): ?(.*)') if len(l:errors) > 0 let l:ghc_type = l:errors[1] let l:text = l:errors[2] else let l:ghc_type = '' let l:text = l:match[4][:0] is# ' ' ? l:match[4][1:] : l:match[4] endif if l:ghc_type is? 'Warning' let l:type = 'W' else let l:type = 'E' endif " Replace temporary filenames in problem messages with the basename let l:text = substitute(l:text, l:temp_filename_regex, l:basename, 'g') let l:item = { \ 'lnum': l:match[2] + 0, \ 'col': l:match[3] + 0, \ 'text': l:text, \ 'type': l:type, \} " Include extra lines as details if they are there. if len(l:line_list) > 1 let l:item.detail = join(l:line_list[1:], "\n") endif call add(l:output, l:item) endfor return l:output endfunction ale-4.0.0/autoload/ale/handlers/haskell_stack.vim000066400000000000000000000004061476501472200217620ustar00rootroot00000000000000function! ale#handlers#haskell_stack#EscapeExecutable(executable, stack_exec) abort let l:exec_args = a:executable =~? 'stack$' \ ? ' exec ' . ale#Escape(a:stack_exec) . ' --' \ : '' return ale#Escape(a:executable) . l:exec_args endfunction ale-4.0.0/autoload/ale/handlers/hdl_checker.vim000066400000000000000000000051331476501472200214070ustar00rootroot00000000000000" Author: suoto " Description: Adds support for HDL Code Checker, which wraps vcom/vlog, ghdl " or xvhdl. More info on https://github.com/suoto/hdl_checker call ale#Set('hdl_checker_executable', 'hdl_checker') call ale#Set('hdl_checker_config_file', has('unix') ? '.hdl_checker.config' : '_hdl_checker.config') call ale#Set('hdl_checker_options', '') " Use this as a function so we can mock it on testing. Need to do this because " test files are inside /testplugin (which refers to the ale repo), which will " always have a .git folder function! ale#handlers#hdl_checker#IsDotGit(path) abort return ! empty(a:path) && isdirectory(a:path) endfunction " Should return (in order of preference) " 1. Nearest config file " 2. Nearest .git directory " 3. The current path function! ale#handlers#hdl_checker#GetProjectRoot(buffer) abort let l:project_root = ale#path#FindNearestFile( \ a:buffer, \ ale#Var(a:buffer, 'hdl_checker_config_file')) if !empty(l:project_root) return fnamemodify(l:project_root, ':h') endif " Search for .git to use as root let l:project_root = ale#path#FindNearestDirectory(a:buffer, '.git') if ale#handlers#hdl_checker#IsDotGit(l:project_root) return fnamemodify(l:project_root, ':h:h') endif return '' endfunction function! ale#handlers#hdl_checker#GetExecutable(buffer) abort return ale#Var(a:buffer, 'hdl_checker_executable') endfunction function! ale#handlers#hdl_checker#GetCommand(buffer) abort let l:command = ale#Escape(ale#handlers#hdl_checker#GetExecutable(a:buffer)) . ' --lsp' " Add extra parameters only if config has been set let l:options = ale#Var(a:buffer, 'hdl_checker_options') if ! empty(l:options) let l:command = l:command . ' ' . l:options endif return l:command endfunction " To allow testing function! ale#handlers#hdl_checker#GetInitOptions(buffer) abort return {'project_file': ale#Var(a:buffer, 'hdl_checker_config_file')} endfunction " Define the hdl_checker linter for a given filetype. function! ale#handlers#hdl_checker#DefineLinter(filetype) abort call ale#linter#Define(a:filetype, { \ 'name': 'hdl_checker', \ 'aliases': ['hdl-checker'], \ 'lsp': 'stdio', \ 'language': a:filetype, \ 'executable': function('ale#handlers#hdl_checker#GetExecutable'), \ 'command': function('ale#handlers#hdl_checker#GetCommand'), \ 'project_root': function('ale#handlers#hdl_checker#GetProjectRoot'), \ 'initialization_options': function('ale#handlers#hdl_checker#GetInitOptions'), \ }) endfunction ale-4.0.0/autoload/ale/handlers/hlint.vim000066400000000000000000000005201476501472200202650ustar00rootroot00000000000000call ale#Set('haskell_hlint_executable', 'hlint') call ale#Set('haskell_hlint_options', get(g:, 'hlint_options', '')) function! ale#handlers#hlint#GetExecutable(buffer) abort let l:executable = ale#Var(a:buffer, 'haskell_hlint_executable') return ale#handlers#haskell_stack#EscapeExecutable(l:executable, 'hlint') endfunction ale-4.0.0/autoload/ale/handlers/inko.vim000066400000000000000000000015761476501472200201230ustar00rootroot00000000000000" Author: Yorick Peterse " Description: output handlers for the Inko JSON format function! ale#handlers#inko#GetType(severity) abort if a:severity is? 'warning' return 'W' endif return 'E' endfunction function! ale#handlers#inko#Handle(buffer, lines) abort try let l:errors = json_decode(join(a:lines, '')) catch return [] endtry if empty(l:errors) return [] endif let l:output = [] let l:dir = expand('#' . a:buffer . ':p:h') for l:error in l:errors call add(l:output, { \ 'filename': ale#path#GetAbsPath(l:dir, l:error['file']), \ 'lnum': l:error['line'], \ 'col': l:error['column'], \ 'text': l:error['message'], \ 'type': ale#handlers#inko#GetType(l:error['level']), \}) endfor return l:output endfunction ale-4.0.0/autoload/ale/handlers/ktlint.vim000066400000000000000000000026701476501472200204640ustar00rootroot00000000000000" Author: Michael Phillips " Description: Handler functions for ktlint. call ale#Set('kotlin_ktlint_executable', 'ktlint') call ale#Set('kotlin_ktlint_rulesets', []) call ale#Set('kotlin_ktlint_options', '') function! ale#handlers#ktlint#GetCommand(buffer) abort let l:executable = ale#Var(a:buffer, 'kotlin_ktlint_executable') let l:options = ale#Var(a:buffer, 'kotlin_ktlint_options') let l:rulesets = ale#handlers#ktlint#GetRulesets(a:buffer) return ale#Escape(l:executable) \ . (empty(l:options) ? '' : ' ' . l:options) \ . (empty(l:rulesets) ? '' : ' ' . l:rulesets) \ . ' --stdin' endfunction function! ale#handlers#ktlint#GetRulesets(buffer) abort let l:rulesets = map(ale#Var(a:buffer, 'kotlin_ktlint_rulesets'), '''--ruleset '' . v:val') return join(l:rulesets, ' ') endfunction function! ale#handlers#ktlint#Handle(buffer, lines) abort let l:message_pattern = '^\(.*\):\([0-9]\+\):\([0-9]\+\):\s\+\(.*\)' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:message_pattern) let l:line = l:match[2] + 0 let l:column = l:match[3] + 0 let l:text = l:match[4] let l:type = l:text =~? 'not a valid kotlin file' ? 'E' : 'W' call add(l:output, { \ 'lnum': l:line, \ 'col': l:column, \ 'text': l:text, \ 'type': l:type \}) endfor return l:output endfunction ale-4.0.0/autoload/ale/handlers/languagetool.vim000066400000000000000000000053011476501472200216320ustar00rootroot00000000000000" Author: Vincent (wahrwolf [at] wolfpit.net) " Description: languagetool for markdown files " call ale#Set('languagetool_executable', 'languagetool') call ale#Set('languagetool_options', '--autoDetect') function! ale#handlers#languagetool#GetExecutable(buffer) abort return ale#Var(a:buffer, 'languagetool_executable') endfunction function! ale#handlers#languagetool#GetCommand(buffer) abort let l:executable = ale#handlers#languagetool#GetExecutable(a:buffer) let l:options = ale#Var(a:buffer, 'languagetool_options') return ale#Escape(l:executable) \ . (empty(l:options) ? '' : ' ' . l:options) . ' %s' endfunction function! ale#handlers#languagetool#HandleOutput(buffer, lines) abort " Match lines like: " 1.) Line 5, column 1, Rule ID: let l:head_pattern = '^\v.+.\) Line (\d+), column (\d+), Rule ID. (.+)$' let l:head_matches = ale#util#GetMatches(a:lines, l:head_pattern) " Match lines like: " Message: Did you forget a comma after a conjunctive/linking adverb? let l:message_pattern = '^\vMessage. (.+)$' let l:message_matches = ale#util#GetMatches(a:lines, l:message_pattern) " Match lines like: " ^^^^^ " let l:markers_pattern = '^\v *(\^+) *$' let l:markers_matches = ale#util#GetMatches(a:lines, l:markers_pattern) let l:output = [] " Okay tbh I was to lazy to figure out a smarter solution here " We just check that the arrays are same sized and merge everything " together let l:i = 0 while l:i < len(l:head_matches) \ && ( \ (len(l:head_matches) == len(l:markers_matches)) \ && (len(l:head_matches) == len(l:message_matches)) \ ) let l:item = { \ 'lnum' : str2nr(l:head_matches[l:i][1]), \ 'col' : str2nr(l:head_matches[l:i][2]), \ 'end_col' : str2nr(l:head_matches[l:i][2]) + len(l:markers_matches[l:i][1])-1, \ 'type' : 'W', \ 'code' : l:head_matches[l:i][3], \ 'text' : l:message_matches[l:i][1] \} call add(l:output, l:item) let l:i+=1 endwhile return l:output endfunction " Define the languagetool linter for a given filetype. " TODO: " - Add language detection settings based on user env (for mothertongue) " - Add fixer " - Add config options for rules function! ale#handlers#languagetool#DefineLinter(filetype) abort call ale#linter#Define(a:filetype, { \ 'name': 'languagetool', \ 'executable': function('ale#handlers#languagetool#GetExecutable'), \ 'command': function('ale#handlers#languagetool#GetCommand'), \ 'output_stream': 'stdout', \ 'callback': 'ale#handlers#languagetool#HandleOutput', \ 'lint_file': 1, \}) endfunction ale-4.0.0/autoload/ale/handlers/markdownlint.vim000066400000000000000000000012241476501472200216620ustar00rootroot00000000000000" Author: Ty-Lucas Kelley " Description: Adds support for markdownlint function! ale#handlers#markdownlint#Handle(buffer, lines) abort let l:pattern=': \?\(\d\+\)\(:\(\d\+\)\?\)\? \(MD\d\{3}/[A-Za-z0-9-/]\+\) \(.*\)$' let l:output=[] for l:match in ale#util#GetMatches(a:lines, l:pattern) let l:result = ({ \ 'lnum': l:match[1] + 0, \ 'code': l:match[4], \ 'text': l:match[5], \ 'type': 'W', \}) if len(l:match[3]) > 0 let l:result.col = (l:match[3] + 0) endif call add(l:output, l:result) endfor return l:output endfunction ale-4.0.0/autoload/ale/handlers/naga.vim000066400000000000000000000015351476501472200200640ustar00rootroot00000000000000" Author: rhysd " Description: Handle errors for naga-cli. function! ale#handlers#naga#Handle(buffer, lines) abort let l:errors = [] let l:current_error = v:null for l:line in a:lines if l:line =~# '^error: ' let l:text = l:line[7:] let l:current_error = { 'text': l:text, 'type': 'E' } continue endif if l:current_error isnot v:null let l:matches = matchlist(l:line, '\v:(\d+):(\d+)$') if !empty(l:matches) let l:current_error.lnum = str2nr(l:matches[1]) let l:current_error.col = str2nr(l:matches[2]) call add(l:errors, l:current_error) let l:current_error = v:null continue endif endif endfor return l:errors endfunction ale-4.0.0/autoload/ale/handlers/ocamllsp.vim000066400000000000000000000020321476501472200207610ustar00rootroot00000000000000" Author: Risto Stevcev " Description: Handlers for the official OCaml language server let s:language_id_of_filetype = { \ 'menhir': 'ocaml.menhir', \ 'ocaml': 'ocaml', \ 'ocamlinterface': 'ocaml.interface', \ 'ocamllex': 'ocaml.lex' \} function! ale#handlers#ocamllsp#GetExecutable(buffer) abort return 'ocamllsp' endfunction function! ale#handlers#ocamllsp#GetCommand(buffer) abort let l:executable = ale#handlers#ocamllsp#GetExecutable(a:buffer) let l:ocaml_ocamllsp_use_opam = ale#Var(a:buffer, 'ocaml_ocamllsp_use_opam') return l:ocaml_ocamllsp_use_opam ? 'opam config exec -- ' . l:executable : l:executable endfunction function! ale#handlers#ocamllsp#GetLanguage(buffer) abort return s:language_id_of_filetype[getbufvar(a:buffer, '&filetype')] endfunction function! ale#handlers#ocamllsp#GetProjectRoot(buffer) abort let l:dune_project_file = ale#path#FindNearestFile(a:buffer, 'dune-project') return !empty(l:dune_project_file) ? fnamemodify(l:dune_project_file, ':h') : '' endfunction ale-4.0.0/autoload/ale/handlers/ols.vim000066400000000000000000000015701476501472200177520ustar00rootroot00000000000000" Author: Michael Jungo " Description: Handlers for the OCaml language server function! ale#handlers#ols#GetExecutable(buffer) abort let l:ols_setting = ale#handlers#ols#GetLanguage(a:buffer) . '_ols' return ale#path#FindExecutable(a:buffer, l:ols_setting, [ \ 'node_modules/.bin/ocaml-language-server', \]) endfunction function! ale#handlers#ols#GetCommand(buffer) abort let l:executable = ale#handlers#ols#GetExecutable(a:buffer) return ale#node#Executable(a:buffer, l:executable) . ' --stdio' endfunction function! ale#handlers#ols#GetLanguage(buffer) abort return getbufvar(a:buffer, '&filetype') endfunction function! ale#handlers#ols#GetProjectRoot(buffer) abort let l:merlin_file = ale#path#FindNearestFile(a:buffer, '.merlin') return !empty(l:merlin_file) ? fnamemodify(l:merlin_file, ':h') : '' endfunction ale-4.0.0/autoload/ale/handlers/openscad.vim000066400000000000000000000043011476501472200207440ustar00rootroot00000000000000scriptencoding utf-8LE " Description: This file defines a handler function for linting OpenSCAD files " with SCA2D function! ale#handlers#openscad#SCA2D_callback(buffer, lines) abort " Example output:: " foo.scad:3:1: W2001: Variable `unused` overwritten within scope. " foo.scad:1:1: F0001: Cannot read file due to syntax error: " - No terminal matches '}' in the current parser context, at line 1 col 36 let l:filename_re = '^\([^:]*\):' let l:linenum_re = '\([0-9]*\):' let l:colnum_re = '\([0-9]*\):' let l:err_id = '\([IWEFU][0-9]\+\):' let l:err_msg = '\(.*\)' let l:pattern = filename_re . \ linenum_re . \ colnum_re . \ ' ' . \ err_id . \ ' ' . \ err_msg let l:result = [] let l:idx = 0 for l:line in a:lines let l:matches = matchlist(line, pattern) if len(matches) > 0 " option: Info, Warning, Error, Fatal, Unknown if index(['I', 'W'], matches[4][0]) >= 0 let l:type = 'W' else let l:type = 'E' endif let l:lnum = matches[2] let l:col = matches[3] let l:text = matches[5] " Better locations for some syntax errors if matches[4][0] is# 'F' let l:syntax_error_re = '^\(.*\), at line \([0-9]\+\) col \([0-9]\+\)$' let l:next_line = a:lines[idx+1] let l:syn_err_matches = matchlist(l:next_line, l:syntax_error_re) if len(syn_err_matches) > 0 let l:text = l:text . l:syn_err_matches[1] let l:lnum = l:syn_err_matches[2] let l:col = l:syn_err_matches[3] else let l:text = l:next_line endif endif let l:element = { \ 'lnum': str2nr(l:lnum), \ 'col': str2nr(l:col), \ 'text': l:text, \ 'detail': l:matches[4] . ': ' . l:text, \ 'filename': fnamemodify(matches[1], ':p'), \ 'type': l:type \ } call add(l:result, l:element) endif let l:idx += 1 endfor return result endfun ale-4.0.0/autoload/ale/handlers/pony.vim000066400000000000000000000021331476501472200201360ustar00rootroot00000000000000scriptencoding utf-8 " Description: This file defines a handler function which ought to work for " any program which outputs errors in the format that ponyc uses. function! s:RemoveUnicodeQuotes(text) abort let l:text = a:text let l:text = substitute(l:text, '[`´‘’]', '''', 'g') let l:text = substitute(l:text, '\v\\u2018([^\\]+)\\u2019', '''\1''', 'g') let l:text = substitute(l:text, '[“”]', '"', 'g') return l:text endfunction function! ale#handlers#pony#HandlePonycFormat(buffer, lines) abort " Look for lines like the following. " /home/code/pony/classes/Wombat.pony:22:30: can't lookup private fields from outside the type let l:pattern = '\v^([^:]+):(\d+):(\d+)?:? (.+)$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) let l:item = { \ 'filename': l:match[1], \ 'lnum': str2nr(l:match[2]), \ 'col': str2nr(l:match[3]), \ 'type': 'E', \ 'text': s:RemoveUnicodeQuotes(l:match[4]), \} call add(l:output, l:item) endfor return l:output endfunction ale-4.0.0/autoload/ale/handlers/redpen.vim000066400000000000000000000036121476501472200204310ustar00rootroot00000000000000" Author: rhysd https://rhysd.github.io " Description: Redpen, a proofreading tool (http://redpen.cc) function! ale#handlers#redpen#HandleRedpenOutput(buffer, lines) abort " Only one file was passed to redpen. So response array has only one " element. let l:res = get(ale#util#FuzzyJSONDecode(a:lines, []), 0, {}) let l:output = [] for l:err in get(l:res, 'errors', []) let l:item = { \ 'text': l:err.message, \ 'type': 'W', \ 'code': l:err.validator, \} if has_key(l:err, 'startPosition') let l:item.lnum = l:err.startPosition.lineNum let l:item.col = l:err.startPosition.offset + 1 if has_key(l:err, 'endPosition') let l:item.end_lnum = l:err.endPosition.lineNum let l:item.end_col = l:err.endPosition.offset endif else " Fallback to a whole sentence region when a region is not " specified by the error. let l:item.lnum = l:err.lineNum let l:item.col = l:err.sentenceStartColumnNum + 1 endif " Adjust column number for multibyte string let l:line = getline(l:item.lnum) if l:line is# '' let l:line = l:err.sentence endif let l:line = split(l:line, '\zs') if l:item.col >= 2 let l:col = 0 for l:strlen in map(l:line[0:(l:item.col - 2)], 'strlen(v:val)') let l:col = l:col + l:strlen endfor let l:item.col = l:col + 1 endif if has_key(l:item, 'end_col') let l:col = 0 for l:strlen in map(l:line[0:(l:item.end_col - 1)], 'strlen(v:val)') let l:col = l:col + l:strlen endfor let l:item.end_col = l:col endif call add(l:output, l:item) endfor return l:output endfunction ale-4.0.0/autoload/ale/handlers/ruby.vim000066400000000000000000000023741476501472200201410ustar00rootroot00000000000000" Author: Brandon Roehl - https://github.com/BrandonRoehl, Matthias Guenther https://wikimatze.de " " Description: This file implements handlers specific to Ruby. function! s:HandleSyntaxError(buffer, lines) abort " Matches patterns line the following: " " test.rb:3: warning: parentheses after method name is interpreted as an argument list, not a decomposed argument " test.rb:8: syntax error, unexpected keyword_end, expecting end-of-input let l:pattern = '\v^.+:(\d+): (warning: )?(.+)$' let l:column = '\v^(\s+)\^$' let l:output = [] for l:line in a:lines let l:match = matchlist(l:line, l:pattern) if len(l:match) == 0 let l:match = matchlist(l:line, l:column) if len(l:match) != 0 let l:output[len(l:output) - 1]['col'] = len(l:match[1]) endif else call add(l:output, { \ 'lnum': l:match[1] + 0, \ 'col': 0, \ 'text': l:match[2] . l:match[3], \ 'type': empty(l:match[2]) ? 'E' : 'W', \}) endif endfor return l:output endfunction function! ale#handlers#ruby#HandleSyntaxErrors(buffer, lines) abort return s:HandleSyntaxError(a:buffer, a:lines) endfunction ale-4.0.0/autoload/ale/handlers/rust.vim000066400000000000000000000045161476501472200201550ustar00rootroot00000000000000" Author: Daniel Schemala , " w0rp " " Description: This file implements handlers specific to Rust. if !exists('g:ale_rust_ignore_error_codes') let g:ale_rust_ignore_error_codes = [] endif if !exists('g:ale_rust_ignore_secondary_spans') let g:ale_rust_ignore_secondary_spans = 0 endif function! s:FindSpan(buffer, span) abort if ale#path#IsBufferPath(a:buffer, a:span.file_name) || a:span.file_name is# '' return a:span endif " Search inside the expansion of an error, as the problem for this buffer " could lie inside a nested object. if !empty(get(a:span, 'expansion', v:null)) return s:FindSpan(a:buffer, a:span.expansion.span) endif return {} endfunction function! ale#handlers#rust#HandleRustErrors(buffer, lines) abort let l:output = [] for l:errorline in a:lines " ignore everything that is not JSON if l:errorline !~# '^{' continue endif let l:error = json_decode(l:errorline) if has_key(l:error, 'message') && type(l:error.message) is v:t_dict let l:error = l:error.message endif if !has_key(l:error, 'code') continue endif if !empty(l:error.code) && index(g:ale_rust_ignore_error_codes, l:error.code.code) > -1 continue endif for l:root_span in l:error.spans let l:span = s:FindSpan(a:buffer, l:root_span) if ale#Var(a:buffer, 'rust_ignore_secondary_spans') && !get(l:span, 'is_primary', 1) continue endif if !empty(l:span) let l:output_line = { \ 'lnum': l:span.line_start, \ 'end_lnum': l:span.line_end, \ 'col': l:span.column_start, \ 'end_col': l:span.column_end-1, \ 'text': empty(l:span.label) ? l:error.message : printf('%s: %s', l:error.message, l:span.label), \ 'type': toupper(l:error.level[0]), \} if has_key(l:error, 'rendered') && !empty(l:error.rendered) let l:output_line.detail = l:error.rendered endif call add(l:output, l:output_line) endif endfor endfor return l:output endfunction ale-4.0.0/autoload/ale/handlers/scala.vim000066400000000000000000000020301476501472200202300ustar00rootroot00000000000000" Author: Nils Leuzinger - https://github.com/PawkyPenguin " Description: Scala linting handlers for scalac-like compilers. function! ale#handlers#scala#HandleScalacLintFormat(buffer, lines) abort " Matches patterns line the following: " " /var/folders/5q/20rgxx3x1s34g3m14n5bq0x80000gn/T/vv6pSsy/0:26: error: expected class or object definition let l:pattern = '^.\+:\(\d\+\): \(\w\+\): \(.\+\)' let l:output = [] let l:ln = 0 for l:line in a:lines let l:ln = l:ln + 1 let l:match = matchlist(l:line, l:pattern) if len(l:match) == 0 continue endif let l:text = l:match[3] let l:type = l:match[2] is# 'error' ? 'E' : 'W' let l:col = 0 if l:ln + 1 < len(a:lines) let l:col = stridx(a:lines[l:ln + 1], '^') endif call add(l:output, { \ 'lnum': l:match[1] + 0, \ 'col': l:col + 1, \ 'text': l:text, \ 'type': l:type, \}) endfor return l:output endfunction ale-4.0.0/autoload/ale/handlers/sh.vim000066400000000000000000000021231476501472200175620ustar00rootroot00000000000000" Author: w0rp function! ale#handlers#sh#GetShellType(buffer) abort let l:shebang = get(getbufline(a:buffer, 1), 0, '') let l:command = '' " Take the shell executable from the shebang, if we can. if l:shebang[:1] is# '#!' " Remove options like -e, etc. let l:command = substitute(l:shebang, ' --\?[a-zA-Z0-9]\+', '', 'g') endif " With no shebang line, attempt to use Vim's buffer-local variables. if l:command is# '' if getbufvar(a:buffer, 'is_bash', 0) let l:command = 'bash' elseif getbufvar(a:buffer, 'is_sh', 0) let l:command = 'sh' elseif getbufvar(a:buffer, 'is_kornshell', 0) let l:command = 'ksh' endif endif " If we couldn't find a shebang, try the filetype if l:command is# '' let l:command = &filetype endif for l:possible_shell in ['bash', 'dash', 'ash', 'tcsh', 'csh', 'zsh', 'ksh', 'sh'] if l:command =~# l:possible_shell . '\s*$' return l:possible_shell endif endfor return '' endfunction ale-4.0.0/autoload/ale/handlers/shellcheck.vim000066400000000000000000000145461476501472200212710ustar00rootroot00000000000000" Author: w0rp " Description: This file adds support for using the shellcheck linter " Shellcheck supports shell directives to define the shell dialect for scripts " that do not have a shebang for some reason. " https://github.com/koalaman/shellcheck/wiki/Directive#shell function! ale#handlers#shellcheck#GetShellcheckDialectDirective(buffer) abort let l:linenr = 0 let l:pattern = '\s\{-}#\s\{-}shellcheck\s\{-}shell=\(.*\)' let l:possible_shell = ['bash', 'dash', 'ash', 'tcsh', 'csh', 'zsh', 'ksh', 'sh'] while l:linenr < min([50, line('$')]) let l:linenr += 1 let l:match = matchlist(getline(l:linenr), l:pattern) if len(l:match) > 1 && index(l:possible_shell, l:match[1]) >= 0 return l:match[1] endif endwhile return '' endfunction function! ale#handlers#shellcheck#GetDialectArgument(buffer) abort let l:shell_type = ale#handlers#shellcheck#GetShellcheckDialectDirective(a:buffer) if empty(l:shell_type) let l:shell_type = ale#handlers#sh#GetShellType(a:buffer) endif if !empty(l:shell_type) " Use the dash dialect for /bin/ash, etc. if l:shell_type is# 'ash' return 'dash' endif return l:shell_type endif return '' endfunction function! ale#handlers#shellcheck#GetCwd(buffer) abort return ale#Var(a:buffer, 'sh_shellcheck_change_directory') ? '%s:h' : '' endfunction function! ale#handlers#shellcheck#GetCommand(buffer, version) abort let l:options = ale#Var(a:buffer, 'sh_shellcheck_options') let l:exclude_option = ale#Var(a:buffer, 'sh_shellcheck_exclusions') let l:dialect = ale#Var(a:buffer, 'sh_shellcheck_dialect') let l:external_option = ale#semver#GTE(a:version, [0, 4, 0]) ? ' -x' : '' let l:format = ale#semver#GTE(a:version, [0, 7, 0]) ? 'json1' : 'gcc' if l:dialect is# 'auto' let l:dialect = ale#handlers#shellcheck#GetDialectArgument(a:buffer) endif return '%e' \ . (!empty(l:dialect) ? ' -s ' . l:dialect : '') \ . (!empty(l:options) ? ' ' . l:options : '') \ . (!empty(l:exclude_option) ? ' -e ' . l:exclude_option : '') \ . l:external_option \ . ' -f ' . l:format . ' -' endfunction function! s:HandleShellcheckJSON(buffer, lines) abort try let l:errors = json_decode(a:lines[0]) catch return [] endtry if !has_key(l:errors, 'comments') return [] endif let l:output = [] for l:error in l:errors['comments'] if l:error['level'] is# 'error' let l:type = 'E' elseif l:error['level'] is# 'info' let l:type = 'I' elseif l:error['level'] is# 'style' let l:type = 'I' else let l:type = 'W' endif let l:item = { \ 'lnum': l:error['line'], \ 'type': l:type, \ 'text': l:error['message'], \ 'code': 'SC' . l:error['code'], \ 'detail': l:error['message'] . "\n\nFor more information:\n https://www.shellcheck.net/wiki/SC" . l:error['code'], \} if has_key(l:error, 'column') let l:item.col = l:error['column'] endif if has_key(l:error, 'endColumn') let l:item.end_col = l:error['endColumn'] - 1 endif if has_key(l:error, 'endLine') let l:item.end_lnum = l:error['endLine'] endif " If the filename is something like , or -, then " this is an error for the file we checked. if has_key(l:error, 'file') if l:error['file'] isnot# '-' && l:error['file'][0] isnot# '<' let l:item['filename'] = l:error['file'] endif endif call add(l:output, l:item) endfor return l:output endfunction function! s:HandleShellcheckGCC(buffer, lines) abort let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):(\d+)?:? ([^:]+): (.+) \[([^\]]+)\]$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) if l:match[4] is# 'error' let l:type = 'E' elseif l:match[4] is# 'note' let l:type = 'I' else let l:type = 'W' endif let l:item = { \ 'lnum': str2nr(l:match[2]), \ 'type': l:type, \ 'text': l:match[5], \ 'code': l:match[6], \ 'detail': l:match[5] . "\n\nFor more information:\n https://www.shellcheck.net/wiki/" . l:match[6], \} if !empty(l:match[3]) let l:item.col = str2nr(l:match[3]) endif " If the filename is something like , or -, then " this is an error for the file we checked. if l:match[1] isnot# '-' && l:match[1][0] isnot# '<' let l:item['filename'] = l:match[1] endif call add(l:output, l:item) endfor return l:output endfunction function! ale#handlers#shellcheck#Handle(buffer, version, lines) abort return ale#semver#GTE(a:version, [0, 7, 0]) \ ? s:HandleShellcheckJSON(a:buffer, a:lines) \ : s:HandleShellcheckGCC(a:buffer, a:lines) endfunction function! ale#handlers#shellcheck#DefineLinter(filetype) abort " This global variable can be set with a string of comma-separated error " codes to exclude from shellcheck. For example: " let g:ale_sh_shellcheck_exclusions = 'SC2002,SC2004' call ale#Set('sh_shellcheck_exclusions', '') call ale#Set('sh_shellcheck_executable', 'shellcheck') call ale#Set('sh_shellcheck_dialect', 'auto') call ale#Set('sh_shellcheck_options', '') call ale#Set('sh_shellcheck_change_directory', 1) call ale#linter#Define(a:filetype, { \ 'name': 'shellcheck', \ 'executable': {buffer -> ale#Var(buffer, 'sh_shellcheck_executable')}, \ 'cwd': function('ale#handlers#shellcheck#GetCwd'), \ 'command': {buffer -> ale#semver#RunWithVersionCheck( \ buffer, \ ale#Var(buffer, 'sh_shellcheck_executable'), \ '%e --version', \ function('ale#handlers#shellcheck#GetCommand'), \ )}, \ 'callback': {buffer, lines -> ale#semver#RunWithVersionCheck( \ buffer, \ ale#Var(buffer, 'sh_shellcheck_executable'), \ '%e --version', \ {buffer, version -> ale#handlers#shellcheck#Handle( \ buffer, \ l:version, \ lines)}, \ )}, \}) endfunction ale-4.0.0/autoload/ale/handlers/sml.vim000066400000000000000000000060471476501472200177540ustar00rootroot00000000000000" Author: Jake Zimmerman " Description: Shared functions for SML linters " The glob to use for finding the .cm file. " " See :help ale-sml-smlnj for more information. call ale#Set('sml_smlnj_cm_file', '*.cm') function! ale#handlers#sml#GetCmFile(buffer) abort let l:pattern = ale#Var(a:buffer, 'sml_smlnj_cm_file') let l:as_list = 1 let l:cmfile = '' for l:path in ale#path#Upwards(expand('#' . a:buffer . ':p:h')) let l:results = glob(l:path . '/' . l:pattern, 0, l:as_list) if len(l:results) > 0 " If there is more than one CM file, we take the first one " See :help ale-sml-smlnj for how to configure this. let l:cmfile = l:results[0] endif endfor return l:cmfile endfunction " Only one of smlnj or smlnj-cm can be enabled at a time. function! s:GetExecutable(buffer, source) abort if ale#handlers#sml#GetCmFile(a:buffer) is# '' " No CM file found; only allow single-file mode to be enabled if a:source is# 'smlnj-file' return 'sml' elseif a:source is# 'smlnj-cm' return '' endif else " Found a CM file; only allow cm-file mode to be enabled if a:source is# 'smlnj-file' return '' elseif a:source is# 'smlnj-cm' return 'sml' endif endif endfunction function! ale#handlers#sml#GetExecutableSmlnjCm(buffer) abort return s:GetExecutable(a:buffer, 'smlnj-cm') endfunction function! ale#handlers#sml#GetExecutableSmlnjFile(buffer) abort return s:GetExecutable(a:buffer, 'smlnj-file') endfunction function! ale#handlers#sml#Handle(buffer, lines) abort " Try to match basic sml errors " TODO(jez) We can get better errorfmt strings from Syntastic let l:out = [] let l:pattern = '^\(.*\)\:\([0-9\.]\+\)\ \(\w\+\)\:\ \(.*\)' let l:pattern2 = '^\(.*\)\:\([0-9]\+\)\.\?\([0-9]\+\).* \(\(Warning\|Error\): .*\)' for l:line in a:lines let l:match2 = matchlist(l:line, l:pattern2) if len(l:match2) != 0 if l:match2[1] =~# 'stdIn$' let l:loc = {'bufnr': a:buffer} else let l:loc = {'filename': l:match2[1]} endif call add(l:out, extend(l:loc, { \ 'lnum': l:match2[2] + 0, \ 'col' : l:match2[3] - 1, \ 'text': l:match2[4], \ 'type': l:match2[4] =~# '^Warning' ? 'W' : 'E', \})) continue endif let l:match = matchlist(l:line, l:pattern) if len(l:match) != 0 if l:match[1] =~# 'stdIn$' let l:loc = {'bufnr': a:buffer} else let l:loc = {'filename': l:match[1]} endif call add(l:out, extend(l:loc, { \ 'lnum': l:match[2] + 0, \ 'text': l:match[3] . ': ' . l:match[4], \ 'type': l:match[3] is# 'error' ? 'E' : 'W', \})) continue endif endfor return l:out endfunction " vim:ts=4:sts=4:sw=4 ale-4.0.0/autoload/ale/handlers/spectral.vim000066400000000000000000000020131476501472200207630ustar00rootroot00000000000000" Author: t2h5 " Description: Integration of Stoplight Spectral CLI with ALE. function! ale#handlers#spectral#HandleSpectralOutput(buffer, lines) abort " Matches patterns like the following: " openapi.yml:1:1 error oas3-schema "Object should have required property `info`." " openapi.yml:1:1 warning oas3-api-servers "OpenAPI `servers` must be present and non-empty array." let l:pattern = '\v^.*:(\d+):(\d+) (error|warning) (.*)$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) let l:obj = { \ 'lnum': l:match[1] + 0, \ 'col': l:match[2] + 0, \ 'type': l:match[3] is# 'error' ? 'E' : 'W', \ 'text': l:match[4], \} let l:code_match = matchlist(l:obj.text, '\v^(.+) "(.+)"$') if !empty(l:code_match) let l:obj.code = l:code_match[1] let l:obj.text = l:code_match[2] endif call add(l:output, l:obj) endfor return l:output endfunction ale-4.0.0/autoload/ale/handlers/statix.vim000066400000000000000000000013041476501472200204640ustar00rootroot00000000000000scriptencoding utf-8 " Author: David Houston " Description: This file defines a handler function for statix's errorformat " output. function! ale#handlers#statix#Handle(buffer, lines) abort " Look for lines like the following. " " flake.nix>46:13:W:3:This assignment is better written with `inherit` let l:pattern = '\v^.*\>(\d+):(\d+):([A-Z]):(\d+):(.*)$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) call add(l:output, { \ 'lnum': l:match[1] + 0, \ 'col': l:match[2] + 0, \ 'type': l:match[3], \ 'code': l:match[4], \ 'text': l:match[5], \}) endfor return l:output endfunction ale-4.0.0/autoload/ale/handlers/textlint.vim000066400000000000000000000025171476501472200210320ustar00rootroot00000000000000" Author: tokida https://rouger.info, Yasuhiro Kiyota " Description: textlint, a proofreading tool (https://textlint.github.io/) call ale#Set('textlint_executable', 'textlint') call ale#Set('textlint_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('textlint_options', '') function! ale#handlers#textlint#GetExecutable(buffer) abort return ale#path#FindExecutable(a:buffer, 'textlint', [ \ 'node_modules/.bin/textlint', \ 'node_modules/textlint/bin/textlint.js', \]) endfunction function! ale#handlers#textlint#GetCommand(buffer) abort let l:executable = ale#handlers#textlint#GetExecutable(a:buffer) let l:options = ale#Var(a:buffer, 'textlint_options') return ale#node#Executable(a:buffer, l:executable) \ . (!empty(l:options) ? ' ' . l:options : '') \ . ' -f json --stdin --stdin-filename %s' endfunction function! ale#handlers#textlint#HandleTextlintOutput(buffer, lines) abort let l:res = get(ale#util#FuzzyJSONDecode(a:lines, []), 0, {'messages': []}) let l:output = [] for l:err in l:res.messages call add(l:output, { \ 'text': l:err.message, \ 'type': 'W', \ 'code': l:err.ruleId, \ 'lnum': l:err.line, \ 'col' : l:err.column \}) endfor return l:output endfunction ale-4.0.0/autoload/ale/handlers/tslint.vim000066400000000000000000000010631476501472200204670ustar00rootroot00000000000000function! ale#handlers#tslint#InitVariables() abort call ale#Set('typescript_tslint_executable', 'tslint') call ale#Set('typescript_tslint_config_path', '') call ale#Set('typescript_tslint_rules_dir', '') call ale#Set('typescript_tslint_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('typescript_tslint_ignore_empty_files', 0) endfunction function! ale#handlers#tslint#GetExecutable(buffer) abort return ale#path#FindExecutable(a:buffer, 'typescript_tslint', [ \ 'node_modules/.bin/tslint', \]) endfunction ale-4.0.0/autoload/ale/handlers/tsserver.vim000066400000000000000000000004741476501472200210340ustar00rootroot00000000000000" Author: Derek Sifford " Description: Handlers for tsserver function! ale#handlers#tsserver#GetProjectRoot(buffer) abort let l:tsconfig_file = ale#path#FindNearestFile(a:buffer, 'tsconfig.json') return !empty(l:tsconfig_file) ? fnamemodify(l:tsconfig_file, ':h') : '' endfunction ale-4.0.0/autoload/ale/handlers/unix.vim000066400000000000000000000014101476501472200201310ustar00rootroot00000000000000" Author: w0rp " Description: Error handling for errors in a Unix format. function! s:HandleUnixFormat(buffer, lines, type) abort let l:pattern = '\v^[a-zA-Z]?:?[^:]+:(\d+):?(\d+)?:? ?(.+)$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) call add(l:output, { \ 'lnum': l:match[1] + 0, \ 'col': l:match[2] + 0, \ 'text': l:match[3], \ 'type': a:type, \}) endfor return l:output endfunction function! ale#handlers#unix#HandleAsError(buffer, lines) abort return s:HandleUnixFormat(a:buffer, a:lines, 'E') endfunction function! ale#handlers#unix#HandleAsWarning(buffer, lines) abort return s:HandleUnixFormat(a:buffer, a:lines, 'W') endfunction ale-4.0.0/autoload/ale/handlers/vale.vim000066400000000000000000000016471476501472200201110ustar00rootroot00000000000000" Author: Johannes Wienke " Description: output handler for the vale JSON format function! ale#handlers#vale#GetType(severity) abort if a:severity is? 'warning' return 'W' elseif a:severity is? 'suggestion' return 'I' endif return 'E' endfunction function! ale#handlers#vale#Handle(buffer, lines) abort try let l:errors = json_decode(join(a:lines, '')) catch return [] endtry if empty(l:errors) return [] endif let l:output = [] for l:error in l:errors[keys(l:errors)[0]] call add(l:output, { \ 'lnum': l:error['Line'], \ 'col': l:error['Span'][0], \ 'end_col': l:error['Span'][1], \ 'code': l:error['Check'], \ 'text': l:error['Message'], \ 'type': ale#handlers#vale#GetType(l:error['Severity']), \}) endfor return l:output endfunction ale-4.0.0/autoload/ale/handlers/writegood.vim000066400000000000000000000050541476501472200211610ustar00rootroot00000000000000" Author: Sumner Evans " Description: Error handling for errors in the write-good format. function! ale#handlers#writegood#ResetOptions() abort call ale#Set('writegood_options', '') call ale#Set('writegood_executable', 'write-good') call ale#Set('writegood_use_global', get(g:, 'ale_use_global_executables', 0)) endfunction " Reset the options so the tests can test how they are set. call ale#handlers#writegood#ResetOptions() function! ale#handlers#writegood#GetExecutable(buffer) abort return ale#path#FindExecutable(a:buffer, 'writegood', [ \ 'node_modules/.bin/write-good', \ 'node_modules/write-good/bin/write-good.js', \]) endfunction function! ale#handlers#writegood#GetCommand(buffer) abort let l:executable = ale#handlers#writegood#GetExecutable(a:buffer) let l:options = ale#Var(a:buffer, 'writegood_options') return ale#node#Executable(a:buffer, l:executable) \ . (!empty(l:options) ? ' ' . l:options : '') \ . ' %t' endfunction function! ale#handlers#writegood#Handle(buffer, lines) abort " Look for lines like the following. " " "it is" is wordy or unneeded on line 20 at column 53 " "easily" can weaken meaning on line 154 at column 29 let l:marks_pattern = '\v^ *(\^+) *$' let l:pattern = '\v^(".*"\s.*)\son\sline\s(\d+)\sat\scolumn\s(\d+)$' let l:output = [] let l:last_len = 0 for l:match in ale#util#GetMatches(a:lines, [l:marks_pattern, l:pattern]) if empty(l:match[2]) let l:last_len = len(l:match[1]) else let l:col = l:match[3] + 1 " Add the linter error. Note that we need to add 1 to the col because " write-good reports the column corresponding to the space before the " offending word or phrase. call add(l:output, { \ 'text': l:match[1], \ 'lnum': l:match[2] + 0, \ 'col': l:col, \ 'end_col': l:last_len ? (l:col + l:last_len - 1) : l:col, \ 'type': 'W', \}) let l:last_len = 0 endif endfor return l:output endfunction " Define the writegood linter for a given filetype. function! ale#handlers#writegood#DefineLinter(filetype) abort call ale#linter#Define(a:filetype, { \ 'name': 'writegood', \ 'aliases': ['write-good'], \ 'executable': function('ale#handlers#writegood#GetExecutable'), \ 'command': function('ale#handlers#writegood#GetCommand'), \ 'callback': 'ale#handlers#writegood#Handle', \}) endfunction ale-4.0.0/autoload/ale/handlers/xo.vim000066400000000000000000000026411476501472200176030ustar00rootroot00000000000000call ale#Set('javascript_xo_executable', 'xo') call ale#Set('javascript_xo_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('javascript_xo_options', '') call ale#Set('typescript_xo_executable', 'xo') call ale#Set('typescript_xo_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('typescript_xo_options', '') function! ale#handlers#xo#GetExecutable(buffer) abort let l:type = ale#handlers#xo#GetType(a:buffer) return ale#path#FindExecutable(a:buffer, l:type . '_xo', [ \ 'node_modules/xo/cli.js', \ 'node_modules/.bin/xo', \]) endfunction function! ale#handlers#xo#GetLintCommand(buffer) abort return ale#Escape(ale#handlers#xo#GetExecutable(a:buffer)) \ . ale#Pad(ale#handlers#xo#GetOptions(a:buffer)) \ . ' --reporter json --stdin --stdin-filename %s' endfunction function! ale#handlers#xo#GetOptions(buffer) abort let l:type = ale#handlers#xo#GetType(a:buffer) return ale#Var(a:buffer, l:type . '_xo_options') endfunction " xo uses eslint and the output format is the same function! ale#handlers#xo#HandleJSON(buffer, lines) abort return ale#handlers#eslint#HandleJSON(a:buffer, a:lines) endfunction function! ale#handlers#xo#GetType(buffer) abort let l:filetype = getbufvar(a:buffer, '&filetype') let l:type = 'javascript' if l:filetype =~# 'typescript' let l:type = 'typescript' endif return l:type endfunction ale-4.0.0/autoload/ale/handlers/yamllint.vim000066400000000000000000000024651476501472200210120ustar00rootroot00000000000000function! ale#handlers#yamllint#GetCommand(buffer) abort return '%e' . ale#Pad(ale#Var(a:buffer, 'yaml_yamllint_options')) \ . ' -f parsable %t' endfunction function! ale#handlers#yamllint#Handle(buffer, lines) abort " Matches patterns line the following: " something.yaml:1:1: [warning] missing document start "---" (document-start) " something.yml:2:1: [error] syntax error: expected the node content, but found '' let l:pattern = '\v^.*:(\d+):(\d+): \[(error|warning)\] (.+)$' let l:output = [] for l:match in ale#util#GetMatches(a:lines, l:pattern) let l:item = { \ 'lnum': l:match[1] + 0, \ 'col': l:match[2] + 0, \ 'text': l:match[4], \ 'type': l:match[3] is# 'error' ? 'E' : 'W', \} let l:code_match = matchlist(l:item.text, '\v^(.+) \(([^)]+)\)$') if !empty(l:code_match) if l:code_match[2] is# 'trailing-spaces' \&& !ale#Var(a:buffer, 'warn_about_trailing_whitespace') " Skip warnings for trailing whitespace if the option is off. continue endif let l:item.text = l:code_match[1] let l:item.code = l:code_match[2] endif call add(l:output, l:item) endfor return l:output endfunction ale-4.0.0/autoload/ale/highlight.vim000066400000000000000000000162141476501472200173250ustar00rootroot00000000000000scriptencoding utf8 " Author: w0rp " Description: This module implements error/warning highlighting. if !hlexists('ALEError') highlight link ALEError SpellBad endif if !hlexists('ALEStyleError') highlight link ALEStyleError ALEError endif if !hlexists('ALEWarning') highlight link ALEWarning SpellCap endif if !hlexists('ALEStyleWarning') highlight link ALEStyleWarning ALEWarning endif if !hlexists('ALEInfo') highlight link ALEInfo ALEWarning endif " The maximum number of items for the second argument of matchaddpos() let s:MAX_POS_VALUES = 8 let s:MAX_COL_SIZE = 1073741824 " pow(2, 30) let s:has_nvim_highlight = exists('*nvim_buf_add_highlight') && exists('*nvim_buf_clear_namespace') if s:has_nvim_highlight let s:ns_id = nvim_create_namespace('ale_highlight') endif " Wrappers are necessary to test this functionality by faking the calls in tests. function! ale#highlight#nvim_buf_add_highlight(buffer, ns_id, hl_group, line, col_start, col_end) abort " Ignore all errors for adding highlights. try call nvim_buf_add_highlight(a:buffer, a:ns_id, a:hl_group, a:line, a:col_start, a:col_end) catch endtry endfunction function! ale#highlight#nvim_buf_clear_namespace(buffer, ns_id, line_start, line_end) abort call nvim_buf_clear_namespace(a:buffer, a:ns_id, a:line_start, a:line_end) endfunction function! ale#highlight#CreatePositions(line, col, end_line, end_col) abort if a:line >= a:end_line " For single lines, just return the one position. return [[[a:line, a:col, a:end_col - a:col + 1]]] endif " Get positions from the first line at the first column, up to a large " integer for highlighting up to the end of the line, followed by " the lines in-between, for highlighting entire lines, and " a highlight for the last line, up to the end column. let l:all_positions = \ [[a:line, a:col, s:MAX_COL_SIZE]] \ + range(a:line + 1, a:end_line - 1) \ + [[a:end_line, 1, a:end_col]] return map( \ range(0, len(l:all_positions) - 1, s:MAX_POS_VALUES), \ 'l:all_positions[v:val : v:val + s:MAX_POS_VALUES - 1]', \) endfunction " Given a loclist for current items to highlight, remove all highlights " except these which have matching loclist item entries. function! ale#highlight#RemoveHighlights() abort if s:has_nvim_highlight call ale#highlight#nvim_buf_clear_namespace(bufnr(''), s:ns_id, 0, -1) else for l:match in getmatches() if l:match.group =~? '\v^ALE(Style)?(Error|Warning|Info)(Line)?$' call matchdelete(l:match.id) endif endfor endif endfunction " Same semantics of matchaddpos but will use nvim_buf_add_highlight if " available. This involves iterating over the position list, switching from " 1-based indexing to 0-based indexing, and translating the multiple ways " that position can be specified for matchaddpos into line + col_start + " col_end. function! s:matchaddpos(group, pos_list) abort if s:has_nvim_highlight for l:pos in a:pos_list let l:line = type(l:pos) == v:t_number \ ? l:pos - 1 \ : l:pos[0] - 1 if type(l:pos) == v:t_number || len(l:pos) == 1 let l:col_start = 0 let l:col_end = s:MAX_COL_SIZE else let l:col_start = l:pos[1] - 1 let l:col_end = l:col_start + get(l:pos, 2, 1) endif call ale#highlight#nvim_buf_add_highlight( \ bufnr(''), \ s:ns_id, \ a:group, \ l:line, \ l:col_start, \ l:col_end, \) endfor else call matchaddpos(a:group, a:pos_list) endif endfunction function! s:highlight_line(bufnr, lnum, group) abort call s:matchaddpos(a:group, [a:lnum]) endfunction function! s:highlight_range(bufnr, range, group) abort " Set all of the positions, which are chunked into Lists which " are as large as will be accepted by matchaddpos. call map( \ ale#highlight#CreatePositions( \ a:range.lnum, \ a:range.col, \ a:range.end_lnum, \ a:range.end_col \ ), \ 's:matchaddpos(a:group, v:val)' \) endfunction function! ale#highlight#UpdateHighlights() abort let l:item_list = get(b:, 'ale_enabled', 1) && g:ale_enabled \ ? get(b:, 'ale_highlight_items', []) \ : [] call ale#highlight#RemoveHighlights() for l:item in l:item_list if l:item.type is# 'W' if get(l:item, 'sub_type', '') is# 'style' let l:group = 'ALEStyleWarning' else let l:group = 'ALEWarning' endif elseif l:item.type is# 'I' let l:group = 'ALEInfo' elseif get(l:item, 'sub_type', '') is# 'style' let l:group = 'ALEStyleError' else let l:group = 'ALEError' endif let l:range = { \ 'lnum': l:item.lnum, \ 'col': l:item.col, \ 'end_lnum': get(l:item, 'end_lnum', l:item.lnum), \ 'end_col': get(l:item, 'end_col', l:item.col) \} call s:highlight_range(l:item.bufnr, l:range, l:group) endfor " If highlights are enabled and signs are not enabled, we should still " offer line highlights by adding a separate set of highlights. if !g:ale_set_signs let l:available_groups = { \ 'ALEWarningLine': hlexists('ALEWarningLine'), \ 'ALEInfoLine': hlexists('ALEInfoLine'), \ 'ALEErrorLine': hlexists('ALEErrorLine'), \} for l:item in l:item_list if l:item.type is# 'W' let l:group = 'ALEWarningLine' elseif l:item.type is# 'I' let l:group = 'ALEInfoLine' else let l:group = 'ALEErrorLine' endif if l:available_groups[l:group] call s:highlight_line(l:item.bufnr, l:item.lnum, l:group) endif endfor endif endfunction function! ale#highlight#BufferHidden(buffer) abort " Remove highlights right away when buffers are hidden. " They will be restored later when buffers are entered. call ale#highlight#RemoveHighlights() endfunction augroup ALEHighlightBufferGroup autocmd! autocmd BufEnter * call ale#highlight#UpdateHighlights() autocmd BufHidden * call ale#highlight#BufferHidden(expand('')) augroup END function! ale#highlight#SetHighlights(buffer, loclist) abort let l:new_list = getbufvar(a:buffer, 'ale_enabled', 1) && g:ale_enabled \ ? filter(copy(a:loclist), 'v:val.bufnr == a:buffer && v:val.col > 0') \ : [] " Set the list in the buffer variable. call setbufvar(str2nr(a:buffer), 'ale_highlight_items', l:new_list) let l:exclude_list = ale#Var(a:buffer, 'exclude_highlights') if !empty(l:exclude_list) call filter(l:new_list, 'empty(ale#util#GetMatches(v:val.text, l:exclude_list))') endif " Update highlights for the current buffer, which may or may not " be the buffer we just set highlights for. call ale#highlight#UpdateHighlights() endfunction ale-4.0.0/autoload/ale/history.vim000066400000000000000000000036501476501472200170570ustar00rootroot00000000000000" Author: w0rp " Description: Tools for managing command history " A flag for controlling the maximum size of the command history to store. let g:ale_max_buffer_history_size = get(g:, 'ale_max_buffer_history_size', 20) " Return a shallow copy of the command history for a given buffer number. function! ale#history#Get(buffer) abort return copy(getbufvar(a:buffer, 'ale_history', [])) endfunction function! ale#history#Add(buffer, status, job_id, command) abort if g:ale_max_buffer_history_size <= 0 " Don't save anything if the history isn't a positive number. call setbufvar(a:buffer, 'ale_history', []) return endif let l:history = getbufvar(a:buffer, 'ale_history', []) " Remove the first item if we hit the max history size. if len(l:history) >= g:ale_max_buffer_history_size let l:history = l:history[1:] endif call add(l:history, { \ 'status': a:status, \ 'job_id': a:job_id, \ 'command': a:command, \}) call setbufvar(a:buffer, 'ale_history', l:history) endfunction function! s:FindHistoryItem(buffer, job_id) abort " Search backwards to find a matching job ID. IDs might be recycled, " so finding the last one should be good enough. for l:obj in reverse(ale#history#Get(a:buffer)) if l:obj.job_id == a:job_id return l:obj endif endfor return {} endfunction " Set an exit code for a command which finished. function! ale#history#SetExitCode(buffer, job_id, exit_code) abort let l:obj = s:FindHistoryItem(a:buffer, a:job_id) " If we find a match, then set the code and status. let l:obj.exit_code = a:exit_code let l:obj.status = 'finished' endfunction " Set the output for a command which finished. function! ale#history#RememberOutput(buffer, job_id, output) abort let l:obj = s:FindHistoryItem(a:buffer, a:job_id) let l:obj.output = a:output endfunction ale-4.0.0/autoload/ale/hover.vim000066400000000000000000000325751476501472200165110ustar00rootroot00000000000000" Author: w0rp " Description: Hover support for LSP linters. let s:hover_map = {} " Used to get the hover map in tests. function! ale#hover#GetMap() abort return deepcopy(s:hover_map) endfunction " Used to set the hover map in tests. function! ale#hover#SetMap(map) abort let s:hover_map = a:map endfunction function! ale#hover#ClearLSPData() abort let s:hover_map = {} endfunction function! ale#hover#HandleTSServerResponse(conn_id, response) abort if get(a:response, 'command', '') is# 'quickinfo' \&& has_key(s:hover_map, a:response.request_seq) let l:options = remove(s:hover_map, a:response.request_seq) if get(a:response, 'success', v:false) is v:true \&& get(a:response, 'body', v:null) isnot v:null let l:set_balloons = ale#Var(l:options.buffer, 'set_balloons') " If we pass the show_documentation flag, we should show the full " documentation, and always in the preview window. if get(l:options, 'show_documentation', 0) let l:documentation = get(a:response.body, 'documentation', '') " displayString is not included here, because it can be very " noisy and run on for many lines for complex types. A less " verbose alternative may be nice in future. if !empty(l:documentation) call ale#preview#Show(split(l:documentation, "\n"), { \ 'filetype': 'ale-preview.message', \ 'stay_here': 1, \}) endif elseif get(l:options, 'hover_from_balloonexpr', 0) \&& exists('*balloon_show') \&& (l:set_balloons is 1 || l:set_balloons is# 'hover') call balloon_show(a:response.body.displayString) elseif get(l:options, 'truncated_echo', 0) if !empty(a:response.body.displayString) call ale#cursor#TruncatedEcho(a:response.body.displayString) endif elseif g:ale_hover_to_floating_preview || g:ale_floating_preview call ale#floating_preview#Show(split(a:response.body.displayString, "\n"), { \ 'filetype': 'ale-preview.message', \}) elseif g:ale_hover_to_preview call ale#preview#Show(split(a:response.body.displayString, "\n"), { \ 'filetype': 'ale-preview.message', \ 'stay_here': 1, \}) else call ale#util#ShowMessage(a:response.body.displayString) endif endif endif endfunction " Convert a language name to another one. " The language name could be an empty string or v:null function! s:ConvertLanguageName(language) abort return a:language endfunction " Cache syntax file (non-)existence to avoid calling globpath repeatedly. let s:syntax_file_exists_cache = {} function! s:SyntaxFileExists(syntax_file) abort if !has_key(s:syntax_file_exists_cache, a:syntax_file) let s:syntax_file_exists_cache[a:syntax_file] = \ !empty(globpath(&runtimepath, a:syntax_file)) endif return s:syntax_file_exists_cache[a:syntax_file] endfunction function! ale#hover#ParseLSPResult(contents) abort let l:includes = {} let l:highlights = [] let l:lines = [] let l:list = type(a:contents) is v:t_list ? a:contents : [a:contents] let l:region_index = 0 for l:item in l:list if !empty(l:lines) call add(l:lines, '') endif if type(l:item) is v:t_dict && has_key(l:item, 'kind') if l:item.kind is# 'markdown' " Handle markdown values as we handle strings below. let l:item = get(l:item, 'value', '') elseif l:item.kind is# 'plaintext' " We shouldn't try to parse plaintext as markdown. " Pass the lines on and skip parsing them. call extend(l:lines, split(get(l:item, 'value', ''), "\n")) continue endif endif let l:marked_list = [] " If the item is a string, then we should parse it as Markdown text. if type(l:item) is v:t_string let l:fence_language = v:null let l:fence_lines = [] for l:line in split(l:item, "\n") if l:fence_language is v:null " Look for the start of a code fence. (```python, etc.) let l:match = matchlist(l:line, '^``` *\([^ ]\+\)\? *$') if !empty(l:match) let l:fence_language = len(l:match) > 1 ? l:match[1] : 'text' if !empty(l:marked_list) call add(l:fence_lines, '') endif else if !empty(l:marked_list) \&& l:marked_list[-1][0] isnot v:null call add(l:marked_list, [v:null, ['']]) endif call add(l:marked_list, [v:null, [l:line]]) endif elseif l:line =~# '^```$' " When we hit the end of a code fence, pass the fenced " lines on to the next steps below. call add(l:marked_list, [l:fence_language, l:fence_lines]) let l:fence_language = v:null let l:fence_lines = [] else " Gather lines inside of a code fence. call add(l:fence_lines, l:line) endif endfor " If the result from the LSP server is a {language: ..., value: ...} " Dictionary, then that should be interpreted as if it was: " " ```${language} " ${value} " ``` elseif type(l:item) is v:t_dict \&& has_key(l:item, 'language') \&& type(l:item.language) is v:t_string \&& has_key(l:item, 'value') \&& type(l:item.value) is v:t_string call add( \ l:marked_list, \ [l:item.language, split(l:item.value, "\n")], \) endif for [l:language, l:marked_lines] in l:marked_list if l:language is v:null " NOTE: We could handle other Markdown formatting here. call map( \ l:marked_lines, \ 'substitute(v:val, ''\\_'', ''_'', ''g'')', \) else let l:language = s:ConvertLanguageName(l:language) if !empty(l:language) let l:syntax_file = printf('syntax/%s.vim', l:language) if s:SyntaxFileExists(l:syntax_file) let l:includes[l:language] = l:syntax_file endif let l:start = len(l:lines) + 1 let l:end = l:start + len(l:marked_lines) let l:region_index += 1 call add(l:highlights, 'syntax region' \ . ' ALE_hover_' . l:region_index \ . ' start=/\%' . l:start . 'l/' \ . ' end=/\%' . l:end . 'l/' \ . ' contains=@ALE_hover_' . l:language \) endif endif call extend(l:lines, l:marked_lines) endfor endfor let l:include_commands = [] for [l:language, l:lang_path] in sort(items(l:includes)) call add(l:include_commands, 'unlet! b:current_syntax') call add( \ l:include_commands, \ printf('syntax include @ALE_hover_%s %s', l:language, l:lang_path), \) endfor return [l:include_commands + l:highlights, l:lines] endfunction function! ale#hover#HandleLSPResponse(conn_id, response) abort if has_key(a:response, 'id') \&& has_key(s:hover_map, a:response.id) let l:options = remove(s:hover_map, a:response.id) " If the call did __not__ come from balloonexpr... if !get(l:options, 'hover_from_balloonexpr', 0) let l:buffer = bufnr('') let [l:line, l:column] = getpos('.')[1:2] let l:end = len(getline(l:line)) if l:buffer isnot l:options.buffer \|| l:line isnot l:options.line \|| min([l:column, l:end]) isnot min([l:options.column, l:end]) " ... Cancel display the message if the cursor has moved. return endif endif " The result can be a Dictionary item, a List of the same, or null. let l:result = get(a:response, 'result', v:null) if l:result is v:null return endif let [l:commands, l:lines] = ale#hover#ParseLSPResult(l:result.contents) if !empty(l:lines) let l:set_balloons = ale#Var(l:options.buffer, 'set_balloons') if get(l:options, 'hover_from_balloonexpr', 0) \&& exists('*balloon_show') \&& (l:set_balloons is 1 || l:set_balloons is# 'hover') call balloon_show(join(l:lines, "\n")) elseif get(l:options, 'truncated_echo', 0) if type(l:lines[0]) is# v:t_list call ale#cursor#TruncatedEcho(join(l:lines[0], '\n')) else call ale#cursor#TruncatedEcho(l:lines[0]) endif elseif g:ale_hover_to_floating_preview || g:ale_floating_preview call ale#floating_preview#Show(l:lines, { \ 'filetype': 'ale-preview.message', \ 'commands': l:commands, \}) elseif g:ale_hover_to_preview call ale#preview#Show(l:lines, { \ 'filetype': 'ale-preview.message', \ 'stay_here': 1, \ 'commands': l:commands, \}) else call ale#util#ShowMessage(join(l:lines, "\n"), { \ 'commands': l:commands, \}) endif endif endif endfunction function! s:OnReady(line, column, opt, linter, lsp_details) abort let l:id = a:lsp_details.connection_id if !ale#lsp#HasCapability(l:id, 'hover') return endif let l:buffer = a:lsp_details.buffer let l:Callback = a:linter.lsp is# 'tsserver' \ ? function('ale#hover#HandleTSServerResponse') \ : function('ale#hover#HandleLSPResponse') call ale#lsp#RegisterCallback(l:id, l:Callback) if a:linter.lsp is# 'tsserver' let l:column = a:column let l:message = ale#lsp#tsserver_message#Quickinfo( \ l:buffer, \ a:line, \ l:column \) else " Send a message saying the buffer has changed first, or the " hover position probably won't make sense. call ale#lsp#NotifyForChanges(l:id, l:buffer) let l:column = max([ \ min([a:column, len(getbufline(l:buffer, a:line)[0])]), \ 1, \]) let l:message = ale#lsp#message#Hover(l:buffer, a:line, l:column) endif let l:request_id = ale#lsp#Send(l:id, l:message) let s:hover_map[l:request_id] = { \ 'buffer': l:buffer, \ 'line': a:line, \ 'column': l:column, \ 'hover_from_balloonexpr': get(a:opt, 'called_from_balloonexpr', 0), \ 'show_documentation': get(a:opt, 'show_documentation', 0), \ 'truncated_echo': get(a:opt, 'truncated_echo', 0), \} endfunction " Obtain Hover information for the specified position " Pass optional arguments in the dictionary opt. " Currently, only one key/value is useful: " - called_from_balloonexpr, this flag marks if we want the result from this " ale#hover#Show to display in a balloon if possible " " Currently, the callbacks displays the info from hover : " - in the balloon if opt.called_from_balloonexpr and balloon_show is detected " - as status message otherwise function! ale#hover#Show(buffer, line, col, opt) abort let l:show_documentation = get(a:opt, 'show_documentation', 0) let l:Callback = function('s:OnReady', [a:line, a:col, a:opt]) for l:linter in ale#lsp_linter#GetEnabled(a:buffer) " Only tsserver supports documentation requests at the moment. if !l:show_documentation || l:linter.lsp is# 'tsserver' call ale#lsp_linter#StartLSP(a:buffer, l:linter, l:Callback) endif endfor endfunction let s:last_pos = [0, 0, 0] " This function implements the :ALEHover command. function! ale#hover#ShowAtCursor() abort let l:buffer = bufnr('') let l:pos = getpos('.') call ale#hover#Show(l:buffer, l:pos[1], l:pos[2], {}) endfunction function! ale#hover#ShowTruncatedMessageAtCursor() abort let l:buffer = bufnr('') let l:pos = getpos('.')[0:2] if !getbufvar(l:buffer, 'ale_enabled', 1) return endif if l:pos != s:last_pos let s:last_pos = l:pos let [l:info, l:loc] = ale#util#FindItemAtCursor(l:buffer) if empty(l:loc) call ale#hover#Show( \ l:buffer, \ l:pos[1], \ l:pos[2], \ {'truncated_echo': 1}, \) endif endif endfunction " This function implements the :ALEDocumentation command. function! ale#hover#ShowDocumentationAtCursor() abort let l:buffer = bufnr('') let l:pos = getpos('.') let l:options = {'show_documentation': 1} call ale#hover#Show(l:buffer, l:pos[1], l:pos[2], l:options) endfunction ale-4.0.0/autoload/ale/java.vim000066400000000000000000000012711476501472200162740ustar00rootroot00000000000000" Author: Horacio Sanson https://github.com/hsanson " Description: Functions for integrating with Java tools " Find the nearest dir contining a gradle or pom file and assume it " the root of a java app. function! ale#java#FindProjectRoot(buffer) abort let l:gradle_root = ale#gradle#FindProjectRoot(a:buffer) if !empty(l:gradle_root) return l:gradle_root endif let l:maven_pom_file = ale#path#FindNearestFile(a:buffer, 'pom.xml') if !empty(l:maven_pom_file) return fnamemodify(l:maven_pom_file, ':h') endif let l:ant_root = ale#ant#FindProjectRoot(a:buffer) if !empty(l:ant_root) return l:ant_root endif return '' endfunction ale-4.0.0/autoload/ale/job.vim000066400000000000000000000276741476501472200161440ustar00rootroot00000000000000" Author: w0rp " Description: APIs for working with Asynchronous jobs, with an API normalised " between Vim 8 and NeoVim. " " Important functions are described below. They are: " " ale#job#Start(command, options) -> job_id " ale#job#IsRunning(job_id) -> 1 if running, 0 otherwise. " ale#job#Stop(job_id) " A setting for wrapping commands. let g:ale_command_wrapper = get(g:, 'ale_command_wrapper', '') if !has_key(s:, 'job_map') let s:job_map = {} endif " A map from timer IDs to jobs, for tracking jobs that need to be killed " with SIGKILL if they don't terminate right away. if !has_key(s:, 'job_kill_timers') let s:job_kill_timers = {} endif function! s:KillHandler(timer) abort let l:job = remove(s:job_kill_timers, a:timer) call job_stop(l:job, 'kill') endfunction function! s:NeoVimCallback(job, data, event) abort let l:info = s:job_map[a:job] if a:event is# 'stdout' let l:info.out_cb_line = ale#util#JoinNeovimOutput( \ a:job, \ l:info.out_cb_line, \ a:data, \ l:info.mode, \ ale#util#GetFunction(l:info.out_cb), \) elseif a:event is# 'stderr' let l:info.err_cb_line = ale#util#JoinNeovimOutput( \ a:job, \ l:info.err_cb_line, \ a:data, \ l:info.mode, \ ale#util#GetFunction(l:info.err_cb), \) else if has_key(l:info, 'out_cb') && !empty(l:info.out_cb_line) call ale#util#GetFunction(l:info.out_cb)(a:job, l:info.out_cb_line) endif if has_key(l:info, 'err_cb') && !empty(l:info.err_cb_line) call ale#util#GetFunction(l:info.err_cb)(a:job, l:info.err_cb_line) endif try call ale#util#GetFunction(l:info.exit_cb)(a:job, a:data) finally " Automatically forget about the job after it's done. if has_key(s:job_map, a:job) call remove(s:job_map, a:job) endif endtry endif endfunction function! s:VimOutputCallback(channel, data) abort let l:job = ch_getjob(a:channel) let l:job_id = ale#job#ParseVim8ProcessID(string(l:job)) " Only call the callbacks for jobs which are valid. if l:job_id > 0 && has_key(s:job_map, l:job_id) call ale#util#GetFunction(s:job_map[l:job_id].out_cb)(l:job_id, a:data) endif endfunction function! s:VimErrorCallback(channel, data) abort let l:job = ch_getjob(a:channel) let l:job_id = ale#job#ParseVim8ProcessID(string(l:job)) " Only call the callbacks for jobs which are valid. if l:job_id > 0 && has_key(s:job_map, l:job_id) call ale#util#GetFunction(s:job_map[l:job_id].err_cb)(l:job_id, a:data) endif endfunction function! s:VimCloseCallback(channel) abort let l:job = ch_getjob(a:channel) let l:job_id = ale#job#ParseVim8ProcessID(string(l:job)) let l:info = get(s:job_map, l:job_id, {}) if empty(l:info) return endif " job_status() can trigger the exit handler. " The channel can close before the job has exited. if job_status(l:job) is# 'dead' try if !empty(l:info) && has_key(l:info, 'exit_cb') " We have to remove the callback, so we don't call it twice. call ale#util#GetFunction(remove(l:info, 'exit_cb'))(l:job_id, get(l:info, 'exit_code', 1)) endif finally " Automatically forget about the job after it's done. if has_key(s:job_map, l:job_id) call remove(s:job_map, l:job_id) endif endtry endif endfunction function! s:VimExitCallback(job, exit_code) abort let l:job_id = ale#job#ParseVim8ProcessID(string(a:job)) let l:info = get(s:job_map, l:job_id, {}) if empty(l:info) return endif let l:info.exit_code = a:exit_code " The program can exit before the data has finished being read. if ch_status(job_getchannel(a:job)) is# 'closed' try if !empty(l:info) && has_key(l:info, 'exit_cb') " We have to remove the callback, so we don't call it twice. call ale#util#GetFunction(remove(l:info, 'exit_cb'))(l:job_id, a:exit_code) endif finally " Automatically forget about the job after it's done. if has_key(s:job_map, l:job_id) call remove(s:job_map, l:job_id) endif endtry endif endfunction function! ale#job#ParseVim8ProcessID(job_string) abort return matchstr(a:job_string, '\d\+') + 0 endfunction function! ale#job#ValidateArguments(command, options) abort if a:options.mode isnot# 'nl' && a:options.mode isnot# 'raw' throw 'Invalid mode: ' . a:options.mode endif endfunction function! s:PrepareWrappedCommand(original_wrapper, command) abort let l:match = matchlist(a:command, '\v^(.*(\&\&|;)) *(.*)$') let l:prefix = '' let l:command = a:command if !empty(l:match) let l:prefix = l:match[1] . ' ' let l:command = l:match[3] endif let l:format = a:original_wrapper if l:format =~# '%@' let l:wrapped = substitute(l:format, '%@', ale#Escape(l:command), '') else if l:format !~# '%\*' let l:format .= ' %*' endif let l:wrapped = substitute(l:format, '%\*', l:command, '') endif return l:prefix . l:wrapped endfunction function! ale#job#PrepareCommand(buffer, command) abort let l:wrapper = ale#Var(a:buffer, 'command_wrapper') " The command will be executed in a subshell. This fixes a number of " issues, including reading the PATH variables correctly, %PATHEXT% " expansion on Windows, etc. " " NeoVim handles this issue automatically if the command is a String, " but we'll do this explicitly, so we use the same exact command for both " versions. let l:command = !empty(l:wrapper) \ ? s:PrepareWrappedCommand(l:wrapper, a:command) \ : a:command " If a custom shell is specified, use that. if exists('b:ale_shell') let l:ale_shell = b:ale_shell elseif exists('g:ale_shell') let l:ale_shell = g:ale_shell endif if exists('l:ale_shell') let l:shell_arguments = get(b:, 'ale_shell_arguments', get(g:, 'ale_shell_arguments', &shellcmdflag)) return split(l:ale_shell) + split(l:shell_arguments) + [l:command] endif if has('win32') return 'cmd /s/c "' . l:command . '"' endif if &shell =~? 'fish$\|pwsh$' return ['/bin/sh', '-c', l:command] endif return split(&shell) + split(&shellcmdflag) + [l:command] endfunction " Start a job with options which are agnostic to Vim and NeoVim. " " The following options are accepted: " " out_cb - A callback for receiving stdin. Arguments: (job_id, data) " err_cb - A callback for receiving stderr. Arguments: (job_id, data) " exit_cb - A callback for program exit. Arguments: (job_id, status_code) " mode - A mode for I/O. Can be 'nl' for split lines or 'raw'. function! ale#job#Start(command, options) abort call ale#job#ValidateArguments(a:command, a:options) let l:job_info = copy(a:options) let l:job_options = {} if has('nvim') if has_key(a:options, 'out_cb') let l:job_options.on_stdout = function('s:NeoVimCallback') let l:job_info.out_cb_line = '' endif if has_key(a:options, 'err_cb') let l:job_options.on_stderr = function('s:NeoVimCallback') let l:job_info.err_cb_line = '' endif if has_key(a:options, 'exit_cb') let l:job_options.on_exit = function('s:NeoVimCallback') endif let l:job_info.job = jobstart(a:command, l:job_options) let l:job_id = l:job_info.job else let l:job_options = { \ 'in_mode': l:job_info.mode, \ 'out_mode': l:job_info.mode, \ 'err_mode': l:job_info.mode, \} if has_key(a:options, 'out_cb') let l:job_options.out_cb = function('s:VimOutputCallback') else " prevent buffering of output and excessive polling in case close_cb is set let l:job_options.out_cb = {->0} endif if has_key(a:options, 'err_cb') let l:job_options.err_cb = function('s:VimErrorCallback') else " prevent buffering of output and excessive polling in case close_cb is set let l:job_options.err_cb = {->0} endif if has_key(a:options, 'exit_cb') " Set a close callback to which simply calls job_status() " when the channel is closed, which can trigger the exit callback " earlier on. let l:job_options.close_cb = function('s:VimCloseCallback') let l:job_options.exit_cb = function('s:VimExitCallback') endif " Use non-blocking writes for Vim versions that support the option. if has('patch-8.1.350') let l:job_options.noblock = 1 endif " Vim 8 will read the stdin from the file's buffer. let l:job_info.job = job_start(a:command, l:job_options) let l:job_id = ale#job#ParseVim8ProcessID(string(l:job_info.job)) endif if l:job_id > 0 " Store the job in the map for later only if we can get the ID. let s:job_map[l:job_id] = l:job_info endif return l:job_id endfunction " Force running commands in a Windows CMD command line. " This means the same command syntax works everywhere. function! ale#job#StartWithCmd(command, options) abort let l:shell = &l:shell let l:shellcmdflag = &l:shellcmdflag let &l:shell = 'cmd' let &l:shellcmdflag = '/c' try let l:job_id = ale#job#Start(a:command, a:options) finally let &l:shell = l:shell let &l:shellcmdflag = l:shellcmdflag endtry return l:job_id endfunction " Send raw data to the job. function! ale#job#SendRaw(job_id, string) abort if has('nvim') call jobsend(a:job_id, a:string) else let l:job = s:job_map[a:job_id].job if ch_status(l:job) is# 'open' call ch_sendraw(job_getchannel(l:job), a:string) endif endif endfunction " Given a job ID, return 1 if the job is currently running. " Invalid job IDs will be ignored. function! ale#job#IsRunning(job_id) abort if has('nvim') try " In NeoVim, if the job isn't running, jobpid() will throw. call jobpid(a:job_id) return 1 catch endtry elseif has_key(s:job_map, a:job_id) let l:job = s:job_map[a:job_id].job return job_status(l:job) is# 'run' endif return 0 endfunction function! ale#job#HasOpenChannel(job_id) abort if ale#job#IsRunning(a:job_id) if has('nvim') " TODO: Implement a check for NeoVim. return 1 endif " Check if the Job's channel can be written to. return ch_status(s:job_map[a:job_id].job) is# 'open' endif return 0 endfunction " Given a Job ID, stop that job. " Invalid job IDs will be ignored. function! ale#job#Stop(job_id) abort if !has_key(s:job_map, a:job_id) return endif if has('nvim') " FIXME: NeoVim kills jobs on a timer, but will not kill any processes " which are child processes on Unix. Some work needs to be done to " kill child processes to stop long-running processes like pylint. silent! call jobstop(a:job_id) else let l:job = s:job_map[a:job_id].job " We must close the channel for reading the buffer if it is open " when stopping a job. Otherwise, we will get errors in the status line. if ch_status(job_getchannel(l:job)) is# 'open' call ch_close_in(job_getchannel(l:job)) endif " Ask nicely for the job to stop. call job_stop(l:job) if ale#job#IsRunning(l:job) " Set a 100ms delay for killing the job with SIGKILL. let s:job_kill_timers[timer_start(100, function('s:KillHandler'))] = l:job endif endif endfunction ale-4.0.0/autoload/ale/julia.vim000066400000000000000000000011471476501472200164610ustar00rootroot00000000000000" Author: Bartolomeo Stellato bartolomeo.stellato@gmail.com " Description: Functions for integrating with Julia tools " Find the nearest dir containing a julia project let s:__ale_julia_project_filenames = ['REQUIRE', 'Manifest.toml', 'Project.toml'] function! ale#julia#FindProjectRoot(buffer) abort for l:project_filename in s:__ale_julia_project_filenames let l:full_path = ale#path#FindNearestFile(a:buffer, l:project_filename) if !empty(l:full_path) let l:path = fnamemodify(l:full_path, ':p:h') return l:path endif endfor return '' endfunction ale-4.0.0/autoload/ale/linter.vim000066400000000000000000000345241476501472200166570ustar00rootroot00000000000000" Author: w0rp " Description: Linter registration and lazy-loading " Retrieves linters as requested by the engine, loading them if needed. let s:runtime_loaded_map = {} let s:linters = {} " Default filetype aliases. " The user defined aliases will be merged with this Dictionary. " " NOTE: Update the g:ale_linter_aliases documentation when modifying this. let s:default_ale_linter_aliases = { \ 'Dockerfile': 'dockerfile', \ 'csh': 'sh', \ 'javascriptreact': ['javascript', 'jsx'], \ 'plaintex': 'tex', \ 'ps1': 'powershell', \ 'rmarkdown': 'r', \ 'rmd': 'r', \ 'systemverilog': 'verilog', \ 'typescriptreact': ['typescript', 'tsx'], \ 'vader': ['vim', 'vader'], \ 'verilog_systemverilog': ['verilog_systemverilog', 'verilog'], \ 'vimwiki': 'markdown', \ 'vue': ['vue', 'javascript'], \ 'xsd': ['xsd', 'xml'], \ 'xslt': ['xslt', 'xml'], \ 'zsh': 'sh', \} " Default linters to run for particular filetypes. " The user defined linter selections will be merged with this Dictionary. " " No linters are used for plaintext files by default. " " Only cargo and rls are enabled for Rust by default. " rpmlint is disabled by default because it can result in code execution. " hhast is disabled by default because it executes code in the project root. " " NOTE: Update the g:ale_linters documentation when modifying this. let s:default_ale_linters = { \ 'apkbuild': ['apkbuild_lint', 'secfixes_check'], \ 'astro': ['eslint'], \ 'csh': ['shell'], \ 'elixir': ['credo', 'dialyxir', 'dogma'], \ 'go': ['gofmt', 'golangci-lint', 'gopls', 'govet'], \ 'groovy': ['npm-groovy-lint'], \ 'hack': ['hack'], \ 'help': [], \ 'inko': ['inko'], \ 'json': ['biome', 'jsonlint', 'spectral', 'vscodejson'], \ 'json5': [], \ 'jsonc': ['biome'], \ 'perl': ['perlcritic'], \ 'perl6': [], \ 'python': ['flake8', 'mypy', 'pylint', 'pyright', 'ruff'], \ 'rust': ['analyzer', 'cargo'], \ 'spec': [], \ 'text': [], \ 'vader': ['vimls'], \ 'vue': ['eslint', 'vls'], \ 'zsh': ['shell'], \ 'v': ['v'], \ 'yaml': ['actionlint', 'spectral', 'yaml-language-server', 'yamllint'], \} " Testing/debugging helper to unload all linters. function! ale#linter#Reset() abort let s:runtime_loaded_map = {} let s:linters = {} endfunction " Return a reference to the linters loaded. " This is only for tests. " Do not call this function. function! ale#linter#GetLintersLoaded() abort " This command will throw from the sandbox. let &l:equalprg=&l:equalprg return s:linters endfunction function! s:IsCallback(value) abort return type(a:value) is v:t_string || type(a:value) is v:t_func endfunction function! s:IsBoolean(value) abort return type(a:value) is v:t_number && (a:value == 0 || a:value == 1) endfunction function! ale#linter#PreProcess(filetype, linter) abort if type(a:linter) isnot v:t_dict throw 'The linter object must be a Dictionary' endif let l:obj = { \ 'name': get(a:linter, 'name'), \ 'lsp': get(a:linter, 'lsp', ''), \} if type(l:obj.name) isnot v:t_string throw '`name` must be defined to name the linter' endif let l:needs_address = l:obj.lsp is# 'socket' let l:needs_executable = l:obj.lsp isnot# 'socket' let l:needs_command = l:obj.lsp isnot# 'socket' let l:needs_lsp_details = !empty(l:obj.lsp) if empty(l:obj.lsp) let l:obj.callback = get(a:linter, 'callback') if !s:IsCallback(l:obj.callback) throw '`callback` must be defined with a callback to accept output' endif endif if index(['', 'socket', 'stdio', 'tsserver'], l:obj.lsp) < 0 throw '`lsp` must be either `''lsp''`, `''stdio''`, `''socket''` or `''tsserver''` if defined' endif if !l:needs_executable if has_key(a:linter, 'executable') throw '`executable` cannot be used when lsp == ''socket''' endif elseif has_key(a:linter, 'executable') let l:obj.executable = a:linter.executable if type(l:obj.executable) isnot v:t_string \&& type(l:obj.executable) isnot v:t_func throw '`executable` must be a String or Function if defined' endif else throw '`executable` must be defined' endif if !l:needs_command if has_key(a:linter, 'command') throw '`command` cannot be used when lsp == ''socket''' endif elseif has_key(a:linter, 'command') let l:obj.command = a:linter.command if type(l:obj.command) isnot v:t_string \&& type(l:obj.command) isnot v:t_func throw '`command` must be a String or Function if defined' endif else throw '`command` must be defined' endif if !l:needs_address if has_key(a:linter, 'address') throw '`address` cannot be used when lsp != ''socket''' endif elseif has_key(a:linter, 'address') if type(a:linter.address) isnot v:t_string \&& type(a:linter.address) isnot v:t_func throw '`address` must be a String or Function if defined' endif let l:obj.address = a:linter.address if has_key(a:linter, 'cwd') throw '`cwd` makes no sense for socket LSP connections' endif else throw '`address` must be defined for getting the LSP address' endif if has_key(a:linter, 'cwd') let l:obj.cwd = a:linter.cwd if type(l:obj.cwd) isnot v:t_string \&& type(l:obj.cwd) isnot v:t_func throw '`cwd` must be a String or Function if defined' endif endif if l:needs_lsp_details " Default to using the filetype as the language. let l:obj.language = get(a:linter, 'language', a:filetype) if type(l:obj.language) isnot v:t_string \&& type(l:obj.language) isnot v:t_func throw '`language` must be a String or Function if defined' endif if has_key(a:linter, 'project_root') let l:obj.project_root = a:linter.project_root if type(l:obj.project_root) isnot v:t_string \&& type(l:obj.project_root) isnot v:t_func throw '`project_root` must be a String or Function' endif else throw '`project_root` must be defined for LSP linters' endif if has_key(a:linter, 'completion_filter') let l:obj.completion_filter = a:linter.completion_filter if !s:IsCallback(l:obj.completion_filter) throw '`completion_filter` must be a callback' endif endif if has_key(a:linter, 'initialization_options') let l:obj.initialization_options = a:linter.initialization_options if type(l:obj.initialization_options) isnot v:t_dict \&& type(l:obj.initialization_options) isnot v:t_func throw '`initialization_options` must be a Dictionary or Function if defined' endif endif if has_key(a:linter, 'lsp_config') if type(a:linter.lsp_config) isnot v:t_dict \&& type(a:linter.lsp_config) isnot v:t_func throw '`lsp_config` must be a Dictionary or Function if defined' endif let l:obj.lsp_config = a:linter.lsp_config endif endif let l:obj.output_stream = get(a:linter, 'output_stream', 'stdout') if type(l:obj.output_stream) isnot v:t_string \|| index(['stdout', 'stderr', 'both'], l:obj.output_stream) < 0 throw "`output_stream` must be 'stdout', 'stderr', or 'both'" endif " An option indicating that this linter should only be run against the " file on disk. let l:obj.lint_file = get(a:linter, 'lint_file', 0) if !s:IsBoolean(l:obj.lint_file) && type(l:obj.lint_file) isnot v:t_func throw '`lint_file` must be `0`, `1`, or a Function' endif " An option indicating that the buffer should be read. let l:obj.read_buffer = get(a:linter, 'read_buffer', 1) if !s:IsBoolean(l:obj.read_buffer) throw '`read_buffer` must be `0` or `1`' endif let l:obj.aliases = get(a:linter, 'aliases', []) if type(l:obj.aliases) isnot v:t_list \|| len(filter(copy(l:obj.aliases), 'type(v:val) isnot v:t_string')) > 0 throw '`aliases` must be a List of String values' endif return l:obj endfunction function! ale#linter#Define(filetype, linter) abort " This command will throw from the sandbox. let &l:equalprg=&l:equalprg let l:new_linter = ale#linter#PreProcess(a:filetype, a:linter) if !has_key(s:linters, a:filetype) let s:linters[a:filetype] = [] endif " Remove previously defined linters with the same name. call filter(s:linters[a:filetype], 'v:val.name isnot# a:linter.name') call add(s:linters[a:filetype], l:new_linter) endfunction " Prevent any linters from being loaded for a given filetype. function! ale#linter#PreventLoading(filetype) abort let s:runtime_loaded_map[a:filetype] = 1 endfunction function! ale#linter#GetAll(filetypes) abort " Don't return linters in the sandbox. " Otherwise a sandboxed script could modify them. if ale#util#InSandbox() return [] endif let l:combined_linters = [] for l:filetype in a:filetypes " Load linters from runtimepath if we haven't done that yet. if !has_key(s:runtime_loaded_map, l:filetype) execute 'silent! runtime! ale_linters/' . l:filetype . '/*.vim' let s:runtime_loaded_map[l:filetype] = 1 endif call extend(l:combined_linters, get(s:linters, l:filetype, [])) endfor return l:combined_linters endfunction function! s:GetAliasedFiletype(original_filetype) abort let l:buffer_aliases = get(b:, 'ale_linter_aliases', {}) " b:ale_linter_aliases can be set to a List or String. if type(l:buffer_aliases) is v:t_list \|| type(l:buffer_aliases) is v:t_string return l:buffer_aliases endif " Check for aliased filetypes first in a buffer variable, " then the global variable, " then in the default mapping, " otherwise use the original filetype. for l:dict in [ \ l:buffer_aliases, \ g:ale_linter_aliases, \ s:default_ale_linter_aliases, \] if has_key(l:dict, a:original_filetype) return l:dict[a:original_filetype] endif endfor return a:original_filetype endfunction function! ale#linter#ResolveFiletype(original_filetype) abort let l:filetype = s:GetAliasedFiletype(a:original_filetype) if type(l:filetype) isnot v:t_list return [l:filetype] endif return l:filetype endfunction function! s:GetLinterNames(original_filetype) abort let l:buffer_ale_linters = get(b:, 'ale_linters', {}) " b:ale_linters can be set to 'all' if l:buffer_ale_linters is# 'all' return 'all' endif " b:ale_linters can be set to a List. if type(l:buffer_ale_linters) is v:t_list return l:buffer_ale_linters endif " Try to get a buffer-local setting for the filetype if has_key(l:buffer_ale_linters, a:original_filetype) return l:buffer_ale_linters[a:original_filetype] endif " Try to get a global setting for the filetype if has_key(g:ale_linters, a:original_filetype) return g:ale_linters[a:original_filetype] endif " If the user has configured ALE to only enable linters explicitly, then " don't enable any linters by default. if g:ale_linters_explicit return [] endif " Try to get a default setting for the filetype if has_key(s:default_ale_linters, a:original_filetype) return s:default_ale_linters[a:original_filetype] endif return 'all' endfunction function! ale#linter#Get(original_filetypes) abort let l:possibly_duplicated_linters = [] " Handle dot-separated filetypes. for l:original_filetype in split(a:original_filetypes, '\.') let l:filetype = ale#linter#ResolveFiletype(l:original_filetype) let l:linter_names = s:GetLinterNames(l:original_filetype) let l:all_linters = ale#linter#GetAll(l:filetype) let l:filetype_linters = [] if type(l:linter_names) is v:t_string && l:linter_names is# 'all' let l:filetype_linters = l:all_linters elseif type(l:linter_names) is v:t_list " Select only the linters we or the user has specified. for l:linter in l:all_linters let l:name_list = [l:linter.name] + l:linter.aliases for l:name in l:name_list if index(l:linter_names, l:name) >= 0 call add(l:filetype_linters, l:linter) break endif endfor endfor endif call extend(l:possibly_duplicated_linters, l:filetype_linters) endfor let l:name_list = [] let l:combined_linters = [] " Make sure we override linters so we don't get two with the same name, " like 'eslint' for both 'javascript' and 'typescript' " " Note that the reverse calls here modify the List variables. for l:linter in reverse(l:possibly_duplicated_linters) if index(l:name_list, l:linter.name) < 0 call add(l:name_list, l:linter.name) call add(l:combined_linters, l:linter) endif endfor return reverse(l:combined_linters) endfunction " Given a buffer and linter, get the executable String for the linter. function! ale#linter#GetExecutable(buffer, linter) abort let l:Executable = a:linter.executable return type(l:Executable) is v:t_func \ ? l:Executable(a:buffer) \ : l:Executable endfunction function! ale#linter#GetCwd(buffer, linter) abort let l:Cwd = get(a:linter, 'cwd', v:null) return type(l:Cwd) is v:t_func ? l:Cwd(a:buffer) : l:Cwd endfunction " Given a buffer and linter, get the command String for the linter. function! ale#linter#GetCommand(buffer, linter) abort let l:Command = a:linter.command return type(l:Command) is v:t_func ? l:Command(a:buffer) : l:Command endfunction " Given a buffer and linter, get the address for connecting to the server. function! ale#linter#GetAddress(buffer, linter) abort let l:Address = a:linter.address return type(l:Address) is v:t_func ? l:Address(a:buffer) : l:Address endfunction function! ale#linter#GetLanguage(buffer, linter) abort let l:Language = a:linter.language return type(l:Language) is v:t_func ? l:Language(a:buffer) : l:Language endfunction ale-4.0.0/autoload/ale/list.vim000066400000000000000000000216041476501472200163300ustar00rootroot00000000000000" Author: Bjorn Neergaard , modified by Yann fery " Description: Manages the loclist and quickfix lists " This flag dictates if ale open the configured loclist let g:ale_open_list = get(g:, 'ale_open_list', 0) " This flag dictates if ale keeps open loclist even if there is no error in loclist let g:ale_keep_list_window_open = get(g:, 'ale_keep_list_window_open', 0) " This flag dictates that quickfix windows should be opened vertically let g:ale_list_vertical = get(g:, 'ale_list_vertical', 0) " The window size to set for the quickfix and loclist windows let g:ale_list_window_size = get(g:, 'ale_list_window_size', 10) " A string format for the loclist messages. let g:ale_loclist_msg_format = get(g:, 'ale_loclist_msg_format', \ get(g:, 'ale_echo_msg_format', '%code: %%s') \) if !exists('s:timer_args') let s:timer_args = {} endif " Return 1 if there is a buffer with buftype == 'quickfix' in buffer list function! ale#list#IsQuickfixOpen() abort let l:res = getqflist({ 'winid' : winnr() }) if has_key(l:res, 'winid') && l:res.winid > 0 return 1 endif let l:res = getloclist(0, { 'winid' : winnr() }) if has_key(l:res, 'winid') && l:res.winid > 0 return 1 endif return 0 endfunction " Check if we should open the list, based on the save event being fired, and " that setting being on, or that the error count is at least as high as the " setting when set to an integer value. function! s:ShouldOpen(buffer, loclist_len) abort let l:val = ale#Var(a:buffer, 'open_list') let l:saved = getbufvar(a:buffer, 'ale_save_event_fired', 0) return l:val > 0 ? a:loclist_len >= l:val : l:val is# 'on_save' && l:saved endfunction " Check if we should close the list, based on the save event being fired, and " that setting being on, or the setting just being set to an integer value. function! s:ShouldClose(buffer) abort let l:val = ale#Var(a:buffer, 'open_list') let l:saved = getbufvar(a:buffer, 'ale_save_event_fired', 0) return !((l:val >= 1) || (l:val is# 'on_save' && l:saved)) endfunction function! s:Deduplicate(list) abort let l:list = a:list call sort(l:list, function('ale#util#LocItemCompareWithText')) call uniq(l:list, function('ale#util#LocItemCompareWithText')) return l:list endfunction function! ale#list#GetCombinedList() abort let l:list = [] for l:info in values(g:ale_buffer_info) call extend(l:list, l:info.loclist) endfor return s:Deduplicate(l:list) endfunction function! s:FixList(buffer, list) abort let l:format = ale#Var(a:buffer, 'loclist_msg_format') let l:new_list = [] for l:item in a:list let l:fixed_item = copy(l:item) let l:fixed_item.text = ale#GetLocItemMessage(l:item, l:format) if l:item.bufnr == -1 " If the buffer number is invalid, remove it. call remove(l:fixed_item, 'bufnr') endif call add(l:new_list, l:fixed_item) endfor return l:new_list endfunction function! s:WinFindBuf(buffer) abort return exists('*win_findbuf') ? win_findbuf(str2nr(a:buffer)) : [0] endfunction function! s:SetListsImpl(timer_id, buffer, loclist) abort let l:title = expand('#' . a:buffer . ':p') if g:ale_set_quickfix let l:quickfix_list = ale#list#GetCombinedList() if has('nvim') call setqflist(s:FixList(a:buffer, l:quickfix_list), ' ', l:title) else call setqflist(s:FixList(a:buffer, l:quickfix_list)) call setqflist([], 'r', {'title': l:title}) endif elseif g:ale_set_loclist " If windows support is off, win_findbuf() may not exist. " We'll set result in the current window, which might not be correct, " but it's better than nothing. let l:ids = s:WinFindBuf(a:buffer) let l:loclist = s:Deduplicate(a:loclist) for l:id in l:ids if has('nvim') call setloclist(l:id, s:FixList(a:buffer, l:loclist), ' ', l:title) else call setloclist(l:id, s:FixList(a:buffer, l:loclist)) call setloclist(l:id, [], 'r', {'title': l:title}) endif endfor endif " Save the current view before opening/closing any window call setbufvar(a:buffer, 'ale_winview', winsaveview()) " Open a window to show the problems if we need to. " " ShouldOpen() checks if the current buffer has enough problems to be " opened. if s:ShouldOpen(a:buffer, len(a:loclist)) let l:winnr = winnr() let l:mode = mode() " open windows vertically instead of default horizontally let l:open_type = '' if ale#Var(a:buffer, 'list_vertical') == 1 let l:open_type = 'vert rightbelow ' endif if g:ale_set_quickfix if !ale#list#IsQuickfixOpen() silent! execute l:open_type . 'copen ' . str2nr(ale#Var(a:buffer, 'list_window_size')) endif elseif g:ale_set_loclist silent! execute l:open_type . 'lopen ' . str2nr(ale#Var(a:buffer, 'list_window_size')) endif " If focus changed, restore it (jump to the last window). if l:winnr isnot# winnr() wincmd p endif " Return to original mode when applicable if mode() != l:mode if l:mode is? 'v' || l:mode is# "\" " Reset our last visual selection normal! gv elseif l:mode is? 's' || l:mode is# "\" " Reset our last character selection normal! "\" endif endif call s:RestoreViewIfNeeded(a:buffer) endif " If ALE isn't currently checking for more problems, close the window if " needed now. This check happens inside of this timer function, so " the window can be closed reliably. if !ale#engine#IsCheckingBuffer(a:buffer) call s:CloseWindowIfNeeded(a:buffer) endif endfunction " Try to restore the window view after closing any of the lists to avoid making " the it moving around, especially useful when on insert mode function! s:RestoreViewIfNeeded(buffer) abort let l:saved_view = getbufvar(a:buffer, 'ale_winview', {}) " Saved view is empty, can't do anything if empty(l:saved_view) return endif " Check whether the cursor has moved since linting was actually requested. If " the user has indeed moved lines, do nothing let l:current_view = winsaveview() if l:current_view['lnum'] != l:saved_view['lnum'] return endif " Anchor view by topline if the list is set to open horizontally if ale#Var(a:buffer, 'list_vertical') == 0 call winrestview({'topline': l:saved_view['topline']}) endif endfunction function! ale#list#SetLists(buffer, loclist) abort if get(g:, 'ale_set_lists_synchronously') == 1 \|| getbufvar(a:buffer, 'ale_save_event_fired', 0) " Update lists immediately if running a test synchronously, or if the " buffer was saved. " " The lists need to be updated immediately when saving a buffer so " that we can reliably close window automatically, if so configured. call s:SetListsImpl(-1, a:buffer, a:loclist) else call ale#util#StartPartialTimer( \ 0, \ function('s:SetListsImpl'), \ [a:buffer, a:loclist], \) endif endfunction function! ale#list#ForcePopulateErrorList(populate_quickfix) abort let l:quickfix_bak = g:ale_set_quickfix let g:ale_set_quickfix = a:populate_quickfix let l:loclist_bak = g:ale_set_loclist let g:ale_set_loclist = !a:populate_quickfix let l:open_list_bak = g:ale_open_list let g:ale_open_list = 1 let l:buffer = bufnr('') let l:loclist = get(g:ale_buffer_info, l:buffer, {'loclist': []}).loclist call s:SetListsImpl(-1, l:buffer, l:loclist) let g:ale_open_list = l:open_list_bak let g:ale_set_loclist = l:loclist_bak let g:ale_set_quickfix = l:quickfix_bak endfunction function! s:CloseWindowIfNeeded(buffer) abort if ale#Var(a:buffer, 'keep_list_window_open') || s:ShouldClose(a:buffer) return endif let l:did_close_any_list = 0 try " Only close windows if the quickfix list or loclist is completely empty, " including errors set through other means. if g:ale_set_quickfix if empty(getqflist()) cclose let l:did_close_any_list = 1 endif else let l:win_ids = s:WinFindBuf(a:buffer) for l:win_id in l:win_ids if g:ale_set_loclist && empty(getloclist(l:win_id)) lclose let l:did_close_any_list = 1 endif endfor endif " Ignore 'Cannot close last window' errors. catch /E444/ endtry if l:did_close_any_list call s:RestoreViewIfNeeded(a:buffer) endif endfunction ale-4.0.0/autoload/ale/loclist_jumping.vim000066400000000000000000000116251476501472200205610ustar00rootroot00000000000000" Author: w0rp " Description: This file implements functions for jumping around in a file " based on ALE's internal loclist. " Search for the nearest line either before or after the current position " in the loclist. The argument 'wrap' can be passed to enable wrapping " around the end of the list. " " If there are no items or we have hit the end with wrapping off, an empty " List will be returned, otherwise a pair of [line_number, column_number] will " be returned. function! ale#loclist_jumping#FindNearest(direction, wrap, ...) abort let l:buffer = bufnr('') let l:pos = getpos('.') let l:info = get(g:ale_buffer_info, bufnr('%'), {'loclist': []}) " Copy the list and filter to only the items in this buffer. let l:loclist = filter(copy(l:info.loclist), 'v:val.bufnr == l:buffer') let l:search_item = {'bufnr': l:buffer, 'lnum': l:pos[1], 'col': l:pos[2]} if a:0 > 0 let l:filter = a:1 else let l:filter = 'any' endif if a:0 > 1 let l:subtype_filter = a:2 else let l:subtype_filter = 'any' endif " When searching backwards, so we can find the next smallest match. if a:direction is# 'before' call reverse(l:loclist) endif " Look for items before or after the current position. for l:item in l:loclist " Compare the cursor with a item where the column number is bounded, " such that it's possible for the cursor to actually be on the given " column number, without modifying the cursor number we return. This " will allow us to move through matches, but still let us move the " cursor to a line without changing the column, in some cases. let l:cmp_value = ale#util#LocItemCompare( \ { \ 'bufnr': l:buffer, \ 'lnum': l:item.lnum, \ 'col': min([ \ max([l:item.col, 1]), \ max([len(getline(l:item.lnum)), 1]), \ ]), \ }, \ l:search_item \) if (l:filter is# 'any' || l:filter is# l:item.type) \&& ( \ l:subtype_filter is# 'any' \ || l:subtype_filter is# get(l:item, 'sub_type', '') \) if a:direction is# 'before' && l:cmp_value < 0 return [l:item.lnum, l:item.col] endif if a:direction is# 'after' && l:cmp_value > 0 return [l:item.lnum, l:item.col] endif endif endfor " If we found nothing, and the wrap option is set to 1, then we should " wrap around the list of warnings/errors if a:wrap for l:item in l:loclist if (l:filter is# 'any' || l:filter is# l:item.type) \&& ( \ l:subtype_filter is# 'any' \ || l:subtype_filter is# get(l:item, 'sub_type', '') \) return [l:item.lnum, l:item.col] endif endfor endif return [] endfunction " As before, find the nearest match, but position the cursor at it. function! ale#loclist_jumping#Jump(direction, ...) abort if a:0 > 0 let l:wrap = a:1 else let l:wrap = 0 endif if a:0 > 1 let l:filter = a:2 else let l:filter = 'any' endif if a:0 > 2 let l:subtype_filter = a:3 else let l:subtype_filter = 'any' endif let l:nearest = ale#loclist_jumping#FindNearest(a:direction, \ l:wrap, l:filter, l:subtype_filter) if !empty(l:nearest) normal! m` call cursor([l:nearest[0], max([l:nearest[1], 1])]) endif endfunction function! ale#loclist_jumping#WrapJump(direction, sargs) abort let [l:args, l:rest] = ale#args#Parse(['error', 'warning', 'info', 'wrap', \ 'style', 'nostyle'], a:sargs) let l:wrap = 0 let l:type_filter = 'any' let l:subtype_filter = 'any' if get(l:args, 'wrap', 'nil') is# '' let l:wrap = 1 endif if get(l:args, 'error', 'nil') is# '' let l:type_filter = 'E' elseif get(l:args, 'warning', 'nil') is# '' let l:type_filter = 'W' elseif get(l:args, 'info', 'nil') is# '' let l:type_filter = 'I' endif if get(l:args, 'nostyle', 'nil') is# '' let l:subtype_filter = 'style' elseif get(l:args, 'style', 'nil') is# '' let l:subtype_filter = '' endif call ale#loclist_jumping#Jump(a:direction, l:wrap, l:type_filter, \ l:subtype_filter) endfunction function! ale#loclist_jumping#JumpToIndex(index) abort let l:buffer = bufnr('') let l:info = get(g:ale_buffer_info, l:buffer, {'loclist': []}) let l:loclist = filter(copy(l:info.loclist), 'v:val.bufnr == l:buffer') if empty(l:loclist) return endif let l:item = l:loclist[a:index] if !empty(l:item) normal! m` call cursor([l:item.lnum, l:item.col]) endif endfunction ale-4.0.0/autoload/ale/lsp.vim000066400000000000000000000543471476501472200161650ustar00rootroot00000000000000" Author: w0rp " Description: Language Server Protocol client code " A Dictionary for tracking connections. let s:connections = get(s:, 'connections', {}) let g:ale_lsp_next_message_id = 1 " Given an id, which can be an executable or address, and a project path, " create a new connection if needed. Return a unique ID for the connection. function! ale#lsp#Register(executable_or_address, project, init_options) abort let l:conn_id = a:executable_or_address . ':' . a:project if !has_key(s:connections, l:conn_id) " is_tsserver: 1 if the connection is for tsserver. " data: The message data received so far. " root: The project root. " open_documents: A Dictionary mapping buffers to b:changedtick, keeping " track of when documents were opened, and when we last changed them. " initialized: 0 if the connection is ready, 1 otherwise. " init_request_id: The ID for the init request. " init_options: Options to send to the server. " config: Configuration settings to send to the server. " callback_list: A list of callbacks for handling LSP responses. " capabilities_queue: The list of callbacks to call with capabilities. " capabilities: Features the server supports. let s:connections[l:conn_id] = { \ 'id': l:conn_id, \ 'is_tsserver': 0, \ 'data': '', \ 'root': a:project, \ 'open_documents': {}, \ 'initialized': 0, \ 'init_request_id': 0, \ 'init_options': a:init_options, \ 'config': {}, \ 'callback_list': [], \ 'init_queue': [], \ 'capabilities': { \ 'hover': 0, \ 'rename': 0, \ 'filerename': 0, \ 'references': 0, \ 'completion': 0, \ 'completion_trigger_characters': [], \ 'definition': 0, \ 'typeDefinition': 0, \ 'implementation': 0, \ 'symbol_search': 0, \ 'code_actions': 0, \ 'did_save': 0, \ 'includeText': 0, \ }, \} endif return l:conn_id endfunction " Remove an LSP connection with a given ID. This is only for tests. function! ale#lsp#RemoveConnectionWithID(id) abort if has_key(s:connections, a:id) call remove(s:connections, a:id) endif endfunction function! ale#lsp#ResetConnections() abort let s:connections = {} endfunction " Used only in tests. function! ale#lsp#GetConnections() abort " This command will throw from the sandbox. let &l:equalprg=&l:equalprg return s:connections endfunction " This is only needed for tests function! ale#lsp#MarkDocumentAsOpen(id, buffer) abort let l:conn = get(s:connections, a:id, {}) if !empty(l:conn) let l:conn.open_documents[a:buffer] = -1 endif endfunction function! ale#lsp#GetNextMessageID() abort " Use the current ID let l:id = g:ale_lsp_next_message_id " Increment the ID variable. let g:ale_lsp_next_message_id += 1 " When the ID overflows, reset it to 1. By the time we hit the initial ID " again, the messages will be long gone. if g:ale_lsp_next_message_id < 1 let g:ale_lsp_next_message_id = 1 endif return l:id endfunction " TypeScript messages use a different format. function! s:CreateTSServerMessageData(message) abort let l:is_notification = a:message[0] let l:obj = { \ 'seq': v:null, \ 'type': 'request', \ 'command': a:message[1][3:], \} if !l:is_notification let l:obj.seq = ale#lsp#GetNextMessageID() endif if len(a:message) > 2 let l:obj.arguments = a:message[2] endif let l:data = json_encode(l:obj) . "\n" return [l:is_notification ? 0 : l:obj.seq, l:data] endfunction " Given a List of one or two items, [method_name] or [method_name, params], " return a List containing [message_id, message_data] function! ale#lsp#CreateMessageData(message) abort if a:message[1][:2] is# 'ts@' return s:CreateTSServerMessageData(a:message) endif let l:is_notification = a:message[0] let l:obj = { \ 'method': a:message[1], \ 'jsonrpc': '2.0', \} if !l:is_notification let l:obj.id = ale#lsp#GetNextMessageID() endif if len(a:message) > 2 let l:obj.params = a:message[2] endif let l:body = json_encode(l:obj) let l:data = 'Content-Length: ' . strlen(l:body) . "\r\n\r\n" . l:body return [l:is_notification ? 0 : l:obj.id, l:data] endfunction function! ale#lsp#ReadMessageData(data) abort let l:response_list = [] let l:remainder = a:data while 1 " Look for the end of the HTTP headers let l:body_start_index = matchend(l:remainder, "\r\n\r\n") if l:body_start_index < 0 " No header end was found yet. break endif " Parse the Content-Length header. let l:header_data = l:remainder[:l:body_start_index - 4] let l:length_match = matchlist( \ l:header_data, \ '\vContent-Length: *(\d+)' \) if empty(l:length_match) throw "Invalid JSON-RPC header:\n" . l:header_data endif " Split the body and the remainder of the text. let l:remainder_start_index = l:body_start_index + str2nr(l:length_match[1]) if len(l:remainder) < l:remainder_start_index " We don't have enough data yet. break endif let l:body = l:remainder[l:body_start_index : l:remainder_start_index - 1] let l:remainder = l:remainder[l:remainder_start_index :] " Parse the JSON object and add it to the list. call add(l:response_list, json_decode(l:body)) endwhile return [l:remainder, l:response_list] endfunction " Update capabilities from the server, so we know which features the server " supports. function! s:UpdateCapabilities(conn, capabilities) abort if type(a:capabilities) isnot v:t_dict return endif if get(a:capabilities, 'hoverProvider') is v:true let a:conn.capabilities.hover = 1 endif if type(get(a:capabilities, 'hoverProvider')) is v:t_dict let a:conn.capabilities.hover = 1 endif if get(a:capabilities, 'referencesProvider') is v:true let a:conn.capabilities.references = 1 endif if type(get(a:capabilities, 'referencesProvider')) is v:t_dict let a:conn.capabilities.references = 1 endif if get(a:capabilities, 'renameProvider') is v:true let a:conn.capabilities.rename = 1 endif if type(get(a:capabilities, 'renameProvider')) is v:t_dict let a:conn.capabilities.rename = 1 endif if get(a:capabilities, 'codeActionProvider') is v:true let a:conn.capabilities.code_actions = 1 endif if type(get(a:capabilities, 'codeActionProvider')) is v:t_dict let a:conn.capabilities.code_actions = 1 endif if !empty(get(a:capabilities, 'completionProvider')) let a:conn.capabilities.completion = 1 endif if type(get(a:capabilities, 'completionProvider')) is v:t_dict let l:chars = get(a:capabilities.completionProvider, 'triggerCharacters') if type(l:chars) is v:t_list let a:conn.capabilities.completion_trigger_characters = l:chars endif endif if get(a:capabilities, 'definitionProvider') is v:true let a:conn.capabilities.definition = 1 endif if type(get(a:capabilities, 'definitionProvider')) is v:t_dict let a:conn.capabilities.definition = 1 endif if get(a:capabilities, 'typeDefinitionProvider') is v:true let a:conn.capabilities.typeDefinition = 1 endif if type(get(a:capabilities, 'typeDefinitionProvider')) is v:t_dict let a:conn.capabilities.typeDefinition = 1 endif if get(a:capabilities, 'implementationProvider') is v:true let a:conn.capabilities.implementation = 1 endif if type(get(a:capabilities, 'implementationProvider')) is v:t_dict let a:conn.capabilities.implementation = 1 endif if get(a:capabilities, 'workspaceSymbolProvider') is v:true let a:conn.capabilities.symbol_search = 1 endif if type(get(a:capabilities, 'workspaceSymbolProvider')) is v:t_dict let a:conn.capabilities.symbol_search = 1 endif if type(get(a:capabilities, 'textDocumentSync')) is v:t_dict let l:syncOptions = get(a:capabilities, 'textDocumentSync') if get(l:syncOptions, 'save') is v:true let a:conn.capabilities.did_save = 1 endif if type(get(l:syncOptions, 'save')) is v:t_dict let a:conn.capabilities.did_save = 1 let l:saveOptions = get(l:syncOptions, 'save') if get(l:saveOptions, 'includeText') is v:true let a:conn.capabilities.includeText = 1 endif endif endif endfunction " Update a connection's configuration dictionary and notify LSP servers " of any changes since the last update. Returns 1 if a configuration " update was sent; otherwise 0 will be returned. function! ale#lsp#UpdateConfig(conn_id, buffer, config) abort let l:conn = get(s:connections, a:conn_id, {}) if empty(l:conn) || a:config ==# l:conn.config " no-custom-checks return 0 endif let l:conn.config = a:config let l:message = ale#lsp#message#DidChangeConfiguration(a:buffer, a:config) call ale#lsp#Send(a:conn_id, l:message) return 1 endfunction function! ale#lsp#HandleInitResponse(conn, response) abort if get(a:response, 'method', '') is# 'initialize' let a:conn.initialized = 1 elseif type(get(a:response, 'result')) is v:t_dict \&& has_key(a:response.result, 'capabilities') call s:UpdateCapabilities(a:conn, a:response.result.capabilities) let a:conn.initialized = 1 endif if !a:conn.initialized return endif " The initialized message must be sent before everything else. call ale#lsp#Send(a:conn.id, ale#lsp#message#Initialized()) " Call capabilities callbacks queued for the project. for l:Callback in a:conn.init_queue call l:Callback() endfor let a:conn.init_queue = [] endfunction function! ale#lsp#HandleMessage(conn_id, message) abort let l:conn = get(s:connections, a:conn_id, {}) if empty(l:conn) return endif if type(a:message) isnot v:t_string " Ignore messages that aren't strings. return endif let l:conn.data .= a:message " Parse the objects now if we can, and keep the remaining text. let [l:conn.data, l:response_list] = ale#lsp#ReadMessageData(l:conn.data) " Look for initialize responses first. if !l:conn.initialized for l:response in l:response_list call ale#lsp#HandleInitResponse(l:conn, l:response) endfor endif " If the connection is marked as initialized, call the callbacks with the " responses. if l:conn.initialized for l:response in l:response_list " Call all of the registered handlers with the response. for l:Callback in l:conn.callback_list call ale#util#GetFunction(l:Callback)(a:conn_id, l:response) endfor endfor endif endfunction " Given a connection ID, mark it as a tsserver connection, so it will be " handled that way. function! ale#lsp#MarkConnectionAsTsserver(conn_id) abort let l:conn = s:connections[a:conn_id] let l:conn.is_tsserver = 1 let l:conn.initialized = 1 " Set capabilities which are supported by tsserver. let l:conn.capabilities.hover = 1 let l:conn.capabilities.references = 1 let l:conn.capabilities.completion = 1 let l:conn.capabilities.completion_trigger_characters = ['.'] let l:conn.capabilities.definition = 1 let l:conn.capabilities.typeDefinition = 1 let l:conn.capabilities.implementation = 1 let l:conn.capabilities.symbol_search = 1 let l:conn.capabilities.rename = 1 let l:conn.capabilities.filerename = 1 let l:conn.capabilities.code_actions = 1 endfunction function! s:SendInitMessage(conn) abort let [l:init_id, l:init_data] = ale#lsp#CreateMessageData( \ ale#lsp#message#Initialize( \ a:conn.root, \ a:conn.init_options, \ { \ 'workspace': { \ 'applyEdit': v:false, \ 'didChangeConfiguration': { \ 'dynamicRegistration': v:false, \ }, \ 'symbol': { \ 'dynamicRegistration': v:false, \ }, \ 'workspaceFolders': v:false, \ 'configuration': v:false, \ }, \ 'textDocument': { \ 'synchronization': { \ 'dynamicRegistration': v:false, \ 'willSave': v:false, \ 'willSaveWaitUntil': v:false, \ 'didSave': v:true, \ }, \ 'completion': { \ 'dynamicRegistration': v:false, \ 'completionItem': { \ 'snippetSupport': v:false, \ 'commitCharactersSupport': v:false, \ 'documentationFormat': ['plaintext', 'markdown'], \ 'deprecatedSupport': v:false, \ 'preselectSupport': v:false, \ }, \ 'contextSupport': v:false, \ }, \ 'hover': { \ 'dynamicRegistration': v:false, \ 'contentFormat': ['plaintext', 'markdown'], \ }, \ 'references': { \ 'dynamicRegistration': v:false, \ }, \ 'documentSymbol': { \ 'dynamicRegistration': v:false, \ 'hierarchicalDocumentSymbolSupport': v:false, \ }, \ 'definition': { \ 'dynamicRegistration': v:false, \ 'linkSupport': v:false, \ }, \ 'typeDefinition': { \ 'dynamicRegistration': v:false, \ }, \ 'implementation': { \ 'dynamicRegistration': v:false, \ 'linkSupport': v:false, \ }, \ 'publishDiagnostics': { \ 'relatedInformation': v:true, \ }, \ 'codeAction': { \ 'dynamicRegistration': v:false, \ 'codeActionLiteralSupport': { \ 'codeActionKind': { \ 'valueSet': [] \ } \ } \ }, \ 'rename': { \ 'dynamicRegistration': v:false, \ }, \ }, \ }, \ ), \) let a:conn.init_request_id = l:init_id call s:SendMessageData(a:conn, l:init_data) endfunction " Start a program for LSP servers. " " 1 will be returned if the program is running, or 0 if the program could " not be started. function! ale#lsp#StartProgram(conn_id, executable, command) abort let l:conn = s:connections[a:conn_id] let l:started = 0 if !has_key(l:conn, 'job_id') || !ale#job#HasOpenChannel(l:conn.job_id) let l:options = { \ 'mode': 'raw', \ 'out_cb': {_, message -> ale#lsp#HandleMessage(a:conn_id, message)}, \ 'exit_cb': { -> ale#lsp#Stop(a:conn_id) }, \} if has('win32') let l:job_id = ale#job#StartWithCmd(a:command, l:options) else let l:job_id = ale#job#Start(a:command, l:options) endif let l:started = 1 else let l:job_id = l:conn.job_id endif if l:job_id > 0 let l:conn.job_id = l:job_id endif if l:started && !l:conn.is_tsserver let l:conn.initialized = 0 call s:SendInitMessage(l:conn) endif return l:job_id > 0 endfunction " Connect to an LSP server via TCP. " " 1 will be returned if the connection is running, or 0 if the connection could " not be opened. function! ale#lsp#ConnectToAddress(conn_id, address) abort let l:conn = s:connections[a:conn_id] let l:started = 0 if !has_key(l:conn, 'channel_id') || !ale#socket#IsOpen(l:conn.channel_id) let l:channel_id = ale#socket#Open(a:address, { \ 'callback': {_, mess -> ale#lsp#HandleMessage(a:conn_id, mess)}, \}) let l:started = 1 else let l:channel_id = l:conn.channel_id endif if l:channel_id >= 0 let l:conn.channel_id = l:channel_id endif if l:started call s:SendInitMessage(l:conn) endif return l:channel_id >= 0 endfunction " Given a connection ID and a callback, register that callback for handling " messages if the connection exists. function! ale#lsp#RegisterCallback(conn_id, callback) abort let l:conn = get(s:connections, a:conn_id, {}) if !empty(l:conn) " Add the callback to the List if it's not there already. call uniq(sort(add(l:conn.callback_list, a:callback))) endif endfunction " Stop a single LSP connection. function! ale#lsp#Stop(conn_id) abort if has_key(s:connections, a:conn_id) let l:conn = remove(s:connections, a:conn_id) if has_key(l:conn, 'channel_id') call ale#socket#Close(l:conn.channel_id) elseif has_key(l:conn, 'job_id') call ale#job#Stop(l:conn.job_id) endif endif endfunction function! ale#lsp#CloseDocument(conn_id) abort endfunction " Stop all LSP connections, closing all jobs and channels, and removing any " queued messages. function! ale#lsp#StopAll() abort for l:conn_id in keys(s:connections) call ale#lsp#Stop(l:conn_id) endfor endfunction function! s:SendMessageData(conn, data) abort if has_key(a:conn, 'job_id') call ale#job#SendRaw(a:conn.job_id, a:data) elseif has_key(a:conn, 'channel_id') && ale#socket#IsOpen(a:conn.channel_id) " Send the message to the server call ale#socket#Send(a:conn.channel_id, a:data) else return 0 endif return 1 endfunction " Send a message to an LSP server. " Notifications do not need to be handled. " " Returns -1 when a message is sent, but no response is expected " 0 when the message is not sent and " >= 1 with the message ID when a response is expected. function! ale#lsp#Send(conn_id, message) abort let l:conn = get(s:connections, a:conn_id, {}) if empty(l:conn) return 0 endif if !l:conn.initialized throw 'LSP server not initialized yet!' endif let [l:id, l:data] = ale#lsp#CreateMessageData(a:message) call s:SendMessageData(l:conn, l:data) return l:id == 0 ? -1 : l:id endfunction " Notify LSP servers or tsserver if a document is opened, if needed. " If a document is opened, 1 will be returned, otherwise 0 will be returned. function! ale#lsp#OpenDocument(conn_id, buffer, language_id) abort let l:conn = get(s:connections, a:conn_id, {}) let l:opened = 0 if !empty(l:conn) && !has_key(l:conn.open_documents, a:buffer) if l:conn.is_tsserver let l:message = ale#lsp#tsserver_message#Open(a:buffer) else let l:message = ale#lsp#message#DidOpen(a:buffer, a:language_id) endif call ale#lsp#Send(a:conn_id, l:message) let l:conn.open_documents[a:buffer] = getbufvar(a:buffer, 'changedtick') let l:opened = 1 endif return l:opened endfunction " Notify LSP servers or tsserver that a document is closed, if opened before. " If a document is closed, 1 will be returned, otherwise 0 will be returned. " " Only the buffer number is required here. A message will be sent to every " language server that was notified previously of the document being opened. function! ale#lsp#CloseDocument(buffer) abort let l:closed = 0 " The connection keys are sorted so the messages are easier to test, and " so messages are sent in a consistent order. for l:conn_id in sort(keys(s:connections)) let l:conn = s:connections[l:conn_id] if l:conn.initialized && has_key(l:conn.open_documents, a:buffer) if l:conn.is_tsserver let l:message = ale#lsp#tsserver_message#Close(a:buffer) else let l:message = ale#lsp#message#DidClose(a:buffer) endif call ale#lsp#Send(l:conn_id, l:message) call remove(l:conn.open_documents, a:buffer) let l:closed = 1 endif endfor return l:closed endfunction " Notify LSP servers or tsserver that a document has changed, if needed. " If a notification is sent, 1 will be returned, otherwise 0 will be returned. function! ale#lsp#NotifyForChanges(conn_id, buffer) abort let l:conn = get(s:connections, a:conn_id, {}) let l:notified = 0 if !empty(l:conn) && has_key(l:conn.open_documents, a:buffer) let l:new_tick = getbufvar(a:buffer, 'changedtick') if l:conn.open_documents[a:buffer] < l:new_tick if l:conn.is_tsserver let l:message = ale#lsp#tsserver_message#Change(a:buffer) else let l:message = ale#lsp#message#DidChange(a:buffer) endif call ale#lsp#Send(a:conn_id, l:message) let l:conn.open_documents[a:buffer] = l:new_tick let l:notified = 1 endif endif return l:notified endfunction " Wait for an LSP server to be initialized. function! ale#lsp#OnInit(conn_id, Callback) abort let l:conn = get(s:connections, a:conn_id, {}) if empty(l:conn) return endif if l:conn.initialized call a:Callback() else call add(l:conn.init_queue, a:Callback) endif endfunction " Check if an LSP has a given capability. function! ale#lsp#HasCapability(conn_id, capability) abort let l:conn = get(s:connections, a:conn_id, {}) if empty(l:conn) return 0 endif if type(get(l:conn.capabilities, a:capability, v:null)) isnot v:t_number throw 'Invalid capability ' . a:capability endif return l:conn.capabilities[a:capability] endfunction ale-4.0.0/autoload/ale/lsp/000077500000000000000000000000001476501472200154335ustar00rootroot00000000000000ale-4.0.0/autoload/ale/lsp/message.vim000066400000000000000000000150721476501472200176010ustar00rootroot00000000000000" Author: w0rp " Description: Language Server Protocol message implementations " " Messages in this movie will be returned in the format " [is_notification, method_name, params?] " " All functions which accept line and column arguments expect them to be 1-based " (the same format as being returned by getpos() and friends), those then " will be converted to 0-based as specified by LSP. let g:ale_lsp_next_version_id = 1 " The LSP protocols demands that we send every change to a document, including " undo, with incrementing version numbers, so we'll just use one incrementing " ID for everything. function! ale#lsp#message#GetNextVersionID() abort " Use the current ID let l:id = g:ale_lsp_next_version_id " Increment the ID variable. let g:ale_lsp_next_version_id += 1 " When the ID overflows, reset it to 1. By the time we hit the initial ID " again, the messages will be long gone. if g:ale_lsp_next_version_id < 1 let g:ale_lsp_next_version_id = 1 endif return l:id endfunction function! ale#lsp#message#Initialize(root_path, options, capabilities) abort " NOTE: rootPath is deprecated in favour of rootUri return [0, 'initialize', { \ 'processId': getpid(), \ 'rootPath': a:root_path, \ 'capabilities': a:capabilities, \ 'initializationOptions': a:options, \ 'rootUri': ale#util#ToURI(a:root_path), \}] endfunction function! ale#lsp#message#Initialized() abort return [1, 'initialized', {}] endfunction function! ale#lsp#message#Shutdown() abort return [0, 'shutdown'] endfunction function! ale#lsp#message#Exit() abort return [1, 'exit'] endfunction function! ale#lsp#message#DidOpen(buffer, language_id) abort return [1, 'textDocument/didOpen', { \ 'textDocument': { \ 'uri': ale#util#ToURI(expand('#' . a:buffer . ':p')), \ 'languageId': a:language_id, \ 'version': ale#lsp#message#GetNextVersionID(), \ 'text': ale#util#GetBufferContents(a:buffer), \ }, \}] endfunction function! ale#lsp#message#DidChange(buffer) abort " For changes, we simply send the full text of the document to the server. return [1, 'textDocument/didChange', { \ 'textDocument': { \ 'uri': ale#util#ToURI(expand('#' . a:buffer . ':p')), \ 'version': ale#lsp#message#GetNextVersionID(), \ }, \ 'contentChanges': [{'text': ale#util#GetBufferContents(a:buffer)}] \}] endfunction function! ale#lsp#message#DidSave(buffer, include_text) abort let l:response = [1, 'textDocument/didSave', { \ 'textDocument': { \ 'uri': ale#util#ToURI(expand('#' . a:buffer . ':p')), \ }, \}] if a:include_text let l:response[2].textDocument.version = ale#lsp#message#GetNextVersionID() let l:response[2].text = ale#util#GetBufferContents(a:buffer) endif return l:response endfunction function! ale#lsp#message#DidClose(buffer) abort return [1, 'textDocument/didClose', { \ 'textDocument': { \ 'uri': ale#util#ToURI(expand('#' . a:buffer . ':p')), \ }, \}] endfunction let s:COMPLETION_TRIGGER_INVOKED = 1 let s:COMPLETION_TRIGGER_CHARACTER = 2 function! ale#lsp#message#Completion(buffer, line, column, trigger_character) abort let l:message = [0, 'textDocument/completion', { \ 'textDocument': { \ 'uri': ale#util#ToURI(expand('#' . a:buffer . ':p')), \ }, \ 'position': {'line': a:line - 1, 'character': a:column - 1}, \}] if !empty(a:trigger_character) let l:message[2].context = { \ 'triggerKind': s:COMPLETION_TRIGGER_CHARACTER, \ 'triggerCharacter': a:trigger_character, \} endif return l:message endfunction function! ale#lsp#message#Definition(buffer, line, column) abort return [0, 'textDocument/definition', { \ 'textDocument': { \ 'uri': ale#util#ToURI(expand('#' . a:buffer . ':p')), \ }, \ 'position': {'line': a:line - 1, 'character': a:column - 1}, \}] endfunction function! ale#lsp#message#TypeDefinition(buffer, line, column) abort return [0, 'textDocument/typeDefinition', { \ 'textDocument': { \ 'uri': ale#util#ToURI(expand('#' . a:buffer . ':p')), \ }, \ 'position': {'line': a:line - 1, 'character': a:column - 1}, \}] endfunction function! ale#lsp#message#Implementation(buffer, line, column) abort return [0, 'textDocument/implementation', { \ 'textDocument': { \ 'uri': ale#util#ToURI(expand('#' . a:buffer . ':p')), \ }, \ 'position': {'line': a:line - 1, 'character': a:column - 1}, \}] endfunction function! ale#lsp#message#References(buffer, line, column) abort return [0, 'textDocument/references', { \ 'textDocument': { \ 'uri': ale#util#ToURI(expand('#' . a:buffer . ':p')), \ }, \ 'position': {'line': a:line - 1, 'character': a:column - 1}, \ 'context': {'includeDeclaration': v:false}, \}] endfunction function! ale#lsp#message#Symbol(query) abort return [0, 'workspace/symbol', { \ 'query': a:query, \}] endfunction function! ale#lsp#message#Hover(buffer, line, column) abort return [0, 'textDocument/hover', { \ 'textDocument': { \ 'uri': ale#util#ToURI(expand('#' . a:buffer . ':p')), \ }, \ 'position': {'line': a:line - 1, 'character': a:column - 1}, \}] endfunction function! ale#lsp#message#DidChangeConfiguration(buffer, config) abort return [1, 'workspace/didChangeConfiguration', { \ 'settings': a:config, \}] endfunction function! ale#lsp#message#Rename(buffer, line, column, new_name) abort return [0, 'textDocument/rename', { \ 'textDocument': { \ 'uri': ale#util#ToURI(expand('#' . a:buffer . ':p')), \ }, \ 'position': {'line': a:line - 1, 'character': a:column - 1}, \ 'newName': a:new_name, \}] endfunction function! ale#lsp#message#CodeAction(buffer, line, column, end_line, end_column, diagnostics) abort return [0, 'textDocument/codeAction', { \ 'textDocument': { \ 'uri': ale#util#ToURI(expand('#' . a:buffer . ':p')), \ }, \ 'range': { \ 'start': {'line': a:line - 1, 'character': a:column - 1}, \ 'end': {'line': a:end_line - 1, 'character': a:end_column}, \ }, \ 'context': { \ 'diagnostics': a:diagnostics \ }, \}] endfunction function! ale#lsp#message#ExecuteCommand(command, arguments) abort return [0, 'workspace/executeCommand', { \ 'command': a:command, \ 'arguments': a:arguments, \}] endfunction ale-4.0.0/autoload/ale/lsp/reset.vim000066400000000000000000000055161476501472200173010ustar00rootroot00000000000000" Author: w0rp " Description: Functions for resetting LSP servers. function! s:Message(message) abort call ale#util#Execute('echom ' . string(a:message)) endfunction " Stop all LSPs and remove all of the data for them. function! ale#lsp#reset#StopAllLSPs() abort call ale#lsp#StopAll() if exists('*ale#definition#ClearLSPData') " Clear the go to definition mapping for everything. call ale#definition#ClearLSPData() endif if exists('*ale#lsp_linter#ClearLSPData') " Clear the mapping for connections, etc. call ale#lsp_linter#ClearLSPData() " Remove the problems for all of the LSP linters in every buffer. for l:buffer_string in keys(g:ale_buffer_info) let l:buffer = str2nr(l:buffer_string) " Non-ignored and disabled linters are included here so we can " clear results for them after we ignore or disable them. for l:linter in ale#linter#Get(getbufvar(l:buffer, '&filetype')) if !empty(l:linter.lsp) call ale#engine#HandleLoclist(l:linter.name, l:buffer, [], 0) endif endfor endfor endif endfunction function! ale#lsp#reset#Complete(arg, line, pos) abort let l:linter_map = ale#lsp_linter#GetLSPLinterMap() let l:candidates = map(values(l:linter_map), {_, linter -> linter.name}) call uniq(sort(l:candidates)) call filter(l:candidates, {_, name -> name =~? a:arg}) return l:candidates endfunction function! ale#lsp#reset#StopLSP(name, bang) abort let l:linter_map = ale#lsp_linter#GetLSPLinterMap() let l:matched = filter( \ items(l:linter_map), \ {_, item -> item[1].name is# a:name} \) if empty(l:matched) if a:bang isnot# '!' call s:Message('No running language server with name: ' . a:name) endif return endif " Stop LSP connections first. for [l:conn_id, l:linter] in l:matched call ale#lsp#Stop(l:conn_id) endfor if exists('*ale#definition#ClearLSPData') " Clear the go to definition mapping for everything. call ale#definition#ClearLSPData() endif " Remove connections from the lsp_linter map. for [l:conn_id, l:linter] in l:matched call remove(l:linter_map, l:conn_id) endfor " Remove the problems for the LSP linters in every buffer. for [l:buffer_string, l:info] in items(g:ale_buffer_info) let l:buffer = str2nr(l:buffer_string) let l:should_clear_buffer = 0 for l:item in l:info.loclist if l:item.linter_name is# a:name let l:should_clear_buffer = 1 break endif endfor if l:should_clear_buffer call ale#engine#HandleLoclist(a:name, l:buffer, [], 0) endif endfor endfunction ale-4.0.0/autoload/ale/lsp/response.vim000066400000000000000000000116431476501472200200130ustar00rootroot00000000000000" Author: w0rp " Description: Parsing and transforming of LSP server responses. " Constants for error codes. " Defined by JSON RPC let s:PARSE_ERROR = -32700 let s:INVALID_REQUEST = -32600 let s:METHOD_NOT_FOUND = -32601 let s:INVALID_PARAMS = -32602 let s:INTERNAL_ERROR = -32603 let s:SERVER_ERROR_START = -32099 let s:SERVER_ERROR_END = -32000 let s:SERVER_NOT_INITIALIZED = -32002 let s:UNKNOWN_ERROR_CODE = -32001 " Defined by the protocol. let s:REQUEST_CANCELLED = -32800 " Constants for message severity codes. let s:SEVERITY_ERROR = 1 let s:SEVERITY_WARNING = 2 let s:SEVERITY_INFORMATION = 3 let s:SEVERITY_HINT = 4 " Parse the message for textDocument/publishDiagnostics function! ale#lsp#response#ReadDiagnostics(response) abort let l:loclist = [] for l:diagnostic in a:response.params.diagnostics let l:severity = get(l:diagnostic, 'severity', 0) let l:loclist_item = { \ 'text': substitute(l:diagnostic.message, '\(\r\n\|\n\|\r\)', ' ', 'g'), \ 'type': 'E', \ 'lnum': l:diagnostic.range.start.line + 1, \ 'col': l:diagnostic.range.start.character + 1, \ 'end_lnum': l:diagnostic.range.end.line + 1, \ 'end_col': l:diagnostic.range.end.character, \} if l:severity == s:SEVERITY_WARNING let l:loclist_item.type = 'W' elseif l:severity == s:SEVERITY_INFORMATION " TODO: Use 'I' here in future. let l:loclist_item.type = 'W' elseif l:severity == s:SEVERITY_HINT " TODO: Use 'H' here in future let l:loclist_item.type = 'W' endif if has_key(l:diagnostic, 'code') if type(l:diagnostic.code) == v:t_string let l:loclist_item.code = l:diagnostic.code elseif type(l:diagnostic.code) == v:t_number && l:diagnostic.code != -1 let l:loclist_item.code = string(l:diagnostic.code) let l:loclist_item.nr = l:diagnostic.code endif endif if has_key(l:diagnostic, 'relatedInformation') \ && l:diagnostic.relatedInformation isnot v:null let l:related = deepcopy(l:diagnostic.relatedInformation) call map(l:related, {key, val -> \ ale#util#ToResource(val.location.uri) . \ ':' . (val.location.range.start.line + 1) . \ ':' . (val.location.range.start.character + 1) . \ ":\n\t" . val.message \}) let l:loclist_item.detail = l:diagnostic.message . "\n" . join(l:related, "\n") endif if has_key(l:diagnostic, 'source') let l:loclist_item.detail = printf( \ '[%s] %s', \ l:diagnostic.source, \ l:diagnostic.message \) endif call add(l:loclist, l:loclist_item) endfor return l:loclist endfunction function! ale#lsp#response#ReadTSServerDiagnostics(response) abort let l:loclist = [] for l:diagnostic in a:response.body.diagnostics let l:loclist_item = { \ 'text': l:diagnostic.text, \ 'type': 'E', \ 'lnum': l:diagnostic.start.line, \ 'col': l:diagnostic.start.offset, \ 'end_lnum': l:diagnostic.end.line, \ 'end_col': l:diagnostic.end.offset - 1, \} if has_key(l:diagnostic, 'code') if type(l:diagnostic.code) == v:t_string let l:loclist_item.code = l:diagnostic.code elseif type(l:diagnostic.code) == v:t_number && l:diagnostic.code != -1 let l:loclist_item.code = string(l:diagnostic.code) let l:loclist_item.nr = l:diagnostic.code endif endif if get(l:diagnostic, 'category') is# 'warning' let l:loclist_item.type = 'W' endif if get(l:diagnostic, 'category') is# 'suggestion' let l:loclist_item.type = 'I' endif call add(l:loclist, l:loclist_item) endfor return l:loclist endfunction function! ale#lsp#response#GetErrorMessage(response) abort if type(get(a:response, 'error', 0)) isnot v:t_dict return '' endif let l:code = get(a:response.error, 'code') " Only report things for these error codes. if l:code isnot s:INVALID_PARAMS && l:code isnot s:INTERNAL_ERROR return '' endif let l:message = get(a:response.error, 'message', '') if empty(l:message) return '' endif " Include the traceback or error data as details, if present. let l:error_data = get(a:response.error, 'data', {}) if type(l:error_data) is v:t_string let l:message .= "\n" . l:error_data elseif type(l:error_data) is v:t_dict let l:traceback = get(l:error_data, 'traceback', []) if type(l:traceback) is v:t_list && !empty(l:traceback) let l:message .= "\n" . join(l:traceback, "\n") endif endif return l:message endfunction ale-4.0.0/autoload/ale/lsp/tsserver_message.vim000066400000000000000000000123351476501472200215350ustar00rootroot00000000000000" Author: w0rp " Description: tsserver message implementations " " Messages in this movie will be returned in the format " [is_notification, command_name, params?] " " Every command must begin with the string 'ts@', which will be used to " detect the different message format for tsserver, and this string will " be removed from the actual command name, function! ale#lsp#tsserver_message#Open(buffer) abort return [1, 'ts@open', {'file': expand('#' . a:buffer . ':p')}] endfunction function! ale#lsp#tsserver_message#Close(buffer) abort return [1, 'ts@close', {'file': expand('#' . a:buffer . ':p')}] endfunction function! ale#lsp#tsserver_message#Change(buffer) abort let l:lines = getbufline(a:buffer, 1, '$') " We will always use a very high endLine number, so we can delete " lines from files. tsserver will gladly accept line numbers beyond the " end. return [1, 'ts@change', { \ 'file': expand('#' . a:buffer . ':p'), \ 'line': 1, \ 'offset': 1, \ 'endLine': 1073741824, \ 'endOffset': 1, \ 'insertString': join(l:lines, "\n") . "\n", \}] endfunction function! ale#lsp#tsserver_message#Geterr(buffer) abort return [1, 'ts@geterr', {'files': [expand('#' . a:buffer . ':p')]}] endfunction function! ale#lsp#tsserver_message#Completions( \ buffer, line, column, prefix, include_external) abort return [0, 'ts@completions', { \ 'line': a:line, \ 'offset': a:column, \ 'file': expand('#' . a:buffer . ':p'), \ 'prefix': a:prefix, \ 'includeExternalModuleExports': a:include_external, \}] endfunction function! ale#lsp#tsserver_message#CompletionEntryDetails(buffer, line, column, entry_names) abort return [0, 'ts@completionEntryDetails', { \ 'line': a:line, \ 'offset': a:column, \ 'file': expand('#' . a:buffer . ':p'), \ 'entryNames': a:entry_names, \}] endfunction function! ale#lsp#tsserver_message#Definition(buffer, line, column) abort return [0, 'ts@definition', { \ 'line': a:line, \ 'offset': a:column, \ 'file': expand('#' . a:buffer . ':p'), \}] endfunction function! ale#lsp#tsserver_message#TypeDefinition(buffer, line, column) abort return [0, 'ts@typeDefinition', { \ 'line': a:line, \ 'offset': a:column, \ 'file': expand('#' . a:buffer . ':p'), \}] endfunction function! ale#lsp#tsserver_message#Implementation(buffer, line, column) abort return [0, 'ts@implementation', { \ 'line': a:line, \ 'offset': a:column, \ 'file': expand('#' . a:buffer . ':p'), \}] endfunction function! ale#lsp#tsserver_message#References(buffer, line, column) abort return [0, 'ts@references', { \ 'line': a:line, \ 'offset': a:column, \ 'file': expand('#' . a:buffer . ':p'), \}] endfunction function! ale#lsp#tsserver_message#Quickinfo(buffer, line, column) abort return [0, 'ts@quickinfo', { \ 'line': a:line, \ 'offset': a:column, \ 'file': expand('#' . a:buffer . ':p'), \}] endfunction function! ale#lsp#tsserver_message#Rename( \ buffer, line, column, find_in_comments, find_in_strings) abort return [0, 'ts@rename', { \ 'line': a:line, \ 'offset': a:column, \ 'file': expand('#' . a:buffer . ':p'), \ 'arguments': { \ 'findInComments': a:find_in_comments, \ 'findInStrings': a:find_in_strings, \ } \}] endfunction function! ale#lsp#tsserver_message#GetEditsForFileRename( \ oldFilePath, newFilePath) abort return [0, 'ts@getEditsForFileRename', { \ 'oldFilePath': a:oldFilePath, \ 'newFilePath': a:newFilePath, \}] endfunction function! ale#lsp#tsserver_message#OrganizeImports(buffer) abort return [0, 'ts@organizeImports', { \ 'scope': { \ 'type': 'file', \ 'args': { \ 'file': expand('#' . a:buffer . ':p'), \ }, \ }, \}] endfunction function! ale#lsp#tsserver_message#GetCodeFixes(buffer, line, column, end_line, end_column, error_codes) abort " The lines and columns are 1-based. " The errors codes must be a list of tsserver error codes to fix. return [0, 'ts@getCodeFixes', { \ 'startLine': a:line, \ 'startOffset': a:column, \ 'endLine': a:end_line, \ 'endOffset': a:end_column + 1, \ 'file': expand('#' . a:buffer . ':p'), \ 'errorCodes': a:error_codes, \}] endfunction function! ale#lsp#tsserver_message#GetApplicableRefactors(buffer, line, column, end_line, end_column) abort " The arguments for this request can also be just 'line' and 'offset' return [0, 'ts@getApplicableRefactors', { \ 'startLine': a:line, \ 'startOffset': a:column, \ 'endLine': a:end_line, \ 'endOffset': a:end_column + 1, \ 'file': expand('#' . a:buffer . ':p'), \}] endfunction function! ale#lsp#tsserver_message#GetEditsForRefactor(buffer, line, column, end_line, end_column, refactor, action) abort return [0, 'ts@getEditsForRefactor', { \ 'startLine': a:line, \ 'startOffset': a:column, \ 'endLine': a:end_line, \ 'endOffset': a:end_column + 1, \ 'file': expand('#' . a:buffer . ':p'), \ 'refactor': a:refactor, \ 'action': a:action, \}] endfunction ale-4.0.0/autoload/ale/lsp_linter.vim000066400000000000000000000440041476501472200175270ustar00rootroot00000000000000" Author: w0rp " Description: Integration between linters and LSP/tsserver. " This code isn't loaded if a user never users LSP features or linters. " Associates LSP connection IDs with linter names. if !has_key(s:, 'lsp_linter_map') let s:lsp_linter_map = {} endif " Clear LSP linter data for the linting engine. function! ale#lsp_linter#ClearLSPData() abort let s:lsp_linter_map = {} endfunction " Only for internal use. function! ale#lsp_linter#GetLSPLinterMap() abort return s:lsp_linter_map endfunction " Just for tests. function! ale#lsp_linter#SetLSPLinterMap(replacement_map) abort let s:lsp_linter_map = a:replacement_map endfunction " Get all enabled LSP linters. " This list still includes linters ignored with `ale_linters_ignore`. " " `ale_linters_ignore` is designed to allow language servers to be used for " their functionality while ignoring the diagnostics they return. function! ale#lsp_linter#GetEnabled(buffer) abort let l:filetype = getbufvar(a:buffer, '&filetype') " Only LSP linters are included here. let l:linters = filter(ale#linter#Get(l:filetype), '!empty(v:val.lsp)') let l:disable_lsp = ale#Var(a:buffer, 'disable_lsp') " Only load code for ignoring linters if we need it. if ( \ l:disable_lsp is 1 \ || l:disable_lsp is v:true \ || (l:disable_lsp is# 'auto' && get(g:, 'lspconfig', 0)) \) let l:linters = ale#engine#ignore#Exclude( \ l:filetype, \ l:linters, \ [], \ l:disable_lsp, \) endif return l:linters endfunction " Check if diagnostics for a particular linter should be ignored. function! s:ShouldIgnoreDiagnostics(buffer, linter) abort let l:config = ale#Var(a:buffer, 'linters_ignore') let l:disable_lsp = ale#Var(a:buffer, 'disable_lsp') " Only load code for ignoring linters if we need it. if ( \ !empty(l:config) \ || l:disable_lsp is 1 \ || l:disable_lsp is v:true \ || (l:disable_lsp is# 'auto' && get(g:, 'lspconfig', 0)) \) " Re-use the ignore implementation just for this linter. return empty( \ ale#engine#ignore#Exclude( \ getbufvar(a:buffer, '&filetype'), \ [a:linter], \ l:config, \ l:disable_lsp, \ ) \) endif return 0 endfunction function! s:HandleLSPDiagnostics(conn_id, response) abort let l:linter = get(s:lsp_linter_map, a:conn_id) if empty(l:linter) return endif let l:filename = ale#util#ToResource(a:response.params.uri) let l:escaped_name = escape( \ fnameescape(l:filename), \ has('win32') ? '^' : '^,}]' \) let l:buffer = bufnr('^' . l:escaped_name . '$') let l:info = get(g:ale_buffer_info, l:buffer, {}) if empty(l:info) return endif if s:ShouldIgnoreDiagnostics(l:buffer, l:linter) return endif let l:loclist = ale#lsp#response#ReadDiagnostics(a:response) call ale#engine#HandleLoclist(l:linter.name, l:buffer, l:loclist, 0) endfunction function! s:HandleTSServerDiagnostics(response, error_type) abort " Re-create a fake linter object for tsserver. let l:linter = { \ 'name': 'tsserver', \ 'aliases': [], \ 'lsp': 'tsserver', \} let l:escaped_name = escape( \ fnameescape(a:response.body.file), \ has('win32') ? '^' : '^,}]' \) let l:buffer = bufnr('^' . l:escaped_name . '$') let l:info = get(g:ale_buffer_info, l:buffer, {}) if empty(l:info) return endif call ale#engine#MarkLinterInactive(l:info, l:linter.name) if s:ShouldIgnoreDiagnostics(l:buffer, l:linter) return endif let l:thislist = ale#lsp#response#ReadTSServerDiagnostics(a:response) let l:no_changes = 0 " tsserver sends syntax and semantic errors in separate messages, so we " have to collect the messages separately for each buffer and join them " back together again. if a:error_type is# 'syntax' if len(l:thislist) is 0 && len(get(l:info, 'syntax_loclist', [])) is 0 let l:no_changes = 1 endif let l:info.syntax_loclist = l:thislist elseif a:error_type is# 'semantic' if len(l:thislist) is 0 && len(get(l:info, 'semantic_loclist', [])) is 0 let l:no_changes = 1 endif let l:info.semantic_loclist = l:thislist else if len(l:thislist) is 0 && len(get(l:info, 'suggestion_loclist', [])) is 0 let l:no_changes = 1 endif let l:info.suggestion_loclist = l:thislist endif if l:no_changes return endif let l:loclist = get(l:info, 'semantic_loclist', []) \ + get(l:info, 'suggestion_loclist', []) \ + get(l:info, 'syntax_loclist', []) call ale#engine#HandleLoclist(l:linter.name, l:buffer, l:loclist, 0) endfunction function! s:HandleLSPErrorMessage(linter, response) abort if !g:ale_history_enabled || !g:ale_history_log_output return endif if empty(a:linter) return endif let l:message = ale#lsp#response#GetErrorMessage(a:response) if empty(l:message) return endif call ale#lsp_linter#AddErrorMessage(a:linter.name, l:message) endfunction function! ale#lsp_linter#AddErrorMessage(linter_name, message) abort " This global variable is set here so we don't load the debugging.vim file " until someone uses :ALEInfo. let g:ale_lsp_error_messages = get(g:, 'ale_lsp_error_messages', {}) if !has_key(g:ale_lsp_error_messages, a:linter_name) let g:ale_lsp_error_messages[a:linter_name] = [] endif call add(g:ale_lsp_error_messages[a:linter_name], a:message) endfunction function! ale#lsp_linter#HandleLSPResponse(conn_id, response) abort let l:method = get(a:response, 'method', '') if get(a:response, 'jsonrpc', '') is# '2.0' && has_key(a:response, 'error') let l:linter = get(s:lsp_linter_map, a:conn_id, {}) call s:HandleLSPErrorMessage(l:linter, a:response) elseif l:method is# 'textDocument/publishDiagnostics' call s:HandleLSPDiagnostics(a:conn_id, a:response) elseif l:method is# 'window/showMessage' call ale#lsp_window#HandleShowMessage( \ s:lsp_linter_map[a:conn_id].name, \ g:ale_lsp_show_message_format, \ a:response.params \) elseif get(a:response, 'type', '') is# 'event' \&& get(a:response, 'event', '') is# 'semanticDiag' call s:HandleTSServerDiagnostics(a:response, 'semantic') elseif get(a:response, 'type', '') is# 'event' \&& get(a:response, 'event', '') is# 'syntaxDiag' call s:HandleTSServerDiagnostics(a:response, 'syntax') elseif get(a:response, 'type', '') is# 'event' \&& get(a:response, 'event', '') is# 'suggestionDiag' \&& get(g:, 'ale_lsp_suggestions', '1') == 1 call s:HandleTSServerDiagnostics(a:response, 'suggestion') endif endfunction function! ale#lsp_linter#GetOptions(buffer, linter) abort if has_key(a:linter, 'initialization_options_callback') return ale#util#GetFunction(a:linter.initialization_options_callback)(a:buffer) endif if has_key(a:linter, 'initialization_options') let l:Options = a:linter.initialization_options if type(l:Options) is v:t_func let l:Options = l:Options(a:buffer) endif return l:Options endif return {} endfunction function! ale#lsp_linter#GetConfig(buffer, linter) abort if has_key(a:linter, 'lsp_config_callback') return ale#util#GetFunction(a:linter.lsp_config_callback)(a:buffer) endif if has_key(a:linter, 'lsp_config') let l:Config = a:linter.lsp_config if type(l:Config) is v:t_func let l:Config = l:Config(a:buffer) endif return l:Config endif return {} endfunction function! ale#lsp_linter#FindProjectRoot(buffer, linter) abort let l:buffer_ale_root = getbufvar(a:buffer, 'ale_root', {}) if type(l:buffer_ale_root) is v:t_string return l:buffer_ale_root endif " Try to get a buffer-local setting for the root if has_key(l:buffer_ale_root, a:linter.name) let l:Root = l:buffer_ale_root[a:linter.name] if type(l:Root) is v:t_func return l:Root(a:buffer) else return l:Root endif endif " Try to get a global setting for the root if has_key(g:ale_root, a:linter.name) let l:Root = g:ale_root[a:linter.name] if type(l:Root) is v:t_func return l:Root(a:buffer) else return l:Root endif endif " Fall back to the linter-specific configuration if has_key(a:linter, 'project_root') let l:Root = a:linter.project_root return type(l:Root) is v:t_func ? l:Root(a:buffer) : l:Root endif return ale#util#GetFunction(a:linter.project_root_callback)(a:buffer) endfunction " This function is accessible so tests can call it. function! ale#lsp_linter#OnInit(linter, details, Callback) abort let l:buffer = a:details.buffer let l:conn_id = a:details.connection_id let l:command = a:details.command let l:config = ale#lsp_linter#GetConfig(l:buffer, a:linter) let l:language_id = ale#linter#GetLanguage(l:buffer, a:linter) call ale#lsp#UpdateConfig(l:conn_id, l:buffer, l:config) if ale#lsp#OpenDocument(l:conn_id, l:buffer, l:language_id) if g:ale_history_enabled && !empty(l:command) call ale#history#Add(l:buffer, 'started', l:conn_id, l:command) endif endif " The change message needs to be sent for tsserver before doing anything. if a:linter.lsp is# 'tsserver' call ale#lsp#NotifyForChanges(l:conn_id, l:buffer) endif " Tell the relevant buffer that the LSP has started via an autocmd. if l:buffer > 0 if l:buffer == bufnr('') silent doautocmd User ALELSPStarted else execute 'augroup ALELSPStartedGroup' . l:buffer autocmd! execute printf( \ 'autocmd BufEnter ' \ . ' doautocmd User ALELSPStarted', \ l:buffer \) " Replicate ++once behavior for backwards compatibility. execute printf( \ 'autocmd BufEnter ' \ . ' autocmd! ALELSPStartedGroup%d', \ l:buffer, l:buffer \) augroup END endif endif call a:Callback(a:linter, a:details) endfunction function! s:StartLSP(options, address, executable, command) abort let l:buffer = a:options.buffer let l:linter = a:options.linter let l:root = a:options.root let l:Callback = a:options.callback let l:init_options = ale#lsp_linter#GetOptions(l:buffer, l:linter) if l:linter.lsp is# 'socket' let l:conn_id = ale#lsp#Register(a:address, l:root, l:init_options) let l:ready = ale#lsp#ConnectToAddress(l:conn_id, a:address) let l:command = '' else let l:conn_id = ale#lsp#Register(a:executable, l:root, l:init_options) " tsserver behaves differently, so tell the LSP API that it is tsserver. if l:linter.lsp is# 'tsserver' call ale#lsp#MarkConnectionAsTsserver(l:conn_id) endif let l:cwd = ale#linter#GetCwd(l:buffer, l:linter) let l:command = ale#command#FormatCommand( \ l:buffer, \ a:executable, \ a:command, \ 0, \ v:false, \ l:cwd, \ ale#GetFilenameMappings(l:buffer, l:linter.name), \)[1] let l:command = ale#job#PrepareCommand(l:buffer, l:command) let l:ready = ale#lsp#StartProgram(l:conn_id, a:executable, l:command) endif if !l:ready if g:ale_history_enabled && !empty(a:command) call ale#history#Add(l:buffer, 'failed', l:conn_id, a:command) endif return 0 endif let l:details = { \ 'buffer': l:buffer, \ 'connection_id': l:conn_id, \ 'command': l:command, \ 'project_root': l:root, \} call ale#lsp#OnInit(l:conn_id, {-> \ ale#lsp_linter#OnInit(l:linter, l:details, l:Callback) \}) return 1 endfunction function! s:StartWithAddress(options, address) abort if ale#command#IsDeferred(a:address) let a:address.result_callback = { \ address -> s:StartWithAddress(a:options, address) \} return 1 endif if empty(a:address) return 0 endif return s:StartLSP(a:options, a:address, '', '') endfunction function! s:StartWithCommand(options, executable, command) abort if ale#command#IsDeferred(a:command) let a:command.result_callback = { \ command -> s:StartWithCommand(a:options, a:executable, command) \} return 1 endif if empty(a:command) return 0 endif return s:StartLSP(a:options, '', a:executable, a:command) endfunction function! s:StartIfExecutable(options, executable) abort if ale#command#IsDeferred(a:executable) let a:executable.result_callback = { \ executable -> s:StartIfExecutable(a:options, executable) \} return 1 endif if !ale#engine#IsExecutable(a:options.buffer, a:executable) return 0 endif let l:command = ale#linter#GetCommand(a:options.buffer, a:options.linter) return s:StartWithCommand(a:options, a:executable, l:command) endfunction " Given a buffer, an LSP linter, start up an LSP linter and get ready to " receive messages for the document. function! ale#lsp_linter#StartLSP(buffer, linter, Callback) abort let l:command = '' let l:address = '' let l:root = ale#lsp_linter#FindProjectRoot(a:buffer, a:linter) if empty(l:root) && a:linter.lsp isnot# 'tsserver' " If there's no project root, then we can't check files with LSP, " unless we are using tsserver, which doesn't use project roots. call ale#lsp_linter#AddErrorMessage(a:linter.name, "Failed to find project root, language server won't start.") return 0 endif let l:options = { \ 'buffer': a:buffer, \ 'linter': a:linter, \ 'callback': a:Callback, \ 'root': l:root, \} if a:linter.lsp is# 'socket' let l:address = ale#linter#GetAddress(a:buffer, a:linter) return s:StartWithAddress(l:options, l:address) endif let l:executable = ale#linter#GetExecutable(a:buffer, a:linter) return s:StartIfExecutable(l:options, l:executable) endfunction function! s:CheckWithLSP(linter, details) abort let l:buffer = a:details.buffer let l:info = get(g:ale_buffer_info, l:buffer) if empty(l:info) return endif let l:id = a:details.connection_id " Register a callback now for handling errors now. let l:Callback = function('ale#lsp_linter#HandleLSPResponse') call ale#lsp#RegisterCallback(l:id, l:Callback) " Remember the linter this connection is for. let s:lsp_linter_map[l:id] = a:linter if a:linter.lsp is# 'tsserver' let l:message = ale#lsp#tsserver_message#Geterr(l:buffer) let l:notified = ale#lsp#Send(l:id, l:message) != 0 if l:notified call ale#engine#MarkLinterActive(l:info, a:linter) endif else let l:notified = ale#lsp#NotifyForChanges(l:id, l:buffer) endif " If this was a file save event, also notify the server of that. if a:linter.lsp isnot# 'tsserver' \&& getbufvar(l:buffer, 'ale_save_event_fired', 0) \&& ale#lsp#HasCapability(l:id, 'did_save') let l:include_text = ale#lsp#HasCapability(l:id, 'includeText') let l:save_message = ale#lsp#message#DidSave(l:buffer, l:include_text) let l:notified = ale#lsp#Send(l:id, l:save_message) != 0 endif endfunction function! ale#lsp_linter#CheckWithLSP(buffer, linter) abort return ale#lsp_linter#StartLSP(a:buffer, a:linter, function('s:CheckWithLSP')) endfunction function! s:HandleLSPResponseToCustomRequests(conn_id, response) abort if has_key(a:response, 'id') " Get the custom handlers Dictionary from the linter map. let l:linter = get(s:lsp_linter_map, a:conn_id, {}) let l:custom_handlers = get(l:linter, 'custom_handlers', {}) if has_key(l:custom_handlers, a:response.id) let l:Handler = remove(l:custom_handlers, a:response.id) call l:Handler(a:response) endif endif endfunction function! s:OnReadyForCustomRequests(args, linter, lsp_details) abort let l:id = a:lsp_details.connection_id let l:request_id = ale#lsp#Send(l:id, a:args.message) if l:request_id > 0 && has_key(a:args, 'handler') let l:Callback = function('s:HandleLSPResponseToCustomRequests') call ale#lsp#RegisterCallback(l:id, l:Callback) " Remember the linter this connection is for. let s:lsp_linter_map[l:id] = a:linter " Add custom_handlers to the linter Dictionary. if !has_key(a:linter, 'custom_handlers') let a:linter.custom_handlers = {} endif " Put the handler function in the map to call later. let a:linter.custom_handlers[l:request_id] = a:args.handler endif endfunction " Send a custom request to an LSP linter. function! ale#lsp_linter#SendRequest(buffer, linter_name, message, ...) abort let l:filetype = ale#linter#ResolveFiletype(getbufvar(a:buffer, '&filetype')) let l:linter_list = ale#linter#GetAll(l:filetype) let l:linter_list = filter(l:linter_list, {_, v -> v.name is# a:linter_name}) if len(l:linter_list) < 1 throw 'Linter "' . a:linter_name . '" not found!' endif let l:linter = l:linter_list[0] if empty(l:linter.lsp) throw 'Linter "' . a:linter_name . '" does not support LSP!' endif let l:is_notification = a:message[0] let l:callback_args = {'message': a:message} if !l:is_notification && a:0 let l:callback_args.handler = a:1 endif let l:Callback = function('s:OnReadyForCustomRequests', [l:callback_args]) return ale#lsp_linter#StartLSP(a:buffer, l:linter, l:Callback) endfunction ale-4.0.0/autoload/ale/lsp_window.vim000066400000000000000000000043621476501472200175440ustar00rootroot00000000000000" Author: suoto " Description: Handling of window/* LSP methods, although right now only " handles window/showMessage " Constants for message type codes let s:LSP_MESSAGE_TYPE_DISABLED = 0 let s:LSP_MESSAGE_TYPE_ERROR = 1 let s:LSP_MESSAGE_TYPE_WARNING = 2 let s:LSP_MESSAGE_TYPE_INFORMATION = 3 let s:LSP_MESSAGE_TYPE_LOG = 4 " Translate strings from the user config to a number so we can check " severities let s:CFG_TO_LSP_SEVERITY = { \ 'disabled': s:LSP_MESSAGE_TYPE_DISABLED, \ 'error': s:LSP_MESSAGE_TYPE_ERROR, \ 'warning': s:LSP_MESSAGE_TYPE_WARNING, \ 'information': s:LSP_MESSAGE_TYPE_INFORMATION, \ 'info': s:LSP_MESSAGE_TYPE_INFORMATION, \ 'log': s:LSP_MESSAGE_TYPE_LOG \} " Handle window/showMessage response. " - details: dict containing linter name and format (g:ale_lsp_show_message_format) " - params: dict with the params for the call in the form of {type: number, message: string} function! ale#lsp_window#HandleShowMessage(linter_name, format, params) abort let l:message = a:params.message let l:type = a:params.type " Get the configured severity level threshold and check if the message " should be displayed or not let l:configured_severity = tolower(get(g:, 'ale_lsp_show_message_severity', 'error')) " If the user has configured with a value we can't find on the conversion " dict, fall back to warning let l:cfg_severity_threshold = get(s:CFG_TO_LSP_SEVERITY, l:configured_severity, s:LSP_MESSAGE_TYPE_WARNING) if l:type > l:cfg_severity_threshold return endif " Severity will depend on the message type if l:type is# s:LSP_MESSAGE_TYPE_ERROR let l:severity = g:ale_echo_msg_error_str elseif l:type is# s:LSP_MESSAGE_TYPE_INFORMATION let l:severity = g:ale_echo_msg_info_str elseif l:type is# s:LSP_MESSAGE_TYPE_LOG let l:severity = g:ale_echo_msg_log_str else " Default to warning just in case let l:severity = g:ale_echo_msg_warning_str endif let l:string = substitute(a:format, '\V%severity%', l:severity, 'g') let l:string = substitute(l:string, '\V%linter%', a:linter_name, 'g') let l:string = substitute(l:string, '\V%s\>', l:message, 'g') call ale#util#ShowMessage(l:string) endfunction ale-4.0.0/autoload/ale/lua.vim000066400000000000000000000017031476501472200161340ustar00rootroot00000000000000" Author: w0rp " Description: Functions for integrating with Lua linters. " Find project root for a Lua language server. function! ale#lua#FindProjectRoot(buffer) abort let l:possible_project_roots = [ \ '.git', \ bufname(a:buffer), \] for l:possible_root in l:possible_project_roots let l:project_root = ale#path#FindNearestFile(a:buffer, l:possible_root) if empty(l:project_root) let l:project_root = ale#path#FindNearestDirectory(a:buffer, l:possible_root) endif if !empty(l:project_root) " dir:p expands to /full/path/to/dir/ whereas " file:p expands to /full/path/to/file (no trailing slash) " Appending '/' ensures that :h:h removes the path's last segment " regardless of whether it is a directory or not. return fnamemodify(l:project_root . '/', ':p:h:h') endif endfor return '' endfunction ale-4.0.0/autoload/ale/maven.vim000066400000000000000000000032511476501472200164610ustar00rootroot00000000000000" Description: Functions for working with Maven projects. " " Given a buffer number, find a Maven project root. function! ale#maven#FindProjectRoot(buffer) abort let l:wrapper_path = ale#path#FindNearestFile(a:buffer, 'mvnw') if !empty(l:wrapper_path) return fnamemodify(l:wrapper_path, ':h') endif let l:pom_path = ale#path#FindNearestFile(a:buffer, 'pom.xml') if !empty(l:pom_path) return fnamemodify(l:pom_path, ':h') endif return '' endfunction " Given a buffer number, find the path to the executable. " First search on the path for 'mvnw' (mvnw.cmd on Windows), if nothing is found, " try the global command. Returns an empty string if cannot find the executable. function! ale#maven#FindExecutable(buffer) abort let l:wrapper_cmd = has('unix') ? 'mvnw' : 'mvnw.cmd' let l:wrapper_path = ale#path#FindNearestFile(a:buffer, l:wrapper_cmd) if !empty(l:wrapper_path) && executable(l:wrapper_path) return l:wrapper_path endif if executable('mvn') return 'mvn' endif return '' endfunction " Given a buffer number, get a working directory and command to print the " classpath of the root project. " " Returns an empty string for the command if Maven is not detected. function! ale#maven#BuildClasspathCommand(buffer) abort let l:executable = ale#maven#FindExecutable(a:buffer) if !empty(l:executable) let l:project_root = ale#maven#FindProjectRoot(a:buffer) if !empty(l:project_root) return [ \ l:project_root, \ ale#Escape(l:executable) . ' dependency:build-classpath' \] endif endif return ['', ''] endfunction ale-4.0.0/autoload/ale/node.vim000066400000000000000000000014131476501472200162760ustar00rootroot00000000000000" Author: w0rp " Description: Functions for working with Node executables. call ale#Set('windows_node_executable_path', 'node.exe') " Create a executable string which executes a Node.js script command with a " Node.js executable if needed. " " The executable string should not be escaped before passing it to this " function, the executable string will be escaped when returned by this " function. " " The executable is only prefixed for Windows machines function! ale#node#Executable(buffer, executable) abort if has('win32') && a:executable =~? '\.js$' let l:node = ale#Var(a:buffer, 'windows_node_executable_path') return ale#Escape(l:node) . ' ' . ale#Escape(a:executable) endif return ale#Escape(a:executable) endfunction ale-4.0.0/autoload/ale/organize_imports.vim000066400000000000000000000033431476501472200207500ustar00rootroot00000000000000" Author: Jerko Steiner " Description: Organize imports support for tsserver function! ale#organize_imports#HandleTSServerResponse(conn_id, response) abort if get(a:response, 'command', '') isnot# 'organizeImports' return endif if get(a:response, 'success', v:false) isnot v:true return endif let l:file_code_edits = a:response.body call ale#code_action#HandleCodeAction( \ { \ 'description': 'Organize Imports', \ 'changes': l:file_code_edits, \ }, \ { \ 'conn_id': a:conn_id, \ 'should_save': g:ale_save_hidden || !&hidden, \ }, \) endfunction function! s:OnReady(linter, lsp_details) abort let l:id = a:lsp_details.connection_id if a:linter.lsp isnot# 'tsserver' call ale#util#Execute('echom ''OrganizeImports currently only works with tsserver''') return endif let l:buffer = a:lsp_details.buffer let l:Callback = function('ale#organize_imports#HandleTSServerResponse') call ale#lsp#RegisterCallback(l:id, l:Callback) let l:message = ale#lsp#tsserver_message#OrganizeImports(l:buffer) let l:request_id = ale#lsp#Send(l:id, l:message) endfunction function! s:OrganizeImports(linter) abort let l:buffer = bufnr('') let [l:line, l:column] = getpos('.')[1:2] if a:linter.lsp isnot# 'tsserver' let l:column = min([l:column, len(getline(l:line))]) endif let l:Callback = function('s:OnReady') call ale#lsp_linter#StartLSP(l:buffer, a:linter, l:Callback) endfunction function! ale#organize_imports#Execute() abort for l:linter in ale#lsp_linter#GetEnabled(bufnr('')) call s:OrganizeImports(l:linter) endfor endfunction ale-4.0.0/autoload/ale/other_source.vim000066400000000000000000000015311476501472200200530ustar00rootroot00000000000000" Tell ALE that another source has started checking a buffer. function! ale#other_source#StartChecking(buffer, linter_name) abort call ale#engine#InitBufferInfo(a:buffer) let l:list = g:ale_buffer_info[a:buffer].active_other_sources_list call add(l:list, a:linter_name) call uniq(sort(l:list)) endfunction " Show some results, and stop checking a buffer. " To clear results or cancel checking a buffer, an empty List can be given. function! ale#other_source#ShowResults(buffer, linter_name, loclist) abort call ale#engine#InitBufferInfo(a:buffer) let l:info = g:ale_buffer_info[a:buffer] " Remove this linter name from the active list. let l:list = l:info.active_other_sources_list call filter(l:list, 'v:val isnot# a:linter_name') call ale#engine#HandleLoclist(a:linter_name, a:buffer, a:loclist, 1) endfunction ale-4.0.0/autoload/ale/path.vim000066400000000000000000000206771476501472200163220ustar00rootroot00000000000000" Author: w0rp " Description: Functions for working with paths in the filesystem. " simplify a path, and fix annoying issues with paths on Windows. " " Forward slashes are changed to back slashes so path equality works better " on Windows. Back slashes are changed to forward slashes on Unix. " " Unix paths can technically contain back slashes, but in practice no path " should, and replacing back slashes with forward slashes makes linters work " in environments like MSYS. " " Paths starting with more than one forward slash are changed to only one " forward slash, to prevent the paths being treated as special MSYS paths. function! ale#path#Simplify(path) abort if has('unix') let l:unix_path = substitute(a:path, '\\', '/', 'g') return substitute(simplify(l:unix_path), '^//\+', '/', 'g') " no-custom-checks endif let l:win_path = substitute(a:path, '/', '\\', 'g') return substitute(simplify(l:win_path), '^\\\+', '\', 'g') " no-custom-checks endfunction " Simplify a path without a Windows drive letter. " This function can be used for checking if paths are equal. function! ale#path#RemoveDriveLetter(path) abort return has('win32') && a:path[1:2] is# ':\' \ ? ale#path#Simplify(a:path[2:]) \ : ale#path#Simplify(a:path) endfunction " Given a buffer and a filename, find the nearest file by searching upwards " through the paths relative to the given buffer. function! ale#path#FindNearestFile(buffer, filename) abort let l:buffer_filename = fnamemodify(bufname(a:buffer), ':p') let l:buffer_filename = fnameescape(l:buffer_filename) let l:relative_path = findfile(a:filename, l:buffer_filename . ';') if !empty(l:relative_path) return fnamemodify(l:relative_path, ':p') endif return '' endfunction " Given a buffer and a directory name, find the nearest directory by searching upwards " through the paths relative to the given buffer. function! ale#path#FindNearestDirectory(buffer, directory_name) abort let l:buffer_filename = fnamemodify(bufname(a:buffer), ':p') let l:buffer_filename = fnameescape(l:buffer_filename) let l:relative_path = finddir(a:directory_name, l:buffer_filename . ';') if !empty(l:relative_path) return fnamemodify(l:relative_path, ':p') endif return '' endfunction " 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, " use the global fallback path instead. function! ale#path#ResolveLocalPath(buffer, search_string, global_fallback) abort " Search for a locally installed file first. let l:path = ale#path#FindNearestFile(a:buffer, a:search_string) " If the search fails, try the global executable instead. if empty(l:path) let l:path = a:global_fallback endif return l:path endfunction " Given a buffer number, a base variable name, and a list of paths to search " for in ancestor directories, detect the executable path for a program. function! ale#path#FindNearestExecutable(buffer, path_list) abort for l:path in a:path_list if ale#path#IsAbsolute(l:path) let l:executable = filereadable(l:path) ? l:path : '' else let l:executable = ale#path#FindNearestFile(a:buffer, l:path) endif if !empty(l:executable) return l:executable endif endfor return '' endfunction " Given a buffer number, a base variable name, and a list of paths to search " for in ancestor directories, detect the executable path for a program. " " The use_global and executable options for the relevant program will be used. function! ale#path#FindExecutable(buffer, base_var_name, path_list) abort if ale#Var(a:buffer, a:base_var_name . '_use_global') return ale#Var(a:buffer, a:base_var_name . '_executable') endif let l:nearest = ale#path#FindNearestExecutable(a:buffer, a:path_list) if !empty(l:nearest) return l:nearest endif return ale#Var(a:buffer, a:base_var_name . '_executable') endfunction " Return 1 if a path is an absolute path. function! ale#path#IsAbsolute(filename) abort if has('win32') && a:filename[:0] is# '\' return 1 endif " Check for /foo and C:\foo, etc. return a:filename[:0] is# '/' || a:filename[1:2] is# ':\' endfunction let s:temp_dir = ale#path#Simplify(fnamemodify(ale#util#Tempname(), ':h:h')) " Given a filename, return 1 if the file represents some temporary file " created by Vim. function! ale#path#IsTempName(filename) abort return ale#path#Simplify(a:filename)[:len(s:temp_dir) - 1] is# s:temp_dir endfunction " Given a base directory, which must not have a trailing slash, and a " filename, which may have an absolute path a path relative to the base " directory, return the absolute path to the file. function! ale#path#GetAbsPath(base_directory, filename) abort if ale#path#IsAbsolute(a:filename) return ale#path#Simplify(a:filename) endif let l:sep = has('win32') ? '\' : '/' return ale#path#Simplify(a:base_directory . l:sep . a:filename) endfunction " Given a path, return the directory name for that path, with no trailing " slashes. If the argument is empty(), return an empty string. function! ale#path#Dirname(path) abort if empty(a:path) return '' endif " For /foo/bar/ we need :h:h to get /foo if a:path[-1:] is# '/' || (has('win32') && a:path[-1:] is# '\') return fnamemodify(a:path, ':h:h') endif return fnamemodify(a:path, ':h') endfunction " Given a buffer number and a relative or absolute path, return 1 if the " two paths represent the same file on disk. function! ale#path#IsBufferPath(buffer, complex_filename) abort " If the path is one of many different names for stdin, we have a match. if a:complex_filename is# '-' \|| a:complex_filename is# 'stdin' \|| a:complex_filename[:0] is# '<' return 1 endif let l:test_filename = ale#path#Simplify(a:complex_filename) if l:test_filename[:1] is# './' let l:test_filename = l:test_filename[2:] endif if l:test_filename[:1] is# '..' " Remove ../../ etc. from the front of the path. let l:test_filename = substitute(l:test_filename, '\v^(\.\.[/\\])+', '/', '') endif " Use the basename for temporary files, as they are likely our files. if ale#path#IsTempName(l:test_filename) let l:test_filename = fnamemodify(l:test_filename, ':t') endif let l:buffer_filename = expand('#' . a:buffer . ':p') return l:buffer_filename is# l:test_filename \ || l:buffer_filename[-len(l:test_filename):] is# l:test_filename endfunction " Given a path, return every component of the path, moving upwards. function! ale#path#Upwards(path) abort let l:pattern = has('win32') ? '\v/+|\\+' : '\v/+' let l:sep = has('win32') ? '\' : '/' let l:parts = split(ale#path#Simplify(a:path), l:pattern) let l:path_list = [] while !empty(l:parts) call add(l:path_list, join(l:parts, l:sep)) let l:parts = l:parts[:-2] endwhile if has('win32') && a:path =~# '^[a-zA-z]:\' " Add \ to C: for C:\, etc. let l:path_list[-1] .= '\' elseif a:path[0] is# '/' " If the path starts with /, even on Windows, add / and / to all paths. call map(l:path_list, '''/'' . v:val') call add(l:path_list, '/') endif return l:path_list endfunction " Convert a filesystem path to a file:// URI " relatives paths will not be prefixed with the protocol. " For Windows paths, the `:` in C:\ etc. will not be percent-encoded. function! ale#path#ToFileURI(path) abort let l:has_drive_letter = a:path[1:2] is# ':\' return substitute( \ ((l:has_drive_letter || a:path[:0] is# '/') ? 'file://' : '') \ . (l:has_drive_letter ? '/' . a:path[:2] : '') \ . ale#uri#Encode(l:has_drive_letter ? a:path[3:] : a:path), \ '\\', \ '/', \ 'g', \) endfunction function! ale#path#FromFileURI(uri) abort if a:uri[:6] is? 'file://' let l:encoded_path = a:uri[7:] elseif a:uri[:4] is? 'file:' let l:encoded_path = a:uri[5:] else let l:encoded_path = a:uri endif let l:path = ale#uri#Decode(l:encoded_path) " If the path is like /C:/foo/bar, it should be C:\foo\bar instead. if has('win32') && l:path =~# '^/[a-zA-Z][:|]' let l:path = substitute(l:path[1:], '/', '\\', 'g') let l:path = l:path[0] . ':' . l:path[2:] endif return l:path endfunction ale-4.0.0/autoload/ale/pattern_options.vim000066400000000000000000000025041476501472200206030ustar00rootroot00000000000000" Author: w0rp " Description: Set options in files based on regex patterns. " These variables are used to cache the sorting of patterns below. let s:last_pattern_options = {} let s:sorted_items = [] function! s:CmpPatterns(left_item, right_item) abort if a:left_item[0] < a:right_item[0] return -1 endif if a:left_item[0] > a:right_item[0] return 1 endif return 0 endfunction function! ale#pattern_options#SetOptions(buffer) abort let l:pattern_options = get(g:, 'ale_pattern_options', {}) if empty(l:pattern_options) " Stop if no options are set. return endif " The items will only be sorted whenever the patterns change. if l:pattern_options != s:last_pattern_options let s:last_pattern_options = deepcopy(l:pattern_options) " The patterns are sorted, so they are applied consistently. let s:sorted_items = sort( \ items(l:pattern_options), \ function('s:CmpPatterns') \) endif let l:filename = expand('#' . a:buffer . ':p') for [l:pattern, l:options] in s:sorted_items if match(l:filename, l:pattern) >= 0 for [l:key, l:value] in items(l:options) call setbufvar(a:buffer, l:key, l:value) endfor endif endfor endfunction ale-4.0.0/autoload/ale/powershell.vim000066400000000000000000000023431476501472200175400ustar00rootroot00000000000000" Author: zigford " Description: Functions for integrating with Powershell linters. " Write a powershell script to a temp file for execution " return the command used to execute it function! s:TemporaryPSScript(buffer, input) abort let l:filename = 'script.ps1' " Create a temp dir to house our temp .ps1 script " a temp dir is needed as powershell needs the .ps1 " extension let l:tempdir = ale#util#Tempname() . (has('win32') ? '\' : '/') let l:tempscript = l:tempdir . l:filename " Create the temporary directory for the file, unreadable by 'other' " users. call mkdir(l:tempdir, '', 0750) " Automatically delete the directory later. call ale#command#ManageDirectory(a:buffer, l:tempdir) " Write the script input out to a file. call ale#util#Writefile(a:buffer, a:input, l:tempscript) return l:tempscript endfunction function! ale#powershell#RunPowerShell(buffer, base_var_name, command) abort let l:executable = ale#Var(a:buffer, a:base_var_name . '_executable') let l:tempscript = s:TemporaryPSScript(a:buffer, a:command) return ale#Escape(l:executable) \ . ' -Exe Bypass -NoProfile -File ' \ . ale#Escape(l:tempscript) \ . ' %t' endfunction ale-4.0.0/autoload/ale/preview.vim000066400000000000000000000075261476501472200170450ustar00rootroot00000000000000" Author: w0rp " Description: Preview windows for showing whatever information in. if !has_key(s:, 'last_list') let s:last_list = [] endif if !has_key(s:, 'last_options') let s:last_options = {} endif function! ale#preview#SetLastSelection(item_list, options) abort let s:last_list = a:item_list let s:last_options = { \ 'open_in': get(a:options, 'open_in', 'current-buffer'), \ 'use_relative_paths': get(a:options, 'use_relative_paths', 0), \} endfunction " Open a preview window and show some lines in it. " A second argument can be passed as a Dictionary with options. They are... " " filetype - The filetype to use, defaulting to 'ale-preview' " stay_here - If 1, stay in the window you came from. function! ale#preview#Show(lines, ...) abort let l:options = get(a:000, 0, {}) silent pedit ALEPreviewWindow wincmd P setlocal modifiable setlocal noreadonly setlocal nobuflisted setlocal buftype=nofile setlocal bufhidden=wipe :%d call setline(1, a:lines) setlocal nomodifiable setlocal readonly let &l:filetype = get(l:options, 'filetype', 'ale-preview') for l:command in get(l:options, 'commands', []) call execute(l:command) endfor if get(l:options, 'stay_here') wincmd p endif endfunction " Close the preview window if the filetype matches the given one. function! ale#preview#CloseIfTypeMatches(filetype) abort for l:win in getwininfo() let l:wintype = gettabwinvar(l:win.tabnr, l:win.winnr, '&filetype') if l:wintype is# a:filetype silent! pclose! endif endfor endfunction " Show a location selection preview window, given some items. " Each item should have 'filename', 'line', and 'column' keys. function! ale#preview#ShowSelection(item_list, ...) abort let l:options = get(a:000, 0, {}) let l:sep = has('win32') ? '\' : '/' let l:lines = [] " Create lines to display to users. for l:item in a:item_list let l:match = get(l:item, 'match', '') let l:filename = l:item.filename if get(l:options, 'use_relative_paths') let l:cwd = getcwd() " no-custom-checks let l:filename = substitute(l:filename, '^' . l:cwd . l:sep, '', '') endif call add( \ l:lines, \ l:filename \ . ':' . l:item.line \ . ':' . l:item.column \ . (!empty(l:match) ? ' ' . l:match : ''), \) endfor call ale#preview#Show(l:lines, {'filetype': 'ale-preview-selection'}) let b:ale_preview_item_list = a:item_list let b:ale_preview_item_open_in = get(l:options, 'open_in', 'current-buffer') " Jump to an index for a previous selection, if set. if has_key(l:options, 'jump_to_index') let l:pos = getpos('.') let l:pos[1] = l:options.jump_to_index + 1 call setpos('.', l:pos) endif " Remember preview state, so we can repeat it later. call ale#preview#SetLastSelection(a:item_list, l:options) endfunction function! ale#preview#RepeatSelection() abort if !empty(s:last_list) call ale#preview#ShowSelection(s:last_list, s:last_options) endif endfunction function! s:Open(open_in) abort let l:item_list = get(b:, 'ale_preview_item_list', []) let l:index = getpos('.')[1] - 1 let l:item = get(l:item_list, l:index, {}) if empty(l:item) return endif " Remember an index to jump to when repeating a selection. let s:last_options.jump_to_index = l:index :q! call ale#util#Open( \ l:item.filename, \ l:item.line, \ l:item.column, \ {'open_in': a:open_in}, \) endfunction function! ale#preview#OpenSelection() abort call s:Open(b:ale_preview_item_open_in) endfunction function! ale#preview#OpenSelectionInTab() abort call s:Open('tab') endfunction ale-4.0.0/autoload/ale/python.vim000066400000000000000000000161701476501472200167000ustar00rootroot00000000000000" Author: w0rp " Description: Functions for integrating with Python linters. call ale#Set('python_auto_pipenv', '0') call ale#Set('python_auto_poetry', '0') call ale#Set('python_auto_uv', '0') let s:sep = has('win32') ? '\' : '/' " bin is used for Unix virtualenv directories, and Scripts is for Windows. let s:bin_dir = has('unix') ? 'bin' : 'Scripts' " The default virtualenv directory names are ordered from the likely most " common names down to the least common. `.env` might be more common, but it's " also likely to conflict with a `.env` file for environment variables, so we " search for it last. (People really shouldn't use that name.) let g:ale_virtualenv_dir_names = get(g:, 'ale_virtualenv_dir_names', [ \ '.venv', \ 'env', \ 've', \ 'venv', \ 'virtualenv', \ '.env', \]) function! ale#python#FindProjectRootIni(buffer) abort for l:path in ale#path#Upwards(expand('#' . a:buffer . ':p:h')) " If you change this, update ale-python-root documentation. if filereadable(l:path . '/MANIFEST.in') \|| filereadable(l:path . '/setup.cfg') \|| filereadable(l:path . '/pytest.ini') \|| filereadable(l:path . '/tox.ini') \|| filereadable(l:path . '/.pyre_configuration.local') \|| filereadable(l:path . '/mypy.ini') \|| filereadable(l:path . '/.mypy.ini') \|| filereadable(l:path . '/pycodestyle.cfg') \|| filereadable(l:path . '/.flake8') \|| filereadable(l:path . '/.flake8rc') \|| filereadable(l:path . '/pylama.ini') \|| filereadable(l:path . '/pylintrc') \|| filereadable(l:path . '/.pylintrc') \|| filereadable(l:path . '/pyrightconfig.json') \|| filereadable(l:path . '/pyrightconfig.toml') \|| filereadable(l:path . '/Pipfile') \|| filereadable(l:path . '/Pipfile.lock') \|| filereadable(l:path . '/poetry.lock') \|| filereadable(l:path . '/pyproject.toml') \|| filereadable(l:path . '/.tool-versions') \|| filereadable(l:path . '/uv.lock') return l:path endif endfor return '' endfunction " Given a buffer number, find the project root directory for Python. " The root directory is defined as the first directory found while searching " upwards through paths, including the current directory, until a path " 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 " via init file, then it will be defined as the first directory found " searching upwards through paths, including the current directory, until no " __init__.py files is found. function! ale#python#FindProjectRoot(buffer) abort let l:ini_root = ale#python#FindProjectRootIni(a:buffer) if !empty(l:ini_root) return l:ini_root endif for l:path in ale#path#Upwards(expand('#' . a:buffer . ':p:h')) if !filereadable(l:path . '/__init__.py') return l:path endif endfor return '' endfunction " Given a buffer number, find a virtualenv path for Python. function! ale#python#FindVirtualenv(buffer) abort for l:path in ale#path#Upwards(expand('#' . a:buffer . ':p:h')) " Skip empty path components returned in MSYS. if empty(l:path) continue endif for l:dirname in ale#Var(a:buffer, 'virtualenv_dir_names') let l:venv_dir = ale#path#Simplify( \ join([l:path, l:dirname], s:sep) \) let l:script_filename = ale#path#Simplify( \ join([l:venv_dir, s:bin_dir, 'activate'], s:sep) \) if filereadable(l:script_filename) return l:venv_dir endif endfor endfor return $VIRTUAL_ENV endfunction " Automatically determine virtualenv environment variables and build " a string of them to prefix linter commands with. function! ale#python#AutoVirtualenvEnvString(buffer) abort let l:venv_dir = ale#python#FindVirtualenv(a:buffer) if !empty(l:venv_dir) let l:strs = [ ] " venv/bin directory let l:pathdir = join([l:venv_dir, s:bin_dir], s:sep) " expand PATH correctly inside of the appropriate shell. " set VIRTUAL_ENV to point to venv if has('win32') call add(l:strs, 'set PATH=' . ale#Escape(l:pathdir) . ';%PATH% && ') call add(l:strs, 'set VIRTUAL_ENV=' . ale#Escape(l:venv_dir) . ' && ') else call add(l:strs, 'PATH=' . ale#Escape(l:pathdir) . '":$PATH" ') call add(l:strs, 'VIRTUAL_ENV=' . ale#Escape(l:venv_dir) . ' ') endif return join(l:strs, '') endif return '' endfunction " Given a buffer number and a command name, find the path to the executable. " First search on a virtualenv for Python, if nothing is found, try the global " command. Returns an empty string if cannot find the executable function! ale#python#FindExecutable(buffer, base_var_name, path_list) abort if ale#Var(a:buffer, a:base_var_name . '_use_global') return ale#Var(a:buffer, a:base_var_name . '_executable') endif let l:virtualenv = ale#python#FindVirtualenv(a:buffer) if !empty(l:virtualenv) for l:path in a:path_list let l:ve_executable = ale#path#Simplify( \ join([l:virtualenv, s:bin_dir, l:path], s:sep) \) if executable(l:ve_executable) return l:ve_executable endif endfor endif return ale#Var(a:buffer, a:base_var_name . '_executable') endfunction " Handle traceback.print_exception() output starting in the first a:limit lines. function! ale#python#HandleTraceback(lines, limit) abort let l:nlines = len(a:lines) let l:limit = a:limit > l:nlines ? l:nlines : a:limit let l:start = 0 while l:start < l:limit if a:lines[l:start] is# 'Traceback (most recent call last):' break endif let l:start += 1 endwhile if l:start >= l:limit return [] endif let l:end = l:start + 1 " Traceback entries are always prefixed with 2 spaces. " SyntaxError marker (if present) is prefixed with at least 4 spaces. " Final exc line starts with exception class name (never a space). while l:end < l:nlines && a:lines[l:end][0] is# ' ' let l:end += 1 endwhile let l:exc_line = l:end < l:nlines \ ? a:lines[l:end] \ : 'An exception was thrown.' return [{ \ 'lnum': 1, \ 'text': l:exc_line . ' (See :ALEDetail)', \ 'detail': join(a:lines[(l:start):(l:end)], "\n"), \}] endfunction " Detects whether a pipenv environment is present. function! ale#python#PipenvPresent(buffer) abort return findfile('Pipfile.lock', expand('#' . a:buffer . ':p:h') . ';') isnot# '' endfunction " Detects whether a poetry environment is present. function! ale#python#PoetryPresent(buffer) abort return findfile('poetry.lock', expand('#' . a:buffer . ':p:h') . ';') isnot# '' endfunction " Detects whether a poetry environment is present. function! ale#python#UvPresent(buffer) abort return findfile('uv.lock', expand('#' . a:buffer . ':p:h') . ';') isnot# '' endfunction ale-4.0.0/autoload/ale/racket.vim000066400000000000000000000005011476501472200166170ustar00rootroot00000000000000function! ale#racket#FindProjectRoot(buffer) abort let l:cwd = expand('#' . a:buffer . ':p:h') let l:highest_init = l:cwd for l:path in ale#path#Upwards(l:cwd) if filereadable(l:path.'/init.rkt') let l:highest_init = l:path endif endfor return l:highest_init endfunction ale-4.0.0/autoload/ale/references.vim000066400000000000000000000141511476501472200174750ustar00rootroot00000000000000let g:ale_default_navigation = get(g:, 'ale_default_navigation', 'buffer') let s:references_map = {} " Used to get the references map in tests. function! ale#references#GetMap() abort return deepcopy(s:references_map) endfunction " Used to set the references map in tests. function! ale#references#SetMap(map) abort let s:references_map = a:map endfunction function! ale#references#ClearLSPData() abort let s:references_map = {} endfunction function! ale#references#FormatTSResponseItem(response_item, options) abort let l:match = substitute(a:response_item.lineText, '^\s*\(.\{-}\)\s*$', '\1', '') if get(a:options, 'open_in') is# 'quickfix' return { \ 'filename': a:response_item.file, \ 'lnum': a:response_item.start.line, \ 'col': a:response_item.start.offset, \ 'text': l:match, \} else return { \ 'filename': a:response_item.file, \ 'line': a:response_item.start.line, \ 'column': a:response_item.start.offset, \ 'match': l:match, \} endif endfunction function! ale#references#HandleTSServerResponse(conn_id, response) abort if get(a:response, 'command', '') is# 'references' \&& has_key(s:references_map, a:response.request_seq) let l:options = remove(s:references_map, a:response.request_seq) if get(a:response, 'success', v:false) is v:true let l:item_list = [] for l:response_item in a:response.body.refs call add( \ l:item_list, \ ale#references#FormatTSResponseItem(l:response_item, l:options) \) endfor if empty(l:item_list) call ale#util#Execute('echom ''No references found.''') else if get(l:options, 'open_in') is# 'quickfix' call setqflist([], 'r') call setqflist(l:item_list, 'a') call ale#util#Execute('cc 1') else call ale#preview#ShowSelection(l:item_list, l:options) endif endif endif endif 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 if has_key(a:response, 'id') \&& has_key(s:references_map, a:response.id) let l:options = remove(s:references_map, a:response.id) " The result can be a Dictionary item, a List of the same, or null. let l:result = get(a:response, 'result', []) let l:item_list = [] if type(l:result) is v:t_list for l:response_item in l:result call add(l:item_list, \ ale#references#FormatLSPResponseItem(l:response_item, l:options) \) endfor endif if empty(l:item_list) call ale#util#Execute('echom ''No references found.''') else if get(l:options, 'open_in') is# 'quickfix' call setqflist([], 'r') call setqflist(l:item_list, 'a') call ale#util#Execute('cc 1') else call ale#preview#ShowSelection(l:item_list, l:options) endif endif endif endfunction function! s:OnReady(line, column, options, linter, lsp_details) abort let l:id = a:lsp_details.connection_id if !ale#lsp#HasCapability(l:id, 'references') return endif let l:buffer = a:lsp_details.buffer let l:Callback = a:linter.lsp is# 'tsserver' \ ? function('ale#references#HandleTSServerResponse') \ : function('ale#references#HandleLSPResponse') call ale#lsp#RegisterCallback(l:id, l:Callback) if a:linter.lsp is# 'tsserver' let l:message = ale#lsp#tsserver_message#References( \ l:buffer, \ a:line, \ a:column \) else " Send a message saying the buffer has changed first, or the " references position probably won't make sense. call ale#lsp#NotifyForChanges(l:id, l:buffer) let l:message = ale#lsp#message#References(l:buffer, a:line, a:column) endif let l:request_id = ale#lsp#Send(l:id, l:message) let s:references_map[l:request_id] = { \ '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'), \} endfunction function! ale#references#Find(...) abort let l:options = {} if len(a:000) > 0 for l:option in a:000 if l:option is? '-relative' let l:options.use_relative_paths = 1 elseif l:option is? '-tab' let l:options.open_in = 'tab' elseif l:option is? '-split' let l:options.open_in = 'split' elseif l:option is? '-vsplit' let l:options.open_in = 'vsplit' elseif l:option is? '-quickfix' let l:options.open_in = 'quickfix' endif endfor endif if !has_key(l:options, 'open_in') let l:default_navigation = ale#Var(bufnr(''), 'default_navigation') if index(['tab', 'split', 'vsplit'], l:default_navigation) >= 0 let l:options.open_in = l:default_navigation endif endif let l:buffer = bufnr('') let [l:line, l:column] = getpos('.')[1:2] let l:column = min([l:column, len(getline(l:line))]) let l:Callback = function('s:OnReady', [l:line, l:column, l:options]) for l:linter in ale#lsp_linter#GetEnabled(l:buffer) call ale#lsp_linter#StartLSP(l:buffer, l:linter, l:Callback) endfor endfunction ale-4.0.0/autoload/ale/rename.vim000066400000000000000000000126531476501472200166300ustar00rootroot00000000000000" Author: Jerko Steiner " Description: Rename symbol support for LSP / tsserver let s:rename_map = {} " Used to get the rename map in tests. function! ale#rename#GetMap() abort return deepcopy(s:rename_map) endfunction " Used to set the rename map in tests. function! ale#rename#SetMap(map) abort let s:rename_map = a:map endfunction function! ale#rename#ClearLSPData() abort let s:rename_map = {} endfunction let g:ale_rename_tsserver_find_in_comments = get(g:, 'ale_rename_tsserver_find_in_comments') let g:ale_rename_tsserver_find_in_strings = get(g:, 'ale_rename_tsserver_find_in_strings') function! s:message(message) abort call ale#util#Execute('echom ' . string(a:message)) endfunction function! ale#rename#HandleTSServerResponse(conn_id, response) abort if get(a:response, 'command', '') isnot# 'rename' return endif if !has_key(s:rename_map, a:response.request_seq) return endif let l:options = remove(s:rename_map, a:response.request_seq) let l:old_name = l:options.old_name let l:new_name = l:options.new_name if get(a:response, 'success', v:false) is v:false let l:message = get(a:response, 'message', 'unknown') call s:message('Error renaming "' . l:old_name . '" to: "' . l:new_name \ . '". Reason: ' . l:message) return endif let l:changes = [] for l:response_item in a:response.body.locs let l:filename = l:response_item.file let l:text_changes = [] for l:loc in l:response_item.locs call add(l:text_changes, { \ 'start': { \ 'line': l:loc.start.line, \ 'offset': l:loc.start.offset, \ }, \ 'end': { \ 'line': l:loc.end.line, \ 'offset': l:loc.end.offset, \ }, \ 'newText': l:new_name, \}) endfor call add(l:changes, { \ 'fileName': l:filename, \ 'textChanges': l:text_changes, \}) endfor if empty(l:changes) call s:message('Error renaming "' . l:old_name . '" to: "' . l:new_name . '"') return endif call ale#code_action#HandleCodeAction( \ { \ 'description': 'rename', \ 'changes': l:changes, \ }, \ { \ 'conn_id': a:conn_id, \ 'should_save': g:ale_save_hidden || !&hidden, \ }, \) endfunction function! ale#rename#HandleLSPResponse(conn_id, response) abort if has_key(a:response, 'id') \&& has_key(s:rename_map, a:response.id) let l:options = remove(s:rename_map, a:response.id) if !has_key(a:response, 'result') call s:message('No rename result received from server') return endif let l:changes_map = ale#code_action#GetChanges(a:response.result) if empty(l:changes_map) call s:message('No changes received from server') return endif let l:changes = ale#code_action#BuildChangesList(l:changes_map) call ale#code_action#HandleCodeAction( \ { \ 'description': 'rename', \ 'changes': l:changes, \ }, \ { \ 'conn_id': a:conn_id, \ 'should_save': g:ale_save_hidden || !&hidden, \ }, \) endif endfunction function! s:OnReady(line, column, options, linter, lsp_details) abort let l:id = a:lsp_details.connection_id if !ale#lsp#HasCapability(l:id, 'rename') return endif let l:buffer = a:lsp_details.buffer let l:Callback = a:linter.lsp is# 'tsserver' \ ? function('ale#rename#HandleTSServerResponse') \ : function('ale#rename#HandleLSPResponse') call ale#lsp#RegisterCallback(l:id, l:Callback) if a:linter.lsp is# 'tsserver' let l:message = ale#lsp#tsserver_message#Rename( \ l:buffer, \ a:line, \ a:column, \ g:ale_rename_tsserver_find_in_comments, \ g:ale_rename_tsserver_find_in_strings, \) else " Send a message saying the buffer has changed first, or the " rename position probably won't make sense. call ale#lsp#NotifyForChanges(l:id, l:buffer) let l:message = ale#lsp#message#Rename( \ l:buffer, \ a:line, \ a:column, \ a:options.new_name \) endif let l:request_id = ale#lsp#Send(l:id, l:message) let s:rename_map[l:request_id] = a:options endfunction function! s:ExecuteRename(linter, options) abort let l:buffer = bufnr('') let [l:line, l:column] = getpos('.')[1:2] if a:linter.lsp isnot# 'tsserver' let l:column = min([l:column, len(getline(l:line))]) endif let l:Callback = function('s:OnReady', [l:line, l:column, a:options]) call ale#lsp_linter#StartLSP(l:buffer, a:linter, l:Callback) endfunction function! ale#rename#Execute() abort let l:linters = ale#lsp_linter#GetEnabled(bufnr('')) if empty(l:linters) call s:message('No active LSPs') return endif let l:old_name = expand('') let l:new_name = ale#util#Input('New name: ', l:old_name) if empty(l:new_name) call s:message('New name cannot be empty!') return endif for l:linter in l:linters call s:ExecuteRename(l:linter, { \ 'old_name': l:old_name, \ 'new_name': l:new_name, \}) endfor endfunction ale-4.0.0/autoload/ale/ruby.vim000066400000000000000000000044161476501472200163400ustar00rootroot00000000000000" Author: Eddie Lebow https://github.com/elebow " Description: Functions for integrating with Ruby tools " Find the nearest dir containing "app", "db", and "config", and assume it is " the root of a Rails app. function! ale#ruby#FindRailsRoot(buffer) abort for l:name in ['app', 'config', 'db'] let l:dir = fnamemodify( \ ale#path#FindNearestDirectory(a:buffer, l:name), \ ':h:h' \) if l:dir isnot# '.' \&& isdirectory(l:dir . '/app') \&& isdirectory(l:dir . '/config') \&& isdirectory(l:dir . '/db') return l:dir endif endfor return '' endfunction " Find the nearest dir containing a potential ruby project. function! ale#ruby#FindProjectRoot(buffer) abort let l:dir = ale#ruby#FindRailsRoot(a:buffer) if isdirectory(l:dir) return l:dir endif for l:name in ['.solargraph.yml', 'Rakefile', 'Gemfile'] let l:dir = fnamemodify( \ ale#path#FindNearestFile(a:buffer, l:name), \ ':h' \) if l:dir isnot# '.' && isdirectory(l:dir) return l:dir endif endfor return '' endfunction " Handle output from rubocop and linters that depend on it (e.b. standardrb) function! ale#ruby#HandleRubocopOutput(buffer, lines) abort try let l:errors = json_decode(a:lines[0]) catch return [] endtry if !has_key(l:errors, 'summary') \|| l:errors['summary']['offense_count'] == 0 \|| empty(l:errors['files']) return [] endif let l:output = [] for l:error in l:errors['files'][0]['offenses'] let l:start_col = l:error['location']['column'] + 0 call add(l:output, { \ 'lnum': l:error['location']['line'] + 0, \ 'col': l:start_col, \ 'end_col': l:start_col + l:error['location']['length'] - 1, \ 'code': l:error['cop_name'], \ 'text': l:error['message'], \ 'type': ale_linters#ruby#rubocop#GetType(l:error['severity']), \}) endfor return l:output endfunction function! ale#ruby#EscapeExecutable(executable, bundle_exec) abort let l:exec_args = a:executable =~? 'bundle' \ ? ' exec ' . a:bundle_exec \ : '' return ale#Escape(a:executable) . l:exec_args endfunction ale-4.0.0/autoload/ale/semver.vim000066400000000000000000000042621476501472200166570ustar00rootroot00000000000000let s:version_cache = {} " Reset the version cache used for parsing the version. function! ale#semver#ResetVersionCache() abort let s:version_cache = {} endfunction function! ale#semver#ParseVersion(version_lines) abort for l:line in a:version_lines let l:match = matchlist(l:line, '\v(\d+)\.(\d+)(\.(\d+))?') if !empty(l:match) return [l:match[1] + 0, l:match[2] + 0, l:match[4] + 0] endif endfor return [] endfunction " Given an executable name and some lines of output, which can be empty, " parse the version from the lines of output, or return the cached version " triple [major, minor, patch] " " If the version cannot be found, an empty List will be returned instead. function! s:GetVersion(executable, version_lines) abort let l:version = get(s:version_cache, a:executable, []) let l:parsed_version = ale#semver#ParseVersion(a:version_lines) if !empty(l:parsed_version) let l:version = l:parsed_version let s:version_cache[a:executable] = l:version endif return l:version endfunction function! ale#semver#RunWithVersionCheck(buffer, executable, command, Callback) abort if empty(a:executable) return '' endif let l:cache = s:version_cache if has_key(s:version_cache, a:executable) return a:Callback(a:buffer, s:version_cache[a:executable]) endif return ale#command#Run( \ a:buffer, \ a:command, \ {_, output -> a:Callback(a:buffer, s:GetVersion(a:executable, output))}, \ {'output_stream': 'both', 'executable': a:executable} \) endfunction " Given two triples of integers [major, minor, patch], compare the triples " and return 1 if the LHS is greater than or equal to the RHS. " " Pairs of [major, minor] can also be used for either argument. " " 0 will be returned if the LHS is an empty List. function! ale#semver#GTE(lhs, rhs) abort if empty(a:lhs) return 0 endif if a:lhs[0] > a:rhs[0] return 1 elseif a:lhs[0] == a:rhs[0] if a:lhs[1] > a:rhs[1] return 1 elseif a:lhs[1] == a:rhs[1] return get(a:lhs, 2) >= get(a:rhs, 2) endif endif return 0 endfunction ale-4.0.0/autoload/ale/sign.vim000066400000000000000000000373361476501472200163260ustar00rootroot00000000000000scriptencoding utf8 " Author: w0rp " Description: Draws error and warning signs into signcolumn " This flag can be set to some integer to control the maximum number of signs " that ALE will set. let g:ale_max_signs = get(g:, 'ale_max_signs', -1) " This flag can be set to 1 to enable changing the sign column colors when " there are errors. let g:ale_change_sign_column_color = get(g:, 'ale_change_sign_column_color', 0) " These variables dictate what signs are used to indicate errors and warnings. let g:ale_sign_error = get(g:, 'ale_sign_error', 'E') let g:ale_sign_style_error = get(g:, 'ale_sign_style_error', g:ale_sign_error) let g:ale_sign_warning = get(g:, 'ale_sign_warning', 'W') let g:ale_sign_style_warning = get(g:, 'ale_sign_style_warning', g:ale_sign_warning) let g:ale_sign_info = get(g:, 'ale_sign_info', 'I') let g:ale_sign_priority = get(g:, 'ale_sign_priority', 30) " This variable sets an offset which can be set for sign IDs. " This ID can be changed depending on what IDs are set for other plugins. " The dummy sign will use the ID exactly equal to the offset. let g:ale_sign_offset = get(g:, 'ale_sign_offset', 1000000) " This flag can be set to 1 to keep sign gutter always open let g:ale_sign_column_always = get(g:, 'ale_sign_column_always', 0) let g:ale_sign_highlight_linenrs = get(g:, 'ale_sign_highlight_linenrs', 0) let s:supports_sign_groups = has('nvim-0.4.2') || has('patch-8.1.614') if !hlexists('ALEErrorSign') highlight link ALEErrorSign error endif if !hlexists('ALEStyleErrorSign') highlight link ALEStyleErrorSign ALEErrorSign endif if !hlexists('ALEWarningSign') highlight link ALEWarningSign todo endif if !hlexists('ALEStyleWarningSign') highlight link ALEStyleWarningSign ALEWarningSign endif if !hlexists('ALEInfoSign') highlight link ALEInfoSign ALEWarningSign endif if !hlexists('ALESignColumnWithErrors') highlight link ALESignColumnWithErrors error endif function! ale#sign#SetUpDefaultColumnWithoutErrorsHighlight() abort let l:verbose = &verbose set verbose=0 let l:output = execute('highlight SignColumn', 'silent') let &verbose = l:verbose let l:highlight_syntax = join(split(l:output)[2:]) let l:match = matchlist(l:highlight_syntax, '\vlinks to (.+)$') if !empty(l:match) execute 'highlight link ALESignColumnWithoutErrors ' . l:match[1] elseif l:highlight_syntax isnot# 'cleared' execute 'highlight ALESignColumnWithoutErrors ' . l:highlight_syntax endif endfunction if !hlexists('ALESignColumnWithoutErrors') call ale#sign#SetUpDefaultColumnWithoutErrorsHighlight() endif " Spaces and backslashes need to be escaped for signs. function! s:EscapeSignText(sign_text) abort return substitute(substitute(a:sign_text, ' *$', '', ''), '\\\| ', '\\\0', 'g') endfunction " Signs show up on the left for error markers. execute 'sign define ALEErrorSign text=' . s:EscapeSignText(g:ale_sign_error) \ . ' texthl=ALEErrorSign linehl=ALEErrorLine' execute 'sign define ALEStyleErrorSign text=' . s:EscapeSignText(g:ale_sign_style_error) \ . ' texthl=ALEStyleErrorSign linehl=ALEErrorLine' execute 'sign define ALEWarningSign text=' . s:EscapeSignText(g:ale_sign_warning) \ . ' texthl=ALEWarningSign linehl=ALEWarningLine' execute 'sign define ALEStyleWarningSign text=' . s:EscapeSignText(g:ale_sign_style_warning) \ . ' texthl=ALEStyleWarningSign linehl=ALEWarningLine' execute 'sign define ALEInfoSign text=' . s:EscapeSignText(g:ale_sign_info) \ . ' texthl=ALEInfoSign linehl=ALEInfoLine' sign define ALEDummySign text=\ texthl=SignColumn if g:ale_sign_highlight_linenrs && (has('nvim-0.3.2') || has('patch-8.2.3874')) if !hlexists('ALEErrorSignLineNr') highlight link ALEErrorSignLineNr CursorLineNr endif if !hlexists('ALEStyleErrorSignLineNr') highlight link ALEStyleErrorSignLineNr CursorLineNr endif if !hlexists('ALEWarningSignLineNr') highlight link ALEWarningSignLineNr CursorLineNr endif if !hlexists('ALEStyleWarningSignLineNr') highlight link ALEStyleWarningSignLineNr CursorLineNr endif if !hlexists('ALEInfoSignLineNr') highlight link ALEInfoSignLineNr CursorLineNr endif sign define ALEErrorSign numhl=ALEErrorSignLineNr sign define ALEStyleErrorSign numhl=ALEStyleErrorSignLineNr sign define ALEWarningSign numhl=ALEWarningSignLineNr sign define ALEStyleWarningSign numhl=ALEStyleWarningSignLineNr sign define ALEInfoSign numhl=ALEInfoSignLineNr endif function! ale#sign#GetSignName(sublist) abort let l:priority = g:ale#util#style_warning_priority " Determine the highest priority item for the line. for l:item in a:sublist let l:item_priority = ale#util#GetItemPriority(l:item) if l:item_priority > l:priority let l:priority = l:item_priority endif endfor if l:priority is# g:ale#util#error_priority return 'ALEErrorSign' endif if l:priority is# g:ale#util#warning_priority return 'ALEWarningSign' endif if l:priority is# g:ale#util#style_error_priority return 'ALEStyleErrorSign' endif if l:priority is# g:ale#util#style_warning_priority return 'ALEStyleWarningSign' endif if l:priority is# g:ale#util#info_priority return 'ALEInfoSign' endif " Use the error sign for invalid severities. return 'ALEErrorSign' endfunction function! s:PriorityCmd() abort if s:supports_sign_groups return ' priority=' . g:ale_sign_priority . ' ' else return '' endif endfunction function! s:GroupCmd() abort if s:supports_sign_groups return ' group=ale_signs ' else return ' ' endif endfunction " Read sign data for a buffer to a list of lines. function! ale#sign#ReadSigns(buffer) abort let l:output = execute( \ 'sign place ' . s:GroupCmd() . s:PriorityCmd() \ . ' buffer=' . a:buffer \ ) return split(l:output, "\n") endfunction function! ale#sign#ParsePattern() abort if s:supports_sign_groups " Matches output like : " line=4 id=1 group=ale_signs name=ALEErrorSign " строка=1 id=1000001 группа=ale_signs имя=ALEErrorSign " 行=1 識別子=1000001 グループ=ale_signs 名前=ALEWarningSign " línea=12 id=1000001 grupo=ale_signs nombre=ALEWarningSign " riga=1 id=1000001 gruppo=ale_signs nome=ALEWarningSign " Zeile=235 id=1000001 Gruppe=ale_signs Name=ALEErrorSign let l:pattern = '\v^.*\=(\d+).*\=(\d+).*\=ale_signs>.*\=(ALE[a-zA-Z]+Sign)' else " Matches output like : " line=4 id=1 name=ALEErrorSign " строка=1 id=1000001 имя=ALEErrorSign " 行=1 識別子=1000001 名前=ALEWarningSign " línea=12 id=1000001 nombre=ALEWarningSign " riga=1 id=1000001 nome=ALEWarningSign " Zeile=235 id=1000001 Name=ALEErrorSign let l:pattern = '\v^.*\=(\d+).*\=(\d+).*\=(ALE[a-zA-Z]+Sign)' endif return l:pattern endfunction " Given a buffer number, return a List of placed signs [line, id, group] function! ale#sign#ParseSignsWithGetPlaced(buffer) abort let l:signs = sign_getplaced(a:buffer, { 'group': s:supports_sign_groups ? 'ale_signs' : '' })[0].signs let l:result = [] let l:is_dummy_sign_set = 0 for l:sign in l:signs if l:sign['name'] is# 'ALEDummySign' let l:is_dummy_sign_set = 1 else call add(l:result, [ \ str2nr(l:sign['lnum']), \ str2nr(l:sign['id']), \ l:sign['name'], \]) endif endfor return [l:is_dummy_sign_set, l:result] endfunction " Given a list of lines for sign output, return a List of [line, id, group] function! ale#sign#ParseSigns(line_list) abort let l:pattern =ale#sign#ParsePattern() let l:result = [] let l:is_dummy_sign_set = 0 for l:line in a:line_list let l:match = matchlist(l:line, l:pattern) if len(l:match) > 0 if l:match[3] is# 'ALEDummySign' let l:is_dummy_sign_set = 1 else call add(l:result, [ \ str2nr(l:match[1]), \ str2nr(l:match[2]), \ l:match[3], \]) endif endif endfor return [l:is_dummy_sign_set, l:result] endfunction function! ale#sign#FindCurrentSigns(buffer) abort if exists('*sign_getplaced') return ale#sign#ParseSignsWithGetPlaced(a:buffer) else let l:line_list = ale#sign#ReadSigns(a:buffer) return ale#sign#ParseSigns(l:line_list) endif endfunction " Given a loclist, group the List into with one List per line. function! s:GroupLoclistItems(buffer, loclist) abort let l:grouped_items = [] let l:last_lnum = -1 for l:obj in a:loclist if l:obj.bufnr != a:buffer continue endif " Create a new sub-List when we hit a new line. if l:obj.lnum != l:last_lnum call add(l:grouped_items, []) endif call add(l:grouped_items[-1], l:obj) let l:last_lnum = l:obj.lnum endfor return l:grouped_items endfunction function! s:UpdateLineNumbers(buffer, current_sign_list, loclist) abort let l:line_map = {} let l:line_numbers_changed = 0 for [l:line, l:sign_id, l:name] in a:current_sign_list let l:line_map[l:sign_id] = l:line endfor for l:item in a:loclist if l:item.bufnr == a:buffer let l:lnum = get(l:line_map, get(l:item, 'sign_id', 0), 0) if l:lnum && l:item.lnum != l:lnum let l:item.lnum = l:lnum let l:line_numbers_changed = 1 endif endif endfor " When the line numbers change, sort the list again if l:line_numbers_changed call sort(a:loclist, 'ale#util#LocItemCompare') endif endfunction function! s:BuildSignMap(buffer, current_sign_list, grouped_items) abort let l:max_signs = ale#Var(a:buffer, 'max_signs') if l:max_signs is 0 let l:selected_grouped_items = [] elseif type(l:max_signs) is v:t_number && l:max_signs > 0 let l:selected_grouped_items = a:grouped_items[:l:max_signs - 1] else let l:selected_grouped_items = a:grouped_items endif let l:sign_map = {} let l:sign_offset = g:ale_sign_offset for [l:line, l:sign_id, l:name] in a:current_sign_list let l:sign_info = get(l:sign_map, l:line, { \ 'current_id_list': [], \ 'current_name_list': [], \ 'new_id': 0, \ 'new_name': '', \ 'items': [], \}) " Increment the sign offset for new signs, by the maximum sign ID. if l:sign_id > l:sign_offset let l:sign_offset = l:sign_id endif " Remember the sign names and IDs in separate Lists, so they are easy " to work with. call add(l:sign_info.current_id_list, l:sign_id) call add(l:sign_info.current_name_list, l:name) let l:sign_map[l:line] = l:sign_info endfor for l:group in l:selected_grouped_items let l:line = l:group[0].lnum let l:sign_info = get(l:sign_map, l:line, { \ 'current_id_list': [], \ 'current_name_list': [], \ 'new_id': 0, \ 'new_name': '', \ 'items': [], \}) let l:sign_info.new_name = ale#sign#GetSignName(l:group) let l:sign_info.items = l:group let l:index = index( \ l:sign_info.current_name_list, \ l:sign_info.new_name \) if l:index >= 0 " We have a sign with this name already, so use the same ID. let l:sign_info.new_id = l:sign_info.current_id_list[l:index] else " This sign name replaces the previous name, so use a new ID. let l:sign_info.new_id = l:sign_offset + 1 let l:sign_offset += 1 endif let l:sign_map[l:line] = l:sign_info endfor return l:sign_map endfunction function! ale#sign#GetSignCommands(buffer, was_sign_set, sign_map) abort let l:command_list = [] let l:is_dummy_sign_set = a:was_sign_set " Set the dummy sign if we need to. " The dummy sign is needed to keep the sign column open while we add " and remove signs. if !l:is_dummy_sign_set && (!empty(a:sign_map) || g:ale_sign_column_always) call add(l:command_list, 'sign place ' \ . g:ale_sign_offset \ . s:GroupCmd() \ . s:PriorityCmd() \ . ' line=1 name=ALEDummySign ' \ . ' buffer=' . a:buffer \) let l:is_dummy_sign_set = 1 endif " Place new items first. for [l:line_str, l:info] in items(a:sign_map) if l:info.new_id " Save the sign IDs we are setting back on our loclist objects. " These IDs will be used to preserve items which are set many times. for l:item in l:info.items let l:item.sign_id = l:info.new_id endfor if index(l:info.current_id_list, l:info.new_id) < 0 call add(l:command_list, 'sign place ' \ . (l:info.new_id) \ . s:GroupCmd() \ . s:PriorityCmd() \ . ' line=' . l:line_str \ . ' name=' . (l:info.new_name) \ . ' buffer=' . a:buffer \) endif endif endfor " Remove signs without new IDs. for l:info in values(a:sign_map) for l:current_id in l:info.current_id_list if l:current_id isnot l:info.new_id call add(l:command_list, 'sign unplace ' \ . l:current_id \ . s:GroupCmd() \ . ' buffer=' . a:buffer \) endif endfor endfor " Remove the dummy sign to close the sign column if we need to. if l:is_dummy_sign_set && !g:ale_sign_column_always call add(l:command_list, 'sign unplace ' \ . g:ale_sign_offset \ . s:GroupCmd() \ . ' buffer=' . a:buffer \) endif return l:command_list endfunction " This function will set the signs which show up on the left. function! ale#sign#SetSigns(buffer, loclist) abort if !bufexists(str2nr(a:buffer)) " Stop immediately when attempting to set signs for a buffer which " does not exist. return endif " Find the current markers let [l:is_dummy_sign_set, l:current_sign_list] = \ ale#sign#FindCurrentSigns(a:buffer) " Update the line numbers for items from before which may have moved. call s:UpdateLineNumbers(a:buffer, l:current_sign_list, a:loclist) " Group items after updating the line numbers. let l:grouped_items = s:GroupLoclistItems(a:buffer, a:loclist) " Build a map of current and new signs, with the lines as the keys. let l:sign_map = s:BuildSignMap( \ a:buffer, \ l:current_sign_list, \ l:grouped_items, \) let l:command_list = ale#sign#GetSignCommands( \ a:buffer, \ l:is_dummy_sign_set, \ l:sign_map, \) " Change the sign column color if the option is on. if g:ale_change_sign_column_color && !empty(a:loclist) highlight clear SignColumn highlight link SignColumn ALESignColumnWithErrors endif for l:command in l:command_list silent! execute l:command endfor " Reset the sign column color when there are no more errors. if g:ale_change_sign_column_color && empty(a:loclist) highlight clear SignColumn highlight link SignColumn ALESignColumnWithoutErrors endif endfunction " Remove all signs. function! ale#sign#Clear() abort if s:supports_sign_groups sign unplace group=ale_signs * else sign unplace * endif endfunction ale-4.0.0/autoload/ale/socket.vim000066400000000000000000000112121476501472200166370ustar00rootroot00000000000000" Author: w0rp " Description: APIs for working with asynchronous sockets, with an API " normalised between Vim 8 and NeoVim. Socket connections only work in NeoVim " 0.3+, and silently do nothing in earlier NeoVim versions. " " Important functions are described below. They are: " " ale#socket#Open(address, options) -> channel_id (>= 0 if successful) " ale#socket#IsOpen(channel_id) -> 1 if open, 0 otherwise " ale#socket#Close(channel_id) " ale#socket#Send(channel_id, data) " ale#socket#GetAddress(channel_id) -> Return the address for a job let s:channel_map = get(s:, 'channel_map', {}) function! s:VimOutputCallback(channel, data) abort let l:channel_id = ch_info(a:channel).id " Only call the callbacks for jobs which are valid. if l:channel_id >= 0 && has_key(s:channel_map, l:channel_id) call ale#util#GetFunction(s:channel_map[l:channel_id].callback)(l:channel_id, a:data) endif endfunction function! s:NeoVimOutputCallback(channel_id, data, event) abort let l:info = s:channel_map[a:channel_id] if a:event is# 'data' let l:info.last_line = ale#util#JoinNeovimOutput( \ a:channel_id, \ l:info.last_line, \ a:data, \ l:info.mode, \ ale#util#GetFunction(l:info.callback), \) endif endfunction " Open a socket for a given address. The following options are accepted: " " callback - A callback for receiving input. (required) " " A non-negative number representing a channel ID will be returned is the " connection was successful. 0 is a valid channel ID in Vim, so test if the " connection ID is >= 0. function! ale#socket#Open(address, options) abort let l:mode = get(a:options, 'mode', 'raw') let l:Callback = a:options.callback let l:channel_info = { \ 'address': a:address, \ 'mode': l:mode, \ 'callback': a:options.callback, \} if !has('nvim') " Vim let l:channel_options = { \ 'mode': l:mode, \ 'waittime': 0, \ 'callback': function('s:VimOutputCallback'), \} " Use non-blocking writes for Vim versions that support the option. if has('patch-8.1.350') let l:channel_options.noblock = 1 endif let l:channel_info.channel = ch_open(a:address, l:channel_options) let l:vim_info = ch_info(l:channel_info.channel) let l:channel_id = !empty(l:vim_info) ? l:vim_info.id : -1 elseif exists('*chansend') && exists('*sockconnect') " NeoVim 0.3+ try let l:channel_id = sockconnect(stridx(a:address, ':') != -1 ? 'tcp' : 'pipe', \ a:address, {'on_data': function('s:NeoVimOutputCallback')}) let l:channel_info.last_line = '' catch /connection failed/ let l:channel_id = -1 endtry " 0 means the connection failed some times in NeoVim, so make the ID " invalid to match Vim. if l:channel_id is 0 let l:channel_id = -1 endif let l:channel_info.channel = l:channel_id else " Other Vim versions. let l:channel_id = -1 endif if l:channel_id >= 0 let s:channel_map[l:channel_id] = l:channel_info endif return l:channel_id endfunction " Return 1 is a channel is open, 0 otherwise. function! ale#socket#IsOpen(channel_id) abort if !has_key(s:channel_map, a:channel_id) return 0 endif if has('nvim') " In NeoVim, we have to check if this channel is in the global list. return index(map(nvim_list_chans(), 'v:val.id'), a:channel_id) >= 0 endif let l:channel = s:channel_map[a:channel_id].channel return ch_status(l:channel) is# 'open' endfunction " Close a socket, if it's still open. function! ale#socket#Close(channel_id) abort " IsRunning isn't called here, so we don't check nvim_list_chans() if !has_key(s:channel_map, a:channel_id) return 0 endif let l:channel = remove(s:channel_map, a:channel_id).channel if has('nvim') silent! call chanclose(l:channel) elseif ch_status(l:channel) is# 'open' call ch_close(l:channel) endif endfunction " Send some data to a socket. function! ale#socket#Send(channel_id, data) abort if !has_key(s:channel_map, a:channel_id) return endif let l:channel = s:channel_map[a:channel_id].channel if has('nvim') call chansend(l:channel, a:data) else call ch_sendraw(l:channel, a:data) endif endfunction " Get an address for a channel, or an empty string. function! ale#socket#GetAddress(channel_id) abort return get(get(s:channel_map, a:channel_id, {}), 'address', '') endfunction ale-4.0.0/autoload/ale/statusline.vim000066400000000000000000000101121476501472200175400ustar00rootroot00000000000000" Author: KabbAmine " Additions by: petpetpetpet " Description: Statusline related function(s) function! s:CreateCountDict() abort " Keys 0 and 1 are for backwards compatibility. " The count object used to be a List of [error_count, warning_count]. return { \ '0': 0, \ '1': 0, \ 'error': 0, \ 'warning': 0, \ 'info': 0, \ 'style_error': 0, \ 'style_warning': 0, \ 'total': 0, \} endfunction " Update the buffer error/warning count with data from loclist. function! ale#statusline#Update(buffer, loclist) abort if !exists('g:ale_buffer_info') || !has_key(g:ale_buffer_info, a:buffer) return endif let l:loclist = filter(copy(a:loclist), 'v:val.bufnr == a:buffer') let l:count = s:CreateCountDict() let l:count.total = len(l:loclist) " Allows easy access to the first instance of each problem type. let l:first_problems = {} for l:entry in l:loclist if l:entry.type is# 'W' if get(l:entry, 'sub_type', '') is# 'style' let l:count.style_warning += 1 if l:count.style_warning == 1 let l:first_problems.style_warning = l:entry endif else let l:count.warning += 1 if l:count.warning == 1 let l:first_problems.warning = l:entry endif endif elseif l:entry.type is# 'I' let l:count.info += 1 if l:count.info == 1 let l:first_problems.info = l:entry endif elseif get(l:entry, 'sub_type', '') is# 'style' let l:count.style_error += 1 if l:count.style_error == 1 let l:first_problems.style_error = l:entry endif else let l:count.error += 1 if l:count.error == 1 let l:first_problems.error = l:entry endif endif endfor " Set keys for backwards compatibility. let l:count[0] = l:count.error + l:count.style_error let l:count[1] = l:count.total - l:count[0] let g:ale_buffer_info[a:buffer].count = l:count let g:ale_buffer_info[a:buffer].first_problems = l:first_problems endfunction " Get the counts for the buffer, and update the counts if needed. function! s:UpdateCacheIfNecessary(buffer) abort " Cache is cold, so manually ask for an update. if !has_key(g:ale_buffer_info[a:buffer], 'count') call ale#statusline#Update( \ a:buffer, \ g:ale_buffer_info[a:buffer].loclist \) endif endfunction function! s:BufferCacheExists(buffer) abort if !exists('g:ale_buffer_info') || !has_key(g:ale_buffer_info, a:buffer) return 0 endif return 1 endfunction " Get the counts for the buffer, and update the counts if needed. function! s:GetCounts(buffer) abort if !s:BufferCacheExists(a:buffer) return s:CreateCountDict() endif call s:UpdateCacheIfNecessary(a:buffer) return g:ale_buffer_info[a:buffer].count endfunction " Get the dict of first_problems, update the buffer info cache if necessary. function! s:GetFirstProblems(buffer) abort if !s:BufferCacheExists(a:buffer) return {} endif call s:UpdateCacheIfNecessary(a:buffer) return g:ale_buffer_info[a:buffer].first_problems endfunction " Returns a Dictionary with counts for use in third party integrations. function! ale#statusline#Count(buffer) abort " The Dictionary is copied here before exposing it to other plugins. return copy(s:GetCounts(a:buffer)) endfunction " Returns a copy of the *first* locline instance of the specified problem " type. (so this would allow an external integration to know all the info " about the first style warning in the file, for example.) function! ale#statusline#FirstProblem(buffer, type) abort let l:first_problems = s:GetFirstProblems(a:buffer) if !empty(l:first_problems) && has_key(l:first_problems, a:type) return copy(l:first_problems[a:type]) endif return {} endfunction ale-4.0.0/autoload/ale/swift.vim000066400000000000000000000047021476501472200165110ustar00rootroot00000000000000" Author: Dan Loman " Description: Functions for integrating with Swift tools " Find the nearest dir containing a Package.swift file and assume it is the root of the Swift project. function! ale#swift#FindProjectRoot(buffer) abort let l:swift_config = ale#path#FindNearestFile(a:buffer, 'Package.swift') if !empty(l:swift_config) return fnamemodify(l:swift_config, ':h') endif return '' endfunction " Support Apple Swift Format {{{1 call ale#Set('swift_appleswiftformat_executable', 'swift-format') call ale#Set('swift_appleswiftformat_use_swiftpm', 0) " Return the executable depending on whether or not to use Swift Package Manager. " " If not asked to use Swift Package Manager (use_swiftpm = 0), the returned " value is the global executable, else the returned value is 'swift' because " the final command line will be `swift run swift-format ...`. " " Failure is expected if use_swiftpm is `1` but no Package.swift can be located. function! ale#swift#GetAppleSwiftFormatExecutable(buffer) abort if !ale#Var(a:buffer, 'swift_appleswiftformat_use_swiftpm') return ale#Var(a:buffer, 'swift_appleswiftformat_executable') endif if ale#path#FindNearestFile(a:buffer, 'Package.swift') is# '' " If there is no Package.swift file, we don't use swift-format even if it exists, " so we return '' to indicate failure. return '' endif return 'swift' endfunction " Return the command depending on whether or not to use Swift Package Manager. " " If asked to use Swift Package Manager (use_swiftpm = 1), the command " arguments are prefixed with 'swift run'. " " In either case, the configuration file is located and added to the command. function! ale#swift#GetAppleSwiftFormatCommand(buffer) abort let l:executable = ale#swift#GetAppleSwiftFormatExecutable(a:buffer) let l:command_args = '' if ale#Var(a:buffer, 'swift_appleswiftformat_use_swiftpm') let l:command_args = ' ' . 'run swift-format' endif return ale#Escape(l:executable) . l:command_args endfunction " Locate the nearest '.swift-format' configuration file, and return the " arguments, else return an empty string. function! ale#swift#GetAppleSwiftFormatConfigArgs(buffer) abort let l:config_filepath = ale#path#FindNearestFile(a:buffer, '.swift-format') if l:config_filepath isnot# '' return '--configuration' . ' ' . l:config_filepath endif return '' endfunction " }}} ale-4.0.0/autoload/ale/symbol.vim000066400000000000000000000064171476501472200166670ustar00rootroot00000000000000let s:symbol_map = {} " Used to get the symbol map in tests. function! ale#symbol#GetMap() abort return deepcopy(s:symbol_map) endfunction " Used to set the symbol map in tests. function! ale#symbol#SetMap(map) abort let s:symbol_map = a:map endfunction function! ale#symbol#ClearLSPData() abort let s:symbol_map = {} endfunction function! ale#symbol#HandleLSPResponse(conn_id, response) abort if has_key(a:response, 'id') \&& has_key(s:symbol_map, a:response.id) let l:options = remove(s:symbol_map, a:response.id) let l:result = get(a:response, 'result', v:null) let l:item_list = [] if type(l:result) is v:t_list " Each item looks like this: " { " 'name': 'foo', " 'kind': 123, " 'deprecated': v:false, " 'location': { " 'uri': 'file://...', " 'range': { " 'start': {'line': 0, 'character': 0}, " 'end': {'line': 0, 'character': 0}, " }, " }, " 'containerName': 'SomeContainer', " } for l:response_item in l:result let l:location = l:response_item.location call add(l:item_list, { \ 'filename': ale#util#ToResource(l:location.uri), \ 'line': l:location.range.start.line + 1, \ 'column': l:location.range.start.character + 1, \ 'match': l:response_item.name, \}) endfor endif if empty(l:item_list) call ale#util#Execute('echom ''No symbols found.''') else call ale#preview#ShowSelection(l:item_list, l:options) endif endif endfunction function! s:OnReady(query, options, linter, lsp_details) abort let l:id = a:lsp_details.connection_id if !ale#lsp#HasCapability(l:id, 'symbol_search') return endif let l:buffer = a:lsp_details.buffer " If we already made a request, stop here. if getbufvar(l:buffer, 'ale_symbol_request_made', 0) return endif let l:Callback = function('ale#symbol#HandleLSPResponse') call ale#lsp#RegisterCallback(l:id, l:Callback) let l:message = ale#lsp#message#Symbol(a:query) let l:request_id = ale#lsp#Send(l:id, l:message) call setbufvar(l:buffer, 'ale_symbol_request_made', 1) let s:symbol_map[l:request_id] = { \ 'buffer': l:buffer, \ 'use_relative_paths': has_key(a:options, 'use_relative_paths') ? a:options.use_relative_paths : 0 \} endfunction function! ale#symbol#Search(args) abort let [l:opts, l:query] = ale#args#Parse(['relative'], a:args) if empty(l:query) throw 'A non-empty string must be provided!' endif let l:buffer = bufnr('') let l:options = {} if has_key(l:opts, 'relative') let l:options.use_relative_paths = 1 endif " Set a flag so we only make one request. call setbufvar(l:buffer, 'ale_symbol_request_made', 0) let l:Callback = function('s:OnReady', [l:query, l:options]) for l:linter in ale#lsp_linter#GetEnabled(l:buffer) if l:linter.lsp isnot# 'tsserver' call ale#lsp_linter#StartLSP(l:buffer, l:linter, l:Callback) endif endfor endfunction ale-4.0.0/autoload/ale/test.vim000066400000000000000000000146021476501472200163340ustar00rootroot00000000000000" Author: w0rp " Description: Functions for making testing ALE easier. " " This file should not typically be loaded during the normal execution of ALE. " Change the directory for checking things in particular test directories " " This function will set the g:dir variable, which represents the working " directory after changing the path. This variable allows a test to change " directories, and then switch back to a directory at the start of the test " run. " " This function should be run in a Vader Before: block. function! ale#test#SetDirectory(docker_path) abort if a:docker_path[:len('/testplugin/') - 1] isnot# '/testplugin/' throw 'docker_path must start with /testplugin/!' endif " Try to switch directory, which will fail when running tests directly, " and not through the Docker image. silent! execute 'cd ' . fnameescape(a:docker_path) let g:dir = getcwd() " no-custom-checks endfunction " When g:dir is defined, switch back to the directory we saved, and then " delete that variable. " " The filename will be reset to dummy.txt " " This function should be run in a Vader After: block. function! ale#test#RestoreDirectory() abort call ale#test#SetFilename('dummy.txt') silent execute 'cd ' . fnameescape(g:dir) unlet! g:dir endfunction " Get a filename for the current buffer using a relative path to the script. " " If a g:dir variable is set, it will be used as the path to the directory " containing the test file. function! ale#test#GetFilename(path) abort let l:dir = get(g:, 'dir', '') if empty(l:dir) let l:dir = getcwd() " no-custom-checks endif let l:full_path = ale#path#IsAbsolute(a:path) \ ? a:path \ : l:dir . '/' . a:path return ale#path#Simplify(l:full_path) endfunction " Change the filename for the current buffer using a relative path to " the script without running autocmd commands. " " If a g:dir variable is set, it will be used as the path to the directory " containing the test file. function! ale#test#SetFilename(path) abort let l:full_path = ale#test#GetFilename(a:path) silent! noautocmd execute 'file ' . fnameescape(l:full_path) endfunction function! RemoveNewerKeys(results) abort for l:item in a:results if has_key(l:item, 'module') call remove(l:item, 'module') endif if has_key(l:item, 'end_col') call remove(l:item, 'end_col') endif if has_key(l:item, 'end_lnum') call remove(l:item, 'end_lnum') endif endfor endfunction " Return loclist data with only the keys supported by the lowest Vim versions. function! ale#test#GetLoclistWithoutNewerKeys() abort let l:results = getloclist(0) call RemoveNewerKeys(l:results) return l:results endfunction " Return quickfix data with only the keys supported by the lowest Vim versions. function! ale#test#GetQflistWithoutNewerKeys() abort let l:results = getqflist() call RemoveNewerKeys(l:results) return l:results endfunction function! ale#test#GetPreviewWindowText() abort for l:window in range(1, winnr('$')) if getwinvar(l:window, '&previewwindow', 0) let l:buffer = winbufnr(l:window) return getbufline(l:buffer, 1, '$') endif endfor endfunction " This function can be called with a timeout to wait for all jobs to finish. " If the jobs to not finish in the given number of milliseconds, " an exception will be thrown. " " The time taken will be a very rough approximation, and more time may be " permitted than is specified. function! ale#test#WaitForJobs(deadline) abort let l:start_time = ale#events#ClockMilliseconds() if l:start_time == 0 throw 'Failed to read milliseconds from the clock!' endif let l:job_list = [] " Gather all of the jobs from every buffer. for [l:buffer, l:data] in items(ale#command#GetData()) call extend(l:job_list, map(keys(l:data.jobs), 'str2nr(v:val)')) endfor " NeoVim has a built-in API for this, so use that. if has('nvim') let l:nvim_code_list = jobwait(l:job_list, a:deadline) if index(l:nvim_code_list, -1) >= 0 throw 'Jobs did not complete on time!' endif return endif let l:should_wait_more = 1 while l:should_wait_more let l:should_wait_more = 0 for l:job_id in l:job_list if ale#job#IsRunning(l:job_id) let l:now = ale#events#ClockMilliseconds() if l:now - l:start_time > a:deadline " Stop waiting after a timeout, so we don't wait forever. throw 'Jobs did not complete on time!' endif " Wait another 10 milliseconds let l:should_wait_more = 1 sleep 10ms break endif endfor endwhile " Sleep for a small amount of time after all jobs finish. " This seems to be enough to let handlers after jobs end run, and " prevents the occasional failure where this function exits after jobs " end, but before handlers are run. sleep 10ms " We must check the buffer data again to see if new jobs started for " linters with chained commands. let l:has_new_jobs = 0 " Check again to see if any jobs are running. for l:info in values(g:ale_buffer_info) for [l:job_id, l:linter] in get(l:info, 'job_list', []) if ale#job#IsRunning(l:job_id) let l:has_new_jobs = 1 break endif endfor endfor if l:has_new_jobs " We have to wait more. Offset the timeout by the time taken so far. let l:now = ale#events#ClockMilliseconds() let l:new_deadline = a:deadline - (l:now - l:start_time) if l:new_deadline <= 0 " Enough time passed already, so stop immediately. throw 'Jobs did not complete on time!' endif call ale#test#WaitForJobs(l:new_deadline) endif endfunction function! ale#test#FlushJobs() abort " The variable is checked for in a loop, as calling one series of " callbacks can trigger a further series of callbacks. while exists('g:ale_run_synchronously_callbacks') let l:callbacks = g:ale_run_synchronously_callbacks unlet g:ale_run_synchronously_callbacks for l:Callback in l:callbacks call l:Callback() endfor endwhile endfunction ale-4.0.0/autoload/ale/toggle.vim000066400000000000000000000052651476501472200166430ustar00rootroot00000000000000function! s:EnablePreamble() abort " Set pattern options again, if enabled. if get(g:, 'ale_pattern_options_enabled', 0) call ale#pattern_options#SetOptions(bufnr('')) endif " Lint immediately, including running linters against the file. call ale#Queue(0, 'lint_file') endfunction function! s:DisablePostamble() abort " Remove highlights for the current buffer now. if g:ale_set_highlights call ale#highlight#UpdateHighlights() endif if g:ale_virtualtext_cursor isnot# 'disabled' && g:ale_virtualtext_cursor != 0 call ale#virtualtext#Clear(bufnr('')) endif endfunction function! ale#toggle#Toggle() abort let g:ale_enabled = !get(g:, 'ale_enabled') if g:ale_enabled call s:EnablePreamble() if g:ale_set_balloons call ale#balloon#Enable() endif else call ale#engine#CleanupEveryBuffer() call s:DisablePostamble() if exists('*ale#balloon#Disable') call ale#balloon#Disable() endif endif call ale#events#Init() endfunction function! ale#toggle#Enable() abort if !g:ale_enabled call ale#toggle#Toggle() endif endfunction function! ale#toggle#Disable() abort if g:ale_enabled call ale#toggle#Toggle() endif endfunction function! ale#toggle#Reset() abort call ale#engine#CleanupEveryBuffer() call ale#highlight#UpdateHighlights() endfunction function! ale#toggle#ToggleBuffer(buffer) abort " Get the new value for the toggle. let l:enabled = !getbufvar(a:buffer, 'ale_enabled', 1) " Disabling ALE globally removes autocmd events, so we cannot enable " linting locally when linting is disabled globally if l:enabled && !g:ale_enabled " no-custom-checks echom 'ALE cannot be enabled locally when disabled globally' return endif call setbufvar(a:buffer, 'ale_enabled', l:enabled) if l:enabled call s:EnablePreamble() else " Stop all jobs and clear the results for everything, and delete " all of the data we stored for the buffer. call ale#engine#Cleanup(a:buffer) call s:DisablePostamble() endif endfunction function! ale#toggle#EnableBuffer(buffer) abort " ALE is enabled by default for all buffers. if !getbufvar(a:buffer, 'ale_enabled', 1) call ale#toggle#ToggleBuffer(a:buffer) endif endfunction function! ale#toggle#DisableBuffer(buffer) abort if getbufvar(a:buffer, 'ale_enabled', 1) call ale#toggle#ToggleBuffer(a:buffer) endif endfunction function! ale#toggle#ResetBuffer(buffer) abort call ale#engine#Cleanup(a:buffer) call ale#highlight#UpdateHighlights() endfunction ale-4.0.0/autoload/ale/uri.vim000066400000000000000000000016211476501472200161510ustar00rootroot00000000000000function! s:EncodeChar(char) abort let l:result = '' for l:index in range(strlen(a:char)) let l:result .= printf('%%%02x', char2nr(a:char[l:index])) endfor return l:result endfunction function! ale#uri#Encode(value) abort return substitute( \ a:value, \ '\([^a-zA-Z0-9\\/$\-_.!*''(),]\)', \ '\=s:EncodeChar(submatch(1))', \ 'g' \) endfunction function! ale#uri#Decode(value) abort return substitute( \ a:value, \ '%\(\x\x\)', \ '\=printf("%c", str2nr(submatch(1), 16))', \ 'g' \) endfunction let s:uri_handlers = { \ 'jdt': { \ 'OpenURILink': function('ale#uri#jdt#OpenJDTLink'), \ } \} function! ale#uri#GetURIHandler(uri) abort for l:scheme in keys(s:uri_handlers) if a:uri =~# '^'.l:scheme.'://' return s:uri_handlers[scheme] endif endfor return v:null endfunction ale-4.0.0/autoload/ale/uri/000077500000000000000000000000001476501472200154345ustar00rootroot00000000000000ale-4.0.0/autoload/ale/uri/jdt.vim000066400000000000000000000061211476501472200167320ustar00rootroot00000000000000" Author: yoshi1123 " Description: Functions for working with jdt:// URIs. function! s:OpenJDTLink(root, uri, line, column, options, result) abort if has_key(a:result, 'error') " no-custom-checks echoerr a:result.error.message return endif let l:contents = a:result['result'] if type(l:contents) is# type(v:null) " no-custom-checks echoerr 'File content not found' endif " disable autocmd when opening buffer autocmd! AleURISchemes call ale#util#Open(a:uri, a:line, a:column, a:options) autocmd AleURISchemes BufNewFile,BufReadPre jdt://** call ale#uri#jdt#ReadJDTLink(expand('')) if !empty(getbufvar(bufnr(''), 'ale_root', '')) return endif let b:ale_root = a:root set filetype=java call setline(1, split(l:contents, '\n')) call cursor(a:line, a:column) normal! zz setlocal buftype=nofile nomodified nomodifiable readonly endfunction " Load new buffer with jdt:// contents and jump to line and column. function! ale#uri#jdt#OpenJDTLink(encoded_uri, line, column, options, conn_id) abort let l:found_eclipselsp = v:false " We should only arrive here from a 'go to definition' request, so we'll " assume the eclipselsp linter is enabled. for l:linter in ale#linter#Get('java') if l:linter.name is# 'eclipselsp' let l:found_eclipselsp = v:true endif endfor if !l:found_eclipselsp throw 'eclipselsp not running' endif let l:root = a:conn_id[stridx(a:conn_id, ':')+1:] let l:uri = a:encoded_uri call ale#lsp_linter#SendRequest( \ bufnr(''), \ 'eclipselsp', \ [0, 'java/classFileContents', {'uri': ale#util#ToURI(l:uri)}], \ function('s:OpenJDTLink', [l:root, l:uri, a:line, a:column, a:options]) \) endfunction function! s:ReadClassFileContents(uri, result) abort if has_key(a:result, 'error') " no-custom-checks echoerr a:result.error.message return endif let l:contents = a:result['result'] if type(l:contents) is# type(v:null) " no-custom-checks echoerr 'File content not found' endif call setline(1, split(l:contents, '\n')) setlocal buftype=nofile nomodified nomodifiable readonly endfunction " Read jdt:// contents, as part of current project, into current buffer. function! ale#uri#jdt#ReadJDTLink(encoded_uri) abort if !empty(getbufvar(bufnr(''), 'ale_root', '')) return endif let l:linter_map = ale#lsp_linter#GetLSPLinterMap() for [l:conn_id, l:linter] in items(l:linter_map) if l:linter.name is# 'eclipselsp' let l:root = l:conn_id[stridx(l:conn_id, ':')+1:] endif endfor if l:root is# v:null throw 'eclipselsp not running' endif let l:uri = a:encoded_uri let b:ale_root = l:root set filetype=java call ale#lsp_linter#SendRequest( \ bufnr(''), \ 'eclipselsp', \ [0, 'java/classFileContents', {'uri': ale#util#ToURI(l:uri)}], \ function('s:ReadClassFileContents', [l:uri]) \) endfunction ale-4.0.0/autoload/ale/util.vim000066400000000000000000000423141476501472200163330ustar00rootroot00000000000000" Author: w0rp " Description: Contains miscellaneous functions " A wrapper function for mode() so we can test calls for it. function! ale#util#Mode(...) abort return call('mode', a:000) endfunction " A wrapper function for feedkeys so we can test calls for it. function! ale#util#FeedKeys(...) abort return call('feedkeys', a:000) endfunction " Show a message in as small a window as possible. " " Vim 8 does not support echoing long messages from asynchronous callbacks, " but NeoVim does. Small messages can be echoed in Vim 8, and larger messages " have to be shown in preview windows. function! ale#util#ShowMessage(string, ...) abort let l:options = get(a:000, 0, {}) if !has('nvim') call ale#preview#CloseIfTypeMatches('ale-preview.message') endif " We have to assume the user is using a monospace font. if has('nvim') || (a:string !~? "\n" && len(a:string) < &columns) " no-custom-checks echo a:string else call ale#preview#Show(split(a:string, "\n"), extend( \ { \ 'filetype': 'ale-preview.message', \ 'stay_here': 1, \ }, \ l:options, \)) endif endfunction " A wrapper function for execute, so we can test executing some commands. function! ale#util#Execute(expr) abort execute a:expr endfunction if !exists('g:ale#util#nul_file') " A null file for sending output to nothing. let g:ale#util#nul_file = '/dev/null' if has('win32') let g:ale#util#nul_file = 'nul' endif endif " Given a job, a buffered line of data, a list of parts of lines, a mode data " is being read in, and a callback, join the lines of output for a NeoVim job " or socket together, and call the callback with the joined output. " " Note that jobs and IDs are the same thing on NeoVim. function! ale#util#JoinNeovimOutput(job, last_line, data, mode, callback) abort if a:mode is# 'raw' call a:callback(a:job, join(a:data, "\n")) return '' endif let l:lines = a:data[:-2] if len(a:data) > 1 let l:lines[0] = a:last_line . l:lines[0] let l:new_last_line = a:data[-1] else let l:new_last_line = a:last_line . get(a:data, 0, '') endif for l:line in l:lines call a:callback(a:job, l:line) endfor return l:new_last_line endfunction " Return the number of lines for a given buffer. function! ale#util#GetLineCount(buffer) abort return len(getbufline(a:buffer, 1, '$')) endfunction function! ale#util#GetFunction(string_or_ref) abort if type(a:string_or_ref) is v:t_string return function(a:string_or_ref) endif return a:string_or_ref endfunction " Open the file (at the given line). " options['open_in'] can be: " current-buffer (default) " tab " split " vsplit function! ale#util#Open(filename, line, column, options) abort let l:open_in = get(a:options, 'open_in', 'current-buffer') let l:args_to_open = '+' . a:line . ' ' . fnameescape(a:filename) if l:open_in is# 'tab' call ale#util#Execute('tabedit ' . l:args_to_open) elseif l:open_in is# 'split' call ale#util#Execute('split ' . l:args_to_open) elseif l:open_in is# 'vsplit' call ale#util#Execute('vsplit ' . l:args_to_open) elseif bufnr(a:filename) isnot bufnr('') " Open another file only if we need to. call ale#util#Execute('edit ' . l:args_to_open) else normal! m` endif call cursor(a:line, a:column) normal! zz endfunction let g:ale#util#error_priority = 5 let g:ale#util#warning_priority = 4 let g:ale#util#info_priority = 3 let g:ale#util#style_error_priority = 2 let g:ale#util#style_warning_priority = 1 function! ale#util#GetItemPriority(item) abort if a:item.type is# 'I' return g:ale#util#info_priority endif if a:item.type is# 'W' if get(a:item, 'sub_type', '') is# 'style' return g:ale#util#style_warning_priority endif return g:ale#util#warning_priority endif if get(a:item, 'sub_type', '') is# 'style' return g:ale#util#style_error_priority endif return g:ale#util#error_priority endfunction " Compare two loclist items for ALE, sorted by their buffers, filenames, and " line numbers and column numbers. function! ale#util#LocItemCompare(left, right) abort if a:left.bufnr < a:right.bufnr return -1 endif if a:left.bufnr > a:right.bufnr return 1 endif if a:left.bufnr == -1 if a:left.filename < a:right.filename return -1 endif if a:left.filename > a:right.filename return 1 endif endif if a:left.lnum < a:right.lnum return -1 endif if a:left.lnum > a:right.lnum return 1 endif if a:left.col < a:right.col return -1 endif if a:left.col > a:right.col return 1 endif " When either of the items lacks a problem type, then the two items should " be considered equal. This is important for loclist jumping. if !has_key(a:left, 'type') || !has_key(a:right, 'type') return 0 endif let l:left_priority = ale#util#GetItemPriority(a:left) let l:right_priority = ale#util#GetItemPriority(a:right) if l:left_priority < l:right_priority return -1 endif if l:left_priority > l:right_priority return 1 endif return 0 endfunction " Compare two loclist items, including the text for the items. " " This function can be used for de-duplicating lists. function! ale#util#LocItemCompareWithText(left, right) abort let l:cmp_value = ale#util#LocItemCompare(a:left, a:right) if l:cmp_value return l:cmp_value endif if a:left.text < a:right.text return -1 endif if a:left.text > a:right.text return 1 endif return 0 endfunction " This function will perform a binary search and a small sequential search " on the list to find the last problem in the buffer and line which is " on or before the column. The index of the problem will be returned. " " -1 will be returned if nothing can be found. function! ale#util#BinarySearch(loclist, buffer, line, column) abort let l:min = 0 let l:max = len(a:loclist) - 1 while 1 if l:max < l:min return -1 endif let l:mid = (l:min + l:max) / 2 let l:item = a:loclist[l:mid] " Binary search for equal buffers, equal lines, then near columns. if l:item.bufnr < a:buffer let l:min = l:mid + 1 elseif l:item.bufnr > a:buffer let l:max = l:mid - 1 elseif l:item.lnum < a:line let l:min = l:mid + 1 elseif l:item.lnum > a:line let l:max = l:mid - 1 else " This part is a small sequential search. let l:index = l:mid " Search backwards to find the first problem on the line. while l:index > 0 \&& a:loclist[l:index - 1].bufnr == a:buffer \&& a:loclist[l:index - 1].lnum == a:line let l:index -= 1 endwhile " Find the last problem on or before this column. while l:index < l:max \&& a:loclist[l:index + 1].bufnr == a:buffer \&& a:loclist[l:index + 1].lnum == a:line \&& a:loclist[l:index + 1].col <= a:column let l:index += 1 endwhile " Scan forwards to find the last item on the column for the item " we found, which will have the most serious problem. let l:item_column = a:loclist[l:index].col while l:index < l:max \&& a:loclist[l:index + 1].bufnr == a:buffer \&& a:loclist[l:index + 1].lnum == a:line \&& a:loclist[l:index + 1].col == l:item_column let l:index += 1 endwhile return l:index endif endwhile endfunction " A function for testing if a function is running inside a sandbox. " See :help sandbox function! ale#util#InSandbox() abort try let &l:equalprg=&l:equalprg catch /E48/ " E48 is the sandbox error. return 1 endtry return 0 endfunction function! ale#util#Tempname() abort let l:clear_tempdir = 0 if exists('$TMPDIR') && empty($TMPDIR) let l:clear_tempdir = 1 let $TMPDIR = '/tmp' endif try let l:name = tempname() " no-custom-checks finally if l:clear_tempdir let $TMPDIR = '' endif endtry return l:name endfunction " Given a single line, or a List of lines, and a single pattern, or a List " of patterns, return all of the matches for the lines(s) from the given " patterns, using matchlist(). " " Only the first pattern which matches a line will be returned. function! ale#util#GetMatches(lines, patterns) abort let l:matches = [] let l:lines = type(a:lines) is v:t_list ? a:lines : [a:lines] let l:patterns = type(a:patterns) is v:t_list ? a:patterns : [a:patterns] for l:line in l:lines for l:pattern in l:patterns let l:match = matchlist(l:line, l:pattern) if !empty(l:match) call add(l:matches, l:match) break endif endfor endfor return l:matches endfunction " Given a single line, or a List of lines, and a single pattern, or a List of " patterns, and a callback function for mapping the items matches, return the " result of mapping all of the matches for the lines from the given patterns, " using matchlist() " " Only the first pattern which matches a line will be returned. function! ale#util#MapMatches(lines, patterns, Callback) abort return map(ale#util#GetMatches(a:lines, a:patterns), 'a:Callback(v:val)') endfunction function! s:LoadArgCount(function) abort try let l:output = execute('function a:function') catch /E123/ return 0 endtry let l:match = matchstr(split(l:output, "\n")[0], '\v\([^)]+\)')[1:-2] let l:arg_list = filter(split(l:match, ', '), 'v:val isnot# ''...''') return len(l:arg_list) endfunction " Given the name of a function, a Funcref, or a lambda, return the number " of named arguments for a function. function! ale#util#FunctionArgCount(function) abort let l:Function = ale#util#GetFunction(a:function) let l:count = s:LoadArgCount(l:Function) " If we failed to get the count, forcibly load the autoload file, if the " function is an autoload function. autoload functions aren't normally " defined until they are called. if l:count == 0 let l:function_name = matchlist(string(l:Function), 'function([''"]\(.\+\)[''"])')[1] if l:function_name =~# '#' execute 'runtime autoload/' . join(split(l:function_name, '#')[:-2], '/') . '.vim' let l:count = s:LoadArgCount(l:Function) endif endif return l:count endfunction " Escape a string so the characters in it will be safe for use inside of PCRE " or RE2 regular expressions without characters having special meanings. function! ale#util#EscapePCRE(unsafe_string) abort return substitute(a:unsafe_string, '\([\-\[\]{}()*+?.^$|]\)', '\\\1', 'g') endfunction " Escape a string so that it can be used as a literal string inside an evaled " vim command. function! ale#util#EscapeVim(unsafe_string) abort return "'" . substitute(a:unsafe_string, "'", "''", 'g') . "'" endfunction " Given a String or a List of String values, try and decode the string(s) " as a JSON value which can be decoded with json_decode. If the JSON string " is invalid, the default argument value will be returned instead. " " This function is useful in code where the data can't be trusted to be valid " JSON, and where throwing exceptions is mostly just irritating. function! ale#util#FuzzyJSONDecode(data, default) abort if empty(a:data) return a:default endif let l:str = type(a:data) is v:t_string ? a:data : join(a:data, '') try let l:result = json_decode(l:str) " Vim 8 only uses the value v:none for decoding blank strings. if !has('nvim') && l:result is v:none return a:default endif return l:result catch /E474\|E491/ return a:default endtry endfunction " Write a file, including carriage return characters for DOS files. " " The buffer number is required for determining the fileformat setting for " the buffer. function! ale#util#Writefile(buffer, lines, filename) abort let l:corrected_lines = getbufvar(a:buffer, '&fileformat') is# 'dos' \ ? map(copy(a:lines), 'substitute(v:val, ''\r*$'', ''\r'', '''')') \ : a:lines " Set binary flag if buffer doesn't have eol and nofixeol to avoid appending newline let l:flags = !getbufvar(a:buffer, '&eol') && exists('+fixeol') && !&fixeol ? 'bS' : 'S' call writefile(l:corrected_lines, a:filename, l:flags) " no-custom-checks endfunction if !exists('s:patial_timers') let s:partial_timers = {} endif function! s:ApplyPartialTimer(timer_id) abort if has_key(s:partial_timers, a:timer_id) let [l:Callback, l:args] = remove(s:partial_timers, a:timer_id) call call(l:Callback, [a:timer_id] + l:args) endif endfunction " Given a delay, a callback, a List of arguments, start a timer with " timer_start() and call the callback provided with [timer_id] + args. " " The timer must not be stopped with timer_stop(). " Use ale#util#StopPartialTimer() instead, which can stop any timer, and will " clear any arguments saved for executing callbacks later. function! ale#util#StartPartialTimer(delay, callback, args) abort let l:timer_id = timer_start(a:delay, function('s:ApplyPartialTimer')) let s:partial_timers[l:timer_id] = [a:callback, a:args] return l:timer_id endfunction function! ale#util#StopPartialTimer(timer_id) abort call timer_stop(a:timer_id) if has_key(s:partial_timers, a:timer_id) call remove(s:partial_timers, a:timer_id) endif endfunction " Given a possibly multi-byte string and a 1-based character position on a " line, return the 1-based byte position on that line. function! ale#util#Col(str, chr) abort if a:chr < 2 return a:chr endif return strlen(join(split(a:str, '\zs')[0:a:chr - 2], '')) + 1 endfunction function! ale#util#FindItemAtCursor(buffer) abort let l:info = get(g:ale_buffer_info, a:buffer, {}) let l:loclist = get(l:info, 'loclist', []) let l:pos = getpos('.') let l:index = ale#util#BinarySearch(l:loclist, a:buffer, l:pos[1], l:pos[2]) let l:loc = l:index >= 0 ? l:loclist[l:index] : {} return [l:info, l:loc] endfunction function! ale#util#Input(message, value, ...) abort if a:0 > 0 return input(a:message, a:value, a:1) else return input(a:message, a:value) endif endfunction function! ale#util#HasBuflineApi() abort return exists('*deletebufline') && exists('*setbufline') endfunction " Sets buffer contents to lines function! ale#util#SetBufferContents(buffer, lines) abort let l:has_bufline_api = ale#util#HasBuflineApi() if !l:has_bufline_api && a:buffer isnot bufnr('') return endif " If the file is in DOS mode, we have to remove carriage returns from " the ends of lines before calling setline(), or we will see them " twice. let l:new_lines = getbufvar(a:buffer, '&fileformat') is# 'dos' \ ? map(copy(a:lines), 'substitute(v:val, ''\r\+$'', '''', '''')') \ : a:lines let l:first_line_to_remove = len(l:new_lines) + 1 " Use a Vim API for setting lines in other buffers, if available. if l:has_bufline_api if has('nvim') " save and restore signs to avoid flickering let signs = sign_getplaced(a:buffer, {'group': 'ale'})[0].signs call nvim_buf_set_lines(a:buffer, 0, l:first_line_to_remove, 0, l:new_lines) " restore signs (invalid line numbers will be skipped) call sign_placelist(map(signs, {_, v -> extend(v, {'buffer': a:buffer})})) else call setbufline(a:buffer, 1, l:new_lines) endif call deletebufline(a:buffer, l:first_line_to_remove, '$') " Fall back on setting lines the old way, for the current buffer. else let l:old_line_length = line('$') if l:old_line_length >= l:first_line_to_remove let l:save = winsaveview() silent execute \ l:first_line_to_remove . ',' . l:old_line_length . 'd_' call winrestview(l:save) endif call setline(1, l:new_lines) endif return l:new_lines endfunction function! ale#util#GetBufferContents(buffer) abort return join(getbufline(a:buffer, 1, '$'), "\n") . "\n" endfunction function! ale#util#ToURI(resource) abort let l:uri_handler = ale#uri#GetURIHandler(a:resource) if l:uri_handler is# v:null " resource is a filesystem path let l:uri = ale#path#ToFileURI(a:resource) else " resource is a URI let l:uri = a:resource endif return l:uri endfunction function! ale#util#ToResource(uri) abort let l:uri_handler = ale#uri#GetURIHandler(a:uri) if l:uri_handler is# v:null " resource is a filesystem path let l:resource = ale#path#FromFileURI(a:uri) else " resource is a URI let l:resource = a:uri endif return l:resource endfunction ale-4.0.0/autoload/ale/virtualtext.vim000066400000000000000000000221641476501472200177520ustar00rootroot00000000000000scriptencoding utf-8 " Author: w0rp " Author: Luan Santos " Description: Shows lint message for the current line as virtualtext, if any if !hlexists('ALEVirtualTextError') highlight link ALEVirtualTextError Comment endif if !hlexists('ALEVirtualTextStyleError') highlight link ALEVirtualTextStyleError ALEVirtualTextError endif if !hlexists('ALEVirtualTextWarning') highlight link ALEVirtualTextWarning Comment endif if !hlexists('ALEVirtualTextStyleWarning') highlight link ALEVirtualTextStyleWarning ALEVirtualTextWarning endif if !hlexists('ALEVirtualTextInfo') highlight link ALEVirtualTextInfo ALEVirtualTextWarning endif let g:ale_virtualtext_prefix = \ get(g:, 'ale_virtualtext_prefix', '%comment% %type%: ') " Controls the milliseconds delay before showing a message. let g:ale_virtualtext_delay = get(g:, 'ale_virtualtext_delay', 10) " Controls the positioning of virtualtext let g:ale_virtualtext_column = get(g:, 'ale_virtualtext_column', 0) let g:ale_virtualtext_maxcolumn = get(g:, 'ale_virtualtext_maxcolumn', 0) " If 1, only show the first problem with virtualtext. let g:ale_virtualtext_single = get(g:, 'ale_virtualtext_single', 1) let s:cursor_timer = get(s:, 'cursor_timer', -1) let s:last_pos = get(s:, 'last_pos', [0, 0, 0]) let s:hl_list = get(s:, 'hl_list', []) let s:last_message = '' if !has_key(s:, 'has_virt_text') let s:has_virt_text = 0 let s:emulate_virt = 0 let s:last_virt = -1 if has('nvim-0.3.2') let s:ns_id = nvim_create_namespace('ale') let s:has_virt_text = 1 elseif has('textprop') && has('popupwin') let s:has_virt_text = 1 let s:emulate_virt = !has('patch-9.0.0297') if s:emulate_virt call prop_type_add('ale', {}) endif endif endif function! s:StopCursorTimer() abort if s:cursor_timer != -1 call timer_stop(s:cursor_timer) let s:cursor_timer = -1 endif endfunction function! ale#virtualtext#ResetDataForTests() abort let s:last_pos = [0, 0, 0] let s:last_message = '' endfunction function! ale#virtualtext#GetLastMessageForTests() abort return s:last_message endfunction function! ale#virtualtext#GetComment(buffer) abort let l:filetype = getbufvar(a:buffer, '&filetype') let l:split = split(getbufvar(a:buffer, '&commentstring'), '%s') return !empty(l:split) ? trim(l:split[0]) : '#' endfunction function! ale#virtualtext#Clear(buffer) abort if !s:has_virt_text || !bufexists(str2nr(a:buffer)) return endif if has('nvim') call nvim_buf_clear_namespace(a:buffer, s:ns_id, 0, -1) else if s:emulate_virt && s:last_virt != -1 call prop_remove({'type': 'ale'}) call popup_close(s:last_virt) let s:last_virt = -1 elseif !empty(s:hl_list) call prop_remove({ \ 'types': s:hl_list, \ 'all': 1, \ 'bufnr': a:buffer, \}) endif endif endfunction function! ale#virtualtext#GetGroup(item) abort let l:type = get(a:item, 'type', 'E') let l:sub_type = get(a:item, 'sub_type', '') if l:type is# 'E' if l:sub_type is# 'style' return 'ALEVirtualTextStyleError' endif return 'ALEVirtualTextError' endif if l:type is# 'W' if l:sub_type is# 'style' return 'ALEVirtualTextStyleWarning' endif return 'ALEVirtualTextWarning' endif return 'ALEVirtualTextInfo' endfunction function! ale#virtualtext#GetColumnPadding(buffer, line) abort let l:mincol = ale#Var(a:buffer, 'virtualtext_column') let l:maxcol = ale#Var(a:buffer, 'virtualtext_maxcolumn') let l:win = bufwinnr(a:buffer) if l:mincol[len(l:mincol)-1] is# '%' let l:mincol = (winwidth(l:win) * l:mincol) / 100 endif if l:maxcol[len(l:maxcol)-1] is# '%' let l:maxcol = (winwidth(l:win) * l:maxcol) / 100 endif " Calculate padding for virtualtext alignment if l:mincol > 0 || l:maxcol > 0 let l:line_width = strdisplaywidth(getline(a:line)) if l:line_width < l:mincol return l:mincol - l:line_width elseif l:maxcol > 0 && l:line_width >= l:maxcol " Stop processing if virtualtext would start beyond maxcol return -1 endif endif " no padding. return 0 endfunction function! ale#virtualtext#ShowMessage(buffer, item) abort if !s:has_virt_text || !bufexists(str2nr(a:buffer)) return endif let l:line = max([1, a:item.lnum]) let l:hl_group = ale#virtualtext#GetGroup(a:item) " Get a language-appropriate comment character, or default to '#'. let l:comment = ale#virtualtext#GetComment(a:buffer) let l:prefix = ale#Var(a:buffer, 'virtualtext_prefix') let l:prefix = ale#GetLocItemMessage(a:item, l:prefix) let l:prefix = substitute(l:prefix, '\V%comment%', '\=l:comment', 'g') let l:msg = l:prefix . substitute(a:item.text, '\n', ' ', 'g') let l:col_pad = ale#virtualtext#GetColumnPadding(a:buffer, l:line) " Store the last message we're going to set so we can read it in tests. let s:last_message = l:msg " Discard virtualtext if padding is negative. if l:col_pad < 0 return endif if has('nvim') call nvim_buf_set_virtual_text( \ a:buffer, \ s:ns_id, l:line - 1, \ [[l:msg, l:hl_group]], \ {} \) elseif s:emulate_virt let l:left_pad = col('$') call prop_add(l:line, l:left_pad, {'type': 'ale'}) let s:last_virt = popup_create(l:msg, { \ 'line': -1, \ 'padding': [0, 0, 0, 1], \ 'mask': [[1, 1, 1, 1]], \ 'textprop': 'ale', \ 'highlight': l:hl_group, \ 'fixed': 1, \ 'wrap': 0, \ 'zindex': 2 \}) else let l:type = prop_type_get(l:hl_group) if l:type == {} call prop_type_add(l:hl_group, {'highlight': l:hl_group}) endif " Add highlight groups to the list so we can clear them later. if index(s:hl_list, l:hl_group) == -1 call add(s:hl_list, l:hl_group) endif " We ignore all errors from prop_add. silent! call prop_add(l:line, 0, { \ 'type': l:hl_group, \ 'text': ' ' . l:msg, \ 'bufnr': a:buffer, \ 'text_padding_left': l:col_pad, \}) endif endfunction function! ale#virtualtext#ShowCursorWarning(...) abort if g:ale_virtualtext_cursor isnot# 'current' \&& g:ale_virtualtext_cursor != 1 return endif let l:buffer = bufnr('') if mode(1) isnot# 'n' \|| g:ale_use_neovim_diagnostics_api \|| ale#ShouldDoNothing(l:buffer) return endif let [l:info, l:item] = ale#util#FindItemAtCursor(l:buffer) call ale#virtualtext#Clear(l:buffer) if !empty(l:item) call ale#virtualtext#ShowMessage(l:buffer, l:item) endif endfunction function! ale#virtualtext#ShowCursorWarningWithDelay() abort let l:buffer = bufnr('') if g:ale_virtualtext_cursor isnot# 'current' \&& g:ale_virtualtext_cursor != 1 return endif call s:StopCursorTimer() if mode(1) isnot# 'n' \|| g:ale_use_neovim_diagnostics_api return endif let l:pos = getpos('.')[0:2] " Check the current buffer, line, and column number against the last " recorded position. If the position has actually changed, *then* " we should show something. Otherwise we can end up doing processing " the show message far too frequently. if l:pos != s:last_pos let l:delay = ale#Var(l:buffer, 'virtualtext_delay') let s:last_pos = l:pos let s:cursor_timer = timer_start( \ l:delay, \ function('ale#virtualtext#ShowCursorWarning') \) endif endfunction function! ale#virtualtext#CompareSeverityPerLine(left, right) abort " Compare lines if a:left.lnum < a:right.lnum return -1 endif if a:left.lnum > a:right.lnum return 1 endif let l:left_priority = ale#util#GetItemPriority(a:left) let l:right_priority = ale#util#GetItemPriority(a:right) " Put highest priority items first. if l:left_priority > l:right_priority return -1 endif if l:left_priority < l:right_priority return 1 endif " Put the first seen problem first. return a:left.col - a:right.col endfunction function! ale#virtualtext#SetTexts(buffer, loclist) abort if !has('nvim') && s:emulate_virt return endif call ale#virtualtext#Clear(a:buffer) let l:buffer_list = filter(copy(a:loclist), 'v:val.bufnr == a:buffer') if ale#Var(a:buffer,'virtualtext_single') " If we want a single problem per line, sort items on each line by " highest severity and then lowest column position, then de-duplicate " the items by line. call uniq( \ sort(l:buffer_list, function('ale#virtualtext#CompareSeverityPerLine')), \ {a, b -> a.lnum - b.lnum} \) endif for l:item in l:buffer_list call ale#virtualtext#ShowMessage(a:buffer, l:item) endfor endfunction ale-4.0.0/autoload/asyncomplete/000077500000000000000000000000001476501472200165775ustar00rootroot00000000000000ale-4.0.0/autoload/asyncomplete/sources/000077500000000000000000000000001476501472200202625ustar00rootroot00000000000000ale-4.0.0/autoload/asyncomplete/sources/ale.vim000066400000000000000000000016631476501472200215460ustar00rootroot00000000000000function! asyncomplete#sources#ale#get_source_options(...) abort let l:default = extend({ \ 'name': 'ale', \ 'completor': function('asyncomplete#sources#ale#completor'), \ 'whitelist': ['*'], \ 'triggers': asyncomplete#sources#ale#get_triggers(), \ }, a:0 >= 1 ? a:1 : {}) return extend(l:default, {'refresh_pattern': '\k\+$'}) endfunction function! asyncomplete#sources#ale#get_triggers() abort let l:triggers = ale#completion#GetAllTriggers() let l:triggers['*'] = l:triggers[''] return l:triggers endfunction function! asyncomplete#sources#ale#completor(options, context) abort let l:keyword = matchstr(a:context.typed, '\w\+$') let l:startcol = a:context.col - len(l:keyword) call ale#completion#GetCompletions('ale-callback', { 'callback': {completions -> \ asyncomplete#complete(a:options.name, a:context, l:startcol, completions) \ }}) endfunction ale-4.0.0/doc/000077500000000000000000000000001476501472200130315ustar00rootroot00000000000000ale-4.0.0/doc/ale-ada.txt000066400000000000000000000051171476501472200150620ustar00rootroot00000000000000=============================================================================== ALE Ada Integration *ale-ada-options* =============================================================================== cspell *ale-ada-cspell* See |ale-cspell-options| =============================================================================== gcc *ale-ada-gcc* g:ale_ada_gcc_executable *g:ale_ada_gcc_executable* *b:ale_ada_gcc_executable* Type: |String| Default: `'gcc'` This variable can be changed to use a different executable for gcc. g:ale_ada_gcc_options *g:ale_ada_gcc_options* *b:ale_ada_gcc_options* Type: |String| Default: `'-gnatwa -gnatq'` This variable can be set to pass additional options to gcc. =============================================================================== gnatpp *ale-ada-gnatpp* g:ale_ada_gnatpp_options *g:ale_ada_gnatpp_options* *b:ale_ada_gnatpp_options* Type: |String| Default: `''` This variable can be set to pass extra options to the gnatpp fixer. =============================================================================== ada-language-server *ale-ada-language-server* g:ale_ada_adals_executable *g:ale_ada_adals_executable* *b:ale_ada_adals_executable* Type: |String| Default: `'ada_language_server'` This variable can be changed to use a different executable for Ada Language Server. g:ale_ada_adals_project *g:ale_ada_adals_project* *b:ale_ada_adals_project* Type: |String| Default: `'default.gpr'` This variable can be changed to use a different GPR file for Ada Language Server. g:ale_ada_adals_encoding *g:ale_ada_adals_encoding* *b:ale_ada_adals_encoding* Type: |String| Default: `'utf-8'` This variable can be changed to use a different file encoding for Ada Language Server. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-ansible.txt000066400000000000000000000031211476501472200157430ustar00rootroot00000000000000=============================================================================== ALE Ansible Integration *ale-ansible-options* =============================================================================== ansible-language-server *ale-ansible-language-server* g:ale_ansible_language_server_executable *g:ale_ansible_language_server* *b:ale_ansible_language_server* Type: |String| Default: 'ansible-language-server' Variable can be used to modify the executable used for ansible language server. g:ale_ansible_language_server_config *g:ale_ansible_language_server_config* *b:ale_ansible_language_server_config* Type: |Dictionary| Default: '{}' Configuration parameters sent to the language server on start. Refer to the ansible language server configuration documentation for list of available options: https://als.readthedocs.io/en/latest/settings/ =============================================================================== ansible-lint *ale-ansible-ansible-lint* g:ale_ansible_ansible_lint_executable *g:ale_ansible_ansible_lint_executable* *b:ale_ansible_ansible_lint_executable* Type: |String| Default: `'ansible-lint'` This variable can be changed to modify the executable used for ansible-lint. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-apkbuild.txt000066400000000000000000000044501476501472200161270ustar00rootroot00000000000000=============================================================================== ALE APKBUILD Integration *ale-apkbuild-options* =============================================================================== apkbuild-fixer *ale-apkbuild-apkbuild-fixer* g:apkbuild_apkbuild_fixer_options *g:apkbuild_apkbuild_fixer_options* *b:apkbuild_apkbuild_fixer_options* Type: |String| Default: `''` This variable can be set to pass additional options to the apkbuild_fixer fixer. g:apkbuild_apkbuild_fixer_executable *g:apkbuild_apkbuild_fixer_executable* *b:apkbuild_apkbuild_fixer_executable* Type: |String| Default: `'apkbuild-fixer'` This variable can be modified to change the executable path for `apkbuild-fixer`. g:apkbuild_apkbuild_fixer_lint_executable *g:apkbuild_apkbuild_fixer_lint_executable* *b:apkbuild_apkbuild_fixer_lint_executable* Type: |String| Default: `'apkbuild-fixer'` This variable can be modified to change the executable path for `apkbuild-lint`, the binary used to find violations. =============================================================================== apkbuild-lint *ale-apkbuild-apkbuild-lint* g:ale_apkbuild_apkbuild_lint_executable *g:ale_apkbuild_apkbuild_lint_executable* *b:ale_apkbuild_apkbuild_lint_executable* Type: |String| Default: `'apkbuild-lint'` This variable can be set to change the path to apkbuild-lint =============================================================================== secfixes-check *ale-apkbuild-secfixes-check* g:ale_apkbuild_secfixes_check_executable *g:ale_apkbuild_secfixes_check_executable* *b:ale_apkbuild_secfixes_check_executable* Type: |String| Default: `'secfixes-check'` This variable can be set to change the path to secfixes-check =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-asciidoc.txt000066400000000000000000000015211476501472200161060ustar00rootroot00000000000000=============================================================================== ALE AsciiDoc Integration *ale-asciidoc-options* =============================================================================== cspell *ale-asciidoc-cspell* See |ale-cspell-options| =============================================================================== write-good *ale-asciidoc-write-good* See |ale-write-good-options| =============================================================================== textlint *ale-asciidoc-textlint* See |ale-text-textlint| =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-asm.txt000066400000000000000000000032111476501472200151060ustar00rootroot00000000000000=============================================================================== ALE ASM Integration *ale-asm-options* =============================================================================== gcc *ale-asm-gcc* g:ale_asm_gcc_executable *g:ale_asm_gcc_executable* *b:ale_asm_gcc_executable* Type: |String| Default: `'gcc'` This variable can be changed to use a different executable for gcc. g:ale_asm_gcc_options *g:ale_asm_gcc_options* *b:ale_asm_gcc_options* Type: |String| Default: `'-Wall'` This variable can be set to pass additional options to gcc. =============================================================================== llvm_mc *ale-asm-llvm_mc* g:ale_asm_clang_executable *g:ale_asm_llvm_mc_executable* *b:ale_asm_llvm_mc_executable* Type: |String| Default: `'llvm-mc'` This variable can be changed to use a different executable for llvm-mc. g:ale_asm_clang_options *g:ale_asm_llvm_mc_options* *b:ale_asm_llvm_mc_options* Type: |String| Default: `''` This variable can be set to pass additional options to llvm-mc. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-astro.txt000066400000000000000000000013641476501472200154650ustar00rootroot00000000000000=============================================================================== ALE Astro Integration *ale-astro-options* =============================================================================== eslint *ale-astro-eslint* See |ale-javascript-eslint| for information about the available options. =============================================================================== prettier *ale-astro-prettier* See |ale-javascript-prettier| for information about the available options. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-avra.txt000066400000000000000000000017151476501472200152660ustar00rootroot00000000000000=============================================================================== ALE AVRA Integration *ale-avra-options* =============================================================================== avra *ale-avra-avra* g:ale_avra_avra_executable *g:ale_avra_avra_executable* *b:ale_avra_avra_executable* Type: |String| Default `'avra'` This variable can be changed to use different executable for AVRA. g:ale_avra_avra_options *g:ale_avra_avra_options* *b:ale_avra_avra_options* Type: |String| Default: `''` This variable can be set to pass additional options to AVRA. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-awk.txt000066400000000000000000000017131476501472200151150ustar00rootroot00000000000000=============================================================================== ALE Awk Integration *ale-awk-options* =============================================================================== gawk *ale-awk-gawk* g:ale_awk_gawk_executable *g:ale_awk_gawk_executable* *b:ale_awk_gawk_executable* Type: |String| Default: `'gawk'` This variable sets executable used for gawk. g:ale_awk_gawk_options *g:ale_awk_gawk_options* *b:ale_awk_gawk_options* Type: |String| Default: `''` With this variable we are able to pass extra arguments for gawk for invocation. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-bats.txt000066400000000000000000000010441476501472200152610ustar00rootroot00000000000000=============================================================================== ALE Bats Integration *ale-bats-options* =============================================================================== shellcheck *ale-bats-shellcheck* The `shellcheck` linter for Bats uses the sh options for `shellcheck`; see: |ale-sh-shellcheck|. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-bazel.txt000066400000000000000000000021221476501472200154230ustar00rootroot00000000000000=============================================================================== ALE Bazel Integration *ale-bazel-options* =============================================================================== buildifier *ale-bazel-buildifier* g:ale_bazel_buildifier_executable *g:ale_bazel_buildifier_executable* *b:ale_bazel_buildifier_executable* Type: |String| Default: `'buildifier'` See |ale-integrations-local-executables| g:ale_bazel_buildifier_options *g:ale_bazel_buildifier_options* *b:ale_bazel_buildifier_options* Type: |String| Default: `''` This variable can be set to pass extra options to buildifier. g:ale_bazel_buildifier_use_global *g:ale_bazel_buildifier_use_global* *b:ale_bazel_buildifier_use_global* Type: |Number| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| ale-4.0.0/doc/ale-bib.txt000066400000000000000000000012661476501472200150720ustar00rootroot00000000000000=============================================================================== ALE BibTeX Integration *ale-bib-options* =============================================================================== bibclean *ale-bib-bibclean* g:ale_bib_bibclean_executable *g:ale_bib_bibclean_executable* Type: |String| Default: `'bibclean'` g:ale_bib_bibclean_options *g:ale_bib_bibclean_options* Type: |String| Default: `'-align-equals'` =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-bicep.txt000066400000000000000000000031651476501472200154200ustar00rootroot00000000000000=============================================================================== ALE Bicep Integration *ale-bicep-options* =============================================================================== bicep *ale-bicep-bicep* g:ale_bicep_bicep_executable *g:ale_bicep_bicep_executable* *b:ale_bicep_bicep_executable* Type: |String| Default: `'bicep'` This variable can be set to change the path to bicep. g:ale_bicep_bicep_options *g:ale_bicep_bicep_options* *b:ale_bicep_bicep_options* Type: |String| Default: `''` This variable can be set to pass additional options to bicep. =============================================================================== az_bicep *ale-bicep-az_bicep* g:ale_bicep_az_bicep_executable *g:ale_bicep_az_bicep_executable* *b:ale_bicep_az_bicep_executable* Type: |String| Default: `'az'` This variable can be set to change the path to az_bicep. g:ale_bicep_az_bicep_options *g:ale_bicep_az_bicep_options* *b:ale_bicep_az_bicep_options* Type: |String| Default: `''` This variable can be set to pass additional options to az_bicep. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-bitbake.txt000066400000000000000000000017721476501472200157410ustar00rootroot00000000000000=============================================================================== ALE BitBake Integration *ale-bitbake-options* =============================================================================== oelint-adv *ale-bitbake-oelint_adv* g:ale_bitbake_oelint_adv_executable *g:ale_bitbake_oelint_adv_executable* Type: |String| Default: `'oelint-adv'` This variable can be changed to use a different executable for oelint-adv. g:ale_bitbake_oelint_adv_options *g:ale_bitbake_oelint_adv_options* Type: |String| Default: `''` This variable can be set to pass additional options to oelint-adv. g:ale_bitbake_oelint_adv_config *g:ale_bitbake_oelint_adv_config* Type: |String| Default: `'.oelint.cfg'` This variable can be set to use a different config file. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-c.txt000066400000000000000000000445641476501472200145700ustar00rootroot00000000000000=============================================================================== ALE C Integration *ale-c-options* For basic checking of problems with C files, ALE offers the `cc` linter, which runs either `clang`, or `gcc`. See |ale-c-cc|. =============================================================================== Global Options g:ale_c_always_make *g:ale_c_always_make* *b:ale_c_always_make* Type: |Number| Default: `has('unix') && !has('macunix')` If set to `1`, use `--always-make` for `make`, which means that output will always be parsed from `make` dry runs with GNU make. BSD `make` does not support this option, so you probably want to turn this option off when using a BSD variant. g:ale_c_build_dir_names *g:ale_c_build_dir_names* *b:ale_c_build_dir_names* Type: |List| Default: `['build', 'bin']` A list of directory names to be used when searching upwards from C files to discover compilation databases with. For directory named `'foo'`, ALE will search for `'foo/compile_commands.json'` in all directories on and above the directory containing the C file to find path to compilation database. This feature is useful for the clang tools wrapped around LibTooling (namely here, clang-tidy) g:ale_c_build_dir *g:ale_c_build_dir* *b:ale_c_build_dir* Type: |String| Default: `''` For programs that can read `compile_commands.json` files, this option can be set to the directory containing the file for the project. ALE will try to determine the location of `compile_commands.json` automatically, but if your file exists in some other directory, you can set this option so ALE will know where it is. This directory will be searched instead of |g:ale_c_build_dir_names|. g:ale_c_parse_compile_commands *g:ale_c_parse_compile_commands* *b:ale_c_parse_compile_commands* Type: |Number| Default: `1` If set to `1`, ALE will parse `compile_commands.json` files to automatically determine flags for C or C++ compilers. ALE will first search for the nearest `compile_commands.json` file, and then look for `compile_commands.json` files in the directories for |g:ale_c_build_dir_names|. g:ale_c_parse_makefile *g:ale_c_parse_makefile* *b:ale_c_parse_makefile* Type: |Number| Default: `0` If set to `1`, ALE will run `make -n` to automatically determine flags to set for C or C++ compilers. This can make it easier to determine the correct build flags to use for different files. NOTE: When using this option on BSD, you may need to set |g:ale_c_always_make| to `0`, and `make -n` will not provide consistent results if binaries have already been built, so use `make clean` when editing your files. WARNING: Running `make -n` automatically can execute arbitrary code, even though it's supposed to be a dry run, so enable this option with care. You might prefer to use the buffer-local version of the option instead with |g:ale_pattern_options|, or you own code for checking which project you're in. You might want to disable this option if `make -n` takes too long to run for projects you work on. If |g:ale_c_parse_compile_commands| or |b:ale_c_parse_compile_commands| is set to `1`, flags taken from `compile_commands.json` will be preferred over `make -n` output. =============================================================================== astyle *ale-c-astyle* g:ale_c_astyle_executable *g:ale_c_astyle_executable* *b:ale_c_astyle_executable* Type: |String| Default: `'astyle'` This variable can be changed to use a different executable for astyle. g:ale_c_astyle_project_options *g:ale_c_astyle_project_options* *b:ale_c_astyle_project_options* Type: |String| Default: `''` This variable can be changed to use an option file for project level configurations. Provide only the filename of the option file that should be present at the project's root directory. For example, if .astylrc is specified, the file is searched in the parent directories of the source file's directory. =============================================================================== cc *ale-c-cc* *ale-c-gcc* *ale-c-clang* g:ale_c_cc_executable *g:ale_c_cc_executable* *b:ale_c_cc_executable* Type: |String| Default: `''` This variable can be changed to use a different executable for a C compiler. ALE will try to use `clang` if Clang is available, otherwise ALE will default to checking C code with `gcc`. g:ale_c_cc_options *g:ale_c_cc_options* *b:ale_c_cc_options* Type: |String| Default: `'-std=c11 -Wall'` This variable can be changed to modify flags given to the C compiler. g:ale_c_cc_use_header_lang_flag *g:ale_c_cc_use_header_lang_flag* *b:ale_c_cc_use_header_lang_flag* Type: |Number| Default: `-1` By default, ALE will use `'-x c-header'` instead of `'-x c'` for header files when using Clang. This variable can be changed to manually activate or deactivate this flag for header files. - When set to `-1`, the default beviour is used, `'-x c-header'` is used with Clang and `'-x c'` is used with other compilers. - When set to `0`, the flag is deactivated, `'-x c'` is always used independently of the compiler. - When set to `1`, the flag is activated, `'-x c-header'` is always used independently of the compiler. Gcc does not support `'-x c-header'` when using `'-'` as input filename, which is what ALE does. This why, by default, ALE only uses `'-x c-header'` with Clang. g:ale_c_cc_header_exts *g:ale_c_cc_header_exts* *b:ale_c_cc_header_exts* Type: |List| Default: `['h']` This variable can be changed to modify the list of extensions of the files considered as header files. This variable is only used when `'-x c-header'` is used instead of `'-x c'`, see |g:ale_c_cc_use_header_lang_flag|. =============================================================================== ccls *ale-c-ccls* g:ale_c_ccls_executable *g:ale_c_ccls_executable* *b:ale_c_ccls_executable* Type: |String| Default: `'ccls'` This variable can be changed to use a different executable for ccls. g:ale_c_ccls_init_options *g:ale_c_ccls_init_options* *b:ale_c_ccls_init_options* Type: |Dictionary| Default: `{}` This variable can be changed to customize ccls initialization options. Example: > { \ 'cacheDirectory': '/tmp/ccls', \ 'cacheFormat': 'binary', \ 'diagnostics': { \ 'onOpen': 0, \ 'opChange': 1000, \ }, \ } < For all available options and explanations, visit https://github.com/MaskRay/ccls/wiki/Customization#initialization-options. =============================================================================== clangcheck *ale-c-clangcheck* `clang-check` will be run only when files are saved to disk, so that `compile_commands.json` files can be used. It is recommended to use this linter in combination with `compile_commands.json` files. Therefore, `clang-check` linter reads the options |g:ale_c_build_dir| and |g:ale_c_build_dir_names|. Also, setting |g:ale_c_build_dir| actually overrides |g:ale_c_build_dir_names|. g:ale_c_clangcheck_executable *g:ale_c_clangcheck_executable* *b:ale_c_clangcheck_executable* Type: |String| Default: `'clang-check'` This variable can be changed to use a different executable for clangcheck. g:ale_c_clangcheck_options *g:ale_c_clangcheck_options* *b:ale_c_clangcheck_options* Type: |String| Default: `''` This variable can be changed to modify flags given to clang-check. This variable should not be set to point to build subdirectory with `-p path/to/build` option, as it is handled by the |g:ale_c_build_dir| option. =============================================================================== clangd *ale-c-clangd* g:ale_c_clangd_executable *g:ale_c_clangd_executable* *b:ale_c_clangd_executable* Type: |String| Default: `'clangd'` This variable can be changed to use a different executable for clangd. g:ale_c_clangd_options *g:ale_c_clangd_options* *b:ale_c_clangd_options* Type: |String| Default: `''` This variable can be changed to modify flags given to clangd. =============================================================================== clang-format *ale-c-clangformat* g:ale_c_clangformat_executable *g:ale_c_clangformat_executable* *b:ale_c_clangformat_executable* Type: |String| Default: `'clang-format'` This variable can be changed to use a different executable for clang-format. g:ale_c_clangformat_options *g:ale_c_clangformat_options* *b:ale_c_clangformat_options* Type: |String| Default: `''` This variable can be changed to modify flags given to clang-format. g:ale_c_clangformat_style_option *g:ale_c_clangformat_style_option* *b:ale_c_clangformat_style_option* Type: |String| Default: `''` This variable can be changed to modify only the style flag given to clang-format. The contents of the variable are passed directly to the -style flag of clang-format. Example: > { \ BasedOnStyle: Microsoft, \ ColumnLimit: 80, \ AllowShortBlocksOnASingleLine: Always, \ AllowShortFunctionsOnASingleLine: Inline, \ } < If you set this variable, ensure you don't modify -style in |g:ale_c_clangformat_options|, as this will cause clang-format to error. g:ale_c_clangformat_use_local_file *g:ale_c_clangformat_use_local_file* *b:ale_c_clangformat_use_local_file* Type: |Number| Default: `0` This variable can be changed to modify whether to use a local .clang-format file. If the file is found, the flag '-style=file' is passed to clang-format and any options configured via |g:ale_c_clangformat_style_option| are not passed. If this option is enabled but no .clang-format file is found, default back to |g:ale_c_clangformat_style_option|, if it set. If you set this variable, ensure you don't modify -style in |g:ale_c_clangformat_options|, as this will cause clang-format to error. =============================================================================== clangtidy *ale-c-clangtidy* `clang-tidy` will be run only when files are saved to disk, so that `compile_commands.json` files can be used. It is recommended to use this linter in combination with `compile_commands.json` files. Therefore, `clang-tidy` linter reads the options |g:ale_c_build_dir| and |g:ale_c_build_dir_names|. Also, setting |g:ale_c_build_dir| actually overrides |g:ale_c_build_dir_names|. g:ale_c_clangtidy_checks *g:ale_c_clangtidy_checks* *b:ale_c_clangtidy_checks* Type: |List| Default: `[]` The checks to enable for clang-tidy with the `-checks` argument. All options will be joined with commas, and escaped appropriately for the shell. The `-checks` flag can be removed entirely by setting this option to an empty List. Not all of clangtidy checks are applicable for C. You should consult the clang documentation for an up-to-date list of compatible checks: http://clang.llvm.org/extra/clang-tidy/checks/list.html g:ale_c_clangtidy_executable *g:ale_c_clangtidy_executable* *b:ale_c_clangtidy_executable* Type: |String| Default: `'clang-tidy'` This variable can be changed to use a different executable for clangtidy. g:ale_c_clangtidy_options *g:ale_c_clangtidy_options* *b:ale_c_clangtidy_options* Type: |String| Default: `''` This variable can be changed to modify compiler flags given to clang-tidy. - Setting this variable to a non-empty string, - and working in a buffer where no compilation database is found using |g:ale_c_build_dir_names| or |g:ale_c_build_dir|, will cause the `--` argument to be passed to `clang-tidy`, which will mean that detection of `compile_commands.json` files for compile command databases will be disabled. Only set this option if you want to control compiler flags entirely manually, and no `compile_commands.json` file is in one of the |g:ale_c_build_dir_names| directories of the project tree. g:ale_c_clangtidy_extra_options *g:ale_c_clangtidy_extra_options* *b:ale_c_clangtidy_extra_options* Type: |String| Default: `''` This variable can be changed to modify flags given to clang-tidy. g:ale_c_clangtidy_fix_errors *g:ale_c_clangtidy_fix_errors* *b:ale_c_clangtidy_fix_errors* Type: |Number| Default: `1` This variable can be changed to disable the `-fix-errors` option for the |clangtidy| fixer. =============================================================================== cppcheck *ale-c-cppcheck* g:ale_c_cppcheck_executable *g:ale_c_cppcheck_executable* *b:ale_c_cppcheck_executable* Type: |String| Default: `'cppcheck'` This variable can be changed to use a different executable for cppcheck. g:ale_c_cppcheck_options *g:ale_c_cppcheck_options* *b:ale_c_cppcheck_options* Type: |String| Default: `'--enable=style'` This variable can be changed to modify flags given to cppcheck. =============================================================================== cquery *ale-c-cquery* g:ale_c_cquery_executable *g:ale_c_cquery_executable* *b:ale_c_cquery_executable* Type: |String| Default: `'cquery'` This variable can be changed to use a different executable for cquery. g:ale_c_cquery_cache_directory *g:ale_c_cquery_cache_directory* *b:ale_c_cquery_cache_directory* Type: |String| Default: `'~/.cache/cquery'` This variable can be changed to decide which directory cquery uses for its cache. =============================================================================== cspell *ale-c-cspell* See |ale-cspell-options| =============================================================================== flawfinder *ale-c-flawfinder* g:ale_c_flawfinder_executable *g:ale_c_flawfinder_executable* *b:ale_c_flawfinder_executable* Type: |String| Default: `'flawfinder'` This variable can be changed to use a different executable for flawfinder. g:ale_c_flawfinder_minlevel *g:ale_c_flawfinder_minlevel* *b:ale_c_flawfinder_minlevel* Type: |Number| Default: `1` This variable can be changed to ignore risks under the given risk threshold. g:ale_c_flawfinder_options *g:ale-c-flawfinder* *b:ale-c-flawfinder* Type: |String| Default: `''` This variable can be used to pass extra options into the flawfinder command. g:ale_c_flawfinder_error_severity *g:ale_c_flawfinder_error_severity* *b:ale_c_flawfinder_error_severity* Type: |Number| Default: `6` This variable can be changed to set the minimum severity to be treated as an error. This setting also applies to flawfinder for c++. =============================================================================== uncrustify *ale-c-uncrustify* g:ale_c_uncrustify_executable *g:ale_c_uncrustify_executable* *b:ale_c_uncrustify_executable* Type: |String| Default: `'uncrustify'` This variable can be changed to use a different executable for uncrustify. g:ale_c_uncrustify_options *g:ale_c_uncrustify_options* *b:ale_c_uncrustify_options* Type: |String| Default: `''` This variable can be change to modify flags given to uncrustify. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-c3.txt000066400000000000000000000025011476501472200146340ustar00rootroot00000000000000=============================================================================== ALE C3 Integration *ale-c3-options* =============================================================================== c3lsp *ale-c3-c3lsp* g:ale_c3_c3lsp_executable *g:ale_c3_c3lsp_executable* *b:ale_c3_c3lsp_executable* Type: |String| Default: `c3lsp` This variable can be changed to set the path to c3lsp executable. g:ale_c3_c3lsp_options *g:ale_c3_c3lsp_options* *b:ale_c3_c3lsp_options* Type: |String| Default: `''` Add command line options to the c3lsp executable. This is useful to specify the path to the C3 standard library with '-stdlib-path='. g:ale_c3_c3lsp_init_options *g:ale_c3_c3lsp_init_options* *b:ale_c3_c3lsp_init_options* Type: |Dictionary| Default: `{}` Dictionary containing configuration settings that will be passed to the language server. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-cairo.txt000066400000000000000000000022561476501472200154330ustar00rootroot00000000000000=============================================================================== ALE Cairo Integration *ale-cairo-options* =============================================================================== scarb *ale-cairo-scarb* g:ale_cairo_scarb_executable *g:ale_cairo_scarb_executable* *b:ale_cairo_scarb_executable* Default: `'scarb build'` For Cairo1 projects using Scarb For more information read 'https://docs.swmansion.com/scarb/' =============================================================================== starknet *ale-cairo-starknet* g:ale_cairo_starknet_executable *g:ale_cairo_starknet_executable* *b:ale_cairo_starknet_executable* Default: `'starknet-compile'` Overrides the starknet-compile binary after installing the cairo-language. For more information read 'https://starknet.io/docs/quickstart.html' =============================================================================== ale-4.0.0/doc/ale-chef.txt000066400000000000000000000034331476501472200152410ustar00rootroot00000000000000=============================================================================== ALE Chef Integration *ale-chef-options* =============================================================================== cookstyle *ale-chef-cookstyle* g:ale_chef_cookstyle_options *g:ale_chef_cookstyle_options* *b:ale_chef_cookstyle_options* Type: |String| Default: `''` This variable can be changed to modify flags given to cookstyle. g:ale_chef_cookstyle_executable *g:ale_chef_cookstyle_executable* *b:ale_chef_cookstyle_executable* Type: |String| Default: `'cookstyle'` This variable can be changed to point to the cookstyle binary in case it's not on the $PATH or a specific version/path must be used. =============================================================================== foodcritic *ale-chef-foodcritic* g:ale_chef_foodcritic_options *g:ale_chef_foodcritic_options* *b:ale_chef_foodcritic_options* Type: |String| Default: `''` This variable can be changed to modify flags given to foodcritic. g:ale_chef_foodcritic_executable *g:ale_chef_foodcritic_executable* *b:ale_chef_foodcritic_executable* Type: |String| Default: `'foodcritic'` This variable can be changed to point to the foodcritic binary in case it's not on the $PATH or a specific version/path must be used. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-clojure.txt000066400000000000000000000036321476501472200160000ustar00rootroot00000000000000=============================================================================== ALE Clojure Integration *ale-clojure-options* =============================================================================== clj-kondo *ale-clojure-clj-kondo* A minimal and opinionated linter for code that sparks joy. https://github.com/borkdude/clj-kondo g:ale_clojure_clj_kondo_options *g:ale_clojure_clj_kondo_options* *b:ale_clojure_clj_kondo_options* Type: |String| Default: `'--cache'` This variable can be changed to modify options passed to clj-kondo. =============================================================================== cljfmt *ale-clojure-cljfmt* cljfmt is a linter and fixer for Clojure code, with defaults adhering to the Clojure Style Guide (see https://guide.clojure.style/ ) https://github.com/weavejester/cljfmt Linting options are not configurable by ale, but instead are controlled by Leiningen, or a cljfmt file in the current or parent directories. see https://github.com/weavejester/cljfmt#Configuration for more information. =============================================================================== joker *ale-clojure-joker* Joker is a small Clojure interpreter and linter written in Go. https://github.com/candid82/joker Linting options are not configurable by ale, but instead are controlled by a `.joker` file in same directory as the file (or current working directory if linting stdin), a parent directory relative to the file, or the users home directory. see https://github.com/candid82/joker#linter-mode for more information. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-cloudformation.txt000066400000000000000000000026051476501472200173610ustar00rootroot00000000000000=============================================================================== ALE CloudFormation Integration *ale-cloudformation-options* =============================================================================== cfn-python-lint *ale-cloudformation-cfn-python-lint* cfn-python-lint is a linter for AWS CloudFormation template file. Website: https://github.com/awslabs/cfn-python-lint Installation ------------------------------------------------------------------------------- Install cfn-python-lint using either pip or brew: > `pip install cfn-lint`. If pip is not available, run `python setup.py clean --all` then `python setup.py install`. Homebrew (macOS): `brew install cfn-lint` < Configuration ------------------------------------------------------------------------------- To get cloudformation linter to work on only CloudFormation files we must set the buffer |filetype| to yaml.cloudformation. This causes ALE to lint the file with linters configured for cloudformation and yaml files. Just put: > au BufRead,BufNewFile *.template.yaml set filetype=yaml.cloudformation < on `ftdetect/cloudformation.vim` This will get both cloudformation and yaml linters to work on any file with `.template.yaml` ext. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-cmake.txt000066400000000000000000000045041476501472200154140ustar00rootroot00000000000000=============================================================================== ALE CMake Integration *ale-cmake-options* =============================================================================== cmakelint *ale-cmake-cmakelint* g:ale_cmake_cmakelint_executable *g:ale_cmake_cmakelint_executable* *b:ale_cmake_cmakelint_executable* Type: |String| Default: `'cmakelint'` This variable can be set to change the path the cmakelint. g:ale_cmake_cmakelint_options *g:ale_cmake_cmakelint_options* *b:ale_cmake_cmakelint_options* Type: |String| Default: `''` This variable can be set to pass additional options to cmakelint. =============================================================================== cmake-lint *ale-cmake-cmake-lint* g:ale_cmake_cmake_lint_executable *g:ale_cmake_cmake_lint_executable* *b:ale_cmake_cmake_lint_executable* Type: |String| Default: `'cmake-lint'` This variable can be set to change the path the cmake-lint. g:ale_cmake_cmake_lint_options *g:ale_cmake_cmake_lint_options* *b:ale_cmake_cmake_lint_options* Type: |String| Default: `''` This variable can be set to pass additional options to cmake-lint. =============================================================================== cmake-format *ale-cmake-cmakeformat* g:ale_cmake_cmakeformat_executable *g:ale_cmake_cmakeformat_executable* *b:ale_cmake_cmakeformat_executable* Type: |String| Default: `'cmakeformat'` This variable can be set to change the path the cmake-format. g:ale_cmake_cmakeformat_options *g:ale_cmake_cmakeformat_options* *b:ale_cmake_cmakeformat_options* Type: |String| Default: `''` This variable can be set to pass additional options to cmake-format. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-cpp.txt000066400000000000000000000354361476501472200151260ustar00rootroot00000000000000=============================================================================== ALE C++ Integration *ale-cpp-options* For basic checking of problems with C++ files, ALE offers the `cc` linter, which runs either `clang++`, or `gcc`. See |ale-cpp-cc|. =============================================================================== Global Options The following C options also apply to some C++ linters too. * |g:ale_c_always_make| * |g:ale_c_build_dir_names| * |g:ale_c_build_dir| * |g:ale_c_parse_makefile| * |g:ale_c_parse_compile_commands| =============================================================================== astyle *ale-cpp-astyle* g:ale_cpp_astyle_executable *g:ale_cpp_astyle_executable* *b:ale_cpp_astyle_executable* Type: |String| Default: `'astyle'` This variable can be changed to use a different executable for astyle. g:ale_cpp_astyle_project_options *g:ale_cpp_astyle_project_options* *b:ale_cpp_astyle_project_options* Type: |String| Default: `''` This variable can be changed to use an option file for project level configurations. Provide only the filename of the option file that should be present at the project's root directory. For example, if .astylrc is specified, the file is searched in the parent directories of the source file's directory. =============================================================================== cc *ale-cpp-cc* *ale-cpp-gcc* *ale-cpp-clang* g:ale_cpp_cc_executable *g:ale_cpp_cc_executable* *b:ale_cpp_cc_executable* Type: |String| Default: `''` This variable can be changed to use a different executable for a C++ compiler. ALE will try to use `clang++` if Clang is available, otherwise ALE will default to checking C++ code with `gcc`. g:ale_cpp_cc_options *g:ale_cpp_cc_options* *b:ale_cpp_cc_options* Type: |String| Default: `'-std=c++14 -Wall'` This variable can be changed to modify flags given to the C++ compiler. g:ale_cpp_cc_use_header_lang_flag *g:ale_cpp_cc_use_header_lang_flag* *b:ale_cpp_cc_use_header_lang_flag* Type: |Number| Default: `-1` By default, ALE will use `'-x c++-header'` instead of `'-x c++'` for header files when using Clang. This variable can be changed to manually activate or deactivate this flag for header files. - When set to `-1`, the default beviour is used, `'-x c++-header'` is used with Clang and `'-x c++'` is used with other compilers. - When set to `0`, the flag is deactivated, `'-x c++'` is always used independently of the compiler. - When set to `1`, the flag is activated, `'-x c++-header'` is always used independently of the compiler. Gcc does not support `'-x c++-header'` when using `'-'` as input filename, which is what ALE does. This why, by default, ALE only uses `'-x c++-header'` with Clang. g:ale_cpp_cc_header_exts *g:ale_cpp_cc_header_exts* *b:ale_cpp_cc_header_exts* Type: |List| Default: `['h', 'hpp']` This variable can be changed to modify the list of extensions of the files considered as header files. This variable is only used when `'-x c++-header'` is used instead of `'-x c++'`, see |g:ale_cpp_cc_use_header_lang_flag|. =============================================================================== ccls *ale-cpp-ccls* g:ale_cpp_ccls_executable *g:ale_cpp_ccls_executable* *b:ale_cpp_ccls_executable* Type: |String| Default: `'ccls'` This variable can be changed to use a different executable for ccls. g:ale_cpp_ccls_init_options *g:ale_cpp_ccls_init_options* *b:ale_cpp_ccls_init_options* Type: |Dictionary| Default: `{}` This variable can be changed to customize ccls initialization options. Example: > { \ 'cacheDirectory': '/tmp/ccls', \ 'cacheFormat': 'binary', \ 'diagnostics': { \ 'onOpen': 0, \ 'opChange': 1000, \ }, \ } < Visit https://github.com/MaskRay/ccls/wiki/Initialization-options for all available options and explanations. =============================================================================== clangcheck *ale-cpp-clangcheck* `clang-check` will be run only when files are saved to disk, so that `compile_commands.json` files can be used. It is recommended to use this linter in combination with `compile_commands.json` files. Therefore, `clang-check` linter reads the options |g:ale_c_build_dir| and |g:ale_c_build_dir_names|. Also, setting |g:ale_c_build_dir| actually overrides |g:ale_c_build_dir_names|. g:ale_cpp_clangcheck_executable *g:ale_cpp_clangcheck_executable* *b:ale_cpp_clangcheck_executable* Type: |String| Default: `'clang-check'` This variable can be changed to use a different executable for clangcheck. g:ale_cpp_clangcheck_options *g:ale_cpp_clangcheck_options* *b:ale_cpp_clangcheck_options* Type: |String| Default: `''` This variable can be changed to modify flags given to clang-check. This variable should not be set to point to build subdirectory with `-p path/to/build` option, as it is handled by the |g:ale_c_build_dir| option. =============================================================================== clangd *ale-cpp-clangd* g:ale_cpp_clangd_executable *g:ale_cpp_clangd_executable* *b:ale_cpp_clangd_executable* Type: |String| Default: `'clangd'` This variable can be changed to use a different executable for clangd. g:ale_cpp_clangd_options *g:ale_cpp_clangd_options* *b:ale_cpp_clangd_options* Type: |String| Default: `''` This variable can be changed to modify flags given to clangd. =============================================================================== clang-format *ale-cpp-clangformat* See |ale-c-clangformat| for information about the available options. Note that the C options are also used for C++. =============================================================================== clangtidy *ale-cpp-clangtidy* `clang-tidy` will be run only when files are saved to disk, so that `compile_commands.json` files can be used. It is recommended to use this linter in combination with `compile_commands.json` files. Therefore, `clang-tidy` linter reads the options |g:ale_c_build_dir| and |g:ale_c_build_dir_names|. Also, setting |g:ale_c_build_dir| actually overrides |g:ale_c_build_dir_names|. g:ale_cpp_clangtidy_checks *g:ale_cpp_clangtidy_checks* *b:ale_cpp_clangtidy_checks* Type: |List| Default: `[]` The checks to enable for clang-tidy with the `-checks` argument. All options will be joined with commas, and escaped appropriately for the shell. The `-checks` flag can be removed entirely by setting this option to an empty List. g:ale_cpp_clangtidy_executable *g:ale_cpp_clangtidy_executable* *b:ale_cpp_clangtidy_executable* Type: |String| Default: `'clang-tidy'` This variable can be changed to use a different executable for clangtidy. g:ale_cpp_clangtidy_options *g:ale_cpp_clangtidy_options* *b:ale_cpp_clangtidy_options* Type: |String| Default: `''` This variable can be changed to modify compiler flags given to clang-tidy. - Setting this variable to a non-empty string, - and working in a buffer where no compilation database is found using |g:ale_c_build_dir_names| or |g:ale_c_build_dir|, will cause the `--` argument to be passed to `clang-tidy`, which will mean that detection of `compile_commands.json` files for compile command databases will be disabled. Only set this option if you want to control compiler flags entirely manually, and no `compile_commands.json` file is in one of the |g:ale_c_build_dir_names| directories of the project tree. g:ale_cpp_clangtidy_extra_options *g:ale_cpp_clangtidy_extra_options* *b:ale_cpp_clangtidy_extra_options* Type: |String| Default: `''` This variable can be changed to modify flags given to clang-tidy. g:ale_cpp_clangtidy_fix_errors *g:ale_cpp_clangtidy_fix_errors* *b:ale_cpp_clangtidy_fix_errors* Type: |Number| Default: `1` This variable can be changed to disable the `-fix-errors` option for the |clangtidy| fixer. =============================================================================== clazy *ale-cpp-clazy* g:ale_cpp_clazy_executable *g:ale_cpp_clazy_executable* *b:ale_cpp_clazy_executable* Type: |String| Default: `'clazy-standalone'` This variable can be changed to use a different executable for clazy. g:ale_cpp_clazy_checks *g:ale_cpp_clazy_checks* *b:ale_cpp_clazy_checks* Type: |List| Default: `['level1']` The checks to enable for clazy with the `-checks` argument. All options will be joined with commas, and escaped appropriately for the shell. The `-checks` flag can be removed entirely by setting this option to an empty List. g:ale_cpp_clazy_options *g:ale_cpp_clazy_options* *b:ale_cpp_clazy_options* Type: |String| Default: `''` This variable can be changed to modify flags given to clazy. =============================================================================== cppcheck *ale-cpp-cppcheck* g:ale_cpp_cppcheck_executable *g:ale_cpp_cppcheck_executable* *b:ale_cpp_cppcheck_executable* Type: |String| Default: `'cppcheck'` This variable can be changed to use a different executable for cppcheck. g:ale_cpp_cppcheck_options *g:ale_cpp_cppcheck_options* *b:ale_cpp_cppcheck_options* Type: |String| Default: `'--enable=style'` This variable can be changed to modify flags given to cppcheck. =============================================================================== cpplint *ale-cpp-cpplint* g:ale_cpp_cpplint_executable *g:ale_cpp_cpplint_executable* *b:ale_cpp_cpplint_executable* Type: |String| Default: `'cpplint'` This variable can be changed to use a different executable for cpplint. g:ale_cpp_cpplint_options *g:ale_cpp_cpplint_options* *b:ale_cpp_cpplint_options* Type: |String| Default: `''` This variable can be changed to modify flags given to cpplint. g:ale_c_cpplint_executable *g:ale_c_cpplint_executable* *b:ale_c_cpplint_executable* Type: |String| Default: `'cpplint'` This variable can be changed to use a different executable for cpplint. g:ale_c_cpplint_options *g:ale_c_cpplint_options* *b:ale_c_cpplint_options* Type: |String| Default: `''` This variable can be changed to modify flags given to cpplint. =============================================================================== cquery *ale-cpp-cquery* g:ale_cpp_cquery_executable *g:ale_cpp_cquery_executable* *b:ale_cpp_cquery_executable* Type: |String| Default: `'cquery'` This variable can be changed to use a different executable for cquery. g:ale_cpp_cquery_cache_directory *g:ale_cpp_cquery_cache_directory* *b:ale_cpp_cquery_cache_directory* Type: |String| Default: `'~/.cache/cquery'` This variable can be changed to decide which directory cquery uses for its cache. =============================================================================== cspell *ale-cpp-cspell* See |ale-cspell-options| =============================================================================== flawfinder *ale-cpp-flawfinder* g:ale_cpp_flawfinder_executable *g:ale_cpp_flawfinder_executable* *b:ale_cpp_flawfinder_executable* Type: |String| Default: `'flawfinder'` This variable can be changed to use a different executable for flawfinder. g:ale_cpp_flawfinder_minlevel *g:ale_cpp_flawfinder_minlevel* *b:ale_cpp_flawfinder_minlevel* Type: |Number| Default: `1` This variable can be changed to ignore risks under the given risk threshold. g:ale_cpp_flawfinder_options *g:ale-cpp-flawfinder* *b:ale-cpp-flawfinder* Type: |String| Default: `''` This variable can be used to pass extra options into the flawfinder command. =============================================================================== uncrustify *ale-cpp-uncrustify* See |ale-c-uncrustify| for information about the available options. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-cs.txt000066400000000000000000000225031476501472200147400ustar00rootroot00000000000000=============================================================================== ALE C# Integration *ale-cs-options* In addition to the linters that are provided with ALE, C# code can be checked with the OmniSharp plugin. See here: https://github.com/OmniSharp/omnisharp-vim =============================================================================== clang-format *ale-cs-clangformat* See |ale-c-clangformat| for information about the available options. Note that the C options are also used for C#. =============================================================================== csc *ale-cs-csc* The |ale-cs-csc| linter checks for semantic errors when files are opened or saved. See |ale-lint-file-linters| for more information on linters which do not check for problems while you type. The csc linter uses the mono csc compiler, providing full C# 7 and newer support, to generate a temporary module target file (/t:module). The module includes all '*.cs' files contained in the directory tree rooted at the path defined by the |g:ale_cs_csc_source| or |b:ale_cs_csc_source| variable and all sub directories. It will in future replace the |ale-cs-mcs| and |ale-cs-mcsc| linters as both utilize the mcsc compiler which, according to the mono project, is no longer actively developed, and only receives maintenance updates. However, because the csc compiler does not support the -syntax option, this linter does not offer any as-you-type syntax checking, similar to the |ale-cs-mcsc| linter. The paths to search for additional assembly files can be specified using the |g:ale_cs_csc_assembly_path| or |b:ale_cs_csc_assembly_path| variables. NOTE: ALE will not find any errors in files apart from syntax errors if any one of the source files contains a syntax error. Syntax errors must be fixed first before other errors will be shown. g:ale_cs_csc_options *g:ale_cs_csc_options* *b:ale_cs_csc_options* Type: |String| Default: `''` This option can be set to pass additional arguments to the `csc` compiler. For example, to add the dotnet package which is not added per default: > let g:ale_cs_mcs_options = ' /warn:4 /langversion:7.2' < NOTE: the `/unsafe` option is always passed to `csc`. g:ale_cs_csc_source *g:ale_cs_csc_source* *b:ale_cs_csc_source* Type: |String| Default: `''` This variable defines the root path of the directory tree searched for the '*.cs' files to be linted. If this option is empty, the source file's directory will be used. NOTE: Currently it is not possible to specify sub directories and directory sub trees which shall not be searched for *.cs files. g:ale_cs_csc_assembly_path *g:ale_cs_csc_assembly_path* *b:ale_cs_csc_assembly_path* Type: |List| Default: `[]` This variable defines a list of path strings to be searched for external assembly files. The list is passed to the csc compiler using the `/lib:` flag. g:ale_cs_csc_assemblies *g:ale_cs_csc_assemblies* *b:ale_cs_csc_assemblies* Type: |List| Default: `[]` This variable defines a list of external assembly (*.dll) files required by the mono mcs compiler to generate a valid module target. The list is passed the csc compiler using the `/r:` flag. For example: > " Compile C# programs with the Unity engine DLL file on Mac. let g:ale_cs_mcsc_assemblies = [ \ '/Applications/Unity/Unity.app/Contents/Frameworks/Managed/UnityEngine.dll', \ 'path-to-unityproject/obj/Debug', \] < =============================================================================== cspell *ale-cs-cspell* See |ale-cspell-options| =============================================================================== dotnet-format *ale-cs-dotnet-format* Installation ------------------------------------------------------------------------------- Installing .NET SDK should probably ensure that `dotnet` is in your `$PATH`. For .NET 6 the `dotnet format` tool is already included in the .NET SDK. For .NET 5 or below you will have to manually install it using the instructions from listed in this repository: https://github.com/dotnet/format Options ------------------------------------------------------------------------------- g:ale_cs_dotnet_format_executable *g:ale_cs_dotnet_format_executable* *b:ale_cs_dotnet_format_executable* Type: |String| Default: `'dotnet'` This variable can be set to specify an absolute path to the `dotnet` executable (or to specify an alternate executable). g:ale_cs_dotnet_format_options *g:ale_cs_dotnet_format_options* *b:ale_cs_dotnet_format_options* Type: |String| Default: `''` This variable can be set to pass additional options to the `dotnet format` fixer. =============================================================================== mcs *ale-cs-mcs* The `mcs` linter looks only for syntax errors while you type. See |ale-cs-mcsc| for the separately configured linter for checking for semantic errors. g:ale_cs_mcs_options *g:ale_cs_mcs_options* *b:ale_cs_mcs_options* Type: String Default: `''` This variable can be changed to pass additional flags given to mcs. NOTE: The -unsafe flag is selected implicitly and thus does not need to be explicitly included in the |g:ale_cs_mcs_options| or |b:ale_cs_mcs_options| parameter. =============================================================================== mcsc *ale-cs-mcsc* The mcsc linter checks for semantic errors when files are opened or saved See |ale-lint-file-linters| for more information on linters which do not check for problems while you type. The mcsc linter uses the mono mcs compiler to generate a temporary module target file (-t:module). The module includes including all '*.cs' files contained in the directory tree rooted at the path defined by the |g:ale_cs_mcsc_source| or |b:ale_cs_mcsc_source| variable. variable and all sub directories. The paths to search for additional assembly files can be specified using the |g:ale_cs_mcsc_assembly_path| or |b:ale_cs_mcsc_assembly_path| variables. NOTE: ALE will not find any errors in files apart from syntax errors if any one of the source files contains a syntax error. Syntax errors must be fixed first before other errors will be shown. g:ale_cs_mcsc_options *g:ale_cs_mcsc_options* *b:ale_cs_mcsc_options* Type: |String| Default: `''` This option can be set to pass additional arguments to the `mcs` compiler. For example, to add the dotnet package which is not added per default: > let g:ale_cs_mcs_options = '-pkg:dotnet' < NOTE: the `-unsafe` option is always passed to `mcs`. g:ale_cs_mcsc_source *g:ale_cs_mcsc_source* *b:ale_cs_mcsc_source* Type: |String| Default: `''` This variable defines the root path of the directory tree searched for the '*.cs' files to be linted. If this option is empty, the source file's directory will be used. NOTE: Currently it is not possible to specify sub directories and directory sub trees which shall not be searched for *.cs files. g:ale_cs_mcsc_assembly_path *g:ale_cs_mcsc_assembly_path* *b:ale_cs_mcsc_assembly_path* Type: |List| Default: `[]` This variable defines a list of path strings to be searched for external assembly files. The list is passed to the mcs compiler using the `-lib:` flag. g:ale_cs_mcsc_assemblies *g:ale_cs_mcsc_assemblies* *b:ale_cs_mcsc_assemblies* Type: |List| Default: `[]` This variable defines a list of external assembly (*.dll) files required by the mono mcs compiler to generate a valid module target. The list is passed the mcs compiler using the `-r:` flag. For example: > " Compile C# programs with the Unity engine DLL file on Mac. let g:ale_cs_mcsc_assemblies = [ \ '/Applications/Unity/Unity.app/Contents/Frameworks/Managed/UnityEngine.dll', \ 'path-to-unityproject/obj/Debug', \] < =============================================================================== uncrustify *ale-cs-uncrustify* See |ale-c-uncrustify| for information about the available options. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-css.txt000066400000000000000000000064631476501472200151320ustar00rootroot00000000000000=============================================================================== ALE CSS Integration *ale-css-options* =============================================================================== cspell *ale-css-cspell* See |ale-cspell-options| =============================================================================== css-beautify *ale-css-css-beautify* g:ale_css_css_beautify_executable *g:ale_css_css_beautify_executable* *b:ale_css_css_beautify_executable* Type: |String| Default: `'css-beautify'` See |ale-integrations-local-executables| g:ale_css_css_beautify_options *g:ale_css_css_beautify_options* *b:ale_css_css_beautify_options* Type: |String| Default: `''` This variable can be set to pass additional options to css-beautify. g:ale_css_css_beautify_use_global *g:ale_css_css_beautify_use_global* *b:ale_css_css_beautify_use_global* Type: |String| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| =============================================================================== fecs *ale-css-fecs* `fecs` options for CSS is the same as the options for JavaScript, and both of them reads `./.fecsrc` as the default configuration file. See: |ale-javascript-fecs|. =============================================================================== prettier *ale-css-prettier* See |ale-javascript-prettier| for information about the available options. =============================================================================== stylelint *ale-css-stylelint* g:ale_css_stylelint_executable *g:ale_css_stylelint_executable* *b:ale_css_stylelint_executable* Type: |String| Default: `'stylelint'` See |ale-integrations-local-executables| g:ale_css_stylelint_options *g:ale_css_stylelint_options* *b:ale_css_stylelint_options* Type: |String| Default: `''` This variable can be set to pass additional options to stylelint. g:ale_css_stylelint_use_global *g:ale_css_stylelint_use_global* *b:ale_css_stylelint_use_global* Type: |String| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| =============================================================================== vscodecss *ale-css-vscode* Website: https://github.com/hrsh7th/vscode-langservers-extracted Installation ------------------------------------------------------------------------------- Install VSCode css language server either globally or locally: > npm install -g vscode-langservers-extracted < =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-cuda.txt000066400000000000000000000037211476501472200152500ustar00rootroot00000000000000=============================================================================== ALE CUDA Integration *ale-cuda-options* =============================================================================== clang-format *ale-cuda-clangformat* See |ale-c-clangformat| for information about the available options. Note that the C options are also used for CUDA. =============================================================================== clangd *ale-cuda-clangd* g:ale_cuda_clangd_executable *g:ale_cuda_clangd_executable* *b:ale_cuda_clangd_executable* Type: |String| Default: `'clangd'` This variable can be changed to use a different executable for clangd. g:ale_cuda_clangd_options *g:ale_cuda_clangd_options* *b:ale_cuda_clangd_options* Type: |String| Default: `''` This variable can be changed to modify flags given to clangd. =============================================================================== nvcc *ale-cuda-nvcc* g:ale_cuda_nvcc_executable *g:ale_cuda_nvcc_executable* *b:ale_cuda_nvcc_executable* Type: |String| Default: `'nvcc'` This variable can be changed to use a different executable for nvcc. Currently only nvcc 8.0 is supported. g:ale_cuda_nvcc_options *g:ale_cuda_nvcc_options* *b:ale_cuda_nvcc_options* Type: |String| Default: `'-std=c++11'` This variable can be changed to modify flags given to nvcc. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-d.txt000066400000000000000000000024721476501472200145610ustar00rootroot00000000000000=============================================================================== ALE D Integration *ale-d-options* =============================================================================== dfmt *ale-d-dfmt* g:ale_d_dfmt_options *g:ale_d_dfmt_options* *b:ale_d_dfmt_options* Type: |String| Default: `''` This variable can be set to pass additional options to the dfmt fixer. =============================================================================== dls *ale-d-dls* g:ale_d_dls_executable *g:ale_d_dls_executable* *b:ale_d_dls_executable* Type: |String| Default: `dls` See |ale-integrations-local-executables| =============================================================================== uncrustify *ale-d-uncrustify* See |ale-c-uncrustify| for information about the available options. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-dafny.txt000066400000000000000000000011471476501472200154350ustar00rootroot00000000000000=============================================================================== ALE Dafny Integration *ale-dafny-options* =============================================================================== dafny *ale-dafny-dafny* g:ale_dafny_dafny_timelimit *g:ale_dafny_dafny_timelimit* *b:ale_dafny_dafny_timelimit* Type: |Number| Default: `10` This variable sets the `/timeLimit` used for dafny. vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-dart.txt000066400000000000000000000121341476501472200152640ustar00rootroot00000000000000=============================================================================== ALE Dart Integration *ale-dart-options* =============================================================================== analysis_server *ale-dart-analysis_server* Installation ------------------------------------------------------------------------------- Install Dart via whatever means. `analysis_server` will be included in the SDK. In case that `dart` is not in your path, try to set the executable option to its absolute path. : > " Set the executable path for dart to the absolute path to it. let g:ale_dart_analysis_server_executable = '/usr/local/bin/dart' < Options ------------------------------------------------------------------------------- g:ale_dart_analysis_server_executable *g:ale_dart_analysis_server_executable* *b:ale_dart_analysis_server_executable* Type: |String| Default: `'dart'` This variable can be set to change the path of dart. g:ale_dart_analysis_server_enable_language_server *g:ale_dart_analysis_server_enable_language_server* *b:ale_dart_analysis_server_enable_language_server* Type: |Number| Default: `1` When set to `1`, ALE will use the new `dart language-server` command, available from Dart version 2.16.0, to launch the language server. When set to `0`, ALE will instead use the deprecated `./snapshots/analysis_server.dart.snapshot --lsp` command used by older versions of Dart. =============================================================================== dart-analyze *ale-dart-analyze* Installation ------------------------------------------------------------------------------- Installing Dart should probably ensure that `dart` is in your `$PATH`. In case it is not, try to set the executable option to its absolute path. : > " Set the executable path for dart to the absolute path to it. let g:ale_dart_format_executable = '/usr/lib/dart/bin/dart' > Install Dart via whatever means. `dart analyze` will be included in the SDK. Options ------------------------------------------------------------------------------- g:ale_dart_analyze_executable *g:ale_dart_analyze_executable* *b:ale_dart_analyze_executable* Type: |String| Default: `'dart'` This variable can be set to specify an absolute path to the format executable (or to specify an alternate executable). =============================================================================== dart-format *ale-dart-format* Installation ------------------------------------------------------------------------------- Installing Dart should probably ensure that `dart` is in your `$PATH`. In case it is not, try to set the executable option to its absolute path. : > " Set the executable path for dart to the absolute path to it. let g:ale_dart_format_executable = '/usr/lib/dart/bin/dart' > Options ------------------------------------------------------------------------------- g:ale_dart_format_executable *g:ale_dart_format_executable* *b:ale_dart_format_executable* Type: |String| Default: `'dart'` This variable can be set to specify an absolute path to the format executable (or to specify an alternate executable). g:ale_dart_format_options *g:ale_dart_format_options* *b:ale_dart_format_options* Type: |String| Default: `''` This variable can be set to pass additional options to the dart format fixer. =============================================================================== dartfmt *ale-dart-dartfmt* Installation ------------------------------------------------------------------------------- Installing Dart should probably ensure that `dartfmt` is in your `$PATH`. In case it is not, try to set the executable option to its absolute path. : > " Set the executable path for dartfmt to the absolute path to it. let g:ale_dart_dartfmt_executable = '/usr/lib/dart/bin/dartfmt' > Options ------------------------------------------------------------------------------- g:ale_dart_dartfmt_executable *g:ale_dart_dartfmt_executable* *b:ale_dart_dartfmt_executable* Type: |String| Default: `''` This variable can be set to specify an absolute path to the dartfmt executable (or to specify an alternate executable). g:ale_dart_dartfmt_options *g:ale_dart_dartfmt_options* *b:ale_dart_dartfmt_options* Type: |String| Default: `''` This variable can be set to pass additional options to the dartfmt fixer. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-desktop.txt000066400000000000000000000015261476501472200160060ustar00rootroot00000000000000=============================================================================== ALE desktop Integration *ale-desktop-options* =============================================================================== desktop-file-validate *ale-desktop-desktop-file-validate* ALE supports checking .desktop files with `desktop-file-validate.` g:ale_desktop_desktop_file_validate_options *g:ale_desktop_desktop_file_validate_options* *b:ale_desktop_desktop_file_validate_options* Type: |String| Default: `''` This variable can be changed to set options for `desktop-file-validate`, such as `'--warn-kde'`. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-development.txt000066400000000000000000000605451476501472200166650ustar00rootroot00000000000000*ale-development.txt* For Vim version 8.0. *ale-dev* *ale-development* ALE Development Documentation =============================================================================== CONTENTS *ale-development-contents* 1. Introduction.........................|ale-development-introduction| 2. Design Goals.........................|ale-design-goals| 3. Coding Standards.....................|ale-coding-standards| 4. Testing ALE..........................|ale-development-tests| 4.1. Writing Linter Tests.............|ale-development-linter-tests| 4.2. Writing Fixer Tests..............|ale-development-fixer-tests| 4.3. Running Tests in a Windows VM....|ale-development-windows-tests| 5. Contributing.........................|ale-development-contributing| 5.1. Preparing a Release..............|ale-development-release| =============================================================================== 1. Introduction *ale-development-introduction* This document contains helpful information for ALE developers, including design goals, information on how to run the tests, coding standards, and so on. You should read this document if you want to get involved with ALE development. =============================================================================== 2. Design Goals *ale-design-goals* This section lists design goals for ALE, in no particular order. They are as follows. ALE code should be almost 100% VimL. This makes the plugin as portable as possible. ALE should run without needing any other plugins to be installed, to make installation simple. ALE can integrate with other plugins for more advanced functionality, non-essential functionality, or improving on basic first party functionality. ALE should check files with as many tools as possible by default, except where they cause security issues or make excessive use of resources on modern machines. ALE should be free of breaking changes to the public API, which is comprised of documented functions and options, until a major version is planned. Breaking changes should be preceded by a deprecation phase complete with warnings. Changes required for security may be an exception. ALE supports Vim 8 and above, and Neovim 0.7.0 or newer. These are the earliest versions of Vim and Neovim which support |+job|, |+timer|, |+closure|, and |+lambda| features. All ALE code should be written so it is compatible with these versions of Vim, or with version checks so particular features can degrade or fail gracefully. Just about everything should be documented and covered with tests. By and large, people shouldn't pay for the functionality they don't use. Care should be taken when adding new features, so supporting new features doesn't degrade the general performance of anything ALE does. LSP support will become more important as time goes on. ALE should provide better support for LSP features as time goes on. When merging pull requests, you should respond with `Cheers! :beers:`, purely for comedy value. =============================================================================== 3. Coding Standards *ale-coding-standards* The following general coding standards should be adhered to for Vim code. * Check your Vim code with `Vint` and do everything it says. ALE will check your Vim code with Vint automatically. See: https://github.com/Kuniwak/vint Read ALE's `Dockerfile` to see which version of `Vint` it uses. * Try to write descriptive and concise names for variables and functions. Names shouldn't be too short or too long. Think about others reading your code later on. * Use `snake_case` names for variables and arguments, and `PascalCase` names for functions. Prefix every variable name with its scope. (`l:`, `g:`, etc.) * Try to keep lines no longer than 80 characters, but this isn't an absolute requirement. * Use 4 spaces for every level of indentation in Vim code. * Add a blank line before every `function`, `if`, `for`, `while`, or `return`, which doesn't start a new level of indentation. This makes the logic in your code easier to follow. * End every file with a trailing newline character, but not with extra blank lines. Remove trailing whitespace from the ends of lines. * Write the full names of commands instead of abbreviations. For example, write `function` instead of `func`, and `endif` instead of `end`. * Write functions with `!`, so files can be reloaded. Use the |abort| keyword for all functions, so functions exit on the first error. * Make sure to credit yourself in files you have authored with `Author:` and `Description:` comments. In addition to the above general guidelines for the style of your code, you should also follow some additional rules designed to prevent mistakes. Some of these are reported with ALE's `custom-linting-rules` script. See |ale-development-tests|. * Don't leave stray `:echo` lines in code. Write `" no-custom-checks` above the line if you must echo something. * For strings use |is#| instead of |==#|, `is?` instead of `==?`, `isnot#` instead of `!=#`, and `isnot?` instead of `!=?`. This is because `'x' ==# 0` returns 1, while `'x' is# 0` returns 0, so you will experience fewer issues when numbers are compared with strings. `is` and `isnot` also do not throw errors when other objects like List or Dictionaries are compared with strings. * Don't use the `getcwd()` function in the ALE codebase. Most of ALE's code runs from asynchronous callback functions, and these functions can execute from essentially random buffers. Therefore, the `getcwd()` output is useless. Use `expand('#' . a:buffer . ':p:h')` instead. Don't use `expand('%...')` for the same reason. * Don't use the `simplify()` function. It doesn't simplify paths enough. Use `ale#path#Simplify()` instead. * Don't use the `shellescape()` function. It doesn't escape arguments properly on Windows. Use `ale#Escape()` instead, which will avoid escaping where it isn't needed, and generally escape arguments better on Windows. * Don't use the `tempname()` function. It doesn't work when `$TMPDIR` isn't set. Use `ale#util#Tempname()` instead, which temporarily sets `$TMPDIR` appropriately where needed. * Use `snake_case` names for linter names, so they can be used as part of variable names. You can define `aliases` for linters, for other names people might try to configure linters with. * Use |v:t_TYPE| variables instead of `type()`, which are more readable. Apply the following guidelines when writing Vader test files. * Use 2 spaces for Vader test files, instead of the 4 spaces for Vim files. * If you write `Before` and `After` blocks, you should typically write them at the top of the file, so they run for all tests. There may be some tests where it make sense to modify the `Before` and `After` code part of the way through the file. * If you modify any settings or global variables, reset them in `After` blocks. The Vader `Save` and `Restore` commands can be useful for this purpose. * If you load or define linters in tests, write `call ale#linter#Reset()` in an `After` block. * Just write `Execute` blocks for Vader tests, and don't bother writing `Then` blocks. `Then` blocks execute after `After` blocks in older versions, and that can be confusing. Apply the following rules when writing Bash scripts. * Run `shellcheck`, and do everything it says. See: https://github.com/koalaman/shellcheck * Try to write scripts so they will run on Linux, BSD, or Mac OSX. =============================================================================== 4. Testing ALE *ale-development-tests* *ale-dev-tests* *ale-tests* ALE is tested with a suite of tests executed via GitHub Actions and AppVeyor. ALE runs tests with the following versions of Vim in the following environments. 1. Vim 8.0.0027 on Linux via GitHub Actions. 2. Vim 9.0.0297 on Linux via GitHub Actions. 3. Neovim 0.7.0 on Linux via GitHub Actions. 4. Neovim 0.8.0 on Linux via GitHub Actions. 6. Vim 8 (stable builds) on Windows via AppVeyor. If you are developing ALE code on Linux, Mac OSX, or BSD, you can run ALEs tests by installing Docker and running the `run-tests` script. Follow the instructions on the Docker site for installing Docker. See: https://docs.docker.com/install/ NOTE: Don't forget to add your user to the `docker` group on Linux, or Docker just won't work. See: https://docs.docker.com/install/linux/linux-postinstall/ If you run simply `./run-tests` from the ALE repository root directory, the latest Docker image for tests will be downloaded if needed, and the script will run all of the tests in Vader, Vint checks, and several Bash scripts for finding extra issues. Run `./run-tests --help` to see all of the options the script supports. Note that the script supports selecting particular test files. Once you get used to dealing with Vim and NeoVim compatibility issues, you probably want to use `./run-tests --fast -q` for running tests with only the fastest available Vim version, and with success messages from tests suppressed. Generally write tests for any changes you make. The following types of tests are recommended for the following types of code. * New/edited error handler callbacks -> Write tests in `test/handler` * New/edited linter definition -> Write tests in `test/linter` * New/edited fixer functions -> Write tests in `test/fixers` Look at existing tests in the codebase for examples of how to write tests. Refer to the Vader documentation for general information on how to write Vader tests: https://github.com/junegunn/vader.vim If you need to add any supporting files for tests, such as empty files present to test searching upwards through paths for configuration files, they can be added to the `test/test-files` directory. See |ale-development-linter-tests| for more information on how to write linter tests. When you add new linters or fixers, make sure to add them into the tables in supported-tools.md and |ale-supported-languages-and-tools.txt|. If you forget to keep them both in sync, you should see an error like the following in the builds run for GitHub Actions. > ======================================== diff supported-tools.md and doc/ale-supported-languages-and-tools.txt tables ======================================== Differences follow: --- /tmp/readme.qLjNhJdB 2018-07-01 16:29:55.590331972 +0100 +++ /tmp/doc.dAi8zfVE 2018-07-01 16:29:55.582331877 +0100 @@ -1 +1 @@ - ASM: gcc, foobar + ASM: gcc < Make sure to list documentation entries for linters and fixers in individual help files in the table of contents, and to align help tags to the right margin. For example, if you add a heading for an `aardvark` tool to `ale-python.txt` with a badly aligned doc tag, you will see errors like so. > ======================================== Look for badly aligned doc tags ======================================== Badly aligned tags follow: doc/ale-python.txt:aardvark ... ======================================== Look for table of contents issues ======================================== Check for bad ToC sorting: Check for mismatched ToC and headings: --- /tmp/table-of-contents.mwCFOgSI 2018-07-01 16:33:25.068811878 +0100 +++ /tmp/headings.L4WU0hsO 2018-07-01 16:33:25.076811973 +0100 @@ -168,6 +168,7 @@ pyrex (cython), ale-pyrex-options cython, ale-pyrex-cython python, ale-python-options + aardvark, ale-python-aardvark autopep8, ale-python-autopep8 black, ale-python-black flake8, ale-python-flake8 < Make sure to make the table of contents match the headings, and to keep the doc tags on the right margin. =============================================================================== 4.1 Writing Linter Tests *ale-development-linter-tests* Tests for ALE linters take two forms. 1. Tests for handling the output of commands. 2. Tests for checking which commands are run, or connections are made. Tests of the first form should go in the `test/handler` directory, and should be written like so. > Before: " Load the file which defines the linter. runtime ale_linters/filetype/linter_name_here.vim After: " Unload all linters again. call ale#linter#Reset() Execute(The output should be correct): " Test that the right loclist items are parsed from the handler. AssertEqual \ [ \ { \ 'lnum': 1, \ 'type': 'E', \ 'text': 'Something went wrong', \ }, \ ], \ ale_linters#filetype#linter_name#Handle(bufnr(''), [ \ '1:Something went wrong', \ ] < Tests for what ALE runs should go in the `test/linter` directory, and should be written like so. > Before: " Load the linter and set up a series of commands, reset linter variables, " clear caches, etc. " " Vader's 'Save' command will be called here for linter variables. call ale#assert#SetUpLinterTest('filetype', 'linter_name') After: " Reset linters, variables, etc. " " Vader's 'Restore' command will be called here. call ale#assert#TearDownLinterTest() Execute(The default command should be correct): " AssertLinter checks the executable and command. " Pass expected_executable, expected_command AssertLinter 'some-command', ale#Escape('some-command') . ' --foo' Execute(Check chained commands): " GivenCommandOutput can be called with 1 or more list for passing output " to chained commands. The output for each callback defaults to an empty " list. GivenCommandOutput ['v2.1.2'] " Given a List of commands, check all of them. " Given a String, only the last command in the chain will be checked. AssertLinter 'some-command', [ \ ale#Escape('some-command') . ' --version', \ ale#Escape('some-command') . ' --foo', \] < The full list of commands that will be temporarily defined for linter tests given the above setup are as follows. `GivenCommandOutput [...]` - Define output for ale#command#Run. `AssertLinterCwd cwd` - Check the `cwd` for the linter. `AssertLinter executable, command` - Check the executable and command. `AssertLinterNotExecuted` - Check that linters will not be executed. `AssertLSPLanguage language` - Check the language given to an LSP server. `AssertLSPOptions options_dict` - Check the options given to an LSP server. `AssertLSPConfig config_dict` - Check the config given to an LSP server. `AssertLSPProject project_root` - Check the root given to an LSP server. `AssertLSPAddress address` - Check the address to an LSP server. =============================================================================== 4.2 Writing Fixer Tests *ale-development-fixer-tests* Tests for ALE fixers should go in the `test/fixers` directory, and should be written like so. > Before: " Load the fixer and set up a series of commands, reset fixer variables, " clear caches, etc. " " Vader's 'Save' command will be called here for fixer variables. call ale#assert#SetUpFixerTest('filetype', 'fixer_name') After: " Reset fixers, variables, etc. " " Vader's 'Restore' command will be called here. call ale#assert#TearDownFixerTest() Execute(The default command should be correct): " AssertFixer checks the result of the loaded fixer function. AssertFixer {'command': ale#Escape('some-command') . ' --foo'} Execute(Check chained commands): " Same as above for linter tests. GivenCommandOutput ['v2.1.2'] " Given a List of commands, check all of them. " Given anything else, only the last result will be checked. AssertFixer [ \ ale#Escape('some-command') . ' --version', \ {'command': ale#Escape('some-command') . ' --foo'} \] < The full list of commands that will be temporarily defined for fixer tests given the above setup are as follows. `GivenCommandOutput [...]` - Define output for ale#command#Run. `AssertFixerCwd cwd` - Check the `cwd` for the fixer. `AssertFixer results` - Check the fixer results `AssertFixerNotExecuted` - Check that fixers will not be executed. =============================================================================== 4.3 Running Tests in a Windows VM *ale-development-windows-tests* Tests are run for ALE in a build of Vim 8 for Windows via AppVeyor. These tests can frequently break due to minor differences in paths and how escaping is done for commands on Windows. If you are a Linux or Mac user, running these tests locally can be difficult. Here is a process that will make that easier. First, you want to install a Windows image with VirtualBox. Install VirtualBox and grab a VirtualBox image for Windows such as from here: https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/ NOTE: If you need to enter a password for the virtual machine at any point, the password is "Passw0rd!" without the double quotes. NOTE: If your trial period for Windows runs out, run the commands like the wallpaper tells you to. Your virtual machine will need to have PowerShell installed. Before you go any further, confirm that PowerShell is installed in your Windows virtual machine. Consult the VirtualBox documentation on how to install "Guest Additions." You probably want to install "Guest Additions" for most things to work properly. After you've loaded your virtual machine image, go into "Settings" for your virtual machine, and "Shared Folders." Add a shared folder with the name "ale", and set the "Folder Path" to the path to your ALE repository, for example: "/home/w0rp/ale" Find out which drive letter "ale" has been mounted as in Windows. We'll use "E:" as the drive letter, for example. Open the command prompt as an administrator by typing in `cmd` in the start menu, right clicking on the command prompt application, and clicking "Run as administrator." Click "Yes" when prompted to ask if you're sure you want to run the command prompt. You should type in the following command to mount the "ale" directory for testing, where "E:" is replaced with your drive letter. > mklink /D C:\testplugin E: < Close the administrator Command Prompt, and try running the command `type C:\testplugin\LICENSE` in a new Command Prompt which you are NOT running as administrator. You should see the license for ALE in your terminal. After you have confirmed that you have mounted ALE on your machine, search in the Start Menu for "power shell," run PowerShell as an administrator, and issue the following commands to install the correct Vim and Vader versions for running tests. > Add-Type -A System.IO.Compression.FileSystem Invoke-WebRequest ftp://ftp.vim.org/pub/vim/pc/vim80-586w32.zip -OutFile C:\vim.zip [IO.Compression.ZipFile]::ExtractToDirectory('C:\vim.zip', 'C:\vim') rm C:\vim.zip Invoke-WebRequest ftp://ftp.vim.org/pub/vim/pc/vim80-586rt.zip -OutFile C:\rt.zip [IO.Compression.ZipFile]::ExtractToDirectory('C:\rt.zip', 'C:\vim') rm C:\rt.zip Invoke-WebRequest https://github.com/junegunn/vader.vim/archive/c6243dd81c98350df4dec608fa972df98fa2a3af.zip -OutFile C:\vader.zip [IO.Compression.ZipFile]::ExtractToDirectory('C:\vader.zip', 'C:\') mv C:\vader.vim-c6243dd81c98350df4dec608fa972df98fa2a3af C:\vader rm C:\vader.zip < After you have finished installing everything, you can run all of the tests in Windows by opening a Command Prompt NOT as an administrator by navigating to the directory where you've mounted the ALE code, which must be named `C:\testplugin`, and by running the `run-tests.bat` batch file. > cd C:\testplugin run-tests < It will probably take several minutes for all of the tests to run. Be patient. You can run a specific test by passing the filename as an argument to the batch file, for example: `run-tests test/test_c_flag_parsing.vader` . This will give you results much more quickly. =============================================================================== 5. Contributing *ale-development-contributing* All integration of new code into ALE is done through GitHub pull requests. Using that tool streamlines the process and minimizes the time and effort required to e.g. ensure test suites are run for every change. As for any project hosted by GitHub, the choice of platform demands every contributor to take care to setup an account and configure it accordingly. Due to details of our process, a difference to many other GitHub hosted projects is that contributors who wish to keep the author fields for their commits unaltered need to configure a public email address in their account and profile settings. See: https://docs.github.com/en/account-and-profile/ Unless configuring GitHub to expose contact details, commits will be rewritten to appear by `USERNAME ` . =============================================================================== 5.1 Preparing a Release *ale-development-release* ALE offers release packages through GitHub, for two reasons: 1. Some users like to target specific release versions rather than simply installing the plugin from `master`. This includes users who create Linux distribution specific packages from GitHub releases. 2. The releases provide a nice way to get an overview of what has changed in ALE over time. ALE has no fixed release schedule. Release versions are created whenever the ALE developers feel the need to create one. ALE release versions follow the typical Semantic Versioning scheme. See: https://semver.org/ Minor version releases for ALE should be the most common, followed by patch releases. Every minor version release should be followed by a `vA.B.x` branch such as `v2.0.x` for version `2.0.0` and every following patch version before `2.1.0`. The `git` branch strategy for patches is to first merge a bug fix to `master`, and then `git cherry-pick` a patch to a branch for a specific version. ALE developers do not generally support anything but `master` or the last minor version. Generally ALE releases hit a major version only when there are breaking changes to a public ALE setting or function. A "public" setting or function is defined as any setting or function documented in the `:help` |ale.txt| file. Major ALE versions ought to be so rare that they only come once a year at most. ALE should not typically introduce any breaking changes. If there are ever to be any breaking changes made for ALE, there should first come a minor version release for ALE documenting all of the coming breaking changes to ALE. It should be described how users can prepare for a breaking change that is coming before it is done. To create a release for ALE, you will need sufficient permissions in GitHub. Once you do, follow these steps. 1. Create a new release draft, or edit an existing one. It helps to craft drafts ahead of time and write the last commit ID checked for release notes on the last update to a draft. See the releases page: https://github.com/dense-analysis/ale/releases 2. Examine `git log` and read changes made between the last ID checked, or the git tag of the previous release, and the current commit in `master`. 3. Write updates in separate sections (except where empty) for: 3.a. Breaking Changes 3.b. Deprecated Features 3.c. New Features 3.d. New Linters 3.e. New Fixers 3.f. Linter Enhancements 3.g. Fixer Enhancements 3.h. Bugs Fixed 4. Once you've finished writing the draft for the release, bump `s:current_ale_version` in `autoload/ale.vim` to the current version, and add a line to `test/test_ale_has.vader` to test for the version. See |ale#Has()| documentation for more information. 5. Commit the changes after `./run-tests --fast -q` passes. 6. Tag the release with `git tag vA.B.C`, replacing `A`, `B`, and `C` with the version numbers. See `git tag --list` for examples. 7. Run `git push` and `git push --tags` to push the commit and the tag. 8. Edit the release draft in GitHub, select the tag you just pushed, and publish the draft. 9. If you're creating a new major or minor version: `git checkout -b vA.B.x`, replacing `A` and `B` with the major and minor versions. `git push` the new branch, and the GitHub branch protection settings should automatically apply to the new release branch. 10. You have already completed the last step. Have fun creating ALE releases. Drink responsibly, or not at all, which is the preference of w0rp. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-dhall.txt000066400000000000000000000033611476501472200154200ustar00rootroot00000000000000=============================================================================== ALE Dhall Integration *ale-dhall-options* g:ale_dhall_executable *g:ale_dhall_executable* *b:ale_dhall_executable* Type: |String| Default: `'dhall'` g:ale_dhall_options *g:ale_dhall_options* *b:ale_dhall_options* Type: |String| Default: `''` This variable can be set to pass additional options to the 'dhall` executable. This is shared with `dhall-freeze` and `dhall-lint`. > let g:ale_dhall_options = '--ascii' < =============================================================================== dhall-format *ale-dhall-format* Dhall (https://dhall-lang.org/) =============================================================================== dhall-freeze *ale-dhall-freeze* Dhall (https://dhall-lang.org/) g:ale_dhall_freeze_options *g:ale_dhall_freeze_options* *b:ale_dhall_freeze_options* Type: |String| Default: `''` This variable can be set to pass additional options to the 'dhall freeze` executable. > let g:ale_dhall_freeze_options = '--all' < =============================================================================== dhall-lint *ale-dhall-lint* Dhall (https://dhall-lang.org/) =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-dockerfile.txt000066400000000000000000000073731476501472200164520ustar00rootroot00000000000000=============================================================================== ALE Dockerfile Integration *ale-dockerfile-options* =============================================================================== dockerfile_lint *ale-dockerfile-dockerfile_lint* g:ale_dockerfile_dockerfile_lint_executable *g:ale_dockerfile_dockerfile_lint_executable* *b:ale_dockerfile_dockerfile_lint_executable* Type: |String| Default: `'dockerfile_lint'` This variable can be changed to specify the executable used to run dockerfile_lint. g:ale_dockerfile_dockerfile_lint_options *g:ale_dockerfile_dockerfile_lint_options* *b:ale_dockerfile_dockerfile_lint_options* Type: |String| Default: `''` This variable can be changed to add additional command-line arguments to the dockerfile lint invocation - like custom rule file definitions. =============================================================================== dockerlinter *ale-dockerfile-dockerlinter* g:ale_dockerfile_dockerlinter_executable *g:ale_dockerfile_dockerlinter_executable* *b:ale_dockerfile_dockerlinter_executable* Type: |String| Default: `'dockerlinter'` This variable can be changed to specify the executable used to run dockerlinter. g:ale_dockerfile_dockerlinter_options *g:ale_dockerfile_dockerlinter_options* *b:ale_dockerfile_dockerlinter_options* Type: |String| Default: `''` This variable can be changed to add additional command-line arguments to the dockerfile lint invocation - like custom rule file definitions. dockerlinter =============================================================================== dprint *ale-dockerfile-dprint* See |ale-dprint-options| and https://dprint.dev/plugins/dockerfile =============================================================================== hadolint *ale-dockerfile-hadolint* hadolint can be found at: https://github.com/hadolint/hadolint g:ale_dockerfile_hadolint_options *g:ale_dockerfile_hadolint_options* *b:ale_dockerfile_hadolint_options* Type: |String| Default: `''` This variable can be changed to add command-line arguments to the hadolint invocation. These arguments will be used whether docker is being used or not (see below). g:ale_dockerfile_hadolint_use_docker *g:ale_dockerfile_hadolint_use_docker* *b:ale_dockerfile_hadolint_use_docker* Type: |String| Default: `'never'` This variable controls if docker and the hadolint image are used to run this linter: if 'never', docker will never be used; 'always' means docker will always be used; 'yes' and docker will be used if the hadolint executable cannot be found. For now, the default is 'never'. This may change as ale's support for using docker to lint evolves. g:ale_dockerfile_hadolint_image *g:ale_dockerfile_hadolint_image* *b:ale_dockerfile_hadolint_image* Type: |String| Default: `'hadolint/hadolint'` This variable controls the docker image used to run hadolint. The default is hadolint's author's build, and can be found at: https://hub.docker.com/r/hadolint/hadolint/ =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-elixir.txt000066400000000000000000000103701476501472200156260ustar00rootroot00000000000000=============================================================================== ALE Elixir Integration *ale-elixir-options* =============================================================================== mix *ale-elixir-mix* The `mix` linter is disabled by default, as it can be too expensive to run. See `:help g:ale_linters` g:ale_elixir_mix_options *g:ale_elixir_mix_options* *b:ale_elixir_mix_options* Type: |String| Default: `'mix'` This variable can be changed to specify the mix executable. =============================================================================== mix_format *ale-elixir-mix-format* g:ale_elixir_mix_format_options *g:ale_elixir_mix_format_options* *b:ale_elixir_mix_format_options* Type: |String| Default: `''` This variable can be changed to specify the mix options passed to the mix_format fixer =============================================================================== dialyxir *ale-elixir-dialyxir* Dialyzer, a DIscrepancy AnaLYZer for ERlang programs. http://erlang.org/doc/man/dialyzer.html It can be used with elixir through dialyxir https://github.com/jeremyjh/dialyxir Options for dialyzer are not configurable by ale, but they are instead configured on your project's `mix.exs`. See https://github.com/jeremyjh/dialyxir#with-explaining-stuff for more information. =============================================================================== elixir-ls *ale-elixir-elixir-ls* Elixir Language Server (https://github.com/JakeBecker/elixir-ls) g:ale_elixir_elixir_ls_release *g:ale_elixir_elixir_ls_release* *b:ale_elixir_elixir_ls_release* Type: |String| Default: `'elixir-ls'` Location of the elixir-ls release directory. This directory must contain the language server scripts (language_server.sh and language_server.bat). g:ale_elixir_elixir_ls_config *g:ale_elixir_elixir_ls_config* *b:ale_elixir_elixir_ls_config* Type: |Dictionary| Default: `{}` Dictionary containing configuration settings that will be passed to the language server. For example, to disable Dialyzer: > { \ 'elixirLS': { \ 'dialyzerEnabled': v:false, \ }, \ } < Consult the ElixirLS documentation for more information about settings. =============================================================================== credo *ale-elixir-credo* Credo (https://github.com/rrrene/credo) g:ale_elixir_credo_strict *g:ale_elixir_credo_strict* Type: |Integer| Default: `0` Tells credo to run in strict mode or suggest mode. Set variable to 1 to enable --strict mode. g:ale_elixir_credo_config_file *g:ale_elixir_credo_config_file* Type: |String| Default: `''` Tells credo to use a custom configuration file. =============================================================================== cspell *ale-elixir-cspell* See |ale-cspell-options| =============================================================================== lexical *ale-elixir-lexical* Lexical (https://github.com/lexical-lsp/lexical) g:ale_elixir_lexical_release *g:ale_elixir_lexical_release* *b:ale_elixir_lexical_release* Type: |String| Default: `'lexical'` Location of the lexical release directory. This directory must contain the language server scripts (start_lexical.sh and start_lexical.bat). For example, set release to: `/home/projects/lexical/_build/dev/rel/lexical` There are currnetly no configuration options for lexical. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-elm.txt000066400000000000000000000067621476501472200151210ustar00rootroot00000000000000=============================================================================== ALE Elm Integration *ale-elm-options* =============================================================================== elm-format *ale-elm-elm-format* g:ale_elm_format_executable *g:ale_elm_format_executable* *b:ale_elm_format_executable* Type: |String| Default: `'elm-format'` See |ale-integrations-local-executables| g:ale_elm_format_use_global *g:ale_elm_format_use_global* *b:ale_elm_format_use_global* Type: |Number| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| g:ale_elm_format_options *g:ale_elm_format_options* *b:ale_elm_format_options* Type: |String| Default: `'--yes'` This variable can be set to pass additional options to elm-format. =============================================================================== elm-ls *ale-elm-elm-ls* g:ale_elm_ls_executable *g:ale_elm_ls_executable* *b:ale_elm_ls_executable* Type: |String| Default: `'elm-language-server'` See |ale-integrations-local-executables| g:ale_elm_ls_use_global *g:ale_elm_ls_use_global* *b:ale_elm_ls_use_global* Type: |Number| Default: `get(g:, 'ale_use_global_executables', 1)` See |ale-integrations-local-executables| g:ale_elm_ls_elm_path *g:ale_elm_ls_elm_path* *b:ale_elm_ls_elm_path* Type: |String| Default: `''` See |ale-integrations-local-executables| g:ale_elm_ls_elm_format_path *g:ale_elm_ls_elm_format_path* *b:ale_elm_ls_elm_format_path* Type: |String| Default: `''` See |ale-integrations-local-executables| g:ale_elm_ls_elm_test_path *g:ale_elm_ls_elm_test_path* *b:ale_elm_ls_elm_test_path* Type: |String| Default: `''` See |ale-integrations-local-executables| g:ale_elm_ls_elm_analyse_trigger *g:ale_elm_ls_elm_analyse_trigger* *b:ale_elm_ls_elm_analyse_trigger* Type: |String| Default: `'change'` One of 'change', 'save' or 'never' =============================================================================== elm-make *ale-elm-elm-make* g:ale_elm_make_executable *g:ale_elm_make_executable* *b:ale_elm_make_executable* Type: |String| Default: `'elm'` See |ale-integrations-local-executables| g:ale_elm_make_use_global *g:ale_elm_make_use_global* *b:ale_elm_make_use_global* Type: |Number| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-erlang.txt000066400000000000000000000156441476501472200156130ustar00rootroot00000000000000=============================================================================== ALE Erlang Integration *ale-erlang-options* =============================================================================== dialyzer *ale-erlang-dialyzer* g:ale_erlang_dialyzer_executable *g:ale_erlang_dialyzer_executable* *b:ale_erlang_dialyzer_executable* Type: |String| Default: `'dialyzer'` This variable can be changed to specify the dialyzer executable. g:ale_erlang_dialyzer_options *g:ale_erlang_dialyzer_options* *b:ale_erlang_dialyzer_options* Type: |String| Default: `'-Wunmatched_returns -Werror_handling -Wrace_conditions -Wunderspec'` This variable can be changed to specify the options to pass to the dialyzer executable. g:ale_erlang_dialyzer_plt_file *g:ale_erlang_dialyzer_plt_file* *b:ale_erlang_dialyzer_plt_file* Type: |String| This variable can be changed to specify the path to the PLT file. By default, it will search for the PLT file inside the `_build` directory. If there isn't one, it will fallback to the path `$REBAR_PLT_DIR/dialyzer/plt`. Otherwise, it will default to `$HOME/.dialyzer_plt`. g:ale_erlang_dialyzer_rebar3_profile *g:ale_erlang_dialyzer_rebar3_profile* *b:ale_erlang_dialyzer_rebar3_profile* Type: |String| Default: `'default'` This variable can be changed to specify the profile that is used to run dialyzer with rebar3. ------------------------------------------------------------------------------- elvis *ale-erlang-elvis* g:ale_erlang_elvis_executable *g:ale_erlang_elvis_executable* *b:ale_erlang_elvis_executable* Type: |String| Default: `'elvis'` This variable can be changed to specify the elvis executable. ------------------------------------------------------------------------------- erlang-mode *ale-erlang-erlang-mode* g:ale_erlang_erlang_mode_emacs_executable *g:ale_erlang_erlang_mode_emacs_executable* *b:ale_erlang_erlang_mode_emacs_executable* Type: |String| Default: `'emacs'` This variable can be changed to specify the Emacs executable. g:ale_erlang_erlang_mode_indent_level *g:ale_erlang_erlang_mode_indent_level* *b:ale_erlang_erlang_mode_indent_level* Type: |Number| Default: `4` Indentation of Erlang calls/clauses within blocks. g:ale_erlang_erlang_mode_icr_indent *g:ale_erlang_erlang_mode_icr_indent* *b:ale_erlang_erlang_mode_icr_indent* Type: `'nil'` or |Number| Default: `'nil'` Indentation of Erlang if/case/receive patterns. `'nil'` means keeping default behavior. When non-`'nil'`, indent to the column of if/case/receive. g:ale_erlang_erlang_mode_indent_guard *g:ale_erlang_erlang_mode_indent_guard* *b:ale_erlang_erlang_mode_indent_guard* Type: |Number| Default: `2` Indentation of Erlang guards. g:ale_erlang_erlang_mode_argument_indent *g:ale_erlang_erlang_mode_argument_indent* *b:ale_erlang_erlang_mode_argument_indent* Type: `'nil'` or |Number| Default: `2` Indentation of the first argument in a function call. When `'nil'`, indent to the column after the `'('` of the function. g:ale_erlang_erlang_mode_indent_tabs_mode *g:ale_erlang_erlang_mode_indent_tabs_mode* *b:ale_erlang_erlang_mode_indent_tabs_mode* Type: `'nil'` or `'t'` Default: `'nil'` Indentation can insert tabs if this is non-`'nil'`. ------------------------------------------------------------------------------- erlang_ls *ale-erlang-erlang_ls* g:ale_erlang_erlang_ls_executable *g:ale_erlang_erlang_ls_executable* *b:ale_erlang_erlang_ls_executable* Type: |String| Default: `'erlang_ls'` This variable can be changed to specify the erlang_ls executable. g:ale_erlang_erlang_ls_log_dir *g:ale_erlang_erlang_ls_log_dir* *b:ale_erlang_erlang_ls_log_dir* Type: |String| Default: `''` If set this variable overrides default directory where logs will be written. g:ale_erlang_erlang_ls_log_level *g:ale_erlang_erlang_ls_log_level* *b:ale_erlang_erlang_ls_log_level* Type: |String| Default: `'info'` This variable can be changed to specify log level. ------------------------------------------------------------------------------- erlc *ale-erlang-erlc* g:ale_erlang_erlc_executable *g:ale_erlang_erlc_executable* *b:ale_erlang_erlc_executable* Type: |String| Default: `'erlc'` This variable can be changed to specify the erlc executable. g:ale_erlang_erlc_options *g:ale_erlang_erlc_options* *b:ale_erlang_erlc_options* Type: |String| Default: `''` This variable controls additional parameters passed to `erlc`, such as `-I` or `-pa`. ------------------------------------------------------------------------------- erlfmt *ale-erlang-erlfmt* g:ale_erlang_erlfmt_executable *g:ale_erlang_erlfmt_executable* *b:ale_erlang_erlfmt_executable* Type: |String| Default: `'erlfmt'` This variable can be changed to specify the erlfmt executable. g:ale_erlang_erlfmt_options *g:ale_erlang_erlfmt_options* *b:ale_erlang_erlfmt_options* Type: |String| Default: `''` This variable controls additional parameters passed to `erlfmt`, such as `--insert-pragma` or `--print-width`. ------------------------------------------------------------------------------- syntaxerl *ale-erlang-syntaxerl* g:ale_erlang_syntaxerl_executable *g:ale_erlang_syntaxerl_executable* *b:ale_erlang_syntaxerl_executable* Type: |String| Default: `'syntaxerl'` This variable can be changed to specify the syntaxerl executable. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-eruby.txt000066400000000000000000000060611476501472200154620ustar00rootroot00000000000000=============================================================================== ALE Eruby Integration *ale-eruby-options* There are four linters for `eruby` files: - `erb` - `erblint` - `erubis` - `erubi` - `htmlbeautifier` - `ruumba` `erb` is in the Ruby standard library and is mostly universal. `erubis` is the default parser in Rails between 3.0 and 5.1. `erubi` is the default in Rails 5.1 and later. `ruumba` can extract Ruby from eruby files and run rubocop on the result. To selectively enable a subset, see |g:ale_linters|. =============================================================================== erb-formatter *ale-eruby-erbformatter* g:ale_eruby_erbformatter_executable *g:ale_eruby_erbformatter_executable* *b:ale_eruby_erbformatter_executable* Type: |String| Default: `'erb-formatter'` Override the invoked erb-formatter binary. This is useful for running erb-formatter from binstubs or a bundle. =============================================================================== erblint *ale-eruby-erblint* g:ale_eruby_erblint_executable *g:ale_eruby_erblint_executable* *b:ale_eruby_erblint_executable* Type: |String| Default: `'erblint'` Override the invoked erblint binary. This is useful for running erblint from binstubs or a bundle. g:ale_eruby_erblint_options *g:ale_ruby_erblint_options* *b:ale_ruby_erblint_options* Type: |String| Default: `''` This variable can be change to modify flags given to erblint. =============================================================================== htmlbeautifier *ale-eruby-htmlbeautifier* g:ale_eruby_htmlbeautifier_executable *g:ale_eruby_htmlbeautifier_executable* *b:ale_eruby_htmlbeautifier_executable* Type: |String| Default: `'htmlbeautifier'` Override the invoked htmlbeautifier binary. This is useful for running htmlbeautifier from binstubs or a bundle. =============================================================================== ruumba *ale-eruby-ruumba* g:ale_eruby_ruumba_executable *g:ale_eruby_ruumba_executable* *b:ale_eruby_ruumba_executable* Type: |String| Default: `'ruumba'` Override the invoked ruumba binary. This is useful for running ruumba from binstubs or a bundle. g:ale_eruby_ruumba_options *g:ale_ruby_ruumba_options* *b:ale_ruby_ruumba_options* Type: |String| Default: `''` This variable can be change to modify flags given to ruumba. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-fish.txt000066400000000000000000000025251476501472200152660ustar00rootroot00000000000000=============================================================================== ALE Fish Integration *ale-fish-options* Lints fish files using `fish -n`. Note that `fish -n` is not foolproof: it sometimes gives false positives or errors that are difficult to parse without more context. This integration skips displaying errors if an error message is not found. If ALE is not showing any errors but your file does not run as expected, run `fish -n ` from the command line. =============================================================================== fish_indent *ale-fish-fish_indent* g:ale_fish_fish_indent_executable *g:ale_fish_fish_indent_executable* *b:ale_fish_fish_indent_executable* Type: |String| Default: `'fish_indent'` This variable can be changed to use a different executable for fish_indent. g:ale_fish_fish_indent_options *g:ale_fish_fish_indent_options* *b:ale_fish_fish_indent_options* Type: |String| Default: `''` This variable can be set to pass additional options to fish_indent. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-fortran.txt000066400000000000000000000041621476501472200160070ustar00rootroot00000000000000=============================================================================== ALE Fortran Integration *ale-fortran-options* =============================================================================== gcc *ale-fortran-gcc* g:ale_fortran_gcc_executable *g:ale_fortran_gcc_executable* *b:ale_fortran_gcc_executable* Type: |String| Default: `'gcc'` This variable can be changed to modify the executable used for checking Fortran code with GCC. g:ale_fortran_gcc_options *g:ale_fortran_gcc_options* *b:ale_fortran_gcc_options* Type: |String| Default: `'-Wall'` This variable can be changed to modify flags given to gcc. g:ale_fortran_gcc_use_free_form *g:ale_fortran_gcc_use_free_form* *b:ale_fortran_gcc_use_free_form* Type: |Number| Default: `1` When set to `1`, the `-ffree-form` flag will be used for GCC, to check files with the free form layout. When set to `0`, `-ffixed-form` will be used instead, for checking files with fixed form layouts. =============================================================================== language_server *ale-fortran-language-server* g:ale_fortran_language_server_executable *g:ale_fortran_language_server_executable* *b:ale_fortran_language_server_executable* Type: |String| Default: `'fortls'` This variable can be changed to modify the executable used for the Fortran Language Server. g:ale_fortran_language_server_use_global *g:ale_fortran_language_server_use_global* *b:ale_fortran_language_server_use_global* Type: |Number| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-fountain.txt000066400000000000000000000004321476501472200161530ustar00rootroot00000000000000=============================================================================== ALE Fountain Integration *ale-fountain-options* =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-fuse.txt000066400000000000000000000017301476501472200152740ustar00rootroot00000000000000=============================================================================== ALE FusionScript Integration *ale-fuse-options* =============================================================================== fusion-lint *ale-fuse-fusionlint* g:ale_fusion_fusionlint_executable *g:ale_fuse_fusionlint_executable* *b:ale_fuse_fusionlint_executable* Type: |String| Default: `'fusion-lint'` This variable can be changed to change the path to fusion-lint. g:ale_fuse_fusionlint_options *g:ale_fuse_fusionlint_options* *b:ale_fuse_fusionlint_options* Type: |String| Default: `''` This variable can be set to pass additional options to fusion-lint. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-gitcommit.txt000066400000000000000000000035231476501472200163300ustar00rootroot00000000000000=============================================================================== ALE Git Commit Integration *ale-gitcommit-options* =============================================================================== gitlint *ale-gitcommit-gitlint* g:ale_gitcommit_gitlint_executable *g:ale_gitcommit_gitlint_executable* *b:ale_gitcommit_gitlint_executable* Type: |String| Default: `'gitlint'` This variable can be changed to modify the executable used for gitlint. g:ale_gitcommit_gitlint_options *g:ale_gitcommit_gitlint_options* *b:ale_gitcommit_gitlint_options* Type: |String| Default: `''` This variable can be changed to add command-line arguments to the gitlint invocation. For example, you can specify the path to a configuration file. > let g:ale_gitcommit_gitlint_options = '-C /home/user/.config/gitlint.ini' < You can also disable particular error codes using this option. For example, you can ignore errors for git commits with a missing body. > let g:ale_gitcommit_gitlint_options = '--ignore B6' < g:ale_gitcommit_gitlint_use_global *g:ale_gitcommit_gitlint_use_global* *b:ale_gitcommit_gitlint_use_global* Type: |Number| Default: `get(g:, 'ale_use_global_executables', 0)` This variable controls whether or not ALE will search for gitlint in a virtualenv directory first. If this variable is set to `1`, then ALE will always use |g:ale_gitcommit_gitlint_executable| for the executable path. Both variables can be set with `b:` buffer variables instead. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-gleam.txt000066400000000000000000000023421476501472200154170ustar00rootroot00000000000000=============================================================================== ALE Gleam Integration *ale-gleam-options* *ale-integration-gleam* =============================================================================== gleam_format *ale-gleam-gleam_format* g:ale_gleam_gleam_format_executable *g:ale_gleam_gleam_format_executable* *b:ale_gleam_gleam_format_executable* Type: |String| Default: `'gleam'` This variable can be modified to change the executable path for `gleam format`. =============================================================================== gleamlsp *ale-gleam-gleamlsp* g:ale_gleam_gleamlsp_executable *g:ale_gleam_gleamlsp_executable* *b:ale_gleam_gleamlsp_executable* Type: |String| Default: `'gleam'` This variable can be modified to change the executable path for `gleamlsp`. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-glsl.txt000066400000000000000000000043441476501472200152770ustar00rootroot00000000000000=============================================================================== ALE GLSL Integration *ale-glsl-options* *ale-integration-glsl* =============================================================================== Integration Information Since Vim does not detect the glsl file types out-of-the-box, you need the runtime files for glsl from here: https://github.com/tikhomirov/vim-glsl Note that the current glslang-based linter expects glslangValidator in standard paths. If it's not installed system-wide you can set |g:ale_glsl_glslang_executable| to a specific path. =============================================================================== glslang *ale-glsl-glslang* g:ale_glsl_glslang_executable *g:ale_glsl_glslang_executable* *b:ale_glsl_glslang_executable* Type: |String| Default: `'glslangValidator'` This variable can be changed to change the path to glslangValidator. g:ale_glsl_glslang_options *g:ale_glsl_glslang_options* *b:ale_glsl_glslang_options* Type: |String| Default: `''` This variable can be set to pass additional options to glslangValidator. =============================================================================== glslls *ale-glsl-glslls* g:ale_glsl_glslls_executable *g:ale_glsl_glslls_executable* *b:ale_glsl_glslls_executable* Type: |String| Default: `'glslls'` This variable can be changed to change the path to glslls. See |ale-integrations-local-executables| g:ale_glsl_glslls_logfile *g:ale_glsl_glslls_logfile* *b:ale_glsl_glslls_logfile* Type: |String| Default: `''` Setting this variable to a writeable file path will enable logging to that file. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-go.txt000066400000000000000000000265561476501472200147540ustar00rootroot00000000000000=============================================================================== ALE Go Integration *ale-go-options* =============================================================================== Integration Information ALE enables `gofmt`, `gopls` and `go vet` by default. It also supports `staticcheck`, `go build, ``gosimple`, `golangserver`, and `golangci-lint. To enable `golangci-lint`, update |g:ale_linters| as appropriate. A possible configuration is to enable golangci-lint and `gofmt: > " Enable all of the linters you want for Go. let g:ale_linters = {'go': ['golangci-lint', 'gofmt']} < g:ale_go_go_executable *g:ale_go_go_executable* *b:ale_go_go_executable* Type: |String| Default: `'go'` The executable that will be run for the `gobuild` and `govet` linters, and the `gomod` fixer. g:ale_go_go111module *g:ale_go_go111module* *b:ale_go_go111module* Type: |String| Default: `''` Override the value of the `$GO111MODULE` environment variable for golang tools. =============================================================================== bingo *ale-go-bingo* g:ale_go_bingo_executable *g:ale_go_bingo_executable* *b:ale_go_bingo_executable* Type: |String| Default: `'bingo'` Location of the bingo binary file. g:ale_go_bingo_options *g:ale_go_bingo_options* *b:ale_go_bingo_options* Type: |String| Default: `''` =============================================================================== cspell *ale-go-cspell* See |ale-cspell-options| =============================================================================== gobuild *ale-go-gobuild* g:ale_go_gobuild_options *g:ale_go_gobuild_options* *b:ale_go_gobuild_options* Type: |String| Default: `''` This variable can be set to pass additional options to the gobuild linter. They are injected directly after "go test". =============================================================================== gofmt *ale-go-gofmt* g:ale_go_gofmt_options *g:ale_go_gofmt_options* *b:ale_go_gofmt_options* Type: |String| Default: `''` This variable can be set to pass additional options to the gofmt fixer. =============================================================================== gofumpt *ale-go-gofumpt* g:ale_go_gofumpt_executable *g:ale_go_gofumpt_executable* *b:ale_go_gofumpt_executable* Type: |String| Default: `'gofumpt'` Executable to run to use as the gofumpt fixer. g:ale_go_gofumpt_options *g:ale_go_gofumpt_options* *b:ale_go_gofumpt_options* Type: |String| Default: `''` Options to pass to the gofumpt fixer. =============================================================================== golangci-lint *ale-go-golangci-lint* `golangci-lint` is a `lint_file` linter, which only lints files that are written to disk. This differs from the default behavior of linting the buffer. See: |ale-lint-file| g:ale_go_golangci_lint_executable *g:ale_go_golangci_lint_executable* *b:ale_go_golangci_lint_executable* Type: |String| Default: `'golangci-lint'` The executable that will be run for golangci-lint. g:ale_go_golangci_lint_options *g:ale_go_golangci_lint_options* *b:ale_go_golangci_lint_options* Type: |String| Default: `''` This variable can be changed to alter the command-line arguments to the golangci-lint invocation. g:ale_go_golangci_lint_package *g:ale_go_golangci_lint_package* *b:ale_go_golangci_lint_package* Type: |Number| Default: `0` When set to `1`, the whole Go package will be checked instead of only the current file. =============================================================================== golangserver *ale-go-golangserver* g:ale_go_langserver_executable *g:ale_go_langserver_executable* *b:ale_go_langserver_executable* Type: |String| Default: `'go-langserver'` Location of the go-langserver binary file. g:ale_go_langserver_options *g:ale_go_langserver_options* *b:ale_go_langserver_options* Type: |String| Default: `''` Additional options passed to the go-langserver command. Note that the `-gocodecompletion` option is ignored because it is handled automatically by the |g:ale_completion_enabled| variable. =============================================================================== golines *ale-go-golines* g:ale_go_golines_executable *g:ale_go_lines_executable* *b:ale_go_lines_executable* Type: |String| Default: `'golines'` Location of the golines binary file g:ale_go_golines_options *g:ale_go_golines_options* *b:ale_go_golines_options* Type: |String| Default: `''` Additional options passed to the golines command. By default golines has --max-length=100 (lines above 100 characters will be wrapped) =============================================================================== gopls *ale-go-gopls* gopls is the official Go language server, and is enabled for use with ALE by default. To install the latest stable version of `gopls` to your `$GOPATH`, try the following command: > GO111MODULE=on go get golang.org/x/tools/gopls@latest < If `$GOPATH` is readable by ALE, it should probably work without you having to do anything else. See the `gopls` README file for more information: https://github.com/golang/tools/blob/master/gopls/README.md g:ale_go_gopls_executable *g:ale_go_gopls_executable* *b:ale_go_gopls_executable* Type: |String| Default: `'gopls'` See |ale-integrations-local-executables| ALE will search for `gopls` in locally installed directories first by default, and fall back on a globally installed `gopls` if it can't be found otherwise. g:ale_go_gopls_options *g:ale_go_gopls_options* *b:ale_go_gopls_options* Type: |String| Default: `''` Command-line options passed to the gopls executable. See `gopls -h`. g:ale_go_gopls_fix_executable *g:ale_go_gopls_fix_executable* *b:ale_go_gopls_fix_executable* Type: |String| Default: `'gopls'` Executable to run to use as the gopls fixer. g:ale_go_gopls_fix_options *g:ale_go_gopls_fix_options* *b:ale_go_gopls_fix_options* Type: |String| Default: `''` Options to pass to the gopls fixer. g:ale_go_gopls_init_options *g:ale_go_gopls_init_options* *b:ale_go_gopls_init_options* Type: |Dictionary| Default: `{}` LSP initialization options passed to gopls. This can be used to configure the behaviour of gopls. Example: > let g:ale_go_gopls_init_options = {'ui.diagnostic.analyses': { \ 'composites': v:false, \ 'unusedparams': v:true, \ 'unusedresult': v:true, \ }} < For a full list of supported analyzers, see: https://github.com/golang/tools/blob/master/gopls/doc/analyzers.md g:ale_go_gopls_use_global *g:ale_go_gopls_use_global* *b:ale_go_gopls_use_global* Type: |String| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| =============================================================================== govet *ale-go-govet* g:ale_go_govet_options *g:ale_go_govet_options* *b:ale_go_govet_options* Type: |String| Default: `''` This variable can be set to pass additional options to the go vet linter. =============================================================================== revive *ale-go-revive* g:ale_go_revive_executable *g:ale_go_revive_executable* *b:ale_go_revive_executable* Type: |String| Default: `'revive'` This variable can be set to change the revive executable path. g:ale_go_revive_options *g:ale_go_revive_options* *b:ale_go_revive_options* Type: |String| Default: `''` This variable can be set to pass additional options to the revive =============================================================================== staticcheck *ale-go-staticcheck* g:ale_go_staticcheck_executable *g:ale_go_staticcheck_executable* *b:ale_go_staticcheck_executable* Type: |String| Default: `'staticcheck'` See |ale-integrations-local-executables| ALE will search for `staticcheck` in locally installed directories first by default, and fall back on a globally installed `staticcheck` if it can't be found otherwise. g:ale_go_staticcheck_options *g:ale_go_staticcheck_options* *b:ale_go_staticcheck_options* Type: |String| Default: `''` This variable can be set to pass additional options to the staticcheck linter. g:ale_go_staticcheck_lint_package *g:ale_go_staticcheck_lint_package* *b:ale_go_staticcheck_lint_package* Type: |Number| Default: `1` When set to `1`, the whole Go package will be checked instead of only the current file. g:ale_go_staticcheck_use_global *g:ale_go_staticcheck_use_global* *b:ale_go_staticcheck_use_global* Type: |String| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-graphql.txt000066400000000000000000000017711476501472200157750ustar00rootroot00000000000000=============================================================================== ALE GraphQL Integration *ale-graphql-options* =============================================================================== eslint *ale-graphql-eslint* The `eslint` linter for GraphQL uses the JavaScript options for `eslint`; see: |ale-javascript-eslint|. You will need the GraphQL ESLint plugin installed for this to work. =============================================================================== gqlint *ale-graphql-gqlint* =============================================================================== prettier *ale-graphql-prettier* See |ale-javascript-prettier| for information about the available options. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-groovy.txt000066400000000000000000000030461476501472200156610ustar00rootroot00000000000000=============================================================================== ALE Groovy Integration *ale-groovy-options* =============================================================================== Integration Information Linting and fixing of Groovy files is enabled with the integration of `npm-groovy-lint`. =============================================================================== npm-groovy-lint *ale-groovy-npm-groovy-lint* g:ale_groovy_npmgroovylint_executable *g:ale_groovy_npmgroovylint_executable* *b:ale_groovy_npmgroovylint_executable* Type: |String| Default: `'npm-groovy-lint'` Location of the npm-groovy-lint binary file. g:ale_groovy_npmgroovylint_options *g:ale_groovy_npmgroovylint_options* *b:ale_groovy_npmgroovylint_options* Type: |String| Default: `'--loglevel warning'` Additional npm-groovy-lint linter options. g:ale_groovy_npmgroovylint_fix_options *g:ale_groovy_npmgroovylint_fix_options* *b:ale_groovy_npmgroovylint_fix_options* Type: |String| Default: `'--fix'` This variable can be used to configure fixing with npm-groovy-lint. It must contain either `--fix` or `--format` for the fixer to work. See `npm-groovy-lint --help` for more information on possible fix rules. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-hack.txt000066400000000000000000000036241476501472200152440ustar00rootroot00000000000000=============================================================================== ALE Hack Integration *ale-hack-options* *ale-integration-hack* HHAST is disabled by default, as it executes code in the project root. Currently linters must be enabled globally. HHAST can be enabled with: > let g:ale_linters = {'hack': ['hack', 'hhast']} < =============================================================================== hack *ale-hack-hack* g:ale_hack_hack_executable *g:ale_hack_hack_executable* *b:ale_hack_hack_executable* Type: |String| Default: `'hh_client'` This variable can be set to use a specific executable to interact with the Hack typechecker. =============================================================================== hackfmt *ale-hack-hackfmt* g:ale_hack_hackfmt_options *g:ale_hack_hackfmt_options* *b:ale_hack_hackfmt_options* Type: |String| Default: `''` This variable can be set to pass additional options to the hackfmt fixer. =============================================================================== hhast *ale-hack-hhast* g:ale_hack_hhast_executable *g:ale_hack_hhast_executable* *b:ale_hack_hhast_executable* Type: |String| Default: `'vendor/bin/hhast-lint'` This variable can be set to use a specific executable to interact with the Hack typechecker. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-handlebars.txt000066400000000000000000000024761476501472200164450ustar00rootroot00000000000000=============================================================================== ALE Handlebars Integration *ale-handlebars-options* =============================================================================== prettier *ale-handlebars-prettier* See |ale-javascript-prettier| for information about the available options. Uses glimmer parser by default. =============================================================================== ember-template-lint *ale-handlebars-embertemplatelint* g:ale_handlebars_embertemplatelint_executable *g:ale_handlebars_embertemplatelint_executable* *b:ale_handlebars_embertemplatelint_executable* Type: |String| Default: `'ember-template-lint'` See |ale-integrations-local-executables| g:ale_handlebars_embertemplatelint_use_global *g:ale_handlebars_embertemplatelint_use_global* *b:ale_handlebars_embertemplatelint_use_global* Type: |Number| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-haskell.txt000066400000000000000000000227211476501472200157600ustar00rootroot00000000000000=============================================================================== ALE Haskell Integration *ale-haskell-options* =============================================================================== brittany *ale-haskell-brittany* g:ale_haskell_brittany_executable *g:ale_haskell_brittany_executable* *b:ale_haskell_brittany_executable* Type: |String| Default: `'brittany'` This variable can be changed to use a different executable for brittany. =============================================================================== cspell *ale-haskell-cspell* See |ale-cspell-options| =============================================================================== floskell *ale-haskell-floskell* g:ale_haskell_floskell_executable *g:ale_haskell_floskell_executable* *b:ale_haskell_floskell_executable* Type: |String| Default: `'floskell'` This variable can be changed to use a different executable for floskell. =============================================================================== ghc *ale-haskell-ghc* g:ale_haskell_ghc_options *g:ale_haskell_ghc_options* *b:ale_haskell_ghc_options* Type: |String| Default: `'-fno-code -v0'` This variable can be changed to modify flags given to ghc. =============================================================================== ghc-mod *ale-haskell-ghc-mod* g:ale_haskell_ghc_mod_executable *g:ale_haskell_ghc_mod_executable* *b:ale_haskell_ghc_mod_executable* Type: |String| Default: `'ghc-mod'` This variable can be changed to use a different executable for ghc-mod. =============================================================================== cabal-ghc *ale-haskell-cabal-ghc* g:ale_haskell_cabal_ghc_options *g:ale_haskell_cabal_ghc_options* *b:ale_haskell_cabal_ghc_options* Type: |String| Default: `'-fno-code -v0'` This variable can be changed to modify flags given to ghc through cabal exec. =============================================================================== hdevtools *ale-haskell-hdevtools* g:ale_haskell_hdevtools_executable *g:ale_haskell_hdevtools_executable* *b:ale_haskell_hdevtools_executable* Type: |String| Default: `'hdevtools'` This variable can be changed to use a different executable for hdevtools. g:ale_haskell_hdevtools_options *g:ale_haskell_hdevtools_options* *b:ale_haskell_hdevtools_options* Type: |String| Default: `get(g:, 'hdevtools_options', '-g -Wall')` This variable can be changed to modify flags given to hdevtools. The hdevtools documentation recommends setting GHC options for `hdevtools` with `g:hdevtools_options`. ALE will use the value of `g:hdevtools_options` for the value of `g:ale_haskell_hdevtools_options` by default, so this option can be respected and overridden specifically for ALE. =============================================================================== hfmt *ale-haskell-hfmt* g:ale_haskell_hfmt_executable *g:ale_haskell_hfmt_executable* *b:ale_haskell_hfmt_executable* Type: |String| Default: `'hfmt'` This variable can be changed to use a different executable for hfmt. =============================================================================== hindent *ale-haskell-hindent* g:ale_haskell_hindent_executable *g:ale_haskell_hindent_executable* *b:ale_haskell_hindent_executable* Type: |String| Default: `'hindent'` This variable can be changed to use a different executable for hindent. =============================================================================== hlint *ale-haskell-hlint* g:ale_haskell_hlint_executable *g:ale_haskell_hlint_executable* *b:ale_haskell_hlint_executable* Type: |String| Default: `'hlint'` This variable can be changed to use a different executable for hlint. g:ale_haskell_hlint_options g:ale_haskell_hlint_options b:ale_haskell_hlint_options Type: |String| Default: `''` This variable can be used to pass extra options to the underlying hlint executable. =============================================================================== hls *ale-haskell-hls* g:ale_haskell_hls_executable *g:ale_haskell_hls_executable* *b:ale_haskell_hls_executable* Type: |String| Default: `'haskell-language-server-wrapper'` This variable can be changed to use a different executable for the haskell language server. g:ale_haskell_hls_config *g:ale_haskell_hls_config* *b:ale_haskell_hls_config* Type: |Dictionary| Default: `{}` Dictionary with configuration settings for HLS. For example, to see more completions: > let g:ale_haskell_hls_config = {'haskell': {'maxCompletions': 250}} < Refer to HLS documentation for possible settings: https://haskell-language-server.readthedocs.io/en/latest/configuration.html#language-specific-server-options =============================================================================== stack-build *ale-haskell-stack-build* g:ale_haskell_stack_build_options *g:ale_haskell_stack_build_options* *b:ale_haskell_stack_build_options* Type: |String| Default: `'--fast'` We default to using `'--fast'`. Since Stack generates binaries, your programs will be slower unless you separately rebuild them outside of ALE. =============================================================================== stack-ghc *ale-haskell-stack-ghc* g:ale_haskell_stack_ghc_options *g:ale_haskell_stack_ghc_options* *b:ale_haskell_stack_ghc_options* Type: |String| Default: `'-fno-code -v0'` This variable can be changed to modify flags given to ghc through `stack ghc` =============================================================================== stylish-haskell *ale-haskell-stylish-haskell* g:ale_haskell_stylish_haskell_executable *g:ale_haskell_stylish_haskell_executable* *b:ale_haskell_stylish_haskell_executable* Type: |String| Default: `'stylish-haskell'` This variable can be changed to use a different executable for stylish-haskell. =============================================================================== hie *ale-haskell-hie* g:ale_haskell_hie_executable *g:ale_haskell_hie_executable* *b:ale_haskell_hie_executable* Type: |String| Default: `'hie'` This variable can be changed to use a different executable for the haskell ide engine. i.e. `'hie-wrapper'` =============================================================================== ormolu *ale-haskell-ormolu* g:ale_haskell_ormolu_executable *g:ale_haskell_ormolu_executable* *b:ale_haskell_ormolu_executable* Type: |String| Default: `'ormolu'` This variable can be changed to use a different executable for ormolu. g:ale_haskell_ormolu_options *g:ale_haskell_ormolu_options* *b:ale_haskell_ormolu_options* Type: |String| Default: `''` This variable can be used to pass extra options to the underlying ormolu executable. =============================================================================== fourmolu *ale-haskell-fourmolu* g:ale_haskell_fourmolu_executable *g:ale_haskell_fourmolu_executable* *b:ale_haskell_fourmolu_executable* Type: |String| Default: `'fourmolu'` This variable can be changed to use a different executable for fourmolu. g:ale_haskell_fourmolu_options *g:ale_haskell_fourmolu_options* *b:ale_haskell_fourmolu_options* Type: |String| Default: `''` This variable can be used to pass extra options to the underlying fourmolu executable. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-hcl.txt000066400000000000000000000013631476501472200151020ustar00rootroot00000000000000=============================================================================== ALE HCL Integration *ale-hcl-options* =============================================================================== packer-fmt *ale-hcl-packer-fmt* See |ale-packer-fmt-fixer| for information about the available options. =============================================================================== terraform-fmt *ale-hcl-terraform-fmt* See |ale-terraform-fmt-fixer| for information about the available options. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-help.txt000066400000000000000000000007301476501472200152610ustar00rootroot00000000000000=============================================================================== ALE Help Integration *ale-help-options* =============================================================================== cspell *ale-help-cspell* See |ale-cspell-options| =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-html.txt000066400000000000000000000204331476501472200152770ustar00rootroot00000000000000=============================================================================== ALE HTML Integration *ale-html-options* =============================================================================== angular *ale-html-angular* ALE supports language server features for Angular. You can install it via `npm`: > $ npm install --save-dev @angular/language-server < Angular 11 and up are supported. g:ale_html_angular_executable *g:ale_html_angular_executable* *b:ale_html_angular_executable* Type: |String| Default: `'ngserver'` See |ale-integrations-local-executables| g:ale_html_angular_use_global *g:ale_html_angular_use_global* *b:ale_html_angular_use_global* Type: |String| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| =============================================================================== cspell *ale-html-cspell* See |ale-cspell-options| =============================================================================== djlint *ale-html-djlint* g:ale_html_djlint_executable *g:ale_html_djlint_executable* *b:ale_html_djlint_executable* Type: |String| Default: `'djlint'` See |ale-integrations-local-executables| g:ale_html_djlint_options *g:ale_html_djlint_options* *b:ale_html_djlint_options* Type: |String| Default: `''` This variable can be changed to modify flags given to djlint. =============================================================================== fecs *ale-html-fecs* `fecs` options for HTML are the same as the options for JavaScript, and both of them read `./.fecsrc` as the default configuration file. See: |ale-javascript-fecs|. =============================================================================== html-beautify *ale-html-beautify* g:ale_html_beautify_executable *g:ale_html_beautify_executable* *b:ale_html_beautify_executable* Type: |String| Default: `'html-beautify'` See |ale-integrations-local-executables| g:ale_html_beautify_options *g:ale_html_beautify_options* *b:ale_html_beautify_options* Type: |String| Default: `''` This variable can be changed to modify flags given to html-beautify. g:ale_html_beautify_use_global *g:ale_html_beautify_use_global* *b:ale_html_beautify_use_global* Type: |String| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| =============================================================================== htmlhint *ale-html-htmlhint* g:ale_html_htmlhint_executable *g:ale_html_htmlhint_executable* *b:ale_html_htmlhint_executable* Type: |String| Default: `'htmlhint'` See |ale-integrations-local-executables| g:ale_html_htmlhint_options *g:ale_html_htmlhint_options* *b:ale_html_htmlhint_options* Type: |String| Default: `''` This variable can be changed to modify flags given to HTMLHint. g:ale_html_htmlhint_use_global *g:ale_html_htmlhint_use_global* *b:ale_html_htmlhint_use_global* Type: |String| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| =============================================================================== prettier *ale-html-prettier* See |ale-javascript-prettier| for information about the available options. =============================================================================== rustywind *ale-html-rustywind* g:ale_html_rustywind_executable *g:ale_html_rustywind_executable* *b:ale_html_rustywind_executable* Type: |String| Default: `'rustywind'` See |ale-integrations-local-executables| g:ale_html_rustywind_options *g:ale_html_rustywind_options* *b:ale_html_rustywind_options* Type: |String| Default: `''` This variable can be changed to modify flags given to rustywind. =============================================================================== stylelint *ale-html-stylelint* g:ale_html_stylelint_executable *g:ale_html_stylelint_executable* *b:ale_html_stylelint_executable* Type: |String| Default: `'stylelint'` See |ale-integrations-local-executables| g:ale_html_stylelint_options *g:ale_html_stylelint_options* *b:ale_html_stylelint_options* Type: |String| Default: `''` This variable can be set to pass additional options to stylelint. g:ale_html_stylelint_use_global *g:ale_html_stylelint_use_global* *b:ale_html_stylelint_use_global* Type: |String| Default: `0` See |ale-integrations-local-executables| =============================================================================== tidy *ale-html-tidy* `tidy` is a console application which corrects and cleans up HTML and XML documents by fixing markup errors and upgrading legacy code to modern standards. Note: `/usr/bin/tidy` on macOS (installed by default) is too old. It was released on 31 Oct 2006. It does not consider modern HTML specs (HTML5) and shows outdated warnings. So |ale| ignores `/usr/bin/tidy` on macOS. To use `tidy` on macOS, please install the latest version with Homebrew: > $ brew install tidy-html5 < `/usr/local/bin/tidy` is installed. g:ale_html_tidy_executable *g:ale_html_tidy_executable* *b:ale_html_tidy_executable* Type: |String| Default: `'tidy'` This variable can be changed to change the path to tidy. g:ale_html_tidy_options *g:ale_html_tidy_options* *b:ale_html_tidy_options* Type: |String| Default: `'-q -e -language en'` This variable can be changed to change the arguments provided to the executable. ALE will attempt to automatically detect the appropriate file encoding to provide to html-tidy, and fall back to UTF-8 when encoding detection fails. The recognized file encodings are as follows: ascii, big5, cp1252 (win1252), cp850 (ibm858), cp932 (shiftjis), iso-2022-jp (iso-2022), latin1, macroman (mac), sjis (shiftjis), utf-16le, utf-16, utf-8 g:ale_html_tidy_use_global *g:html_tidy_use_global* Type: |Number| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| =============================================================================== vscodehtml *ale-html-vscode* Website: https://github.com/hrsh7th/vscode-langservers-extracted Installation ------------------------------------------------------------------------------- Install VSCode html language server either globally or locally: > npm install -g vscode-langservers-extracted < =============================================================================== write-good *ale-html-write-good* See |ale-write-good-options| =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-hurl.txt000066400000000000000000000012571476501472200153100ustar00rootroot00000000000000=============================================================================== ALE Hurl Integration *ale-hurl-options* =============================================================================== hurlfmt *ale-hurl-hurlfmt* g:ale_hurl_hurlfmt_executable *g:ale_hurl_hurlfmt_executable* *b:ale_hurl_hurlfmt_executable* Type: |String| Default: `'hurlfmt'` Override the invoked hurlfmt binary. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-idris.txt000066400000000000000000000017571476501472200154550ustar00rootroot00000000000000=============================================================================== ALE Idris Integration *ale-idris-options* =============================================================================== idris *ale-idris-idris* g:ale_idris_idris_executable *g:ale_idris_idris_executable* *b:ale_idris_idris_executable* Type: |String| Default: `'idris'` This variable can be changed to change the path to idris. g:ale_idris_idris_options *g:ale_idris_idris_options* *b:ale_idris_idris_options* Type: |String| Default: `'--total --warnpartial --warnreach --warnipkg'` This variable can be changed to modify flags given to idris. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-ink.txt000066400000000000000000000027421476501472200151170ustar00rootroot00000000000000=============================================================================== ALE Ink Integration *ale-ink-options* =============================================================================== ink-language-server *ale-ink-language-server* Ink Language Server (https://github.com/ephraim/ink-language-server) g:ale_ink_ls_executable g:ale_ink_ls_executable b:ale_ink_ls_executable Type: |String| Default: `'ink-language-server'` Ink language server executable. g:ale_ink_ls_initialization_options g:ale_ink_ls_initialization_options b:ale_ink_ls_initialization_options Type: |Dictionary| Default: `{}` Dictionary containing configuration settings that will be passed to the language server at startup. For certain platforms and certain story structures, the defaults will suffice. However, many projects will need to change these settings - see the ink-language-server website for more information. An example of setting non-default options: { \ 'ink': { \ 'mainStoryPath': 'init.ink', \ 'inklecateExecutablePath': '/usr/local/bin/inklecate', \ 'runThroughMono': v:false \ } \} =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-inko.txt000066400000000000000000000017251476501472200152760ustar00rootroot00000000000000=============================================================================== ALE Inko Integration *ale-inko-options* *ale-integration-inko* =============================================================================== Integration Information Currently, the only supported linter for Inko is the Inko compiler itself. =============================================================================== inko *ale-inko-inko* g:ale_inko_inko_executable *g:ale_inko_inko_executable* *b:ale_inko_inko_executable* Type: |String| Default: `'inko'` This variable can be modified to change the executable path for `inko`. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-ispc.txt000066400000000000000000000017151476501472200152730ustar00rootroot00000000000000=============================================================================== ALE ISPC Integration *ale-ispc-options* =============================================================================== ispc *ale-ispc-ispc* g:ale_ispc_ispc_executable *g:ale_ispc_ispc_executable* *b:ale_ispc_ispc_executable* Type: |String| Default: `'ispc'` This variable can be changed to use a different executable for ispc. g:ale_ispc_ispc_options *g:ale_ispc_ispc_options* *b:ale_ispc_ispc_options* Type: |String| Default: `''` This variable can be changed to modify flags given to ispc. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-java.txt000066400000000000000000000246651476501472200152670ustar00rootroot00000000000000=============================================================================== ALE Java Integration *ale-java-options* =============================================================================== checkstyle *ale-java-checkstyle* g:ale_java_checkstyle_config *g:ale_java_checkstyle_config* *b:ale_java_checkstyle_config* Type: |String| Default: `'/google_checks.xml'` A path to a checkstyle configuration file. If a configuration file is specified with |g:ale_java_checkstyle_options|, it will be preferred over this setting. The path to the configuration file can be an absolute path or a relative path. ALE will search for the relative path in parent directories. g:ale_java_checkstyle_executable *g:ale_java_checkstyle_executable* *b:ale_java_checkstyle_executable* Type: |String| Default: `'checkstyle'` This variable can be changed to modify the executable used for checkstyle. g:ale_java_checkstyle_options *g:ale_java_checkstyle_options* *b:ale_java_checkstyle_options* Type: |String| Default: `''` This variable can be changed to modify flags given to checkstyle. If a configuration file is specified with `-c`, it will be used instead of configuration files set with |g:ale_java_checkstyle_config|. =============================================================================== clang-format *ale-java-clangformat* See |ale-c-clangformat| for information about the available options. Note that the C options are also used for Java. =============================================================================== cspell *ale-java-cspell* See |ale-cspell-options| =============================================================================== javac *ale-java-javac* g:ale_java_javac_classpath *g:ale_java_javac_classpath* *b:ale_java_javac_classpath* Type: |String| or |List| Default: `''` This variable can be set to change the global classpath for Java. g:ale_java_javac_executable *g:ale_java_javac_executable* *b:ale_java_javac_executable* Type: |String| Default: `'javac'` This variable can be set to change the executable path used for javac. g:ale_java_javac_options *g:ale_java_javac_options* *b:ale_java_javac_options* Type: |String| Default: `''` This variable can be set to pass additional options to javac. g:ale_java_javac_sourcepath *g:ale_java_javac_sourcepath* *b:ale_java_javac_sourcepath* Type: |String| or |List| Default: `''` This variable can set multiple source code paths, the source code path is a relative path (relative to the project root directory). Example: String type: Note that the unix system separator is a colon(`:`) window system is a semicolon(`;`). > let g:ale_java_javac_sourcepath = 'build/gen/source/xx/main:build/gen/source' < List type: > let g:ale_java_javac_sourcepath = [ \ 'build/generated/source/querydsl/main', \ 'target/generated-sources/source/querydsl/main' \ ] < =============================================================================== google-java-format *ale-java-google-java-format* g:ale_java_google_java_format_executable *g:ale_java_google_java_format_executable* *b:ale_java_google_java_format_executable* Type: |String| Default: `'google-java-format'` See |ale-integrations-local-executables| g:ale_java_google_java_format_options *g:ale_java_google_java_format_options* *b:ale_java_google_java_format_options* Type: |String| Default: `''` This variable can be set to pass additional options =============================================================================== pmd *ale-java-pmd* g:ale_java_pmd_options *g:ale_java_pmd_options* *b:ale_java_pmd_options* Type: |String| Default: `'-R category/java/bestpractices'` This variable can be changed to modify flags given to PMD. Do not specify -f and -d. They are added automatically. =============================================================================== javalsp *ale-java-javalsp* To enable Java LSP linter you need to download and build the vscode-javac language server from https://github.com/georgewfraser/java-language-server. Before building the language server you need to install pre-requisites: npm, maven, and protobuf. You also need to have Java 13 and JAVA_HOME properly set. After downloading the source code and installing all pre-requisites you can build the language server with the included build.sh script: scripts/build.sh This will create launch scripts for Linux, Mac, and Windows in the dist folder within the repo: - lang_server_linux.sh - lang_server_mac.sh - lang_server_windows.sh To let ALE use this language server you need to set the g:ale_java_javalsp_executable variable to the absolute path of the launcher executable for your platform. g:ale_java_javalsp_executable *g:ale_java_javalsp_executable* *b:ale_java_javalsp_executable* Type: |String| Default: `''` This variable must be set to the absolute path of the language server launcher executable. For example: > let g:ale_java_javalsp_executable=/java-language-server/dist/lang_server_linux.sh < g:ale_java_javalsp_config *g:ale_java_javalsp_config* *b:ale_java_javalsp_config* Type: |Dictionary| Default: `{}` The javalsp linter automatically detects external dependencies for Maven and Gradle projects. In case the javalsp fails to detect some of them, you can specify them setting a dictionary to |g:ale_java_javalsp_config| variable. > let g:ale_java_javalsp_config = \ { \ 'java': { \ 'externalDependencies': [ \ 'junit:junit:jar:4.12:test', " Maven format \ 'junit:junit:4.1' " Gradle format \ ], \ 'classPath': [ \ 'lib/some-dependency.jar', \ '/android-sdk/platforms/android-28.jar' \ ] \ } \ } The Java language server will look for the dependencies you specify in `externalDependencies` array in your Maven and Gradle caches ~/.m2 and ~/.gradle. =============================================================================== eclipselsp *ale-java-eclipselsp* To enable Eclipse JDT LSP linter you need to clone and build the eclipse.jdt.ls language server from https://github.com/eclipse/eclipse.jdt.ls. Simply clone the source code repo and then build the plugin: ./mvnw clean verify Note: currently, the build can only run when launched with JDK 11. More recent versions can be used to run the server though. After build completes the files required to run the language server will be located inside the repository folder `eclipse.jdt.ls`. Please ensure to set |g:ale_java_eclipselsp_path| to the absolute path of that folder. You could customize compiler options and code assists of the server. Under your project folder, modify the file `.settings/org.eclipse.jdt.core.prefs` with options presented at https://help.eclipse.org/neon/topic/org.eclipse.jdt.doc.isv/reference/api/org/eclipse/jdt/core/JavaCore.html. g:ale_java_eclipselsp_path *g:ale_java_eclipselsp_path* *b:ale_java_eclipselsp_path* Type: |String| Default: `'$HOME/eclipse.jdt.ls'` Absolute path to the location of the eclipse.jdt.ls repository folder. Or if you have VSCode extension installed the absolute path to the VSCode extensions folder (e.g. $HOME/.vscode/extensions/redhat.java-0.4x.0 in Linux). g:ale_java_eclipselsp_executable *g:ale_java_eclipse_executable* *b:ale_java_eclipse_executable* Type: |String| Default: `'java'` This variable can be set to change the executable path used for java. g:ale_java_eclipselsp_config_path *g:ale_java_eclipse_config_path* *b:ale_java_eclipse_config_path* Type: |String| Default: `''` Set this variable to change the configuration directory path used by eclipselsp (e.g. `$HOME/.jdtls` in Linux). By default ALE will attempt to use the configuration within the installation directory. This setting is particularly useful when eclipselsp is installed in a non-writable directory like `/usr/share/java/jdtls`, as is the case when installed via system package. g:ale_java_eclipselsp_workspace_path *g:ale_java_eclipselsp_workspace_path* *b:ale_java_eclipselsp_workspace_path* Type: |String| Default: `''` If you have Eclipse installed it is a good idea to set this variable to the absolute path of the Eclipse workspace. If not set this value will be set to the parent folder of the project root. g:ale_java_eclipselsp_javaagent *g:ale_java_eclipselsp_javaagent* *b:ale_java_eclipselsp_javaagent* Type: |String| Default: `''` A variable to add java agent for annotation processing such as Lombok. If you have multiple java agent files, use space to separate them. For example: > let g:ale_java_eclipselsp_javaagent='/eclipse/lombok.jar /eclipse/jacoco.jar' < =============================================================================== uncrustify *ale-java-uncrustify* See |ale-c-uncrustify| for information about the available options. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-javascript.txt000066400000000000000000000320501476501472200164770ustar00rootroot00000000000000=============================================================================== ALE JavaScript Integration *ale-javascript-options* *ale-eslint-nested-configuration-files* For fixing files with ESLint, nested configuration files with `root: false` are not supported. This is because ALE fixes files by writing the contents of buffers to temporary files, and then explicitly sets the configuration file. Configuration files which are set explicitly must be root configuration files. If you are using nested configuration files, you should restructure your project so your configuration files use `extends` instead. See the ESLint documentation here: http://eslint.org/docs/user-guide/configuring#extending-configuration-files You should change the structure of your project from this: > /path/foo/.eslintrc.js # root: true /path/foo/bar/.eslintrc.js # root: false < To this: > /path/foo/.base-eslintrc.js # Base configuration here /path/foo/.eslintrc.js # extends: ["/path/foo/.base-eslintrc.js"] /path/foo/bar/.eslintrc.js # extends: ["/path/foo/.base-eslintrc.js"] < =============================================================================== biome *ale-javascript-biome* Check the docs over at |ale-typescript-biome|. =============================================================================== clang-format *ale-javascript-clangformat* See |ale-c-clangformat| for information about the available options. Note that the C options are also used for JavaScript. =============================================================================== cspell *ale-javascript-cspell* See |ale-cspell-options| =============================================================================== deno *ale-javascript-deno* Check the docs over at |ale-typescript-deno|. =============================================================================== dprint *ale-javascript-dprint* See |ale-dprint-options| and https://dprint.dev/plugins/typescript =============================================================================== eslint *ale-javascript-eslint* g:ale_javascript_eslint_executable *g:ale_javascript_eslint_executable* *b:ale_javascript_eslint_executable* Type: |String| Default: `'eslint'` See |ale-integrations-local-executables| g:ale_javascript_eslint_options *g:ale_javascript_eslint_options* *b:ale_javascript_eslint_options* Type: |String| Default: `''` This variable can be set to pass additional options to eslint. g:ale_javascript_eslint_use_global *g:ale_javascript_eslint_use_global* *b:ale_javascript_eslint_use_global* Type: |Number| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| g:ale_javascript_eslint_suppress_eslintignore *g:ale_javascript_eslint_suppress_eslintignore* *b:ale_javascript_eslint_suppress_eslintignore* Type: |Number| Default: `0` This variable can be set to `1` to disable warnings for files being ignored by eslint. g:ale_javascript_eslint_suppress_missing_config *g:ale_javascript_eslint_suppress_missing_config* *b:ale_javascript_eslint_suppress_missing_config* Type: |Number| Default: `0` This variable can be set to `1` to disable errors for missing eslint configuration files. When turning this option on, eslint will not report any problems when no configuration files are found. =============================================================================== fecs *ale-javascript-fecs* `fecs` is a lint tool for HTML/CSS/JavaScript, can be installed via: `$ npm install --save-dev fecs` And the configuration file is located at `./fecsrc`, see http://fecs.baidu.com for more options. g:ale_javascript_fecs_executable *g:ale_javascript_fecs_executable* *b:ale_javascript_fecs_executable* Type: |String| Default: `'fecs'` See |ale-integrations-local-executables| g:ale_javascript_fecs_use_global *g:ale_javascript_fecs_use_global* *b:ale_javascript_fecs_use_global* Type: |Number| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| =============================================================================== flow *ale-javascript-flow* g:ale_javascript_flow_executable *g:ale_javascript_flow_executable* *b:ale_javascript_flow_executable* Type: |String| Default: `'flow'` See |ale-integrations-local-executables| g:ale_javascript_flow_use_home_config *g:ale_javascript_flow_use_home_config* *b:ale_javascript_flow_use_home_config* Type: |Number| Default: `0` When set to `1`, ALE will allow Flow to be executed with configuration files from your home directory. ALE will not run Flow with home directory configuration files by default, as doing so can lead to Vim consuming all of your RAM and CPU power. g:ale_javascript_flow_use_global *g:ale_javascript_flow_use_global* *b:ale_javascript_flow_use_global* Type: |Number| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| g:ale_javascript_flow_use_respect_pragma *g:ale_javascript_flow_use_respect_pragma* *b:ale_javascript_flow_use_respect_pragma* Type: |Number| Default: `1` By default, ALE will use the `--respect-pragma` option for `flow`, so only files with the `@flow` pragma are checked by ALE. This option can be set to `0` to disable that behavior, so all files can be checked by `flow`. =============================================================================== importjs *ale-javascript-importjs* g:ale_javascript_importjs_executable *g:ale_javascript_importjs_executable* *b:ale_javascript_importjs_executable* Type: |String| Default: `'importjs'` =============================================================================== jscs *ale-javascript-jscs* g:ale_javascript_jscs_executable *g:ale_javascript_jscs_executable* *b:ale_javascript_jscs_executable* Type: |String| Default: `'jscs'` See |ale-integrations-local-executables| g:ale_javascript_jscs_use_global *g:ale_javascript_jscs_use_global* *b:ale_javascript_jscs_use_global* Type: |Number| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| =============================================================================== jshint *ale-javascript-jshint* g:ale_javascript_jshint_executable *g:ale_javascript_jshint_executable* *b:ale_javascript_jshint_executable* Type: |String| Default: `'jshint'` See |ale-integrations-local-executables| g:ale_javascript_jshint_use_global *g:ale_javascript_jshint_use_global* *b:ale_javascript_jshint_use_global* Type: |Number| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| =============================================================================== prettier *ale-javascript-prettier* g:ale_javascript_prettier_executable *g:ale_javascript_prettier_executable* *b:ale_javascript_prettier_executable* Type: |String| Default: `'prettier'` See |ale-integrations-local-executables| g:ale_javascript_prettier_options *g:ale_javascript_prettier_options* *b:ale_javascript_prettier_options* Type: |String| Default: `''` This variable can be set to pass additional options to prettier. g:ale_javascript_prettier_use_global *g:ale_javascript_prettier_use_global* *b:ale_javascript_prettier_use_global* Type: |Number| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| =============================================================================== prettier-eslint *ale-javascript-prettier-eslint* g:ale_javascript_prettier_eslint_executable *g:ale_javascript_prettier_eslint_executable* *b:ale_javascript_prettier_eslint_executable* Type: |String| Default: `'prettier-eslint'` See |ale-integrations-local-executables| g:ale_javascript_prettier_eslint_options *g:ale_javascript_prettier_eslint_options* *b:ale_javascript_prettier_eslint_options* Type: |String| Default: `''` This variable can be set to pass additional options to prettier-eslint. g:ale_javascript_prettier_eslint_use_global *g:ale_javascript_prettier_eslint_use_global* *b:ale_javascript_prettier_eslint_use_global* Type: |Number| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| =============================================================================== prettier-standard *ale-javascript-prettier-standard* g:ale_javascript_prettier_standard_executable *g:ale_javascript_prettier_standard_executable* *b:ale_javascript_prettier_standard_executable* Type: |String| Default: `'prettier-standard'` See |ale-integrations-local-executables| g:ale_javascript_prettier_standard_options *g:ale_javascript_prettier_standard_options* *b:ale_javascript_prettier_standard_options* Type: |String| Default: `''` This variable can be set to pass additional options to prettier-standard. g:ale_javascript_prettier_standard_use_global *g:ale_javascript_prettier_standard_use_global* *b:ale_javascript_prettier_standard_use_global* Type: |Number| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| =============================================================================== standard *ale-javascript-standard* g:ale_javascript_standard_executable *g:ale_javascript_standard_executable* *b:ale_javascript_standard_executable* Type: |String| Default: `'standard'` See |ale-integrations-local-executables| g:ale_javascript_standard_options *g:ale_javascript_standard_options* *b:ale_javascript_standard_options* Type: |String| Default: `''` This variable can be set to pass additional options to standard. g:ale_javascript_standard_use_global *g:ale_javascript_standard_use_global* *b:ale_javascript_standard_use_global* Type: |Number| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| =============================================================================== xo *ale-javascript-xo* g:ale_javascript_xo_executable *g:ale_javascript_xo_executable* *b:ale_javascript_xo_executable* Type: |String| Default: `'xo'` See |ale-integrations-local-executables| g:ale_javascript_xo_options *g:ale_javascript_xo_options* *b:ale_javascript_xo_options* Type: |String| Default: `''` This variable can be set to pass additional options to xo. g:ale_javascript_xo_use_global *g:ale_javascript_xo_use_global* *b:ale_javascript_xo_use_global* Type: |Number| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-json.txt000066400000000000000000000166531476501472200153150ustar00rootroot00000000000000=============================================================================== ALE JSON Integration *ale-json-options* =============================================================================== biome *ale-json-biome* Check the docs over at |ale-typescript-biome|. =============================================================================== clang-format *ale-json-clangformat* See |ale-c-clangformat| for information about the available options. Note that the C options are also used for JSON. =============================================================================== cspell *ale-json-cspell* See |ale-cspell-options| =============================================================================== dprint *ale-json-dprint* See |ale-dprint-options| and https://dprint.dev/plugins/json =============================================================================== eslint *ale-json-eslint* The `eslint` linter for JSON uses the JavaScript options for `eslint`; see: |ale-javascript-eslint|. You will need a JSON ESLint plugin installed for this to work. =============================================================================== fixjson *ale-json-fixjson* fixjson is a JSON file fixer/formatter for humans using (relaxed) JSON5. It provides: - Pretty-prints JSON input - Fixes various failures while humans writing JSON - Fixes trailing commas objects or arrays - Fixes missing commas for elements of objects or arrays - Adds quotes to keys in objects - Newlines in strings - Hex numbers - Fixes single quotes to double quotes You can install it using npm: > $ npm install -g fixjson < ALE provides fixjson integration as a fixer. See |ale-fix|. g:ale_json_fixjson_executable *g:ale_json_fixjson_executable* *b:ale_json_fixjson_executable* Type: |String| Default: `'fixjson'` The executable that will be run for fixjson. g:ale_json_fixjson_options *g:ale_json_fixjson_options* *b:ale_json_fixjson_options* Type: |String| Default: `''` This variable can add extra options to the command executed for running fixjson. g:ale_json_fixjson_use_global *g:ale_json_fixjson_use_global* *b:ale_json_fixjson_use_global* Type: |Number| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| =============================================================================== pytool *ale-json-pytool* Use python's json.tool module to reformat json. g:ale_json_pytool_executable *g:ale_json_pytool_executable* *b:ale_json_pytool_executable* Type: |String| Default: `'python'` The python executable that run to use its json.tool module. This fixer requires python 3, which includes the json module. g:ale_json_pytool_options *g:ale_json_pytool_options* *b:ale_json_pytool_options* Type: |String| Default: `''` These options are passed to the json.tool module. Example: > let g:ale_json_pytool_options = '--sort-keys --indent 2' < See docs for all options: https://docs.python.org/3/library/json.html#module-json.tool g:ale_json_pytool_use_global *g:ale_json_pytool_use_global* *b:ale_json_pytool_use_global* Type: |Number| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| =============================================================================== jsonlint *ale-json-jsonlint* g:ale_json_jsonlint_executable *g:ale_json_jsonlint_executable* *b:ale_json_jsonlint_executable* Type: |String| Default: `'jsonlint'` The executable that will be run for jsonlint. g:ale_json_jsonlint_use_global *g:ale_json_jsonlint_use_global* *b:ale_json_jsonlint_use_global* Type: |Number| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| =============================================================================== jq *ale-json-jq* g:ale_json_jq_executable *g:ale_json_jq_executable* *b:ale_json_jq_executable* Type: |String| Default: `'jq'` This option can be changed to change the path for `jq`. g:ale_json_jq_options *g:ale_json_jq_options* *b:ale_json_jq_options* Type: |String| Default: `''` This option can be changed to pass extra options to `jq`. g:ale_json_jq_filters *g:ale_json_jq_filters* *b:ale_json_jq_filters* Type: |String| Default: `'.'` This option can be changed to pass custom filters to `jq`. =============================================================================== prettier *ale-json-prettier* See |ale-javascript-prettier| for information about the available options. =============================================================================== spectral *ale-json-spectral* Website: https://github.com/stoplightio/spectral Installation ------------------------------------------------------------------------------- Install spectral either globally or locally: > npm install @stoplight/spectral -g # global npm install @stoplight/spectral # local < Options ------------------------------------------------------------------------------- g:ale_json_spectral_executable *g:ale_json_spectral_executable* *b:ale_json_spectral_executable* Type: |String| Default: `'spectral'` This variable can be set to change the path to spectral. g:ale_json_spectral_use_global *g:ale_json_spectral_use_global* *b:ale_json_spectral_use_global* Type: |String| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| =============================================================================== vscodejson *ale-json-vscode* Website: https://github.com/hrsh7th/vscode-langservers-extracted Installation ------------------------------------------------------------------------------- Install VSCode json language server either globally or locally: > npm install -g vscode-langservers-extracted < =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-json5.txt000066400000000000000000000011451476501472200153700ustar00rootroot00000000000000=============================================================================== ALE JSON5 Integration *ale-json5-options* =============================================================================== eslint *ale-json5-eslint* The `eslint` linter for JSON uses the JavaScript options for `eslint`; see: |ale-javascript-eslint|. You will need a JSON5 ESLint plugin installed for this to work. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-jsonc.txt000066400000000000000000000014671476501472200154550ustar00rootroot00000000000000=============================================================================== ALE JSONC Integration *ale-jsonc-options* =============================================================================== biome *ale-jsonc-biome* Check the docs over at |ale-typescript-biome|. =============================================================================== eslint *ale-jsonc-eslint* The `eslint` linter for JSON uses the JavaScript options for `eslint`; see: |ale-javascript-eslint|. You will need a JSONC ESLint plugin installed for this to work. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-jsonnet.txt000066400000000000000000000031061476501472200160110ustar00rootroot00000000000000=============================================================================== ALE Jsonnet Integration *ale-jsonnet-options* =============================================================================== jsonnetfmt *ale-jsonnet-jsonnetfmt* g:ale_jsonnet_jsonnetfmt_executable *g:ale_jsonnet_jsonnetfmt_executable* *b:ale_jsonnet_jsonnetfmt_executable* Type: |String| Default: `'jsonnetfmt'` This option can be changed to change the path for `jsonnetfmt`. g:ale_jsonnet_jsonnetfmt_options *g:ale_jsonnet_jsonnetfmt_options* *b:ale_jsonnet_jsonnetfmt_options* Type: |String| Default: `''` This option can be changed to pass extra options to `jsonnetfmt`. =============================================================================== jsonnet-lint *ale-jsonnet-jsonnet-lint* g:ale_jsonnet_jsonnet_lint_executable *g:ale_jsonnet_jsonnet_lint_executable* *b:ale_jsonnet_jsonnet_lint_executable* Type: |String| Default: `'jsonnet-lint'` This option can be changed to change the path for `jsonnet-lint`. g:ale_jsonnet_jsonnet_lint_options *g:ale_jsonnet_jsonnet_lint_options* *b:ale_jsonnet_jsonnet_lint_options* Type: |String| Default: `''` This option can be changed to pass extra options to `jsonnet-lint`. vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-julia.txt000066400000000000000000000014011476501472200154310ustar00rootroot00000000000000=============================================================================== ALE Julia Integration *ale-julia-options* =============================================================================== languageserver *ale-julia-languageserver* To enable Julia LSP linter you need to install the LanguageServer.jl package within julia. g:ale_julia_executable *g:ale_julia_executable* *b:ale_julia_executable* Type: |String| Default: `'julia'` Path to the julia exetuable. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-kotlin.txt000066400000000000000000000073751476501472200156450ustar00rootroot00000000000000=============================================================================== ALE Kotlin Integration *ale-kotlin-options* *ale-integration-kotlin* =============================================================================== Integration Information Make sure your setup has support for the kotlin file type. A filetype plugin can be found here: https://github.com/udalov/kotlin-vim Note: Make sure you have a working kotlin compiler =============================================================================== kotlinc *ale-kotlin-kotlinc* g:ale_kotlin_kotlinc_options *g:ale_kotlin_kotlinc_options* Type: |String| Default: `''` Additional options to pass to the kotlin compiler g:ale_kotlin_kotlinc_enable_config *g:ale_kotlin_kotlinc_enable_config* Type: |Number| Default: `0` Setting this variable to `1` tells the linter to load a configuration file. This should be set in your vimrc g:ale_kotlin_kotlinc_config_file *g:ale_kotlin_kotlinc_config_file* Type: |String| Default: `'.ale_kotlin_kotlinc_config'` Filename of the configuration file. This should be set in your vimrc g:ale_kotlin_kotlinc_classpath *g:ale_kotlin_kotlinc_classpath* Type: |String| Default: `''` A string containing the paths (separated by the appropriate path separator) of the source directories. g:ale_kotlin_kotlinc_sourcepath *g:ale_kotlin_kotlinc_sourcepath* Type: |String| Default: `''` A string containing the paths (separated by space) of the source directories. g:ale_kotlin_kotlinc_use_module_file *g:ale_kotlin_kotlinc_use_module_file* Type: |Number| Default: `0` This option indicates whether the linter should use a module file. It is off by default. g:ale_kotlin_kotlinc_module_filename *g:ale_kotlin_kotlinc_module_filename* Type: |String| Default: `'module.xml'` The filename of the module file that the linter should pass to the kotlin compiler. =============================================================================== ktlint *ale-kotlin-ktlint* g:ale_kotlin_ktlint_executable *g:ale_kotlin_ktlint_executable* Type: |String| Default: `''` The Ktlint executable. Posix-compliant shell scripts are the only executables that can be found on Ktlint's github release page. If you are not on such a system, your best bet will be to download the ktlint jar and set this option to something similar to `'java -jar /path/to/ktlint.jar'` g:ale_kotlin_ktlint_rulesets *g:ale_kotlin_ktlint_rulesets* Type: |List| of |String|s Default: `[]` This list should contain paths to ruleset jars and/or strings of maven artifact triples. Example: > let g:ale_kotlin_ktlint_rulesets = ['/path/to/custom-ruleset.jar', 'com.ktlint.rulesets:mycustomrule:1.0.0'] g:ale_kotlin_ktlint_options *g:ale_kotlin_ktlint_options* Type: |String| Default: `''` Additional options to pass to ktlint for both linting and fixing. Example: > let g:ale_kotlin_ktlint_options = '--android' =============================================================================== languageserver *ale-kotlin-languageserver* g:ale_kotlin_languageserver_executable *g:ale_kotlin_languageserver_executable* Type: |String| Default: `''` The kotlin-language-server executable. Executables are located inside the bin/ folder of the language server release. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-latex.txt000066400000000000000000000014701476501472200154500ustar00rootroot00000000000000=============================================================================== ALE LaTeX Integration *ale-latex-options* =============================================================================== cspell *ale-latex-cspell* =============================================================================== write-good *ale-latex-write-good* See |ale-write-good-options| =============================================================================== textlint *ale-latex-textlint* See |ale-text-textlint| =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-less.txt000066400000000000000000000045561476501472200153110ustar00rootroot00000000000000=============================================================================== ALE Less Integration *ale-less-options* =============================================================================== lessc *ale-less-lessc* g:ale_less_lessc_executable *g:ale_less_lessc_executable* *b:ale_less_lessc_executable* Type: |String| Default: `'lessc'` See |ale-integrations-local-executables| g:ale_less_lessc_options *g:ale_less_lessc_options* *b:ale_less_lessc_options* Type: |String| Default: `''` This variable can be set to pass additional options to lessc. g:ale_less_lessc_use_global *g:ale_less_lessc_use_global* *b:ale_less_lessc_use_global* Type: |String| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| =============================================================================== prettier *ale-less-prettier* See |ale-javascript-prettier| for information about the available options. =============================================================================== stylelint *ale-less-stylelint* g:ale_less_stylelint_executable *g:ale_less_stylelint_executable* *b:ale_less_stylelint_executable* Type: |String| Default: `'stylelint'` See |ale-integrations-local-executables| g:ale_less_stylelint_options *g:ale_less_stylelint_options* *b:ale_less_stylelint_options* Type: |String| Default: `''` This variable can be set to pass additional options to stylelint. g:ale_less_stylelint_use_global *g:ale_less_stylelint_use_global* *b:ale_less_stylelint_use_global* Type: |String| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-llvm.txt000066400000000000000000000013561476501472200153100ustar00rootroot00000000000000=============================================================================== ALE LLVM Integration *ale-llvm-options* =============================================================================== llc *ale-llvm-llc* g:ale_llvm_llc_executable *g:ale_llvm_llc_executable* *b:ale_llvm_llc_executable* Type: |String| Default: `"llc"` The command to use for checking. This variable is useful when llc command has suffix like "llc-5.0". =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-lua.txt000066400000000000000000000123201476501472200151100ustar00rootroot00000000000000=============================================================================== ALE Lua Integration *ale-lua-options* =============================================================================== cspell *ale-lua-cspell* See |ale-cspell-options| =============================================================================== lua-format *ale-lua-lua-format* g:ale_lua_lua_format_executable *g:ale_lua_lua_format_executable* *b:ale_lua_lua_format_executable* Type: |String| Default: `'lua-format'` This variable can be changed to change the path to lua-format. g:ale_lua_lua_format_options *g:ale_lua_lua_format_options* *b:ale_lua_lua_format_options* Type: |String| Default: `''` This variable can be set to pass additional options to lua-format. =============================================================================== lua-language-server *ale-lua-lua-language-server* *ale-lua-language-server* g:ale_lua_language_server_executable *g:ale_lua_language_server_executable* *b:ale_lua_language_server_executable* Type: |String| Default: `'lua-language-server'` This variable can be changed to set the path to lua-language-server. If you have compiled the language server yourself in `/some/path`, the path will be `'/some/path/bin/lua-language-server'`. g:ale_lua_lua_language_server_config *g:ale_lua_lua_language_server_config* *b:ale_lua_lua_language_server_config* Type: |Dictionary| Default: `{}` Dictionary containing configuration settings that will be passed to the language server. =============================================================================== luac *ale-lua-luac* g:ale_lua_luac_executable *g:ale_lua_luac_executable* *b:ale_lua_luac_executable* Type: |String| Default: `'luac'` This variable can be changed to change the path to luac. =============================================================================== luacheck *ale-lua-luacheck* g:ale_lua_luacheck_executable *g:ale_lua_luacheck_executable* *b:ale_lua_luacheck_executable* Type: |String| Default: `'luacheck'` This variable can be changed to change the path to luacheck. g:ale_lua_luacheck_options *g:ale_lua_luacheck_options* *b:ale_lua_luacheck_options* Type: |String| Default: `''` This variable can be set to pass additional options to luacheck. =============================================================================== luafmt *ale-lua-luafmt* g:ale_lua_luafmt_executable *g:ale_lua_luafmt_executable* *b:ale_lua_luafmt_executable* Type: |String| Default: `'luafmt'` This variable can be set to use a different executable for luafmt. g:ale_lua_luafmt_options *g:ale_lua_luafmt_options* *b:ale_lua_luafmt_options* Type: |String| Default: `''` This variable can be set to pass additional options to the luafmt fixer. =============================================================================== selene *ale-lua-selene* g:ale_lua_selene_executable *g:ale_lua_selene_executable* *b:ale_lua_selene_executable* Type: |String| Default: `'selene'` This variable can be set to use a different executable for selene. g:ale_lua_selene_options *g:ale_lua_selene_options* *b:ale_lua_selene_options* Type: |String| Default: `''` This variable can be set to pass additional options to selene. =============================================================================== stylua *ale-lua-stylua* g:ale_lua_stylua_executable *g:ale_lua_stylua_executable* *b:ale_lua_stylua_executable* Type: |String| Default: `'stylua'` This variable can be set to use a different executable for stylua. g:ale_lua_stylua_options *g:ale_lua_stylua_options* *b:ale_lua_stylua_options* Type: |String| Default: `''` This variable can be set to pass additional options to the stylua fixer. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-make.txt000066400000000000000000000014551476501472200152530ustar00rootroot00000000000000=============================================================================== ALE Make Integration *ale-make-options* =============================================================================== checkmake *ale-make-checkmake* g:ale_make_checkmake_config *g:ale_make_checkmake_config* *b:ale_make_checkmake_config* Type: |String| Default: `''` This variable can be used to set the `--config` option of checkmake command. if the value is empty, the checkmake command will not be invoked with the option. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-markdown.txt000066400000000000000000000154251476501472200161620ustar00rootroot00000000000000=============================================================================== ALE Markdown Integration *ale-markdown-options* =============================================================================== cspell *ale-markdown-cspell* See |ale-cspell-options| =============================================================================== dprint *ale-markdown-dprint* See |ale-dprint-options| and https://dprint.dev/plugins/markdown =============================================================================== markdownlint *ale-markdown-markdownlint* g:ale_markdown_markdownlint_executable *g:ale_markdown_markdownlint_executable* *b:ale_markdown_markdownlint_executable* Type: |String| Default: `'markdownlint'` Override the invoked `markdownlint` binary. You can use other binaries such as `markdownlint-cli2`. g:ale_markdown_markdownlint_options *g:ale_markdown_markdownlint_options* *b:ale_markdown_markdownlint_options* Type: |String| Default: `''` This variable can be set to pass additional options to markdownlint. =============================================================================== marksman *ale-markdown-marksman* g:ale_markdown_marksman_executable *g:ale_markdown_marksman_executable* *b:ale_markdown_marksman_executable* Type: |String| Default: `'marksman'` Override the invoked `marksman` binary. =============================================================================== mdl *ale-markdown-mdl* g:ale_markdown_mdl_executable *g:ale_markdown_mdl_executable* *b:ale_markdown_mdl_executable* Type: |String| Default: `'mdl'` Override the invoked mdl binary. This is useful for running mdl from binstubs or a bundle. g:ale_markdown_mdl_options *g:ale_markdown_mdl_options* *b:ale_markdown_mdl_options* Type: |String| Default: `''` This variable can be set to pass additional options to mdl. =============================================================================== pandoc *ale-markdown-pandoc* g:ale_markdown_pandoc_executable *g:ale_markdown_pandoc_executable* *b:ale_markdown_pandoc_executable* Type: |String| Default: `'pandoc'` This variable can be set to specify where to find the pandoc executable g:ale_markdown_pandoc_options *g:ale_markdown_pandoc_options* *b:ale_markdown_pandoc_options* Type: |String| Default: `'-f gfm -t gfm -s -'` This variable can be set to change the default options passed to pandoc =============================================================================== prettier *ale-markdown-prettier* See |ale-javascript-prettier| for information about the available options. =============================================================================== pymarkdown *ale-markdown-pymarkdown* g:ale_markdown_pymarkdown_executable *g:ale_markdown_pymarkdown_executable* *b:ale_markdown_pymarkdown_executable* Type: |String| Default: `'pymarkdown'` See |ale-integrations-local-executables| Set this to `'pipenv'` to invoke `'pipenv` `run` `pymarkdown'`. Set this to `'poetry'` to invoke `'poetry` `run` `pymarkdown'`. g:ale_markdown_pymarkdown_options *g:ale_markdown_pymarkdown_options* *b:ale_markdown_pymarkdown_options* Type: |String| Default: `''` This variable can be changed to add command-line arguments to the pymarkdown invocation. g:ale_markdown_pymarkdown_use_global *g:ale_markdown_pymarkdown_use_global* *b:ale_markdown_pymarkdown_use_global* Type: |Number| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| g:ale_markdown_pymarkdown_auto_pipenv *g:ale_markdown_pymarkdown_auto_pipenv* *b:ale_markdown_pymarkdown_auto_pipenv* Type: |Number| Default: `0` Detect whether the file is inside a pipenv, and set the executable to `pipenv` if true. This is overridden by a manually-set executable. g:ale_markdown_pymarkdown_auto_poetry *g:ale_markdown_pymarkdown_auto_poetry* *b:ale_markdown_pymarkdown_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. g:ale_markdown_pymarkdown_auto_uv *g:ale_markdown_pymarkdown_auto_uv* *b:ale_markdown_pymarkdown_auto_uv* Type: |Number| Default: `0` Set the executable to `uv` if true. This is overridden by a manually-set executable. =============================================================================== remark-lint *ale-markdown-remark-lint* g:ale_markdown_remark_lint_executable *g:ale_markdown_remark_lint_executable* *b:ale_markdown_remark_lint_executable* Type: |String| Default: `'remark'` See |ale-integrations-local-executables| g:ale_markdown_remark_lint_options *g:ale_markdown_remark_lint_options* *b:ale_markdown_remark_lint_options* Type: |String| Default: `''` This variable can be set to pass additional options to remark-lint. g:ale_markdown_remark_lint_use_global *g:ale_markdown_remark_lint_use_global* *b:ale_markdown_remark_lint_use_global* Type: |Number| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| =============================================================================== textlint *ale-markdown-textlint* See |ale-text-textlint| =============================================================================== write-good *ale-markdown-write-good* See |ale-write-good-options| =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-mercury.txt000066400000000000000000000017641476501472200160270ustar00rootroot00000000000000=============================================================================== ALE Mercury Integration *ale-mercury-options* =============================================================================== mmc *ale-mercury-mmc* g:ale_mercury_mmc_executable *g:ale_mercury_mmc_executable* *b:ale_mercury_mmc_executable* Type: |String| Default: `'mmc'` This variable can be changed to use a different executable for mmc. g:ale_mercury_mmc_options *g:ale_mercury_mmc_options* *b:ale_mercury_mmc_options* Type: |String| Default: `'--make --output-compile-error-lines 100'` This variable can be set to pass additional options to mmc. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-nasm.txt000066400000000000000000000017151476501472200152730ustar00rootroot00000000000000=============================================================================== ALE NASM Integration *ale-nasm-options* =============================================================================== nasm *ale-nasm-nasm* g:ale_nasm_nasm_executable *g:ale_nasm_nasm_executable* *b:ale_nasm_nasm_executable* Type: |String| Default `'nasm'` This variable can be changed to use different executable for NASM. g:ale_nasm_nasm_options *g:ale_nasm_nasm_options* *b:ale_nasm_nasm_options* Type: |String| Default: `''` This variable can be set to pass additional options to NASM. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-nickel.txt000066400000000000000000000017271476501472200156050ustar00rootroot00000000000000=============================================================================== ALE Nickel Integration *ale-nickel-options* =============================================================================== nickel_format *ale-nickel-nickel-format* g:ale_nickel_nickel_format_executable *g:ale_nickel_nickel_format_executable* *b:ale_nickel_nickel_format_executable* Type: |String| Default: `'nickel'` This option can be changed to change the path for `nickel`. g:ale_nickel_nickel_format_options *g:ale_nickel_nickel_format_options* *b:ale_nickel_nickel_format_options* Type: |String| Default: `''` This option can be changed to pass extra options to `'nickel format'` =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-nim.txt000066400000000000000000000031241476501472200151140ustar00rootroot00000000000000=============================================================================== ALE Nim Integration *ale-nim-options* =============================================================================== nimcheck *ale-nim-nimcheck* ALE does not provide additional configuration options for `nimcheck` at this point. =============================================================================== nimlsp *ale-nim-nimlsp* g:nim_nimlsp_nim_sources *g:nim_nimlsp_nim_sources* Type: |String| Default: `''` Sets the path to Nim source repository as the first argument to `nimlsp` command. =============================================================================== nimpretty *ale-nim-nimpretty* g:ale_nim_nimpretty_executable *g:ale_nim_nimpretty_executable* *b:ale_nim_nimpretty_executable* Type: |String| Default: `'nimpretty'` This variable can be changed to use a different executable for nimpretty. g:ale_nim_nimpretty_options *g:ale_nim_nimpretty_options* *b:ale_nim_nimpretty_options* Type: |String| Default: `'--maxLineLen:80'` This variable can be changed to modify flags given to nimpretty. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-nix.txt000066400000000000000000000104021476501472200151240ustar00rootroot00000000000000=============================================================================== ALE Nix Integration *ale-nix-options* =============================================================================== alejandra *ale-nix-alejandra* g:ale_nix_alejandra_executable *g:ale_nix_alejandra_executable* *b:ale_nix_alejandra_executable* Type: |String| Default: `'alejandra'` This variable sets the executable used for alejandra. g:ale_nix_alejandra_options *g:ale_nix_alejandra_options* *b:ale_nix_alejandra_options* Type: |String| Default: `''` This variable can be set to pass additional options to the alejandra fixer. =============================================================================== nixfmt *ale-nix-nixfmt* g:ale_nix_nixfmt_executable *g:ale_nix_nixfmt_executable* *b:ale_nix_nixfmt_executable* Type: |String| Default: `'nixfmt'` This variable sets the executable used for nixfmt. g:ale_nix_nixfmt_options *g:ale_nix_nixfmt_options* *b:ale_nix_nixfmt_options* Type: |String| Default: `''` This variable can be set to pass additional options to the nixfmt fixer. =============================================================================== nixpkgs-fmt *ale-nix-nixpkgs-fmt* g:ale_nix_nixpkgsfmt_executable *g:ale_nix_nixpkgsfmt_executable* *b:ale_nix_nixpkgsfmt_executable* Type: |String| Default: `'nixpkgs-fmt'` This variable sets executable used for nixpkgs-fmt. g:ale_nix_nixpkgsfmt_options *g:ale_nix_nixpkgsfmt_options* *b:ale_nix_nixpkgsfmt_options* Type: |String| Default: `''` This variable can be set to pass additional options to the nixpkgs-fmt fixer. =============================================================================== statix *ale-nix-statix* g:ale_nix_statix_check_executable *g:ale_nix_statix_check_executable* *b:ale_nix_statix_check_executable* Type: |String| Default: `'statix'` This variable sets the executable used for statix when running it as a linter. g:ale_nix_statix_check_options *g:ale_nix_statix_check_options* *b:ale_nix_statix_check_options* Type: |String| Default: `''` This variable can be used to pass additional options to statix when running it as a linter. g:ale_nix_statix_fix_executable *g:ale_nix_fix_check_executable* *b:ale_nix_fix_check_executable* Type: |String| Default: `'statix'` This variable sets the executable used for statix when running it as a fixer. g:ale_nix_statix_fix_options *g:ale_nix_statix_fix_options* *b:ale_nix_statix_fix_options* Type: |String| Default: `''` This variable can be used to pass additional options to statix when running it as a fixer. =============================================================================== deadnix *ale-nix-deadnix* g:ale_nix_deadnix_executable *g:ale_nix_deadnix_executable* *b:ale_nix_deadnix_executable* Type: |String| Default: `'deadnix'` This variable sets the executable used for deadnix. g:ale_nix_deadnix_options *g:ale_nix_deadnix_options* *b:ale_nix_deadnix_options* Type: |String| Default: `''` This variable can be used to pass additional options to deadnix. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-nroff.txt000066400000000000000000000007321476501472200154450ustar00rootroot00000000000000=============================================================================== ALE nroff Integration *ale-nroff-options* =============================================================================== write-good *ale-nroff-write-good* See |ale-write-good-options| =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-objc.txt000066400000000000000000000055751476501472200152620ustar00rootroot00000000000000=============================================================================== ALE Objective-C Integration *ale-objc-options* =============================================================================== ccls *ale-objc-ccls* g:ale_objc_ccls_executable *g:ale_objc_ccls_executable* *b:ale_objc_ccls_executable* Type: |String| Default: `'ccls'` This variable can be changed to use a different executable for ccls. g:ale_objc_ccls_init_options *g:ale_objc_ccls_init_options* *b:ale_objc_ccls_init_options* Type: |Dictionary| Default: `{}` This variable can be changed to customize ccls initialization options. Example: > { \ 'cacheDirectory': '/tmp/ccls', \ 'cacheFormat': 'binary', \ 'diagnostics': { \ 'onOpen': 0, \ 'opChange': 1000, \ }, \ } < Visit https://github.com/MaskRay/ccls/wiki/Initialization-options for all available options and explanations. =============================================================================== clang *ale-objc-clang* g:ale_objc_clang_options *g:ale_objc_clang_options* *b:ale_objc_clang_options* Type: |String| Default: `'-std=c11 -Wall'` This variable can be changed to modify flags given to clang. =============================================================================== clang-format *ale-objc-clangformat* See |ale-c-clangformat| for information about the available options. Note that the C options are also used for Objective-C. =============================================================================== clangd *ale-objc-clangd* g:ale_objc_clangd_executable *g:ale_objc_clangd_executable* *b:ale_objc_clangd_executable* Type: |String| Default: `'clangd'` This variable can be changed to use a different executable for clangd. g:ale_objc_clangd_options *g:ale_objc_clangd_options* *b:ale_objc_clangd_options* Type: |String| Default: `''` This variable can be changed to modify flags given to clangd. =============================================================================== uncrustify *ale-objc-uncrustify* See |ale-c-uncrustify| for information about the available options. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-objcpp.txt000066400000000000000000000031571476501472200156140ustar00rootroot00000000000000=============================================================================== ALE Objective-C++ Integration *ale-objcpp-options* =============================================================================== clang *ale-objcpp-clang* g:ale_objcpp_clang_options *g:ale_objcpp_clang_options* *b:ale_objcpp_clang_options* Type: |String| Default: `'-std=c++14 -Wall'` This variable can be changed to modify flags given to clang. =============================================================================== clangd *ale-objcpp-clangd* g:ale_objcpp_clangd_executable *g:ale_objcpp_clangd_executable* *b:ale_objcpp_clangd_executable* Type: |String| Default: `'clangd'` This variable can be changed to use a different executable for clangd. g:ale_objcpp_clangd_options *g:ale_objcpp_clangd_options* *b:ale_objcpp_clangd_options* Type: |String| Default: `''` This variable can be changed to modify flags given to clangd. =============================================================================== uncrustify *ale-objcpp-uncrustify* See |ale-c-uncrustify| for information about the available options. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-ocaml.txt000066400000000000000000000116211476501472200154250ustar00rootroot00000000000000=============================================================================== ALE OCaml Integration *ale-ocaml-options* =============================================================================== dune *ale-ocaml-dune* Dune is a build system for OCaml projects. The `dune format` command is supported for automatically formatting `dune` and `dune-project` files. g:ale_ocaml_dune_executable *g:ale_ocaml_dune_executable* *b:ale_ocaml_dune_executable* Type: |String| Default: `'dune'` This variable can be set to pass the path to dune. g:ale_ocaml_dune_options *g:ale_ocaml_dune_options* *b:ale_ocaml_dune_options* Type: |String| Default: `''` This variable can be set to pass additional options to the dune fixer. =============================================================================== merlin *ale-ocaml-merlin* To use merlin linter for OCaml source code you need to make sure Merlin for Vim is correctly configured. See the corresponding Merlin wiki page for detailed instructions (https://github.com/the-lambda-church/merlin/wiki/vim-from-scratch). =============================================================================== ocamllsp *ale-ocaml-ocamllsp* The `ocaml-lsp-server` is the official OCaml implementation of the Language Server Protocol. See the installation instructions: https://github.com/ocaml/ocaml-lsp#installation g:ale_ocaml_ocamllsp_use_opam *g:ale_ocaml_ocamllsp_use_opam* *b:ale_ocaml_ocamllsp_use_opam* Type: |Number| Default: `get(g:, 'ale_ocaml_ocamllsp_use_opam', 1)` This variable can be set to change whether or not opam is used to execute the language server. =============================================================================== ols *ale-ocaml-ols* The `ocaml-language-server` is the engine that powers OCaml and ReasonML editor support using the Language Server Protocol. See the installation instructions: https://github.com/freebroccolo/ocaml-language-server#installation g:ale_ocaml_ols_executable *g:ale_ocaml_ols_executable* *b:ale_ocaml_ols_executable* Type: |String| Default: `'ocaml-language-server'` This variable can be set to change the executable path for `ols`. g:ale_ocaml_ols_use_global *g:ale_ocaml_ols_use_global* *b:ale_ocaml_ols_use_global* Type: |String| Default: `get(g:, 'ale_use_global_executables', 0)` This variable can be set to `1` to always use the globally installed executable. See also |ale-integrations-local-executables|. =============================================================================== ocamlformat *ale-ocaml-ocamlformat* g:ale_ocaml_ocamlformat_executable *g:ale_ocaml_ocamlformat_executable* *b:ale_ocaml_ocamlformat_executable* Type: |String| Default: `'ocamlformat'` This variable can be set to pass the path of the ocamlformat fixer. g:ale_ocaml_ocamlformat_options *g:ale_ocaml_ocamlformat_options* *b:ale_ocaml_ocamlformat_options* Type: |String| Default: `''` This variable can be set to pass additional options to the ocamlformat fixer. =============================================================================== ocp-indent *ale-ocaml-ocp-indent* g:ale_ocaml_ocp_indent_executable *g:ale_ocaml_ocp_indent_executable* *b:ale_ocaml_ocp_indent_executable* Type: |String| Default: `ocp-indent` This variable can be set to pass the path of the ocp-indent. g:ale_ocaml_ocp_indent_options *g:ale_ocaml_ocp_indent_options* *b:ale_ocaml_ocp_indent_options* Type: |String| Default: `''` This variable can be set to pass additional options to the ocp-indent. g:ale_ocaml_ocp_indent_config *g:ale_ocaml_ocp_indent_config* *b:ale_ocaml_ocp_indent_config* Type: |String| Default: `''` This variable can be set to pass additional config to the ocp-indent. Expand after "--config=". "ocp-indent" can also be enabled from ocamlformat config. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-odin.txt000066400000000000000000000022671476501472200152710ustar00rootroot00000000000000=============================================================================== ALE Odin Integration *ale-odin-options* *ale-integration-odin* =============================================================================== Integration Information Currently, the only supported linter for Odin is ols. =============================================================================== ols *ale-odin-ols* g:ale_odin_ols_executable *g:ale_odin_ols_executable* *b:ale_odin_ols_executable* Type: |String| Default: `'ols'` This variable can be modified to change the executable path for `ols`. g:ale_odin_ols_config *g:ale_odin_ols_config* *b:ale_odin_ols_config* Type: |Dictionary| Default: `{}` Dictionary with configuration settings for ols. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-openapi.txt000066400000000000000000000052341476501472200157700ustar00rootroot00000000000000=============================================================================== ALE OpenApi Integration *ale-openapi-options* =============================================================================== ibm_validator *ale-openapi-ibm-validator* Website: https://github.com/IBM/openapi-validator Installation ------------------------------------------------------------------------------- Install ibm-openapi-validator either globally or locally: > npm install ibm-openapi-validator -g # global npm install ibm-openapi-validator # local < Configuration ------------------------------------------------------------------------------- OpenAPI files can be written in YAML or JSON so in order for ALE plugins to work with these files we must set the buffer |filetype| to either |openapi.yaml| or |openapi.json| respectively. This causes ALE to lint the file with linters configured for openapi and yaml files or openapi and json files respectively. For example setting filetype to |openapi.yaml| on a buffer and the following |g:ale_linters| configuration will enable linting of openapi files using both |ibm_validator| and |yamlint|: > let g:ale_linters = { \ 'yaml': ['yamllint'], \ 'openapi': ['ibm_validator'] \} < The following plugin will detect openapi files automatically and set the filetype to |openapi.yaml| or |openapi.json|: https://github.com/hsanson/vim-openapi Options ------------------------------------------------------------------------------- g:ale_openapi_ibm_validator_executable *g:ale_openapi_ibm_validator_executable* *b:ale_openapi_ibm_validator_executable* Type: |String| Default: `'lint-openapi'` This variable can be set to change the path to lint-openapi. g:ale_openapi_ibm_validator_options *g:ale_openapi_ibm_validator_options* *b:ale_openapi_ibm_validator_options* Type: |String| Default: `''` This variable can be set to pass additional options to lint-openapi. =============================================================================== prettier *ale-openapi-prettier* See |ale-javascript-prettier| for information about the available options. =============================================================================== yamllint *ale-openapi-yamllint* See |ale-yaml-yamllint| for information about the available options. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-openscad.txt000066400000000000000000000031011476501472200161200ustar00rootroot00000000000000=============================================================================== ALE OpenSCAD Integration *ale-openscad-options* =============================================================================== sca2d *ale-openscad-sca2d* g:ale_openscad_sca2d_executable *g:ale_openscad_sca2d_executable* *b:ale_openscad_sca2d_executable* Type: |String| Default: `'sca2d'` See |ale-integrations-local-executables| g:ale_openscad_sca2d_options *g:ale_openscad_sca2d_options* *b:ale_openscad_sca2d_options* Type: |String| Default: `''` This variable can be set to pass options to sca2d. =============================================================================== scadformat *ale-openscad-scadformat* g:ale_openscad_scadformat_executable *g:ale_openscad_scadformat_executable* *b:ale_openscad_scadformat_executable* Type: |String| Default: `'scadformat'` See |ale-integrations-local-executables| g:ale_openscad_scadformat_options *g:ale_openscad_scadformat_options* *b:ale_openscad_scadformat_options* Type: |String| Default: `''` This variable can be set to pass options to scadformat. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-packer.txt000066400000000000000000000016241476501472200156010ustar00rootroot00000000000000=============================================================================== ALE Packer Integration *ale-packer-options* =============================================================================== packer-fmt-fixer *ale-packer-fmt-fixer* g:ale_packer_fmt_executable *g:ale_packer_fmt_executable* *b:ale_packer_fmt_executable* Type: |String| Default: `'packer'` This variable can be changed to use a different executable for packer. g:ale_packer_fmt_options *g:ale_packer_fmt_options* *b:ale_packer_fmt_options* Type: |String| Default: `''` =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-pascal.txt000066400000000000000000000017141476501472200155770ustar00rootroot00000000000000=============================================================================== ALE Pascal Integration *ale-pascal-options* =============================================================================== ptop *ale-pascal-ptop* g:ale_pascal_ptop_executable *g:ale_pascal_ptop_executable* *b:ale_pascal_ptop_executable* Type: |String| Default: `'ptop'` This variable can be changed to specify the ptop executable. g:ale_pascal_ptop_options *g:ale_pascal_ptop_options* *b:ale_pascal_ptop_options* Type: |String| Default: `''` This variable can be set to pass additional options to the ptop fixer. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-pawn.txt000066400000000000000000000010011476501472200152660ustar00rootroot00000000000000=============================================================================== ALE Pawn Integration *ale-pawn-options* =============================================================================== uncrustify *ale-pawn-uncrustify* See |ale-c-uncrustify| for information about the available options. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-perl.txt000066400000000000000000000070751476501472200153040ustar00rootroot00000000000000=============================================================================== ALE Perl Integration *ale-perl-options* ALE offers a few ways to check Perl code. Checking code with `perl` is disabled by default, as `perl` code cannot be checked without executing it. Specifically, we use the `-c` flag to see if `perl` code compiles. This does not execute all of the code in a file, but it does run `BEGIN` and `CHECK` blocks. See `perl --help` and https://stackoverflow.com/a/12908487/406224 See |g:ale_linters|. =============================================================================== perl *ale-perl-perl* g:ale_perl_perl_executable *g:ale_perl_perl_executable* *b:ale_perl_perl_executable* Type: |String| Default: `'perl'` This variable can be changed to modify the executable used for linting perl. g:ale_perl_perl_options *g:ale_perl_perl_options* *b:ale_perl_perl_options* Type: |String| Default: `'-c -Mwarnings -Ilib'` This variable can be changed to alter the command-line arguments to the perl invocation. =============================================================================== perlcritic *ale-perl-perlcritic* g:ale_perl_perlcritic_executable *g:ale_perl_perlcritic_executable* *b:ale_perl_perlcritic_executable* Type: |String| Default: `'perlcritic'` This variable can be changed to modify the perlcritic executable used for linting perl. g:ale_perl_perlcritic_profile *g:ale_perl_perlcritic_profile* *b:ale_perl_perlcritic_profile* Type: |String| Default: `'.perlcriticrc'` This variable can be changed to modify the perlcritic profile used for linting perl. The current directory is checked for the file, then the parent directory, etc, until it finds one. If no matching file is found, no profile is passed to perlcritic. Set to an empty string to disable passing a specific profile to perlcritic with the `'--profile'` option. To prevent perlcritic from using any profile, set this variable to an empty string and pass `'--no-profile'`to perlcritic via the |g:ale_perl_perlcritic_options| variable. g:ale_perl_perlcritic_options *g:ale_perl_perlcritic_options* *b:ale_perl_perlcritic_options* Type: |String| Default: `''` This variable can be changed to supply additional command-line arguments to the perlcritic invocation. g:ale_perl_perlcritic_showrules *g:ale_perl_perlcritic_showrules* Type: |Number| Default: `0` Controls whether perlcritic rule names are shown after the error message. Defaults to off to reduce length of message. =============================================================================== perltidy *ale-perl-perltidy* g:ale_perl_perltidy_options *g:ale_perl_perltidy_options* *b:ale_perl_perltidy_options* Type: |String| Default: `''` This variable can be changed to alter the command-line arguments to the perltidy invocation. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-perl6.txt000066400000000000000000000034601476501472200153640ustar00rootroot00000000000000=============================================================================== ALE Perl6 Integration *ale-perl6-options* Checking code with `perl6` is disabled by default, as `perl6` code cannot be checked without executing it. Specifically, we use the `-c` flag to see if `perl6` code compiles. This does not execute all of the code in a file, but it does run `BEGIN` and `CHECK` blocks. See `perl6 --help` Full support requires a perl6 implementation that supports the PERL6_EXCEPTIONS_HANDLER environment variable and JSON error output, which was specified in 6.d. Rakudo version 2018.08 is the first rakudo release that supports this. See `perl6 --version` and https://docs.perl6.org/programs/03-environment-variables. Without this variable, errors and warnings will appear at line 1, and can be viewed with ALEDetail. This also serves as a fallback for errors and warnings that do not trigger JSON output. See |g:ale_linters|. =============================================================================== perl6 *ale-perl6-perl6* g:ale_perl6_perl6_executable *g:ale_perl6_perl6_executable* *b:ale_perl6_perl6_executable* Type: |String| Default: `'perl6'` This variable can be changed to modify the executable used for linting perl6. g:ale_perl6_perl6_options *g:ale_perl6_perl6_options* *b:ale_perl6_perl6_options* Type: |String| Default: `'-c -Ilib'` This variable can be changed to alter the command-line arguments to the perl6 invocation. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-php.txt000066400000000000000000000325161476501472200151270ustar00rootroot00000000000000=============================================================================== ALE PHP Integration *ale-php-options* =============================================================================== cspell *ale-php-cspell* See |ale-cspell-options| =============================================================================== langserver *ale-php-langserver* g:ale_php_langserver_executable *g:ale_php_langserver_executable* *b:ale_php_langserver_executable* Type: |String| Default: `'php-language-server.php'` The variable can be set to configure the executable that will be used for running the PHP language server. `vendor` directory executables will be preferred instead of this setting if |g:ale_php_langserver_use_global| is `0`. See: |ale-integrations-local-executables| g:ale_php_langserver_use_global *g:ale_php_langserver_use_global* *b:ale_php_langserver_use_global* Type: |Number| Default: `get(g:, 'ale_use_global_executables', 0)` This variable can be set to `1` to force the language server to be run with the executable set for |g:ale_php_langserver_executable|. See: |ale-integrations-local-executables| =============================================================================== phan *ale-php-phan* WARNING: please use the phan_client linter if you have an configuration file for your project because the phan will look into your entirely project and ale will display in the current buffer warnings that may belong to other file. g:ale_php_phan_minimum_severity *g:ale_php_phan_minimum_severity* *b:ale_php_phan_minimum_severity* Type: |Number| Default: `0` This variable defines the minimum severity level. g:ale_php_phan_executable *g:ale_php_phan_executable* *b:ale_php_phan_executable* Type: |String| Default: `'phan'` This variable sets executable used for phan or phan_client. g:ale_php_phan_use_client *g:ale_php_phan_use_client* *b:ale_php_phan_use_client* Type: |Number| Default: `get(g:, 'ale_php_phan_use_client', 0)` This variable can be set to 1 to use the phan_client with phan daemon mode instead of the phan standalone. =============================================================================== phpcbf *ale-php-phpcbf* g:ale_php_phpcbf_executable *g:ale_php_phpcbf_executable* *b:ale_php_phpcbf_executable* Type: |String| Default: `'phpcbf'` See |ale-integrations-local-executables| g:ale_php_phpcbf_standard *g:ale_php_phpcbf_standard* *b:ale_php_phpcbf_standard* Type: |String| Default: `''` This variable can be set to specify the coding standard used by phpcbf. If no coding standard is specified, phpcbf will default to fixing against the PEAR coding standard, or the standard you have set as the default. g:ale_php_phpcbf_use_global *g:ale_php_phpcbf_use_global* *b:ale_php_phpcbf_use_global* Type: |Number| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| g:ale_php_phpcbf_options *g:ale_php_phpcbf_options* *b:ale_php_phpcbf_options* Type: |String| Default: `''` This variable can be set to pass additional options to php-cbf =============================================================================== phpcs *ale-php-phpcs* g:ale_php_phpcs_executable *g:ale_php_phpcs_executable* *b:ale_php_phpcs_executable* Type: |String| Default: `'phpcs'` See |ale-integrations-local-executables| g:ale_php_phpcs_standard *g:ale_php_phpcs_standard* *b:ale_php_phpcs_standard* Type: |String| Default: `''` This variable can be set to specify the coding standard used by phpcs. If no coding standard is specified, phpcs will default to checking against the PEAR coding standard, or the standard you have set as the default. g:ale_php_phpcs_use_global *g:ale_php_phpcs_use_global* *b:ale_php_phpcs_use_global* Type: |Number| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| g:ale_php_phpcs_options *g:ale_php_phpcs_options* *b:ale_php_phpcs_options* Type: |String| Default: `''` This variable can be set to pass additional options to php-cs =============================================================================== phpmd *ale-php-phpmd* g:ale_php_phpmd_executable *g:ale_php_phpmd_executable* *b:ale_php_phpmd_executable* Type: |String| Default: `'phpmd'` This variable sets executable used for phpmd. g:ale_php_phpmd_ruleset *g:ale_php_phpmd_ruleset* *b:ale_php_phpmd_ruleset* Type: |String| Default: `'cleancode,codesize,controversial,design,naming,unusedcode'` This variable controls the ruleset used by phpmd. Default is to use all of the available phpmd rulesets =============================================================================== phpstan *ale-php-phpstan* g:ale_php_phpstan_executable *g:ale_php_phpstan_executable* *b:ale_php_phpstan_executable* Type: |String| Default: `'phpstan'` This variable sets executable used for phpstan. g:ale_php_phpstan_level *g:ale_php_phpstan_level* *b:ale_php_phpstan_level* Type: |String| Default: `''` This variable controls the rule levels. 0 is the loosest and 7 is the strictest. If this option isn't set, the rule level will be controlled by the configuration file. If no configuration file can be detected, `'7'` will be used instead. g:ale_php_phpstan_configuration *g:ale_php_phpstan_configuration* *b:ale_php_phpstan_configuration* Type: |String| Default: `''` This variable sets path to phpstan configuration file. g:ale_php_phpstan_autoload *g:ale_php_phpstan_autoload* *b:ale_php_phpstan_autoload* Type: |String| Default: `''` This variable sets path to phpstan autoload file. g:ale_php_phpstan_memory_limit *g:ale_php_phpstan_memory-limit* *b:ale_php_phpstan_memory-limit* Type: |String| Default: `''` This variable sets the memory limit for phpstan analysis. This is a string in the same format as `php.ini` accepts, e.g. `128M`, `1G`. =============================================================================== psalm *ale-php-psalm* g:ale_php_psalm_executable *g:ale_php_psalm_executable* *b:ale_php_psalm_executable* Type: |String| Default: `'psalm'` This variable sets the executable used for psalm. g:ale_php_psalm_options *g:ale_php_psalm_options* *b:ale_php_psalm_options* Type: |String| Default: `''` This variable can be set to pass additional options to psalm. g:ale_php_psalm_use_global *g:ale_php_psalm_use_global* *b:ale_php_psalm_use_global* Type: |Boolean| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| =============================================================================== php-cs-fixer *ale-php-php-cs-fixer* g:ale_php_cs_fixer_executable *g:ale_php_cs_fixer_executable* *b:ale_php_cs_fixer_executable* Type: |String| Default: `'php-cs-fixer'` This variable sets executable used for php-cs-fixer. g:ale_php_cs_fixer_options *g:ale_php_cs_fixer_options* *b:ale_php_cs_fixer_options* Type: |String| Default: `''` This variable can be set to pass additional options to php-cs-fixer. g:ale_php_cs_fixer_use_global *g:ale_php_cs_fixer_use_global* *b:ale_php_cs_fixer_use_global* Type: |Boolean| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| =============================================================================== php *ale-php-php* g:ale_php_php_executable *g:ale_php_php_executable* *b:ale_php_php_executable* Type: |String| Default: `'php'` This variable sets the executable used for php. =============================================================================== pint *ale-php-pint* g:ale_php_pint_executable *g:ale_php_pint_executable* *b:ale_php_pint_executable* Type: |String| Default: `'pint'` This variable sets the executable used for pint. g:ale_php_pint_options *g:ale_php_pint_options* *b:ale_php_pint_options* Type: |String| Default: `''` This variable can be set to pass additional options to pint. g:ale_php_pint_use_global *g:ale_php_pint_use_global* *b:ale_php_pint_use_global* Type: |Boolean| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| =============================================================================== tlint *ale-php-tlint* g:ale_php_tlint_executable *g:ale_php_tlint_executable* *b:ale_php_tlint_executable* Type: |String| Default: `'tlint'` See |ale-integrations-local-executables| g:ale_php_tlint_use_global *g:ale_php_tlint_use_global* *b:ale_php_tlint_use_global* Type: |Number| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| g:ale_php_tlint_options *g:ale_php_tlint_options* *b:ale_php_tlint_options* Type: |String| Default: `''` This variable can be set to pass additional options to tlint =============================================================================== intelephense *ale-php-intelephense* g:ale_php_intelephense_executable *g:ale_php_intelephense_executable* *b:ale_php_intelephense_executable* Type: |String| Default: `'intelephense'` The variable can be set to configure the executable that will be used for running the intelephense language server. `node_modules` directory executable will be preferred instead of this setting if |g:ale_php_intelephense_use_global| is `0`. See: |ale-integrations-local-executables| g:ale_php_intelephense_use_global *g:ale_php_intelephense_use_global* *b:ale_php_intelephense_use_global* Type: |Number| Default: `get(g:, 'ale_use_global_executables', 0)` This variable can be set to `1` to force the language server to be run with the executable set for |g:ale_php_intelephense_executable|. See: |ale-integrations-local-executables| g:ale_php_intelephense_config *g:ale_php_intelephense_config* *b:ale_php_intelephense_config* Type: |Dictionary| Default: `{}` The initialization options config specified by Intelephense. Refer to the installation docs provided by intelephense (github.com/bmewburn/intelephense -docs). =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-po.txt000066400000000000000000000007321476501472200147510ustar00rootroot00000000000000=============================================================================== ALE PO Integration *ale-po-options* =============================================================================== write-good *ale-po-write-good* See |ale-write-good-options| =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-pod.txt000066400000000000000000000007321476501472200151150ustar00rootroot00000000000000=============================================================================== ALE Pod Integration *ale-pod-options* =============================================================================== write-good *ale-pod-write-good* See |ale-write-good-options| =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-pony.txt000066400000000000000000000016661476501472200153270ustar00rootroot00000000000000=============================================================================== ALE Pony Integration *ale-pony-options* =============================================================================== ponyc *ale-pony-ponyc* g:ale_pony_ponyc_executable *g:ale_pony_ponyc_executable* *b:ale_pony_ponyc_executable* Type: |String| Default: `'ponyc'` See |ale-integrations-local-executables| g:ale_pony_ponyc_options *g:ale_pony_ponyc_options* *b:ale_pony_ponyc_options* Type: |String| Default: `'--pass paint'` This variable can be set to pass options to ponyc. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-powershell.txt000066400000000000000000000050751476501472200165240ustar00rootroot00000000000000=============================================================================== ALE PowerShell Integration *ale-powershell-options* =============================================================================== cspell *ale-powershell-cspell* See |ale-cspell-options| =============================================================================== powershell *ale-powershell-powershell* g:ale_powershell_powershell_executable *g:ale_powershell_powershell_executable* *b:ale_powershell_powershell_executable* Type: |String| Default: `'pwsh'` This variable can be changed to use a different executable for powershell. > " Use powershell.exe rather than the default pwsh let g:ale_powershell_powershell_executable = 'powershell.exe' > =============================================================================== psscriptanalyzer *ale-powershell-psscriptanalyzer* Installation ------------------------------------------------------------------------------- Install PSScriptAnalyzer by any means, so long as it can be automatically imported in PowerShell. g:ale_powershell_psscriptanalyzer_executable *g:ale_powershell_psscriptanalyzer_executable* *b:ale_powershell_psscriptanalyzer_executable* Type: |String| Default: `'pwsh'` This variable sets executable used for powershell. For example, on Windows you could set powershell to be Windows Powershell: > let g:ale_powershell_psscriptanalyzer_executable = 'powershell.exe' < g:ale_powershell_psscriptanalyzer_module *g:ale_powershell_psscriptanalyzer_module* *b:ale_powershell_psscriptanalyzer_module* Type: |String Default: `'psscriptanalyzer'` This variable sets the name of the psscriptanalyzer module. for psscriptanalyzer invocation. g:ale_powershell_psscriptanalyzer_exclusions *g:ale_powershell_psscriptanalyzer_exclusions* *b:ale_powershell_psscriptanalyzer_exclusions* Type: |String| Default: `''` Set this variable to exclude test(s) for psscriptanalyzer (-ExcludeRule option). To exclude more than one option, separate them with commas. > " Suppress Write-Host and Global vars warnings let g:ale_powershell_psscriptanalyzer_exclusions = \ 'PSAvoidUsingWriteHost,PSAvoidGlobalVars' < =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-prolog.txt000066400000000000000000000046221476501472200156370ustar00rootroot00000000000000=============================================================================== ALE Prolog Integration *ale-prolog-options* =============================================================================== swipl *ale-prolog-swipl* g:ale_prolog_swipl_executable *g:ale_prolog_swipl_executable* *b:ale_prolog_swipl_executable* Type: |String| Default: `'swipl'` The executable that will be run for the `swipl` linter. g:ale_prolog_swipl_load *g:ale_prolog_swipl_load* *b:ale_prolog_swipl_load* Type: |String| Default: `'current_prolog_flag(argv, [File]), load_files(File, [sandboxed(true)]), halt.'` The prolog goals that will be passed to |g:ale_prolog_swipl_executable| with `-g` option. It does: 1. Takes the first command argument (current file path) 2. Checks (syntactic / semantic) problems and output to stderr NOTE: `sandboxed(true)` prohibits executing some directives such as 'initialization main'. g:ale_prolog_swipl_timeout *g:ale_prolog_swipl_timeout* *b:ale_prolog_swipl_timeout* Type: |Number| Default: `3` Timeout seconds to detect long-running linter. It is done by setting SIGALRM. See |g:ale_prolog_swipl_alarm| and |g:ale_prolog_swipl_alarm_handler|. g:ale_prolog_swipl_alarm *g:ale_prolog_swipl_alarm* *b:ale_prolog_swipl_alarm* Type: |String| Default: `'alarm(%t, (%h), _, [])'` The prolog goals to be expected to set SIGALRM. `%t` is replaced by |g:ale_prolog_swipl_timeout|. `%h` is replaced by |g:ale_prolog_swipl_alarm_handler|. g:ale_prolog_swipl_alarm_handler *g:ale_prolog_swipl_alarm_handler* *b:ale_prolog_swipl_alarm_handler* Type: |String| Default: `'writeln(user_error, "ERROR: Exceeded %t seconds, Please change g:prolog_swipl_timeout to modify the limit."), halt(1)'` The prolog goals to be expected that will be run on SIGALRM. `%t` is replaced by |g:ale_prolog_swipl_timeout|. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-proto.txt000066400000000000000000000076061476501472200155050ustar00rootroot00000000000000=============================================================================== ALE Proto Integration *ale-proto-options* =============================================================================== Integration Information To enable `.proto` file linting, update |g:ale_linters| as appropriate: > " Enable linter for .proto files let g:ale_linters = {'proto': ['buf-lint', 'protoc-gen-lint', 'protolint']} < To enable `.proto` file fixing, update |g:ale_fixers| as appropriate: > " Enable linter for .proto files let b:ale_fixers = {'proto': ['buf-format', 'protolint']} < =============================================================================== buf-format *ale-proto-buf-format* The formatter uses `buf`, a fully-featured Protobuf compiler that doesn't depend on `protoc`. Make sure the `buf` binary is available in the system path, or set ale_proto_buf_format_executable. g:ale_proto_buf_format_executable *g:ale_proto_buf_format_executable* Type: |String| Default: `'buf'` This variable can be changed to modify the executable used for buf. =============================================================================== buf-lint *ale-proto-buf-lint* The linter uses `buf`, a fully-featured Protobuf compiler that doesn't depend on `protoc`. Make sure the `buf` binary is available in the system path, or set ale_proto_buf_lint_executable. g:ale_proto_buf_lint_executable *g:ale_proto_buf_lint_executable* Type: |String| Default: `'buf'` This variable can be changed to modify the executable used for buf. g:ale_proto_buf_lint_config *g:ale_proto_buf_lint_config* Type: |String| Default: `''` A path to a buf configuration file. The path to the configuration file can be an absolute path or a relative path. ALE will search for the relative path in parent directories. =============================================================================== clang-format *ale-proto-clangformat* See |ale-c-clangformat| for information about the available options. Note that the C options are also used for Proto. =============================================================================== protoc-gen-lint *ale-proto-protoc-gen-lint* The linter is a plugin for the `protoc` binary. As long as the binary resides in the system path, `protoc` will find it. g:ale_proto_protoc_gen_lint_options *g:ale_proto_protoc_gen_lint_options* Type: |String| Default: `''` This variable can be changed to modify flags given to protoc. Note that the directory of the linted file is always passed as an include path with '-I' before any user-supplied options. =============================================================================== protolint *ale-proto-protolint* The linter is a pluggable tool that doesn't depend on the `protoc` binary. This supports both linting and fixing. Make sure the binary is available in the system path, or set ale_proto_protolint_executable. Note that the binary with v0.22.0 or above is supported. g:ale_proto_protolint_executable *g:ale_proto_protolint_executable* Type: |String| Default: `'protolint'` This variable can be changed to modify the executable used for protolint. g:ale_proto_protolint_config *g:ale_proto_protolint_config* Type: |String| Default: `''` A path to a protolint configuration file. The path to the configuration file can be an absolute path or a relative path. ALE will search for the relative path in parent directories. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-pug.txt000066400000000000000000000030201476501472200151170ustar00rootroot00000000000000=============================================================================== ALE Pug Integration *ale-pug-options* =============================================================================== puglint *ale-pug-puglint* The puglint linter will detect configuration files based on the path to the filename automatically. Configuration files will be loaded in this order: 1. `.pug-lintrc` 2. `.pug-lintrc.js` 3. `.pug-lintrc.json` 4. `package.json` You might need to create a configuration file for your project to get meaningful results. g:ale_pug_puglint_executable *g:ale_pug_puglint_executable* *b:ale_pug_puglint_executable* Type: |String| Default: `'pug-lint'` See |ale-integrations-local-executables| g:ale_pug_puglint_options *g:ale_pug_puglint_options* *b:ale_pug_puglint_options* Type: |String| Default: `''` This variable can be set to pass additional options to pug-lint. g:ale_pug_puglint_use_global *g:ale_pug_puglint_use_global* *b:ale_pug_puglint_use_global* Type: |Number| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-puppet.txt000066400000000000000000000043161476501472200156520ustar00rootroot00000000000000=============================================================================== ALE Puppet Integration *ale-puppet-options* =============================================================================== puppet *ale-puppet-puppet* g:ale_puppet_puppet_executable *g:ale_puppet_puppet_executable* *b:ale_puppet_puppet_executable* Type: |String| Default: `'puppet'` This variable can be changed to specify the executable used for puppet. g:ale_puppet_puppet_options *g:ale_puppet_puppet_options* *b:ale_puppet_puppet_options* Type: |String| Default: `''` This variable can be changed to add command-line arguments to the puppet parser validate invocation. =============================================================================== puppetlint *ale-puppet-puppetlint* g:ale_puppet_puppetlint_executable *g:ale_puppet_puppetlint_executable* *b:ale_puppet_puppetlint_executable* Type: |String| Default: `'puppet-lint'` This variable can be changed to specify the executable used for puppet-lint. g:ale_puppet_puppetlint_options *g:ale_puppet_puppetlint_options* *b:ale_puppet_puppetlint_options* Type: |String| Default: `'--no-autoloader_layout-check'` This variable can be changed to add command-line arguments to the puppet-lint invocation. =============================================================================== puppet-languageserver *ale-puppet-languageserver* g:ale_puppet_languageserver_executable *g:ale_puppet_languageserver_executable* *b:ale_puppet_languageserver_executable* type: |String| Default: `'puppet-languageserver'` This variable can be used to specify the executable used for puppet-languageserver. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-purescript.txt000066400000000000000000000053171476501472200165370ustar00rootroot00000000000000=============================================================================== ALE PureScript Integration *ale-purescript-options* =============================================================================== purescript-language-server *ale-purescript-language-server* PureScript Language Server (https://github.com/nwolverson/purescript-language-server) g:ale_purescript_ls_executable g:ale_purescript_ls_executable b:ale_purescript_ls_executable Type: |String| Default: `'purescript-language-server'` PureScript language server executable. g:ale_purescript_ls_config g:ale_purescript_ls_config b:ale_purescript_ls_config Type: |Dictionary| Default: `{}` Dictionary containing configuration settings that will be passed to the language server. For example, with a spago project: { \ 'purescript': { \ 'addSpagoSources': v:true, \ 'addNpmPath': v:true, \ 'buildCommand': 'spago --quiet build --purs-args --json-errors' \ } \} =============================================================================== purs-tidy *ale-purescript-tidy* g:ale_purescript_tidy_executable *g:ale_purescript_tidy_executable* *b:ale_purescript_tidy_executable* Type: |String| Default: `'purs-tidy'` This variable can be changed to use a different executable for purs-tidy. g:ale_purescript_tidy_use_global *g:ale_purescript_tidy_use_global* *b:ale_purescript_tidy_use_global* Type: |Number| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| g:ale_purescript_tidy_options *g:ale_purescript_tidy_options* *b:ale_purescript_tidy_options* Type: |String| Default: `''` This variable can be set to pass in additional option to the 'purs-tidy' executable. > let g:ale_purescript_options = '--indent 3' < =============================================================================== purty *ale-purescript-purty* g:ale_purescript_purty_executable *g:ale_purescript_purty_executable* *b:ale_purescript_purty_executable* Type: |String| Default: `'purty'` This variable can be changed to use a different executable for purty. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-pyrex.txt000066400000000000000000000017641476501472200155100ustar00rootroot00000000000000=============================================================================== ALE Pyrex (Cython) Integration *ale-pyrex-options* =============================================================================== cython *ale-pyrex-cython* g:ale_pyrex_cython_executable *g:ale_pyrex_cython_executable* *b:ale_pyrex_cython_executable* Type: |String| Default: `'cython'` This variable can be changed to use a different executable for cython. g:ale_pyrex_cython_options *g:ale_pyrex_cython_options* *b:ale_pyrex_cython_options* Type: |String| Default: `'--warning-extra --warning-errors'` This variable can be changed to modify flags given to cython. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-python.txt000066400000000000000000002050441476501472200156570ustar00rootroot00000000000000=============================================================================== ALE Python Integration *ale-python-options* g:ale_python_auto_pipenv *g:ale_python_auto_pipenv* *b:ale_python_auto_pipenv* Type: |Number| Default: `0` Detect whether the file is inside a pipenv, and set the executable to `pipenv` if true. This is overridden by a manually-set executable. g:ale_python_auto_poetry *g:ale_python_auto_poetry* *b:ale_python_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. g:ale_python_auto_uv *g:ale_python_auto_uv* *b:ale_python_auto_uv* Type: |Number| Default: `0` Set the executable to `uv` if true. This is overridden by a manually-set executable. g:ale_python_auto_virtualenv *g:ale_python_auto_virtualenv* *b:ale_python_auto_virtualenv* Type: |Number| Default: `0` If set to `1`, ALE will automatically set environment variables for commands such as `PATH` to attempt to make the experience of running Python linters via virtualenv easier, without the need for another plugin or some specialised setup. =============================================================================== ALE Python Project Root Behavior *ale-python-root* For some linters, ALE will search for a Python project root by looking at the files in directories on or above where a file being checked is. ALE applies the following methods, in order: 1. Find the first directory containing a common Python configuration file. 2. If no configuration file can be found, use the first directory which does not contain a readable file named `__init__.py`. ALE will look for configuration files with the following filenames. > MANIFEST.in setup.cfg pytest.ini tox.ini .pyre_configuration.local mypy.ini .mypy.ini pycodestyle.cfg .flake8 .flake8rc pylama.ini pylintrc .pylintrc pyrightconfig.json pyrightconfig.toml Pipfile Pipfile.lock poetry.lock pyproject.toml .tool-versions < The first directory containing any of the files named above will be used. =============================================================================== autoflake *ale-python-autoflake* g:ale_python_autoflake_executable *g:ale_python_autoflake_executable* *b:ale_python_autoflake_executable* Type: |String| Default: `'autoflake'` See |ale-integrations-local-executables| g:ale_python_autoflake_options *g:ale_python_autoflake_options* *b:ale_python_autoflake_options* Type: |String| Default: `''` This variable can be set to pass extra options to autoflake. g:ale_python_autoflake_use_global *g:ale_python_autoflake_use_global* *b:ale_python_autoflake_use_global* Type: |Number| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| g:ale_python_autoflake_auto_pipenv *g:ale_python_autoflake_auto_pipenv* *b:ale_python_autoflake_auto_pipenv* Type: |Number| Default: `0` Detect whether the file is inside a pipenv, and set the executable to `pipenv` if true. This is overridden by a manually-set executable. g:ale_python_autoflake_auto_poetry *g:ale_python_autoflake_auto_poetry* *b:ale_python_autoflake_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. g:ale_python_autoflake_auto_uv *g:ale_python_autoflake_auto_uv* *b:ale_python_autoflake_auto_uv* Type: |Number| Default: `0` Set the executable to `uv` if true. This is overridden by a manually-set executable. =============================================================================== autoimport *ale-python-autoimport* g:ale_python_autoimport_executable *g:ale_python_autoimport_executable* *b:ale_python_autoimport_executable* Type: |String| Default: `'autoimport'` See |ale-integrations-local-executables| g:ale_python_autoimport_options *g:ale_python_autoimport_options* *b:ale_python_autoimport_options* Type: |String| Default: `''` This variable can be set to pass extra options to autoimport. g:ale_python_autoimport_use_global *g:ale_python_autoimport_use_global* *b:ale_python_autoimport_use_global* Type: |Number| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| g:ale_python_autoimport_auto_pipenv *g:ale_python_autoimport_auto_pipenv* *b:ale_python_autoimport_auto_pipenv* Type: |Number| Default: `0` Detect whether the file is inside a pipenv, and set the executable to `pipenv` if true. This is overridden by a manually-set executable. g:ale_python_autoimport_auto_poetry *g:ale_python_autoimport_auto_poetry* *b:ale_python_autoimport_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. g:ale_python_autoimport_auto_uv *g:ale_python_autoimport_auto_uv* *b:ale_python_autoimport_auto_uv* Type: |Number| Default: `0` Set the executable to `uv` if true. This is overridden by a manually-set executable. =============================================================================== autopep8 *ale-python-autopep8* g:ale_python_autopep8_executable *g:ale_python_autopep8_executable* *b:ale_python_autopep8_executable* Type: |String| Default: `'autopep8'` See |ale-integrations-local-executables| g:ale_python_autopep8_options *g:ale_python_autopep8_options* *b:ale_python_autopep8_options* Type: |String| Default: `''` This variable can be set to pass extra options to autopep8. g:ale_python_autopep8_use_global *g:ale_python_autopep8_use_global* *b:ale_python_autopep8_use_global* Type: |Number| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| g:ale_python_autopep8_auto_pipenv *g:ale_python_autopep8_auto_pipenv* *b:ale_python_autopep8_auto_pipenv* Type: |Number| Default: `0` Detect whether the file is inside a pipenv, and set the executable to `pipenv` if true. This is overridden by a manually-set executable. g:ale_python_autopep8_auto_poetry *g:ale_python_autopep8_auto_poetry* *b:ale_python_autopep8_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. g:ale_python_autopep8_auto_uv *g:ale_python_autopep8_auto_uv* *b:ale_python_autopep8_auto_uv* Type: |Number| Default: `0` Set the executable to `uv` if true. This is overridden by a manually-set executable. =============================================================================== bandit *ale-python-bandit* g:ale_python_bandit_executable *g:ale_python_bandit_executable* *b:ale_python_bandit_executable* Type: |String| Default: `'bandit'` See |ale-integrations-local-executables| Set this to `'pipenv'` to invoke `'pipenv` `run` `bandit'`. Set this to `'poetry'` to invoke `'poetry` `run` `bandit'`. g:ale_python_bandit_options *g:ale_python_bandit_options* *b:ale_python_bandit_options* Type: |String| Default: `''` This variable can be changed to add command-line arguments to the bandit invocation. g:ale_python_bandit_use_config *g:ale_python_bandit_use_config* *b:ale_python_bandit_use_config* Type: |Number| Default: `1` If this variable is true and a `.bandit` file exists in the directory of the file being checked or a parent directory, an `--ini` option is added to the `bandit` command for the nearest `.bandit` file. Set this variable false to disable adding the `--ini` option automatically. g:ale_python_bandit_use_global *g:ale_python_bandit_use_global* *b:ale_python_bandit_use_global* Type: |Number| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| g:ale_python_bandit_auto_pipenv *g:ale_python_bandit_auto_pipenv* *b:ale_python_bandit_auto_pipenv* Type: |Number| Default: `0` Detect whether the file is inside a pipenv, and set the executable to `pipenv` if true. This is overridden by a manually-set executable. g:ale_python_bandit_auto_poetry *g:ale_python_bandit_auto_poetry* *b:ale_python_bandit_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. g:ale_python_bandit_auto_uv *g:ale_python_bandit_auto_uv* *b:ale_python_bandit_auto_uv* Type: |Number| Default: `0` Set the executable to `uv` if true. This is overridden by a manually-set executable. =============================================================================== black *ale-python-black* g:ale_python_black_executable *g:ale_python_black_executable* *b:ale_python_black_executable* Type: |String| Default: `'black'` See |ale-integrations-local-executables| g:ale_python_black_options *g:ale_python_black_options* *b:ale_python_black_options* Type: |String| Default: `''` This variable can be set to pass extra options to black. g:ale_python_black_use_global *g:ale_python_black_use_global* *b:ale_python_black_use_global* Type: |Number| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| g:ale_python_black_auto_pipenv *g:ale_python_black_auto_pipenv* *b:ale_python_black_auto_pipenv* Type: |Number| Default: `0` Detect whether the file is inside a pipenv, and set the executable to `pipenv` if true. This is overridden by a manually-set executable. g:ale_python_black_auto_poetry *g:ale_python_black_auto_poetry* *b:ale_python_black_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. g:ale_python_black_auto_uv *g:ale_python_black_auto_uv* *b:ale_python_black_auto_uv* Type: |Number| Default: `0` Set the executable to `uv` if true. This is overridden by a manually-set executable. g:ale_python_black_change_directory *g:ale_python_black_change_directory* *b:ale_python_black_change_directory* Type: |Number| Default: `1` If set to `1`, ALE will switch to the directory the Python file being checked with `black` is in before checking it. This helps `black` find configuration files more easily. This option can be turned off if you want to control the directory Python is executed from yourself. =============================================================================== cspell *ale-python-cspell* See |ale-cspell-options| =============================================================================== flake8 *ale-python-flake8* g:ale_python_flake8_change_directory *g:ale_python_flake8_change_directory* *b:ale_python_flake8_change_directory* Type: |String| Default: `'project'` If set to `project`, ALE will switch to the project root before checking file. If set to `file`, ALE will first switch to the directory containing the Python file being checked with `flake8` before checking it. You can turn it off with `off` option if you want to control the directory Python is executed from yourself. g:ale_python_flake8_executable *g:ale_python_flake8_executable* *b:ale_python_flake8_executable* Type: |String| Default: `'flake8'` This variable can be changed to modify the executable used for flake8. Set this to `'pipenv'` to invoke `'pipenv` `run` `flake8'`. Set this to `'poetry'` to invoke `'poetry` `run` `flake8'`. g:ale_python_flake8_options *g:ale_python_flake8_options* *b:ale_python_flake8_options* Type: |String| Default: `''` This variable can be changed to add command-line arguments to the flake8 invocation. For example, to dynamically switch between programs targeting Python 2 and Python 3, you may want to set > let g:ale_python_flake8_executable = 'python3' " or 'python' for Python 2 let g:ale_python_flake8_options = '-m flake8' < after making sure it's installed for the appropriate Python versions (e.g. `python3 -m pip install --user flake8`). g:ale_python_flake8_use_global *g:ale_python_flake8_use_global* *b:ale_python_flake8_use_global* Type: |Number| Default: `get(g:, 'ale_use_global_executables', 0)` This variable controls whether or not ALE will search for flake8 in a virtualenv directory first. If this variable is set to `1`, then ALE will always use |g:ale_python_flake8_executable| for the executable path. Both variables can be set with `b:` buffer variables instead. g:ale_python_flake8_auto_pipenv *g:ale_python_flake8_auto_pipenv* *b:ale_python_flake8_auto_pipenv* Type: |Number| Default: `0` Detect whether the file is inside a pipenv, and set the executable to `pipenv` if true. This is overridden by a manually-set executable. g:ale_python_flake8_auto_poetry *g:ale_python_flake8_auto_poetry* *b:ale_python_flake8_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. g:ale_python_flake8_auto_uv *g:ale_python_flake8_auto_uv* *b:ale_python_flake8_auto_uv* Type: |Number| Default: `0` Set the executable to `uv` if true. This is overridden by a manually-set executable. =============================================================================== flakehell *ale-python-flakehell* g:ale_python_flakehell_change_directory*g:ale_python_flakehell_change_directory* *b:ale_python_flakehell_change_directory* Type: |String| Default: `project` If set to `project`, ALE will switch to the project root before checking file. If set to `file`, ALE will switch to directory the Python file being checked with `flakehell` is in before checking it. You can turn it off with `off` option if you want to control the directory Python is executed from yourself. g:ale_python_flakehell_executable *g:ale_python_flakehell_executable* *b:ale_python_flakehell_executable* Type: |String| Default: `'flakehell'` This variable can be changed to modify the executable used for flakehell. Set this to `'pipenv'` to invoke `'pipenv` `run` `flakehell'`. Set this to `'poetry'` to invoke `'poetry` `run` `flakehell'`. Set this to `'python'` to invoke `'python` `-m` `flakehell'`. g:ale_python_flakehell_options *g:ale_python_flakehell_options* *b:ale_python_flakehell_options* Type: |String| Default: `''` This variable can be changed to add command-line arguments to the flakehell lint invocation. g:ale_python_flakehell_use_global *g:ale_python_flakehell_use_global* *b:ale_python_flakehell_use_global* Type: |Number| Default: `get(g:, 'ale_use_global_executables', 0)` This variable controls whether or not ALE will search for flakehell in a virtualenv directory first. If this variable is set to `1`, then ALE will always use |g:ale_python_flakehell_executable| for the executable path. Both variables can be set with `b:` buffer variables instead. g:ale_python_flakehell_auto_pipenv *g:ale_python_flakehell_auto_pipenv* *b:ale_python_flakehell_auto_pipenv* Type: |Number| Default: `0` Detect whether the file is inside a pipenv, and set the executable to `pipenv` if true. This is overridden by a manually-set executable. g:ale_python_flakehell_auto_poetry *g:ale_python_flakehell_auto_poetry* *b:ale_python_flakehell_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. g:ale_python_flakehell_auto_uv *g:ale_python_flakehell_auto_uv* *b:ale_python_flakehell_auto_uv* Type: |Number| Default: `0` Set the executable to `uv` if true. This is overridden by a manually-set executable. =============================================================================== isort *ale-python-isort* g:ale_python_isort_executable *g:ale_python_isort_executable* *b:ale_python_isort_executable* Type: |String| Default: `'isort'` See |ale-integrations-local-executables| g:ale_python_isort_options *g:ale_python_isort_options* *b:ale_python_isort_options* Type: |String| Default: `''` This variable can be set to pass extra options to isort. g:ale_python_isort_use_global *g:ale_python_isort_use_global* *b:ale_python_isort_use_global* Type: |Number| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| g:ale_python_isort_auto_pipenv *g:ale_python_isort_auto_pipenv* *b:ale_python_isort_auto_pipenv* Type: |Number| Default: `0` Detect whether the file is inside a pipenv, and set the executable to `pipenv` if true. This is overridden by a manually-set executable. g:ale_python_isort_auto_poetry *g:ale_python_isort_auto_poetry* *b:ale_python_isort_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. g:ale_python_isort_auto_uv *g:ale_python_isort_auto_uv* *b:ale_python_isort_auto_uv* Type: |Number| Default: `0` Set the executable to `uv` if true. This is overridden by a manually-set executable. =============================================================================== mypy *ale-python-mypy* The minimum supported version of mypy that ALE supports is v0.4.4. This is the first version containing the `--shadow-file` option ALE needs to be able to check for errors while you type. `mypy` will be run from a detected project root, per |ale-python-root|. g:ale_python_mypy_auto_pipenv *g:ale_python_mypy_auto_pipenv* *b:ale_python_mypy_auto_pipenv* Type: |Number| Default: `0` Detect whether the file is inside a pipenv, and set the executable to `pipenv` if true. This is overridden by a manually-set executable. g:ale_python_mypy_auto_poetry *g:ale_python_mypy_auto_poetry* *b:ale_python_mypy_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. g:ale_python_mypy_auto_uv *g:ale_python_mypy_auto_uv* *b:ale_python_mypy_auto_uv* Type: |Number| Default: `0` Set the executable to `uv` if true. This is overridden by a manually-set executable. g:ale_python_mypy_executable *g:ale_python_mypy_executable* *b:ale_python_mypy_executable* Type: |String| Default: `'mypy'` See |ale-integrations-local-executables| Set this to `'pipenv'` to invoke `'pipenv` `run` `mypy'`. Set this to `'poetry'` to invoke `'poetry` `run` `mypy'`. g:ale_python_mypy_ignore_invalid_syntax *g:ale_python_mypy_ignore_invalid_syntax* *b:ale_python_mypy_ignore_invalid_syntax* Type: |Number| Default: `0` When set to `1`, syntax error messages for mypy will be ignored. This option can be used when running other Python linters which check for syntax errors, as mypy can take a while to finish executing. g:ale_python_mypy_options *g:ale_python_mypy_options* *b:ale_python_mypy_options* Type: |String| Default: `''` This variable can be changed to add command-line arguments to the mypy invocation. g:ale_python_mypy_show_notes *g:ale_python_mypy_show_notes* *b:ale_python_mypy_show_notes* Type: |Number| Default: `1` If enabled, notes on lines will be displayed as 'I' (info) messages. g:ale_python_mypy_use_global *g:ale_python_mypy_use_global* *b:ale_python_mypy_use_global* Type: |Number| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| =============================================================================== prospector *ale-python-prospector* g:ale_python_prospector_executable *g:ale_python_prospector_executable* *b:ale_python_prospector_executable* Type: |String| Default: `'prospector'` See |ale-integrations-local-executables| Set this to `'pipenv'` to invoke `'pipenv` `run` `prospector'`. Set this to `'poetry'` to invoke `'poetry` `run` `prospector'`. g:ale_python_prospector_options *g:ale_python_prospector_options* *b:ale_python_prospector_options* Type: |String| Default: `''` This variable can be changed to add command-line arguments to the prospector invocation. For example, to dynamically switch between programs targeting Python 2 and Python 3, you may want to set > let g:ale_python_prospector_executable = 'python3' " or 'python' for Python 2 let g:ale_python_prospector_options = '--rcfile /path/to/.prospector.yaml' " The virtualenv detection needs to be disabled. let g:ale_python_prospector_use_global = 0 after making sure it's installed for the appropriate Python versions (e.g. `python3 -m pip install --user prospector`). g:ale_python_prospector_use_global *g:ale_python_prospector_use_global* *b:ale_python_prospector_use_global* Type: |Number| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| g:ale_python_prospector_auto_pipenv *g:ale_python_prospector_auto_pipenv* *b:ale_python_prospector_auto_pipenv* Type: |Number| Default: `0` Detect whether the file is inside a pipenv, and set the executable to `pipenv` if true. This is overridden by a manually-set executable. g:ale_python_prospector_auto_poetry *g:ale_python_prospector_auto_poetry* *b:ale_python_prospector_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. g:ale_python_prospector_auto_uv *g:ale_python_prospector_auto_uv* *b:ale_python_prospector_auto_uv* Type: |Number| Default: `0` Set the executable to `uv` if true. This is overridden by a manually-set executable. =============================================================================== pycln *ale-python-pycln* g:ale_python_pycln_change_directory *g:ale_python_pycln_change_directory* *b:ale_python_pycln_change_directory* Type: |Number| Default: `1` If set to `1`, `pycln` will be run from a detected project root, per |ale-python-root|. if set to `0` or no project root detected, `pycln` will be run from the buffer's directory. g:ale_python_pycln_executable *g:ale_python_pycln_executable* *b:ale_python_pycln_executable* Type: |String| Default: `'pycln'` See |ale-integrations-local-executables| Set this to `'pipenv'` to invoke `'pipenv` `run` `pycln'`. Set this to `'poetry'` to invoke `'poetry` `run` `pycln'`. g:ale_python_pycln_options *g:ale_python_pycln_options* *b:ale_python_pycln_options* Type: |String| Default: `''` This variable can be changed to add command-line arguments to the pycln invocation. For example, to select/enable and/or disable some error codes, you may want to set > let g:ale_python_pycln_options = '--expand-stars' g:ale_python_pycln_config_file *g:ale_python_pycln_config_file* *b:ale_python_pycln_config_file* Type: |String| Default: `''` Use this variable to set the configuration file. If `'--config' ` is found in the |g:ale_python_pycln_options|, then that option value will override the value in this variable. g:ale_python_pycln_use_global *g:ale_python_pycln_use_global* *b:ale_python_pycln_use_global* Type: |Number| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| g:ale_python_pycln_auto_pipenv *g:ale_python_pycln_auto_pipenv* *b:ale_python_pycln_auto_pipenv* Type: |Number| Default: `0` Detect whether the file is inside a pipenv, and set the executable to `pipenv` if true. This is overridden by a manually-set executable. g:ale_python_pycln_auto_poetry *g:ale_python_pycln_auto_poetry* *b:ale_python_pycln_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. g:ale_python_pycln_auto_uv *g:ale_python_pycln_auto_uv* *b:ale_python_pycln_auto_uv* Type: |Number| Default: `0` Set the executable to `uv` if true. This is overridden by a manually-set executable. =============================================================================== pycodestyle *ale-python-pycodestyle* g:ale_python_pycodestyle_executable *g:ale_python_pycodestyle_executable* *b:ale_python_pycodestyle_executable* Type: |String| Default: `'pycodestyle'` See |ale-integrations-local-executables| Set this to `'pipenv'` to invoke `'pipenv` `run` `pycodestyle'`. Set this to `'poetry'` to invoke `'poetry` `run` `pycodestyle'`. g:ale_python_pycodestyle_options *g:ale_python_pycodestyle_options* *b:ale_python_pycodestyle_options* Type: |String| Default: `''` This variable can be changed to add command-line arguments to the pycodestyle invocation. g:ale_python_pycodestyle_use_global *g:ale_python_pycodestyle_use_global* *b:ale_python_pycodestyle_use_global* Type: |Number| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| g:ale_python_pycodestyle_auto_pipenv *g:ale_python_pycodestyle_auto_pipenv* *b:ale_python_pycodestyle_auto_pipenv* Type: |Number| Default: `0` Detect whether the file is inside a pipenv, and set the executable to `pipenv` if true. This is overridden by a manually-set executable. g:ale_python_pycodestyle_auto_poetry *g:ale_python_pycodestyle_auto_poetry* *b:ale_python_pycodestyle_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. g:ale_python_pycodestyle_auto_uv *g:ale_python_pycodestyle_auto_uv* *b:ale_python_pycodestyle_auto_uv* Type: |Number| Default: `0` Set the executable to `uv` if true. This is overridden by a manually-set executable. =============================================================================== pydocstyle *ale-python-pydocstyle* g:ale_python_pydocstyle_executable *g:ale_python_pydocstyle_executable* *b:ale_python_pydocstyle_executable* Type: |String| Default: `'pydocstyle'` See |ale-integrations-local-executables| Set this to `'pipenv'` to invoke `'pipenv` `run` `pydocstyle'`. Set this to `'poetry'` to invoke `'poetry` `run` `pydocstyle'`. g:ale_python_pydocstyle_options *g:ale_python_pydocstyle_options* *b:ale_python_pydocstyle_options* Type: |String| Default: `''` This variable can be changed to add command-line arguments to the pydocstyle invocation. g:ale_python_pydocstyle_use_global *g:ale_python_pydocstyle_use_global* *b:ale_python_pydocstyle_use_global* Type: |Number| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| g:ale_python_pydocstyle_auto_pipenv *g:ale_python_pydocstyle_auto_pipenv* *b:ale_python_pydocstyle_auto_pipenv* Type: |Number| Default: `0` Detect whether the file is inside a pipenv, and set the executable to `pipenv` if true. This is overridden by a manually-set executable. g:ale_python_pydocstyle_auto_poetry *g:ale_python_pydocstyle_auto_poetry* *b:ale_python_pydocstyle_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. g:ale_python_pydocstyle_auto_uv *g:ale_python_pydocstyle_auto_uv* *b:ale_python_pydocstyle_auto_uv* Type: |Number| Default: `0` Set the executable to `uv` if true. This is overridden by a manually-set executable. =============================================================================== pyflakes *ale-python-pyflakes* g:ale_python_pyflakes_executable *g:ale_python_pyflakes_executable* *b:ale_python_pyflakes_executable* Type: |String| Default: `'pyflakes'` See |ale-integrations-local-executables| Set this to `'pipenv'` to invoke `'pipenv` `run` `pyflakes'`. Set this to `'poetry'` to invoke `'poetry` `run` `pyflakes'`. g:ale_python_pyflakes_auto_pipenv *g:ale_python_pyflakes_auto_pipenv* *b:ale_python_pyflakes_auto_pipenv* Type: |Number| Default: `0` Detect whether the file is inside a pipenv, and set the executable to `pipenv` if true. This is overridden by a manually-set executable. g:ale_python_pyflakes_auto_poetry *g:ale_python_pyflakes_auto_poetry* *b:ale_python_pyflakes_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. g:ale_python_pyflakes_auto_uv *g:ale_python_pyflakes_auto_uv* *b:ale_python_pyflakes_auto_uv* Type: |Number| Default: `0` Set the executable to `uv` if true. This is overridden by a manually-set executable. =============================================================================== pyflyby *ale-python-pyflyby* g:ale_python_pyflyby_executable *g:ale_python_pyflyby_executable* *b:ale_python_pyflyby_executable* Type: |String| Default: `'tidy-imports'` See |ale-integrations-local-executables| g:ale_python_pyflyby_options *g:ale_python_pyflyby_options* *b:ale_python_pyflyby_options* Type: |String| Default: `''` This variable can be changed to add command-line arguments to the pyflyby tidy-imports invocation. g:ale_python_pyflyby_use_global *g:ale_python_pyflyby_use_global* *b:ale_python_pyflyby_use_global* Type: |Number| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| g:ale_python_pyflyby_auto_pipenv *g:ale_python_pyflyby_auto_pipenv* *b:ale_python_pyflyby_auto_pipenv* Type: |Number| Default: `0` Detect whether the file is inside a pipenv, and set the executable to `pipenv` if true. This is overridden by a manually-set executable. g:ale_python_pyflyby_auto_poetry *g:ale_python_pyflyby_auto_poetry* *b:ale_python_pyflyby_auto_poetry* Type: |Number| Default: `0` Detect whether the file is inside a poetry, and set the executable to `poetry` if true. This is overridden by a manually-set executable. g:ale_python_pyflyby_auto_uv *g:ale_python_pyflyby_auto_uv* *b:ale_python_pyflyby_auto_uv* Type: |Number| Default: `0` Set the executable to `uv` if true. This is overridden by a manually-set executable. =============================================================================== pylama *ale-python-pylama* g:ale_python_pylama_change_directory *g:ale_python_pylama_change_directory* *b:ale_python_pylama_change_directory* Type: |Number| Default: `1` If set to `1`, `pylama` will be run from a detected project root, per |ale-python-root|. This is useful because `pylama` only searches for configuration files in its current directory and applies file masks using paths relative to its current directory. This option can be turned off if you want to control the directory in which `pylama` is executed. g:ale_python_pylama_executable *g:ale_python_pylama_executable* *b:ale_python_pylama_executable* Type: |String| Default: `'pylama'` This variable can be changed to modify the executable used for pylama. Set this to `'pipenv'` to invoke `'pipenv` `run` `pylama'`. Set this to `'poetry'` to invoke `'poetry` `run` `pylama'`. g:ale_python_pylama_options *g:ale_python_pylama_options* *b:ale_python_pylama_options* Type: |String| Default: `''` This variable can be changed to add command-line arguments to the pylama invocation. g:ale_python_pylama_use_global *g:ale_python_pylama_use_global* *b:ale_python_pylama_use_global* Type: |Number| Default: `get(g:, 'ale_use_global_executables', 0)` This variable controls whether or not ALE will search for pylama in a virtualenv directory first. If this variable is set to `1`, then ALE will always use |g:ale_python_pylama_executable| for the executable path. Both variables can be set with `b:` buffer variables instead. g:ale_python_pylama_auto_pipenv *g:ale_python_pylama_auto_pipenv* *b:ale_python_pylama_auto_pipenv* Type: |Number| Default: `0` Detect whether the file is inside a pipenv, and set the executable to `pipenv` if true. This is overridden by a manually-set executable. g:ale_python_pylama_auto_poetry *g:ale_python_pylama_auto_poetry* *b:ale_python_pylama_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. g:ale_python_pylama_auto_uv *g:ale_python_pylama_auto_uv* *b:ale_python_pylama_auto_uv* Type: |Number| Default: `0` Set the executable to `uv` if true. This is overridden by a manually-set executable. =============================================================================== pylint *ale-python-pylint* g:ale_python_pylint_change_directory *g:ale_python_pylint_change_directory* *b:ale_python_pylint_change_directory* Type: |Number| Default: `1` If set to `1`, `pylint` will be run from a detected project root, per |ale-python-root|. Since `pylint` only checks for `pylintrc` in the packages above its current directory before falling back to user and global `pylintrc` files, this is necessary for `pylint` to use a project `pylintrc` file, if present. This option can be turned off if you want to control the directory Python is executed from yourself. g:ale_python_pylint_executable *g:ale_python_pylint_executable* *b:ale_python_pylint_executable* Type: |String| Default: `'pylint'` See |ale-integrations-local-executables| Set this to `'pipenv'` to invoke `'pipenv` `run` `pylint'`. Set this to `'poetry'` to invoke `'poetry` `run` `pylint'`. g:ale_python_pylint_options *g:ale_python_pylint_options* *b:ale_python_pylint_options* Type: |String| Default: `''` This variable can be changed to add command-line arguments to the pylint invocation. For example, to dynamically switch between programs targeting Python 2 and Python 3, you may want to set > let g:ale_python_pylint_executable = 'python3' " or 'python' for Python 2 let g:ale_python_pylint_options = '--rcfile /path/to/pylint.rc' " The virtualenv detection needs to be disabled. let g:ale_python_pylint_use_global = 0 after making sure it's installed for the appropriate Python versions (e.g. `python3 -m pip install --user pylint`). g:ale_python_pylint_use_global *g:ale_python_pylint_use_global* *b:ale_python_pylint_use_global* Type: |Number| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| g:ale_python_pylint_auto_pipenv *g:ale_python_pylint_auto_pipenv* *b:ale_python_pylint_auto_pipenv* Type: |Number| Default: `0` Detect whether the file is inside a pipenv, and set the executable to `pipenv` if true. This is overridden by a manually-set executable. g:ale_python_pylint_auto_poetry *g:ale_python_pylint_auto_poetry* *b:ale_python_pylint_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. g:ale_python_pylint_auto_uv *g:ale_python_pylint_auto_uv* *b:ale_python_pylint_auto_uv* Type: |Number| Default: `0` Set the executable to `uv` if true. This is overridden by a manually-set executable. g:ale_python_pylint_use_msg_id *g:ale_python_pylint_use_msg_id* *b:ale_python_pylint_use_msg_id* Type: |Number| Default: `0` Use message for output (e.g. I0011) instead of symbolic name of the message (e.g. locally-disabled). =============================================================================== pylsp *ale-python-pylsp* `pylsp` will be run from a detected project root, per |ale-python-root|. g:ale_python_pylsp_executable *g:ale_python_pylsp_executable* *b:ale_python_pylsp_executable* Type: |String| Default: `'pylsp'` See |ale-integrations-local-executables| Set this to `'pipenv'` to invoke `'pipenv` `run` `pylsp'`. Set this to `'poetry'` to invoke `'poetry` `run` `pyls'`. g:ale_python_pylsp_use_global *g:ale_python_pylsp_use_global* *b:ale_python_pylsp_use_global* Type: |Number| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| g:ale_python_pylsp_auto_pipenv *g:ale_python_pylsp_auto_pipenv* *b:ale_python_pylsp_auto_pipenv* Type: |Number| Default: `0` Detect whether the file is inside a pipenv, and set the executable to `pipenv` if true. This is overridden by a manually-set executable. g:ale_python_pylsp_auto_poetry *g:ale_python_pylsp_auto_poetry* *b:ale_python_pylsp_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. g:ale_python_pylsp_auto_uv *g:ale_python_pylsp_auto_uv* *b:ale_python_pylsp_auto_uv* Type: |Number| Default: `0` Set the executable to `uv` if true. This is overridden by a manually-set executable. g:ale_python_pylsp_config *g:ale_python_pylsp_config* *b:ale_python_pylsp_config* Type: |Dictionary| Default: `{}` Dictionary with configuration settings for pylsp. For example, to disable the pycodestyle linter: > { \ 'pylsp': { \ 'plugins': { \ 'pycodestyle': { \ 'enabled': v:false \ } \ } \ }, \ } < g:ale_python_pylsp_options *g:ale_python_pylsp_options* *b:ale_python_pylsp_options* Type: |String| Default: `''` This variable can be changed to add command-line arguments to the pylsp invocation. Note that this is not the same thing as ale_python_pylsp_config, which allows configuration of how pylsp functions; this is intended to provide flexibility in how the pylsp command is invoked. For example, if you had installed `pylsp` but your `pylsp` executable was not on your `PATH` for some reason, an alternative way to run the pylsp server would be: let g:ale_python_pylsp_executable = 'python3' let g:ale_python_pylsp_options = '-m pylsp' An example strategy for installing `pylsp`: `python3 -m pip install --user pylsp` =============================================================================== pyre *ale-python-pyre* `pyre` will be run from a detected project root, per |ale-python-root|. g:ale_python_pyre_executable *g:ale_python_pyre_executable* *b:ale_python_pyre_executable* Type: |String| Default: `'pyre'` See |ale-integrations-local-executables| Set this to `'pipenv'` to invoke `'pipenv` `run` `pyre'`. Set this to `'poetry'` to invoke `'poetry` `run` `pyre'`. g:ale_python_pyre_use_global *g:ale_python_pyre_use_global* *b:ale_python_pyre_use_global* Type: |Number| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| g:ale_python_pyre_auto_pipenv *g:ale_python_pyre_auto_pipenv* *b:ale_python_pyre_auto_pipenv* Type: |Number| Default: `0` Detect whether the file is inside a pipenv, and set the executable to `pipenv` if true. This is overridden by a manually-set executable. g:ale_python_pyre_auto_poetry *g:ale_python_pyre_auto_poetry* *b:ale_python_pyre_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. g:ale_python_pyre_auto_uv *g:ale_python_pyre_auto_uv* *b:ale_python_pyre_auto_uv* Type: |Number| Default: `0` Set the executable to `uv` if true. This is overridden by a manually-set executable. =============================================================================== pyright *ale-python-pyright* The `pyright` linter requires a recent version of `pyright` which includes the `pyright-langserver` executable. You can install `pyright` on your system through `npm` with `sudo npm install -g pyright` or similar. Refer to their README for installation instructions: https://github.com/Microsoft/pyright `pyright` needs to know the path to your Python executable and probably a virtualenv to run. ALE will try to detect these automatically. See |g:ale_python_pyright_config|. g:ale_python_pyright_executable *g:ale_python_pyright_executable* *b:ale_python_pyright_executable* Type: |String| Default: `'pyright-langserver'` The executable for running `pyright`, which is typically installed globally. g:ale_python_pyright_config *g:ale_python_pyright_config* *b:ale_python_pyright_config* Type: |Dictionary| Default: `{}` Settings for configuring the `pyright` language server. See pyright's documentation for a full list of options: https://github.com/microsoft/pyright/blob/master/docs/settings.md ALE will automatically try to set defaults for `venvPath` and `pythonPath` so your project can automatically be checked with the right libraries. You can override these settings with whatever you want in your ftplugin file like so: > let b:ale_python_pyright_config = { \ 'python': { \ 'pythonPath': '/bin/python', \ 'venvPath': '/other/dir', \ }, \} < If `venvPath` is set, but `pythonPath` is not, ALE will use `venvPath . '/bin/python'` or similar as `pythonPath`. A commonly used setting for `pyright` is disabling language services apart from type checking and "hover" (|ale-hover|), you can set this setting like so, or use whatever other settings you want: > let b:ale_python_pyright_config = { \ 'pyright': { \ 'disableLanguageServices': v:true, \ }, \} < g:ale_python_pyright_auto_pipenv *g:ale_python_pyright_auto_pipenv* *b:ale_python_pyright_auto_pipenv* Type: |Number| Default: `0` Detect whether the file is inside a pipenv, and set the executable to `pipenv` if true. This is overridden by a manually-set executable. g:ale_python_pyright_auto_poetry *g:ale_python_pyright_auto_poetry* *b:ale_python_pyright_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. g:ale_python_pyright_auto_uv *g:ale_python_pyright_auto_uv* *b:ale_python_pyright_auto_uv* Type: |Number| Default: `0` Set the executable to `uv` if true. This is overridden by a manually-set executable. =============================================================================== refurb *ale-python-refurb* g:ale_python_refurb_change_directory *g:ale_python_refurb_change_directory* *b:ale_python_refurb_change_directory* Type: |Number| Default: `1` If set to `1`, `refurb` will be run from a detected project root, per |ale-python-root|. if set to `0` or no project root detected, `refurb` will be run from the buffer's directory. g:ale_python_refurb_executable *g:ale_python_refurb_executable* *b:ale_python_refurb_executable* Type: |String| Default: `'refurb'` See |ale-integrations-local-executables| Set this to `'pipenv'` to invoke `'pipenv` `run` `refurb'`. Set this to `'poetry'` to invoke `'poetry` `run` `refurb'`. g:ale_python_refurb_options *g:ale_python_refurb_options* *b:ale_python_refurb_options* Type: |String| Default: `''` This variable can be changed to add command-line arguments to the refurb invocation. For example, to select/enable and/or disable some error codes, you may want to set > let g:ale_python_refurb_options = '--ignore 100' g:ale_python_refurb_use_global *g:ale_python_refurb_use_global* *b:ale_python_refurb_use_global* Type: |Number| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| g:ale_python_refurb_auto_pipenv *g:ale_python_refurb_auto_pipenv* *b:ale_python_refurb_auto_pipenv* Type: |Number| Default: `0` Detect whether the file is inside a pipenv, and set the executable to `pipenv` if true. This is overridden by a manually-set executable. g:ale_python_refurb_auto_poetry *g:ale_python_refurb_auto_poetry* *b:ale_python_refurb_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. g:ale_python_refurb_auto_uv *g:ale_python_refurb_auto_uv* *b:ale_python_refurb_auto_uv* Type: |Number| Default: `0` Set the executable to `uv` if true. This is overridden by a manually-set executable. =============================================================================== reorder-python-imports *ale-python-reorder_python_imports* g:ale_python_reorder_python_imports_executable *g:ale_python_reorder_python_imports_executable* *b:ale_python_reorder_python_imports_executable* Type: |String| Default: `'reorder-python-imports'` See |ale-integrations-local-executables| g:ale_python_reorder_python_imports_options *g:ale_python_reorder_python_imports_options* *b:ale_python_reorder_python_imports_options* Type: |String| Default: `''` This variable can be set to pass extra options to reorder-python-imports. g:ale_python_reorder_python_imports_use_global *g:ale_python_reorder_python_imports_use_global* *b:ale_python_reorder_python_imports_use_global* Type: |Number| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| g:ale_python_reorder_python_imports_auto_pipenv *g:ale_python_reorder_python_imports_auto_pipenv* *b:ale_python_reorder_python_imports_auto_pipenv* Type: |Number| Default: `0` Detect whether the file is inside a pipenv, and set the executable to `pipenv` if true. This is overridden by a manually-set executable. g:ale_python_reorder_python_imports_auto_poetry *g:ale_python_reorder_python_imports_auto_poetry* *b:ale_python_reorder_python_imports_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. g:ale_python_reorder_python_imports_auto_uv *g:ale_python_reorder_python_imports_auto_uv* *b:ale_python_reorder_python_imports_auto_uv* Type: |Number| Default: `0` Set the executable to `uv` if true. This is overridden by a manually-set executable. =============================================================================== ruff *ale-python-ruff* g:ale_python_ruff_change_directory *g:ale_python_ruff_change_directory* *b:ale_python_ruff_change_directory* Type: |Number| Default: `1` If set to `1`, `ruff` will be run from a detected project root, per |ale-python-root|. if set to `0` or no project root detected, `ruff` will be run from the buffer's directory. g:ale_python_ruff_executable *g:ale_python_ruff_executable* *b:ale_python_ruff_executable* Type: |String| Default: `'ruff'` See |ale-integrations-local-executables| Set this to `'pipenv'` to invoke `'pipenv` `run` `ruff'`. Set this to `'poetry'` to invoke `'poetry` `run` `ruff'`. g:ale_python_ruff_options *g:ale_python_ruff_options* *b:ale_python_ruff_options* Type: |String| Default: `''` This variable can be changed to add command-line arguments to the ruff invocation. For example, to select/enable and/or disable some error codes, you may want to set > let g:ale_python_ruff_options = '--ignore F401' g:ale_python_ruff_use_global *g:ale_python_ruff_use_global* *b:ale_python_ruff_use_global* Type: |Number| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| g:ale_python_ruff_auto_pipenv *g:ale_python_ruff_auto_pipenv* *b:ale_python_ruff_auto_pipenv* Type: |Number| Default: `0` Detect whether the file is inside a pipenv, and set the executable to `pipenv` if true. This is overridden by a manually-set executable. g:ale_python_ruff_auto_poetry *g:ale_python_ruff_auto_poetry* *b:ale_python_ruff_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. g:ale_python_ruff_auto_uv *g:ale_python_ruff_auto_uv* *b:ale_python_ruff_auto_uv* Type: |Number| Default: `0` Set the executable to `uv` if true. This is overridden by a manually-set executable. =============================================================================== ruff-format *ale-python-ruff-format* g:ale_python_ruff_format_change_directory *g:ale_python_ruff_format_change_directory* *b:ale_python_ruff_format_change_directory* Type: |Number| Default: `1` If set to `1`, `ruff` will be run from a detected project root, per |ale-python-root|. if set to `0` or no project root detected, `ruff` will be run from the buffer's directory. g:ale_python_ruff_format_executable *g:ale_python_ruff_format_executable* *b:ale_python_ruff_format_executable* Type: |String| Default: `'ruff'` See |ale-integrations-local-executables| Set this to `'pipenv'` to invoke `'pipenv` `run` `ruff'`. Set this to `'poetry'` to invoke `'poetry` `run` `ruff'`. g:ale_python_ruff_format_options *g:ale_python_ruff_format_options* *b:ale_python_ruff_format_options* Type: |String| Default: `''` This variable can be changed to add command-line arguments to the ruff invocation. For example, to select/enable and/or disable some error codes, you may want to set > let g:ale_python_ruff_format_options = '--ignore F401' g:ale_python_ruff_format_use_global *g:ale_python_ruff_format_use_global* *b:ale_python_ruff_format_use_global* Type: |Number| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| g:ale_python_ruff_format_auto_pipenv *g:ale_python_ruff_format_auto_pipenv* *b:ale_python_ruff_format_auto_pipenv* Type: |Number| Default: `0` Detect whether the file is inside a pipenv, and set the executable to `pipenv` if true. This is overridden by a manually-set executable. g:ale_python_ruff_format_auto_poetry *g:ale_python_ruff_format_auto_poetry* *b:ale_python_ruff_format_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. g:ale_python_ruff_format_auto_uv *g:ale_python_ruff_format_auto_uv* *b:ale_python_ruff_format_auto_uv* Type: |Number| Default: `0` Set the executable to `uv` if true. This is overridden by a manually-set executable. =============================================================================== unimport *ale-python-unimport* `unimport` will be run from a detected project root, per |ale-python-root|. g:ale_python_unimport_auto_pipenv *g:ale_python_unimport_auto_pipenv* *b:ale_python_unimport_auto_pipenv* Type: |Number| Default: `0` Detect whether the file is inside a pipenv, and set the executable to `pipenv` if true. This is overridden by a manually-set executable. g:ale_python_unimport_auto_poetry *g:ale_python_unimport_auto_poetry* *b:ale_python_unimport_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. g:ale_python_unimport_auto_uv *g:ale_python_unimport_auto_uv* *b:ale_python_unimport_auto_uv* Type: |Number| Default: `0` Set the executable to `uv` if true. This is overridden by a manually-set executable. g:ale_python_unimport_executable *g:ale_python_unimport_executable* *b:ale_python_unimport_executable* Type: |String| Default: `'unimport'` See |ale-integrations-local-executables| Set this to `'pipenv'` to invoke `'pipenv` `run` `unimport'`. Set this to `'poetry'` to invoke `'poetry` `run` `unimport'`. g:ale_python_unimport_options *g:ale_python_unimport_options* *b:ale_python_unimport_options* Type: |String| Default: `''` This variable can be changed to add command-line arguments to the unimport invocation. g:ale_python_unimport_use_global *g:ale_python_unimport_use_global* *b:ale_python_unimport_use_global* Type: |Number| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| =============================================================================== vulture *ale-python-vulture* g:ale_python_vulture_change_directory *g:ale_python_vulture_change_directory* *b:ale_python_vulture_change_directory* Type: |Number| Default: `1` If set to `1`, ALE will switch to the directory the Python file being checked with `vulture` is in before checking it and check the whole project directory instead of checking only the file opened in the current buffer. This helps `vulture` to know the context and avoid false-negative results. g:ale_python_vulture_executable *g:ale_python_vulture_executable* *b:ale_python_vulture_executable* Type: |String| Default: `'vulture'` See |ale-integrations-local-executables| g:ale_python_vulture_options *g:ale_python_vulture_options* *b:ale_python_vulture_options* Type: |String| Default: `''` This variable can be changed to add command-line arguments to the vulture invocation. g:ale_python_vulture_use_global *g:ale_python_vulture_use_global* *b:ale_python_vulture_use_global* Type: |Number| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| g:ale_python_vulture_auto_pipenv *g:ale_python_vulture_auto_pipenv* *b:ale_python_vulture_auto_pipenv* Type: |Number| Default: `0` Detect whether the file is inside a pipenv, and set the executable to `pipenv` if true. This is overridden by a manually-set executable. g:ale_python_vulture_auto_poetry *g:ale_python_vulture_auto_poetry* *b:ale_python_vulture_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. g:ale_python_vulture_auto_uv *g:ale_python_vulture_auto_uv* *b:ale_python_vulture_auto_uv* Type: |Number| Default: `0` Set the executable to `uv` if true. This is overridden by a manually-set executable. =============================================================================== yapf *ale-python-yapf* g:ale_python_yapf_executable *g:ale_python_yapf_executable* *b:ale_python_yapf_executable* Type: |String| Default: `'yapf'` See |ale-integrations-local-executables| g:ale_python_yapf_use_global *g:ale_python_yapf_use_global* *b:ale_python_yapf_use_global* Type: |Number| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| g:ale_python_yapf_auto_pipenv *g:ale_python_yapf_auto_pipenv* *b:ale_python_yapf_auto_pipenv* Type: |Number| Default: `0` Detect whether the file is inside a pipenv, and set the executable to `pipenv` if true. This is overridden by a manually-set executable. g:ale_python_yapf_auto_poetry *g:ale_python_yapf_auto_poetry* *b:ale_python_yapf_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. g:ale_python_yapf_auto_uv *g:ale_python_yapf_auto_uv* *b:ale_python_yapf_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: ale-4.0.0/doc/ale-qml.txt000066400000000000000000000013011476501472200151150ustar00rootroot00000000000000=============================================================================== ALE QML Integration *ale-qml-options* =============================================================================== qmlfmt *ale-qml-qmlfmt* g:ale_qml_qmlfmt_executable *g:ale_qml_qmlfmt_executable* *b:ale_qml_qmlfmt_executable* Type: |String| Default: `'qmlfmt'` This variable can be set to change the path to qmlfmt. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-r.txt000066400000000000000000000052101476501472200145700ustar00rootroot00000000000000=============================================================================== ALE R Integration *ale-r-options* =============================================================================== languageserver *ale-r-languageserver* g:ale_r_languageserver_cmd *g:ale_r_languageserver_cmd* *b:ale_r_languageserver_cmd* Type: |String| Default: `'languageserver::run()'` This option can be configured to change the execution command for languageserver. See the languageserver documentation for more options. g:ale_r_languageserver_config *g:ale_r_languageserver_config* *b:ale_r_languageserver_config* Type: |Dictionary| Default: `{}` This option can be configured to change settings for languageserver. See the languageserver documentation for more information. =============================================================================== lintr *ale-r-lintr* g:ale_r_lintr_options *g:ale_r_lintr_options* *b:ale_r_lintr_options* Type: |String| Default: `'lintr::with_defaults()'` This option can be configured to change the options for lintr. The value of this option will be run with `eval` for the `lintr::lint` options. Consult the lintr documentation for more information. g:ale_r_lintr_lint_package *g:ale_r_lintr_lint_package* *b:ale_r_lintr_lint_package* Type: |Number| Default: `0` When set to `1`, the file will be checked with `lintr::lint_package` instead of `lintr::lint`. This prevents erroneous namespace warnings when linting package files. =============================================================================== styler *ale-r-styler* g:ale_r_styler_options *g:ale_r_styler_options* *b:ale_r_styler_options* Type: |String| Default: `'styler::tidyverse_style'` This option can be configured to change the options for styler. The value of this option will be used as the `style` argument for the `styler::style_file` options. Consult the styler documentation for more information. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-racket.txt000066400000000000000000000035061476501472200156060ustar00rootroot00000000000000=============================================================================== ALE Racket Integration *ale-racket-options* =============================================================================== racket_langserver *ale-racket-langserver* 1. Install racket-langserver as described here: https://github.com/jeapostrophe/racket-langserver 2. Have `racket` available in the `$PATH` environment variable, currently there is no way to specify path to custom location of `racket`. 3. set `racket_langserver` as a linter for `racket` like: > let g:ale_linters['racket'] += ['racket_langserver'] You should be able to see linter results and use LSP features of `ALE` like `ALEGoToDefinition` with `racket-langserver`. =============================================================================== raco_fmt *ale-racket-raco-fmt* g:ale_racket_raco_fmt_executable *g:ale_racket_raco_fmt_executable* *b:ale_racket_raco_fmt_executable* Type: |String| Default: `'raco'` If the `raco` excutable is not in the `$PATH` environment variable, or you prefer to use one installed in a custom location, set this option to the path to the specific `raco` executable. g:ale_racket_raco_fmt_options *g:ale_racket_raco_fmt_options* *b:ale_racket_raco_fmt_options* Type: |String| Default: `''` Use this variable to pass command-line flags/parameters to `raco_fmt` For example, set the page width limit to 40 > let g:ale_racket_raco_fmt_options = '--width 40' =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-reasonml.txt000066400000000000000000000060311476501472200161510ustar00rootroot00000000000000=============================================================================== ALE ReasonML Integration *ale-reasonml-options* =============================================================================== merlin *ale-reasonml-merlin* To use merlin linter for ReasonML source code you need to make sure Merlin for Vim is correctly configured. See the corresponding Merlin wiki page for detailed instructions: https://github.com/the-lambda-church/merlin/wiki/vim-from-scratch =============================================================================== ols *ale-reasonml-ols* The `ocaml-language-server` is the engine that powers OCaml and ReasonML editor support using the Language Server Protocol. See the installation instructions: https://github.com/freebroccolo/ocaml-language-server#installation g:ale_reason_ols_executable *g:ale_reason_ols_executable* *b:ale_reason_ols_executable* Type: |String| Default: `'ocaml-language-server'` This variable can be set to change the executable path for `ols`. g:ale_reason_ols_use_global *g:ale_reason_ols_use_global* *b:ale_reason_ols_use_global* Type: |String| Default: `get(g:, 'ale_use_global_executables', 0)` This variable can be set to `1` to always use the globally installed executable. See also |ale-integrations-local-executables|. =============================================================================== reason-language-server *ale-reasonml-language-server* Note: You must set an executable - there is no 'default' install location. Go to https://github.com/jaredly/reason-language-server and download the latest release. You can place it anywhere, but ensure you set the executable path. g:ale_reason_ls_executable *g:ale_reason_ls_executable* *b:ale_reason_ls_executable* Type: |String| This variable defines the standard location of the language server executable. This must be set. =============================================================================== refmt *ale-reasonml-refmt* g:ale_reasonml_refmt_executable *g:ale_reasonml_refmt_executable* *b:ale_reasonml_refmt_executable* Type: |String| Default: `'refmt'` This variable can be set to pass the path of the refmt fixer. g:ale_reasonml_refmt_options *g:ale_reasonml_refmt_options* *b:ale_reasonml_refmt_options* Type: |String| Default: `''` This variable can be set to pass additional options to the refmt fixer. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-rego.txt000066400000000000000000000034031476501472200152650ustar00rootroot00000000000000=============================================================================== ALE Rego Integration *ale-rego-options* =============================================================================== cspell *ale-rego-cspell* See |ale-cspell-options| =============================================================================== opacheck *ale-rego-opa-check* g:ale_rego_opacheck_executable *g:rego_opacheck_executable* *b:rego_opacheck_executable* Type: |String| Default: `'opa'` This variable can be changed to use a different executable for opa. g:rego_opacheck_options *g:rego_opacheck_options* *b:rego_opacheck_options* Type: |String| Default: `''` This variable can be changed to pass custom CLI flags to opa check. =============================================================================== opafmt *ale-rego-opa-fmt-fixer* g:ale_opa_fmt_executable *g:ale_opa_fmt_executable* *b:ale_opa_fmt_executable* Type: |String| Default: `'opa'` This variable can be changed to use a different executable for opa. g:ale_opa_fmt_options *g:ale_opa_fmt_options* *b:ale_opa_fmt_options* Type: |String| Default: `''` =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-restructuredtext.txt000066400000000000000000000022051476501472200177700ustar00rootroot00000000000000=============================================================================== ALE reStructuredText Integration *ale-restructuredtext-options* =============================================================================== cspell *ale-restructuredtext-cspell* See |ale-cspell-options| =============================================================================== textlint *ale-restructuredtext-textlint* To use textlint at reStructuredText, please install `textlint-plugin-rst`. https://github.com/jimo1001/textlint-plugin-rst > $ npm install textlint-plugin-rst To install `textlint-plugin-rst`, `docutils-ast-writer` python package must be installed. See: https://github.com/jimo1001/docutils-ast-writer See |ale-text-textlint| =============================================================================== write-good *ale-restructuredtext-write-good* See |ale-write-good-options| =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-robot.txt000066400000000000000000000012071476501472200154560ustar00rootroot00000000000000=============================================================================== ALE Robot Integration *ale-robot-options* =============================================================================== rflint *ale-robot-rflint* g:ale_robot_rflint_executable *g:ale_robot_rflint_executable* *b:ale_robot_rflint_executable* Type: |String| Default: `'rflint'` =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-ruby.txt000066400000000000000000000244541476501472200153230ustar00rootroot00000000000000=============================================================================== ALE Ruby Integration *ale-ruby-options* =============================================================================== brakeman *ale-ruby-brakeman* g:ale_ruby_brakeman_executable *g:ale_ruby_brakeman_executable* *b:ale_ruby_brakeman_executable* Type: |String| Default: `'brakeman'` Override the invoked brakeman binary. Set this to `'bundle'` to invoke `'bundle` `exec` brakeman'. g:ale_ruby_brakeman_options *g:ale_ruby_brakeman_options* *b:ale_ruby_brakeman_options* Type: |String| Default: `''` The contents of this variable will be passed through to brakeman. =============================================================================== cspell *ale-ruby-cspell* See |ale-cspell-options| =============================================================================== debride *ale-ruby-debride* g:ale_ruby_debride_executable *g:ale_ruby_debride_executable* *b:ale_ruby_debride_executable* Type: |String| Default: `'debride'` Override the invoked debride binary. Set this to `'bundle'` to invoke `'bundle` `exec` debride'. g:ale_ruby_debride_options *g:ale_ruby_debride_options* *b:ale_ruby_debride_options* Type: |String| Default: `''` This variable can be changed to modify flags given to debride. =============================================================================== packwerk *ale-ruby-packwerk* g:ale_ruby_packwerk_executable *g:ale_ruby_packwerk_executable* *b:ale_ruby_packwerk_executable* Type: |String| Default: `'packwerk'` Override the invoked packwerk binary. Set this to `'bundle'` to invoke `'bundle` `exec` packwerk'. g:ale_ruby_packwerk_options *g:ale_ruby_packwerk_options* *b:ale_ruby_packwerk_options* Type: |String| Default: `''` This variable can be changed to modify flags given to packwerk. =============================================================================== prettier *ale-ruby-prettier* See |ale-javascript-prettier| for information about the available options. =============================================================================== rails_best_practices *ale-ruby-rails_best_practices* g:ale_ruby_rails_best_practices_executable *g:ale_ruby_rails_best_practices_executable* *b:ale_ruby_rails_best_practices_executable* Type: |String| Default: `'rails_best_practices'` Override the invoked rails_best_practices binary. Set this to `'bundle'` to invoke `'bundle` `exec` rails_best_practices'. g:ale_ruby_rails_best_practices_options *g:ale_ruby_rails_best_practices_options* *b:ale_ruby_rails_best_practices_options* Type: |String| Default: `''` The contents of this variable will be passed through to rails_best_practices. =============================================================================== reek *ale-ruby-reek* g:ale_ruby_reek_executable *g:ale_ruby_reek_executable* *b:ale_ruby_reek_executable* Type: |String| Default: `'reek'` Override the invoked reek binary. Set this to `'bundle'` to invoke `'bundle` `exec` reek'. g:ale_ruby_reek_show_context *g:ale_ruby_reek_show_context* *b:ale_ruby_reek_show_context* Type: |Number| Default: `0` Controls whether context is included in the linter message. Defaults to off because context is usually obvious while viewing a file. g:ale_ruby_reek_show_wiki_link *g:ale_ruby_reek_show_wiki_link* *b:ale_ruby_reek_show_wiki_link* Type: |Number| Default: `0` Controls whether linter messages contain a link to an explanatory wiki page for the type of code smell. Defaults to off to improve readability. =============================================================================== rubocop *ale-ruby-rubocop* g:ale_ruby_rubocop_executable *g:ale_ruby_rubocop_executable* *b:ale_ruby_rubocop_executable* Type: |String| Default: `'rubocop'` Override the invoked rubocop binary. Set this to `'bundle'` to invoke `'bundle` `exec` rubocop'. g:ale_ruby_rubocop_options *g:ale_ruby_rubocop_options* *b:ale_ruby_rubocop_options* Type: |String| Default: `''` This variable can be changed to modify flags given to rubocop. g:ale_ruby_rubocop_auto_correct_all *g:ale_ruby_rubocop_auto_correct_all* *b:ale_ruby_rubocop_auto_correct_all* Type: |Number| Default: `0` This variable can be changed to make rubocop to correct all offenses (unsafe). =============================================================================== ruby *ale-ruby-ruby* g:ale_ruby_ruby_executable *g:ale_ruby_ruby_executable* *b:ale_ruby_ruby_executable* Type: |String| Default: `'ruby'` This variable can be changed to use a different executable for ruby. =============================================================================== rufo *ale-ruby-rufo* g:ale_ruby_rufo_executable *g:ale_ruby_rufo_executable* *b:ale_ruby_rufo_executable* Type: |String| Default: `'rufo'` Override the invoked rufo binary. This is useful for running rufo from binstubs or a bundle. =============================================================================== solargraph *ale-ruby-solargraph* g:ale_ruby_solargraph_executable *g:ale_ruby_solargraph_executable* *b:ale_ruby_solargraph_executable* Type: |String| Default: `'solargraph'` Override the invoked solargraph binary. This is useful for running solargraph from binstubs or a bundle. =============================================================================== sorbet *ale-ruby-sorbet* g:ale_ruby_sorbet_executable *g:ale_ruby_sorbet_executable* *b:ale_ruby_sorbet_executable* Type: |String| Default: `'srb'` Override the invoked sorbet binary. Set this to `'bundle'` to invoke `'bundle` `exec` srb'. g:ale_ruby_sorbet_options *g:ale_ruby_sorbet_options* *b:ale_ruby_sorbet_options* Type: |String| Default: `''` This variable can be changed to modify flags given to sorbet. g:ale_ruby_sorbet_enable_watchman *g:ale_ruby_sorbet_enable_watchman* *b:ale_ruby_sorbet_enable_watchman* Type: |Number| Default: `0` Whether or not to use watchman to let the LSP server to know about changes to files from outside of vim. Defaults to disable watchman because it requires watchman to be installed separately from sorbet. =============================================================================== standardrb *ale-ruby-standardrb* g:ale_ruby_standardrb_executable *g:ale_ruby_standardrb_executable* *b:ale_ruby_standardrb_executable* Type: |String| Default: `'standardrb'` Override the invoked standardrb binary. Set this to `'bundle'` to invoke `'bundle` `exec` standardrb'. g:ale_ruby_standardrb_options *g:ale_ruby_standardrb_options* *b:ale_ruby_standardrb_options* Type: |String| Default: `''` This variable can be changed to modify flags given to standardrb. =============================================================================== syntax_tree *ale-ruby-syntax_tree* g:ale_ruby_syntax_tree_executable *g:ale_ruby_syntax_tree_executable* *b:ale_ruby_syntax_tree_executable* Type: |String| Default: `'stree'` Override the invoked SyntaxTree binary. Set this to `'bundle'` to invoke `'bundle` `exec` stree'. g:ale_ruby_syntax_tree_options *g:ale_ruby_syntax_tree_options* *b:ale_ruby_syntax_tree_options* Type: |String| Default: `''` This variable can be changed to modify flags given to SyntaxTree. =============================================================================== rubyfmt *ale-ruby-rubyfmt* g:ale_ruby_rubyfmt_executable *g:ale_ruby_rubyfmt_executable* *b:ale_ruby_rubyfmt_executable* Type: |String| Default: `'rubyfmt'` This option can be changed to change the path for `rubyfmt`. g:ale_ruby_rubyfmt_options *g:ale_ruby_rubyfmt_options* *b:ale_ruby_rubyfmt_options* Type: |String| Default: `''` This option can be changed to pass extra options to `'rubyfmt'`. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-rust.txt000066400000000000000000000305041476501472200153300ustar00rootroot00000000000000=============================================================================== ALE Rust Integration *ale-rust-options* *ale-integration-rust* =============================================================================== Integration Information If Vim does not detect the Rust file type out-of-the-box, you need the runtime files for Rust distributed in Vim >=8.0.0501 or upstream: https://github.com/rust-lang/rust.vim Note that there are several possible linters and fixers for Rust files: 1. rustc -- The Rust compiler is used to check the currently edited file. So, if your project consists of multiple files, you will get some errors when you use e.g. a struct which is defined in another file. You can use |g:ale_rust_ignore_error_codes| to ignore some of these errors. 2. cargo -- If your project is managed by Cargo, the whole project is checked. That means that all errors are properly shown, but cargo can only operate on the files written on disk, so errors will not be reported while you type. 3. rls -- If you have `rls` installed, you might prefer using this linter over cargo. rls implements the Language Server Protocol for incremental compilation of Rust code, and can check Rust files while you type. `rls` requires Rust files to be contained in Cargo projects. 4. analyzer -- If you have rust-analyzer installed, you might prefer using this linter over cargo and rls. rust-analyzer also implements the Language Server Protocol for incremental compilation of Rust code, and is the next iteration of rls. rust-analyzer either requires Rust files to be contained in Cargo projects or requires the project to be described in the rust-project.json format: https://rust-analyzer.github.io/manual.html#non-cargo-based-projects 5. rustfmt -- If you have `rustfmt` installed, you can use it as a fixer to consistently reformat your Rust code. Only cargo and rust-analyze are enabled by default. To switch to using rustc instead of cargo, configure |b:ale_linters| in your ftplugin file appropriately: > " See the help text for the option for more information. let b:ale_linters = ['analyzer', 'rustc'] < Also note that rustc 1.18. or later is needed. =============================================================================== analyzer *ale-rust-analyzer* g:ale_rust_analyzer_executable *g:ale_rust_analyzer_executable* *b:ale_rust_analyzer_executable* Type: |String| Default: `'rust-analyzer'` This variable can be modified to change the executable path for `rust-analyzer`. g:ale_rust_analyzer_config *g:ale_rust_analyzer_config* *b:ale_rust_analyzer_config* Type: |Dictionary| Default: `{}` Dictionary with configuration settings for rust-analyzer. Keys of the dictionary are components of configuration keys. For example: > let g:ale_rust_analyzer_config = { \ 'server': { \ 'extraEnv': { 'RUSTUP_TOOLCHAIN': 'stable' }, \ } \} < corresponds to `rust-analyzer.server.extraEnv = { 'RUSTUP_TOOLCHAIN': 'stable' }` For available configuration parameters, see the `rust-analyzer` manual: https://rust-analyzer.github.io/manual.html#configuration =============================================================================== cargo *ale-rust-cargo* g:ale_rust_cargo_use_check *g:ale_rust_cargo_use_check* *b:ale_rust_cargo_use_check* Type: |Number| Default: `1` When set to `1`, this option will cause ALE to use `cargo check` instead of `cargo build` . `cargo check` is supported since version 1.16.0 of Rust. ALE will never use `cargo check` when the version of `cargo` is less than 0.17.0. g:ale_rust_cargo_check_all_targets *g:ale_rust_cargo_check_all_targets* *b:ale_rust_cargo_check_all_targets* Type: |Number| Default: `0` When set to `1`, ALE will set the `--all-targets` option when `cargo check` is used. See |g:ale_rust_cargo_use_check|, g:ale_rust_cargo_check_tests *g:ale_rust_cargo_check_tests* *b:ale_rust_cargo_check_tests* Type: |Number| Default: `0` When set to `1`, ALE will set the `--tests` option when `cargo check` is used. This allows for linting of tests which are normally excluded. See |g:ale_rust_cargo_use_check|, g:ale_rust_cargo_check_examples *g:ale_rust_cargo_check_examples* *b:ale_rust_cargo_check_examples* Type: |Number| Default: `0` When set to `1`, ALE will set the `--examples` option when `cargo check` is used. This allows for linting of examples which are normally excluded. See |g:ale_rust_cargo_use_check|, g:ale_rust_cargo_default_feature_behavior *g:ale_rust_cargo_default_feature_behavior* *b:ale_rust_cargo_default_feature_behavior* Type: |String| Default: `default` When set to `none`, ALE will set the `--no-default-features` option when invoking `cargo`. Only the features specified in |g:ale_rust_cargo_include_features| will be included when performing the lint check. When set to `default`, ALE will instruct `cargo` to build all default features specified in the project's `Cargo.toml` file, in addition to including any additional features defined in |g:ale_rust_cargo_include_features|. When set to `all`, ALE will set the `--all-features` option when invoking `cargo`, which will include all features defined in the project's `Cargo.toml` file when performing the lint check. g:ale_rust_cargo_include_features *g:ale_rust_cargo_include_features* *b:ale_rust_cargo_include_features* Type: |String| Default: `''` When defined, ALE will set the `--features` option when invoking `cargo` to perform the lint check. See |g:ale_rust_cargo_default_feature_behavior|. g:ale_rust_cargo_avoid_whole_workspace *g:ale_rust_cargo_avoid_whole_workspace* *b:ale_rust_cargo_avoid_whole_workspace* Type: |Number| Default: `1` When set to 1, and ALE is used to edit a crate that is part of a Cargo workspace, avoid building the entire workspace by invoking `cargo` directly in the crate's directory. Otherwise, behave as usual. g:ale_rust_cargo_use_clippy *g:ale_rust_cargo_use_clippy* *b:ale_rust_cargo_use_clippy* Type: |Number| Default: `0` When set to 1, `cargo clippy` will be used instead of `cargo check` or `cargo build` as linter. For details of `cargo clippy`, please visit the following link: https://github.com/rust-lang-nursery/rust-clippy Since `cargo clippy` is optional toolchain, it's safer to check whether `cargo-clippy` is executable as follows: > let g:ale_rust_cargo_use_clippy = executable('cargo-clippy') < g:ale_rust_cargo_clippy_options *g:ale_rust_cargo_clippy_options* *b:ale_rust_cargo_clippy_options* Type: |String| Default: `''` When `cargo clippy` is used, this value will be added to a command line to run it. This variable is useful when you want to add some extra options which only `cargo clippy` supports (e.g. `--deny`). g:ale_rust_cargo_target_dir *g:ale_rust_cargo_target_dir* *b:ale_rust_cargo_target_dir* Type: |String| Default: `''` Use a custom target directory when running the commands for ALE. This can help to avoid "waiting for file lock on build directory" messages when running `cargo` commands manually while ALE is performing its checks. =============================================================================== cspell *ale-rust-cspell* See |ale-cspell-options| =============================================================================== rls *ale-rust-rls* g:ale_rust_rls_executable *g:ale_rust_rls_executable* *b:ale_rust_rls_executable* Type: |String| Default: `'rls'` This variable can be modified to change the executable path for `rls`. g:ale_rust_rls_toolchain *g:ale_rust_rls_toolchain* *b:ale_rust_rls_toolchain* Type: |String| Default: `''` This option can be set to change the toolchain used for `rls`. Possible values include `'nightly'`, `'beta'`, `'stable'`, and `''`. When using option `''`, rls will automatically find the default toolchain set by rustup. If you want to use `rls` from a specific toolchain version, you may also use values like `'channel-yyyy-mm-dd-arch-target'` as long as `'rls +{toolchain_name} -V'` runs correctly in your command line. The `rls` server will only be started once per executable. g:ale_rust_rls_config *g:ale_rust_rls_config* *b:ale_rust_rls_config* Type: |Dictionary| Default: `{}` Dictionary with configuration settings for rls. For example, to force using clippy as linter: > { \ 'rust': { \ 'clippy_preference': 'on' \ } \ } =============================================================================== rustc *ale-rust-rustc* g:ale_rust_rustc_options *g:ale_rust_rustc_options* *b:ale_rust_rustc_options* Type: |String| Default: `'--emit=mir -o /dev/null'` The variable can be used to change the options passed to `rustc`. Users of nightly builds of Rust might want to use `-Z no-codegen` instead. Be careful when setting the options, as running `rustc` could execute code or generate binary files. g:ale_rust_ignore_error_codes *g:ale_rust_ignore_error_codes* *b:ale_rust_ignore_error_codes* Type: |List| of |String|s Default: `[]` This variable can contain error codes which will be ignored. For example, to ignore most errors regarding failed imports, put this in your .vimrc > let g:ale_rust_ignore_error_codes = ['E0432', 'E0433'] g:ale_rust_ignore_secondary_spans *g:ale_rust_ignore_secondary_spans* *b:ale_rust_ignore_secondary_spans* Type: |Number| Default: `0` When set to 1, instructs the Rust error reporting to ignore secondary spans. The problem with secondary spans is that they sometimes appear in error messages before the main cause of the error, for example: > 1 src/main.rs|98 col 5 error| this function takes 4 parameters but 5 parameters were supplied: defined here 2 src/main.rs|430 col 32 error| this function takes 4 parameters but 5 parameters were supplied: expected 4 parameters < This is due to the sorting by line numbers. With this option set to 1, the 'defined here' span will not be presented. =============================================================================== rustfmt *ale-rust-rustfmt* g:ale_rust_rustfmt_options *g:ale_rust_rustfmt_options* *b:ale_rust_rustfmt_options* Type: |String| Default: `''` This variable can be set to pass additional options to the rustfmt fixer. g:ale_rust_rustfmt_executable *g:ale_rust_rustfmt_executable* *b:ale_rust_rustfmt_executable* Type: |String| Default: `'rustfmt'` This variable can be modified to change the executable path for `rustfmt`. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-salt.tmt000066400000000000000000000030031476501472200152550ustar00rootroot00000000000000=============================================================================== ALE SALT Integration *ale-salt-options* =============================================================================== salt-lint *ale-salt-salt-lint* Website: https://github.com/warpnet/salt-lint Installation ------------------------------------------------------------------------------- Install salt-lint in your a virtualenv directory, locally, or globally: > pip install salt-lint # After activating virtualenv pip install --user salt-lint # Install to ~/.local/bin sudo pip install salt-lint # Install globally See |g:ale_virtualenv_dir_names| for configuring how ALE searches for virtualenv directories. Options ------------------------------------------------------------------------------- g:ale_salt_salt_lint_executable *g:ale_salt_salt_lint_executable* *b:ale_salt_salt_lint_executable* Type: |String| Default: `'salt-lint'` This variable can be set to change the path to salt-lint. g:ale_salt_salt_lint_options *g:ale_salt_salt_lint_options* *b:ale_salt_salt_lint_options* Type: |String| Default: `''` This variable can be set to pass additional options to salt-lint. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-sass.txt000066400000000000000000000022621476501472200153040ustar00rootroot00000000000000=============================================================================== ALE Sass Integration *ale-sass-options* =============================================================================== sasslint *ale-sass-sasslint* See |ale-scss-sasslint| for information about the available options. =============================================================================== stylelint *ale-sass-stylelint* g:ale_sass_stylelint_executable *g:ale_sass_stylelint_executable* *b:ale_sass_stylelint_executable* Type: |String| Default: `'stylelint'` See |ale-integrations-local-executables| g:ale_sass_stylelint_use_global *g:ale_sass_stylelint_use_global* *b:ale_sass_stylelint_use_global* Type: |String| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-scala.txt000066400000000000000000000114471476501472200154230ustar00rootroot00000000000000=============================================================================== ALE Scala Integration *ale-scala-options* =============================================================================== cspell *ale-scala-cspell* See |ale-cspell-options| =============================================================================== metals *ale-scala-metals* `metals` requires either an SBT project, a Mill project, or a running Bloop server. g:ale_scala_metals_executable *g:ale_scala_metals_executable* *b:ale_scala_metals_executable* Type: |String| Default: `'metals-vim'` Override the invoked `metals` binary. g:ale_scala_metals_project_root *g:ale_scala_metals_project_root* *b:ale_scala_metals_project_root* Type: |String| Default: `''` By default the project root is found by searching upwards for `build.sbt`, `build.sc`, `.bloop` or `.metals`. If the project root is elsewhere, you can override the project root directory. =============================================================================== sbtserver *ale-scala-sbtserver* `sbtserver` requires a running ^1.1.x sbt shell to connect to. It will attempt to connect via TCP to the address defined in `g:ale_scala_sbtserver_address`. As `sbt` defaults to listening via unix sockets, place these settings into your `~/.sbt/1.0/global.sbt` to ensure that ale will always attempt to connect to the right socket: `serverConnectionType := ConnectionType.Tcp` and `serverPort := 4273` g:ale_scala_sbtserver_address *g:ale_scala_sbtserver_address* *b:ale_scala_sbtserver_address* Type: |String| Default: `'127.0.0.1:4273'` By default the address is found by parsing `active.json`, however, reading a file is a blocking operation which should be avoided in ale. The easy way around this is to configure sbt to always connect to the same port, which the instructions above describe. g:ale_scala_sbtserver_project_root *g:ale_scala_sbtserver_project_root* *b:ale_scala_sbtserver_project_root* Type: |String| Default: `''` By default the project root is found by searching upwards for `build.sbt`. If the project root is elsewhere, you can override the project root directory. =============================================================================== scalafmt *ale-scala-scalafmt* If Nailgun is used, override `g:ale_scala_scalafmt_executable` like so: > let g:ale_scala_scalafmt_executable = 'ng' g:ale_scala_scalafmt_executable *g:ale_scala_scalafmt_executable* *b:ale_scala_scalafmt_executable* Type: |String| Default: `'scalafmt'` Override the invoked `scalafmt` binary. This is useful for running `scalafmt` with Nailgun. g:ale_scala_scalafmt_options *g:ale_scala_scalafmt_options* *b:ale_scala_scalafmt_options* Type: |String| Default: `''` A string containing additional options to pass to `'scalafmt'`, or `'ng scalafmt'` if Nailgun is used. =============================================================================== scalastyle *ale-scala-scalastyle* `scalastyle` requires a configuration file for a project to run. When no configuration file can be found, ALE will report a problem saying that a configuration file is required at line 1. To disable `scalastyle` globally, use |g:ale_linters| like so: > let g:ale_linters = {'scala': ['scalac']} " Enable only scalac instead < See |g:ale_linters| for more information on disabling linters. g:ale_scala_scalastyle_config *g:ale_scala_scalastyle_config* *b:ale_scala_scalastyle_config* Type: |String| Default: `''` A string containing the location of a global fallback configuration file. By default, ALE will look for a configuration file named `scalastyle_config.xml` or `scalastyle-config.xml` in the current file's directory or parent directories. g:ale_scala_scalastyle_options *g:ale_scala_scalastyle_options* *b:ale_scala_scalastyle_options* Type: |String| Default: `''` A string containing additional options to pass to scalastyle. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-scss.txt000066400000000000000000000045641476501472200153150ustar00rootroot00000000000000=============================================================================== ALE SCSS Integration *ale-scss-options* =============================================================================== prettier *ale-scss-prettier* See |ale-javascript-prettier| for information about the available options. =============================================================================== sasslint *ale-scss-sasslint* g:ale_scss_sasslint_executable *g:ale_scss_sasslint_executable* *b:ale_scss_sasslint_executable* Type: |String| Default: `'sass-lint'` See |ale-integrations-local-executables| g:ale_scss_sasslint_options *g:ale_scss_sasslint_options* *b:ale_scss_sasslint_options* Type: |String| Default: `''` This variable can be set to pass additional options to sass-lint. g:ale_scss_sasslint_use_global *g:ale_scss_sasslint_use_global* *b:ale_scss_sasslint_use_global* Type: |Number| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| =============================================================================== stylelint *ale-scss-stylelint* g:ale_scss_stylelint_executable *g:ale_scss_stylelint_executable* *b:ale_scss_stylelint_executable* Type: |String| Default: `'stylelint'` See |ale-integrations-local-executables| g:ale_scss_stylelint_options *g:ale_scss_stylelint_options* *b:ale_scss_stylelint_options* Type: |String| Default: `''` This variable can be set to pass additional options to stylelint. g:ale_scss_stylelint_use_global *g:ale_scss_stylelint_use_global* *b:ale_scss_stylelint_use_global* Type: |String| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-sh.txt000066400000000000000000000126271476501472200147530ustar00rootroot00000000000000=============================================================================== ALE Shell Integration *ale-sh-options* =============================================================================== bashate *ale-sh-bashate* g:ale_sh_bashate_executable *g:ale_sh_bashate_executable* *b:ale_sh_bashate_executable* Type: |String| Default: `'bashate'` This variable sets executable used for bashate. g:ale_sh_bashate_options *g:ale_sh_bashate_options* *b:ale_sh_bashate_options* Type: |String| Default: `''` With this variable we are able to pass extra arguments for bashate. For example to ignore the indentation rule: > let g:ale_sh_bashate_options = '-i E003' < =============================================================================== cspell *ale-sh-cspell* See |ale-cspell-options| =============================================================================== sh-language-server *ale-sh-language-server* g:ale_sh_language_server_executable *g:ale_sh_language_server_executable* *b:ale_sh_language_server_executable* Type: |String| Default: `'bash-language-server'` See |ale-integrations-local-executables| g:ale_sh_language_server_use_global *g:ale_sh_language_server_use_global* *b:ale_sh_language_server_use_global* Type: |Number| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| =============================================================================== shell *ale-sh-shell* g:ale_sh_shell_default_shell *g:ale_sh_shell_default_shell* *b:ale_sh_shell_default_shell* Type: |String| Default: The current shell (`$SHELL`). Falls back to `'bash'` if that cannot be read or if the current shell is `'fish'`. When ALE runs the linter for shells with the `-n` flag, it will attempt to read the shell from the shebang (`#!`) line from the shell script to determine the shell program to run. When this detection fails, this variable will be used instead. =============================================================================== shellcheck *ale-sh-shellcheck* g:ale_sh_shellcheck_executable *g:ale_sh_shellcheck_executable* *b:ale_sh_shellcheck_executable* Type: |String| Default: `'shellcheck'` This variable sets executable used for shellcheck. g:ale_sh_shellcheck_options *g:ale_sh_shellcheck_options* *b:ale_sh_shellcheck_options* Type: |String| Default: `''` With this variable we are able to pass extra arguments for shellcheck for shellcheck invocation. For example, if we want shellcheck to follow external sources (`see SC1091`) we can set the variable as such: > let g:ale_sh_shellcheck_options = '-x' < g:ale_sh_shellcheck_change_directory *g:ale_sh_shellcheck_change_directory* *b:ale_sh_shellcheck_change_directory* Type: |Number| Default: `1` If set to `1`, ALE will switch to the directory the shell file being checked with `shellcheck` is in before checking it. This helps `shellcheck` determine the path to sourced files more easily. This option can be turned off if you want to control the directory `shellcheck` is executed from yourself. g:ale_sh_shellcheck_dialect *g:ale_sh_shellcheck_dialect* *b:ale_sh_shellcheck_dialect* Type: |String| Default: `'auto'` This variable specifies the shellcheck dialect (`-s` option). The value `'auto'` causes ALE to detect the dialect automatically, based on the shebang line (if present) or the value of `b:is_bash`, `b:is_sh`, or `b:is_kornshell` (set and used by |sh.vim|). g:ale_sh_shellcheck_exclusions *g:ale_sh_shellcheck_exclusions* *b:ale_sh_shellcheck_exclusions* Type: |String| Default: `''` Set this variable to exclude test(s) for shellcheck (-e/--exclude option). To exclude more than one option, separate them with commas. For example, to ignore some warnings that aren't applicable to files that will be sourced by other scripts, use the buffer-local variant: > autocmd BufEnter PKGBUILD,.env \ let b:ale_sh_shellcheck_exclusions = 'SC2034,SC2154,SC2164' < =============================================================================== shfmt *ale-sh-shfmt* g:ale_sh_shfmt_options *g:ale_sh_shfmt_options* *b:ale_sh_shfmt_options* Type: |String| Default: `''` This variable can be set to pass additional options to the shfmt fixer. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-sml.txt000066400000000000000000000032141476501472200151240ustar00rootroot00000000000000=============================================================================== ALE SML Integration *ale-sml-options* =============================================================================== smlnj *ale-sml-smlnj* *ale-sml-smlnj-cm* There are two SML/NJ powered checkers: - one using Compilation Manager that works on whole projects, but requires you to save before errors show up - one using the SML/NJ REPL that works as you change the text, but might fail if your project can only be built with CM. We dynamically select which one to use based whether we find a `*.cm` file at or above the directory of the file being checked. Only one checker (`smlnj`, `smlnj-cm`) will be enabled at a time. ------------------------------------------------------------------------------- g:ale_sml_smlnj_cm_file *g:ale_sml_smlnj_cm_file* *b:ale_sml_smlnj_cm_file* Type: |String| Default: `'*.cm'` By default, ALE will look for a `*.cm` file in your current directory, searching upwards. It stops when it finds at least one `*.cm` file (taking the first file if there are more than one). Change this option (in the buffer or global scope) to control how ALE finds CM files. For example, to always search for a CM file named `sandbox.cm`: > let g:ale_sml_smlnj_cm_file = 'sandbox.cm' =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-solidity.txt000066400000000000000000000042111476501472200161670ustar00rootroot00000000000000=============================================================================== ALE Solidity Integration *ale-solidity-options* =============================================================================== solc *ale-solidity-solc* g:ale_solidity_solc_executable *g:ale_solidity_solc_executable* *b:ale_solidity_solc_executable* Type: |String| Default: `'solc'` Override the invoked solc binary. For truffle/hardhat binaries. g:ale_solidity_solc_options *g:ale_solidity_solc_options* *b:ale_solidity_solc_options* Type: |String| Default: `''` This variable can be set to pass extra options to solc. =============================================================================== solhint *ale-solidity-solhint* Solhint should work out-of-the-box. You can further configure it using a `.solihint.json` file. See https://github.com/protofire/solhint for more information. =============================================================================== solium *ale-solidity-solium* Use of Solium linter for Solidity source code requires a .soliumrc.json file in project root. This file can be generated by running `solium --init`. See the corresponding solium usage for detailed instructions (https://github.com/duaraghav8/Solium#usage). =============================================================================== forge *ale-solidity-forge* `forge fmt` is not a linter, only a formatter. It should be used only as a fixer. `forge fmt` should work out-of-the-box. You can further configure it using `foundry.toml`. See the corresponding documentation for detailed instructions (https://book.getfoundry.sh/reference/config/formatter). =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-spec.txt000066400000000000000000000031521476501472200152640ustar00rootroot00000000000000=============================================================================== ALE Spec Integration *ale-spec-options* *ale-integration-spec* =============================================================================== Integration Information The rpmlint linter is disabled by default, because running rpmlint can result in the execution of code embedded in the spec file and rpmlint makes no distinction between checks which are safe to run on untrusted files and those which are not. Currently linters must be enabled globally. The rpmlint linter can be enabled with: > let g:ale_linters = {'spec': ['rpmlint']} < =============================================================================== rpmlint *ale-spec-rpmlint* g:ale_spec_rpmlint_executable *g:ale_spec_rpmlint_executable* *b:ale_spec_rpmlint_executable* Type: |String| Default: `'rpmlint'` This variable sets executable used for rpmlint. g:ale_spec_rpmlint_options *g:ale_spec_rpmlint_options* *b:ale_spec_rpmlint_options* Type: |String| Default: `''` Set this to pass extra arguments to rpmlint. For example, to instruct rpmlint to use a specific configuration file: > let g:ale_spec_rpmlint_options = '-f custom.cf' < =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-sql.txt000066400000000000000000000065601476501472200151370ustar00rootroot00000000000000=============================================================================== ALE SQL Integration *ale-sql-options* =============================================================================== dprint *ale-sql-dprint* See |ale-dprint-options| and https://github.com/dprint/dprint-plugin-sql/releases =============================================================================== pgformatter *ale-sql-pgformatter* g:ale_sql_pgformatter_executable *g:ale_sql_pgformatter_executable* *b:ale_sql_pgformatter_executable* Type: |String| Default: `'pg_format'` This variable sets executable used for pgformatter. g:ale_sql_pgformatter_options *g:ale_sql_pgformatter_options* *b:ale_sql_pgformatter_options* Type: |String| Default: `''` This variable can be set to pass additional options to the pgformatter fixer. =============================================================================== sqlfluff *ale-sql-sqlfluff* g:ale_sql_sqlfluff_executable *g:ale_sql_sqlfluff_executable* *b:ale_sql_sqlfluff_executable* Type: |String| Default: `'sqlfluff'` This variable sets executable used for sqlfluff. g:ale_sql_sqlfluff_options *g:ale_sql_sqlfluff_options* *b:ale_sql_sqlfluff_options* Type: |String| Default: `''` This variable can be set to pass additional options to the sqlfluff linter. =============================================================================== =============================================================================== sqlfmt *ale-sql-sqlfmt* g:ale_sql_sqlfmt_executable *g:ale_sql_sqlfmt_executable* *b:ale_sql_sqlfmt_executable* Type: |String| Default: `'sqlfmt'` This variable sets executable used for sqlfmt. g:ale_sql_sqlfmt_options *g:ale_sql_sqlfmt_options* *b:ale_sql_sqlfmt_options* Type: |String| Default: `''` This variable can be set to pass additional options to the sqlfmt fixer. At this time only the -u flag is available to format with upper-case. =============================================================================== sqlformat *ale-sql-sqlformat* g:ale_sql_sqlformat_executable *g:ale_sql_sqlformat_executable* *b:ale_sql_sqlformat_executable* Type: |String| Default: `'sqlformat'` This variable sets executable used for sqlformat. g:ale_sql_sqlformat_options *g:ale_sql_sqlformat_options* *b:ale_sql_sqlformat_options* Type: |String| Default: `''` This variable can be set to pass additional options to the sqlformat fixer. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-stylus.txt000066400000000000000000000023221476501472200156730ustar00rootroot00000000000000=============================================================================== ALE Stylus Integration *ale-stylus-options* =============================================================================== stylelint *ale-stylus-stylelint* g:ale_stylus_stylelint_executable *g:ale_stylus_stylelint_executable* *b:ale_stylus_stylelint_executable* Type: |String| Default: `'stylelint'` See |ale-integrations-local-executables| g:ale_stylus_stylelint_options *g:ale_stylus_stylelint_options* *b:ale_stylus_stylelint_options* Type: |String| Default: `''` This variable can be set to pass additional options to stylelint. g:ale_stylus_stylelint_use_global *g:ale_stylus_stylelint_use_global* *b:ale_stylus_stylelint_use_global* Type: |String| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-sugarss.txt000066400000000000000000000023461476501472200160250ustar00rootroot00000000000000=============================================================================== ALE SugarSS Integration *ale-sugarss-options* =============================================================================== stylelint *ale-sugarss-stylelint* g:ale_sugarss_stylelint_executable *g:ale_sugarss_stylelint_executable* *b:ale_sugarss_stylelint_executable* Type: |String| Default: `'stylelint'` See |ale-integrations-local-executables| g:ale_sugarss_stylelint_options *g:ale_sugarss_stylelint_options* *b:ale_sugarss_stylelint_options* Type: |String| Default: `''` This variable can be set to pass additional options to stylelint. g:ale_sugarss_stylelint_use_global *g:ale_sugarss_stylelint_use_global* *b:ale_sugarss_stylelint_use_global* Type: |String| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-supported-languages-and-tools.txt000066400000000000000000000250311476501472200222210ustar00rootroot00000000000000*ale-supported-languages-and-tools.txt* For Vim version 8.0. *ale-supported-list* ALE Supported Languages and Tools =============================================================================== The following languages and tools are supported by ALE. Notes: `^` No linters for text or Vim help filetypes are enabled by default. `!!` These linters check only files on disk. See |ale-lint-file-linters| * Ada * `ada_language_server` * `cspell` * `gcc` * `gnatpp` * Ansible * `ansible-language-server` * `ansible-lint`!! * API Blueprint * `drafter` * APKBUILD * `apkbuild-fixer` * `apkbuild-lint` * `secfixes-check` * AsciiDoc * `alex` * `cspell` * `languagetool`!! * `proselint` * `redpen` * `textlint` * `vale` * `write-good` * ASM * `gcc` * `llvm-mc` * Astro * `eslint` * `prettier` * AVRA * `avra` * Awk * `gawk` * Bash * `bashate` * `cspell` * `language-server` * `shell` (-n flag) * `shellcheck` * `shfmt` * Bats * `shellcheck` * Bazel * `buildifier` * BibTeX * `bibclean` * Bicep * `bicep` * BitBake * `oelint-adv` * Bourne Shell * `shell` (-n flag) * `shellcheck` * `shfmt` * C * `astyle` * `ccls` * `clang` (`cc`) * `clang-format` * `clangcheck`!! * `clangd` * `clangtidy`!! * `cppcheck` * `cpplint`!! * `cquery` * `cspell` * `flawfinder` * `gcc` (`cc`) * `uncrustify` * C# * `clang-format` * `csc`!! * `cspell` * `dotnet-format` * `mcs` * `mcsc`!! * `uncrustify` * C++ (filetype cpp) * `astyle` * `ccls` * `clang` (`cc`) * `clang-format` * `clangcheck`!! * `clangd` * `clangtidy`!! * `clazy`!! * `cppcheck` * `cpplint`!! * `cquery` * `cspell` * `flawfinder` * `gcc` (`cc`) * `uncrustify` * C3 * `c3lsp` * Cairo * `scarb`!! * `starknet` * Chef * `cookstyle` * `foodcritic`!! * Clojure * `clj-kondo` * `cljfmt` * `joker` * CloudFormation * `cfn-python-lint` * CMake * `cmake-format` * `cmake-lint` * `cmakelint` * CoffeeScript * `coffee` * `coffeelint` * Crystal * `ameba`!! * `crystal`!! * CSS * `VSCode CSS language server` * `cspell` * `css-beautify` * `csslint` * `fecs` * `prettier` * `stylelint` * Cucumber * `cucumber` * CUDA * `clang-format` * `clangd` * `nvcc`!! * Cypher * `cypher-lint` * Cython (pyrex filetype) * `cython` * D * `dfmt` * `dls` * `dmd` * `uncrustify` * Dafny * `dafny`!! * Dart * `analysis_server` * `dart-analyze`!! * `dart-format`!! * `dartfmt`!! * `language_server` * desktop * `desktop-file-validate` * Dhall * `dhall-format` * `dhall-freeze` * `dhall-lint` * Dockerfile * `dockerfile_lint` * `dockerlinter` * `dprint` * `hadolint` * Elixir * `credo` * `cspell` * `dialyxir` * `dogma`!! * `elixir-ls` * `lexical` * `mix`!! * Elm * `elm-format` * `elm-ls` * `elm-make` * Erb * `erb` * `erb-formatter` * `erblint` * `erubi` * `erubis` * `htmlbeautifier` * `ruumba` * Erlang * `SyntaxErl` * `dialyzer`!! * `elvis`!! * `erlang-mode` (The Erlang mode for Emacs) * `erlang_ls` * `erlc` * `erlfmt` * Fish * `fish` (-n flag) * `fish_indent` * Fortran * `gcc` * `language_server` * Fountain * `proselint` * FusionScript * `fusion-lint` * Git Commit Messages * `gitlint` * Gleam * `gleam_format` * `gleamlsp` * GLSL * `glslang` * `glslls` * Go * `bingo` * `cspell` * `go build`!! * `go mod`!! * `go vet`!! * `gofmt` * `gofumpt` * `goimports` * `golangci-lint`!! * `golangserver` * `golines` * `gopls` * `gosimple`!! * `gotype`!! * `revive`!! * `staticcheck`!! * GraphQL * `eslint` * `gqlint` * `prettier` * Groovy * `npm-groovy-lint` * Hack * `hack` * `hackfmt` * `hhast` * Haml * `haml-lint` * Handlebars * `ember-template-lint` * Haskell * `brittany` * `cabal-ghc` * `cspell` * `floskell` * `fourmolu` * `ghc` * `ghc-mod` * `hdevtools` * `hfmt` * `hie` * `hindent` * `hlint` * `hls` * `ormolu` * `stack-build`!! * `stack-ghc` * `stylish-haskell` * HCL * `packer-fmt` * `terraform-fmt` * HTML * `VSCode HTML language server` * `alex` * `angular` * `cspell` * djlint * `eslint` * `fecs` * `html-beautify` * `htmlhint` * `prettier` * `proselint` * `rustywind` * `tidy` * `write-good` * Hurl * `hurlfmt` * Idris * `idris` * Ink * `ink-language-server` * Inko * `inko` !! * ISPC * `ispc`!! * Java * `PMD` * `checkstyle`!! * `clang-format` * `cspell` * `eclipselsp` * `google-java-format` * `javac` * `javalsp` * `uncrustify` * JavaScript * `biome` * `clang-format` * `cspell` * `deno` * `dprint` * `eslint` * `fecs` * `flow` * `jscs` * `jshint` * `prettier` * `prettier-eslint` * `prettier-standard` * `standard` * `tsserver` * `xo` * JSON * `VSCode JSON language server` * `biome` * `clang-format` * `cspell` * `dprint` * `eslint` * `fixjson` * `jq` * `json.tool` * `jsonlint` * `prettier` * `spectral` * JSON5 * `eslint` * JSONC * `biome` * `eslint` * Jsonnet * `jsonnet-lint` * `jsonnetfmt` * Julia * `languageserver` * Kotlin * `kotlinc`!! * `ktlint` * `languageserver` * LaTeX (tex) * `alex` * `chktex` * `cspell` * `lacheck` * `proselint` * `redpen` * `texlab` * `textlint` * `vale` * `write-good` * Less * `lessc` * `prettier` * `stylelint` * LLVM * `llc` * Lua * `cspell` * `lua-format` * `lua-language-server` * `luac` * `luacheck` * `luafmt` * `selene` * `stylua` * Mail * `alex` * `languagetool`!! * `proselint` * `vale` * Make * `checkmake` * Markdown * `alex` * `cspell` * `languagetool`!! * `markdownlint`!! * `marksman` * `mdl` * `pandoc` * `prettier` * `proselint` * `pymarkdown` * `redpen` * `remark-lint` * `textlint` * `vale` * `write-good` * MATLAB * `mlint` * Mercury * `mmc`!! * NASM * `nasm`!! * Nickel * `nickel_format` * Nim * `nim check`!! * `nimlsp` * `nimpretty` * nix * `alejandra` * `deadnix` * `nix-instantiate` * `nixfmt` * `nixpkgs-fmt` * `rnix-lsp` * `statix` * nroff * `alex` * `proselint` * `write-good` * Objective-C * `ccls` * `clang` * `clang-format` * `clangd` * `uncrustify` * Objective-C++ * `clang` * `clangd` * `uncrustify` * OCaml * `dune` * `merlin` (see |ale-ocaml-merlin|) * `ocamlformat` * `ocamllsp` * `ocp-indent` * `ols` * Odin * `ols` * OpenApi * `ibm_validator` * `prettier` * `yamllint` * OpenSCAD * `SCA2D` * `scadformat` * Packer * `packer-fmt-fixer` * Pascal * `ptop` * Pawn * `uncrustify` * Perl * `perl -c` * `perl-critic` * `perltidy` * Perl6 * `perl6 -c` * PHP * `cspell` * `intelephense` * `langserver` * `phan` * `php -l` * `php-cs-fixer` * `phpactor` * `phpcbf` * `phpcs` * `phpmd` * `phpstan` * `pint` * `psalm`!! * `tlint` * PO * `alex` * `msgfmt` * `proselint` * `write-good` * Pod * `alex` * `proselint` * `write-good` * Pony * `ponyc` * PowerShell * `cspell` * `powershell` * `psscriptanalyzer` * Prolog * `swipl` * proto * `buf-format`!! * `buf-lint`!! * `clang-format` * `protoc-gen-lint`!! * `protolint`!! * Pug * `pug-lint` * Puppet * `languageserver` * `puppet` * `puppet-lint` * PureScript * `purescript-language-server` * `purs-tidy` * `purty` * Python * `autoflake`!! * `autoimport` * `autopep8` * `bandit` * `black` * `cspell` * `flake8` * `flakehell` * `isort` * `mypy` * `prospector`!! * `pycln` * `pycodestyle` * `pydocstyle` * `pyflakes` * `pyflyby` * `pylama`!! * `pylint`!! * `pylsp` * `pyre` * `pyright` * `refurb` * `reorder-python-imports` * ruff * ruff-format * `unimport` * `vulture`!! * `yapf` * QML * `qmlfmt` * `qmllint` * R * `languageserver` * `lintr` * `styler` * Racket * `racket-langserver` * `raco` * `raco_fmt` * Re:VIEW * `redpen` * ReasonML * `merlin` * `ols` * `reason-language-server` * `refmt` * Rego * `cspell` * `opacheck` * `opafmt` * reStructuredText * `alex` * `cspell` * `proselint` * `redpen` * `rstcheck` * `textlint` * `vale` * `write-good` * Robot * `rflint` * RPM spec * `rpmlint` * Ruby * `brakeman`!! * `cspell` * `debride` * `packwerk`!! * `prettier` * `rails_best_practices`!! * `reek` * `rubocop` * `ruby` * `rubyfmt` * `rufo` * `solargraph` * `sorbet` * `standardrb` * `steep` * `syntax_tree` * Rust * `cargo`!! * `cspell` * `rls` * `rust-analyzer` * `rustc` (see |ale-integration-rust|) * `rustfmt` * Salt * `salt-lint` * Sass * `sass-lint` * `stylelint` * Scala * `cspell` * `fsc` * `metals` * `sbtserver` * `scalac` * `scalafmt` * `scalastyle` * SCSS * `prettier` * `sass-lint` * `scss-lint` * `stylelint` * Slim * `slim-lint` * SML * `smlnj` * Solidity * `forge` * `solc` * `solhint` * `solium` * SQL * `dprint` * `pgformatter` * `sql-lint` * `sqlfluff` * `sqlfmt` * `sqlformat` * `sqlint` * Stylus * `stylelint` * SugarSS * `stylelint` * Svelte * `prettier` * `svelteserver` * Swift * Apple `swift-format` * `cspell` * `sourcekit-lsp` * `swiftformat` * `swiftlint` * systemd * `systemd-analyze`!! * Tcl * `nagelfar`!! * Terraform * `checkov` * `terraform` * `terraform-fmt-fixer` * `terraform-ls` * `terraform-lsp` * `tflint` * `tfsec` * Texinfo * `alex` * `cspell` * `proselint` * `write-good` * Text^ * `alex` * `cspell` * `languagetool`!! * `proselint` * `redpen` * `textlint` * `vale` * `write-good` * Thrift * `thrift` * `thriftcheck` * TOML * `dprint` * TypeScript * `biome` * `cspell` * `deno` * `dprint` * `eslint` * `fecs` * `prettier` * `standard` * `tslint` * `tsserver` * `typecheck` * V * `v`!! * `vfmt` * VALA * `uncrustify` * `vala_lint`!! * Verilog * `hdl-checker` * `iverilog` * slang * `verilator` * `vlog` * `xvlog` * `yosys`!! * VHDL * `ghdl` * `vcom` * `xvhdl` * Vim * `vimls` * `vint` * Vim help^ * `alex` * `proselint` * `write-good` * Vue * `cspell` * `prettier` * `vls` * `volar` * WGSL * `naga` * XHTML * `alex` * `cspell` * `proselint` * `write-good` * XML * `xmllint` * YAML * `actionlint` * `circleci`!! * `gitlablint` * `prettier` * `spectral` * `swaglint` * `yaml-language-server` * `yamlfix` * `yamlfmt` * `yamllint` * `yq` * YANG * `yang-lsp` * Yara * `yls` * Zeek * `zeek`!! * Zig * `zigfmt` * `zls` =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-svelte.txt000066400000000000000000000022751476501472200156410ustar00rootroot00000000000000=============================================================================== ALE Svelte Integration *ale-svelte-options* =============================================================================== prettier *ale-svelte-prettier* See |ale-javascript-prettier| for information about the available options. =============================================================================== svelteserver *ale-svelte-svelteserver* g:ale_svelte_svelteserver_executable *g:ale_svelte_svelteserver_executable* *b:ale_svelte_svelteserver_executable* Type: |String| Default: `'svelteserver'` See |ale-integrations-local-executables| g:ale_svelte_svelteserver_use_global *g:ale_svelte_svelteserver_use_global* *b:ale_svelte_svelteserver_use_global* Type: |Number| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-swift.txt000066400000000000000000000051251476501472200154700ustar00rootroot00000000000000=============================================================================== ALE Swift Integration *ale-swift-options* =============================================================================== apple-swift-format *ale-swift-apple-swift-format* There are 3 options to enable linting and fixing with Apple's swift-format: 1. Install the local executable in your path, as described here: https://github.com/apple/swift-format 2. Install the executable via your OS package manager, for instance via Homebrew with `brew install swift-format` 3. Your Swift project has a dependency on the swift-format package, so it can be run with `swift run swift-format lint ...` In this case, you need to set a variable, see |g:ale_swift_appleswiftformat_use_swiftpm|. Additionally, ALE tries to locate and use the nearest existing `.swift-format` configuration file. g:ale_swift_appleswiftformat_executable *g:ale_swift_appleswiftformat_executable* *b:ale_swift_appleswiftformat_executable* Type: |String| Default: `'swift-format'` This variable can be modified to change the executable path for `swift-format`. g:ale_swift_appleswiftformat_use_swiftpm *g:ale_swift_appleswiftformat_use_swiftpm* *b:ale_swift_appleswiftformat_use_swiftpm* Type: |Number| Default: `0` When set to `1`, this option will cause ALE to use `swift run swift-format lint ...` instead of the global executable. Use this option if your Swift project has a dependency on the swift-format package. See |ale-integrations-local-executables| =============================================================================== cspell *ale-swift-cspell* See |ale-cspell-options| =============================================================================== sourcekitlsp *ale-swift-sourcekitlsp* To enable the SourceKit-LSP you need to install and build the executable as described here: https://github.com/apple/sourcekit-lsp#building-sourcekit-lsp g:ale_sourcekit_lsp_executable *g:ale_sourcekit_lsp_executable* *b:ale_sourcekit_lsp_executable* Type: |String| Default: `'sourcekit-lsp'` See |ale-integrations-local-executables| =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-systemd.txt000066400000000000000000000012331476501472200160200ustar00rootroot00000000000000=============================================================================== ALE systemd Integration *ale-systemd-options* =============================================================================== systemd-analyze *ale-systemd-analyze* ALE supports checking user systemd units with `systemd-analyze --user verify` Checks will only work with user unit files in their proper location. There aren't any options, and checks can only run after saving the file. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-tcl.txt000066400000000000000000000017221476501472200151150ustar00rootroot00000000000000=============================================================================== ALE Tcl Integration *ale-tcl-options* =============================================================================== nagelfar *ale-tcl-nagelfar* g:ale_tcl_nagelfar_executable *g:ale_tcl_nagelfar_executable* *b:ale_tcl_nagelfar_executable* Type: |String| Default: `'nagelfar.tcl'` This variable can be changed to change the path to nagelfar. g:ale_tcl_nagelfar_options *g:ale_tcl_nagelfar_options* *b:ale_tcl_nagelfar_options* Type: |String| Default: `''` This variable can be changed to modify flags given to nagelfar. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-terraform.txt000066400000000000000000000120271476501472200163340ustar00rootroot00000000000000=============================================================================== ALE Terraform Integration *ale-terraform-options* =============================================================================== checkov *ale-terraform-checkov* g:ale_terraform_checkov_executable *g:ale_terraform_checkov_executable* *b:ale_terraform_checkov_executable* Type: |String| Default: `'checkov'` This variable can be changed to use a different executable for checkov. g:ale_terraform_checkov_options *g:ale_terraform_checkov_options* *b:ale_terraform_checkov_options* Type: |String| Default: `''` This variable can be changed to set additional options for checkov. =============================================================================== terraform-fmt-fixer *ale-terraform-fmt-fixer* g:ale_terraform_fmt_executable *g:ale_terraform_fmt_executable* *b:ale_terraform_fmt_executable* Type: |String| Default: `'terraform'` This variable can be changed to use a different executable for terraform. g:ale_terraform_fmt_options *g:ale_terraform_fmt_options* *b:ale_terraform_fmt_options* Type: |String| Default: `''` =============================================================================== terraform *ale-terraform-terraform* g:ale_terraform_terraform_executable *g:ale_terraform_terraform_executable* *b:ale_terraform_terraform_executable* Type: |String| Default: `'terraform'` This variable can be changed to use a different executable for terraform. =============================================================================== terraform-ls *ale-terraform-terraform-ls* Official terraform language server. More stable than *terraform-lsp* but currently has less features. g:ale_terraform_ls_executable *g:ale_terraform_ls_executable* *b:ale_terraform_ls_executable* Type: |String| Default: `'terraform-ls'` This variable can be changed to use a different executable for terraform-ls. g:ale_terraform_ls_options *g:ale_terraform_ls_options* *b:ale_terraform_ls_options* Type: |String| Default: `''` This variable can be changed to pass custom CLI flags to terraform-ls. =============================================================================== terraform-lsp *ale-terraform-terraform-lsp* g:ale_terraform_langserver_executable *g:ale_terraform_langserver_executable* *b:ale_terraform_langserver_executable* Type: |String| Default: `'terraform-lsp'` This variable can be changed to use a different executable for terraform-lsp. g:ale_terraform_langserver_options *g:ale_terraform_langserver_options* *b:ale_terraform_langserver_options* Type: |String| Default: `''` This variable can be changed to pass custom CLI flags to terraform-lsp. =============================================================================== tflint *ale-terraform-tflint* g:ale_terraform_tflint_executable *g:ale_terraform_tflint_executable* *b:ale_terraform_tflint_executable* Type: |String| Default: `'tflint'` This variable can be changed to use a different executable for tflint. g:ale_terraform_tflint_options *g:ale_terraform_tflint_options* *b:ale_terraform_tflint_options* Type: |String| Default: `'-f json'` This variable can be changed to pass different options to tflint. Ale does expect json output from tflint, so if you change this, you'll probably want to include '-f json' in your new value. =============================================================================== tfsec *ale-terraform-tfsec* g:ale_terraform_tfsec_executable *g:ale_terraform_tfsec_executable* *b:ale_terraform_tfsec_executable* Type: |String| Default: `'tfsec'` This variable can be changed to use a different executable for tfsec. g:ale_terraform_tfsec_options *g:ale_terraform_tfsec_options* *b:ale_terraform_tfsec_options* Type: |String| Default: `''` This variable can be changed to pass custom CLI flags to tfsec. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-tex.txt000066400000000000000000000066731476501472200151450ustar00rootroot00000000000000=============================================================================== ALE TeX Integration *ale-tex-options* =============================================================================== chktex *ale-tex-chktex* g:ale_tex_chktex_executable *g:ale_tex_chktex_executable* *b:ale_tex_chktex_executable* Type: |String| Default: `'chktex'` This variable can be changed to change the path to chktex. g:ale_tex_chktex_options *g:ale_tex_chktex_options* *b:ale_tex_chktex_options* Type: |String| Default: `'-I'` This variable can be changed to modify flags given to chktex. =============================================================================== cspell *ale-tex-cspell* See |ale-cspell-options| =============================================================================== lacheck *ale-tex-lacheck* g:ale_lacheck_executable *g:ale_lacheck_executable* *b:ale_lacheck_executable* Type: |String| Default: `'lacheck'` This variable can be changed to change the path to lacheck. =============================================================================== latexindent *ale-tex-latexindent* g:ale_tex_latexindent_executable *g:ale_tex_latexindent_executable* *b:ale_tex_latexindent_executable* Type: |String| Default: `'latexindent'` This variable can be changed to change the path to latexindent. g:ale_tex_latexindent_options *g:ale_tex_latexindent_options* *b:ale_tex_latexindent_options* Type: |String| Default: `''` This variable can be changed to modify flags given to latexindent. =============================================================================== texlab *ale-tex-texlab* g:ale_tex_texlab_executable *g:ale_tex_texlab_executable* *b:ale_tex_texlab_executable* Type: |String| Default: `'texlab'` This variable can be changed to change the path to texlab. g:ale_tex_texlab_options *g:ale_tex_texlab_options* *b:ale_tex_texlab_options* Type: |String| Default: `''` This variable can be changed to modify flags given to texlab command. g:ale_tex_texlab_config *g:ale_tex_texlab_config* *b:ale_tex_texlab_config* Type: |Dictionary| Default: `{}` Dictionary containing LSP configuration settings used to initialize texlab language server. Refer to texlab documentation for possible settings: https://github.com/latex-lsp/texlab/blob/master/docs/options.md For example to set build onSave initialization setting: > let g:ale_tex_texlab_config = {"build":{"onSave":v:true}} < =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-texinfo.txt000066400000000000000000000012301476501472200160010ustar00rootroot00000000000000=============================================================================== ALE Texinfo Integration *ale-texinfo-options* =============================================================================== cspell *ale-texinfo-cspell* See |ale-cspell-options| =============================================================================== write-good *ale-texinfo-write-good* See |ale-write-good-options| =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-text.txt000066400000000000000000000033121476501472200153140ustar00rootroot00000000000000=============================================================================== ALE Text Integration *ale-text-options* ============================================================================== cspell *ale-text-cspell* See |ale-cspell-options| =============================================================================== textlint *ale-text-textlint* The options for the textlint linter are global because it does not make sense to have them specified on a per-language basis. g:ale_textlint_executable *g:ale_textlint_executable* *b:ale_textlint_executable* Type: |String| Default: `'textlint'` See |ale-integrations-local-executables| g:ale_textlint_options *g:ale_textlint_options* *b:ale_textlint_options* Type: |String| Default: `''` This variable can be set to pass additional options to textlint. g:ale_textlint_use_global *g:ale_textlint_use_global* *b:ale_textlint_use_global* Type: |Number| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| =============================================================================== write-good *ale-text-write-good* See |ale-write-good-options| =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-thrift.txt000066400000000000000000000047471476501472200156450ustar00rootroot00000000000000=============================================================================== ALE Thrift Integration *ale-thrift-options* =============================================================================== thrift *ale-thrift-thrift* The `thrift` linter works by compiling the buffer's contents and reporting any errors reported by the parser and the configured code generator(s). g:ale_thrift_thrift_executable *g:ale_thrift_thrift_executable* *b:ale_thrift_thrift_executable* Type: |String| Default: `'thrift'` See |ale-integrations-local-executables| g:ale_thrift_thrift_generators *g:ale_thrift_thrift_generators* *b:ale_thrift_thrift_generators* Type: |List| of |String|s Default: `['cpp']` This list must contain one or more named code generators. Generator options can be included as part of each string, e.g. `['py:dynamic']`. g:ale_thrift_thrift_includes *g:ale_thrift_thrift_includes* *b:ale_thrift_thrift_includes* Type: |List| of |String|s Default: `['.']` This list contains paths that will be searched for thrift `include` directives. g:ale_thrift_thrift_options *g:ale_thrift_thrift_options* *b:ale_thrift_thrift_options* Type: |String| Default: `'-strict'` This variable can be changed to customize the additional command-line arguments that are passed to the thrift compiler. =============================================================================== thriftcheck *ale-thrift-thriftcheck* g:ale_thrift_thriftcheck_executable *g:ale_thrift_thriftcheck_executable* *b:ale_thrift_thriftcheck_executable* Type: |String| Default: `'thriftcheck'` See |ale-integrations-local-executables| g:ale_thrift_thriftcheck_options *g:ale_thrift_thriftcheck_options* *b:ale_thrift_thriftcheck_options* Type: |String| Default: `''` This variable can be changed to customize the additional command-line arguments that are passed to thriftcheck. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-toml.txt000066400000000000000000000007741476501472200153140ustar00rootroot00000000000000=============================================================================== ALE TOML Integration *ale-toml-options* =============================================================================== dprint *ale-toml-dprint* See |ale-dprint-options| and https://dprint.dev/plugins/toml =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-typescript.txt000066400000000000000000000241551476501472200165460ustar00rootroot00000000000000=============================================================================== ALE TypeScript Integration *ale-typescript-options* =============================================================================== biome *ale-typescript-biome* g:ale_biome_executable *g:ale_biome_executable* *b:ale_biome_executable* Type: |String| Default: `'biome'` g:ale_biome_options *g:ale_biome_options* *b:ale_biome_options* Type: |String| Default: `''` This variable can be set to pass additional options to `biome check` when applying fixes. g:ale_biome_use_global *g:ale_biome_use_global* *b:ale_biome_use_global* Type: |Number| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| g:ale_biome_fixer_apply_unsafe *g:ale_biome_fixer_apply_unsafe* *b:ale_biome_fixer_apply_unsafe* Type: |Number| Default: `0` If set to `1`, biome will apply unsafe fixes along with safe fixes. g:ale_biome_lsp_project_root *g:ale_biome_lsp_project_root* *b:ale_biome_lsp_project_root* Type: |String| Default: `''` If this variable is left unset, ALE will try to find the project root by executing the following steps in the given order: 1. Find an ancestor directory containing a biome.json. 2. Find an ancestor directory containing a biome.jsonc. 3. Find an ancestor directory containing a package.json. 4. Find an ancestor directory containing a .git folder. 5. Use the directory of the current buffer (if the buffer was opened from a file). =============================================================================== cspell *ale-typescript-cspell* See |ale-cspell-options| =============================================================================== deno *ale-typescript-deno* Starting from version 1.6.0, Deno comes with its own language server. Earlier versions are not supported. g:ale_deno_executable *g:ale_deno_executable* *b:ale_deno_executable* Type: |String| Default: `'deno'` g:ale_deno_lsp_project_root *g:ale_deno_lsp_project_root* *b:ale_deno_lsp_project_root* Type: |String| Default: `''` If this variable is left unset, ALE will try to find the project root by executing the following steps in the given order: 1. Find an ancestor directory containing a tsconfig.json. 2. Find an ancestor directory containing a .git folder. 3. Use the directory of the current buffer (if the buffer was opened from a file). g:ale_deno_unstable *g:ale_deno_unstable* *b:ale_deno_unstable* Type: |Number| Default: `0` Enable or disable unstable Deno features and APIs. g:ale_deno_import_map *g:ale_deno_import_map* *b:ale_deno_import_map* Type: |String| Default: `'import_map.json'` Specify the import map filename to load url maps in a deno project. =============================================================================== dprint *ale-typescript-dprint* See |ale-dprint-options| and https://dprint.dev/plugins/typescript =============================================================================== eslint *ale-typescript-eslint* Because of how TypeScript compiles code to JavaScript and how interrelated the two languages are, the `eslint` linter for TypeScript uses the JavaScript options for `eslint` too. See: |ale-javascript-eslint|. =============================================================================== prettier *ale-typescript-prettier* See |ale-javascript-prettier| for information about the available options. =============================================================================== standard *ale-typescript-standard* g:ale_typescript_standard_executable *g:ale_typescript_standard_executable* *b:ale_typescript_standard_executable* Type: |String| Default: `'standard'` See |ale-integrations-local-executables| g:ale_typescript_standard_options *g:ale_typescript_standard_options* *b:ale_typescript_standard_options* Type: |String| Default: `''` This variable can be set to pass additional options to standard. g:ale_typescript_standard_use_global *g:ale_typescript_standard_use_global* *b:ale_typescript_standard_use_global* Type: |Number| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| =============================================================================== tslint *ale-typescript-tslint* This linter isn't recommended, because TSLint can't be used for checking for problems while you type. You should probably use the tsserver plugin instead. tsserver plugins are described here: https://github.com/Microsoft/TypeScript/wiki/Writing-a-Language-Service-Plugin Follow the instructions on the plugin website for installing it: https://github.com/Microsoft/typescript-tslint-plugin Then disable TSLint in vimrc or any other Vim configuration file. > let g:ale_linters_ignore = {'typescript': ['tslint']} < g:ale_typescript_tslint_executable *g:ale_typescript_tslint_executable* *b:ale_typescript_tslint_executable* Type: |String| Default: `'tslint'` See |ale-integrations-local-executables| g:ale_typescript_tslint_config_path *g:ale_typescript_tslint_config_path* *b:ale_typescript_tslint_config_path* Type: |String| Default: `''` ALE will first discover the tslint.json path in an ancestor directory. If no such path exists, this variable will be used instead. g:ale_typescript_tslint_ignore_empty_files *g:ale_typescript_tslint_ignore_empty_files* *b:ale_typescript_tslint_ignore_empty_files* Type: |Number| Default: `0` When set to `1`, ALE will not report any problems for empty files with TSLint. ALE will still execute TSLint for the files, but ignore any problems reported. This stops ALE from complaining about newly created files, and files where lines have been added and then removed. g:ale_typescript_tslint_rules_dir *g:ale_typescript_tslint_rules_dir* *b:ale_typescript_tslint_rules_dir* Type: |String| Default: `''` If this variable is set, ALE will use it as the rules directory for tslint. g:ale_typescript_tslint_use_global *g:ale_typescript_tslint_use_global* *b:ale_typescript_tslint_use_global* Type: |Number| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| =============================================================================== tsserver *ale-typescript-tsserver* g:ale_typescript_tsserver_executable *g:ale_typescript_tsserver_executable* *b:ale_typescript_tsserver_executable* Type: |String| Default: `'tsserver'` ALE will first discover the tsserver path in an ancestor node_modules directory. If no such path exists, this variable will be used instead. If you wish to use only a globally installed version of tsserver, set |g:ale_typescript_tsserver_use_global| to `1`. g:ale_typescript_tsserver_config_path *g:ale_typescript_tsserver_config_path* *b:ale_typescript_tsserver_config_path* Type: |String| Default: `''` ALE will first discover the tsserver.json path in an ancestor directory. If no such path exists, this variable will be used instead. g:ale_typescript_tsserver_use_global *g:ale_typescript_tsserver_use_global* *b:ale_typescript_tsserver_use_global* Type: |Number| Default: `get(g:, 'ale_use_global_executables', 0)` This variable controls whether or not ALE will search for a local path for tsserver first. If this variable is set to `1`, then ALE will always use the global version of tsserver, in preference to locally installed versions of tsserver in node_modules. =============================================================================== xo *ale-typescript-xo* g:ale_typescript_xo_executable *g:ale_typescript_xo_executable* *b:ale_typescript_xo_executable* Type: |String| Default: `'xo'` See |ale-integrations-local-executables| g:ale_typescript_xo_options *g:ale_typescript_xo_options* *b:ale_typescript_xo_options* Type: |String| Default: `''` This variable can be set to pass additional options to xo. g:ale_typescript_xo_use_global *g:ale_typescript_xo_use_global* *b:ale_typescript_xo_use_global* Type: |Number| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-v.txt000066400000000000000000000033031476501472200145750ustar00rootroot00000000000000=============================================================================== ALE V Integration *ale-v-options* =============================================================================== Integration Information `v` is V's build tool. `vfmt` (called as `v fmt` from the same executable that does the builds) is the autoformatter/fixer. g:ale_v_v_executable *g:ale_v_v_executable* *b:ale_v_v_executable* Type: |String| Default: `'v'` The executable that will be run for the `v` linter and the `vfmt` fixer. =============================================================================== v *ale-v-v* g:ale_v_v_options *g:ale_v_v_options* *b:ale_v_v_options* Type: |String| Default: `''` This variable can be set to pass additional options to the v linter. They are injected directly after "v .". =============================================================================== vfmt *ale-v-vfmt* g:ale_v_vfmt_options *g:ale_v_vfmt_options* *b:ale_v_vfmt_options* Type: |String| Default: `''` This variable can be set to pass additional options to the vfmt fixer. They are injected directly after "v fmt". =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-vala.txt000066400000000000000000000025571476501472200152650ustar00rootroot00000000000000=============================================================================== ALE VALA Integration *ale-vala-options* =============================================================================== uncrustify *ale-vala-uncrustify* See |ale-c-uncrustify| for information about the available options. =============================================================================== Vala-Lint *ale-vala-vala-lint* g:vala_vala_lint_executable *g:vala_vala_lint_executable* *b:vala_vala_lint_executable* Type: |String| Default: `'io.elementary.vala-lint'` This variable can be set to specify a Vala-Lint executable file. g:vala_vala_lint_config_filename *g:vala_vala_lint_config_filename* *b:vala_vala_lint_config_filename* Type: |String| Default: `'vala-lint.conf'` This variable can be set to specify a Vala-Lint config filename. When a file with the specified name was not found or this variable was set to empty, Vala-Lint will be executed without specifying a config filename. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-verilog.txt000066400000000000000000000134401476501472200160020ustar00rootroot00000000000000=============================================================================== ALE Verilog/SystemVerilog Integration *ale-verilog-options* =============================================================================== ALE can use seven different linters for Verilog HDL: HDL Checker Using `hdl_checker --lsp` iverilog: Using `iverilog -t null -Wall` slang: Using `slang -Weverything` verilator Using `verilator --lint-only -Wall` ModelSim/Questa Using `vlog -quiet -lint` Vivado Using `xvlog` Yosys Using `yosys -Q -T -p 'read_verilog'` By default, both 'verilog' and 'systemverilog' filetypes are checked. You can limit 'systemverilog' files to be checked using only 'verilator' by defining 'g:ale_linters' variable: > au FileType systemverilog \ let g:ale_linters = {'systemverilog' : ['verilator'],} < =============================================================================== General notes Linters/compilers that utilize a "work" directory for analyzing designs- such as ModelSim and Vivado- can be passed the location of these directories as part of their respective option strings listed below. This is useful for holistic analysis of a file (e.g. a design with components, packages, or other code defined external to the current file as part of a larger project) or when wanting to simply pass an alternative location for the auto-generated work directories (such as '/tmp') so as to not muddle the current directory. Since these type of linters often use this work directory for holding compiled design data as part of a single build process, they sometimes cannot handle the frequent, asynchronous application launches when linting while text is changing. This can happen in the form of hangs or crashes. To help prevent this when using these linters, it may help to run linting less frequently; for example, only when a file is saved. HDL Checker is an alternative for some of the issues described above. It wraps around ghdl, Vivado and ModelSim/Questa and, when using the latter, it can handle mixed language (VHDL, Verilog, SystemVerilog) designs. =============================================================================== hdl-checker *ale-verilog-hdl-checker* See |ale-vhdl-hdl-checker| =============================================================================== iverilog *ale-verilog-iverilog* No additional options =============================================================================== slang *ale-verilog-slang* g:ale_verilog_slang_option *g:ale_verilog_slang_options* *b:ale_verilog_slang_options* Type: String Default: '' This variable can be changed to modify 'slang' command arguments. =============================================================================== verilator *ale-verilog-verilator* g:ale_verilog_verilator_options *g:ale_verilog_verilator_options* *b:ale_verilog_verilator_options* Type: |String| Default: `''` This variable can be changed to modify 'verilator' command arguments. For example `'-sv --default-language "1800-2012"'` if you want to enable SystemVerilog parsing and select the 2012 version of the language. =============================================================================== vlog *ale-verilog-vlog* g:ale_verilog_vlog_executable *g:ale_verilog_vlog_executable* *b:ale_verilog_vlog_executable* Type: |String| Default: `'vlog'` This variable can be changed to the path to the 'vlog' executable. g:ale_verilog_vlog_options *g:ale_verilog_vlog_options* *b:ale_verilog_vlog_options* Type: |String| Default: `'-quiet -lint'` This variable can be changed to modify the flags/options passed to 'vlog'. =============================================================================== xvlog *ale-verilog-xvlog* g:ale_verilog_xvlog_executable *g:ale_verilog_xvlog_executable* *b:ale_verilog_xvlog_executable* Type: |String| Default: `'xvlog'` This variable can be changed to the path to the 'xvlog' executable. g:ale_verilog_xvlog_options *g:ale_verilog_xvlog_options* *b:ale_verilog_xvlog_options* Type: |String| Default: `''` This variable can be changed to modify the flags/options passed to 'xvlog'. =============================================================================== yosys *ale-verilog-yosys* g:ale_verilog_yosys_executable *g:ale_verilog_yosys_executable* *b:ale_verilog_yosys_executable* Type: |String| Default: `'yosys'` This variable can be changed to the path to the 'yosys' executable. g:ale_verilog_yosys_options *g:ale_verilog_yosys_options* *b:ale_verilog_yosys_options* Type: |String| Default: `'-Q -T -p ''read_verilog %s'''` This variable can be changed to modify the flags/options passed to 'yosys'. By default, Yosys is an interactive program. To obtain linting functionality, the `'read_verilog'` command is used. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-vhdl.txt000066400000000000000000000140771476501472200152770ustar00rootroot00000000000000=============================================================================== ALE VHDL Integration *ale-vhdl-options* =============================================================================== ALE can use four different linters for VHDL: ghdl: Using `ghdl --std=08` ModelSim/Questa Using `vcom -2008 -quiet -lint` Vivado Using `xvhdl --2008` HDL Checker Using `hdl_checker --lsp` =============================================================================== General notes ghdl, ModelSim/Questa and Vivado linters default to VHDL-2008 support. This, and other options, can be changed with each linter's respective option variable. Linters/compilers that utilize a "work" directory for analyzing designs- such as ModelSim and Vivado- can be passed the location of these directories as part of their respective option strings listed below. This is useful for holistic analysis of a file (e.g. a design with components, packages, or other code defined external to the current file as part of a larger project) or when wanting to simply pass an alternative location for the auto-generated work directories (such as '/tmp') so as to not muddle the current directory. Since these type of linters often use this work directory for holding compiled design data as part of a single build process, they sometimes cannot handle the frequent, asynchronous application launches when linting while text is changing. This can happen in the form of hangs or crashes. To help prevent this when using these linters, it may help to run linting less frequently; for example, only when a file is saved. HDL Checker is an alternative for some of the issues described above. It wraps around ghdl, Vivado and ModelSim/Questa and, when using the latter, it can handle mixed language (VHDL, Verilog, SystemVerilog) designs. =============================================================================== ghdl *ale-vhdl-ghdl* g:ale_vhdl_ghdl_executable *g:ale_vhdl_ghdl_executable* *b:ale_vhdl_ghdl_executable* Type: |String| Default: `'ghdl'` This variable can be changed to the path to the 'ghdl' executable. g:ale_vhdl_ghdl_options *g:ale_vhdl_ghdl_options* *b:ale_vhdl_ghdl_options* Type: |String| Default: `'--std=08'` This variable can be changed to modify the flags/options passed to 'ghdl'. =============================================================================== hdl-checker *ale-vhdl-hdl-checker* HDL Checker is a wrapper for VHDL/Verilg/SystemVerilog tools that aims to reduce the boilerplate code needed to set things up. It can automatically infer libraries for VHDL sources, determine the compilation order and provide some static checks. You can install it using pip: > $ pip install hdl-checker `hdl-checker` will be run from a detected project root, determined by the following methods, in order: 1. Find the first directory containing a configuration file (see |g:ale_hdl_checker_config_file|) 2. If no configuration file can be found, find the first directory containing a folder named `'.git' 3. If no such folder is found, use the directory of the current buffer g:ale_hdl_checker_executable *g:ale_hdl_checker_executable* *b:ale_hdl_checker_executable* Type: |String| Default: `'hdl_checker'` This variable can be changed to the path to the 'hdl_checker' executable. g:ale_hdl_checker_options *g:ale_hdl_checker_options* *b:ale_hdl_checker_options* Type: |String| Default: `''` This variable can be changed to modify the flags/options passed to the 'hdl_checker' server startup command. g:ale_hdl_checker_config_file *g:ale_hdl_checker_config_file* *b:ale_hdl_checker_config_file* Type: |String| Default: `'.hdl_checker.config'` (Unix), `'_hdl_checker.config'` (Windows) This variable can be changed to modify the config file HDL Checker will try to look for. It will also affect how the project's root directory is determined (see |ale-vhdl-hdl-checker|). More info on the configuration file format can be found at: https://github.com/suoto/hdl_checker/wiki/Setting-up-a-project =============================================================================== vcom *ale-vhdl-vcom* g:ale_vhdl_vcom_executable *g:ale_vhdl_vcom_executable* *b:ale_vhdl_vcom_executable* Type: |String| Default: `'vcom'` This variable can be changed to the path to the 'vcom' executable. g:ale_vhdl_vcom_options *g:ale_vhdl_vcom_options* *b:ale_vhdl_vcom_options* Type: |String| Default: `'-2008 -quiet -lint'` This variable can be changed to modify the flags/options passed to 'vcom'. =============================================================================== xvhdl *ale-vhdl-xvhdl* g:ale_vhdl_xvhdl_executable *g:ale_vhdl_xvhdl_executable* *b:ale_vhdl_xvhdl_executable* Type: |String| Default: `'xvhdl'` This variable can be changed to the path to the 'xvhdl' executable. g:ale_vhdl_xvhdl_options *g:ale_vhdl_xvhdl_options* *b:ale_vhdl_xvhdl_options* Type: |String| Default: `'--2008'` This variable can be changed to modify the flags/options passed to 'xvhdl'. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-vim-help.txt000066400000000000000000000007321476501472200160540ustar00rootroot00000000000000=============================================================================== ALE Vim help Integration *ale-vim-help-options* =============================================================================== write-good *ale-vim-help-write-good* See |ale-write-good-options| =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-vim.txt000066400000000000000000000055111476501472200151260ustar00rootroot00000000000000=============================================================================== ALE Vim Integration *ale-vim-options* =============================================================================== vimls *ale-vim-vimls* The `vim-language-server` is the engine that powers VimL editor support using the Language Server Protocol. See the installation instructions: https://github.com/iamcco/vim-language-server#install g:ale_vim_vimls_executable *g:ale_vim_vimls_executable* *b:ale_vim_vimls_executable* Type: |String| Default: `'vim-language-server'` This option can be set to change the executable path for vimls. g:ale_vim_vimls_config *g:ale_vim_vimls_config* *b:ale_vim_vimls_config* Type: |Dictionary| Default: `{}` Dictionary containing configuration settings that will be passed to the language server. For example: > { \ 'vim': { \ 'iskeyword': '@,48-57,_,192-255,-#', \ 'vimruntime': '', \ 'runtimepath': '', \ 'diagnostic': { \ 'enable': v:true \ }, \ 'indexes': { \ 'runtimepath': v:true, \ 'gap': 100, \ 'count': 3, \ 'projectRootPatterns' : ['.git', 'autoload', 'plugin'] \ }, \ 'suggest': { \ 'fromVimruntime': v:true, \ 'fromRuntimepath': v:false \ }, \ } \} < Consult the vim-language-server documentation for more information about settings. g:ale_vim_vimls_use_global *g:ale_vim_vimls_use_global* *b:ale_vim_vimls_use_global* Type: |Number| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| =============================================================================== vint *ale-vim-vint* g:ale_vim_vint_executable *g:ale_vim_vint_executable* *b:ale_vim_vint_executable* Type: |String| Default: `'vint'` This option can be set to change the executable path for Vint. g:ale_vim_vint_show_style_issues *g:ale_vim_vint_show_style_issues* *b:ale_vim_vint_show_style_issues* Type: |Number| Default: `1` This variable will enable/disable style issues for Vint. When this option is disabled, only warnings and errors which are not purely style issues will be reported. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-vue.txt000066400000000000000000000046511476501472200151360ustar00rootroot00000000000000=============================================================================== ALE Vue Integration *ale-vue-options* =============================================================================== cspell *ale-vue-cspell* See |ale-cspell-options| =============================================================================== prettier *ale-vue-prettier* See |ale-javascript-prettier| for information about the available options. =============================================================================== vls *ale-vue-vls* g:ale_vue_vls_executable *g:ale_vue_vls_executable* *b:ale_vue_vls_executable* Type: |String| Default: `'vls'` See |ale-integrations-local-executables| g:ale_vue_vls_use_global *g:ale_vue_vls_use_global* *b:ale_vue_vls_use_global* Type: |Number| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| =============================================================================== volar *ale-vue-volar* It is required to have typescript installed in your project as your dev dependency: `npm i -D typescript` g:ale_vue_volar_executable *g:ale_vue_volar_executable* *b:ale_vue_volar_executable* Type: |String| Default: `'vue-language-server'` See |ale-integrations-local-executables| g:ale_vue_volar_use_global *g:ale_vue_volar_use_global* *b:ale_vue_volar_use_global* Type: |Number| Default: `1` See |ale-integrations-local-executables| g:vue_volar_init_options *g:ale_vue_volar_init_options* *b:ale_vue_volar_init_options* Type: |Dictionary| Default: `{ 'typescript': 'tsdk': '' }` Default is too long to show here, take a look at it over `ale_linters/vue/volar.vim` =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-wgsl.txt000066400000000000000000000012761476501472200153130ustar00rootroot00000000000000=============================================================================== ALE WGSL Integration *ale-wgsl-options* =============================================================================== naga *ale-wgsl-naga* g:ale_wgsl_naga_executable *g:ale_wgsl_naga_executable* *b:ale_wgsl_naga_executable* Type: |String| Default: `'naga'` The executable that will be run for the `naga` linter. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-xhtml.txt000066400000000000000000000012301476501472200154610ustar00rootroot00000000000000=============================================================================== ALE XHTML Integration *ale-xhtml-options* =============================================================================== cspell *ale-xhtml-cspell* See |ale-cspell-options| =============================================================================== write-good *ale-xhtml-write-good* See |ale-write-good-options| =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-xml.txt000066400000000000000000000023371476501472200151360ustar00rootroot00000000000000=============================================================================== ALE XML Integration *ale-xml-options* =============================================================================== xmllint *ale-xml-xmllint* g:ale_xml_xmllint_executable *g:ale_xml_xmllint_executable* *b:ale_xml_xmllint_executable* Type: |String| Default: `'xmllint'` This variable can be set to change the path to xmllint. g:ale_xml_xmllint_options *g:ale_xml_xmllint_options* *b:ale_xml_xmllint_options* Type: |String| Default: `''` This variable can be set to pass additional options to xmllint. g:ale_xml_xmllint_indentsize *g:ale_xml_xmllint_indentsize* *b:ale_xml_xmllint_indentsize* Type: |Number| Default: `2` This variable can be sent to specify the amount of spaces used for indentation. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-yaml.txt000066400000000000000000000317431476501472200153030ustar00rootroot00000000000000=============================================================================== ALE YAML Integration *ale-yaml-options* =============================================================================== actionlint *ale-yaml-actionlint* Website: https://github.com/rhysd/actionlint Installation ------------------------------------------------------------------------------- See installation guide: https://github.com/rhysd/actionlint#quick-start This linter is disabled by default and must be enabled by setting `g:ale_linters`. To enable it only for Github Action YAML files a configuration like this is better: > au BufRead,BufNewFile */.github/*/*.y{,a}ml \ let b:ale_linters = {'yaml': ['actionlint']} < Options ------------------------------------------------------------------------------- g:ale_yaml_actionlint_executable *g:ale_yaml_actionlint_executable* *b:ale_yaml_actionlint_executable* Type: |String| Default: `'actionlint'` This variable can be set to change the path to actionlint. g:ale_yaml_actionlint_options *g:ale_yaml_actionlint_options* *b:ale_yaml_actionlint_options* Type: |String| Default: `''` This variable can be set to add extra options to actionlint executable. For example, to disable running `shellcheck` and `pyflakes` external commands, you may want to set: > let g:ale_yaml_actionlint_options = '-shellcheck= -pyflakes=' < Please note that passing `-format` as option is not supported at the moment. =============================================================================== circleci *ale-yaml-circleci* Website: https://circleci.com/docs/2.0/local-cli Installation ------------------------------------------------------------------------------- Follow the instructions on the website, and make sure to test that you can validate configuration files with: > circleci config validate - < .circleci/config.yml < As long as the validator runs correctly, you should be able to see errors when you save the configuration file. The validator doesn't run as you type because it sends network requests, and running too often would overload the circleci servers. =============================================================================== prettier *ale-yaml-prettier* Website: https://github.com/prettier/prettier Installation ------------------------------------------------------------------------------- Install prettier either globally or locally: > npm install prettier -g # global npm install prettier # local < =============================================================================== spectral *ale-yaml-spectral* Website: https://github.com/stoplightio/spectral Installation ------------------------------------------------------------------------------- Install spectral either globally or locally: > npm install @stoplight/spectral -g # global npm install @stoplight/spectral # local < Options ------------------------------------------------------------------------------- g:ale_yaml_spectral_executable *g:ale_yaml_spectral_executable* *b:ale_yaml_spectral_executable* Type: |String| Default: `'spectral'` This variable can be set to change the path to spectral. g:ale_yaml_spectral_use_global *g:ale_yaml_spectral_use_global* *b:ale_yaml_spectral_use_global* Type: |String| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| =============================================================================== swaglint *ale-yaml-swaglint* Website: https://github.com/byCedric/swaglint Installation ------------------------------------------------------------------------------- Install swaglint either globally or locally: > npm install swaglint -g # global npm install swaglint # local < Options ------------------------------------------------------------------------------- g:ale_yaml_swaglint_executable *g:ale_yaml_swaglint_executable* *b:ale_yaml_swaglint_executable* Type: |String| Default: `'swaglint'` This variable can be set to change the path to swaglint. g:ale_yaml_swaglint_use_global *g:ale_yaml_swaglint_use_global* *b:ale_yaml_swaglint_use_global* Type: |String| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| =============================================================================== yaml-language-server *ale-yaml-language-server* Website: https://github.com/redhat-developer/yaml-language-server Installation ------------------------------------------------------------------------------- Install yaml-language-server either globally or locally: > npm install yaml-language-server -g # global npm install yaml-language-server # local Options ------------------------------------------------------------------------------- g:ale_yaml_ls_executable *g:ale_yaml_ls_executable* *b:ale_yaml_ls_executable* Type: |String| Default: `'yaml-language-server'` This variable can be set to change the path to yaml-language-server. g:ale_yaml_ls_config *g:ale_yaml_ls_config* *b:ale_yaml_ls_config* Type: |Dictionary| Default: `{}` Dictionary containing configuration settings that will be passed to the language server. For example, to enable schema store: > { \ 'yaml': { \ 'schemaStore': { \ 'enable': v:true, \ }, \ }, \ } < Consult the yaml-language-server documentation for more information about settings. g:ale_yaml_ls_use_global *g:ale_yaml_ls_use_global* *b:ale_yaml_ls_use_global* Type: |String| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| =============================================================================== yamlfix *ale-yaml-yamlfix* Website: https://lyz-code.github.io/yamlfix Installation ------------------------------------------------------------------------------- Install yamlfix: > pip install yamlfix < Options ------------------------------------------------------------------------------- g:ale_yaml_yamlfix_executable *g:ale_yaml_yamlfix_executable* *b:ale_yaml_yamlfix_executable* Type: |String| Default: `'yamlfix'` See |ale-integrations-local-executables| g:ale_yaml_yamlfix_options *g:ale_yaml_yamlfix_options* *b:ale_yaml_yamlfix_options* Type: |String| Default: `''` This variable can be set to pass extra options to yamlfix. g:ale_yaml_yamlfix_use_global *g:ale_yaml_yamlfix_use_global* *b:ale_yaml_yamlfix_use_global* Type: |Number| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| =============================================================================== yamlfmt *ale-yaml-yamlfmt* Website: https://github.com/google/yamlfmt Installation ------------------------------------------------------------------------------- Install yamlfmt: See the website. Options ------------------------------------------------------------------------------- g:ale_yaml_yamlfmt_executable *g:ale_yaml_yamlfmt_executable* *b:ale_yaml_yamlfmt_executable* Type: |String| Default: `'yamlfmt'` See |ale-integrations-local-executables| g:ale_yaml_yamlfmt_options *g:ale_yaml_yamlfmt_options* *b:ale_yaml_yamlfmt_options* Type: |String| Default: `''` This variable can be set to pass extra options to yamlfmt. g:ale_yaml_yamlfmt_use_global *g:ale_yaml_yamlfmt_use_global* *b:ale_yaml_yamlfmt_use_global* Type: |Number| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| =============================================================================== yamllint *ale-yaml-yamllint* Website: https://github.com/adrienverge/yamllint Installation ------------------------------------------------------------------------------- Install yamllint in your a virtualenv directory, locally, or globally: > pip install yamllint # After activating virtualenv pip install --user yamllint # Install to ~/.local/bin sudo pip install yamllint # Install globally See |g:ale_virtualenv_dir_names| for configuring how ALE searches for virtualenv directories. Options ------------------------------------------------------------------------------- g:ale_yaml_yamllint_executable *g:ale_yaml_yamllint_executable* *b:ale_yaml_yamllint_executable* Type: |String| Default: `'yamllint'` This variable can be set to change the path to yamllint. g:ale_yaml_yamllint_options *g:ale_yaml_yamllint_options* *b:ale_yaml_yamllint_options* Type: |String| Default: `''` This variable can be set to pass additional options to yamllint. =============================================================================== gitlablint *ale-yaml-gitlablint* Website: https://github.com/elijah-roberts/gitlab-lint Installation ------------------------------------------------------------------------------- Install yamllint in your a virtualenv directory, locally, or globally: > pip3 install gitlab_lint # After activating virtualenv pip3 install --user gitlab_lint # Install to ~/.local/bin sudo pip3 install gitlab_lint # Install globally See |g:ale_virtualenv_dir_names| for configuring how ALE searches for virtualenv directories. Is recommended to use |g:ale_pattern_options| to enable this linter so it only applies to 'gitlab-ci.yml' files and not all yaml files: > let g:ale_pattern_options = { \ '.gitlab-ci\.yml$': { \ 'ale_linters': ['gitlablint'], \ }, \} < Options ------------------------------------------------------------------------------- g:ale_yaml_gitlablint_executable *g:ale_yaml_gitlablint_executable* *b:ale_yaml_gitlablint_executable* Type: |String| Default: `'gll'` This variable can be set to change the path to gll. g:ale_yaml_gitlablint_options *g:ale_yaml_gitlablint_options* *b:ale_yaml_gitlablint_options* Type: |String| Default: `''` This variable can be set to pass additional options to gll. =============================================================================== yq *ale-yaml-yq* Website: https://github.com/mikefarah/yq Installation ------------------------------------------------------------------------------- Install yq: > wget https://github.com/mikefarah/yq/releases/download/${VERSION}/${BINARY}.tar.gz -O - | tar xz && mv ${BINARY} /usr/bin/yq Options ------------------------------------------------------------------------------- g:ale_yaml_yq_executable *g:ale_yaml_yq_executable* *b:ale_yaml_yq_executable* Type: |String| Default: `'yq'` This variable can be set to change the path to yq. g:ale_yaml_yq_options *g:ale_yaml_yq_options* *b:ale_yaml_yq_options* Type: |String| Default: `''` This variable can be set to pass additional options to yq. g:ale_yaml_yq_filters *g:ale_yaml_yq_filters *b:ale_yaml_yq_filters* Type: |String| Default: `'.'` This option can be changed to pass additional filters to yq =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-yang.txt000066400000000000000000000013401476501472200152650ustar00rootroot00000000000000=============================================================================== ALE YANG Integration *ale-yang-options* =============================================================================== yang-lsp *ale-yang-lsp* g:ale_yang_lsp_executable *g:ale_yang_lsp_executable* *b:ale_yang_lsp_executable* Type: |String| Default: `'yang-language-server'` This variable can be changed to use a different executable for yang-lsp. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-yara.txt000066400000000000000000000016761476501472200152770ustar00rootroot00000000000000=============================================================================== ALE Yara Integration *ale-yara-options* *ale-integration-yara* =============================================================================== Integration Information Currently, the only supported linter for yara is yls. =============================================================================== yls *ale-yara-yls* g:ale_yara_yls_executable *g:ale_yara_yls_executable* *b:ale_yara_yls_executable* Type: |String| Default: `'yls'` This variable can be modified to change the executable path for `yls`. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-zeek.txt000066400000000000000000000017021476501472200152670ustar00rootroot00000000000000=============================================================================== ALE Zeek Integration *ale-zeek-options* *ale-integration-zeek* =============================================================================== Integration Information Currently, the only supported linter for Zeek is zeek. =============================================================================== zeek *ale-zeek-zeek* g:ale_zeek_zeek_executable *g:ale_zeek_zeek_executable* *b:ale_zeek_zeek_executable* Type: |String| Default: `'zeek'` This variable can be modified to change the executable path for `zeek`. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale-zig.txt000066400000000000000000000033441476501472200151260ustar00rootroot00000000000000=============================================================================== ALE Zig Integration *ale-zig-options* *ale-integration-zig* =============================================================================== Integration Information Currently, the only supported linter for zig is zls. =============================================================================== zigfmt *ale-zig-zigfmt* g:ale_zig_zigfmt_executable *g:ale_zig_zigfmt_executable* *b:ale_zig_zigfmt_executable* Type: |String| Default: `'zig'` The executable that will be run for the `zig fmt` fixer. =============================================================================== zls *ale-zig-zls* g:ale_zig_zls_executable *g:ale_zig_zls_executable* *b:ale_zig_zls_executable* Type: |String| Default: `'zls'` This variable can be modified to change the executable path for `zls`. g:ale_zig_zls_config *g:ale_zig_zls_config* *b:ale_zig_zls_config* Type: |Dictionary| Default: `{}` WARNING: As of writing, zls does not support receiving configuration from the client. This variable is a PLACEHOLDER until it does. Dictionary with configuration settings for zls. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/doc/ale.txt000066400000000000000000006377251476501472200143570ustar00rootroot00000000000000*ale.txt* Plugin to lint and fix files asynchronously *ale* ALE - Asynchronous Lint Engine =============================================================================== CONTENTS *ale-contents* 1. Introduction.........................|ale-introduction| 2. Supported Languages & Tools..........|ale-support| 3. Linting..............................|ale-lint| 3.1 Linting On Other Machines.........|ale-lint-other-machines| 3.2 Adding Language Servers...........|ale-lint-language-servers| 3.3 Other Sources.....................|ale-lint-other-sources| 4. Fixing Problems......................|ale-fix| 5. Language Server Protocol Support.....|ale-lsp| 5.1 Completion........................|ale-completion| 5.2 Go To Definition..................|ale-go-to-definition| 5.3 Go To Type Definition.............|ale-go-to-type-definition| 5.4 Go To Implementation..............|ale-go-to-implementation| 5.5 Find References...................|ale-find-references| 5.6 Hovering..........................|ale-hover| 5.7 Symbol Search.....................|ale-symbol-search| 5.8 Refactoring: Rename, Actions......|ale-refactor| 6. Global Options.......................|ale-options| 6.1 Highlights........................|ale-highlights| 7. Linter/Fixer Options.................|ale-integration-options| 7.1 Options for alex..................|ale-alex-options| 7.2 Options for cspell................|ale-cspell-options| 7.3 Options for languagetool..........|ale-languagetool-options| 7.4 Options for write-good............|ale-write-good-options| 7.5 Other Linter/Fixer Options........|ale-other-integration-options| 8. Commands/Keybinds....................|ale-commands| 9. API..................................|ale-api| 10. Special Thanks......................|ale-special-thanks| 11. Contact.............................|ale-contact| =============================================================================== 1. Introduction *ale-introduction* ALE provides the means to run linters asynchronously in Vim in a variety of languages and tools. ALE sends the contents of buffers to linter programs using the |job-control| features available in Vim 8 and NeoVim. For Vim 8, Vim must be compiled with the |+job| and |+channel| and |+timers| features as a minimum. ALE supports the following key features for linting: 1. Running linters when text is changed. 2. Running linters when files are opened. 3. Running linters when files are saved. (When a global flag is set.) 4. Populating the |location-list| with warning and errors. 5. Setting |signs| with warnings and errors for error markers. 6. Using `:echo` to show error messages when the cursor moves. 7. Setting syntax highlights for errors. ALE can fix problems with files with the `:ALEFix` command, using the same job control functionality used for checking for problems. Try using the `:ALEFixSuggest` command for browsing tools that can be used to fix problems for the current buffer. If you are interested in contributing to the development of ALE, read the developer documentation. See |ale-development| =============================================================================== 2. Supported Languages & Tools *ale-support* ALE supports a wide variety of languages and tools. See |ale-supported-list| for the full list. =============================================================================== 3. Linting *ale-lint* ALE's primary focus is on checking for problems with your code with various programs via some Vim code for integrating with those programs, referred to as 'linters.' ALE supports a wide array of programs for linting by default, but additional programs can be added easily by defining files in |runtimepath| with the filename pattern `ale_linters//.vim`. For more information on defining new linters, see the extensive documentation for |ale#linter#Define()|. Without any configuration, ALE will attempt to check all of the code for every file you open in Vim with all available tools by default. To see what ALE is doing, and what options have been set, try using the `:ALEInfo` command. Most of the linters ALE runs will check the Vim buffer you are editing instead of the file on disk. This allows you to check your code for errors before you have even saved your changes. ALE will check your code in the following circumstances, which can be configured with the associated options. * When you modify a buffer. - |g:ale_lint_on_text_changed| * On leaving insert mode. - |g:ale_lint_on_insert_leave| * When you open a new or modified buffer. - |g:ale_lint_on_enter| * When you save a buffer. - |g:ale_lint_on_save| * When the filetype changes for a buffer. - |g:ale_lint_on_filetype_changed| * If ALE is used to check code manually. - |:ALELint| *ale-lint-settings-on-startup* It is worth reading the documentation for every option. You should configure which events ALE will use before ALE is loaded, so it can optimize which autocmd commands to run. You can force autocmd commands to be reloaded with `:ALEDisable | ALEEnable` This also applies to the autocmd commands used for |g:ale_echo_cursor|. *ale-lint-file-linters* Some programs must be run against files which have been saved to disk, and simply do not support reading temporary files or stdin, either of which are required for ALE to be able to check for errors as you type. The programs which behave this way are documented in the lists and tables of supported programs. ALE will only lint files with these programs in the following circumstances. * When you open a new or modified buffer. - |g:ale_lint_on_enter| * When you save a buffer. - |g:ale_lint_on_save| * When the filetype changes for a buffer. - |g:ale_lint_on_filetype_changed| * If ALE is used to check code manually. - |:ALELint| ALE will report problems with your code in the following ways, listed with their relevant options. * Via Neovim diagnostics (On in Neovim 0.7+) - |g:ale_use_neovim_diagnostics_api| * By updating loclist. (On by default) - |g:ale_set_loclist| * By updating quickfix. (Off by default) - |g:ale_set_quickfix| * By setting error highlights. - |g:ale_set_highlights| * By creating signs in the sign column. - |g:ale_set_signs| * By echoing messages based on your cursor. - |g:ale_echo_cursor| * By inline text based on your cursor. - |g:ale_virtualtext_cursor| * By displaying the preview based on your cursor. - |g:ale_cursor_detail| * By showing balloons for your mouse cursor - |g:ale_set_balloons| Please consult the documentation for each option, which can reveal some other ways of tweaking the behavior of each way of displaying problems. You can disable or enable whichever options you prefer. Most settings can be configured for each buffer. (|b:| instead of |g:|), including disabling ALE for certain buffers with |b:ale_enabled|. The |g:ale_pattern_options| setting can be used to configure files differently based on regular expressions for filenames. For configuring entire projects, the buffer-local options can be used with external plugins for reading Vim project configuration files. Buffer-local settings can also be used in ftplugin files for different filetypes. ALE offers several options for controlling which linters are run. * Selecting linters to run. - |g:ale_linters| * Aliasing filetypes for linters - |g:ale_linter_aliases| * Only running linters you asked for. - |g:ale_linters_explicit| * Disabling only a subset of linters. - |g:ale_linters_ignore| * Disabling LSP linters and `tsserver`. - |g:ale_disable_lsp| You can stop ALE any currently running linters with the `:ALELintStop` command. Any existing problems will be kept. ------------------------------------------------------------------------------- 3.1 Linting On Other Machines *ale-lint-other-machines* ALE offers support for running linters or fixers on files you are editing locally on other machines, so long as the other machine has access to the file you are editing. This could be a linter or fixer run inside of a Docker image, running in a virtual machine, running on a remote server, etc. In order to run tools on other machines, you will need to configure your tools to run via scripts that execute commands on those machines, such as by setting the ALE `_executable` options for those tools to a path for a script to run, or by using |g:ale_command_wrapper| to specify a script to wrap all commands that are run by ALE, before they are executed. For tools that ALE runs where ALE looks for locally installed executables first, you may need to set the `_use_global` options for those tools to `1`, or you can set |g:ale_use_global_executables| to `1` before ALE is loaded to only use global executables for all tools. In order for ALE to properly lint or fix files which are running on another file system, you must provide ALE with |List|s of strings for mapping paths to and from your local file system and the remote file system, such as the file system of your Docker container. See |g:ale_filename_mappings| for all of the different ways these filename mappings can be configured. For example, you might configure `pylint` to run via Docker by creating a script like so. > #!/usr/bin/env bash exec docker run -i --rm -v "$(pwd):/data" cytopia/pylint "$@" < You will want to run Docker commands with `-i` in order to read from stdin. With the above script in mind, you might configure ALE to lint your Python project with `pylint` by providing the path to the script to execute, and mappings which describe how to change between the two file systems in your `python.vim` |ftplugin| file, like so: > if expand('%:p') =~# '^/home/w0rp/git/test-pylint/' let b:ale_linters = ['pylint'] let b:ale_python_pylint_use_global = 1 " This is the path to the script above. let b:ale_python_pylint_executable = '/home/w0rp/git/test-pylint/pylint.sh' " /data matches the path in Docker. let b:ale_filename_mappings = { \ 'pylint': [ \ ['/home/w0rp/git/test-pylint', '/data'], \ ], \} endif < You might consider using a Vim plugin for loading Vim configuration files specific to each project, if you have a lot of projects to manage. ------------------------------------------------------------------------------- 3.2 Adding Language Servers *ale-lint-language-servers* ALE comes with many default configurations for language servers, so they can be detected and run automatically. ALE can connect to other language servers by defining a new linter for a filetype. New linters can be defined in |vimrc|, in plugin files, or `ale_linters` directories in 'runtimepath'. See |ale-linter-loading-behavior| for more information on loading linters. A minimal configuration for a language server linter might look so. > call ale#linter#Define('filetype_here', { \ 'name': 'any_name_you_want', \ 'lsp': 'stdio', \ 'executable': '/path/to/executable', \ 'command': '%e run', \ 'project_root': '/path/to/root_of_project', \}) < For language servers that use a TCP or named pipe socket connection, you should define the address to connect to instead. > call ale#linter#Define('filetype_here', { \ 'name': 'any_name_you_want', \ 'lsp': 'socket', \ 'address': 'servername:1234', \ 'project_root': '/path/to/root_of_project', \}) < Most of the options for a language server can be replaced with a |Funcref| for a function accepting a buffer number for dynamically computing values such as the executable path, the project path, the server address, etc, most of which can also be determined based on executing some other asynchronous task. See |ale#command#Run()| for computing linter options based on asynchronous results. See |ale#linter#Define()| for a detailed explanation of all of the options for configuring linters. ------------------------------------------------------------------------------- 3.3 Other Sources *ale-lint-other-sources* Problems for a buffer can be taken from other sources and rendered by ALE. This allows ALE to be used in combination with other plugins which also want to display any problems they might find with a buffer. ALE's API includes the following components for making this possible. * |ale#other_source#StartChecking()| - Tell ALE that a buffer is being checked. * |ale#other_source#ShowResults()| - Show results from another source. * |ALEWantResults| - A signal for when ALE wants results. Other resources can provide results for ALE to display at any time, following ALE's loclist format. (See |ale-loclist-format|) For example: > " Tell ALE to show some results. " This function can be called at any time. call ale#other_source#ShowResults(bufnr(''), 'some-linter-name', [ \ {'text': 'Something went wrong', 'lnum': 13}, \]) < Other sources should use a unique name for identifying themselves. A single linter name can be used for all problems from another source, or a series of unique linter names can be used. Results can be cleared for that source by providing an empty List. |ale#other_source#StartChecking()| should be called whenever another source starts checking a buffer, so other tools can know that a buffer is being checked by some plugin. The |ALEWantResults| autocmd event can be used to start checking a buffer for problems every time that ALE does. When |ALEWantResults| is signaled, |g:ale_want_results_buffer| will be set to the number of the buffer that ALE wants to check. |ale#other_source#StartChecking()| should be called synchronously, and other sources should perform their checks on a buffer in the background asynchronously, so they don't interrupt editing. |ale#other_source#ShowResults()| must not be called synchronously before ALE's engine executes its code after the |ALEWantResults| event runs. If there are immediate results to provide to ALE, a 0 millisecond timer with |timer_start()| can be set instead up to call |ale#other_source#ShowResults()| after ALE has first executed its engine code for its own sources. A plugin might integrate its own checks with ALE like so: > augroup SomeGroupName autocmd! autocmd User ALEWantResults call Hook(g:ale_want_results_buffer) augroup END function! DoBackgroundWork(buffer) abort " Start some work in the background here. " ... " Then call WorkDone(a:buffer, results) endfunction function! Hook(buffer) abort " Tell ALE we're going to check this buffer. call ale#other_source#StartChecking(a:buffer, 'some-name') call DoBackgroundWork(a:buffer) endfunction function! WorkDone(buffer, results) abort " Send results to ALE after they have been collected. call ale#other_source#ShowResults(a:buffer, 'some-name', a:results) endfunction < =============================================================================== 4. Fixing Problems *ale-fix* ALE can fix problems with files with the `:ALEFix` command. `:ALEFix` accepts names of fixers to be applied as arguments. Alternatively, when no arguments are provided, the variable |g:ale_fixers| will be read for getting a |List| of commands for filetypes, split on `.`, and the functions named in |g:ale_fixers| will be executed for fixing the errors. The `:ALEFixSuggest` command can be used to suggest tools that be used to fix problems for the current buffer. The values for `g:ale_fixers` can be a list of |String|, |Funcref|, or |lambda| values. String values must either name a function, or a short name for a function set in the ALE fixer registry. Each function for fixing errors must accept either one argument `(buffer)` or two arguments `(buffer, lines)`, representing the buffer being fixed and the lines to fix. The functions must return either `0`, for changing nothing, a |List| for new lines to set, a |Dictionary| for describing a command to be run in the background, or the result of |ale#command#Run()|. Functions receiving a variable number of arguments will not receive the second argument `lines`. Functions should name two arguments if the `lines` argument is desired. This is required to avoid unnecessary copying of the lines of the buffers being checked. When a |Dictionary| is returned for an `:ALEFix` callback, the following keys are supported for running the commands. `cwd` An optional |String| for setting the working directory for the command. If not set, or `v:null`, the `cwd` of the last command that spawn this one will be used. `command` A |String| for the command to run. This key is required. When `%t` is included in a command string, a temporary file will be created, containing the lines from the file after previous adjustment have been done. See |ale-command-format-strings| for formatting options. `read_temporary_file` When set to `1`, ALE will read the contents of the temporary file created for `%t`. This option can be used for commands which need to modify some file on disk in order to fix files. `process_with` An optional callback for post-processing. The callback must accept arguments `(bufnr, output)`: the buffer number undergoing fixing and the fixer's output as a |List| of |String|s. It must return a |List| of |String|s that will be the new contents of the buffer. This callback is useful to remove excess lines from the command's output or apply additional changes to the output. `read_buffer` An optional key for disabling reading the buffer. When set to `0`, ALE will not pipe the buffer's data into the command via stdin. This option is ignored and the buffer is not read when `read_temporary_file` is `1`. This option defaults to `1`. *ale-fix-configuration* Synchronous functions and asynchronous jobs will be run in a sequence for fixing files, and can be combined. For example: > let g:ale_fixers = { \ 'javascript': [ \ 'DoSomething', \ 'eslint', \ {buffer, lines -> filter(lines, 'v:val !=~ ''^\s*//''')}, \ ], \} ALEFix < The above example will call a function called `DoSomething` which could act upon some lines immediately, then run `eslint` from the ALE registry, and then call a lambda function which will remove every single line comment from the file. For buffer-local settings, such as in |g:ale_pattern_options| or in ftplugin files, a |List| may be used for configuring the fixers instead. > " Same as the above, only a List can be used instead of a Dictionary. let b:ale_fixers = [ \ 'DoSomething', \ 'eslint', \ {buffer, lines -> filter(lines, 'v:val !=~ ''^\s*//''')}, \] ALEFix < For convenience, a plug mapping is defined for `:ALEFix`, so you can set up a keybind easily for fixing files. > " Bind F8 to fixing problems with ALE nmap (ale_fix) < Files can be fixed automatically with the following options, which are all off by default. |g:ale_fix_on_save| - Fix files when they are saved. Fixers can be disabled on save with |g:ale_fix_on_save_ignore|. They will still be run when you manually run `:ALEFix`. Fixers can be run on another machines, just like linters, such as fixers run from a Docker container, running in a virtual machine, running a remote server, etc. See |ale-lint-other-machines|. =============================================================================== 5. Language Server Protocol Support *ale-lsp* ALE offers some support for integrating with Language Server Protocol (LSP) servers. LSP linters can be used in combination with any other linter, and will automatically connect to LSP servers when needed. ALE also supports `tsserver` for TypeScript, which uses a different but very similar protocol. If you want to use another plugin for LSP features and tsserver, you can use the |g:ale_disable_lsp| setting to disable ALE's own LSP integrations, or ignore particular linters with |g:ale_linters_ignore|. If for any reason you want to stop a language server ALE starts, such as when a project configuration has significantly changed, or new files have been added the language server isn't aware of, use either `:ALEStopLSP` or `:ALEStopAllLSPs` to stop the server until ALE automatically starts it again. ------------------------------------------------------------------------------- 5.1 Completion *ale-completion* ALE offers support for automatic completion of code while you type. Completion is only supported while at least one LSP linter is enabled. ALE will only suggest symbols provided by the LSP servers. *ale-deoplete-integration* ALE integrates with Deoplete for offering automatic completion data. ALE's completion source for Deoplete is named `'ale'`, and should enabled automatically if Deoplete is enabled and configured correctly. Deoplete integration should not be combined with ALE's own implementation. *ale-asyncomplete-integration* ALE additionally integrates with asyncomplete.vim for offering automatic completion data. ALE's asyncomplete source requires registration and should use the defaults provided by the |asyncomplete#sources#ale#get_source_options| function > " Use ALE's function for asyncomplete defaults au User asyncomplete_setup call asyncomplete#register_source(asyncomplete#sources#ale#get_source_options({ \ 'priority': 10, " Provide your own overrides here \ })) > ALE also offers its own completion implementation, which does not require any other plugins. Suggestions will be made while you type after completion is enabled. ALE's own completion implementation can be enabled by setting |g:ale_completion_enabled| to `1`. This setting must be set to `1` before ALE is loaded. The delay for completion can be configured with |g:ale_completion_delay|. This setting should not be enabled if you wish to use ALE as a completion source for other plugins. ALE automatic completion will not work when 'paste' is active. Only set 'paste' when you are copy and pasting text into your buffers. ALE automatic completion will interfere with default insert completion with `CTRL-N` and so on (|compl-vim|). You can write your own keybinds and a function in your |vimrc| file to force insert completion instead, like so: > function! SmartInsertCompletion() abort " Use the default CTRL-N in completion menus if pumvisible() return "\" endif " Exit and re-enter insert mode, and use insert completion return "\a\" endfunction inoremap =SmartInsertCompletion() < ALE provides an 'omnifunc' function |ale#completion#OmniFunc| for triggering completion manually with CTRL-X CTRL-O. |i_CTRL-X_CTRL-O| > " Use ALE's function for omnicompletion. set omnifunc=ale#completion#OmniFunc < *ale-completion-fallback* You can write your own completion function and fallback on other methods of completion by checking if there are no results that ALE can determine. For example, for Python code, you could fall back on the `python3complete` function. > function! TestCompletionFunc(findstart, base) abort let l:result = ale#completion#OmniFunc(a:findstart, a:base) " Check if ALE couldn't find anything. if (a:findstart && l:result is -3) \|| (!a:findstart && empty(l:result)) " Defer to another omnifunc if ALE couldn't find anything. return python3complete#Complete(a:findstart, a:base) endif return l:result endfunction set omnifunc=TestCompletionFunc < See |complete-functions| for documentation on how to write completion functions. ALE will only suggest so many possible matches for completion. The maximum number of items can be controlled with |g:ale_completion_max_suggestions|. If you don't like some of the suggestions you see, you can filter them out with |g:ale_completion_excluded_words| or |b:ale_completion_excluded_words|. The `:ALEComplete` command can be used to show completion suggestions manually, even when |g:ale_completion_enabled| is set to `0`. For manually requesting completion information with Deoplete, consult Deoplete's documentation. ALE supports automatic imports from external modules. This behavior can be disabled by setting the |g:ale_completion_autoimport| variable to `0`. Disabling automatic imports can drop some or all completion items from some LSP servers (e.g. eclipselsp). You can manually request imports for symbols at the cursor with the `:ALEImport` command. The word at the cursor must be an exact match for some potential completion result which includes additional text to insert into the current buffer, which ALE will assume is code for an import line. This command can be useful when your code already contains something you need to import. You can execute other commands whenever ALE inserts some completion text with the |ALECompletePost| event. When working with TypeScript files, ALE can remove warnings from your completions by setting the |g:ale_completion_tsserver_remove_warnings| variable to 1. *ale-completion-completeopt-bug* ALE Automatic completion implementation replaces |completeopt| before opening the omnicomplete menu with . In some versions of Vim, the value set for the option will not be respected. If you experience issues with Vim automatically inserting text while you type, set the following option in vimrc, and your issues should go away. > set completeopt=menu,menuone,preview,noselect,noinsert < Or alternatively, if you want to show documentation in popups: > set completeopt=menu,menuone,popup,noselect,noinsert < *ale-symbols* ALE provides a set of basic completion symbols. If you want to replace those symbols with others, you can set the variable |g:ale_completion_symbols| with a mapping of the type of completion to the symbol or other string that you would like to use. An example here shows the available options for symbols > let g:ale_completion_symbols = { \ 'text': '', \ 'method': '', \ 'function': '', \ 'constructor': '', \ 'field': '', \ 'variable': '', \ 'class': '', \ 'interface': '', \ 'module': '', \ 'property': '', \ 'unit': 'unit', \ 'value': 'val', \ 'enum': '', \ 'keyword': 'keyword', \ 'snippet': '', \ 'color': 'color', \ 'file': '', \ 'reference': 'ref', \ 'folder': '', \ 'enum member': '', \ 'constant': '', \ 'struct': '', \ 'event': 'event', \ 'operator': '', \ 'type_parameter': 'type param', \ '': 'v' \ } < ------------------------------------------------------------------------------- 5.2 Go To Definition *ale-go-to-definition* ALE supports jumping to the files and locations where symbols are defined through any enabled LSP linters. The locations ALE will jump to depend on the information returned by LSP servers. The `:ALEGoToDefinition` command will jump to the definition of symbols under the cursor. See the documentation for the command for configuring how the location will be displayed. ALE will update Vim's |tagstack| automatically unless |g:ale_update_tagstack| is set to `0`. ------------------------------------------------------------------------------- 5.3 Go To Type Definition *ale-go-to-type-definition* ALE supports jumping to the files and locations where symbols' types are defined through any enabled LSP linters. The locations ALE will jump to depend on the information returned by LSP servers. The `:ALEGoToTypeDefinition` command will jump to the definition of symbols under the cursor. See the documentation for the command for configuring how the location will be displayed. ------------------------------------------------------------------------------- 5.4 Go To Implementation *ale-go-to-implementation* ALE supports jumping to the files and locations where symbols are implemented through any enabled LSP linters. The locations ALE will jump to depend on the information returned by LSP servers. The `:ALEGoToImplementation` command will jump to the implementation of symbols under the cursor. See the documentation for the command for configuring how the location will be displayed. ------------------------------------------------------------------------------- 5.5 Find References *ale-find-references* ALE supports finding references for symbols though any enabled LSP linters with the `:ALEFindReferences` command. See the documentation for the command for a full list of options. ------------------------------------------------------------------------------- 5.6 Hovering *ale-hover* ALE supports "hover" information for printing brief information about symbols at the cursor taken from LSP linters. The following commands are supported: `:ALEHover` - Print information about the symbol at the cursor. Truncated information will be displayed when the cursor rests on a symbol by default, as long as there are no problems on the same line. You can disable this behavior by setting |g:ale_hover_cursor| to `0`. If |g:ale_set_balloons| is set to `1` and your version of Vim supports the |balloon_show()| function, then "hover" information also show up when you move the mouse over a symbol in a buffer. Diagnostic information will take priority over hover information for balloons. If a line contains a problem, that problem will be displayed in a balloon instead of hover information. Hover information can be displayed in the preview window instead by setting |g:ale_hover_to_preview| to `1`. When using Neovim or Vim with |popupwin|, if |g:ale_hover_to_floating_preview| or |g:ale_floating_preview| is set to 1, the hover information will show in a floating window. The borders of the floating preview window can be customized by setting |g:ale_floating_window_border|. For Vim 8.1+ terminals, mouse hovering is disabled by default. Enabling |balloonexpr| commands in terminals can cause scrolling issues in terminals, so ALE will not attempt to show balloons unless |g:ale_set_balloons| is set to `1` before ALE is loaded. For enabling mouse support in terminals, you may have to change your mouse settings. For example: > " Example mouse settings. " You will need to try different settings, depending on your terminal. set mouse=a set ttymouse=xterm < Documentation for symbols at the cursor can be retrieved using the `:ALEDocumentation` command. This command is only available for `tsserver`. ------------------------------------------------------------------------------- 5.7 Symbol Search *ale-symbol-search* ALE supports searching for workspace symbols via LSP linters with the `:ALESymbolSearch` command. See the documentation for the command for a full list of options. ------------------------------------------------------------------------------- 5.8 Refactoring: Rename, Actions *ale-refactor* ALE supports renaming symbols in code such as variables or class names with the `:ALERename` command. `:ALEFileRename` will rename file and fix import paths (tsserver only). `:ALECodeAction` will execute actions on the cursor or applied to a visual range selection, such as automatically fixing errors. Actions will appear in the right click mouse menu by default for GUI versions of Vim, unless disabled by setting |g:ale_popup_menu_enabled| to `0`. Make sure to set your Vim to move the cursor position whenever you right click, and enable the mouse menu: > set mouse=a set mousemodel=popup_setpos < You may wish to remove some other menu items you don't want to see: > silent! aunmenu PopUp.Select\ Word silent! aunmenu PopUp.Select\ Sentence silent! aunmenu PopUp.Select\ Paragraph silent! aunmenu PopUp.Select\ Line silent! aunmenu PopUp.Select\ Block silent! aunmenu PopUp.Select\ Blockwise silent! aunmenu PopUp.Select\ All < =============================================================================== 6. Global Options *ale-options* g:airline#extensions#ale#enabled *g:airline#extensions#ale#enabled* Type: |Number| Default: `1` Enables or disables the |airline|'s native extension for ale, which displays warnings and errors in the status line, prefixed by |airline#extensions#ale#error_symbol| and |airline#extensions#ale#warning_symbol|. g:ale_cache_executable_check_failures *g:ale_cache_executable_check_failures* Type: |Number| Default: not set When set to `1`, ALE will cache failing executable checks for linters. By default, only executable checks which succeed will be cached. When this option is set to `1`, Vim will have to be restarted after new executables are installed for ALE to be able to run linters for those executables. g:ale_change_sign_column_color *g:ale_change_sign_column_color* Type: |Number| Default: `0` When set to `1`, this option will set different highlights for the sign column itself when ALE reports problems with a file. This option can be combined with |g:ale_sign_column_always|. ALE uses the following highlight groups for highlighting the sign column: `:ALESignColumnWithErrors` - Links to `Error` by default. `:ALESignColumnWithoutErrors` - Uses the value for `SignColumn` by default. The sign column color can only be changed globally in Vim. The sign column might produce unexpected results if editing different files in split windows. g:ale_close_preview_on_insert *g:ale_close_preview_on_insert* Type: |Number| Default: `0` When this option is set to `1`, ALE's |preview-window| will be automatically closed upon entering Insert Mode. This option can be used in combination with |g:ale_cursor_detail| for automatically displaying the preview window on problem lines, and automatically closing it again when editing text. This setting must be set to `1` before ALE is loaded for this behavior to be enabled. See |ale-lint-settings-on-startup|. g:ale_command_wrapper *g:ale_command_wrapper* *b:ale_command_wrapper* Type: |String| Default: `''` An option for wrapping all commands that ALE runs, for linters, fixers, and LSP commands. This option can be set globally, or for specific buffers. This option can be used to apply nice to all commands. For example: > " Prefix all commands with nice. let g:ale_command_wrapper = 'nice -n5' < Use the `:ALEInfo` command to view the commands that are run. All of the arguments for commands will be put on the end of the wrapped command by default. A `%*` marker can be used to spread the arguments in the wrapped command. > " Has the same effect as the above. let g:ale_command_wrapper = 'nice -n5 %*' < For passing all of the arguments for a command as one argument to a wrapper, `%@` can be used instead. > " Will result in say: /bin/bash -c 'other-wrapper -c "some command" -x' let g:ale_command_wrapper = 'other-wrapper -c %@ -x' < For commands including `&&` or `;`, only the last command in the list will be passed to the wrapper. `&&` is most commonly used in ALE to change the working directory before running a command. g:ale_completion_delay *g:ale_completion_delay* Type: |Number| Default: `100` The number of milliseconds before ALE will send a request to a language server for completions after you have finished typing. See |ale-completion| g:ale_completion_enabled *g:ale_completion_enabled* *b:ale_completion_enabled* Type: |Number| Default: `0` When this option is set to `1`, completion support will be enabled. This setting must be set to `1` before ALE is loaded for this behavior to be enabled. This setting should not be enabled if you wish to use ALE as a completion source for other completion plugins. ALE automatic completion will not work when 'paste' is active. Only set 'paste' when you are copy and pasting text into your buffers. A buffer-local version of this setting `b:ale_completion_enabled` can be set to `0` to disable ALE's automatic completion support for a single buffer. ALE's completion support must be enabled globally to be enabled locally. See |ale-completion| *g:ale_completion_tsserver_remove_warnings* g:ale_completion_tsserver_remove_warnings Type: |Number| Default: `0` When this option is set to `0`, ALE will return all completion items, including those that are a warning. Warnings can be excluded from completed items by setting it to `1`. g:ale_completion_autoimport *g:ale_completion_autoimport* Type: |Number| Default: `1` When this option is set to `1`, ALE will try to automatically import completion results from external modules. It can be disabled by setting it to `0`. Some LSP servers include auto imports on every completion item so disabling automatic imports may drop some or all completion items returned by it (e.g. eclipselsp). g:ale_completion_excluded_words *g:ale_completion_excluded_words* *b:ale_completion_excluded_words* Type: |List| Default: `[]` This option can be set to a list of |String| values for "words" to exclude from completion results, as in the words for |complete-items|. The strings will be matched exactly in a case-sensitive manner. (|==#|) This setting can be configured in ftplugin files with buffer variables, so that different lists can be used for different filetypes. For example: > " In ~/.vim/ftplugin/typescript.vim " Don't suggest `it` or `describe` so we can use snippets for those words. let b:ale_completion_excluded_words = ['it', 'describe'] < g:ale_completion_symbols *g:ale_completion_symbols* Type: |Dictionary| Default: See `autoload/ale/completion.vim` A mapping from completion types to symbols for completions. See |ale-symbols| for more information. By default, this mapping only uses built in Vim completion kinds, but it can be updated to use any unicode character for the completion kind. For example: > let g:ale_completion_symbols = { \ 'text': '', \ 'method': '', \ 'function': '', \ 'constructor': '', \ 'field': '', \ 'variable': '', \ 'class': '', \ 'interface': '', \ 'module': '', \ 'property': '', \ 'unit': 'v', \ 'value': 'v', \ 'enum': 't', \ 'keyword': 'v', \ 'snippet': 'v', \ 'color': 'v', \ 'file': 'v', \ 'reference': 'v', \ 'folder': 'v', \ 'enum_member': 'm', \ 'constant': 'm', \ 'struct': 't', \ 'event': 'v', \ 'operator': 'f', \ 'type_parameter': 'p', \ '': 'v' \ }) < g:ale_completion_max_suggestions *g:ale_completion_max_suggestions* Type: |Number| Default: `50` The maximum number of items ALE will suggest in completion menus for automatic completion. Setting this number higher will require more processing time, and may suggest too much noise. Setting this number lower will require less processing time, but some suggestions will not be included, so you might not be able to see the suggestions you want. Adjust this option as needed, depending on the complexity of your codebase and your available processing power. g:ale_cursor_detail *g:ale_cursor_detail* Type: |Number| Default: `0` When this option is set to `1`, ALE's |preview-window| will be automatically opened when the cursor moves onto lines with problems. ALE will search for problems using the same logic that |g:ale_echo_cursor| uses. The preview window will be closed automatically when you move away from the line. Messages are only displayed after a short delay. See |g:ale_echo_delay|. The preview window is opened without stealing focus, which means your cursor will stay in the same buffer as it currently is. The preview window can be closed automatically upon entering Insert mode by setting |g:ale_close_preview_on_insert| to `1`. Either this setting or |g:ale_echo_cursor| must be set to `1` before ALE is loaded for messages to be displayed. See |ale-lint-settings-on-startup|. g:ale_default_navigation *g:ale_default_navigation* *b:ale_default_navigation* Type: |String| Default: `'buffer'` The default method for navigating away from the current buffer to another buffer, such as for `:ALEFindReferences` or `:ALEGoToDefinition`. g:ale_detail_to_floating_preview *g:ale_detail_to_floating_preview* *b:ale_detail_to_floating_preview* Type: |Number| Default: `0` When this option is set to `1`, Neovim or Vim with |popupwin| will use a floating window for ALEDetail output. g:ale_disable_lsp *g:ale_disable_lsp* *b:ale_disable_lsp* Type: |Number| OR |String| Default: `'auto'` When this option is set to `'auto'`, ALE will automatically disable linters that it detects as having already been configured with the nvim-lspconfig plugin. When this option is set to `1`, ALE ignores all linters powered by LSP, and also `tsserver`. Any linters that are disabled will also not be usable for LSP functionality other than just linting. Please see also |ale-lsp|. g:ale_echo_cursor *g:ale_echo_cursor* Type: |Number| Default: `1` When this option is set to `1`, a truncated message will be echoed when a cursor is near a warning or error. ALE will attempt to find the warning or error at a column nearest to the cursor when the cursor is resting on a line which contains a warning or error. This option can be set to `0` to disable this behavior. Messages are only displayed after a short delay. See |g:ale_echo_delay|. The format of the message can be customized with |g:ale_echo_msg_format|. Either this setting or |g:ale_cursor_detail| must be set to `1` before ALE is loaded for messages to be displayed. See |ale-lint-settings-on-startup|. g:ale_echo_delay *g:ale_echo_delay* *b:ale_echo_delay* Type: |Number| Default: `10` Given any integer, this option controls the number of milliseconds before ALE will echo or preview a message for a problem near the cursor. The value can be increased to decrease the amount of processing ALE will do for files displaying a large number of problems. g:ale_echo_msg_error_str *g:ale_echo_msg_error_str* Type: |String| Default: `'Error'` The string used for `%severity%` for errors. See |g:ale_echo_msg_format| g:ale_echo_msg_format *g:ale_echo_msg_format* *b:ale_echo_msg_format* Type: |String| Default: `'%code: %%s'` This variable defines a message format for echoed messages. The following sequences of characters will be replaced. `%s` - replaced with the text for the problem `%...code...% `- replaced with the error code `%linter%` - replaced with the name of the linter `%severity%` - replaced with the severity of the problem (e.g. `Error`) `%type%` - replaced with the type of the problem (e.g. `E`) The strings for `%severity%` can be configured with the following options. |g:ale_echo_msg_error_str| - Defaults to `'Error'` |g:ale_echo_msg_info_str| - Defaults to `'Info'` |g:ale_echo_msg_warning_str| - Defaults to `'Warning'` `%code%` is replaced with the error code, and replaced with an empty string when there is no error code. Any extra characters between the percent signs will be printed when an error code is present. For example, a message like `(error code): message` will be printed for `'%(code): %%s'` and simply the message will be printed when there is no code. |g:ale_echo_cursor| needs to be set to 1 for messages to be displayed. The echo message format can also be configured separately for each buffer, so different formats can be used for different languages. (Say in ftplugin files.) g:ale_echo_msg_info_str *g:ale_echo_msg_info_str* Type: |String| Default: `'Info'` The string used for `%severity%` for info. See |g:ale_echo_msg_format| g:ale_echo_msg_log_str *g:ale_echo_msg_log_str* Type: |String| Default: `'Log'` The string used for `%severity%` for log, used only for handling LSP show message requests. See |g:ale_lsp_show_message_format| g:ale_echo_msg_warning_str *g:ale_echo_msg_warning_str* Type: |String| Default: `'Warning'` The string used for `%severity%` for warnings. See |g:ale_echo_msg_format| g:ale_enabled *g:ale_enabled* *b:ale_enabled* Type: |Number| Default: `1` When set to `0`, this option will completely disable ALE, such that no error checking will be performed, etc. ALE can be toggled on and off with the `:ALEToggle` command, which changes this option. ALE can be disabled in each buffer by setting `let b:ale_enabled = 0` Disabling ALE based on filename patterns can be accomplished by setting a regular expression for |g:ale_pattern_options|. For example: > " Disable linting for all minified JS files. let g:ale_pattern_options = {'\.min.js$': {'ale_enabled': 0}} < See |g:ale_pattern_options| for more information on that option. g:ale_exclude_highlights *g:ale_exclude_highlights* *b:ale_exclude_highlights* Type: |List| Default: `[]` This setting has no effect when |g:ale_use_neovim_diagnostics_api| is `1`. A list of regular expressions for matching against highlight messages to remove. For example: > " Do not highlight messages matching strings like these. let b:ale_exclude_highlights = ['line too long', 'foo.*bar'] < See also: |g:ale_set_highlights| g:ale_fixers *g:ale_fixers* *b:ale_fixers* Type: |Dictionary| Default: `{}` A mapping from filetypes to |List| values for functions for fixing errors. See |ale-fix| for more information. This variable can be overridden with variables in each buffer. `b:ale_fixers` can be set to a |List| of callbacks instead, which can be more convenient. A special `'*'` key be used as a wildcard filetype for configuring fixers for every other type of file. For example: > " Fix Python files with 'bar'. " Don't fix 'html' files. " Fix everything else with 'foo'. let g:ale_fixers = {'python': ['bar'], 'html': [], '*': ['foo']} < g:ale_fix_on_save *g:ale_fix_on_save* *b:ale_fix_on_save* Type: |Number| Default: `0` When set to 1, ALE will fix files when they are saved. If |g:ale_lint_on_save| is set to 1, files will be checked with linters after files are fixed, only when the buffer is open, or re-opened. Changes to the file will be saved to the file on disk. Files will not be fixed on `:wq`, so you should check your code before closing a buffer. Fixing files can be disabled or enabled for individual buffers by setting `b:ale_fix_on_save` to `0` or `1`. Some fixers can be excluded from being run automatically when you save files with the |g:ale_fix_on_save_ignore| setting. g:ale_fix_on_save_ignore *g:ale_fix_on_save_ignore* *b:ale_fix_on_save_ignore* Type: |Dictionary| or |List| Default: `{}` Given a |Dictionary| mapping filetypes to |Lists| of fixers to ignore, or just a |List| of fixers to ignore, exclude those fixers from being run automatically when files are saved. You can disable some fixers in your ftplugin file: > " Disable fixers 'b' and 'c' when fixing on safe for this buffer. let b:ale_fix_on_save_ignore = ['b', 'c'] " Alternatively, define ignore lists for different filetypes. let b:ale_fix_on_save_ignore = {'foo': ['b'], 'bar': ['c']} < You can disable some fixers globally per filetype like so: > let g:ale_fixers = {'foo': ['a', 'b'], 'bar': ['c', 'd']} let g:ale_fix_on_save = 1 " For filetype `foo.bar`, only fixers 'b' and 'd' will be run on save. let g:ale_fix_on_save_ignore = {'foo': ['a'], 'bar': ['c']} " Alternatively, disable these fixers on save for all filetypes. let g:ale_fix_on_save_ignore = ['a', 'c'] < You can ignore fixers based on matching |Funcref| values too: > let g:AddBar = {buffer, lines -> lines + ['bar']} let g:ale_fixers = {'foo': g:AddBar} " The lambda fixer will be ignored, as it will be found in the ignore list. let g:ale_fix_on_save_ignore = [g:AddBar] < g:ale_floating_preview *g:ale_floating_preview* Type: |Number| Default: `0` When set to `1`, Neovim or Vim with |popupwin| will use a floating window for ale's preview window. This is equivalent to setting |g:ale_hover_to_floating_preview| and |g:ale_detail_to_floating_preview| to `1`. g:ale_floating_preview_popup_opts *g:ale_floating_preview_popup_opts* Type: |String| or |Dictionary| Default: `''` Either a dictionary of options or the string name of a function that returns a dictionary of options. This will be used as an argument to |popup_create| for Vim users or |nvim_open_win| for NeoVim users. In either case, the resulting dictionary is merged with ALE defaults rather than explicitly overriding them. This only takes effect if |g:ale_floating_preview| is enabled. NOTE: for Vim users see |popup_create-arguments|, for NeoVim users see |nvim_open_win| for argument details For example, to enhance popups with a title: > function! CustomOpts() abort let [l:info, l:loc] = ale#util#FindItemAtCursor(bufnr('')) return {'title': ' ALE: ' . (l:loc.linter_name) . ' '} endfunction let g:ale_floating_preview_popup_opts = 'g:CustomOpts' < g:ale_floating_window_border *g:ale_floating_window_border* Type: |List| Default: `['|', '-', '+', '+', '+', '+', '|', '-']` When set to `[]`, window borders are disabled. The elements in the list set the characters for the left side, top, top-left corner, top-right corner, bottom-right corner, bottom-left corner, right side, and bottom of the floating window, respectively. If the terminal supports Unicode, you might try setting the value to ` ['│', '─', '╭', '╮', '╯', '╰', '│', '─']`, to make it look nicer. NOTE: For compatibility with previous versions, if the list does not have elements for the right side and bottom, the left side and top will be used instead. g:ale_history_enabled *g:ale_history_enabled* Type: |Number| Default: `1` When set to `1`, ALE will remember the last few commands which were run for every buffer which is open. This information can be viewed with the `:ALEInfo` command. The size of the buffer can be controlled with the |g:ale_max_buffer_history_size| option. This option can be disabled if storing a command history is not desired. g:ale_history_log_output *g:ale_history_log_output* Type: |Number| Default: `1` When set to `1`, ALE will store the output of commands which have completed successfully in the command history, and the output will be displayed when using `:ALEInfo`. |g:ale_history_enabled| must be set to `1` for this output to be stored or printed. Some memory will be consumed by this option. It is very useful for figuring out what went wrong with linters, and for bug reports. Turn this option off if you want to save on some memory usage. g:ale_hover_cursor *g:ale_hover_cursor* Type: |Number| Default: `1` If set to `1`, ALE will show truncated information in the echo line about the symbol at the cursor automatically when the |CursorHold| event is fired. The delay before requesting hover information is based on 'updatetime', as with all |CursorHold| events. If there's a problem on the line where the cursor is resting, ALE will not show any hover information. See |ale-hover| for more information on hover information. This setting must be set to `1` before ALE is loaded for this behavior to be enabled. See |ale-lint-settings-on-startup|. g:ale_hover_to_preview *g:ale_hover_to_preview* *b:ale_hover_to_preview* Type: |Number| Default: `0` If set to `1`, hover messages will be displayed in the preview window, instead of in balloons or the message line. g:ale_hover_to_floating_preview *g:ale_hover_to_floating_preview* *b:ale_hover_to_floating_preview* Type: |Number| Default: `0` If set to `1`, Neovim or Vim with |popupwin| will use floating windows for hover messages. g:ale_info_default_mode *g:ale_info_default_mode* *b:ale_info_default_mode* Type: |String| Default: `'preview'` Changes the default mode used for `:ALEInfo`. See documentation for `:ALEInfo` for more information. g:ale_keep_list_window_open *g:ale_keep_list_window_open* *b:ale_keep_list_window_open* Type: |Number| Default: `0` When set to `1`, this option will keep the loclist or quickfix windows event after all warnings/errors have been removed for files. By default the loclist or quickfix windows will be closed automatically when there are no warnings or errors. See |g:ale_open_list| g:ale_list_window_size *g:ale_list_window_size* *b:ale_list_window_size* Type: |Number| Default: `10` This number configures the number of lines to set for the height of windows opened automatically for ALE problems. The default of `10` matches the Vim default height. See |g:ale_open_list| for information on automatically opening windows for quickfix or the loclist. g:ale_lint_delay *g:ale_lint_delay* *b:ale_lint_delay* Type: |Number| Default: `200` This variable controls the milliseconds delay after which the linters will be run after text is changed. This option is only meaningful with the |g:ale_lint_on_text_changed| variable set to `always`, `insert`, or `normal`. A buffer-local option, `b:ale_lint_delay`, can be set to change the delay for different buffers, such as in |ftplugin| files. g:ale_lint_on_enter *g:ale_lint_on_enter* Type: |Number| Default: `1` When this option is set to `1`, the |BufWinEnter| event will be used to apply linters when buffers are first opened. If this is not desired, this variable can be set to `0` in your vimrc file to disable this behavior. The |FileChangedShellPost| and |BufEnter| events will be used to check if files have been changed outside of Vim. If a file is changed outside of Vim, it will be checked when it is next opened. You should set this setting once before ALE is loaded, and restart Vim if you want to change your preferences. See |ale-lint-settings-on-startup|. g:ale_lint_on_filetype_changed *g:ale_lint_on_filetype_changed* Type: |Number| Default: `1` This option will cause ALE to run when the filetype for a file is changed after a buffer has first been loaded. A short delay will be used before linting will be done, so the filetype can be changed quickly several times in a row, but resulting in only one lint cycle. You should set this setting once before ALE is loaded, and restart Vim if you want to change your preferences. See |ale-lint-settings-on-startup|. g:ale_lint_on_save *g:ale_lint_on_save* Type: |Number| Default: `1` This option will make ALE run the linters whenever a file is saved when it it set to `1` in your vimrc file. This option can be used in combination with the |g:ale_lint_on_enter| and |g:ale_lint_on_text_changed| options to make ALE only check files after that have been saved, if that is what is desired. g:ale_lint_on_text_changed *g:ale_lint_on_text_changed* Type: |String| Default: `'normal'` This option controls how ALE will check your files as you make changes. The following values can be used. `'always'`, `'1'`, or `1` - Check buffers on |TextChanged| or |TextChangedI|. `'normal'` - Check buffers only on |TextChanged|. `'insert'` - Check buffers only on |TextChangedI|. `'never'`, `'0'`, or `0` - Never check buffers on changes. ALE will check buffers after a short delay, with a timer which resets on each change. The delay can be configured by adjusting the |g:ale_lint_delay| variable. *ale-linting-interrupts-mapping* Due to a bug in Vim, ALE can interrupt mappings with pending key presses, per |timeoutlen|. If this happens, follow the advice for enabling |g:ale_lint_on_insert_leave| below, and set this option to `'normal'`, or disable it entirely. You should set this setting once before ALE is loaded, and restart Vim if you want to change your preferences. See |ale-lint-settings-on-startup|. g:ale_lint_on_insert_leave *g:ale_lint_on_insert_leave* *b:ale_lint_on_insert_leave* Type: |Number| Default: `1` When set to `1` in your vimrc file, this option will cause ALE to run linters when you leave insert mode. ALE will not lint files when you escape insert mode with |CTRL-C| by default. You can make ALE lint files with this option when you use |CTRL-C| with the following mapping. > " Make using Ctrl+C do the same as Escape, to trigger autocmd commands inoremap < A buffer-local version of this setting `b:ale_lint_on_insert_leave` can be set to `0` to disable linting when leaving insert mode. The setting must be enabled globally to be enabled locally. You should set this setting once before ALE is loaded, and restart Vim if you want to change your preferences. See |ale-lint-settings-on-startup|. g:ale_linter_aliases *g:ale_linter_aliases* *b:ale_linter_aliases* Type: |Dictionary| Default: `{}` The |g:ale_linter_aliases| option can be used to set aliases from one filetype to another. A given filetype can be mapped to use the linters run for another given filetype. This |Dictionary| will be merged with a default dictionary containing the following values: > { \ 'Dockerfile': 'dockerfile', \ 'csh': 'sh', \ 'javascriptreact': ['javascript', 'jsx'], \ 'plaintex': 'tex', \ 'ps1': 'powershell', \ 'rmarkdown': 'r', \ 'rmd': 'r', \ 'systemverilog': 'verilog', \ 'typescriptreact': ['typescript', 'tsx'], \ 'vader': ['vim', 'vader'], \ 'verilog_systemverilog': ['verilog_systemverilog', 'verilog'], \ 'vimwiki': 'markdown', \ 'vue': ['vue', 'javascript'], \ 'xsd': ['xsd', 'xml'], \ 'xslt': ['xslt', 'xml'], \ 'zsh': 'sh', \} < For example, if you wish to map a new filetype `'foobar'` to run the `'php'` linters, you could set the following: > let g:ale_linter_aliases = {'foobar': 'php'} < When combined with the |g:ale_linters| option, the original filetype (`'foobar'`) will be used for determining which linters to run, not the aliased type (`'php'`). This allows an aliased type to run a different set of linters from the type it is being mapped to. Passing a list of filetypes is also supported. Say you want to lint javascript and css embedded in HTML (using linters that support that). You could alias `html` like so: `let g:ale_linter_aliases = {'html': ['html', 'javascript', 'css']}` Note that `html` itself was included as an alias. That is because aliases will override the original linters for the aliased filetype. Linter aliases can be configured in each buffer with buffer-local variables. ALE will first look for aliases for filetypes in the `b:ale_linter_aliases` variable, then `g:ale_linter_aliases`, and then a default Dictionary. `b:ale_linter_aliases` can be set to a |List| or a |String|, to tell ALE to load the linters for specific filetypes for a given buffer. > let b:ale_linter_aliases = ['html', 'javascript', 'css'] " OR, Alias a filetype to only a single filetype with a String. let b:ale_linter_aliases = 'javascript' < No linters will be loaded when the buffer's filetype is empty. g:ale_filename_mappings *g:ale_filename_mappings* *b:ale_filename_mappings* Type: |Dictionary| or |List| Default: `{}` Either a |Dictionary| mapping a linter or fixer name, as displayed in `:ALEInfo`, to a |List| of two-item |List|s for filename mappings, or just a |List| of two-item |List|s. When given some paths to files, the value of this setting will be used to convert filenames on a local file system to filenames on some remote file system, such as paths in a Docker image, virtual machine, or network drive. For example: > let g:ale_filename_mappings = { \ 'pylint': [ \ ['/home/john/proj', '/data'], \ ], \} < With the above configuration, a filename such as `/home/john/proj/foo.py` will be provided to the linter/fixer as `/data/foo.py`, and paths parsed from linter results such as `/data/foo.py` will be converted back to `/home/john/proj/foo.py`. You can use `*` as to apply a |List| of filename mappings to all other linters or fixers not otherwise matched. > " Use one List of paths for pylint. " Use another List of paths for everything else. let g:ale_filename_mappings = { \ 'pylint': [ \ ['/home/john/proj', '/data'], \ ], \ '*': [ \ ['/home/john/proj', '/other-data'], \ ], \} < If you just want every single linter or fixer to use the same filename mapping, you can just use a |List|. > " Same as above, but for ALL linters and fixers. let g:ale_filename_mappings = [ \ ['/home/john/proj', '/data'], \] < You can provide many such filename paths for multiple projects. Paths are matched by checking if the start of a file path matches the given strings, in a case-sensitive manner. Earlier entries in the |List| will be tried before later entries when mapping to a given file system. Buffer-local options can be set to the same values to override the global options, such as in |ftplugin| files. NOTE: Only fixers registered with a short name can support filename mapping by their fixer names. See |ale-fix|. Filename mappings set for all tools by using only a |List| for the setting will also be applied to fixers not in the registry. NOTE: In order for this filename mapping to work correctly, linters and fixers must exclusively determine paths to files to lint or fix via ALE command formatting as per |ale-command-format-strings|, and paths parsed from linter files must be provided in `filename` keys if a linter returns results for more than one file at a time, as per |ale-loclist-format|. If you discover a linter or fixer which does not behave properly, please report it as an issue. If you are running a linter or fixer through Docker or another remote file system, you may have to mount your temporary directory, which you can discover with the following command: > :echo fnamemodify(tempname(), ':h:h') < You should provide a mapping from this temporary directory to whatever you mount this directory to in Docker, or whatever remote file system you are working with. You can inspect the filename mappings ALE will use with the |ale#GetFilenameMappings()| function. g:ale_linters *g:ale_linters* *b:ale_linters* Type: |Dictionary| Default: `{}` The |g:ale_linters| option sets a |Dictionary| mapping a filetype to a |List| of linter programs to be run when checking particular filetypes. This |Dictionary| will be merged with a default dictionary containing the following values: > { \ 'apkbuild': ['apkbuild_lint', 'secfixes_check'], \ 'csh': ['shell'], \ 'elixir': ['credo', 'dialyxir', 'dogma'], \ 'go': ['gofmt', 'golangci-lint', 'gopls', 'govet'], \ 'groovy': ['npm-groovy-lint'], \ 'hack': ['hack'], \ 'help': [], \ 'inko': ['inko'], \ 'json': ['jsonlint', 'spectral'], \ 'json': ['jsonlint', 'spectral', 'vscodejson'], \ 'json5': [], \ 'jsonc': [], \ 'perl': ['perlcritic'], \ 'perl6': [], \ 'python': ['flake8', 'mypy', 'pylint', 'pyright', 'ruff'], \ 'rust': ['analyzer', 'cargo'], \ 'spec': [], \ 'text': [], \ 'vader': ['vimls'], \ 'vue': ['eslint', 'vls'], \ 'zsh': ['shell'], \ 'v': ['v'], \ 'yaml': ['actionlint', 'spectral', 'yaml-language-server', 'yamllint'], \} < This option can be used to enable only a particular set of linters for a file. For example, you can enable only `eslint` for JavaScript files: > let g:ale_linters = {'javascript': ['eslint']} < If you want to disable all linters for a particular filetype, you can pass an empty list of linters as the value: > let g:ale_linters = {'javascript': []} < All linters will be run for unspecified filetypes. All available linters can be enabled explicitly for a given filetype by passing the string `'all'`, instead of a List. > let g:ale_linters = {'c': 'all'} < Linters can be configured in each buffer with buffer-local variables. ALE will first look for linters for filetypes in the `b:ale_linters` variable, then `g:ale_linters`, and then the default Dictionary mentioned above. `b:ale_linters` can be set to a List, or the string `'all'`. When linters for two different filetypes share the same name, the first linter loaded will be used. Any ambiguity can be resolved by using a Dictionary specifying which linter to run for which filetype instead. > " Use ESLint for the buffer if the filetype includes 'javascript'. let b:ale_linters = {'javascript': ['eslint'], 'html': ['tidy']} " Use a List for the same setting. This will work in most cases. let b:ale_linters = ['eslint', 'tidy'] " Disable all linters for the buffer. let b:ale_linters = [] " Explicitly enable all available linters for the filetype. let b:ale_linters = 'all' < ALE can be configured to disable all linters unless otherwise specified with `g:ale_enabled` or `b:ale_enabled` with the option |g:ale_linters_explicit|. g:ale_linters_explicit *g:ale_linters_explicit* Type: |Number| Default: `0` When set to `1`, only the linters from |g:ale_linters| and |b:ale_linters| will be enabled. The default behavior for ALE is to enable as many linters as possible, unless otherwise specified. g:ale_linters_ignore *g:ale_linters_ignore* *b:ale_linters_ignore* Type: |Dictionary| or |List| Default: `{}` Linters to ignore. Commands for ignored linters will not be run, and diagnostics for LSP linters will be ignored. (See |ale-lsp|) This setting can be set to a |Dictionary| mapping filetypes to linter names, just like |g:ale_linters|, to list linters to ignore. Ignore lists will be applied after everything else. > " Select flake8 and pylint, and ignore pylint, so only flake8 is run. let g:ale_linters = {'python': ['flake8', 'pylint']} let g:ale_linters_ignore = {'python': ['pylint']} < This setting can be set to simply a |List| of linter names, which is especially more convenient when using the setting in ftplugin files for particular buffers. > " The same as above, in a ftplugin/python.vim. let b:ale_linters = ['flake8', 'pylint'] let b:ale_linters_ignore = ['pylint'] < g:ale_list_vertical *g:ale_list_vertical* *b:ale_list_vertical* Type: |Number| Default: `0` When set to `1`, this will cause ALE to open any windows (loclist or quickfix) vertically instead of horizontally (|vert| |lopen|) or (|vert| |copen|) g:ale_loclist_msg_format *g:ale_loclist_msg_format* *b:ale_loclist_msg_format* Type: |String| Default: `g:ale_echo_msg_format` This option is the same as |g:ale_echo_msg_format|, but for formatting the message used for the loclist and the quickfix list. The strings for configuring `%severity%` are also used for this option. g:ale_lsp_show_message_format *g:ale_lsp_show_message_format* Type: |String| Default: `'%severity%:%linter%: %s'` This variable defines the format that messages received from an LSP will have when echoed. The following sequences of characters will be replaced. `%s` - replaced with the message text `%linter%` - replaced with the name of the linter `%severity%` - replaced with the severity of the message The strings for `%severity%` levels "error", "info" and "warning" are shared with |g:ale_echo_msg_format|. Severity "log" is unique to |g:ale_lsp_show_message_format| and it can be configured via |g:ale_echo_msg_log_str| - Defaults to `'Log'` Please note that |g:ale_lsp_show_message_format| *can not* be configured separately for each buffer like |g:ale_echo_msg_format| can. g:ale_lsp_show_message_severity *g:ale_lsp_show_message_severity* Type: |String| Default: `'error'` This variable defines the minimum severity level an LSP message needs to be displayed. Messages below this level are discarded; please note that messages with `Log` severity level are always discarded. Possible values follow the LSP spec `MessageType` definition: `'error'` - Displays only errors. `'warning'` - Displays errors and warnings. `'information'` - Displays errors, warnings and infos `'log'` - Same as `'information'` `'disabled'` - Doesn't display any information at all. g:ale_lsp_suggestions *g:ale_lsp_suggestions* Type: |Number| Default: `0` If set to `1`, show hints/suggestions from LSP servers or tsserver, in addition to warnings and errors. g:ale_max_buffer_history_size *g:ale_max_buffer_history_size* Type: |Number| Default: `20` This setting controls the maximum number of commands which will be stored in the command history used for `:ALEInfo`. Command history will be rotated in a FIFO manner. If set to a number <= 0, then the history will be continuously set to an empty |List|. History can be disabled completely with |g:ale_history_enabled|. g:ale_max_signs *g:ale_max_signs* *b:ale_max_signs* Type: |Number| Default: `-1` This setting has no effect when |g:ale_use_neovim_diagnostics_api| is `1`. When set to any positive integer, ALE will not render any more than the given number of signs for any one buffer. When set to `0`, no signs will be set, but sign processing will still be done, so existing signs can be removed. When set to any other value, no limit will be imposed on the number of signs set. For disabling sign processing, see |g:ale_set_signs|. g:ale_maximum_file_size *g:ale_maximum_file_size* *b:ale_maximum_file_size* Type: |Number| Default: not set A maximum file size in bytes for ALE to check. If set to any positive number, ALE will skip checking files larger than the given size. g:ale_open_list *g:ale_open_list* *b:ale_open_list* Type: |Number| or |String| Default: `0` When set to `1`, this will cause ALE to automatically open a window for the loclist (|lopen|) or for the quickfix list instead if |g:ale_set_quickfix| is `1`. (|copen|) When set to any higher numberical value, ALE will only open the window when the number of warnings or errors are at least that many. When set to `'on_save'`, ALE will only open the loclist after buffers have been saved. The list will be opened some time after buffers are saved and any linter for a buffer returns results. The window will be kept open until all warnings or errors are cleared, including those not set by ALE, unless |g:ale_keep_list_window_open| is set to `1`, in which case the window will be kept open when no problems are found. The window size can be configured with |g:ale_list_window_size|. Windows can be opened vertically with |g:ale_list_vertical|. If you want to close the loclist window automatically when the buffer is closed, you can set up the following |autocmd| command: > augroup CloseLoclistWindowGroup autocmd! autocmd QuitPre * if empty(&buftype) | lclose | endif augroup END < g:ale_pattern_options *g:ale_pattern_options* Type: |Dictionary| Default: not set This option maps regular expression patterns to |Dictionary| values for buffer variables. This option can be set to automatically configure different settings for different files. For example: > " Use just ESLint for linting and fixing files which end in '.foo.js' let g:ale_pattern_options = { \ '\.foo\.js$': { \ 'ale_linters': ['eslint'], \ 'ale_fixers': ['eslint'], \ }, \} < See |b:ale_linters| and |b:ale_fixers| for information for those options. Filenames are matched with |match()|, and patterns depend on the |magic| setting, unless prefixed with the special escape sequences like `'\v'`, etc. The patterns can match any part of a filename. The absolute path of the filename will be used for matching, taken from `expand('%:p')`. The options for every match for the filename will be applied, with the pattern keys sorted in alphabetical order. Options for `'zebra'` will override the options for `'alpha'` for a filename `alpha-zebra`. g:ale_pattern_options_enabled *g:ale_pattern_options_enabled* Type: |Number| Default: not set This option can be used for disabling pattern options. If set to `0`, ALE will not set buffer variables per |g:ale_pattern_options|. g:ale_popup_menu_enabled *g:ale_popup_menu_enabled* Type: |Number| Default: `has('gui_running')` When this option is set to `1`, ALE will show code actions and rename capabilities in the right click mouse menu when there's a LSP server or tsserver available. See |ale-refactor|. This feature is only supported in GUI versions of Vim. This setting must be set to `1` before ALE is loaded for this behavior to be enabled. See |ale-lint-settings-on-startup|. g:ale_rename_tsserver_find_in_comments *g:ale_rename_tsserver_find_in_comments* Type: |Number| Default: `0` If enabled, this option will tell tsserver to find and replace text in comments when calling `:ALERename`. It can be enabled by settings the value to `1`. g:ale_rename_tsserver_find_in_strings *g:ale_rename_tsserver_find_in_strings* Type: |Number| Default: `0` If enabled, this option will tell tsserver to find and replace text in strings when calling `:ALERename`. It can be enabled by settings the value to `1`. g:ale_root *g:ale_root* *b:ale_root* Type: |Dictionary| or |String| Default: `{}` This option is used to determine the project root for a linter. If the value is a |Dictionary|, it maps a linter to either a |String| containing the project root or a |Funcref| to call to look up the root. The |Funcref| is provided the buffer number as its argument. The buffer-specific variable may additionally be a string containing the project root itself. If neither variable yields a result, a linter-specific function is invoked to detect a project root. If this, too, yields no result, and the linter is an LSP linter, it will not run. g:ale_save_hidden *g:ale_save_hidden* Type: |Number| Default: `0` When set to `1`, save buffers when 'hidden' is set when applying code actions or rename operations, such as through `:ALERename` or `:ALEOrganizeImports`. g:ale_set_balloons *g:ale_set_balloons* *b:ale_set_balloons* Type: |Number| or |String| Default: `has('balloon_eval') && has('gui_running')` When this option is set to `1`, balloon messages will be displayed for problems or hover information if available. Problems nearest to the line the mouse cursor is over will be displayed. If there are no problems to show, and one of the linters is an LSP linter supporting "Hover" information, per |ale-hover|, then brief information about the symbol under the cursor will be displayed in a balloon. This option can be set to `'hover'` to only enable balloons for hover message, so diagnostics are never shown in balloons. You may wish to configure use this setting only in GUI Vim like so: > let g:ale_set_balloons = has('gui_running') ? 'hover' : 0 < Balloons can be enabled for terminal versions of Vim that support balloons, but some versions of Vim will produce strange mouse behavior when balloons are enabled. To configure balloons for your terminal, you should first configure your |ttymouse| setting, and then consider setting `g:ale_set_balloons` to `1` before ALE is loaded. `b:ale_set_balloons` can be set to `0` to disable balloons for a buffer. Balloons cannot be enabled for a specific buffer when not initially enabled globally. Balloons will not be shown when |g:ale_enabled| or |b:ale_enabled| is `0`. g:ale_set_balloons_legacy_echo *g:ale_set_balloons_legacy_echo* *b:ale_set_balloons_legacy_echo* Type: |Number| Default: not set If set to `1`, moving your mouse over documents in Vim will make ALE ask `tsserver` or `LSP` servers for information about the symbol where the mouse cursor is, and print that information into Vim's echo line. This is an option for supporting older versions of Vim which do not properly support balloons in an asynchronous manner. If your version of Vim supports the |balloon_show| function, then this option does nothing meaningful. g:ale_set_highlights *g:ale_set_highlights* Type: |Number| Default: `has('syntax')` This setting has no effect when |g:ale_use_neovim_diagnostics_api| is `1`. In addition, ALE's highlight groups will not be used when setting highlights through Neovim's diagnostics API. See |diagnostic-highlights| for how to configure Neovim diagnostic highlighting. When this option is set to `1`, highlights will be set for problems. ALE will use the following highlight groups for problems: ALEError items with `'type': 'E'` |hl-ALEError| ALEWarning items with `'type': 'W'` |hl-ALEWarning| ALEInfo items with `'type': 'I'` |hl-ALEInfo| ALEStyleError items with `'type': 'E'` and `'sub_type': 'style'` |hl-ALEStyleError| ALEStyleWarning items with `'type': 'W'` and `'sub_type': 'style'` |hl-ALEStyleWarning| When |g:ale_set_signs| is set to `0`, the following highlights for entire lines will be set. ALEErrorLine all items with `'type': 'E'` |hl-ALEErrorLine| ALEWarningLine all items with `'type': 'W'` |hl-ALEWarningLine| ALEInfoLine all items with `'type': 'I'` |hl-ALEInfoLine| Vim can only highlight the characters up to the last column in a buffer for match highlights, whereas the line highlights when signs are enabled will run to the edge of the screen. Highlights can be excluded with the |g:ale_exclude_highlights| option. g:ale_set_loclist *g:ale_set_loclist* Type: |Number| Default: `1` When this option is set to `1`, the |location-list| will be populated with any warnings and errors which are found by ALE. This feature can be used to implement jumping between errors through typical use of `:lnext` and `:lprev`. g:ale_set_quickfix *g:ale_set_quickfix* Type: |Number| Default: `0` When this option is set to `1`, the |quickfix| list will be populated with any problems which are found by ALE, instead of the |location-list|. The loclist will never be populated when this option is on. Problems from every buffer ALE has checked will be included in the quickfix list, which can be checked with `:copen`. Problems will be de-duplicated. This feature should not be used in combination with tools for searching for matches and commands like `:cfdo`, as ALE will replace the quickfix list pretty frequently. If you wish to use such tools, you should populate the loclist or use `:ALEPopulateQuickfix` instead. g:ale_set_signs *g:ale_set_signs* Type: |Number| Default: `has('signs')` When this option is set to `1`, the |sign| column will be populated with signs marking where problems appear in the file. When |g:ale_use_neovim_diagnostics_api| is `1`, the only other setting that will be respected for signs is |g:ale_sign_priority|. ALE's highlight groups will and other sign settings will not apply when setting signs through Neovim's diagnostics API. See |diagnostic-signs| for how to configure signs in Neovim. ALE will use the following highlight groups for problems: ALEErrorSign items with `'type': 'E'` |hl-ALEErrorSign| ALEWarningSign items with `'type': 'W'` |hl-ALEWarningSign| ALEInfoSign items with `'type': 'I'` |hl-ALEInfoSign| ALEStyleErrorSign items with `'type': 'E'` and `'sub_type': 'style'` |hl-ALEStyleErrorSign| ALEStyleWarningSign items with `'type': 'W'` and `'sub_type': 'style'` |hl-ALEStyleWarningSign| In addition to the style of the signs, the style of lines where signs appear can be configured with the following highlights: ALEErrorLine all items with `'type': 'E'` |hl-ALEErrorLine| ALEWarningLine all items with `'type': 'W'` |hl-ALEWarningLine| ALEInfoLine all items with `'type': 'I'` |hl-ALEInfoLine| With Neovim 0.3.2 or higher, ALE can use the `numhl` option to highlight the 'number' column. It uses the following highlight groups. ALEErrorSignLineNr items with `'type': 'E'` |hl-ALEErrorSignLineNr| ALEWarningSignLineNr items with `'type': 'W'` |hl-ALEWarningSignLineNr| ALEInfoSignLineNr items with `'type': 'I'` |hl-ALEInfoSignLineNr| ALEStyleErrorSignLineNr items with `'type': 'E'` and `'sub_type': 'style'` |hl-ALEStyleErrorSignLineNr| ALEStyleWarningSignLineNr items with `'type': 'W'` and `'sub_type': 'style'` |hl-ALEStyleWarningSignLineNr| To enable line number highlighting |g:ale_sign_highlight_linenrs| must be set to `1` before ALE is loaded. The markers for the highlights can be customized with the following options: |g:ale_sign_error| |g:ale_sign_warning| |g:ale_sign_info| |g:ale_sign_style_error| |g:ale_sign_style_warning| When multiple problems exist on the same line, the signs will take precedence in the order above, from highest to lowest. To limit the number of signs ALE will set, see |g:ale_max_signs|. g:ale_sign_priority *g:ale_sign_priority* Type: |Number| Default: `30` From Neovim 0.4.0 and Vim 8.1, ALE can set sign priority to all signs. The larger this value is, the higher priority ALE signs have over other plugin signs. See |sign-priority| for further details on how priority works. g:ale_shell *g:ale_shell* *b:ale_shell* Type: |String| Default: not set Override the shell used by ALE for executing commands. ALE uses 'shell' by default, but falls back in `/bin/sh` if the default shell looks like `fish` or `pwsh`, which are not compatible with all of the commands run by ALE. The shell specified with this option will be used even if it might not work in all cases. For Windows, ALE uses `cmd` when this option isn't set. Setting this option will apply shell escaping to the command string, even on Windows. NOTE: Consider setting |g:ale_shell_arguments| if this option is defined. g:ale_shell_arguments *g:ale_shell_arguments* *b:ale_shell_arguments* Type: |String| Default: not set This option specifies the arguments to use for executing a command with a custom shell, per |g:ale_shell|. If this option is not set, 'shellcmdflag' will be used instead. g:ale_sign_column_always *g:ale_sign_column_always* Type: |Number| Default: `0` This setting has no effect when |g:ale_use_neovim_diagnostics_api| is `1`. By default, the sign gutter will disappear when all warnings and errors have been fixed for a file. When this option is set to `1`, the sign column will remain open. This can be preferable if you don't want the text in your file to move around as you edit a file. g:ale_sign_error *g:ale_sign_error* Type: |String| Default: `'E'` This setting has no effect when |g:ale_use_neovim_diagnostics_api| is `1`. The sign for errors in the sign gutter. g:ale_sign_info *g:ale_sign_info* Type: |String| Default: `'I'` This setting has no effect when |g:ale_use_neovim_diagnostics_api| is `1`. The sign for "info" markers in the sign gutter. g:ale_sign_style_error *g:ale_sign_style_error* Type: |String| Default: `g:ale_sign_error` This setting has no effect when |g:ale_use_neovim_diagnostics_api| is `1`. The sign for style errors in the sign gutter. g:ale_sign_style_warning *g:ale_sign_style_warning* Type: |String| Default: `g:ale_sign_warning` This setting has no effect when |g:ale_use_neovim_diagnostics_api| is `1`. The sign for style warnings in the sign gutter. g:ale_sign_offset *g:ale_sign_offset* Type: |Number| Default: `1000000` This setting has no effect when |g:ale_use_neovim_diagnostics_api| is `1`. This variable controls offset from which numeric IDs will be generated for new signs. Signs cannot share the same ID values, so when two Vim plugins set signs at the same time, the IDs have to be configured such that they do not conflict with one another. If the IDs used by ALE are found to conflict with some other plugin, this offset value can be changed, and hopefully both plugins will work together. See |sign-place| for more information on how signs are set. g:ale_sign_warning *g:ale_sign_warning* Type: |String| Default: `'W'` This setting has no effect when |g:ale_use_neovim_diagnostics_api| is `1`. The sign for warnings in the sign gutter. g:ale_sign_highlight_linenrs *g:ale_sign_highlight_linenrs* Type: |Number| Default: `0` This setting has no effect when |g:ale_use_neovim_diagnostics_api| is `1`. When set to `1`, this option enables highlighting problems on the 'number' column in Vim versions that support `numhl` highlights. This option must be configured before ALE is loaded. g:ale_update_tagstack *g:ale_update_tagstack* *b:ale_update_tagstack* Type: |Number| Default: `1` This option can be set to disable updating Vim's |tagstack| automatically. g:ale_type_map *g:ale_type_map* *b:ale_type_map* Type: |Dictionary| Default: `{}` This option can be set re-map problem types for linters. Each key in the |Dictionary| should be the name of a linter, and each value must be a |Dictionary| mapping problem types from one type to another. The following types are supported: `'E'` - `{'type': 'E'}` `'ES'` - `{'type': 'E', 'sub_type': 'style'}` `'W'` - `{'type': 'W'}` `'WS'` - `{'type': 'W', 'sub_type': 'style'}` `'I'` - `{'type': 'I'}` For example, if you want to turn flake8 errors into warnings, you can write the following: > let g:ale_type_map = {'flake8': {'ES': 'WS', 'E': 'W'}} < If you wanted to turn style errors and warnings into regular errors and warnings, you can write the following: > let g:ale_type_map = {'flake8': {'ES': 'E', 'WS': 'W'}} < Type maps can be set per-buffer with `b:ale_type_map`. g:ale_use_global_executables *g:ale_use_global_executables* Type: |Number| Default: not set This option can be set to change the default for all `_use_global` options. This option must be set before ALE is loaded, preferably in a vimrc file. See |ale-integrations-local-executables| for more information on those options. g:ale_use_neovim_diagnostics_api *g:ale_use_neovim_diagnostics_api* Type: |Number| Default: `has('nvim-0.7')` If enabled, this option will disable ALE's standard UI, and instead send all linter output to Neovim's diagnostics API. This allows you to collect errors from nvim-lsp, ALE, and anything else that uses diagnostics all in one place. Many options for configuring how problems appear on the screen will not apply when the API is enabled. To enable this option, set the value to `1`. This option requires Neovim 0.7+, as that version introduces the diagnostics API. g:ale_virtualtext_cursor *g:ale_virtualtext_cursor* Type: |Number| Default: `'all'` (if supported, otherwise `'disabled'`) This option controls how ALE will display problems using |virtual-text|. The following values can be used. `'all'`, `'2'`, or `2` - Show problems for all lines. `'current'`, `'1'`, or `1` - Show problems for the current line. `'disabled'`, `'0'`, or `0` - Do not show problems with virtual-text. When |g:ale_use_neovim_diagnostics_api| is `1`, `'current'` will behave the same as `'all'`. Messages are only displayed after a short delay. See |g:ale_virtualtext_delay|. Messages can be prefixed with a string if not using Neovim's diagnostics API. See |g:ale_virtualtext_prefix|. If and only if not displaying problems via Neovim's diagnostics API, highlights for configuring ALE's virtualtext messages can be configured with custom highlight groups: ALEVirtualTextError items with `'type': 'E'` |hl-ALEVirtualTextError| ALEVirtualTextWarning items with `'type': 'W'` |hl-ALEVirtualTextWarning| ALEVirtualTextInfo items with `'type': 'I'` |hl-ALEVirtualTextInfo| ALEVirtualTextStyleError items with `'type': 'E'` and `'sub_type': 'style'` |hl-ALEVirtualTextStyleError| ALEVirtualTextStyleWarning items with `'type': 'W'` and `'sub_type': 'style'` |hl-ALEVirtualTextStyleWarning| g:ale_virtualtext_delay *g:ale_virtualtext_delay* *b:ale_virtualtext_delay* Type: |Number| Default: `10` This setting has no effect when |g:ale_use_neovim_diagnostics_api| is `1`. Given any integer, this option controls the number of milliseconds before ALE will show a message for a problem near the cursor. The value can be increased to decrease the amount of processing ALE will do for files displaying a large number of problems. g:ale_virtualtext_prefix *g:ale_virtualtext_prefix* *b:ale_virtualtext_prefix* Type: |String| Default: `'%comment% %type%: '` This setting has no effect when |g:ale_use_neovim_diagnostics_api| is `1`. Prefix to be used with |g:ale_virtualtext_cursor|. This setting can be changed in each buffer with |b:ale_virtualtext_prefix||. All of the same format markers used for |g:ale_echo_msg_format| can be used for defining the prefix, including some additional sequences of characters. `%comment%` - replaced with comment characters in the current language ALE will read the comment characters from 'commentstring', reading only the part before `%s`, with whitespace trimmed. If comment syntax cannot be pulled from 'commentstring', ALE will default to `'#'`. g:ale_virtualtext_column *g:ale_virtualtext_column* *b:ale_virtualtext_column* g:ale_virtualtext_maxcolumn *g:ale_virtualtext_maxcolumn* *b:ale_virtualtext_maxcolumn* Type: |String| or |Number| Default: `0` This setting has no effect when |g:ale_use_neovim_diagnostics_api| is `1`. Virtualtext column range, from `column` to `maxcolumn`. If a line is `column` or less characters long, the virtualtext message is shifted right to `column`. Where the line is greater than `column` characters long, but less than `maxcolumn`, the virtualtext message is placed at the end of the line. Where the line is greater than `maxcolumn` the virtualtext message is omitted. A |Number| greater than `0` is used as the fixed column position, however a |String| ending in `%` represents a percentage of the window width. When `column` is set to zero, column positioning is disabled, when `maxcolumn` is set to zero, no maximum line length is enforced. g:ale_virtualtext_single *g:ale_virtualtext_single* *b:ale_virtualtext_single* Type: |Number| Default: `1` This setting has no effect when |g:ale_use_neovim_diagnostics_api| is `1`. Enable or disable concatenation of multiple virtual text messages on a single line. By default, if a line has multiple errors or warnings, each will be appended in turn. With `single` set to a non-zero value, only the first problem on a line will be printed with virtual text. The most severe problem on a line will be printed. If two problems exist on a line of equal severity, the problem at the left-most position will be printed. g:ale_virtualenv_dir_names *g:ale_virtualenv_dir_names* *b:ale_virtualenv_dir_names* Type: |List| Default: `['.venv', 'env', 've', 'venv', 'virtualenv', '.env']` A list of directory names to be used when searching upwards from Python files to discover virtualenv directories with. For directory named `'foo'`, ALE will search for `'foo/bin/activate'` (`foo\Scripts\activate\` on Windows) in all directories on and above the directory containing the Python file to find virtualenv paths. g:ale_warn_about_trailing_blank_lines *g:ale_warn_about_trailing_blank_lines* *b:ale_warn_about_trailing_blank_lines* Type: |Number| Default: `1` When this option is set to `1`, warnings about trailing blank lines will be shown. This option behaves similarly to |g:ale_warn_about_trailing_whitespace|. g:ale_warn_about_trailing_whitespace *g:ale_warn_about_trailing_whitespace* *b:ale_warn_about_trailing_whitespace* Type: |Number| Default: `1` When this option is set to `1`, warnings relating to trailing whitespace on lines will be shown. If warnings are too irritating while editing buffers, and you have configured Vim to automatically remove trailing whitespace, you can disable these warnings by setting this option to `0`. Not all linters may respect this option. If a linter does not, please file a bug report, and it may be possible to add such support. This option may be configured on a per buffer basis. g:ale_windows_node_executable_path *g:ale_windows_node_executable_path* *b:ale_windows_node_executable_path* Type: |String| Default: `'node.exe'` This variable is used as the path to the executable to use for executing scripts with Node.js on Windows. For Windows, any file with a `.js` file extension needs to be executed with the node executable explicitly. Otherwise, Windows could try and open the scripts with other applications, like a text editor. Therefore, these scripts are executed with whatever executable is configured with this setting. ------------------------------------------------------------------------------- 6.1. Highlights *ale-highlights* ALEError *hl-ALEError* Default: `highlight link ALEError SpellBad` The highlight for highlighted errors. See |g:ale_set_highlights|. ALEErrorLine *hl-ALEErrorLine* Default: Undefined The highlight for an entire line where errors appear. Only the first line for a problem will be highlighted. See |g:ale_set_signs| and |g:ale_set_highlights|. ALEErrorSign *hl-ALEErrorSign* Default: `highlight link ALEErrorSign error` The highlight for error signs. See |g:ale_set_signs|. ALEErrorSignLineNr *hl-ALEErrorSignLineNr* Default: `highlight link ALEErrorSignLineNr CursorLineNr` The highlight for error signs. See |g:ale_set_signs|. NOTE: This highlight is only available on Neovim 0.3.2 or higher. ALEInfo *hl-ALEInfo* *ALEInfo-highlight* Default: `highlight link ALEInfo ALEWarning` The highlight for highlighted info messages. See |g:ale_set_highlights|. ALEInfoSign *hl-ALEInfoSign* Default: `highlight link ALEInfoSign ALEWarningSign` The highlight for info message signs. See |g:ale_set_signs|. ALEInfoLine *hl-ALEInfoLine* Default: Undefined The highlight for entire lines where info messages appear. Only the first line for a problem will be highlighted. See |g:ale_set_signs| and |g:ale_set_highlights|. ALEInfoSignLineNr *hl-ALEInfoSignLineNr* Default: `highlight link ALEInfoSignLineNr CursorLineNr` The highlight for error signs. See |g:ale_set_signs|. NOTE: This highlight is only available on Neovim 0.3.2 or higher. ALEStyleError *hl-ALEStyleError* Default: `highlight link ALEStyleError ALEError` The highlight for highlighted style errors. See |g:ale_set_highlights|. ALEStyleErrorSign *hl-ALEStyleErrorSign* Default: `highlight link ALEStyleErrorSign ALEErrorSign` The highlight for style error signs. See |g:ale_set_signs|. ALEStyleErrorSignLineNr *hl-ALEStyleErrorSignLineNr* Default: `highlight link ALEStyleErrorSignLineNr CursorLineNr` The highlight for error signs. See |g:ale_set_signs|. NOTE: This highlight is only available on Neovim 0.3.2 or higher. ALEStyleWarning *hl-ALEStyleWarning* Default: `highlight link ALEStyleWarning ALEError` The highlight for highlighted style warnings. See |g:ale_set_highlights|. ALEStyleWarningSign *hl-ALEStyleWarningSign* Default: `highlight link ALEStyleWarningSign ALEWarningSign` The highlight for style warning signs. See |g:ale_set_signs|. ALEStyleWarningSignLineNr *hl-ALEStyleWarningSignLineNr* Default: `highlight link ALEStyleWarningSignLineNr CursorLineNr` The highlight for error signs. See |g:ale_set_signs|. NOTE: This highlight is only available on Neovim 0.3.2 or higher. ALEVirtualTextError *hl-ALEVirtualTextError* Default: `highlight link ALEVirtualTextError Comment` The highlight for virtualtext errors. See |g:ale_virtualtext_cursor|. ALEVirtualTextInfo *hl-ALEVirtualTextInfo* Default: `highlight link ALEVirtualTextInfo ALEVirtualTextWarning` The highlight for virtualtext info. See |g:ale_virtualtext_cursor|. ALEVirtualTextStyleError *hl-ALEVirtualTextStyleError* Default: `highlight link ALEVirtualTextStyleError ALEVirtualTextError` The highlight for virtualtext style errors. See |g:ale_virtualtext_cursor|. ALEVirtualTextStyleWarning *hl-ALEVirtualTextStyleWarning* Default: `highlight link ALEVirtualTextStyleWarning ALEVirtualTextWarning` The highlight for virtualtext style warnings. See |g:ale_virtualtext_cursor|. ALEVirtualTextWarning *hl-ALEVirtualTextWarning* Default: `highlight link ALEVirtualTextWarning Comment` The highlight for virtualtext errors. See |g:ale_virtualtext_cursor|. ALEWarning *hl-ALEWarning* Default: `highlight link ALEWarning SpellCap` The highlight for highlighted warnings. See |g:ale_set_highlights|. ALEWarningLine *hl-ALEWarningLine* Default: Undefined The highlight for entire lines where warnings appear. Only the first line for a problem will be highlighted. See |g:ale_set_signs| and |g:ale_set_highlights|. ALEWarningSign *hl-ALEWarningSign* Default: `highlight link ALEWarningSign todo` The highlight for warning signs. See |g:ale_set_signs|. ALEWarningSignLineNr *hl-ALEWarningSignLineNr* Default: `highlight link ALEWarningSignLineNr CursorLineNr` The highlight for error signs. See |g:ale_set_signs|. NOTE: This highlight is only available on Neovim 0.3.2 or higher. =============================================================================== 7. Linter/Fixer Options *ale-integration-options* Linter and fixer options are documented below and in individual help files. Every option for programs can be set globally, or individually for each buffer. For example, |b:ale_python_flake8_executable| will override any values set for |g:ale_python_flake8_executable|. *ale-integrations-local-executables* Some tools will prefer to search for locally-installed executables, unless configured otherwise. For example, the `eslint` linter will search for various executable paths in `node_modules`. The `flake8` linter will search for virtualenv directories. If you prefer to use global executables for those tools, set the relevant `_use_global` and `_executable` options for those linters. > " Use the global executable with a special name for eslint. let g:ale_javascript_eslint_executable = 'special-eslint' let g:ale_javascript_eslint_use_global = 1 " Use the global executable with a special name for flake8. let g:ale_python_flake8_executable = '/foo/bar/flake8' let g:ale_python_flake8_use_global = 1 < |g:ale_use_global_executables| can be set to `1` in your vimrc file to make ALE use global executables for all linters by default. The option |g:ale_virtualenv_dir_names| controls the local virtualenv paths ALE will use to search for Python executables. ------------------------------------------------------------------------------- 7.1. Options for alex *ale-alex-options* The options for `alex` are shared between all filetypes, so options can be configured once. g:ale_alex_executable *g:ale_alex_executable* *b:ale_alex_executable* Type: |String| Default: `'alex'` See |ale-integrations-local-executables| g:ale_alex_use_global *g:ale_alex_use_global* *b:ale_alex_use_global* Type: |Number| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| ------------------------------------------------------------------------------- 7.2. Options for cspell *ale-cspell-options* The options for `cspell` are shared between all filetypes, so options can be configured only once. g:ale_cspell_executable *g:ale_cspell_executable* *b:ale_cspell_executable* Type: |String| Default: `'cspell'` See |ale-integrations-local-executables| g:ale_cspell_options *g:ale_cspell_options* *b:ale_cspell_options* Type: |String| Default: `''` This variable can be set to pass additional options to `cspell`. g:ale_cspell_use_global *g:ale_cspell_use_global* *b:ale_cspell_use_global* Type: |Number| Default: `get(g: 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| ------------------------------------------------------------------------------- 7.3. Options for dprint *ale-dprint-options* `dprint` is a fixer for many file types, including: (java|type)script, json(c?), markdown, and more. See https://dprint.dev/plugins for an up-to-date list of supported plugins and their configuration options. g:ale_dprint_executable *g:ale_dprint_executable* *b:ale_dprint_executable* Type: |String| Default: `'dprint'` See |ale-integrations-local-executables| g:ale_dprint_config *g:ale_dprint_config* *b:ale_dprint_config* Type: |String| Default: `'dprint.json'` This variable can be changed to provide a config file to `dprint`. The default is the nearest `dprint.json` searching upward from the current buffer. See https://dprint.dev/config and https://plugins.dprint.dev g:ale_dprint_options *g:ale_dprint_options* *b:ale_dprint_options* Type: |String| Default: `''` This variable can be set to pass additional options to `dprint`. g:ale_dprint_use_global *g:ale_dprint_use_global* *b:ale_dprint_use_global* Type: |Number| Default: `get(g: 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| ------------------------------------------------------------------------------- 7.4. Options for languagetool *ale-languagetool-options* g:ale_languagetool_executable *g:ale_languagetool_executable* *b:ale_languagetool_executable* Type: |String| Default: `'languagetool'` The executable to run for languagetool. g:ale_languagetool_options *g:ale_languagetool_options* *b:ale_languagetool_options* Type: |String| Default: `'--autoDetect'` This variable can be set to pass additional options to languagetool. ------------------------------------------------------------------------------- 7.5. Options for write-good *ale-write-good-options* The options for `write-good` are shared between all filetypes, so options can be configured once. g:ale_writegood_executable *g:ale_writegood_executable* *b:ale_writegood_executable* Type: |String| Default: `'writegood'` See |ale-integrations-local-executables| g:ale_writegood_options *g:ale_writegood_options* *b:ale_writegood_options* Type: |String| Default: `''` This variable can be set to pass additional options to writegood. g:ale_writegood_use_global *g:ale_writegood_use_global* *b:ale_writegood_use_global* Type: |Number| Default: `get(g:, 'ale_use_global_executables', 0)` See |ale-integrations-local-executables| ------------------------------------------------------------------------------- 7.6. Other Linter/Fixer Options *ale-other-integration-options* ALE supports a very wide variety of tools. Other linter or fixer options are documented in additional help files. ada.....................................|ale-ada-options| cspell................................|ale-ada-cspell| gcc...................................|ale-ada-gcc| gnatpp................................|ale-ada-gnatpp| ada-language-server...................|ale-ada-language-server| ansible.................................|ale-ansible-options| ansible-language-server...............|ale-ansible-language-server| ansible-lint..........................|ale-ansible-ansible-lint| apkbuild................................|ale-apkbuild-options| apkbuild-fixer........................|ale-apkbuild-apkbuild-fixer| apkbuild-lint.........................|ale-apkbuild-apkbuild-lint| secfixes-check........................|ale-apkbuild-secfixes-check| asciidoc................................|ale-asciidoc-options| cspell................................|ale-asciidoc-cspell| write-good............................|ale-asciidoc-write-good| textlint..............................|ale-asciidoc-textlint| asm.....................................|ale-asm-options| gcc...................................|ale-asm-gcc| llvm_mc...............................|ale-asm-llvm_mc| astro...................................|ale-astro-options| eslint................................|ale-astro-eslint| prettier..............................|ale-astro-prettier| avra....................................|ale-avra-options| avra..................................|ale-avra-avra| awk.....................................|ale-awk-options| gawk..................................|ale-awk-gawk| bats....................................|ale-bats-options| shellcheck............................|ale-bats-shellcheck| bazel...................................|ale-bazel-options| buildifier............................|ale-bazel-buildifier| bib.....................................|ale-bib-options| bibclean..............................|ale-bib-bibclean| bicep...................................|ale-bicep-options| bicep.................................|ale-bicep-bicep| az_bicep..............................|ale-bicep-az_bicep| bitbake.................................|ale-bitbake-options| oelint-adv............................|ale-bitbake-oelint_adv| c.......................................|ale-c-options| astyle................................|ale-c-astyle| cc....................................|ale-c-cc| ccls..................................|ale-c-ccls| clangcheck............................|ale-c-clangcheck| clangd................................|ale-c-clangd| clang-format..........................|ale-c-clangformat| clangtidy.............................|ale-c-clangtidy| cppcheck..............................|ale-c-cppcheck| cquery................................|ale-c-cquery| cspell................................|ale-c-cspell| flawfinder............................|ale-c-flawfinder| uncrustify............................|ale-c-uncrustify| cairo...................................|ale-cairo-options| scarb.................................|ale-cairo-scarb| starknet..............................|ale-cairo-starknet| chef....................................|ale-chef-options| cookstyle.............................|ale-chef-cookstyle| foodcritic............................|ale-chef-foodcritic| clojure.................................|ale-clojure-options| clj-kondo.............................|ale-clojure-clj-kondo| cljfmt................................|ale-clojure-cljfmt| joker.................................|ale-clojure-joker| cloudformation..........................|ale-cloudformation-options| cfn-python-lint.......................|ale-cloudformation-cfn-python-lint| cmake...................................|ale-cmake-options| cmakelint.............................|ale-cmake-cmakelint| cmake-lint............................|ale-cmake-cmake-lint| cmake-format..........................|ale-cmake-cmakeformat| cpp.....................................|ale-cpp-options| astyle................................|ale-cpp-astyle| cc....................................|ale-cpp-cc| ccls..................................|ale-cpp-ccls| clangcheck............................|ale-cpp-clangcheck| clangd................................|ale-cpp-clangd| clang-format..........................|ale-cpp-clangformat| clangtidy.............................|ale-cpp-clangtidy| clazy.................................|ale-cpp-clazy| cppcheck..............................|ale-cpp-cppcheck| cpplint...............................|ale-cpp-cpplint| cquery................................|ale-cpp-cquery| cspell................................|ale-cpp-cspell| flawfinder............................|ale-cpp-flawfinder| uncrustify............................|ale-cpp-uncrustify| c#......................................|ale-cs-options| clang-format..........................|ale-cs-clangformat| csc...................................|ale-cs-csc| cspell................................|ale-cs-cspell| dotnet-format.........................|ale-cs-dotnet-format| mcs...................................|ale-cs-mcs| mcsc..................................|ale-cs-mcsc| uncrustify............................|ale-cs-uncrustify| css.....................................|ale-css-options| cspell................................|ale-css-cspell| css-beautify..........................|ale-css-css-beautify| fecs..................................|ale-css-fecs| prettier..............................|ale-css-prettier| stylelint.............................|ale-css-stylelint| vscodecss.............................|ale-css-vscode| cuda....................................|ale-cuda-options| clang-format..........................|ale-cuda-clangformat| clangd................................|ale-cuda-clangd| nvcc..................................|ale-cuda-nvcc| c3......................................|ale-c3-options| c3lsp.................................|ale-c3-c3lsp| d.......................................|ale-d-options| dfmt..................................|ale-d-dfmt| dls...................................|ale-d-dls| uncrustify............................|ale-d-uncrustify| dafny...................................|ale-dafny-options| dafny.................................|ale-dafny-dafny| dart....................................|ale-dart-options| analysis_server.......................|ale-dart-analysis_server| dart-analyze..........................|ale-dart-analyze| dart-format...........................|ale-dart-format| dartfmt...............................|ale-dart-dartfmt| desktop.................................|ale-desktop-options| desktop-file-validate.................|ale-desktop-desktop-file-validate| dhall...................................|ale-dhall-options| dhall-format..........................|ale-dhall-format| dhall-freeze..........................|ale-dhall-freeze| dhall-lint............................|ale-dhall-lint| dockerfile..............................|ale-dockerfile-options| dockerfile_lint.......................|ale-dockerfile-dockerfile_lint| dockerlinter..........................|ale-dockerfile-dockerlinter| dprint................................|ale-dockerfile-dprint| hadolint..............................|ale-dockerfile-hadolint| elixir..................................|ale-elixir-options| mix...................................|ale-elixir-mix| mix_format............................|ale-elixir-mix-format| dialyxir..............................|ale-elixir-dialyxir| elixir-ls.............................|ale-elixir-elixir-ls| credo.................................|ale-elixir-credo| cspell................................|ale-elixir-cspell| lexical...............................|ale-elixir-lexical| elm.....................................|ale-elm-options| elm-format............................|ale-elm-elm-format| elm-ls................................|ale-elm-elm-ls| elm-make..............................|ale-elm-elm-make| erlang..................................|ale-erlang-options| dialyzer..............................|ale-erlang-dialyzer| elvis.................................|ale-erlang-elvis| erlang-mode...........................|ale-erlang-erlang-mode| erlang_ls.............................|ale-erlang-erlang_ls| erlc..................................|ale-erlang-erlc| erlfmt................................|ale-erlang-erlfmt| syntaxerl.............................|ale-erlang-syntaxerl| eruby...................................|ale-eruby-options| erb-formatter.........................|ale-eruby-erbformatter| erblint...............................|ale-eruby-erblint| htmlbeautifier........................|ale-eruby-htmlbeautifier| ruumba................................|ale-eruby-ruumba| fish....................................|ale-fish-options| fish_indent...........................|ale-fish-fish_indent| fortran.................................|ale-fortran-options| gcc...................................|ale-fortran-gcc| language_server.......................|ale-fortran-language-server| fountain................................|ale-fountain-options| fusionscript............................|ale-fuse-options| fusion-lint...........................|ale-fuse-fusionlint| git commit..............................|ale-gitcommit-options| gitlint...............................|ale-gitcommit-gitlint| gleam...................................|ale-gleam-options| gleam_format..........................|ale-gleam-gleam_format| gleamlsp..............................|ale-gleam-gleamlsp| glsl....................................|ale-glsl-options| glslang...............................|ale-glsl-glslang| glslls................................|ale-glsl-glslls| go......................................|ale-go-options| bingo.................................|ale-go-bingo| cspell................................|ale-go-cspell| gobuild...............................|ale-go-gobuild| gofmt.................................|ale-go-gofmt| gofumpt...............................|ale-go-gofumpt| golangci-lint.........................|ale-go-golangci-lint| golangserver..........................|ale-go-golangserver| golines...............................|ale-go-golines| gopls.................................|ale-go-gopls| govet.................................|ale-go-govet| revive................................|ale-go-revive| staticcheck...........................|ale-go-staticcheck| graphql.................................|ale-graphql-options| eslint................................|ale-graphql-eslint| gqlint................................|ale-graphql-gqlint| prettier..............................|ale-graphql-prettier| groovy..................................|ale-groovy-options| npm-groovy-lint.......................|ale-groovy-npm-groovy-lint| hack....................................|ale-hack-options| hack..................................|ale-hack-hack| hackfmt...............................|ale-hack-hackfmt| hhast.................................|ale-hack-hhast| handlebars..............................|ale-handlebars-options| prettier..............................|ale-handlebars-prettier| ember-template-lint...................|ale-handlebars-embertemplatelint| haskell.................................|ale-haskell-options| brittany..............................|ale-haskell-brittany| cspell................................|ale-haskell-cspell| floskell..............................|ale-haskell-floskell| ghc...................................|ale-haskell-ghc| ghc-mod...............................|ale-haskell-ghc-mod| cabal-ghc.............................|ale-haskell-cabal-ghc| hdevtools.............................|ale-haskell-hdevtools| hfmt..................................|ale-haskell-hfmt| hindent...............................|ale-haskell-hindent| hlint.................................|ale-haskell-hlint| hls...................................|ale-haskell-hls| stack-build...........................|ale-haskell-stack-build| stack-ghc.............................|ale-haskell-stack-ghc| stylish-haskell.......................|ale-haskell-stylish-haskell| hie...................................|ale-haskell-hie| ormolu................................|ale-haskell-ormolu| fourmolu..............................|ale-haskell-fourmolu| hcl.....................................|ale-hcl-options| packer-fmt............................|ale-hcl-packer-fmt| terraform-fmt.........................|ale-hcl-terraform-fmt| help....................................|ale-help-options| cspell................................|ale-help-cspell| html....................................|ale-html-options| angular...............................|ale-html-angular| cspell................................|ale-html-cspell| djlint................................|ale-html-djlint| fecs..................................|ale-html-fecs| html-beautify.........................|ale-html-beautify| htmlhint..............................|ale-html-htmlhint| prettier..............................|ale-html-prettier| rustywind.............................|ale-html-rustywind| stylelint.............................|ale-html-stylelint| tidy..................................|ale-html-tidy| vscodehtml............................|ale-html-vscode| write-good............................|ale-html-write-good| hurl....................................|ale-hurl-options| hurlfmt...............................|ale-hurl-hurlfmt| idris...................................|ale-idris-options| idris.................................|ale-idris-idris| ink.....................................|ale-ink-options| ink-language-server...................|ale-ink-language-server| inko....................................|ale-inko-options| inko..................................|ale-inko-inko| ispc....................................|ale-ispc-options| ispc..................................|ale-ispc-ispc| java....................................|ale-java-options| checkstyle............................|ale-java-checkstyle| clang-format..........................|ale-java-clangformat| cspell................................|ale-java-cspell| javac.................................|ale-java-javac| google-java-format....................|ale-java-google-java-format| pmd...................................|ale-java-pmd| javalsp...............................|ale-java-javalsp| eclipselsp............................|ale-java-eclipselsp| uncrustify............................|ale-java-uncrustify| javascript..............................|ale-javascript-options| biome.................................|ale-javascript-biome| clang-format..........................|ale-javascript-clangformat| cspell................................|ale-javascript-cspell| deno..................................|ale-javascript-deno| dprint................................|ale-javascript-dprint| eslint................................|ale-javascript-eslint| fecs..................................|ale-javascript-fecs| flow..................................|ale-javascript-flow| importjs..............................|ale-javascript-importjs| jscs..................................|ale-javascript-jscs| jshint................................|ale-javascript-jshint| prettier..............................|ale-javascript-prettier| prettier-eslint.......................|ale-javascript-prettier-eslint| prettier-standard.....................|ale-javascript-prettier-standard| standard..............................|ale-javascript-standard| xo....................................|ale-javascript-xo| json....................................|ale-json-options| biome.................................|ale-json-biome| clang-format..........................|ale-json-clangformat| cspell................................|ale-json-cspell| dprint................................|ale-json-dprint| eslint................................|ale-json-eslint| fixjson...............................|ale-json-fixjson| pytool................................|ale-json-pytool| jsonlint..............................|ale-json-jsonlint| jq....................................|ale-json-jq| prettier..............................|ale-json-prettier| spectral..............................|ale-json-spectral| vscodejson............................|ale-json-vscode| jsonc...................................|ale-jsonc-options| biome.................................|ale-jsonc-biome| eslint................................|ale-jsonc-eslint| jsonnet.................................|ale-jsonnet-options| jsonnetfmt............................|ale-jsonnet-jsonnetfmt| jsonnet-lint..........................|ale-jsonnet-jsonnet-lint| json5...................................|ale-json5-options| eslint................................|ale-json5-eslint| julia...................................|ale-julia-options| languageserver........................|ale-julia-languageserver| kotlin..................................|ale-kotlin-options| kotlinc...............................|ale-kotlin-kotlinc| ktlint................................|ale-kotlin-ktlint| languageserver........................|ale-kotlin-languageserver| latex...................................|ale-latex-options| cspell................................|ale-latex-cspell| write-good............................|ale-latex-write-good| textlint..............................|ale-latex-textlint| less....................................|ale-less-options| lessc.................................|ale-less-lessc| prettier..............................|ale-less-prettier| stylelint.............................|ale-less-stylelint| llvm....................................|ale-llvm-options| llc...................................|ale-llvm-llc| lua.....................................|ale-lua-options| cspell................................|ale-lua-cspell| lua-format............................|ale-lua-lua-format| lua-language-server...................|ale-lua-lua-language-server| luac..................................|ale-lua-luac| luacheck..............................|ale-lua-luacheck| luafmt................................|ale-lua-luafmt| selene................................|ale-lua-selene| stylua................................|ale-lua-stylua| make....................................|ale-make-options| checkmake.............................|ale-make-checkmake| markdown................................|ale-markdown-options| cspell................................|ale-markdown-cspell| dprint................................|ale-markdown-dprint| markdownlint..........................|ale-markdown-markdownlint| marksman..............................|ale-markdown-marksman| mdl...................................|ale-markdown-mdl| pandoc................................|ale-markdown-pandoc| prettier..............................|ale-markdown-prettier| pymarkdown............................|ale-markdown-pymarkdown| remark-lint...........................|ale-markdown-remark-lint| textlint..............................|ale-markdown-textlint| write-good............................|ale-markdown-write-good| mercury.................................|ale-mercury-options| mmc...................................|ale-mercury-mmc| nasm....................................|ale-nasm-options| nasm..................................|ale-nasm-nasm| nickel..................................|ale-nickel-options| nickel_format.........................|ale-nickel-nickel-format| nim.....................................|ale-nim-options| nimcheck..............................|ale-nim-nimcheck| nimlsp................................|ale-nim-nimlsp| nimpretty.............................|ale-nim-nimpretty| nix.....................................|ale-nix-options| alejandra.............................|ale-nix-alejandra| nixfmt................................|ale-nix-nixfmt| nixpkgs-fmt...........................|ale-nix-nixpkgs-fmt| statix................................|ale-nix-statix| deadnix...............................|ale-nix-deadnix| nroff...................................|ale-nroff-options| write-good............................|ale-nroff-write-good| objc....................................|ale-objc-options| ccls..................................|ale-objc-ccls| clang.................................|ale-objc-clang| clang-format..........................|ale-objc-clangformat| clangd................................|ale-objc-clangd| uncrustify............................|ale-objc-uncrustify| objcpp..................................|ale-objcpp-options| clang.................................|ale-objcpp-clang| clangd................................|ale-objcpp-clangd| uncrustify............................|ale-objcpp-uncrustify| ocaml...................................|ale-ocaml-options| dune..................................|ale-ocaml-dune| merlin................................|ale-ocaml-merlin| ocamllsp..............................|ale-ocaml-ocamllsp| ols...................................|ale-ocaml-ols| ocamlformat...........................|ale-ocaml-ocamlformat| ocp-indent............................|ale-ocaml-ocp-indent| odin....................................|ale-odin-options| ols...................................|ale-odin-ols| openapi.................................|ale-openapi-options| ibm_validator.........................|ale-openapi-ibm-validator| prettier..............................|ale-openapi-prettier| yamllint..............................|ale-openapi-yamllint| openscad................................|ale-openscad-options| sca2d.................................|ale-openscad-sca2d| scadformat............................|ale-openscad-scadformat| packer..................................|ale-packer-options| packer-fmt-fixer......................|ale-packer-fmt-fixer| pascal..................................|ale-pascal-options| ptop..................................|ale-pascal-ptop| pawn....................................|ale-pawn-options| uncrustify............................|ale-pawn-uncrustify| perl....................................|ale-perl-options| perl..................................|ale-perl-perl| perlcritic............................|ale-perl-perlcritic| perltidy..............................|ale-perl-perltidy| perl6...................................|ale-perl6-options| perl6.................................|ale-perl6-perl6| php.....................................|ale-php-options| cspell................................|ale-php-cspell| langserver............................|ale-php-langserver| phan..................................|ale-php-phan| phpcbf................................|ale-php-phpcbf| phpcs.................................|ale-php-phpcs| phpmd.................................|ale-php-phpmd| phpstan...............................|ale-php-phpstan| psalm.................................|ale-php-psalm| php-cs-fixer..........................|ale-php-php-cs-fixer| php...................................|ale-php-php| pint..................................|ale-php-pint| tlint.................................|ale-php-tlint| intelephense..........................|ale-php-intelephense| po......................................|ale-po-options| write-good............................|ale-po-write-good| pod.....................................|ale-pod-options| write-good............................|ale-pod-write-good| pony....................................|ale-pony-options| ponyc.................................|ale-pony-ponyc| powershell..............................|ale-powershell-options| cspell................................|ale-powershell-cspell| powershell............................|ale-powershell-powershell| psscriptanalyzer......................|ale-powershell-psscriptanalyzer| prolog..................................|ale-prolog-options| swipl.................................|ale-prolog-swipl| proto...................................|ale-proto-options| buf-format............................|ale-proto-buf-format| buf-lint..............................|ale-proto-buf-lint| clang-format..........................|ale-proto-clangformat| protoc-gen-lint.......................|ale-proto-protoc-gen-lint| protolint.............................|ale-proto-protolint| pug.....................................|ale-pug-options| puglint...............................|ale-pug-puglint| puppet..................................|ale-puppet-options| puppet................................|ale-puppet-puppet| puppetlint............................|ale-puppet-puppetlint| puppet-languageserver.................|ale-puppet-languageserver| purescript..............................|ale-purescript-options| purescript-language-server............|ale-purescript-language-server| purs-tidy.............................|ale-purescript-tidy| purty.................................|ale-purescript-purty| pyrex (cython)..........................|ale-pyrex-options| cython................................|ale-pyrex-cython| python..................................|ale-python-options| autoflake.............................|ale-python-autoflake| autoimport............................|ale-python-autoimport| autopep8..............................|ale-python-autopep8| bandit................................|ale-python-bandit| black.................................|ale-python-black| cspell................................|ale-python-cspell| flake8................................|ale-python-flake8| flakehell.............................|ale-python-flakehell| isort.................................|ale-python-isort| mypy..................................|ale-python-mypy| prospector............................|ale-python-prospector| pycln.................................|ale-python-pycln| pycodestyle...........................|ale-python-pycodestyle| pydocstyle............................|ale-python-pydocstyle| pyflakes..............................|ale-python-pyflakes| pyflyby...............................|ale-python-pyflyby| pylama................................|ale-python-pylama| pylint................................|ale-python-pylint| pylsp.................................|ale-python-pylsp| pyre..................................|ale-python-pyre| pyright...............................|ale-python-pyright| refurb................................|ale-python-refurb| reorder-python-imports................|ale-python-reorder_python_imports| ruff..................................|ale-python-ruff| ruff-format...........................|ale-python-ruff-format| unimport..............................|ale-python-unimport| vulture...............................|ale-python-vulture| yapf..................................|ale-python-yapf| qml.....................................|ale-qml-options| qmlfmt................................|ale-qml-qmlfmt| r.......................................|ale-r-options| languageserver........................|ale-r-languageserver| lintr.................................|ale-r-lintr| styler................................|ale-r-styler| racket..................................|ale-racket-options| racket_langserver.....................|ale-racket-langserver| raco_fmt..............................|ale-racket-raco-fmt| reasonml................................|ale-reasonml-options| merlin................................|ale-reasonml-merlin| ols...................................|ale-reasonml-ols| reason-language-server................|ale-reasonml-language-server| refmt.................................|ale-reasonml-refmt| rego....................................|ale-rego-options| cspell................................|ale-rego-cspell| opacheck..............................|ale-rego-opa-check| opafmt................................|ale-rego-opa-fmt-fixer| restructuredtext........................|ale-restructuredtext-options| cspell................................|ale-restructuredtext-cspell| textlint..............................|ale-restructuredtext-textlint| write-good............................|ale-restructuredtext-write-good| robot...................................|ale-robot-options| rflint................................|ale-robot-rflint| ruby....................................|ale-ruby-options| brakeman..............................|ale-ruby-brakeman| cspell................................|ale-ruby-cspell| debride...............................|ale-ruby-debride| packwerk..............................|ale-ruby-packwerk| prettier..............................|ale-ruby-prettier| rails_best_practices..................|ale-ruby-rails_best_practices| reek..................................|ale-ruby-reek| rubocop...............................|ale-ruby-rubocop| ruby..................................|ale-ruby-ruby| rufo..................................|ale-ruby-rufo| solargraph............................|ale-ruby-solargraph| sorbet................................|ale-ruby-sorbet| standardrb............................|ale-ruby-standardrb| syntax_tree...........................|ale-ruby-syntax_tree| rubyfmt...............................|ale-ruby-rubyfmt| rust....................................|ale-rust-options| analyzer..............................|ale-rust-analyzer| cargo.................................|ale-rust-cargo| cspell................................|ale-rust-cspell| rls...................................|ale-rust-rls| rustc.................................|ale-rust-rustc| rustfmt...............................|ale-rust-rustfmt| salt....................................|ale-salt-options| salt-lint.............................|ale-salt-salt-lint| sass....................................|ale-sass-options| sasslint..............................|ale-sass-sasslint| stylelint.............................|ale-sass-stylelint| scala...................................|ale-scala-options| cspell................................|ale-scala-cspell| metals................................|ale-scala-metals| sbtserver.............................|ale-scala-sbtserver| scalafmt..............................|ale-scala-scalafmt| scalastyle............................|ale-scala-scalastyle| scss....................................|ale-scss-options| prettier..............................|ale-scss-prettier| sasslint..............................|ale-scss-sasslint| stylelint.............................|ale-scss-stylelint| sh......................................|ale-sh-options| bashate...............................|ale-sh-bashate| cspell................................|ale-sh-cspell| sh-language-server....................|ale-sh-language-server| shell.................................|ale-sh-shell| shellcheck............................|ale-sh-shellcheck| shfmt.................................|ale-sh-shfmt| sml.....................................|ale-sml-options| smlnj.................................|ale-sml-smlnj| solidity................................|ale-solidity-options| solc..................................|ale-solidity-solc| solhint...............................|ale-solidity-solhint| solium................................|ale-solidity-solium| forge.................................|ale-solidity-forge| spec....................................|ale-spec-options| rpmlint...............................|ale-spec-rpmlint| sql.....................................|ale-sql-options| dprint................................|ale-sql-dprint| pgformatter...........................|ale-sql-pgformatter| sqlfluff..............................|ale-sql-sqlfluff| sqlfmt................................|ale-sql-sqlfmt| sqlformat.............................|ale-sql-sqlformat| stylus..................................|ale-stylus-options| stylelint.............................|ale-stylus-stylelint| sugarss.................................|ale-sugarss-options| stylelint.............................|ale-sugarss-stylelint| svelte..................................|ale-svelte-options| prettier..............................|ale-svelte-prettier| svelteserver..........................|ale-svelte-svelteserver| swift...................................|ale-swift-options| apple-swift-format....................|ale-swift-apple-swift-format| cspell................................|ale-swift-cspell| sourcekitlsp..........................|ale-swift-sourcekitlsp| systemd.................................|ale-systemd-options| systemd-analyze.......................|ale-systemd-analyze| tcl.....................................|ale-tcl-options| nagelfar..............................|ale-tcl-nagelfar| terraform...............................|ale-terraform-options| checkov...............................|ale-terraform-checkov| terraform-fmt-fixer...................|ale-terraform-fmt-fixer| terraform.............................|ale-terraform-terraform| terraform-ls..........................|ale-terraform-terraform-ls| terraform-lsp.........................|ale-terraform-terraform-lsp| tflint................................|ale-terraform-tflint| tfsec.................................|ale-terraform-tfsec| tex.....................................|ale-tex-options| chktex................................|ale-tex-chktex| cspell................................|ale-tex-cspell| lacheck...............................|ale-tex-lacheck| latexindent...........................|ale-tex-latexindent| texlab................................|ale-tex-texlab| texinfo.................................|ale-texinfo-options| cspell................................|ale-texinfo-cspell| write-good............................|ale-texinfo-write-good| text....................................|ale-text-options| cspell................................|ale-text-cspell| textlint..............................|ale-text-textlint| write-good............................|ale-text-write-good| thrift..................................|ale-thrift-options| thrift................................|ale-thrift-thrift| thriftcheck...........................|ale-thrift-thriftcheck| toml....................................|ale-toml-options| dprint................................|ale-toml-dprint| typescript..............................|ale-typescript-options| biome.................................|ale-typescript-biome| cspell................................|ale-typescript-cspell| deno..................................|ale-typescript-deno| dprint................................|ale-typescript-dprint| eslint................................|ale-typescript-eslint| prettier..............................|ale-typescript-prettier| standard..............................|ale-typescript-standard| tslint................................|ale-typescript-tslint| tsserver..............................|ale-typescript-tsserver| xo....................................|ale-typescript-xo| v.......................................|ale-v-options| v.....................................|ale-v-v| vfmt..................................|ale-v-vfmt| vala....................................|ale-vala-options| uncrustify............................|ale-vala-uncrustify| verilog/systemverilog...................|ale-verilog-options| hdl-checker...........................|ale-verilog-hdl-checker| iverilog..............................|ale-verilog-iverilog| slang.................................|ale-verilog-slang| verilator.............................|ale-verilog-verilator| vlog..................................|ale-verilog-vlog| xvlog.................................|ale-verilog-xvlog| yosys.................................|ale-verilog-yosys| vhdl....................................|ale-vhdl-options| ghdl..................................|ale-vhdl-ghdl| hdl-checker...........................|ale-vhdl-hdl-checker| vcom..................................|ale-vhdl-vcom| xvhdl.................................|ale-vhdl-xvhdl| vim help................................|ale-vim-help-options| write-good............................|ale-vim-help-write-good| vim.....................................|ale-vim-options| vimls.................................|ale-vim-vimls| vint..................................|ale-vim-vint| vue.....................................|ale-vue-options| cspell................................|ale-vue-cspell| prettier..............................|ale-vue-prettier| vls...................................|ale-vue-vls| volar.................................|ale-vue-volar| wgsl....................................|ale-wgsl-options| naga..................................|ale-wgsl-naga| xhtml...................................|ale-xhtml-options| cspell................................|ale-xhtml-cspell| write-good............................|ale-xhtml-write-good| xml.....................................|ale-xml-options| xmllint...............................|ale-xml-xmllint| yaml....................................|ale-yaml-options| actionlint............................|ale-yaml-actionlint| circleci..............................|ale-yaml-circleci| prettier..............................|ale-yaml-prettier| spectral..............................|ale-yaml-spectral| swaglint..............................|ale-yaml-swaglint| yaml-language-server..................|ale-yaml-language-server| yamlfix...............................|ale-yaml-yamlfix| yamlfmt...............................|ale-yaml-yamlfmt| yamllint..............................|ale-yaml-yamllint| gitlablint............................|ale-yaml-gitlablint| yq....................................|ale-yaml-yq| yang....................................|ale-yang-options| yang-lsp..............................|ale-yang-lsp| yara....................................|ale-yara-options| yls...................................|ale-yara-yls| zeek....................................|ale-zeek-options| zeek..................................|ale-zeek-zeek| zig.....................................|ale-zig-options| zigfmt................................|ale-zig-zigfmt| zls...................................|ale-zig-zls| =============================================================================== 8. Commands/Keybinds *ale-commands* :ALEComplete *:ALEComplete* Manually trigger LSP autocomplete and show the menu. Works only when called from insert mode. > inoremap :ALEComplete < A plug mapping `(ale_complete)` is defined for this command. > imap (ale_complete) < :ALEDocumentation *:ALEDocumentation* Similar to the `:ALEHover` command, retrieve documentation information for the symbol at the cursor. Documentation data will always be shown in a preview window, no matter how small the documentation content is. NOTE: This command is only available for `tsserver`. A plug mapping `(ale_documentation)` is defined for this command. :ALEFindReferences *:ALEFindReferences* Find references in the codebase for the symbol under the cursor using the enabled LSP linters for the buffer. ALE will display a preview window containing the results if some references are found. The window can be navigated using the usual Vim navigation commands. The Enter key () can be used to jump to a referencing location, or the `t` key can be used to jump to the location in a new tab. The locations opened in different ways using the following variations. `:ALEFindReferences -tab` - Open the location in a new tab. `:ALEFindReferences -split` - Open the location in a horizontal split. `:ALEFindReferences -vsplit` - Open the location in a vertical split. `:ALEFindReferences -quickfix` - Put the locations into quickfix list. The default method used for navigating to a new location can be changed by modifying |g:ale_default_navigation|. You can add `-relative` to the command to view results with relatives paths, instead of absolute paths. This option has no effect if `-quickfix` is used. The selection can be opened again with the `:ALERepeatSelection` command. You can jump back to the position you were at before going to a reference of something with jump motions like CTRL-O. See |jump-motions|. A plug mapping `(ale_find_references)` is defined for this command. You can define additional plug mapping with any additional options you want like so: > nnoremap (my_mapping) :ALEFindReferences -relative < :ALEFix [linter] *:ALEFix* Fix problems with the current buffer. See |ale-fix| for more information. If the command is run with a bang (`:ALEFix!`), all warnings will be suppressed, including warnings about no fixers being defined, and warnings about not being able to apply fixes to a file because it has been changed. A plug mapping `(ale_fix)` is defined for this command. :ALEFixSuggest *:ALEFixSuggest* Suggest tools that can be used to fix problems in the current buffer. See |ale-fix| for more information. :ALEGoToDefinition [options] *:ALEGoToDefinition* Jump to the definition of a symbol under the cursor using the enabled LSP linters for the buffer. ALE will jump to a definition if an LSP server provides a location to jump to. Otherwise, ALE will do nothing. The locations opened in different ways using the following variations. `:ALEGoToDefinition -tab` - Open the location in a new tab. `:ALEGoToDefinition -split` - Open the location in a horizontal split. `:ALEGoToDefinition -vsplit` - Open the location in a vertical split. The default method used for navigating to a new location can be changed by modifying |g:ale_default_navigation|. You can jump back to the position you were at before going to the definition of something with jump motions like CTRL-O. See |jump-motions|. You should consider using the 'hidden' option in combination with this command. Otherwise, Vim will refuse to leave the buffer you're jumping from unless you have saved your edits. The following Plug mappings are defined for this command, which correspond to the following commands. `(ale_go_to_definition)` - `:ALEGoToDefinition` `(ale_go_to_definition_in_tab)` - `:ALEGoToDefinition -tab` `(ale_go_to_definition_in_split)` - `:ALEGoToDefinition -split` `(ale_go_to_definition_in_vsplit)` - `:ALEGoToDefinition -vsplit` :ALEGoToTypeDefinition [options] *:ALEGoToTypeDefinition* This works similar to `:ALEGoToDefinition` but instead jumps to the definition of a type of a symbol under the cursor. ALE will jump to a definition if an LSP server provides a location to jump to. Otherwise, ALE will do nothing. The locations opened in different ways using the following variations. `:ALEGoToTypeDefinition -tab` - Open the location in a new tab. `:ALEGoToTypeDefinition -split` - Open the location in a horizontal split. `:ALEGoToTypeDefinition -vsplit` - Open the location in a vertical split. The default method used for navigating to a new location can be changed by modifying |g:ale_default_navigation|. You can jump back to the position you were at before going to the definition of something with jump motions like CTRL-O. See |jump-motions|. The following Plug mappings are defined for this command, which correspond to the following commands. `(ale_go_to_type_definition)` - `:ALEGoToTypeDefinition` `(ale_go_to_type_definition_in_tab)` - `:ALEGoToTypeDefinition -tab` `(ale_go_to_type_definition_in_split)` - `:ALEGoToTypeDefinition -split` `(ale_go_to_type_definition_in_vsplit)` - `:ALEGoToTypeDefinition -vsplit` :ALEGoToImplementation [options] *:ALEGoToImplementation* This works similar to `:ALEGoToDefinition` but instead jumps to the implementation of symbol under the cursor. ALE will jump to a definition if an LSP server provides a location to jump to. Otherwise, ALE will do nothing. The locations opened in different ways using the following variations. `:ALEGoToImplementation -tab` - Open the location in a new tab. `:ALEGoToImplementation -split` - Open the location in a horizontal split. `:ALEGoToImplementation -vsplit` - Open the location in a vertical split. The default method used for navigating to a new location can be changed by modifying |g:ale_default_navigation|. You can jump back to the position you were at before going to the definition of something with jump motions like CTRL-O. See |jump-motions|. The following Plug mappings are defined for this command, which correspond to the following commands. `(ale_go_to_implementation)` - `:ALEGoToImplementation` `(ale_go_to_implementation_in_tab)` - `:ALEGoToImplementation -tab` `(ale_go_to_implementation_in_split)` - `:ALEGoToImplementation -split` `(ale_go_to_implementation_in_vsplit)` - `:ALEGoToImplementation -vsplit` :ALEHover *:ALEHover* Print brief information about the symbol under the cursor, taken from any available LSP linters. There may be a small non-blocking delay before information is printed. NOTE: In Vim 8, long messages will be shown in a preview window, as Vim 8 does not support showing a prompt to press enter to continue for long messages from asynchronous callbacks. A plug mapping `(ale_hover)` is defined for this command. :ALEImport *:ALEImport* Try to import a symbol using `tsserver` or a Language Server. ALE will look for completions for the word at the cursor which contain additional text edits that possible insert lines to import the symbol. The first match with additional text edits will be used, and may add other code to the current buffer other than import lines. If linting is enabled, and |g:ale_lint_on_text_changed| is set to ever check buffers when text is changed, the buffer will be checked again after changes are made. A Plug mapping `(ale_import)` is defined for this command. This mapping should only be bound for normal mode. :ALEOrganizeImports *:ALEOrganizeImports* Organize imports using tsserver. Currently not implemented for LSPs. :ALERename *:ALERename* Rename a symbol using `tsserver` or a Language Server. The symbol where the cursor is resting will be the symbol renamed, and a prompt will open to request a new name. The rename operation will not save modified buffers when 'hidden' is on unless |g:ale_save_hidden| is 1. :ALEFileRename *:ALEFileRename* Rename a file and fix imports using `tsserver`. :ALECodeAction *:ALECodeAction* Apply a code action via LSP servers or `tsserver`. If there is an error present on a line that can be fixed, ALE will automatically fix a line, unless there are multiple possible code fixes to apply. This command can be run in visual mode apply actions, such as applicable refactors. A menu will be shown to select code action to apply. :ALERepeatSelection *:ALERepeatSelection* Repeat the last selection displayed in the preview window. :ALESymbolSearch [query] *:ALESymbolSearch* Search for symbols in the workspace, taken from any available LSP linters. The arguments provided to this command will be used as a search query for finding symbols in the workspace, such as functions, types, etc. You can add `-relative` to the command to view results with relatives paths, instead of absolute paths. :ALELint *:ALELint* Run ALE once for the current buffer. This command can be used to run ALE manually, instead of automatically, if desired. This command will also run linters where `lint_file` is evaluates to `1`, meaning linters which check the file instead of the Vim buffer. A plug mapping `(ale_lint)` is defined for this command. :ALELintStop *:ALELintStop* Stop any currently running jobs for checking the current buffer. Any problems from previous linter results will continue to be shown. :ALEPopulateQuickfix *:ALEPopulateQuickfix* :ALEPopulateLocList *:ALEPopulateLocList* Manually populate the |quickfix| or |location-list| and show the corresponding list. Useful when you have other uses for both the |quickfix| and |location-list| and don't want them automatically populated. Be sure to disable auto populating: > let g:ale_set_quickfix = 0 let g:ale_set_loclist = 0 < With these settings, ALE will still run checking and display it with signs, highlighting, and other output described in |ale-lint-file-linters|. :ALEPrevious *:ALEPrevious* :ALEPreviousWrap *:ALEPreviousWrap* :ALENext *:ALENext* :ALENextWrap *:ALENextWrap* :ALEFirst *:ALEFirst* :ALELast *:ALELast* *ale-navigation-commands* Move between warnings or errors in a buffer. ALE will only navigate between the errors or warnings it generated, even if both |g:ale_set_quickfix| and |g:ale_set_loclist| are set to `0`. `:ALEPrevious` and `:ALENext` will stop at the top and bottom of a file, while `:ALEPreviousWrap` and `:ALENextWrap` will wrap around the file to find the last or first warning or error in the file, respectively. `:ALEPrevious` and `:ALENext` take optional flags arguments to custom their behavior : `-wrap` enable wrapping around the file `-error`, `-warning` and `-info` enable jumping to errors, warnings or infos respectively, ignoring anything else. They are mutually exclusive and if several are provided the priority is the following: error > warning > info. `-style` and `-nostyle` allow you to jump respectively to style error or warning and to not style error or warning. They also are mutually exclusive and nostyle has priority over style. Flags can be combined to create create custom jumping. Thus you can use ":ALENext -wrap -error -nosyle" to jump to the next error which is not a style error while going back to the beginning of the file if needed. `:ALEFirst` goes to the first error or warning in the buffer, while `:ALELast` goes to the last one. The following || mappings are defined for the commands: > (ale_previous) - ALEPrevious (ale_previous_wrap) - ALEPreviousWrap (ale_previous_error) - ALEPrevious -error (ale_previous_wrap_error) - ALEPrevious -wrap -error (ale_previous_warning) - ALEPrevious -warning (ale_previous_wrap_warning) - ALEPrevious -wrap -warning (ale_next) - ALENext (ale_next_wrap) - ALENextWrap (ale_next_error) - ALENext -error (ale_next_wrap_error) - ALENext -wrap -error (ale_next_warning) - ALENext -warning (ale_next_wrap_warning) - ALENext -wrap -warning (ale_first) - ALEFirst (ale_last) - ALELast < For example, these commands could be bound to the keys CTRL-j and CTRL-k: > " Map movement through errors without wrapping. nmap (ale_previous) nmap (ale_next) " OR map keys to use wrapping. nmap (ale_previous_wrap) nmap (ale_next_wrap) < :ALEToggle *:ALEToggle* :ALEEnable *:ALEEnable* :ALEDisable *:ALEDisable* :ALEToggleBuffer *:ALEToggleBuffer* :ALEEnableBuffer *:ALEEnableBuffer* :ALEDisableBuffer *:ALEDisableBuffer* `:ALEToggle`, `:ALEEnable`, and `:ALEDisable` enable or disable ALE linting, including all of its autocmd events, loclist items, quickfix items, signs, current jobs, etc., globally. Executing any of these commands will change the |g:ale_enabled| variable. ALE can be disabled or enabled for only a single buffer with `:ALEToggleBuffer`, `:ALEEnableBuffer`, and `:ALEDisableBuffer`. Disabling ALE for a buffer will not remove autocmd events, but will prevent ALE from checking for problems and reporting problems for whatever buffer the `:ALEDisableBuffer` or `:ALEToggleBuffer` command is executed from. These commands can be used for temporarily disabling ALE for a buffer. These commands will modify the |b:ale_enabled| variable. ALE linting cannot be enabled for a single buffer when it is disabled globally, as disabling ALE globally removes the autocmd events needed to perform linting with. The following plug mappings are defined, for conveniently defining keybinds: `:ALEToggle` - `(ale_toggle)` `:ALEEnable` - `(ale_enable)` `:ALEDisable` - `(ale_disable)` `:ALEToggleBuffer` - `(ale_toggle_buffer)` `:ALEEnableBuffer` - `(ale_enable_buffer)` `:ALEDisableBuffer` - `(ale_disable_buffer)` For removing problems reported by ALE, but leaving ALE enabled, see `:ALEReset` and `:ALEResetBuffer`. :ALEDetail *:ALEDetail* Show the full linter message for the problem nearest to the cursor on the given line in the preview window. The preview window can be easily closed with the `q` key. If there is no message to show, the window will not be opened. If a loclist item has a `detail` key set, the message for that key will be preferred over `text`. See |ale-loclist-format|. A plug mapping `(ale_detail)` is defined for this command. :ALEInfo *:ALEInfo* *:ALEInfoToFile* Print runtime information about ALE, including the values of global and buffer-local settings for ALE, the linters that are enabled, the commands that have been run, and the output of commands. ALE will log the commands that are run by default. If you wish to disable this, set |g:ale_history_enabled| to `0`. Because it could be expensive, ALE does not remember the output of recent commands by default. Set |g:ale_history_log_output| to `1` to enable logging of output for commands. ALE will only log the output captured for parsing problems, etc. You can pass options to the command to control how ALE displays the information, such as `:ALEInfo -echo`, etc. > -preview Show the info in a preview window. -clip OR -clipboard Copy the information to your clipboard. -echo echo all of the information with :echo < The default mode can be configured with |g:ale_info_default_mode|. When shown in a preview window, syntax highlights can be defined for the `ale-info` filetype. `:ALEInfoToFile` will write the ALE runtime information to a given filename. The filename works just like `:write`. :ALEReset *:ALEReset* :ALEResetBuffer *:ALEResetBuffer* `:ALEReset` will remove all problems reported by ALE for all buffers. `:ALEResetBuffer` will remove all problems reported for a single buffer. Either command will leave ALE linting enabled, so ALE will report problems when linting is performed again. See |ale-lint| for more information. The following plug mappings are defined, for conveniently defining keybinds: `:ALEReset` - `(ale_reset)` `:ALEResetBuffer` - `(ale_reset_buffer)` ALE can be disabled globally or for a buffer with `:ALEDisable` or `:ALEDisableBuffer`. :ALEStopAllLSPs *:ALEStopAllLSPs* `:ALEStopAllLSPs` will close and stop all channels and jobs for all LSP-like clients, including tsserver, remove all of the data stored for them, and delete all of the problems found for them, updating every linted buffer. This command can be used when LSP clients mess up and need to be restarted. :ALEStopLSP [linter] *:ALEStopLSP* `:ALEStopLSP` will stop a specific language server with a given linter name. Completion is supported for currently running language servers. All language servers with the given name will be stopped across all buffers for all projects. If the command is run with a bang (`:ALEStopLSP!`), all warnings will be suppressed. =============================================================================== 9. API *ale-api* ALE offers a number of functions for running linters or fixers, or defining them. The following functions are part of the publicly documented part of that API, and should be expected to continue to work. ale#Env(variable_name, value) *ale#Env()* Given a variable name and a string value, produce a string for including in a command for setting environment variables. This function can be used for building a command like so. > :echo string(ale#Env('VAR', 'some value') . 'command') 'VAR=''some value'' command' # On Linux or Mac OSX 'set VAR="some value" && command' # On Windows ale#GetFilenameMappings(buffer, name) *ale#GetFilenameMappings()* Given a `buffer` and the `name` of either a linter for fixer, return a |List| of two-item |List|s that describe mapping to and from the local and foreign file systems for running a particular linter or fixer. See |g:ale_filename_mappings| for details on filename mapping. ale#Has(feature) *ale#Has()* Return `1` if ALE supports a given feature, like |has()| for Vim features. ALE versions can be checked with version strings in the format `ale#Has('ale-x.y.z')`, such as `ale#Has('ale-2.4.0')`. ale#Pad(string) *ale#Pad()* Given a string or any |empty()| value, return either the string prefixed with a single space, or an empty string. This function can be used to build parts of a command from variables. ale#Queue(delay, [linting_flag, buffer_number]) *ale#Queue()* Run linters for the current buffer, based on the filetype of the buffer, with a given `delay`. A `delay` of `0` will run the linters immediately. The linters will always be run in the background. Calling this function again from the same buffer An optional `linting_flag` argument can be given. If `linting_flag` is `'lint_file'`, then linters where the `lint_file` option evaluates to `1` will be run. Otherwise, those linters will not be run. An optional `buffer_number` argument can be given for specifying the buffer to check. The active buffer (`bufnr('')`) will be checked by default. *ale-cool-down* If an exception is thrown when queuing/running ALE linters, ALE will enter a cool down period where it will stop checking anything for a short period of time. This is to prevent ALE from seriously annoying users if a linter is broken, or when developing ALE itself. ale#command#CreateDirectory(buffer) *ale#command#CreateDirectory()* Create a new temporary directory with a unique name, and manage that directory with |ale#command#ManageDirectory()|, so it will be removed as soon as possible. It is advised to only call this function from a callback function for returning a linter command to run. ale#command#CreateFile(buffer) *ale#command#CreateFile()* Create a new temporary file with a unique name, and manage that file with |ale#command#ManageFile()|, so it will be removed as soon as possible. It is advised to only call this function from a callback function for returning a linter command to run. ale#command#Run(buffer, command, callback, [options]) *ale#command#Run()* Start running a job in the background, and pass the results to the given callback later. This function can be used for computing the results of ALE linter or fixer functions asynchronously with jobs. `buffer` must match the buffer being linted or fixed, `command` must be a |String| for a shell command to execute, `callback` must be defined as a |Funcref| to call later with the results, and an optional |Dictionary| of `options` can be provided. The `callback` will receive the arguments `(buffer, output, metadata)`, where the `buffer` will match the buffer given to the function, the `output` will be a `List` of lines of output from the job that was run, and the `metadata` will be a |Dictionary| with additional information about the job that was run, including: `exit_code` - A |Number| with the exit code for the program that was run. The result of this function is either a special |Dictionary| ALE will use for waiting for the command to finish, or `0` if the job is not started. The The return value of the `callback` will be used as the eventual result for whatever value is being given to ALE. For example: > function! s:GetCommand(buffer, output, meta) abort " Do something with a:output here, from the foo command. " This is used as the command to run for linting. return 'final command' endfunction " ... 'command': {b -> ale#command#Run(b, 'foo', function('s:GetCommand'))} < The result of a callback can also be the result of another call to this function, so that several commands can be arbitrarily chained together. For example: > function! s:GetAnotherCommand(buffer, output, meta) abort " We can finally return this command. return 'last command' endfunction function! s:GetCommand(buffer, output, meta) abort " We can return another deferred result. return ale#command#Run( \ a:buffer, \ 'second command', \ function('s:GetAnotherCommand') \) endfunction " ... 'command': {b -> ale#command#Run(b, 'foo', function('s:GetCommand'))} < The following `options` can be provided. `cwd` - An optional |String| for setting the working directory for the command, just as per |ale#linter#Define|. If not set, or `v:null`, the `cwd` of the last command that spawned this one will be used. `output_stream` - Either `'stdout'`, `'stderr'`, `'both'`, or `'none`' for selecting which output streams to read lines from. The default is `'stdout'` `executable` - An executable for formatting into `%e` in the command. If this option is not provided, formatting commands with `%e` will not work. `read_buffer` - If set to `1`, the buffer will be piped into the command. The default is `0`. `input` - When creating temporary files with `%t` or piping text into a command `input` can be set to a |List| of text to use instead of the buffer's text. `filename_mappings` - A |List| of two-item |List|s describing filename mappings to apply for formatted filenames in the command string, as per |g:ale_filename_mappings|. If the call to this function is being used for a linter or fixer, the mappings should be provided with this option, and can be retrieved easily with |ale#GetFilenameMappings()|. The default is `[]`. ale#command#EscapeCommandPart(command_part) *ale#command#EscapeCommandPart()* Given a |String|, return a |String| with all `%` characters replaced with `%%` instead. This function can be used to escape strings which are dynamically generated for commands before handing them over to ALE, so that ALE doesn't treat any strings with `%` formatting sequences specially. ale#command#ManageDirectory(buffer, directory) *ale#command#ManageDirectory()* Like |ale#command#ManageFile()|, but directories and all of their contents will be deleted, akin to `rm -rf directory`, which could lead to loss of data if mistakes are made. This command will also delete any temporary filenames given to it. It is advised to use |ale#command#ManageFile()| instead for deleting single files. ale#command#ManageFile(buffer, filename) *ale#command#ManageFile()* Given a buffer number for a buffer currently running some linting or fixing tasks and a filename, register a filename with ALE for automatic deletion after linting or fixing is complete, or when Vim exits. If Vim exits suddenly, ALE will try its best to remove temporary files, but ALE cannot guarantee with absolute certainty that the files will be removed. It is advised to create temporary files in the operating system's managed temporary file directory, such as with |tempname()|. Directory names should not be given to this function. ALE will only delete files and symlinks given to this function. This is to prevent entire directories from being accidentally deleted, say in cases of writing `dir . '/' . filename` where `filename` is actually `''`, etc. ALE instead manages directories separately with the |ale#command#ManageDirectory| function. ale#completion#OmniFunc(findstart, base) *ale#completion#OmniFunc()* A completion function to use with 'omnifunc'. See |ale-completion|. ale#engine#GetLoclist(buffer) *ale#engine#GetLoclist()* Given a buffer number, this function will return the list of problems reported by ALE for a given buffer in the format accepted by |setqflist()|. A reference to the buffer's list of problems will be returned. The list must be copied before applying |map()| or |filter()|. ale#engine#IsCheckingBuffer(buffer) *ale#engine#IsCheckingBuffer()* Given a buffer number, returns `1` when ALE is busy checking that buffer. This function can be used for status lines, tab names, etc. ale#fix#registry#Add(name, func, filetypes, desc, [aliases]) *ale#fix#registry#Add()* Given a |String| `name` for a name to add to the registry, a |String| `func` for a function name, a |List| `filetypes` for a list of filetypes to set for suggestions, and a |String| `desc` for a short description of the fixer, register a fixer in the registry. The `name` can then be used for |g:ale_fixers| in place of the function name, and suggested for fixing files. An optional |List| of |String|s for aliases can be passed as the `aliases` argument. These aliases can also be used for looking up a fixer function. ALE will search for fixers in the registry first by `name`, then by their `aliases`. For example to register a custom fixer for `luafmt`: > function! FormatLua(buffer) abort return { \ 'command': 'luafmt --stdin' \} endfunction execute ale#fix#registry#Add('luafmt', 'FormatLua', ['lua'], 'luafmt for lua') " You can now use it in g:ale_fixers let g:ale_fixers = { \ 'lua': ['luafmt'] } < ale#linter#Define(filetype, linter) *ale#linter#Define()* Given a |String| for a filetype and a |Dictionary| Describing a linter configuration, add a linter for the given filetype. The dictionaries each offer the following options: `name` The name of the linter. These names will be used by |g:ale_linters| option for enabling/disabling particular linters. This argument is required. `callback` A |String| or |Funcref| for a callback function accepting two arguments (buffer, lines), for a buffer number the output is for, and the lines of output from a linter. This callback function should return a |List| of |Dictionary| objects in the format accepted by |setqflist()|. The |List| will be sorted by line and then column order so it can be searched with a binary search by in future before being passed on to the |location-list|, etc. This argument is required, unless the linter is an LSP linter. In which case, this argument must not be defined, as LSP linters handle diagnostics automatically. See |ale-lsp-linters|. If the function named does not exist, including if the function is later deleted, ALE will behave as if the callback returned an empty list. The keys for each item in the List will be handled in the following manner: *ale-loclist-format* `text` - This error message is required. `detail` - An optional, more descriptive message. This message can be displayed with the `:ALEDetail` command instead of the message for `text`, if set. `lnum` - The line number is required. Any strings will be automatically converted to numbers by using |str2nr()|. Line 0 will be moved to line 1, and lines beyond the end of the file will be moved to the end. `col` - The column number is optional and will default to `0`. Any strings will be automatically converted to number using |str2nr()|. `end_col` - An optional end column number. This key can be set to specify the column problems end on, for improved highlighting. `end_lnum` - An optional end line number. This key can set along with `end_col` for highlighting multi-line problems. `bufnr` - This key represents the buffer number the problems are for. This value will default to the buffer number being checked. The `filename` key can be set instead of this key, and then the eventual `bufnr` value in the final list will either represent the number for an open buffer or `-1` for a file not open in any buffer. `filename` - An optional filename for the file the problems are for. This should be an absolute path to a file. Problems for files which have not yet been opened will be set in those files after they are opened and have been checked at least once. Temporary files in directories used for Vim temporary files with |tempname()| will be assumed to be the buffer being checked, unless the `bufnr` key is also set with a valid number for some other buffer. `vcol` - Defaults to `0`. If set to `1`, ALE will convert virtual column positions for `col` and `end_col` to byte column positions. If the buffer is changed in-between checking it and displaying the results, the calculated byte column positions will probably be wrong. `type` - Defaults to `'E'`. `nr` - Defaults to `-1`. Numeric error code. If `nr` is not `-1`, `code` likely should contain the string representation of the same value. `code` - No default; may be unset. Human-readable |String| error code. `executable` A |String| naming the executable itself which will be run, or a |Funcref| for a function to call for computing the executable, accepting a buffer number. The result can be computed with |ale#command#Run()|. This value will be used to check if the program requested is installed or not. If an `executable` is not defined, the command will be run without checking if a program is executable first. Defining an executable path is recommended to avoid starting too many processes. `command` A |String| for a command to run asynchronously, or a |Funcref| for a function to call for computing the command, accepting a buffer number. The result can be computed with |ale#command#Run()|. The command string can be formatted with format markers. See |ale-command-format-strings|. This command will be fed the lines from the buffer to check, and will produce the lines of output given to the `callback`. `cwd` An optional |String| for setting the working directory for the command, or a |Funcref| for a function to call for computing the command, accepting a buffer number. The working directory can be specified as a format string for determining the path dynamically. See |ale-command-format-strings|. To set the working directory to the directory containing the file you're checking, you should probably use `'%s:h'` as the option value. If this option is absent or the string is empty, the `command` will be run with no determined working directory in particular. The directory specified with this option will be used as the default working directory for all commands run in a chain with |ale#command#Run()|, unless otherwise specified. `output_stream` A |String| for the output stream the lines of output should be read from for the command which is run. The accepted values are `'stdout'`, `'stderr'`, and `'both'`. This argument defaults to `'stdout'`. This argument can be set for linter programs which output their errors and warnings to the stderr stream instead of stdout. The option `'both'` will read from both stder and stdout at the same time. `read_buffer` A |Number| (`0` or `1`) indicating whether a command should read the Vim buffer as input via stdin. This option is set to `1` by default, and can be disabled if a command manually reads from a temporary file instead, etc. This option behaves as if it was set to `0` when the `lint_file` option evaluates to `1`. *ale-lint-file* `lint_file` A |Number| (`0` or `1`), or a |Funcref| for a function accepting a buffer number for computing either `0` or `1`, indicating whether a command should read the file instead of the Vim buffer. This option can be used for linters which must check the file on disk, and which cannot check a Vim buffer instead. The result can be computed with |ale#command#Run()|. Linters where the eventual value of this option evaluates to `1` will not be run as a user types, per |g:ale_lint_on_text_changed|. Linters will instead be run only when events occur against the file on disk, including |g:ale_lint_on_enter| and |g:ale_lint_on_save|. Linters where this option evaluates to `1` will also be run when the `:ALELint` command is run. When this option is evaluates to `1`, ALE will behave as if `read_buffer` was set to `0`. *ale-lsp-linters* `lsp` A |String| for defining LSP (Language Server Protocol) linters. This argument may be omitted or `''` when a linter does not represent an LSP linter. When this argument is set to `'stdio'`, then the linter will be defined as an LSP linter which keeps a process for a language server running, and communicates with it directly via a |channel|. `executable` and `command` must be set. When this argument is set to `'socket'`, then the linter will be defined as an LSP linter via a TCP or named pipe socket connection. `address` must be set. ALE will not start a server automatically. When this argument is not empty `project_root` must be defined. `language` can be defined to describe the language for a file. The filetype will be used as the language by default. LSP linters handle diagnostics automatically, so the `callback` argument must not be defined. An optional `completion_filter` callback may be defined for filtering completion results. `initialization_options` may be defined to pass initialization options to the LSP. `lsp_config` may be defined to pass configuration settings to the LSP. `address` A |String| representing an address to connect to, or a |Funcref| accepting a buffer number and returning the |String|. If the value contains a colon, it is interpreted as referring to a TCP socket; otherwise it is interpreted as the path of a named pipe. The result can be computed with |ale#command#Run()|. This argument must only be set if the `lsp` argument is set to `'socket'`. `project_root` A |String| representing a path to the project for the file being checked with the language server, or a |Funcref| accepting a buffer number and returning the |String|. If an empty string is returned, the file will not be checked at all. This argument must only be set if the `lsp` argument is also set to a non-empty string. `language` A |String| representing the name of the language being checked, or a |Funcref| accepting a buffer number and returning the |String|. This string will be sent to the LSP to tell it what type of language is being checked. If a language isn't provided, the language will default to the value of the filetype given to |ale#linter#Define|. `completion_filter` A |String| or |Funcref| for a callback function accepting a buffer number and a completion item. The completion item will be a |Dictionary| following the Language Server Protocol `CompletionItem` interface as described in the specification, available online here: https://microsoft.github.io/language-server-protocol `aliases` A |List| of aliases for the linter name. This argument can be set with alternative names for selecting the linter with |g:ale_linters|. This setting can make it easier to guess the linter name by offering a few alternatives. `initialization_options` A |Dictionary| of initialization options for LSPs, or a |Funcref| for a callback function accepting a buffer number and returning the |Dictionary|. This will be fed (as JSON) to the LSP in the initialize command. `lsp_config` A |Dictionary| for configuring a language server, or a |Funcref| for a callback function accepting a buffer number and returning the |Dictionary|. This will be fed (as JSON) to the LSP in the workspace/didChangeConfiguration command. If temporary files or directories are created for commands run with `command`, then these temporary files or directories can be managed by ALE, for automatic deletion. See |ale#command#ManageFile()| and |ale#command#ManageDirectory| for more information. *ale-command-format-strings* All command strings will be formatted for special character sequences. Any substring `%s` will be replaced with the full path to the current file being edited. This format option can be used to pass the exact filename being edited to a program. For example: > 'command': 'eslint -f unix --stdin --stdin-filename %s' < Any substring `%t` will be replaced with a path to a temporary file. Merely adding `%t` will cause ALE to create a temporary file containing the contents of the buffer being checked. All occurrences of `%t` in command strings will reference the one temporary file. The temporary file will be created inside a temporary directory, and the entire temporary directory will be automatically deleted, following the behavior of |ale#command#ManageDirectory|. This option can be used for some linters which do not support reading from stdin. For example: > 'command': 'ghc -fno-code -v0 %t', < Any substring `%e` will be replaced with the escaped executable supplied with `executable`. This provides a convenient way to define a command string which needs to include a dynamic executable name, but which is otherwise static. For example: > 'command': '%e --some-argument', < The character sequence `%%` can be used to emit a literal `%` into a command, so literal character sequences `%s` and `%t` can be escaped by using `%%s` and `%%t` instead, etc. Some |filename-modifiers| can be applied to `%s` and `%t`. Only `:h`, `:t`, `:r`, and `:e` may be applied, other modifiers will be ignored. Filename modifiers can be applied to the format markers by placing them after them. For example: > 'command': '%s:h %s:e %s:h:t', < Given a path `/foo/baz/bar.txt`, the above command string will generate something akin to `'/foo/baz' 'txt' 'baz'` If a callback for a command generates part of a command string which might possibly contain `%%`, `%s`, `%t`, or `%e`, where the special formatting behavior is not desired, the |ale#command#EscapeCommandPart()| function can be used to replace those characters to avoid formatting issues. *ale-linter-loading-behavior* Linters for ALE will be loaded by searching |runtimepath| in the following format: > ale_linters//.vim < Any linters which exist anywhere in 'runtimepath' with that directory structure will be automatically loaded for the matching |filetype|. Filetypes containing `.` characters will be split into individual parts, and files will be loaded for each filetype between the `.` characters. Linters can be defined from vimrc and other files as long as this function is loaded first. For example, the following code will define a Hello World linter in vimrc in Vim 8: > " Plugins have to be loaded first. " If you are using a plugin manager, run that first. packloadall call ale#linter#Define('vim', { \ 'name': 'echo-test', \ 'executable': 'echo', \ 'command': 'echo hello world', \ 'callback': {buffer, lines -> map(lines, '{"text": v:val, "lnum": 1}')}, \}) < ale#linter#Get(filetype) *ale#linter#Get()* Return all of linters configured for a given filetype as a |List| of |Dictionary| values in the format specified by |ale#linter#Define()|. Filetypes may be dot-separated to invoke linters for multiple filetypes: for instance, the filetype `javascript.jsx` will return linters for both the `javascript` and `jsx` filetype. Aliases may be defined in as described in |g:ale_linter_aliases|. Aliases are applied after dot-separated filetypes are broken up into their components. ale#linter#PreventLoading(filetype) *ale#linter#PreventLoading()* Given a `filetype`, prevent any more linters from being loaded from |runtimepath| for that filetype. This function can be called from vimrc or similar to prevent ALE from loading linters. ale#lsp_linter#SendRequest(buffer, linter_name, message, [Handler]) *ale#lsp_linter#SendRequest()* Send a custom request to an LSP linter. The arguments are defined as follows: `buffer` A valid buffer number. `linter_name` A |String| identifying an LSP linter that is available and enabled for the |filetype| of `buffer`. `message` A |List| in the form `[is_notification, method, parameters]`, containing three elements: `is_notification` - an |Integer| that has value 1 if the request is a notification, 0 otherwise; `method` - a |String|, identifying an LSP method supported by `linter`; `parameters` - a |dictionary| of LSP parameters that are applicable to `method`. `Handler` Optional argument, meaningful only when `message[0]` is 0. A |Funcref| that is called when a response to the request is received, and takes as unique argument a dictionary representing the response obtained from the server. ale#other_source#ShowResults(buffer, linter_name, loclist) *ale#other_source#ShowResults()* Show results from another source of information. `buffer` must be a valid buffer number, and `linter_name` must be a unique name for identifying another source of information. The `loclist` given where the problems in a buffer are, and should be provided in the format ALE uses for regular linter results. See |ale-loclist-format|. ale#other_source#StartChecking(buffer, linter_name) *ale#other_source#StartChecking()* Tell ALE that another source of information has started checking a buffer. `buffer` must be a valid buffer number, and `linter_name` must be a unique name for identifying another source of information. ale#statusline#Count(buffer) *ale#statusline#Count()* Given the number of a buffer which may have problems, return a |Dictionary| containing information about the number of problems detected by ALE. The following keys are supported: `error` -> The number of problems with type `E` and `sub_type != 'style'` `warning` -> The number of problems with type `W` and `sub_type != 'style'` `info` -> The number of problems with type `I` `style_error` -> The number of problems with type `E` and `sub_type == 'style'` `style_warning` -> The number of problems with type `W` and `sub_type == 'style'` `total` -> The total number of problems. ale#statusline#FirstProblem(buffer, type) *ale#statusline#FirstProblem()* Returns a copy of the first entry in the `loclist` that matches the supplied buffer number and problem type. If there is no such entry, an empty dictionary is returned. Problem type should be one of the strings listed below: `error` -> Returns the first `loclist` item with type `E` and `sub_type != 'style'` `warning` -> First item with type `W` and `sub_type != 'style'` `info` -> First item with type `I` `style_error` -> First item with type `E` and `sub_type == 'style'` `style_warning` -> First item with type `W` and `sub_type == 'style'` b:ale_linted *b:ale_linted* `b:ale_linted` is set to the number of times a buffer has been checked by ALE after all linters for one lint cycle have finished checking a buffer. This variable may not be defined until ALE first checks a buffer, so it should be accessed with |get()| or |getbufvar()|. For example: > " Print a message indicating how many times ALE has checked this buffer. echo 'ALE has checked this buffer ' . get(b:, 'ale_linted') . ' time(s).' " Print 'checked' using getbufvar() if a buffer has been checked. echo getbufvar(bufnr(''), 'ale_linted', 0) > 0 ? 'checked' : 'not checked' < g:ale_want_results_buffer *g:ale_want_results_buffer* `g:ale_want_results_buffer` is set to the number of the buffer being checked when the |ALEWantResults| event is signaled. This variable should be read to figure out which buffer other sources should lint. ALECompletePost *ALECompletePost-autocmd* *ALECompletePost* This |User| autocmd is triggered after ALE inserts an item on |CompleteDone|. This event can be used to run commands after a buffer is changed by ALE as the result of completion. For example, `:ALEFix` can be configured to run automatically when completion is done: > augroup FixAfterComplete autocmd! " Run ALEFix when completion items are added. autocmd User ALECompletePost ALEFix! " If ALE starts fixing a file, stop linters running for now. autocmd User ALEFixPre ALELintStop augroup END < ALELintPre *ALELintPre-autocmd* *ALELintPre* ALELintPost *ALELintPost-autocmd* *ALELintPost* ALEFixPre *ALEFixPre-autocmd* *ALEFixPre* ALEFixPost *ALEFixPost-autocmd* *ALEFixPost* These |User| autocommands are triggered before and after every lint or fix cycle. They can be used to update statuslines, send notifications, etc. The autocmd commands are run with |:silent|, so |:unsilent| is required for echoing messages. For example to change the color of the statusline while the linter is running: > augroup ALEProgress autocmd! autocmd User ALELintPre hi Statusline ctermfg=darkgrey autocmd User ALELintPost hi Statusline ctermfg=NONE augroup END < Or to display the progress in the statusline: > let s:ale_running = 0 let l:stl .= '%{s:ale_running ? "[linting]" : ""}' augroup ALEProgress autocmd! autocmd User ALELintPre let s:ale_running = 1 | redrawstatus autocmd User ALELintPost let s:ale_running = 0 | redrawstatus augroup END < ALEJobStarted *ALEJobStarted-autocmd* *ALEJobStarted* This |User| autocommand is triggered immediately after a job is successfully run. This provides better accuracy for checking linter status with |ale#engine#IsCheckingBuffer()| over |ALELintPre-autocmd|, which is actually triggered before any linters are executed. ALELSPStarted *ALELSPStarted-autocmd* *ALELSPStarted* This |User| autocommand is triggered immediately after an LSP connection is successfully initialized. This provides a way to perform any additional initialization work, such as setting up buffer-level mappings. ALEWantResults *ALEWantResults-autocmd* *ALEWantResults* This |User| autocommand is triggered before ALE begins a lint cycle. Another source can respond by calling |ale#other_source#StartChecking()|, and |ALELintPre| will be signaled thereafter, to allow other plugins to know that another source is checking the buffer. |g:ale_want_results_buffer| will be set to the number for a buffer being checked when the event is signaled, and deleted after the event is done. This variable should be read to know which buffer to check. Other plugins can use this event to start checking buffers when ALE events for checking buffers are triggered. =============================================================================== 10. Special Thanks *ale-special-thanks* Special thanks to Mark Grealish (https://www.bhalash.com/) for providing ALE's snazzy looking ale glass logo. Cheers, Mark! =============================================================================== 11. Contact *ale-contact* If you like this plugin, and wish to get in touch, check out the GitHub page for issues and more at https://github.com/dense-analysis/ale If you wish to contact the author of this plugin directly, please feel free to send an email to devw0rp@gmail.com. Please drink responsibly, or not at all, which is ironically the preference of w0rp, who is teetotal. =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: ale-4.0.0/ftplugin/000077500000000000000000000000001476501472200141145ustar00rootroot00000000000000ale-4.0.0/ftplugin/ale-fix-suggest.vim000066400000000000000000000003061476501472200176340ustar00rootroot00000000000000" Close the ALEFixSuggest window with the q key. noremap q :q! let b:undo_ftplugin = get(b:, 'undo_ftplugin', 'execute') let b:undo_ftplugin .= ' | execute "silent! unmap q"' ale-4.0.0/ftplugin/ale-info.vim000066400000000000000000000014351476501472200163260ustar00rootroot00000000000000" Close the ALEInfo preview window with the q key. noremap q :q! " Explicitly use the default synmaxcol for ale-info. setlocal synmaxcol=3000 function! ALEInfoOpenHelp() abort let l:variable = matchstr(getline('.'), '\v[gb]:ale_[a-z0-9_]+') if !empty(l:variable) execute('help ' . l:variable) endif endfunction " Press space to open :help for an ALE Variable nnoremap :call ALEInfoOpenHelp() let b:undo_ftplugin = get(b:, 'undo_ftplugin', 'execute') let b:undo_ftplugin .= ' | setlocal synmaxcol<' let b:undo_ftplugin .= ' | execute "silent! unmap q"' let b:undo_ftplugin .= ' | execute "silent! nunmap "' let b:undo_ftplugin .= ' | if exists(''*ALEInfoOpenHelp'') | delfunction ALEInfoOpenHelp | endif' ale-4.0.0/ftplugin/ale-preview-selection.vim000066400000000000000000000026461476501472200210440ustar00rootroot00000000000000" Close the ALEPreviewWindow window with the q key. noremap q :q! " Disable some keybinds for the selection window. noremap v noremap i noremap I noremap noremap noremap noremap a noremap A noremap o noremap O " Keybinds for opening selection items. noremap :call ale#preview#OpenSelection() noremap t :call ale#preview#OpenSelectionInTab() let b:undo_ftplugin = get(b:, 'undo_ftplugin', 'execute') let b:undo_ftplugin .= ' | execute "silent! unmap q"' let b:undo_ftplugin .= ' | execute "silent! unmap v"' let b:undo_ftplugin .= ' | execute "silent! unmap i"' let b:undo_ftplugin .= ' | execute "silent! unmap I"' let b:undo_ftplugin .= ' | execute "silent! unmap "' let b:undo_ftplugin .= ' | execute "silent! unmap "' let b:undo_ftplugin .= ' | execute "silent! unmap "' let b:undo_ftplugin .= ' | execute "silent! unmap a"' let b:undo_ftplugin .= ' | execute "silent! unmap A"' let b:undo_ftplugin .= ' | execute "silent! unmap o"' let b:undo_ftplugin .= ' | execute "silent! unmap O"' let b:undo_ftplugin .= ' | execute "silent! unmap "' let b:undo_ftplugin .= ' | execute "silent! unmap t"' ale-4.0.0/ftplugin/ale-preview.vim000066400000000000000000000003111476501472200170440ustar00rootroot00000000000000" Close the ALEPreviewWindow window with the q key. noremap q :q! let b:undo_ftplugin = get(b:, 'undo_ftplugin', 'execute') let b:undo_ftplugin .= ' | execute "silent! unmap q"' ale-4.0.0/lspconfig.vim000066400000000000000000000000771476501472200147710ustar00rootroot00000000000000if get(g:, 'lspconfig', 0) " lspconfig is installed. endif ale-4.0.0/lua/000077500000000000000000000000001476501472200130455ustar00rootroot00000000000000ale-4.0.0/lua/ale/000077500000000000000000000000001476501472200136065ustar00rootroot00000000000000ale-4.0.0/lua/ale/diagnostics.lua000066400000000000000000000053421476501472200166240ustar00rootroot00000000000000local module = {} local ale_type_to_diagnostic_severity = { E = vim.diagnostic.severity.ERROR, W = vim.diagnostic.severity.WARN, I = vim.diagnostic.severity.INFO } -- Equivalent to ale#Var, only we can't error on missing global keys. module.aleVar = function(buffer, key) key = "ale_" .. key local exists, value = pcall(vim.api.nvim_buf_get_var, buffer, key) if exists then return value end return vim.g[key] end module.sendAleResultsToDiagnostics = function(buffer, loclist) local diagnostics = {} -- Convert all the ALE loclist items to the shape that Neovim's diagnostic -- API is expecting. for _, location in ipairs(loclist) do if location.bufnr == buffer then table.insert( diagnostics, -- All line numbers from ALE are 1-indexed, but all line numbers -- in the diagnostics API are 0-indexed, so we have to subtract 1 -- to make this work. { lnum = location.lnum - 1, -- Ending line number, or if we don't have one, just make it the same -- as the starting line number end_lnum = (location.end_lnum or location.lnum) - 1, -- Which column does the error start on? col = math.max((location.col or 1) - 1, 0), -- end_col does *not* appear to need 1 subtracted, so we don't. end_col = location.end_col, -- Which severity: error, warning, or info? severity = ale_type_to_diagnostic_severity[location.type] or "E", -- An error code code = location.code, -- The error message message = location.text, -- e.g. "rubocop" source = location.linter_name, } ) end end local virtualtext_enabled_set = { ['all'] = true, ['2'] = true, [2] = true, ['current'] = true, ['1'] = true, [1] = true, } local set_signs = module.aleVar(buffer, 'set_signs') local sign_priority = module.aleVar(buffer, 'sign_priority') local signs if set_signs == 1 and sign_priority then -- If signs are enabled, set the priority for them. local local_cfg = { priority = sign_priority } local global_cfg = vim.diagnostic.config().signs if type(global_cfg) == 'boolean' then signs = local_cfg elseif type(global_cfg) == 'table' then signs = vim.tbl_extend('force', global_cfg, local_cfg) else signs = function(...) local calculated = global_cfg(...) return vim.tbl_extend('force', calculated, local_cfg) end end end vim.diagnostic.set( vim.api.nvim_create_namespace('ale'), buffer, diagnostics, { virtual_text = virtualtext_enabled_set[vim.g.ale_virtualtext_cursor] ~= nil, signs = signs, } ) end return module ale-4.0.0/lua/ale/util.lua000066400000000000000000000003501476501472200152640ustar00rootroot00000000000000local M = {} function M.configured_lspconfig_servers() local configs = require 'lspconfig.configs' local keys = {} for key, _ in pairs(configs) do table.insert(keys, key) end return keys end return M ale-4.0.0/plugin/000077500000000000000000000000001476501472200135625ustar00rootroot00000000000000ale-4.0.0/plugin/ale.vim000066400000000000000000000425641476501472200150530ustar00rootroot00000000000000" Author: w0rp " Description: Main entry point for the plugin: sets up prefs and autocommands " Preferences can be set in vimrc files and so on to configure ale " Sanity Checks if exists('g:loaded_ale_dont_use_this_in_other_plugins_please') finish endif " Set a special flag used only by this plugin for preventing doubly " loading the script. let g:loaded_ale_dont_use_this_in_other_plugins_please = 1 " A flag for detecting if the required features are set. if has('nvim') " We check for Neovim 0.2.0+, but we only officially support NeoVim 0.7.0 let s:has_features = has('timers') && has('nvim-0.2.0') else " Check if Job and Channel functions are available, instead of the " features. This works better on old MacVim versions. let s:has_features = has('timers') && exists('*job_start') && exists('*ch_close_in') endif if !s:has_features " Only output a warning if editing some special files. if index(['', 'gitcommit'], &filetype) == -1 " no-custom-checks echoerr 'ALE requires NeoVim >= 0.7.0 or Vim 8 with +timers +job +channel' " no-custom-checks echoerr 'Please update your editor appropriately.' endif " Stop here, as it won't work. finish endif " Set this flag so that other plugins can use it, like airline. let g:loaded_ale = 1 " This global variable is used internally by ALE for tracking information for " each buffer which linters are being run against. let g:ale_buffer_info = {} " This global Dictionary tracks data for fixing code. Don't mess with it. let g:ale_fix_buffer_data = {} " User Configuration " This option prevents ALE autocmd commands from being run for particular " filetypes which can cause issues. let g:ale_filetype_blacklist = [ \ 'dirvish', \ 'nerdtree', \ 'qf', \ 'tags', \ 'unite', \] " This Dictionary configures which linters are enabled for which languages. let g:ale_linters = get(g:, 'ale_linters', {}) " This option can be changed to only enable explicitly selected linters. let g:ale_linters_explicit = get(g:, 'ale_linters_explicit', 0) " Ignoring linters, for disabling some, or ignoring LSP diagnostics. let g:ale_linters_ignore = get(g:, 'ale_linters_ignore', {}) " Disabling all language server functionality. let g:ale_disable_lsp = get(g:, 'ale_disable_lsp', 'auto') " This Dictionary configures which functions will be used for fixing problems. let g:ale_fixers = get(g:, 'ale_fixers', {}) " This Dictionary allows users to set up filetype aliases for new filetypes. let g:ale_linter_aliases = get(g:, 'ale_linter_aliases', {}) " This flag can be set with a number of milliseconds for delaying the " execution of a linter when text is changed. The timeout will be set and " cleared each time text is changed, so repeated edits won't trigger the " jobs for linting until enough time has passed after editing is done. let g:ale_lint_delay = get(g:, 'ale_lint_delay', 200) " This flag can be set to 'never' to disable linting when text is changed. " This flag can also be set to 'always' or 'insert' to lint when text is " changed in both normal and insert mode, or only in insert mode respectively. let g:ale_lint_on_text_changed = get(g:, 'ale_lint_on_text_changed', 'normal') " This flag can be set to 1 to enable linting when leaving insert mode. let g:ale_lint_on_insert_leave = get(g:, 'ale_lint_on_insert_leave', 1) " This flag can be set to 0 to disable linting when the buffer is entered. let g:ale_lint_on_enter = get(g:, 'ale_lint_on_enter', 1) " This flag can be set to 1 to enable linting when a buffer is written. let g:ale_lint_on_save = get(g:, 'ale_lint_on_save', 1) " This flag can be set to 1 to enable linting when the filetype is changed. let g:ale_lint_on_filetype_changed = get(g:, 'ale_lint_on_filetype_changed', 1) " If set to 1, hints and suggestion from LSP servers and tsserver will be shown. let g:ale_lsp_suggestions = get(g:, 'ale_lsp_suggestions', 0) " This flag can be set to 1 to enable automatically fixing files on save. let g:ale_fix_on_save = get(g:, 'ale_fix_on_save', 0) " This flag may be set to 0 to disable ale. After ale is loaded, :ALEToggle " should be used instead. let g:ale_enabled = get(g:, 'ale_enabled', 1) " A Dictionary mapping linter or fixer names to Arrays of two-item Arrays " mapping filename paths from one system to another. let g:ale_filename_mappings = get(g:, 'ale_filename_mappings', {}) " This Dictionary configures the default project roots for various linters. let g:ale_root = get(g:, 'ale_root', {}) " These flags dictates if ale uses the quickfix or the loclist (loclist is the " default, quickfix overrides loclist). let g:ale_set_loclist = get(g:, 'ale_set_loclist', 1) let g:ale_set_quickfix = get(g:, 'ale_set_quickfix', 0) " This flag can be set to 0 to disable setting signs. " This is enabled by default only if the 'signs' feature exists. let g:ale_set_signs = get(g:, 'ale_set_signs', has('signs')) " This flag can be set to 0 to disable setting error highlights. let g:ale_set_highlights = get(g:, 'ale_set_highlights', has('syntax')) " This List can be configured to exclude particular highlights. let g:ale_exclude_highlights = get(g:, 'ale_exclude_highlights', []) " This flag can be set to 0 to disable echoing when the cursor moves. let g:ale_echo_cursor = get(g:, 'ale_echo_cursor', 1) " This flag can be set to 1 to automatically show errors in the preview window. let g:ale_cursor_detail = get(g:, 'ale_cursor_detail', 0) " This flag can be changed to disable/enable virtual text. let g:ale_virtualtext_cursor = get(g:, 'ale_virtualtext_cursor', (has('nvim-0.3.2') || has('patch-9.0.0297') && has('textprop') && has('popupwin')) ? 'all' : 'disabled') " This flag can be set to 1 to enable LSP hover messages at the cursor. let g:ale_hover_cursor = get(g:, 'ale_hover_cursor', 1) " This flag can be set to 1 to automatically close the preview window upon " entering Insert Mode. let g:ale_close_preview_on_insert = get(g:, 'ale_close_preview_on_insert', 0) " This flag can be set to 0 to disable balloon support. let g:ale_set_balloons = get(g:, 'ale_set_balloons', has('balloon_eval') && has('gui_running')) " Use preview window for hover messages. let g:ale_hover_to_preview = get(g:, 'ale_hover_to_preview', 0) " Float preview windows in Neovim let g:ale_floating_preview = get(g:, 'ale_floating_preview', 0) " Hovers use floating windows in Neovim let g:ale_hover_to_floating_preview = get(g:, 'ale_hover_to_floating_preview', 0) " Detail uses floating windows in Neovim let g:ale_detail_to_floating_preview = get(g:, 'ale_detail_to_floating_preview', 0) " Border setting for floating preview windows " The elements in the list set the characters for the left, top, top-left, " top-right, bottom-right, bottom-left, right, and bottom of the border " respectively let g:ale_floating_window_border = get(g:, 'ale_floating_window_border', ['|', '-', '+', '+', '+', '+', '|', '-']) " This flag can be set to 0 to disable warnings for trailing whitespace let g:ale_warn_about_trailing_whitespace = get(g:, 'ale_warn_about_trailing_whitespace', 1) " This flag can be set to 0 to disable warnings for trailing blank lines let g:ale_warn_about_trailing_blank_lines = get(g:, 'ale_warn_about_trailing_blank_lines', 1) " A flag for enabling or disabling the command history. let g:ale_history_enabled = get(g:, 'ale_history_enabled', 1) " A flag for storing the full output of commands in the history. let g:ale_history_log_output = get(g:, 'ale_history_log_output', 1) " Enable automatic completion with LSP servers and tsserver let g:ale_completion_enabled = get(g:, 'ale_completion_enabled', 0) " Enable automatic detection of pipenv for Python linters. let g:ale_python_auto_pipenv = get(g:, 'ale_python_auto_pipenv', 0) " Enable automatic detection of poetry for Python linters. let g:ale_python_auto_poetry = get(g:, 'ale_python_auto_poetry', 0) " Enable automatic detection of uv for Python linters. let g:ale_python_auto_uv = get(g:, 'ale_python_auto_uv', 0) " Enable automatic adjustment of environment variables for Python linters. " The variables are set based on ALE's virtualenv detection. let g:ale_python_auto_virtualenv = get(g:, 'ale_python_auto_virtualenv', 0) " This variable can be overridden to set the GO111MODULE environment variable. let g:ale_go_go111module = get(g:, 'ale_go_go111module', '') " Default executable for deno, needed set before plugin start let g:ale_deno_executable = get(g:, 'ale_deno_executable', 'deno') " If 1, enable a popup menu for commands. let g:ale_popup_menu_enabled = get(g:, 'ale_popup_menu_enabled', has('gui_running')) " If 0, save hidden files when code actions are applied. let g:ale_save_hidden = get(g:, 'ale_save_hidden', 0) " If 1, disables ALE's built in error display. Instead, all errors are piped " to the diagnostics API. let g:ale_use_neovim_diagnostics_api = get(g:, 'ale_use_neovim_diagnostics_api', has('nvim-0.7')) if g:ale_use_neovim_diagnostics_api && !has('nvim-0.7') " no-custom-checks echoerr('Setting g:ale_use_neovim_diagnostics_api to 1 requires Neovim 0.7+.') endif if g:ale_set_balloons is 1 || g:ale_set_balloons is# 'hover' call ale#balloon#Enable() endif if g:ale_completion_enabled call ale#completion#Enable() endif if g:ale_popup_menu_enabled call ale#code_action#EnablePopUpMenu() endif " Define commands for moving through warnings and errors. command! -bar -nargs=* ALEPrevious \ :call ale#loclist_jumping#WrapJump('before', ) command! -bar -nargs=* ALENext \ :call ale#loclist_jumping#WrapJump('after', ) command! -bar ALEPreviousWrap :call ale#loclist_jumping#Jump('before', 1) command! -bar ALENextWrap :call ale#loclist_jumping#Jump('after', 1) command! -bar ALEFirst :call ale#loclist_jumping#JumpToIndex(0) command! -bar ALELast :call ale#loclist_jumping#JumpToIndex(-1) " A command for showing error details. command! -bar ALEDetail :call ale#cursor#ShowCursorDetail() " Define commands for turning ALE on or off. command! -bar ALEToggle :call ale#toggle#Toggle() command! -bar ALEEnable :call ale#toggle#Enable() command! -bar ALEDisable :call ale#toggle#Disable() command! -bar ALEReset :call ale#toggle#Reset() " Commands for turning ALE on or off for a buffer. command! -bar ALEToggleBuffer :call ale#toggle#ToggleBuffer(bufnr('')) command! -bar ALEEnableBuffer :call ale#toggle#EnableBuffer(bufnr('')) command! -bar ALEDisableBuffer :call ale#toggle#DisableBuffer(bufnr('')) command! -bar ALEResetBuffer :call ale#toggle#ResetBuffer(bufnr('')) " A command to stop all LSP-like clients, including tsserver. command! -bar ALEStopAllLSPs :call ale#lsp#reset#StopAllLSPs() " A command to stop a specific language server, or tsseserver. command! -bar -bang -nargs=1 -complete=customlist,ale#lsp#reset#Complete ALEStopLSP :call ale#lsp#reset#StopLSP(, '') " A command for linting manually. command! -bar ALELint :call ale#Queue(0, 'lint_file') " Stop current jobs when linting. command! -bar ALELintStop :call ale#engine#Stop(bufnr('')) " Commands to manually populate the quickfixes. command! -bar ALEPopulateQuickfix :call ale#list#ForcePopulateErrorList(1) command! -bar ALEPopulateLocList :call ale#list#ForcePopulateErrorList(0) " Define a command to get information about current filetype. command! -bar -nargs=* ALEInfo :call ale#debugging#InfoCommand() " Deprecated and scheduled for removal in 4.0.0. command! -bar ALEInfoToClipboard :call ale#debugging#InfoToClipboardDeprecatedCommand() " Copy ALE information to a file. command! -bar -nargs=1 ALEInfoToFile :call ale#debugging#InfoToFile() " Fix problems in files. command! -bar -bang -nargs=* -complete=customlist,ale#fix#registry#CompleteFixers ALEFix :call ale#fix#Fix(bufnr(''), '', ) " Suggest registered functions to use for fixing problems. command! -bar ALEFixSuggest :call ale#fix#registry#Suggest(&filetype) " Go to definition for tsserver and LSP command! -bar -nargs=* ALEGoToDefinition :call ale#definition#GoToCommandHandler('', ) " Go to type definition for tsserver and LSP command! -bar -nargs=* ALEGoToTypeDefinition :call ale#definition#GoToCommandHandler('type', ) " Go to implementation for tsserver and LSP command! -bar -nargs=* ALEGoToImplementation :call ale#definition#GoToCommandHandler('implementation', ) " Repeat a previous selection in the preview window command! -bar ALERepeatSelection :call ale#preview#RepeatSelection() " Find references for tsserver and LSP command! -bar -nargs=* ALEFindReferences :call ale#references#Find() " Show summary information for the cursor. command! -bar ALEHover :call ale#hover#ShowAtCursor() " Show documentation for the cursor. command! -bar ALEDocumentation :call ale#hover#ShowDocumentationAtCursor() " Search for appearances of a symbol, such as a type name or function name. command! -nargs=1 ALESymbolSearch :call ale#symbol#Search() " Complete text with tsserver and LSP command! -bar ALEComplete :call ale#completion#GetCompletions('ale-manual') " Try to find completions for the current symbol that add additional text. command! -bar ALEImport :call ale#completion#Import() " Rename symbols using tsserver and LSP command! -bar -bang ALERename :call ale#rename#Execute() " Rename file using tsserver command! -bar -bang ALEFileRename :call ale#filerename#Execute() " Apply code actions to a range. command! -bar -range ALECodeAction :call ale#codefix#Execute() " Organize import statements using tsserver command! -bar ALEOrganizeImports :call ale#organize_imports#Execute() " mappings for commands nnoremap (ale_previous) :ALEPrevious nnoremap (ale_previous_wrap) :ALEPreviousWrap nnoremap (ale_previous_error) :ALEPrevious -error nnoremap (ale_previous_wrap_error) :ALEPrevious -wrap -error nnoremap (ale_previous_warning) :ALEPrevious -warning nnoremap (ale_previous_wrap_warning) :ALEPrevious -wrap -warning nnoremap (ale_next) :ALENext nnoremap (ale_next_wrap) :ALENextWrap nnoremap (ale_next_error) :ALENext -error nnoremap (ale_next_wrap_error) :ALENext -wrap -error nnoremap (ale_next_warning) :ALENext -warning nnoremap (ale_next_wrap_warning) :ALENext -wrap -warning nnoremap (ale_first) :ALEFirst nnoremap (ale_last) :ALELast nnoremap (ale_toggle) :ALEToggle nnoremap (ale_enable) :ALEEnable nnoremap (ale_disable) :ALEDisable nnoremap (ale_reset) :ALEReset nnoremap (ale_toggle_buffer) :ALEToggleBuffer nnoremap (ale_enable_buffer) :ALEEnableBuffer nnoremap (ale_disable_buffer) :ALEDisableBuffer nnoremap (ale_reset_buffer) :ALEResetBuffer nnoremap (ale_lint) :ALELint nnoremap (ale_detail) :ALEDetail nnoremap (ale_fix) :ALEFix nnoremap (ale_go_to_definition) :ALEGoToDefinition nnoremap (ale_go_to_definition_in_tab) :ALEGoToDefinition -tab nnoremap (ale_go_to_definition_in_split) :ALEGoToDefinition -split nnoremap (ale_go_to_definition_in_vsplit) :ALEGoToDefinition -vsplit nnoremap (ale_go_to_type_definition) :ALEGoToTypeDefinition nnoremap (ale_go_to_type_definition_in_tab) :ALEGoToTypeDefinition -tab nnoremap (ale_go_to_type_definition_in_split) :ALEGoToTypeDefinition -split nnoremap (ale_go_to_type_definition_in_vsplit) :ALEGoToTypeDefinition -vsplit nnoremap (ale_go_to_implementation) :ALEGoToImplementation nnoremap (ale_go_to_implementation_in_tab) :ALEGoToImplementation -tab nnoremap (ale_go_to_implementation_in_split) :ALEGoToImplementation -split nnoremap (ale_go_to_implementation_in_vsplit) :ALEGoToImplementation -vsplit nnoremap (ale_find_references) :ALEFindReferences nnoremap (ale_hover) :ALEHover nnoremap (ale_documentation) :ALEDocumentation inoremap (ale_complete) :ALEComplete nnoremap (ale_import) :ALEImport nnoremap (ale_rename) :ALERename nnoremap (ale_filerename) :ALEFileRename nnoremap (ale_code_action) :ALECodeAction nnoremap (ale_repeat_selection) :ALERepeatSelection nnoremap (ale_info) :ALEInfo nnoremap (ale_info_echo) :ALEInfo -echo nnoremap (ale_info_clipboard) :ALEInfo -clipboard nnoremap (ale_info_preview) :ALEInfo -preview " Set up autocmd groups now. call ale#events#Init() " Housekeeping augroup ALECleanupGroup autocmd! " Clean up buffers automatically when they are unloaded. autocmd BufDelete * if exists('*ale#engine#Cleanup') | call ale#engine#Cleanup(str2nr(expand(''))) | endif autocmd QuitPre * call ale#events#QuitEvent(str2nr(expand(''))) if exists('##VimSuspend') autocmd VimSuspend * if exists('*ale#engine#CleanupEveryBuffer') | call ale#engine#CleanupEveryBuffer() | endif endif augroup END ale-4.0.0/rplugin/000077500000000000000000000000001476501472200137445ustar00rootroot00000000000000ale-4.0.0/rplugin/python3/000077500000000000000000000000001476501472200153505ustar00rootroot00000000000000ale-4.0.0/rplugin/python3/deoplete/000077500000000000000000000000001476501472200171515ustar00rootroot00000000000000ale-4.0.0/rplugin/python3/deoplete/sources/000077500000000000000000000000001476501472200206345ustar00rootroot00000000000000ale-4.0.0/rplugin/python3/deoplete/sources/ale.py000066400000000000000000000035551476501472200217570ustar00rootroot00000000000000""" A Deoplete source for ALE completion via tsserver and LSP. """ __author__ = 'Joao Paulo, w0rp' try: from deoplete.source.base import Base except ImportError: # Mock the Base class if deoplete isn't available, as mock isn't available # in the Docker image. class Base(object): def __init__(self, vim): pass # Make sure this code is valid in Python 2, used for running unit tests. class Source(Base): def __init__(self, vim): super(Source, self).__init__(vim) self.name = 'ale' self.mark = '[L]' self.rank = 1000 self.is_bytepos = True self.min_pattern_length = 1 self.is_volatile = True # Do not forget to update s:trigger_character_map in completion.vim in # updating entries in this map. self.input_patterns = { '_': r'\.\w*$', 'rust': r'(\.|::)\w*$', 'typescript': r'(\.|\'|")\w*$', 'cpp': r'(\.|::|->)\w*$', 'c': r'(\.|->)\w*$', } # Returns an integer for the start position, as with omnifunc. def get_complete_position(self, context): return self.vim.call( 'ale#completion#GetCompletionPositionForDeoplete', context['input'] ) def gather_candidates(self, context): # Stop early if ALE can't provide completion data for this buffer. if not self.vim.call('ale#completion#CanProvideCompletions'): return None event = context.get('event') if event == 'Async': result = self.vim.call('ale#completion#GetCompletionResult') return result or [] if context.get('is_refresh'): self.vim.command( "call ale#completion#GetCompletions('ale-callback', " + "{'callback': {completions -> deoplete#auto_complete() }})" ) return [] ale-4.0.0/supported-tools.md000066400000000000000000001056751476501472200160070ustar00rootroot00000000000000# ALE Supported Languages and Tools This plugin supports the following languages and tools. All available tools will be run in combination, so they can be complementary. **Legend** | Key | Definition | | ------------- | ----------------------------------------------------------------- | | :floppy_disk: | May only run on files on disk (see: `help ale-lint-file-linters` | | :warning: | Disabled by default | --- * Ada * [ada_language_server](https://github.com/AdaCore/ada_language_server) * [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell) * [gcc](https://gcc.gnu.org) * [gnatpp](https://docs.adacore.com/gnat_ugn-docs/html/gnat_ugn/gnat_ugn/gnat_utility_programs.html#the-gnat-pretty-printer-gnatpp) :floppy_disk: * Ansible * [ansible-language-server](https://github.com/ansible/ansible-language-server/) * [ansible-lint](https://github.com/willthames/ansible-lint) :floppy_disk: * API Blueprint * [drafter](https://github.com/apiaryio/drafter) * APKBUILD * [apkbuild-fixer](https://gitlab.alpinelinux.org/Leo/atools) * [apkbuild-lint](https://gitlab.alpinelinux.org/Leo/atools) * [secfixes-check](https://gitlab.alpinelinux.org/Leo/atools) * AsciiDoc * [alex](https://github.com/get-alex/alex) * [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell) * [languagetool](https://languagetool.org/) :floppy_disk: * [proselint](http://proselint.com/) * [redpen](http://redpen.cc/) * [textlint](https://textlint.github.io/) * [vale](https://github.com/ValeLint/vale) * [write-good](https://github.com/btford/write-good) * ASM * [gcc](https://gcc.gnu.org) * [llvm-mc](https://llvm.org) * Astro * [eslint](http://eslint.org/) * [prettier](https://github.com/prettier/prettier) * AVRA * [avra](https://github.com/Ro5bert/avra) * Awk * [gawk](https://www.gnu.org/software/gawk/) * Bash * [bashate](https://github.com/openstack/bashate) * [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell) * [language-server](https://github.com/mads-hartmann/bash-language-server) * shell [-n flag](https://www.gnu.org/software/bash/manual/bash.html#index-set) * [shellcheck](https://www.shellcheck.net/) * [shfmt](https://github.com/mvdan/sh) * Bats * [shellcheck](https://www.shellcheck.net/) * Bazel * [buildifier](https://github.com/bazelbuild/buildtools) * BibTeX * [bibclean](http://ftp.math.utah.edu/pub/bibclean/) * Bicep * [bicep](https://github.com/Azure/bicep) :floppy_disk: * BitBake * [oelint-adv](https://github.com/priv-kweihmann/oelint-adv) * Bourne Shell * shell [-n flag](http://linux.die.net/man/1/sh) * [shellcheck](https://www.shellcheck.net/) * [shfmt](https://github.com/mvdan/sh) * C * [astyle](http://astyle.sourceforge.net/) * [ccls](https://github.com/MaskRay/ccls) * [clang](http://clang.llvm.org/) * [clang-format](https://clang.llvm.org/docs/ClangFormat.html) * [clangcheck](http://clang.llvm.org/docs/ClangCheck.html) :floppy_disk: * [clangd](https://clang.llvm.org/extra/clangd.html) * [clangtidy](http://clang.llvm.org/extra/clang-tidy/) :floppy_disk: * [cppcheck](http://cppcheck.sourceforge.net) * [cpplint](https://github.com/cpplint/cpplint) * [cquery](https://github.com/cquery-project/cquery) * [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell) * [flawfinder](https://www.dwheeler.com/flawfinder/) * [gcc](https://gcc.gnu.org/) * [uncrustify](https://github.com/uncrustify/uncrustify) * C# * [clang-format](https://clang.llvm.org/docs/ClangFormat.html) * [csc](http://www.mono-project.com/docs/about-mono/languages/csharp/) :floppy_disk: see:`help ale-cs-csc` for details and configuration * [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell) * [dotnet-format](https://github.com/dotnet/format) * [mcs](http://www.mono-project.com/docs/about-mono/languages/csharp/) see:`help ale-cs-mcs` for details * [mcsc](http://www.mono-project.com/docs/about-mono/languages/csharp/) :floppy_disk: see:`help ale-cs-mcsc` for details and configuration * [uncrustify](https://github.com/uncrustify/uncrustify) * C++ (filetype cpp) * [astyle](http://astyle.sourceforge.net/) * [ccls](https://github.com/MaskRay/ccls) * [clang](http://clang.llvm.org/) * [clang-format](https://clang.llvm.org/docs/ClangFormat.html) * [clangcheck](http://clang.llvm.org/docs/ClangCheck.html) :floppy_disk: * [clangd](https://clang.llvm.org/extra/clangd.html) * [clangtidy](http://clang.llvm.org/extra/clang-tidy/) :floppy_disk: * [clazy](https://github.com/KDE/clazy) :floppy_disk: * [cppcheck](http://cppcheck.sourceforge.net) * [cpplint](https://github.com/google/styleguide/tree/gh-pages/cpplint) :floppy_disk: * [cquery](https://github.com/cquery-project/cquery) * [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell) * [flawfinder](https://www.dwheeler.com/flawfinder/) * [gcc](https://gcc.gnu.org/) * [uncrustify](https://github.com/uncrustify/uncrustify) * C3 * [c3lsp](https://github.com/pherrymason/c3-lsp) * Cairo * [scarb](https://docs.swmansion.com/scarb/) :floppy_disk: * [starknet](https://starknet.io/docs) * Chef * [cookstyle](https://docs.chef.io/cookstyle.html) * [foodcritic](http://www.foodcritic.io/) :floppy_disk: * Clojure * [clj-kondo](https://github.com/borkdude/clj-kondo) * [cljfmt](https://github.com/weavejester/cljfmt) * [joker](https://github.com/candid82/joker) * CloudFormation * [cfn-python-lint](https://github.com/awslabs/cfn-python-lint) * CMake * [cmake-format](https://github.com/cheshirekow/cmake_format) * [cmake-lint](https://github.com/cheshirekow/cmake_format) * [cmakelint](https://github.com/cmake-lint/cmake-lint) * CoffeeScript * [coffee](http://coffeescript.org/) * [coffeelint](https://www.npmjs.com/package/coffeelint) * Crystal * [ameba](https://github.com/veelenga/ameba) :floppy_disk: * [crystal](https://crystal-lang.org/) :floppy_disk: * CSS * [VSCode CSS language server](https://github.com/hrsh7th/vscode-langservers-extracted) * [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell) * [css-beautify](https://github.com/beautify-web/js-beautify) * [csslint](http://csslint.net/) * [fecs](http://fecs.baidu.com/) * [prettier](https://github.com/prettier/prettier) * [stylelint](https://github.com/stylelint/stylelint) * Cucumber * [cucumber](https://cucumber.io/) * CUDA * [clang-format](https://clang.llvm.org/docs/ClangFormat.html) * [clangd](https://clang.llvm.org/extra/clangd.html) * [nvcc](http://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/index.html) :floppy_disk: * Cypher * [cypher-lint](https://github.com/cleishm/libcypher-parser) * Cython (pyrex filetype) * [cython](http://cython.org/) * D * [dfmt](https://github.com/dlang-community/dfmt) * [dls](https://github.com/d-language-server/dls) * [dmd](https://dlang.org/dmd-linux.html) * [uncrustify](https://github.com/uncrustify/uncrustify) * Dafny * [dafny](https://rise4fun.com/Dafny) :floppy_disk: * Dart * [analysis_server](https://github.com/dart-lang/sdk/tree/master/pkg/analysis_server) * [dart-analyze](https://github.com/dart-lang/sdk/tree/master/pkg/analyzer_cli) :floppy_disk: * [dart-format](https://github.com/dart-lang/sdk/tree/master/utils/dartfmt) * [dartfmt](https://github.com/dart-lang/sdk/tree/master/utils/dartfmt) * [language_server](https://github.com/natebosch/dart_language_server) * desktop * [desktop-file-validate](https://www.freedesktop.org/wiki/Software/desktop-file-utils/) * Dhall * [dhall-format](https://github.com/dhall-lang/dhall-lang) * [dhall-freeze](https://github.com/dhall-lang/dhall-lang) * [dhall-lint](https://github.com/dhall-lang/dhall-lang) * Dockerfile * [dockerfile_lint](https://github.com/projectatomic/dockerfile_lint) * [dockerlinter](https://github.com/buddy-works/dockerfile-linter) * [dprint](https://dprint.dev) * [hadolint](https://github.com/hadolint/hadolint) * Elixir * [credo](https://github.com/rrrene/credo) * [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell) :warning: * [dialyxir](https://github.com/jeremyjh/dialyxir) * [dogma](https://github.com/lpil/dogma) :floppy_disk: * [elixir-ls](https://github.com/elixir-lsp/elixir-ls) :warning: * [lexical](https://github.com/lexical-lsp/lexical) :warning: * [mix](https://hexdocs.pm/mix/Mix.html) :warning: :floppy_disk: * Elm * [elm-format](https://github.com/avh4/elm-format) * [elm-ls](https://github.com/elm-tooling/elm-language-server) * [elm-make](https://github.com/elm/compiler) * Erb * [erb](https://apidock.com/ruby/ERB) * [erb-formatter](https://github.com/nebulab/erb-formatter) * [erblint](https://github.com/Shopify/erb-lint) * [erubi](https://github.com/jeremyevans/erubi) * [erubis](https://github.com/kwatch/erubis) * [htmlbeautifier](https://github.com/threedaymonk/htmlbeautifier) * [ruumba](https://github.com/ericqweinstein/ruumba) * Erlang * [SyntaxErl](https://github.com/ten0s/syntaxerl) * [dialyzer](http://erlang.org/doc/man/dialyzer.html) :floppy_disk: * [elvis](https://github.com/inaka/elvis) :floppy_disk: * [erlang-mode](https://www.erlang.org/doc/apps/tools/erlang_mode_chapter.html) (The Erlang mode for Emacs) * [erlang_ls](https://github.com/erlang-ls/erlang_ls) * [erlc](http://erlang.org/doc/man/erlc.html) * [erlfmt](https://github.com/WhatsApp/erlfmt) * Fish * fish [-n flag](https://linux.die.net/man/1/fish) * [fish_indent](https://fishshell.com/docs/current/cmds/fish_indent.html) * Fortran * [gcc](https://gcc.gnu.org/) * [language_server](https://github.com/hansec/fortran-language-server) * Fountain * [proselint](http://proselint.com/) * FusionScript * [fusion-lint](https://github.com/RyanSquared/fusionscript) * Git Commit Messages * [gitlint](https://github.com/jorisroovers/gitlint) * Gleam * [gleam_format](https://github.com/gleam-lang/gleam) * [gleamlsp](https://github.com/gleam-lang/gleam) * GLSL * [glslang](https://github.com/KhronosGroup/glslang) * [glslls](https://github.com/svenstaro/glsl-language-server) * Go * [bingo](https://github.com/saibing/bingo) :warning: * [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell) :warning: * [go build](https://golang.org/cmd/go/) :warning: :floppy_disk: * [go mod](https://golang.org/cmd/go/) :warning: :floppy_disk: * [go vet](https://golang.org/cmd/vet/) :floppy_disk: * [gofmt](https://golang.org/cmd/gofmt/) * [gofumpt](https://github.com/mvdan/gofumpt) * [goimports](https://godoc.org/golang.org/x/tools/cmd/goimports) :warning: * [golangci-lint](https://github.com/golangci/golangci-lint) :warning: :floppy_disk: * [golangserver](https://github.com/sourcegraph/go-langserver) :warning: * [golines](https://github.com/segmentio/golines) * [gopls](https://github.com/golang/go/wiki/gopls) * [gosimple](https://github.com/dominikh/go-tools/tree/master/cmd/gosimple) :warning: :floppy_disk: * [gotype](https://godoc.org/golang.org/x/tools/cmd/gotype) :warning: :floppy_disk: * [revive](https://github.com/mgechev/revive) :warning: :floppy_disk: * [staticcheck](https://github.com/dominikh/go-tools/tree/master/cmd/staticcheck) :warning: :floppy_disk: * GraphQL * [eslint](http://eslint.org/) * [gqlint](https://github.com/happylinks/gqlint) * [prettier](https://github.com/prettier/prettier) * Groovy * [npm-groovy-lint](https://github.com/nvuillam/npm-groovy-lint) * Hack * [hack](http://hacklang.org/) * [hackfmt](https://github.com/facebook/hhvm/tree/master/hphp/hack/hackfmt) * [hhast](https://github.com/hhvm/hhast) :warning: (see `:help ale-integration-hack`) * Haml * [haml-lint](https://github.com/brigade/haml-lint) * Handlebars * [ember-template-lint](https://github.com/rwjblue/ember-template-lint) * Haskell * [brittany](https://github.com/lspitzner/brittany) * [cabal-ghc](https://www.haskell.org/cabal/) * [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell) * [floskell](https://github.com/ennocramer/floskell) * [fourmolu](https://github.com/fourmolu/fourmolu) * [ghc](https://www.haskell.org/ghc/) * [ghc-mod](https://github.com/DanielG/ghc-mod) * [hdevtools](https://hackage.haskell.org/package/hdevtools) * [hfmt](https://github.com/danstiner/hfmt) * [hie](https://github.com/haskell/haskell-ide-engine) * [hindent](https://hackage.haskell.org/package/hindent) * [hlint](https://hackage.haskell.org/package/hlint) * [hls](https://github.com/haskell/haskell-language-server) * [ormolu](https://github.com/tweag/ormolu) * [stack-build](https://haskellstack.org/) :floppy_disk: * [stack-ghc](https://haskellstack.org/) * [stylish-haskell](https://github.com/jaspervdj/stylish-haskell) * HCL * [packer-fmt](https://github.com/hashicorp/packer) * [terraform-fmt](https://github.com/hashicorp/terraform) * HTML * [VSCode HTML language server](https://github.com/hrsh7th/vscode-langservers-extracted) * [alex](https://github.com/get-alex/alex) * [angular](https://www.npmjs.com/package/@angular/language-server) * [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell) * [djlint](https://www.djlint.com/) * [eslint](https://github.com/BenoitZugmeyer/eslint-plugin-html) * [fecs](http://fecs.baidu.com/) * [html-beautify](https://beautifier.io/) * [htmlhint](http://htmlhint.com/) * [prettier](https://github.com/prettier/prettier) * [proselint](http://proselint.com/) * [rustywind](https://github.com/avencera/rustywind) * [tidy](http://www.html-tidy.org/) * [write-good](https://github.com/btford/write-good) * Hurl * [hurlfmt](https://hurl.dev) * Idris * [idris](http://www.idris-lang.org/) * Ink * [ink-language-server](https://github.com/ephread/ink-language-server) * Inko * [inko](https://inko-lang.org/) :floppy_disk: * ISPC * [ispc](https://ispc.github.io/) :floppy_disk: * Java * [PMD](https://pmd.github.io/) * [checkstyle](http://checkstyle.sourceforge.net) :floppy_disk: * [clang-format](https://clang.llvm.org/docs/ClangFormat.html) * [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell) * [eclipselsp](https://github.com/eclipse/eclipse.jdt.ls) * [google-java-format](https://github.com/google/google-java-format) * [javac](http://www.oracle.com/technetwork/java/javase/downloads/index.html) * [javalsp](https://github.com/georgewfraser/vscode-javac) * [uncrustify](https://github.com/uncrustify/uncrustify) * JavaScript * [biome](https://biomejs.dev/) * [clang-format](https://clang.llvm.org/docs/ClangFormat.html) * [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell) * [deno](https://deno.land/) * [dprint](https://dprint.dev/) * [eslint](http://eslint.org/) * [fecs](http://fecs.baidu.com/) * [flow](https://flowtype.org/) * [jscs](https://jscs-dev.github.io/) * [jshint](http://jshint.com/) * [prettier](https://github.com/prettier/prettier) * [prettier-eslint](https://github.com/prettier/prettier-eslint-cli) * [prettier-standard](https://github.com/sheerun/prettier-standard) * [standard](http://standardjs.com/) * [tsserver](https://github.com/Microsoft/TypeScript/wiki/Standalone-Server-%28tsserver%29) * [xo](https://github.com/sindresorhus/xo) * JSON * [VSCode JSON language server](https://github.com/hrsh7th/vscode-langservers-extracted) * [biome](https://biomejs.dev/) * [clang-format](https://clang.llvm.org/docs/ClangFormat.html) * [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell) :warning: * [dprint](https://dprint.dev) * [eslint](http://eslint.org/) :warning: * [fixjson](https://github.com/rhysd/fixjson) * [jq](https://stedolan.github.io/jq/) :warning: * [json.tool](https://docs.python.org/3/library/json.html#module-json.tool) :warning: * [jsonlint](https://github.com/zaach/jsonlint) * [prettier](https://github.com/prettier/prettier) * [spectral](https://github.com/stoplightio/spectral) * JSON5 * [eslint](http://eslint.org/) :warning: * JSONC * [biome](https://biomejs.dev/) * [eslint](http://eslint.org/) :warning: * Jsonnet * [jsonnet-lint](https://jsonnet.org/learning/tools.html) * [jsonnetfmt](https://jsonnet.org/learning/tools.html) * Julia * [languageserver](https://github.com/JuliaEditorSupport/LanguageServer.jl) * Kotlin * [kotlinc](https://kotlinlang.org) :floppy_disk: * [ktlint](https://ktlint.github.io) * [languageserver](https://github.com/fwcd/KotlinLanguageServer) see `:help ale-integration-kotlin` for configuration instructions * LaTeX * [alex](https://github.com/get-alex/alex) * [chktex](http://www.nongnu.org/chktex/) * [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell) * [lacheck](https://www.ctan.org/pkg/lacheck) * [proselint](http://proselint.com/) * [redpen](http://redpen.cc/) * [texlab](https://texlab.netlify.com) * [textlint](https://textlint.github.io/) * [vale](https://github.com/ValeLint/vale) * [write-good](https://github.com/btford/write-good) * Less * [lessc](https://www.npmjs.com/package/less) * [prettier](https://github.com/prettier/prettier) * [stylelint](https://github.com/stylelint/stylelint) * LLVM * [llc](https://llvm.org/docs/CommandGuide/llc.html) * Lua * [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell) * [lua-format](https://github.com/Koihik/LuaFormatter) * [lua-language-server](https://github.com/LuaLS/lua-language-server) * [luac](https://www.lua.org/manual/5.1/luac.html) * [luacheck](https://github.com/mpeterv/luacheck) * [luafmt](https://github.com/trixnz/lua-fmt) * [selene](https://github.com/Kampfkarren/selene) * [stylua](https://github.com/johnnymorganz/stylua) * Mail * [alex](https://github.com/get-alex/alex) * [languagetool](https://languagetool.org/) :floppy_disk: * [proselint](http://proselint.com/) * [vale](https://github.com/ValeLint/vale) * Make * [checkmake](https://github.com/mrtazz/checkmake) * Markdown * [alex](https://github.com/get-alex/alex) * [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell) * [languagetool](https://languagetool.org/) :floppy_disk: * [markdownlint](https://github.com/DavidAnson/markdownlint) :floppy_disk: * [marksman](https://github.com/artempyanykh/marksman) * [mdl](https://github.com/mivok/markdownlint) * [pandoc](https://pandoc.org) * [prettier](https://github.com/prettier/prettier) * [proselint](http://proselint.com/) * [pymarkdown](https://github.com/jackdewinter/pymarkdown) * [redpen](http://redpen.cc/) * [remark-lint](https://github.com/wooorm/remark-lint) * [textlint](https://textlint.github.io/) * [vale](https://github.com/ValeLint/vale) * [write-good](https://github.com/btford/write-good) * MATLAB * [mlint](https://www.mathworks.com/help/matlab/ref/mlint.html) * Mercury * [mmc](http://mercurylang.org) :floppy_disk: * NASM * [nasm](https://www.nasm.us/) :floppy_disk: * Nickel * [nickel_format](https://github.com/tweag/nickel#formatting) * Nim * [nim check](https://nim-lang.org/docs/nimc.html) :floppy_disk: * [nimlsp](https://github.com/PMunch/nimlsp) * nimpretty * nix * [alejandra](https://github.com/kamadorueda/alejandra) * [deadnix](https://github.com/astro/deadnix) * [nix-instantiate](http://nixos.org/nix/manual/#sec-nix-instantiate) * [nixfmt](https://github.com/serokell/nixfmt) * [nixpkgs-fmt](https://github.com/nix-community/nixpkgs-fmt) * [rnix-lsp](https://github.com/nix-community/rnix-lsp) * [statix](https://github.com/nerdypepper/statix) * nroff * [alex](https://github.com/get-alex/alex) * [proselint](http://proselint.com/) * [write-good](https://github.com/btford/write-good) * Objective-C * [ccls](https://github.com/MaskRay/ccls) * [clang](http://clang.llvm.org/) * [clang-format](https://clang.llvm.org/docs/ClangFormat.html) * [clangd](https://clang.llvm.org/extra/clangd.html) * [uncrustify](https://github.com/uncrustify/uncrustify) * Objective-C++ * [clang](http://clang.llvm.org/) * [clangd](https://clang.llvm.org/extra/clangd.html) * [uncrustify](https://github.com/uncrustify/uncrustify) * OCaml * [dune](https://dune.build/) * [merlin](https://github.com/the-lambda-church/merlin) see `:help ale-ocaml-merlin` for configuration instructions * [ocamlformat](https://github.com/ocaml-ppx/ocamlformat) * [ocamllsp](https://github.com/ocaml/ocaml-lsp) * [ocp-indent](https://github.com/OCamlPro/ocp-indent) * [ols](https://github.com/freebroccolo/ocaml-language-server) * Odin * [ols](https://github.com/DanielGavin/ols) * OpenApi * [ibm_validator](https://github.com/IBM/openapi-validator) * [prettier](https://github.com/prettier/prettier) * [yamllint](https://yamllint.readthedocs.io/) * OpenSCAD * [SCA2D](https://gitlab.com/bath_open_instrumentation_group/sca2d) :floppy_disk: * [scadformat](https://github.com/hugheaves/scadformat) * Packer (HCL) * [packer-fmt-fixer](https://github.com/hashicorp/packer) * Pascal * [ptop](https://www.freepascal.org/tools/ptop.var) * Pawn * [uncrustify](https://github.com/uncrustify/uncrustify) * Perl * [perl -c](https://perl.org/) :warning: * [perl-critic](https://metacpan.org/pod/Perl::Critic) * [perltidy](https://metacpan.org/pod/distribution/Perl-Tidy/bin/perltidy) * Perl6 * [perl6 -c](https://perl6.org) :warning: * PHP * [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell) * [intelephense](https://github.com/bmewburn/intelephense-docs) * [langserver](https://github.com/felixfbecker/php-language-server) * [phan](https://github.com/phan/phan) see `:help ale-php-phan` to instructions * [php -l](https://secure.php.net/) * [php-cs-fixer](https://cs.symfony.com) * [phpactor](https://github.com/phpactor/phpactor) * [phpcbf](https://github.com/squizlabs/PHP_CodeSniffer) * [phpcs](https://github.com/squizlabs/PHP_CodeSniffer) * [phpmd](https://phpmd.org) * [phpstan](https://github.com/phpstan/phpstan) * [pint](https://github.com/laravel/pint) :beer: * [psalm](https://getpsalm.org) :floppy_disk: * [tlint](https://github.com/tightenco/tlint) * PO * [alex](https://github.com/get-alex/alex) * [msgfmt](https://www.gnu.org/software/gettext/manual/html_node/msgfmt-Invocation.html) * [proselint](http://proselint.com/) * [write-good](https://github.com/btford/write-good) * Pod * [alex](https://github.com/get-alex/alex) * [proselint](http://proselint.com/) * [write-good](https://github.com/btford/write-good) * Pony * [ponyc](https://github.com/ponylang/ponyc) * PowerShell * [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell) * [powershell](https://github.com/PowerShell/PowerShell) * [psscriptanalyzer](https://github.com/PowerShell/PSScriptAnalyzer) * Prolog * [swipl](https://github.com/SWI-Prolog/swipl-devel) * proto * [buf-format](https://github.com/bufbuild/buf) :floppy_disk: * [buf-lint](https://github.com/bufbuild/buf) :floppy_disk: * [clang-format](https://clang.llvm.org/docs/ClangFormat.html) * [protoc-gen-lint](https://github.com/ckaznocha/protoc-gen-lint) :floppy_disk: * [protolint](https://github.com/yoheimuta/protolint) :floppy_disk: * Pug * [pug-lint](https://github.com/pugjs/pug-lint) * Puppet * [languageserver](https://github.com/lingua-pupuli/puppet-editor-services) * [puppet](https://puppet.com) * [puppet-lint](https://puppet-lint.com) * PureScript * [purescript-language-server](https://github.com/nwolverson/purescript-language-server) * [purs-tidy](https://github.com/natefaubion/purescript-tidy) * [purty](https://gitlab.com/joneshf/purty) * Python * [autoflake](https://github.com/myint/autoflake) :floppy_disk: * [autoimport](https://lyz-code.github.io/autoimport/) * [autopep8](https://github.com/hhatto/autopep8) * [bandit](https://github.com/PyCQA/bandit) :warning: * [black](https://github.com/psf/black) * [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell) * [flake8](http://flake8.pycqa.org/en/latest/) * [flakehell](https://github.com/flakehell/flakehell) * [isort](https://github.com/timothycrosley/isort) * [mypy](http://mypy-lang.org/) * [prospector](https://github.com/PyCQA/prospector) :warning: :floppy_disk: * [pycln](https://github.com/hadialqattan/pycln) * [pycodestyle](https://github.com/PyCQA/pycodestyle) :warning: * [pydocstyle](https://www.pydocstyle.org/) :warning: * [pyflakes](https://github.com/PyCQA/pyflakes) * [pyflyby](https://github.com/deshaw/pyflyby) :warning: * [pylama](https://github.com/klen/pylama) :floppy_disk: * [pylint](https://www.pylint.org/) :floppy_disk: * [pylsp](https://github.com/python-lsp/python-lsp-server) :warning: * [pyre](https://github.com/facebook/pyre-check) :warning: * [pyright](https://github.com/microsoft/pyright) * [refurb](https://github.com/dosisod/refurb) :floppy_disk: * [reorder-python-imports](https://github.com/asottile/reorder_python_imports) * [ruff](https://github.com/charliermarsh/ruff) * [ruff-format](https://docs.astral.sh/ruff/formatter/) * [unimport](https://github.com/hakancelik96/unimport) * [vulture](https://github.com/jendrikseipp/vulture) :warning: :floppy_disk: * [yapf](https://github.com/google/yapf) * QML * [qmlfmt](https://github.com/jesperhh/qmlfmt) * [qmllint](https://github.com/qt/qtdeclarative/tree/5.11/tools/qmllint) * R * [languageserver](https://github.com/REditorSupport/languageserver) * [lintr](https://github.com/jimhester/lintr) * [styler](https://github.com/r-lib/styler) * Racket * [racket-langserver](https://github.com/jeapostrophe/racket-langserver/tree/master) * [raco](https://docs.racket-lang.org/raco/) * [raco_fmt](https://docs.racket-lang.org/fmt/) * Re:VIEW * [redpen](http://redpen.cc/) * ReasonML * [merlin](https://github.com/the-lambda-church/merlin) see `:help ale-reasonml-ols` for configuration instructions * [ols](https://github.com/freebroccolo/ocaml-language-server) * [reason-language-server](https://github.com/jaredly/reason-language-server) * [refmt](https://github.com/reasonml/reason-cli) * Rego * [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell) * [opacheck](https://www.openpolicyagent.org/docs/latest/cli/#opa-check) * [opafmt](https://www.openpolicyagent.org/docs/latest/cli/#opa-fmt) * reStructuredText * [alex](https://github.com/get-alex/alex) * [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell) * [proselint](http://proselint.com/) * [redpen](http://redpen.cc/) * [rstcheck](https://github.com/myint/rstcheck) * [textlint](https://textlint.github.io/) * [vale](https://github.com/ValeLint/vale) * [write-good](https://github.com/btford/write-good) * Robot * [rflint](https://github.com/boakley/robotframework-lint) * RPM spec * [rpmlint](https://github.com/rpm-software-management/rpmlint) :warning: (see `:help ale-integration-spec`) * Ruby * [brakeman](http://brakemanscanner.org/) :floppy_disk: * [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell) * [debride](https://github.com/seattlerb/debride) * [packwerk](https://github.com/Shopify/packwerk) :floppy_disk: * [prettier](https://github.com/prettier/plugin-ruby) * [rails_best_practices](https://github.com/flyerhzm/rails_best_practices) :floppy_disk: * [reek](https://github.com/troessner/reek) * [rubocop](https://github.com/bbatsov/rubocop) * [ruby](https://www.ruby-lang.org) * [rubyfmt](https://github.com/fables-tales/rubyfmt) * [rufo](https://github.com/ruby-formatter/rufo) * [solargraph](https://solargraph.org) * [sorbet](https://github.com/sorbet/sorbet) * [standardrb](https://github.com/testdouble/standard) * [steep](https://github.com/soutaro/steep) * [syntax_tree](https://github.com/ruby-syntax-tree/syntax_tree) * Rust * [cargo](https://github.com/rust-lang/cargo) :floppy_disk: (see `:help ale-integration-rust` for configuration instructions) * [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell) * [rls](https://github.com/rust-lang-nursery/rls) :warning: * [rust-analyzer](https://github.com/rust-analyzer/rust-analyzer) :warning: * [rustc](https://www.rust-lang.org/) :warning: * [rustfmt](https://github.com/rust-lang-nursery/rustfmt) * Salt * [salt-lint](https://github.com/warpnet/salt-lint) * Sass * [sass-lint](https://www.npmjs.com/package/sass-lint) * [stylelint](https://github.com/stylelint/stylelint) * Scala * [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell) * [fsc](https://www.scala-lang.org/old/sites/default/files/linuxsoft_archives/docu/files/tools/fsc.html) * [metals](https://scalameta.org/metals/) * [sbtserver](https://www.scala-sbt.org/1.x/docs/sbt-server.html) * [scalac](http://scala-lang.org) * [scalafmt](https://scalameta.org/scalafmt/) * [scalastyle](http://www.scalastyle.org) * SCSS * [prettier](https://github.com/prettier/prettier) * [sass-lint](https://www.npmjs.com/package/sass-lint) * [scss-lint](https://github.com/brigade/scss-lint) * [stylelint](https://github.com/stylelint/stylelint) * Slim * [slim-lint](https://github.com/sds/slim-lint) * SML * [smlnj](http://www.smlnj.org/) * Solidity * [forge](https://github.com/foundry-rs/forge) * [solc](https://solidity.readthedocs.io/) * [solhint](https://github.com/protofire/solhint) * [solium](https://github.com/duaraghav8/Solium) * SQL * [dprint](https://dprint.dev) * [pgformatter](https://github.com/darold/pgFormatter) * [sql-lint](https://github.com/joereynolds/sql-lint) * [sqlfluff](https://github.com/sqlfluff/sqlfluff) * [sqlfmt](https://github.com/jackc/sqlfmt) * [sqlformat](https://github.com/andialbrecht/sqlparse) * [sqlint](https://github.com/purcell/sqlint) * Stylus * [stylelint](https://github.com/stylelint/stylelint) * SugarSS * [stylelint](https://github.com/stylelint/stylelint) * Svelte * [prettier](https://github.com/prettier/prettier) * [svelteserver](https://github.com/sveltejs/language-tools/tree/master/packages/language-server) * Swift * [Apple swift-format](https://github.com/apple/swift-format) * [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell) * [sourcekit-lsp](https://github.com/apple/sourcekit-lsp) * [swiftformat](https://github.com/nicklockwood/SwiftFormat) * [swiftlint](https://github.com/realm/SwiftLint) * systemd * [systemd-analyze](https://www.freedesktop.org/software/systemd/man/systemd-analyze.html) :floppy_disk: * Tcl * [nagelfar](http://nagelfar.sourceforge.net) :floppy_disk: * Terraform * [checkov](https://github.com/bridgecrewio/checkov) * [terraform](https://github.com/hashicorp/terraform) * [terraform-fmt-fixer](https://github.com/hashicorp/terraform) * [terraform-ls](https://github.com/hashicorp/terraform-ls) * [terraform-lsp](https://github.com/juliosueiras/terraform-lsp) * [tflint](https://github.com/wata727/tflint) * [tfsec](https://github.com/aquasecurity/tfsec) * Texinfo * [alex](https://github.com/get-alex/alex) * [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell) * [proselint](http://proselint.com/) * [write-good](https://github.com/btford/write-good) * Text * [alex](https://github.com/get-alex/alex) :warning: * [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell) * [languagetool](https://languagetool.org/) :floppy_disk: * [proselint](http://proselint.com/) :warning: * [redpen](http://redpen.cc/) :warning: * [textlint](https://textlint.github.io/) :warning: * [vale](https://github.com/ValeLint/vale) :warning: * [write-good](https://github.com/btford/write-good) :warning: * Thrift * [thrift](http://thrift.apache.org/) * [thriftcheck](https://github.com/pinterest/thriftcheck) * TOML * [dprint](https://dprint.dev) * TypeScript * [biome](https://biomejs.dev/) * [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell) * [deno](https://deno.land/) * [dprint](https://dprint.dev/) * [eslint](http://eslint.org/) * [fecs](http://fecs.baidu.com/) * [prettier](https://github.com/prettier/prettier) * [standard](http://standardjs.com/) * [tslint](https://github.com/palantir/tslint) * [tsserver](https://github.com/Microsoft/TypeScript/wiki/Standalone-Server-%28tsserver%29) * typecheck * V * [v](https://github.com/vlang/v/) :floppy_disk: * [vfmt](https://github.com/vlang/v/) * VALA * [uncrustify](https://github.com/uncrustify/uncrustify) * [vala_lint](https://github.com/vala-lang/vala-lint) :floppy_disk: * Verilog * [hdl-checker](https://pypi.org/project/hdl-checker) * [iverilog](https://github.com/steveicarus/iverilog) * [slang](https://github.com/MikePopoloski/slang) * [verilator](http://www.veripool.org/projects/verilator/wiki/Intro) * [vlog](https://www.mentor.com/products/fv/questa/) * [xvlog](https://www.xilinx.com/products/design-tools/vivado.html) * [yosys](http://www.clifford.at/yosys/) :floppy_disk: * VHDL * [ghdl](https://github.com/ghdl/ghdl) * [vcom](https://www.mentor.com/products/fv/questa/) * [xvhdl](https://www.xilinx.com/products/design-tools/vivado.html) * Vim * [vimls](https://github.com/iamcco/vim-language-server) * [vint](https://github.com/Kuniwak/vint) * Vim help * [alex](https://github.com/get-alex/alex) :warning: * [proselint](http://proselint.com/) :warning: * [write-good](https://github.com/btford/write-good) :warning: * Vue * [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell) * [prettier](https://github.com/prettier/prettier) * [vls](https://github.com/vuejs/vetur/tree/master/server) * [volar](https://github.com/johnsoncodehk/volar) * WGSL * [naga](https://github.com/gfx-rs/naga) * XHTML * [alex](https://github.com/get-alex/alex) * [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell) * [proselint](http://proselint.com/) * [write-good](https://github.com/btford/write-good) * XML * [xmllint](http://xmlsoft.org/xmllint.html) * YAML * [actionlint](https://github.com/rhysd/actionlint) * [circleci](https://circleci.com/docs/2.0/local-cli) :floppy_disk: :warning: * [gitlablint](https://github.com/elijah-roberts/gitlab-lint) * [prettier](https://github.com/prettier/prettier) * [spectral](https://github.com/stoplightio/spectral) * [swaglint](https://github.com/byCedric/swaglint) :warning: * [yaml-language-server](https://github.com/redhat-developer/yaml-language-server) * [yamlfix](https://lyz-code.github.io/yamlfix) * [yamlfmt](https://github.com/google/yamlfmt) * [yamllint](https://yamllint.readthedocs.io/) * [yq](https://github.com/mikefarah/yq) * YANG * [yang-lsp](https://github.com/theia-ide/yang-lsp) * Yara * [yls](https://github.com/avast/yls) * Zeek * [zeek](http://zeek.org) :floppy_disk: * Zig * [zigfmt](https://github.com/ziglang/zig) * [zls](https://github.com/zigtools/zls) ale-4.0.0/syntax/000077500000000000000000000000001476501472200136125ustar00rootroot00000000000000ale-4.0.0/syntax/ale-fix-suggest.vim000066400000000000000000000005111476501472200173300ustar00rootroot00000000000000if exists('b:current_syntax') finish endif syn match aleFixerComment /^.*$/ syn match aleFixerName /\(^ *\|, \)'[^']*'/ syn match aleFixerHelp /^See :help ale-fix-configuration/ hi def link aleFixerComment Comment hi def link aleFixerName String hi def link aleFixerHelp Statement let b:current_syntax = 'ale-fix-suggest' ale-4.0.0/syntax/ale-info.vim000066400000000000000000000023271476501472200160250ustar00rootroot00000000000000if exists('b:current_syntax') finish endif " Exhaustively list different ALE Info directives to match here. " This should hopefully avoid matching too eagerly. syn match aleInfoDirective /^ *Current Filetype:/ syn match aleInfoDirective /^ *Available Linters:/ syn match aleInfoDirective /^ *Enabled Linters:/ syn match aleInfoDirective /^ *Ignored Linters:/ syn match aleInfoDirective /^ *Suggested Fixers:/ syn match aleInfoDirective /^ *Command History:/ syn match aleCommandNoOutput /^<<>>$/ hi def link aleInfoDirective Title hi def link aleInfoDirective Title hi def link aleCommandNoOutput Comment " Use Vim syntax highlighting for Vim options. unlet! b:current_syntax syntax include @srcVim syntax/vim.vim syntax region aleInfoVimRegionLinter matchgroup=aleInfoDirective start="^ *Linter Variables:$" end="^ $" contains=@srcVim syntax region aleInfoVimRegionGlobal matchgroup=aleInfoDirective start="^ *Global Variables:$" end="^ $" contains=@srcVim unlet! b:current_syntax syntax include @srcAleFixSuggest syntax/ale-fix-suggest.vim syntax region aleInfoFixSuggestRegion matchgroup=aleInfoDirective start="^ *Suggested Fixers:$" end="^ $" contains=@srcAleFixSuggest let b:current_syntax = 'ale-info' ale-4.0.0/syntax/ale-preview-selection.vim000066400000000000000000000004321476501472200205310ustar00rootroot00000000000000if exists('b:current_syntax') finish endif syn match alePreviewSelectionFilename /\v^([a-zA-Z]?:?[^:]+)/ syn match alPreviewNumber /\v:\d+:\d+$/ hi def link alePreviewSelectionFilename String hi def link alePreviewNumber Number let b:current_syntax = 'ale-preview-selection' ale-4.0.0/test-files/000077500000000000000000000000001476501472200143435ustar00rootroot00000000000000ale-4.0.0/test-files/python/000077500000000000000000000000001476501472200156645ustar00rootroot00000000000000ale-4.0.0/test-files/python/no_uv/000077500000000000000000000000001476501472200170125ustar00rootroot00000000000000ale-4.0.0/test-files/python/no_uv/whatever.py000066400000000000000000000000001476501472200211770ustar00rootroot00000000000000