Compare commits

..

2 Commits

Author SHA1 Message Date
Felix Maurer
f0fa137721 Fix end line number when it exceeds the file (#4130)
If the end of the error exceeds the file, set it to the last line,
similarly as it is done with the beginning of the error.
2022-04-01 10:42:40 +01:00
yoshi1123
7e2342ab52 Fix :ALEImport column position
Fix :ALEImport column position so it works with more language servers.

Co-authored-by: w0rp <devw0rp@gmail.com>
2022-03-20 13:21:21 +00:00
295 changed files with 730 additions and 5325 deletions

View File

@@ -40,9 +40,7 @@ Are you having trouble configuring ALE? Try asking for help on [Stack Exchange](
2. Then this happened. 2. Then this happened.
### :ALEInfo ### :ALEInfo
<details>
<summary>Expand</summary> <!-- Paste the output of :ALEInfo here. Try :ALEInfoToClipboard -->
<!-- Paste the output of :ALEInfo here. Try :ALEInfoToClipboard --> <!-- Make sure to run :ALEInfo from the buffer where the bug occurred. -->
<!-- Make sure to run :ALEInfo from the buffer where the bug occurred. --> <!-- Read the output. You might figure out what went wrong yourself. -->
<!-- Read the output. You might figure out what went wrong yourself. -->
</details>

View File

@@ -27,9 +27,10 @@ jobs:
matrix: matrix:
vim-version: vim-version:
- '--vim-80-only' - '--vim-80-only'
- '--vim-90-only' - '--vim-82-only'
- '--neovim-02-only' - '--neovim-02-only'
- '--neovim-08-only' - '--neovim-04-only'
- '--neovim-05-only'
- '--linters-only' - '--linters-only'
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2

View File

@@ -1,9 +1,10 @@
FROM testbed/vim:24 FROM testbed/vim:20
RUN install_vim -tag v8.0.0027 -build \ RUN install_vim -tag v8.0.0027 -build \
-tag v9.0.0133 -build \ -tag v8.2.2401 -build \
-tag neovim:v0.2.0 -build \ -tag neovim:v0.2.0 -build \
-tag neovim:v0.8.0 -build -tag neovim:v0.4.4 -build \
-tag neovim:v0.5.0 -build
ENV PACKAGES="\ ENV PACKAGES="\
bash \ bash \
@@ -24,4 +25,4 @@ RUN git clone https://github.com/junegunn/vader.vim vader && \
ARG GIT_VERSION ARG GIT_VERSION
LABEL Version=${GIT_VERSION} LABEL Version=${GIT_VERSION}
LABEL Name=denseanalysis/ale LABEL Name=w0rp/ale

View File

@@ -1,4 +1,4 @@
# Asynchronous Lint Engine [![GitHub Build Status](https://github.com/dense-analysis/ale/workflows/CI/badge.svg)](https://github.com/dense-analysis/ale/actions?query=event%3Apush+workflow%3ACI+branch%3Amaster++) [![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/r0ef1xu8xjmik58d/branch/master?svg=true)](https://ci.appveyor.com/project/dense-analysis/ale) [![Join the Dense Analysis Discord server](https://img.shields.io/badge/chat-Discord-5865F2)](https://discord.gg/5zFD6pQxDk) # Asynchronous Lint Engine [![GitHub Build Status](https://github.com/dense-analysis/ale/workflows/CI/badge.svg)](https://github.com/dense-analysis/ale/actions?query=event%3Apush+workflow%3ACI+branch%3Amaster++) [![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/r0ef1xu8xjmik58d/branch/master?svg=true)](https://ci.appveyor.com/project/dense-analysis/ale) [![Join the chat at https://gitter.im/vim-ale/Lobby](https://badges.gitter.im/vim-ale/Lobby.svg)](https://gitter.im/vim-ale/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
![ALE Logo by Mark Grealish - https://www.bhalash.com/](https://user-images.githubusercontent.com/3518142/59195920-2c339500-8b85-11e9-9c22-f6b7f69637b8.jpg) ![ALE Logo by Mark Grealish - https://www.bhalash.com/](https://user-images.githubusercontent.com/3518142/59195920-2c339500-8b85-11e9-9c22-f6b7f69637b8.jpg)
@@ -359,7 +359,7 @@ See the Vundle documentation for more information.
<a name="installation-with-vim-plug"></a> <a name="installation-with-vim-plug"></a>
### 3.iv. Installation with Vim-Plug ### 3.iiii. Installation with Vim-Plug
You can install this plugin using [Vim-Plug](https://github.com/junegunn/vim-plug) You can install this plugin using [Vim-Plug](https://github.com/junegunn/vim-plug)
by adding the GitHub path for this repository to your `~/.vimrc`: by adding the GitHub path for this repository to your `~/.vimrc`:
@@ -386,8 +386,8 @@ If you are interested in the general direction of the project, check out the
[wiki home page](https://github.com/dense-analysis/ale/wiki). The wiki includes [wiki home page](https://github.com/dense-analysis/ale/wiki). The wiki includes
a Roadmap for the future, and more. a Roadmap for the future, and more.
If you'd liked to discuss ALE and more check out the Dense Analysis Discord If you'd liked to discuss the project more directly, check out the `#vim-ale` channel
server here: https://discord.gg/5zFD6pQxDk on Libera Chat. Web chat is available [here](https://web.libera.chat/#vim-ale).
<a name="faq"></a> <a name="faq"></a>
@@ -931,14 +931,14 @@ If the terminal supports Unicode, you might try setting the value like below, to
make it look nicer. make it look nicer.
```vim ```vim
let g:ale_floating_window_border = ['│', '─', '╭', '╮', '╯', '╰', '│', '─'] let g:ale_floating_window_border = ['│', '─', '╭', '╮', '╯', '╰']
``` ```
Since vim's default uses nice unicode characters when possible, you can trick Since vim's default uses nice unicode characters when possible, you can trick
ale into using that default with ale into using that default with
```vim ```vim
let g:ale_floating_window_border = repeat([''], 8) let g:ale_floating_window_border = repeat([''], 6)
``` ```
<a name="faq-vim-lsp"></a> <a name="faq-vim-lsp"></a>

View File

@@ -1,46 +0,0 @@
" Author: Horacio Sanson <https://github.com/hsanson>
" Description: Support ansible language server https://github.com/ansible/ansible-language-server/
call ale#Set('ansible_language_server_executable', 'ansible-language-server')
call ale#Set('ansible_language_server_config', {})
function! ale_linters#ansible#ansible_language_server#Executable(buffer) abort
return ale#Var(a:buffer, 'ansible_language_server_executable')
endfunction
function! ale_linters#ansible#ansible_language_server#GetCommand(buffer) abort
let l:executable = ale_linters#ansible#ansible_language_server#Executable(a:buffer)
return ale#Escape(l:executable) . ' --stdio'
endfunction
function! ale_linters#ansible#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': 'ansible-language-server',
\ 'lsp': 'stdio',
\ 'executable': function('ale_linters#ansible#ansible_language_server#Executable'),
\ 'command': function('ale_linters#ansible#ansible_language_server#GetCommand'),
\ 'project_root': function('ale_linters#ansible#ansible_language_server#FindProjectRoot'),
\ 'lsp_config': {b -> ale#Var(b, 'ansible_language_server_config')}
\})

View File

@@ -18,30 +18,9 @@ function! ale_linters#ansible#ansible_lint#Handle(buffer, version, lines) abort
endif endif
endfor endfor
let l:version_group = ale#semver#GTE(a:version, [6, 0, 0]) ? '>=6.0.0' : let l:version_group = ale#semver#GTE(a:version, [5, 0, 0]) ? '>=5.0.0' : '<5.0.0'
\ ale#semver#GTE(a:version, [5, 0, 0]) ? '>=5.0.0' :
\ '<5.0.0'
let l:output = [] 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)
call add(l:output, {
\ 'lnum': exists('l:issue.location.lines.begin.column') ? l:issue.location.lines.begin.line :
\ l:issue.location.lines.begin,
\ 'col': exists('l:issue.location.lines.begin.column') ? l:issue.location.lines.begin.column : 0,
\ 'text': l:issue.check_name,
\ 'detail': l:issue.description,
\ 'code': l:issue.severity,
\ 'type': l:error_codes[l:issue.severity],
\})
endif
endfor
endif
if '>=5.0.0' is# l:version_group if '>=5.0.0' is# l:version_group
" Matches patterns line the following: " Matches patterns line the following:
" test.yml:3:148: syntax-check 'var' is not a valid attribute for a Play " test.yml:3:148: syntax-check 'var' is not a valid attribute for a Play
@@ -94,13 +73,10 @@ endfunction
function! ale_linters#ansible#ansible_lint#GetCommand(buffer, version) abort function! ale_linters#ansible#ansible_lint#GetCommand(buffer, version) abort
let l:commands = { 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 --parseable-severity -x yaml %s',
\ '<5.0.0': '%e --nocolor -p %t' \ '<5.0.0': '%e --nocolor -p %t'
\} \}
let l:command = ale#semver#GTE(a:version, [6, 0]) ? l:commands['>=6.0.0'] : let l:command = ale#semver#GTE(a:version, [5, 0]) ? l:commands['>=5.0.0'] : l:commands['<5.0.0']
\ ale#semver#GTE(a:version, [5, 0]) ? l:commands['>=5.0.0'] :
\ l:commands['<5.0.0']
return l:command return l:command
endfunction endfunction

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -3,8 +3,6 @@
call ale#Set('cpp_cc_executable', '<auto>') call ale#Set('cpp_cc_executable', '<auto>')
call ale#Set('cpp_cc_options', '-std=c++14 -Wall') 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 function! ale_linters#cpp#cc#GetExecutable(buffer) abort
let l:executable = ale#Var(a:buffer, 'cpp_cc_executable') let l:executable = ale#Var(a:buffer, 'cpp_cc_executable')
@@ -33,24 +31,12 @@ function! ale_linters#cpp#cc#GetCommand(buffer, output) abort
\ 'g') \ 'g')
endif 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 " -iquote with the directory the file is in makes #include work for
" headers in the same directory. " headers in the same directory.
" "
" `-o /dev/null` or `-o null` is needed to catch all errors, " `-o /dev/null` or `-o null` is needed to catch all errors,
" -fsyntax-only doesn't catch everything. " -fsyntax-only doesn't catch everything.
return '%e -S -x ' . l:lang_flag return '%e -S -x c++'
\ . ' -o ' . g:ale#util#nul_file \ . ' -o ' . g:ale#util#nul_file
\ . ' -iquote %s:h' \ . ' -iquote %s:h'
\ . ale#Pad(l:cflags) \ . ale#Pad(l:cflags)

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,49 +0,0 @@
" Author: Dmitri Vereshchagin <dmitri.vereshchagin@gmail.com>
" Description: LSP linter for Erlang files
call ale#Set('erlang_erlang_ls_executable', 'erlang_ls')
call ale#Set('erlang_erlang_ls_log_dir', '')
call ale#Set('erlang_erlang_ls_log_level', 'info')
function! s:GetCommand(buffer) abort
let l:log_dir = ale#Var(a:buffer, 'erlang_erlang_ls_log_dir')
let l:log_level = ale#Var(a:buffer, 'erlang_erlang_ls_log_level')
let l:command = '%e'
if !empty(l:log_dir)
let l:command .= ' --log-dir=' . ale#Escape(l:log_dir)
endif
let l:command .= ' --log-level=' . ale#Escape(l:log_level)
return l:command
endfunction
function! s:FindProjectRoot(buffer) abort
let l:markers = ['_build/', 'erlang_ls.config', 'rebar.lock']
" 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'),
\})

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -5,7 +5,7 @@
function! ale_linters#nix#nix#Command(buffer, output, meta) abort function! ale_linters#nix#nix#Command(buffer, output, meta) abort
let l:version = a:output[0][22:] let l:version = a:output[0][22:]
if l:version =~# '^\(2.[4-9]\|2.[1-9][0-9]\+\|3\).*' if l:version =~# '^\(2.[4-9]\|3\).*'
return 'nix-instantiate --log-format internal-json --parse -' return 'nix-instantiate --log-format internal-json --parse -'
else else
return 'nix-instantiate --parse -' return 'nix-instantiate --parse -'

View File

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

View File

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

View File

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

View File

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

View File

@@ -22,19 +22,6 @@ function! ale_linters#python#pylsp#GetExecutable(buffer) abort
return ale#python#FindExecutable(a:buffer, 'python_pylsp', ['pylsp']) return ale#python#FindExecutable(a:buffer, 'python_pylsp', ['pylsp'])
endfunction 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 function! ale_linters#python#pylsp#GetCommand(buffer) abort
let l:executable = ale_linters#python#pylsp#GetExecutable(a:buffer) let l:executable = ale_linters#python#pylsp#GetExecutable(a:buffer)
@@ -49,7 +36,6 @@ call ale#linter#Define('python', {
\ 'name': 'pylsp', \ 'name': 'pylsp',
\ 'lsp': 'stdio', \ 'lsp': 'stdio',
\ 'executable': function('ale_linters#python#pylsp#GetExecutable'), \ 'executable': function('ale_linters#python#pylsp#GetExecutable'),
\ 'cwd': function('ale_linters#python#pylsp#GetCwd'),
\ 'command': function('ale_linters#python#pylsp#GetCommand'), \ 'command': function('ale_linters#python#pylsp#GetCommand'),
\ 'project_root': function('ale#python#FindProjectRoot'), \ 'project_root': function('ale#python#FindProjectRoot'),
\ 'completion_filter': 'ale#completion#python#CompletionItemFilter', \ 'completion_filter': 'ale#completion#python#CompletionItemFilter',

View File

@@ -32,24 +32,10 @@ function! ale_linters#python#pyright#GetConfig(buffer) abort
return l:config return l:config
endfunction 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#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
call ale#linter#Define('python', { call ale#linter#Define('python', {
\ 'name': 'pyright', \ 'name': 'pyright',
\ 'lsp': 'stdio', \ 'lsp': 'stdio',
\ 'executable': {b -> ale#Var(b, 'python_pyright_executable')}, \ 'executable': {b -> ale#Var(b, 'python_pyright_executable')},
\ 'cwd': function('ale_linters#python#pyright#GetCwd'),
\ 'command': '%e --stdio', \ 'command': '%e --stdio',
\ 'project_root': function('ale#python#FindProjectRoot'), \ 'project_root': function('ale#python#FindProjectRoot'),
\ 'completion_filter': 'ale#completion#python#CompletionItemFilter', \ 'completion_filter': 'ale#completion#python#CompletionItemFilter',

View File

@@ -1,73 +0,0 @@
" Author: Yining <zhang.yining@gmail.com>
" 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)
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
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$'
\ ? ' 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,
\})

View File

@@ -1,84 +0,0 @@
" Author: Yining <zhang.yining@gmail.com>
" 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#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
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$'
\ ? ' run ruff'
\ : ''
" NOTE: ruff version `0.0.69` supports liniting input from stdin
return ale#Escape(l:executable) . l:exec_args
\ . ale#Pad(ale#Var(a:buffer, 'python_ruff_options'))
\ . ' --format text'
\ . (ale#semver#GTE(a:version, [0, 0, 69]) ? ' -' : ' %s')
endfunction
function! ale_linters#python#ruff#Handle(buffer, lines) abort
"Example: path/to/file.py:10:5: E999 SyntaxError: unexpected indent
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': '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,
\})

View File

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

View File

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

View File

@@ -9,21 +9,9 @@ function! ale_linters#rust#analyzer#GetCommand(buffer) abort
endfunction endfunction
function! ale_linters#rust#analyzer#GetProjectRoot(buffer) abort 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') let l:cargo_file = ale#path#FindNearestFile(a:buffer, 'Cargo.toml')
if !empty(l:cargo_file) return !empty(l:cargo_file) ? fnamemodify(l:cargo_file, ':h') : ''
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 endfunction
call ale#linter#Define('rust', { call ale#linter#Define('rust', {

View File

@@ -1,72 +0,0 @@
" Author: Carl Smedstad <carl.smedstad at protonmail dot com>
" 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) 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, 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
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
return l:output
endfunction
call ale#linter#Define('sql', {
\ 'name': 'sqlfluff',
\ 'executable': function('ale_linters#sql#sqlfluff#Executable'),
\ 'command': function('ale_linters#sql#sqlfluff#Command'),
\ 'callback': 'ale_linters#sql#sqlfluff#Handle',
\})

View File

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

View File

@@ -1,87 +0,0 @@
" 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',
\})

View File

@@ -13,7 +13,7 @@ function! ale_linters#tex#lacheck#Handle(buffer, lines) abort
for l:match in ale#util#GetMatches(a:lines, l:pattern) for l:match in ale#util#GetMatches(a:lines, l:pattern)
" lacheck follows `\input{}` commands. If the cwd is not the same as the " 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 " file in the buffer then it will fail to find the inputed items. We do not
" want warnings from those items anyway " want warnings from those items anyway
if !empty(matchstr(l:match[3], '^Could not open ".\+"$')) if !empty(matchstr(l:match[3], '^Could not open ".\+"$'))
continue continue

View File

@@ -2,7 +2,7 @@
" Description: Volar Language Server integration for ALE adopted from " Description: Volar Language Server integration for ALE adopted from
" nvim-lspconfig and volar/packages/shared/src/types.ts " nvim-lspconfig and volar/packages/shared/src/types.ts
call ale#Set('vue_volar_executable', 'vue-language-server') call ale#Set('vue_volar_executable', 'volar-server')
call ale#Set('vue_volar_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('vue_volar_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('vue_volar_init_options', { call ale#Set('vue_volar_init_options', {
\ 'documentFeatures': { \ 'documentFeatures': {
@@ -73,7 +73,7 @@ call ale#linter#Define('vue', {
\ 'name': 'volar', \ 'name': 'volar',
\ 'language': 'vue', \ 'language': 'vue',
\ 'lsp': 'stdio', \ 'lsp': 'stdio',
\ 'executable': {b -> ale#path#FindExecutable(b, 'vue_volar', ['node_modules/.bin/vue-language-server'])}, \ 'executable': {b -> ale#path#FindExecutable(b, 'vue_volar', ['node_modules/.bin/volar-server'])},
\ 'command': '%e --stdio', \ 'command': '%e --stdio',
\ 'project_root': function('ale_linters#vue#volar#GetProjectRoot'), \ 'project_root': function('ale_linters#vue#volar#GetProjectRoot'),
\ 'initialization_options': function('ale_linters#vue#volar#GetInitializationOptions'), \ 'initialization_options': function('ale_linters#vue#volar#GetInitializationOptions'),

View File

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

View File

@@ -1,49 +0,0 @@
call 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:
" (<unknown>): 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',
\})

View File

@@ -157,7 +157,7 @@ function! ale#Queue(delay, ...) abort
endif endif
endfunction endfunction
let s:current_ale_version = [3, 3, 0] let s:current_ale_version = [3, 2, 0]
" A function used to check for ALE features in files outside of the project. " A function used to check for ALE features in files outside of the project.
function! ale#Has(feature) abort function! ale#Has(feature) abort

View File

@@ -585,38 +585,3 @@ function! ale#c#IncludeOptions(include_paths) abort
return join(l:option_list) return join(l:option_list)
endfunction 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

View File

@@ -216,7 +216,7 @@ function! s:UpdateCursor(cursor, start, end, offset) abort
" to the end of the changes " to the end of the changes
let l:cur_line = l:end_line + l:line_offset let l:cur_line = l:end_line + l:line_offset
let l:cur_column = l:end_column + l:column_offset let l:cur_column = l:end_column + l:column_offset
" else is not necessary, it means modifications are happening " else is not necesary, it means modifications are happening
" after the cursor so no cursor updates need to be done " after the cursor so no cursor updates need to be done
endif endif
endif endif

View File

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

View File

@@ -130,17 +130,14 @@ let s:should_complete_map = {
\ '<default>': '\v[a-zA-Z$_][a-zA-Z$_0-9]*$|\.$', \ '<default>': '\v[a-zA-Z$_][a-zA-Z$_0-9]*$|\.$',
\ 'clojure': s:lisp_regex, \ 'clojure': s:lisp_regex,
\ 'lisp': s:lisp_regex, \ 'lisp': s:lisp_regex,
\ 'racket': '\k\+$',
\ 'typescript': '\v[a-zA-Z$_][a-zA-Z$_0-9]*$|\.$|''$|"$', \ 'typescript': '\v[a-zA-Z$_][a-zA-Z$_0-9]*$|\.$|''$|"$',
\ 'rust': '\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]*$|\.$|::$|-\>$', \ '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. " Regular expressions for finding the start column to replace with completion.
let s:omni_start_map = { let s:omni_start_map = {
\ '<default>': '\v[a-zA-Z$_][a-zA-Z$_0-9]*$', \ '<default>': '\v[a-zA-Z$_][a-zA-Z$_0-9]*$',
\ 'racket': '\k\+$',
\} \}
" A map of exact characters for triggering LSP completions. Do not forget to " A map of exact characters for triggering LSP completions. Do not forget to
@@ -150,7 +147,6 @@ let s:trigger_character_map = {
\ 'typescript': ['.', '''', '"'], \ 'typescript': ['.', '''', '"'],
\ 'rust': ['.', '::'], \ 'rust': ['.', '::'],
\ 'cpp': ['.', '::', '->'], \ 'cpp': ['.', '::', '->'],
\ 'c': ['.', '->'],
\} \}
function! s:GetFiletypeValue(map, filetype) abort function! s:GetFiletypeValue(map, filetype) abort
@@ -585,7 +581,7 @@ function! ale#completion#ParseLSPCompletions(response) abort
continue continue
endif endif
if get(l:item, 'insertTextFormat', s:LSP_INSERT_TEXT_FORMAT_PLAIN) is s:LSP_INSERT_TEXT_FORMAT_PLAIN if get(l:item, 'insertTextFormat') is s:LSP_INSERT_TEXT_FORMAT_PLAIN
\&& type(get(l:item, 'textEdit')) is v:t_dict \&& type(get(l:item, 'textEdit')) is v:t_dict
let l:text = l:item.textEdit.newText let l:text = l:item.textEdit.newText
elseif type(get(l:item, 'insertText')) is v:t_string elseif type(get(l:item, 'insertText')) is v:t_string
@@ -780,8 +776,7 @@ function! s:OnReady(linter, lsp_details) abort
if a:linter.lsp is# 'tsserver' if a:linter.lsp is# 'tsserver'
if get(g:, 'ale_completion_tsserver_autoimport') is 1 if get(g:, 'ale_completion_tsserver_autoimport') is 1
" no-custom-checks execute 'echom `g:ale_completion_tsserver_autoimport` is deprecated. Use `g:ale_completion_autoimport` instead.'''
echom '`g:ale_completion_tsserver_autoimport` is deprecated. Use `g:ale_completion_autoimport` instead.'
endif endif
let l:message = ale#lsp#tsserver_message#Completions( let l:message = ale#lsp#tsserver_message#Completions(

View File

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

View File

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

View File

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

View File

@@ -203,10 +203,6 @@ function! ale#engine#SetResults(buffer, loclist) abort
call ale#highlight#SetHighlights(a:buffer, a:loclist) call ale#highlight#SetHighlights(a:buffer, a:loclist)
endif endif
if 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 l:linting_is_done
if g:ale_echo_cursor if g:ale_echo_cursor
" Try and echo the warning now. " Try and echo the warning now.
@@ -214,7 +210,7 @@ function! ale#engine#SetResults(buffer, loclist) abort
call ale#cursor#EchoCursorWarning() call ale#cursor#EchoCursorWarning()
endif endif
if g:ale_virtualtext_cursor is# 'current' || g:ale_virtualtext_cursor == 1 if g:ale_virtualtext_cursor
" Try and show the warning now. " Try and show the warning now.
" This will only do something meaningful if we're in normal mode. " This will only do something meaningful if we're in normal mode.
call ale#virtualtext#ShowCursorWarning() call ale#virtualtext#ShowCursorWarning()

View File

@@ -139,7 +139,7 @@ function! ale#events#Init() abort
autocmd InsertLeave * if exists('*ale#engine#Cleanup') | call ale#cursor#EchoCursorWarning() | endif autocmd InsertLeave * if exists('*ale#engine#Cleanup') | call ale#cursor#EchoCursorWarning() | endif
endif endif
if g:ale_virtualtext_cursor is# 'current' || g:ale_virtualtext_cursor is# 1 || g:ale_virtualtext_cursor is# '1' if g:ale_virtualtext_cursor
autocmd CursorMoved,CursorHold * if exists('*ale#engine#Cleanup') | call ale#virtualtext#ShowCursorWarningWithDelay() | endif autocmd CursorMoved,CursorHold * if exists('*ale#engine#Cleanup') | call ale#virtualtext#ShowCursorWarningWithDelay() | endif
" Look for a warning to echo as soon as we leave Insert mode. " Look for a warning to echo as soon as we leave Insert mode.
" The script's position variable used when moving the cursor will " The script's position variable used when moving the cursor will

View File

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

View File

@@ -37,21 +37,11 @@ let s:default_registry = {
\ 'suggested_filetypes': ['python'], \ 'suggested_filetypes': ['python'],
\ 'description': 'Fix PEP8 issues with black.', \ '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': { \ 'buildifier': {
\ 'function': 'ale#fixers#buildifier#Fix', \ 'function': 'ale#fixers#buildifier#Fix',
\ 'suggested_filetypes': ['bzl'], \ 'suggested_filetypes': ['bzl'],
\ 'description': 'Format BUILD and .bzl files with buildifier.', \ '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': { \ 'deno': {
\ 'function': 'ale#fixers#deno#Fix', \ 'function': 'ale#fixers#deno#Fix',
\ 'suggested_filetypes': ['typescript'], \ 'suggested_filetypes': ['typescript'],
@@ -83,11 +73,6 @@ let s:default_registry = {
\ 'suggested_filetypes': ['dhall'], \ 'suggested_filetypes': ['dhall'],
\ 'description': 'Standard code formatter for the Dhall language and removing dead code', \ 'description': 'Standard code formatter for the Dhall language and removing dead code',
\ }, \ },
\ 'dune': {
\ 'function': 'ale#fixers#dune#Fix',
\ 'suggested_filetypes': ['dune'],
\ 'description': 'Fix dune files with dune format',
\ },
\ 'fecs': { \ 'fecs': {
\ 'function': 'ale#fixers#fecs#Fix', \ 'function': 'ale#fixers#fecs#Fix',
\ 'suggested_filetypes': ['javascript', 'css', 'html'], \ 'suggested_filetypes': ['javascript', 'css', 'html'],
@@ -146,11 +131,6 @@ let s:default_registry = {
\ 'description': 'Apply prettier-eslint to a file.', \ 'description': 'Apply prettier-eslint to a file.',
\ 'aliases': ['prettier-eslint'], \ 'aliases': ['prettier-eslint'],
\ }, \ },
\ 'pyflyby': {
\ 'function': 'ale#fixers#pyflyby#Fix',
\ 'suggested_filetypes': ['python'],
\ 'description': 'Tidy Python imports with pyflyby.',
\ },
\ 'importjs': { \ 'importjs': {
\ 'function': 'ale#fixers#importjs#Fix', \ 'function': 'ale#fixers#importjs#Fix',
\ 'suggested_filetypes': ['javascript'], \ 'suggested_filetypes': ['javascript'],
@@ -226,11 +206,6 @@ let s:default_registry = {
\ 'suggested_filetypes': ['swift'], \ 'suggested_filetypes': ['swift'],
\ 'description': 'Apply SwiftFormat to a file.', \ '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': { \ 'apple-swift-format': {
\ 'function': 'ale#fixers#appleswiftformat#Fix', \ 'function': 'ale#fixers#appleswiftformat#Fix',
\ 'suggested_filetypes': ['swift'], \ 'suggested_filetypes': ['swift'],
@@ -246,11 +221,6 @@ let s:default_registry = {
\ 'suggested_filetypes': ['php'], \ 'suggested_filetypes': ['php'],
\ 'description': 'Fix PHP files with php-cs-fixer.', \ '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': { \ 'astyle': {
\ 'function': 'ale#fixers#astyle#Fix', \ 'function': 'ale#fixers#astyle#Fix',
\ 'suggested_filetypes': ['c', 'cpp'], \ 'suggested_filetypes': ['c', 'cpp'],
@@ -263,8 +233,8 @@ let s:default_registry = {
\ }, \ },
\ 'clang-format': { \ 'clang-format': {
\ 'function': 'ale#fixers#clangformat#Fix', \ 'function': 'ale#fixers#clangformat#Fix',
\ 'suggested_filetypes': ['c', 'cpp', 'cs', 'cuda', 'java', 'javascript', 'json', 'objc', 'proto'], \ 'suggested_filetypes': ['c', 'cpp', 'cuda'],
\ 'description': 'Fix C, C++, C#, CUDA, Java, JavaScript, JSON, ObjectiveC and Protobuf files with clang-format.', \ 'description': 'Fix C/C++ and cuda files with clang-format.',
\ }, \ },
\ 'cmakeformat': { \ 'cmakeformat': {
\ 'function': 'ale#fixers#cmakeformat#Fix', \ 'function': 'ale#fixers#cmakeformat#Fix',
@@ -386,11 +356,6 @@ let s:default_registry = {
\ 'suggested_filetypes': ['sh'], \ 'suggested_filetypes': ['sh'],
\ 'description': 'Fix sh files with shfmt.', \ 'description': 'Fix sh files with shfmt.',
\ }, \ },
\ 'sqlfluff': {
\ 'function': 'ale#fixers#sqlfluff#Fix',
\ 'suggested_filetypes': ['sql'],
\ 'description': 'Fix SQL files with sqlfluff.',
\ },
\ 'sqlfmt': { \ 'sqlfmt': {
\ 'function': 'ale#fixers#sqlfmt#Fix', \ 'function': 'ale#fixers#sqlfmt#Fix',
\ 'suggested_filetypes': ['sql'], \ 'suggested_filetypes': ['sql'],
@@ -466,11 +431,6 @@ let s:default_registry = {
\ 'suggested_filetypes': ['hcl', 'terraform'], \ 'suggested_filetypes': ['hcl', 'terraform'],
\ 'description': 'Fix tf and hcl files with terraform fmt.', \ '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': { \ 'crystal': {
\ 'function': 'ale#fixers#crystal#Fix', \ 'function': 'ale#fixers#crystal#Fix',
\ 'suggested_filetypes': ['cr'], \ 'suggested_filetypes': ['cr'],
@@ -524,7 +484,7 @@ let s:default_registry = {
\ 'html-beautify': { \ 'html-beautify': {
\ 'function': 'ale#fixers#html_beautify#Fix', \ 'function': 'ale#fixers#html_beautify#Fix',
\ 'suggested_filetypes': ['html', 'htmldjango'], \ 'suggested_filetypes': ['html', 'htmldjango'],
\ 'description': 'Fix HTML files with html-beautify from js-beautify.', \ 'description': 'Fix HTML files with html-beautify.',
\ }, \ },
\ 'lua-format': { \ 'lua-format': {
\ 'function': 'ale#fixers#lua_format#Fix', \ 'function': 'ale#fixers#lua_format#Fix',
@@ -538,7 +498,7 @@ let s:default_registry = {
\ }, \ },
\ 'dprint': { \ 'dprint': {
\ 'function': 'ale#fixers#dprint#Fix', \ 'function': 'ale#fixers#dprint#Fix',
\ 'suggested_filetypes': ['dockerfile', 'javascript', 'json', 'markdown', 'toml', 'typescript'], \ 'suggested_filetypes': ['javascript', 'typescript', 'json', 'markdown'],
\ 'description': 'Pluggable and configurable code formatting platform', \ 'description': 'Pluggable and configurable code formatting platform',
\ }, \ },
\ 'stylua': { \ 'stylua': {
@@ -561,30 +521,10 @@ let s:default_registry = {
\ 'suggested_filetypes': ['pascal'], \ 'suggested_filetypes': ['pascal'],
\ 'description': 'Fix Pascal files with ptop.', \ 'description': 'Fix Pascal files with ptop.',
\ }, \ },
\ 'opafmt': {
\ 'function': 'ale#fixers#opafmt#Fix',
\ 'suggested_filetypes': ['rego'],
\ 'description': 'Fix rego files with opa fmt.',
\ },
\ 'vfmt': { \ 'vfmt': {
\ 'function': 'ale#fixers#vfmt#Fix', \ 'function': 'ale#fixers#vfmt#Fix',
\ 'suggested_filetypes': ['v'], \ 'suggested_filetypes': ['v'],
\ 'description': 'A formatter for V source code.', \ '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.',
\ } \ }
\} \}

View File

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

View File

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

View File

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

View File

@@ -1,9 +1,10 @@
" Author: WhyNotHugo <hugo@barrera.io> " Author: WhyNotHugo <hugo@barrera.io>
" Description: Format HTML files with html-beautify. " Description: Lint HTML files with html-beautify.
"
call ale#Set('html_beautify_executable', '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_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('html_beautify_options', '') call ale#Set('html_beautify_options', '')
call ale#Set('html_beautify_change_directory', 1)
function! ale#fixers#html_beautify#Fix(buffer) abort function! ale#fixers#html_beautify#Fix(buffer) abort
let l:executable = ale#python#FindExecutable( let l:executable = ale#python#FindExecutable(
@@ -15,6 +16,6 @@ function! ale#fixers#html_beautify#Fix(buffer) abort
let l:options = ale#Var(a:buffer, 'html_beautify_options') let l:options = ale#Var(a:buffer, 'html_beautify_options')
return { return {
\ 'command': ale#Escape(l:executable) . ' ' . l:options . ' -', \ 'command': ale#Escape(l:executable). ' ' . l:options . ' -',
\} \}
endfunction endfunction

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,15 +0,0 @@
" Author: Jeremy Cantrell <jmcantrell@gmail.com>
" 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

View File

@@ -1,89 +0,0 @@
" Author: Yining <zhang.yining@gmail.com>
" 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)
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
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$'
\ ? ' 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$'
call extend(l:cmd, ['run', 'ruff'])
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

View File

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

View File

@@ -1,25 +0,0 @@
" Author: Carl Smedstad <carl.smedstad at protonmail dot com>
" 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

View File

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

View File

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

View File

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

View File

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

View File

@@ -29,8 +29,6 @@ function! ale#handlers#deno#GetProjectRoot(buffer) abort
endif endif
let l:possible_project_roots = [ let l:possible_project_roots = [
\ 'deno.json',
\ 'deno.jsonc',
\ 'tsconfig.json', \ 'tsconfig.json',
\ '.git', \ '.git',
\ bufname(a:buffer), \ bufname(a:buffer),

View File

@@ -19,16 +19,6 @@ let s:temp_regex_prefix =
\ . substitute(s:temp_dir, '\\', '\\\\', 'g') \ . 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 function! ale#handlers#haskell#HandleGHCFormat(buffer, lines) abort
" Look for lines like the following. " Look for lines like the following.
" "
@@ -44,14 +34,6 @@ function! ale#handlers#haskell#HandleGHCFormat(buffer, lines) abort
let l:corrected_lines = [] 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. " Group the lines into smaller lists.
for l:line in a:lines for l:line in a:lines
if len(matchlist(l:line, l:pattern)) > 0 if len(matchlist(l:line, l:pattern)) > 0

View File

@@ -13,7 +13,7 @@ function! ale#handlers#hdl_checker#IsDotGit(path) abort
return ! empty(a:path) && isdirectory(a:path) return ! empty(a:path) && isdirectory(a:path)
endfunction endfunction
" Should return (in order of preference) " Sould return (in order of preference)
" 1. Nearest config file " 1. Nearest config file
" 2. Nearest .git directory " 2. Nearest .git directory
" 3. The current path " 3. The current path

View File

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

View File

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

View File

@@ -1,7 +1,7 @@
" Author: Horacio Sanson https://github.com/hsanson " Author: Horacio Sanson https://github.com/hsanson
" Description: Functions for integrating with Java tools " Description: Functions for integrating with Java tools
" Find the nearest dir contining a gradle or pom file and assume it " Find the nearest dir contining a gradle or pom file and asume it
" the root of a java app. " the root of a java app.
function! ale#java#FindProjectRoot(buffer) abort function! ale#java#FindProjectRoot(buffer) abort
let l:gradle_root = ale#gradle#FindProjectRoot(a:buffer) let l:gradle_root = ale#gradle#FindProjectRoot(a:buffer)

View File

@@ -187,16 +187,10 @@ function! ale#job#PrepareCommand(buffer, command) abort
\ : a:command \ : a:command
" If a custom shell is specified, use that. " If a custom shell is specified, use that.
if exists('b:ale_shell') if exists('g:ale_shell')
let l:ale_shell = b:ale_shell let l:shell_arguments = get(g:, 'ale_shell_arguments', &shellcmdflag)
elseif exists('g:ale_shell')
let l:ale_shell = g:ale_shell
endif
if exists('l:ale_shell') return split(g:ale_shell) + split(l:shell_arguments) + [l:command]
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 endif
if has('win32') if has('win32')
@@ -250,16 +244,10 @@ function! ale#job#Start(command, options) abort
if has_key(a:options, 'out_cb') if has_key(a:options, 'out_cb')
let l:job_options.out_cb = function('s:VimOutputCallback') 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 endif
if has_key(a:options, 'err_cb') if has_key(a:options, 'err_cb')
let l:job_options.err_cb = function('s:VimErrorCallback') 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 endif
if has_key(a:options, 'exit_cb') if has_key(a:options, 'exit_cb')

View File

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

View File

@@ -18,7 +18,7 @@ if !exists('s:timer_args')
let s:timer_args = {} let s:timer_args = {}
endif endif
" Return 1 if there is a buffer with buftype == 'quickfix' in buffer list " Return 1 if there is a buffer with buftype == 'quickfix' in bufffer list
function! ale#list#IsQuickfixOpen() abort function! ale#list#IsQuickfixOpen() abort
let l:res = getqflist({ 'winid' : winnr() }) let l:res = getqflist({ 'winid' : winnr() })
@@ -190,7 +190,7 @@ function! s:RestoreViewIfNeeded(buffer) abort
return return
endif endif
" Check whether the cursor has moved since linting was actually requested. If " Check wether the cursor has moved since linting was actually requested. If
" the user has indeed moved lines, do nothing " the user has indeed moved lines, do nothing
let l:current_view = winsaveview() let l:current_view = winsaveview()

View File

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

View File

@@ -139,15 +139,6 @@ function! ale#lsp#message#TypeDefinition(buffer, line, column) abort
\}] \}]
endfunction 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 function! ale#lsp#message#References(buffer, line, column) abort
return [0, 'textDocument/references', { return [0, 'textDocument/references', {
\ 'textDocument': { \ 'textDocument': {

View File

@@ -72,14 +72,6 @@ function! ale#lsp#tsserver_message#TypeDefinition(buffer, line, column) abort
\}] \}]
endfunction 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 function! ale#lsp#tsserver_message#References(buffer, line, column) abort
return [0, 'ts@references', { return [0, 'ts@references', {
\ 'line': a:line, \ 'line': a:line,

View File

@@ -141,10 +141,6 @@ function! s:HandleLSPErrorMessage(linter_name, response) abort
return return
endif 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 " This global variable is set here so we don't load the debugging.vim file
" until someone uses :ALEInfo. " until someone uses :ALEInfo.
let g:ale_lsp_error_messages = get(g:, 'ale_lsp_error_messages', {}) let g:ale_lsp_error_messages = get(g:, 'ale_lsp_error_messages', {})
@@ -153,7 +149,7 @@ function! ale#lsp_linter#AddErrorMessage(linter_name, message) abort
let g:ale_lsp_error_messages[a:linter_name] = [] let g:ale_lsp_error_messages[a:linter_name] = []
endif endif
call add(g:ale_lsp_error_messages[a:linter_name], a:message) call add(g:ale_lsp_error_messages[a:linter_name], l:message)
endfunction endfunction
function! ale#lsp_linter#HandleLSPResponse(conn_id, response) abort function! ale#lsp_linter#HandleLSPResponse(conn_id, response) abort
@@ -434,8 +430,6 @@ function! ale#lsp_linter#StartLSP(buffer, linter, Callback) abort
if empty(l:root) && a:linter.lsp isnot# 'tsserver' if empty(l:root) && a:linter.lsp isnot# 'tsserver'
" If there's no project root, then we can't check files with LSP, " 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. " 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 return 0
endif endif

View File

@@ -26,15 +26,12 @@ function! ale#python#FindProjectRootIni(buffer) abort
\|| filereadable(l:path . '/tox.ini') \|| filereadable(l:path . '/tox.ini')
\|| filereadable(l:path . '/.pyre_configuration.local') \|| filereadable(l:path . '/.pyre_configuration.local')
\|| filereadable(l:path . '/mypy.ini') \|| filereadable(l:path . '/mypy.ini')
\|| filereadable(l:path . '/.mypy.ini')
\|| filereadable(l:path . '/pycodestyle.cfg') \|| filereadable(l:path . '/pycodestyle.cfg')
\|| filereadable(l:path . '/.flake8') \|| filereadable(l:path . '/.flake8')
\|| filereadable(l:path . '/.flake8rc') \|| filereadable(l:path . '/.flake8rc')
\|| filereadable(l:path . '/pylama.ini') \|| filereadable(l:path . '/pylama.ini')
\|| filereadable(l:path . '/pylintrc') \|| filereadable(l:path . '/pylintrc')
\|| 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')
\|| filereadable(l:path . '/Pipfile.lock') \|| filereadable(l:path . '/Pipfile.lock')
\|| filereadable(l:path . '/poetry.lock') \|| filereadable(l:path . '/poetry.lock')

View File

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

View File

@@ -14,8 +14,8 @@ function! s:DisablePostamble() abort
call ale#highlight#UpdateHighlights() call ale#highlight#UpdateHighlights()
endif endif
if g:ale_virtualtext_cursor is# 'current' || g:ale_virtualtext_cursor == 1 if g:ale_virtualtext_cursor
call ale#virtualtext#Clear(bufnr('')) call ale#virtualtext#Clear()
endif endif
endfunction endfunction
@@ -64,8 +64,7 @@ function! ale#toggle#ToggleBuffer(buffer) abort
" Disabling ALE globally removes autocmd events, so we cannot enable " Disabling ALE globally removes autocmd events, so we cannot enable
" linting locally when linting is disabled globally " linting locally when linting is disabled globally
if l:enabled && !g:ale_enabled if l:enabled && !g:ale_enabled
" no-custom-checks execute 'echom ''ALE cannot be enabled locally when disabled globally'''
echom 'ALE cannot be enabled locally when disabled globally'
return return
endif endif

View File

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

View File

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

View File

@@ -8,59 +8,52 @@ let g:ale_virtualtext_delay = get(g:, 'ale_virtualtext_delay', 10)
let s:cursor_timer = -1 let s:cursor_timer = -1
let s:last_pos = [0, 0, 0] let s:last_pos = [0, 0, 0]
let s:has_virt_text = 0 let s:has_virt_text = 0
let s:emulate_virt = 0
if has('nvim-0.3.2') if has('nvim-0.3.2')
let s:ns_id = nvim_create_namespace('ale') let s:ns_id = nvim_create_namespace('ale')
let s:has_virt_text = 1 let s:has_virt_text = 1
elseif has('textprop') && has('popupwin') elseif has('textprop') && has('popupwin')
call prop_type_add('ale', {})
let s:last_popup = -1
let s:has_virt_text = 1 let s:has_virt_text = 1
let s:emulate_virt = !has('patch-9.0.0297')
let s:hl_list = []
if s:emulate_virt
call prop_type_add('ale', {})
let s:last_virt = -1
endif
endif endif
function! ale#virtualtext#Clear(buf) abort function! ale#virtualtext#Clear() abort
if !s:has_virt_text if !s:has_virt_text
return return
endif endif
let l:buffer = bufnr('')
if has('nvim') if has('nvim')
call nvim_buf_clear_namespace(a:buf, s:ns_id, 0, -1) call nvim_buf_clear_highlight(l:buffer, s:ns_id, 0, -1)
else else
if s:emulate_virt && s:last_virt != -1 if s:last_popup != -1
call prop_remove({'type': 'ale'}) call prop_remove({'type': 'ale'})
call popup_close(s:last_virt) call popup_close(s:last_popup)
let s:last_virt = -1 let s:last_popup = -1
elseif !empty(s:hl_list)
call prop_remove({
\ 'types': s:hl_list,
\ 'all': 1,
\ 'bufnr': a:buf})
endif endif
endif endif
endfunction endfunction
function! ale#virtualtext#ShowMessage(message, hl_group, buf, line) abort function! ale#virtualtext#ShowMessage(message, hl_group) abort
if !s:has_virt_text || !bufexists(str2nr(a:buf)) if !s:has_virt_text
return return
endif endif
let l:line = line('.')
let l:buffer = bufnr('')
let l:prefix = get(g:, 'ale_virtualtext_prefix', '> ') let l:prefix = get(g:, 'ale_virtualtext_prefix', '> ')
let l:msg = l:prefix.trim(substitute(a:message, '\n', ' ', 'g')) let l:msg = l:prefix.trim(substitute(a:message, '\n', ' ', 'g'))
if has('nvim') if has('nvim')
call nvim_buf_set_virtual_text(a:buf, s:ns_id, a:line-1, [[l:msg, a:hl_group]], {}) call nvim_buf_set_virtual_text(l:buffer, s:ns_id, l:line-1, [[l:msg, a:hl_group]], {})
elseif s:emulate_virt else
let l:left_pad = col('$') let l:left_pad = col('$')
call prop_add(a:line, l:left_pad, { call prop_add(l:line, l:left_pad, {
\ 'type': 'ale', \ 'type': 'ale',
\}) \})
let s:last_virt = popup_create(l:msg, { let s:last_popup = popup_create(l:msg, {
\ 'line': -1, \ 'line': -1,
\ 'padding': [0, 0, 0, 1], \ 'padding': [0, 0, 0, 1],
\ 'mask': [[1, 1, 1, 1]], \ 'mask': [[1, 1, 1, 1]],
@@ -70,19 +63,6 @@ function! ale#virtualtext#ShowMessage(message, hl_group, buf, line) abort
\ 'wrap': 0, \ 'wrap': 0,
\ 'zindex': 2 \ 'zindex': 2
\}) \})
else
let type = prop_type_get(a:hl_group)
if type == {}
call add(s:hl_list, a:hl_group)
call prop_type_add(a:hl_group, {'highlight': a:hl_group})
endif
call prop_add(a:line, 0, {
\ 'type': a:hl_group,
\ 'text': ' ' . l:msg,
\ 'bufnr': a:buf
\})
endif endif
endfunction endfunction
@@ -93,26 +73,8 @@ function! s:StopCursorTimer() abort
endif endif
endfunction endfunction
function! ale#virtualtext#GetHlGroup(type, style) abort
if a:type is# 'E'
if a:style is# 'style'
return 'ALEVirtualTextStyleError'
else
return 'ALEVirtualTextError'
endif
elseif a:type is# 'W'
if a:style is# 'style'
return 'ALEVirtualTextStyleWarning'
else
return 'ALEVirtualTextWarning'
endif
else
return 'ALEVirtualTextInfo'
endif
endfunction
function! ale#virtualtext#ShowCursorWarning(...) abort function! ale#virtualtext#ShowCursorWarning(...) abort
if g:ale_virtualtext_cursor isnot# 'current' && g:ale_virtualtext_cursor != 1 if !g:ale_virtualtext_cursor
return return
endif endif
@@ -128,21 +90,35 @@ function! ale#virtualtext#ShowCursorWarning(...) abort
let [l:info, l:loc] = ale#util#FindItemAtCursor(l:buffer) let [l:info, l:loc] = ale#util#FindItemAtCursor(l:buffer)
call ale#virtualtext#Clear(l:buffer) call ale#virtualtext#Clear()
if !empty(l:loc) if !empty(l:loc)
let l:msg = l:loc.text let l:msg = l:loc.text
let l:hl_group = 'ALEVirtualTextInfo'
let l:type = get(l:loc, 'type', 'E') let l:type = get(l:loc, 'type', 'E')
let l:style = get(l:loc, 'sub_type', '')
let l:hl_group = ale#virtualtext#GetHlGroup(l:type, l:style) if l:type is# 'E'
call ale#virtualtext#ShowMessage(l:msg, l:hl_group, l:buffer, line('.')) if get(l:loc, 'sub_type', '') is# 'style'
let l:hl_group = 'ALEVirtualTextStyleError'
else
let l:hl_group = 'ALEVirtualTextError'
endif
elseif l:type is# 'W'
if get(l:loc, 'sub_type', '') is# 'style'
let l:hl_group = 'ALEVirtualTextStyleWarning'
else
let l:hl_group = 'ALEVirtualTextWarning'
endif
endif
call ale#virtualtext#ShowMessage(l:msg, l:hl_group)
endif endif
endfunction endfunction
function! ale#virtualtext#ShowCursorWarningWithDelay() abort function! ale#virtualtext#ShowCursorWarningWithDelay() abort
let l:buffer = bufnr('') let l:buffer = bufnr('')
if g:ale_virtualtext_cursor isnot# 'current' && g:ale_virtualtext_cursor != 1 if !g:ale_virtualtext_cursor
return return
endif endif
@@ -169,19 +145,3 @@ function! ale#virtualtext#ShowCursorWarningWithDelay() abort
endif endif
endfunction endfunction
function! ale#virtualtext#SetTexts(buf, loclist) abort
if !has('nvim') && s:emulate_virt
return
endif
call ale#virtualtext#Clear(a:buf)
for l in a:loclist
if l['bufnr'] != a:buf
continue
endif
let hl = ale#virtualtext#GetHlGroup(l['type'], get(l, 'sub_type', ''))
call ale#virtualtext#ShowMessage(l['text'], hl, a:buf, l['lnum'])
endfor
endfunction

View File

@@ -1,28 +1,6 @@
=============================================================================== ===============================================================================
ALE Ansible Integration *ale-ansible-options* 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* ansible-lint *ale-ansible-ansible-lint*
@@ -34,6 +12,5 @@ g:ale_ansible_ansible_lint_executable *g:ale_ansible_ansible_lint_executable*
This variable can be changed to modify the executable used for ansible-lint. This variable can be changed to modify the executable used for ansible-lint.
=============================================================================== ===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View File

@@ -1,24 +0,0 @@
===============================================================================
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: `'build --outfile /dev/null'`
This variable can be set to pass additional options to bicep.
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View File

@@ -133,42 +133,7 @@ g:ale_c_cc_options *g:ale_c_cc_options*
Type: |String| Type: |String|
Default: `'-std=c11 -Wall'` Default: `'-std=c11 -Wall'`
This variable can be changed to modify flags given to the C compiler. This variable can be change 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 |ale_c_cc_use_header_lang_flag|.
=============================================================================== ===============================================================================

View File

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

View File

@@ -62,42 +62,7 @@ g:ale_cpp_cc_options *g:ale_cpp_cc_options*
Type: |String| Type: |String|
Default: `'-std=c++14 -Wall'` Default: `'-std=c++14 -Wall'`
This variable can be changed to modify flags given to the C++ compiler. This variable can be change 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 |ale_cpp_cc_use_header_lang_flag|.
=============================================================================== ===============================================================================

View File

@@ -6,13 +6,6 @@ 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 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* csc *ale-cs-csc*

View File

@@ -8,33 +8,6 @@ cspell *ale-css-cspell*
See |ale-cspell-options| 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 *ale-css-fecs*
@@ -76,18 +49,5 @@ g:ale_css_stylelint_use_global *g:ale_css_stylelint_use_global*
See |ale-integrations-local-executables| 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: vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View File

@@ -2,32 +2,6 @@
ALE CUDA Integration *ale-cuda-options* 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* nvcc *ale-cuda-nvcc*
@@ -47,6 +21,30 @@ g:ale_cuda_nvcc_options *g:ale_cuda_nvcc_options*
This variable can be changed to modify flags given to nvcc. This variable can be changed to modify flags given to nvcc.
===============================================================================
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.
===============================================================================
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.
=============================================================================== ===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View File

@@ -15,7 +15,6 @@ CONTENTS *ale-development-contents*
4.2. Writing Fixer Tests..............|ale-development-fixer-tests| 4.2. Writing Fixer Tests..............|ale-development-fixer-tests|
4.3. Running Tests in a Windows VM....|ale-development-windows-tests| 4.3. Running Tests in a Windows VM....|ale-development-windows-tests|
5. Contributing.........................|ale-development-contributing| 5. Contributing.........................|ale-development-contributing|
5.1. Preparing a Release..............|ale-development-release|
=============================================================================== ===============================================================================
1. Introduction *ale-development-introduction* 1. Introduction *ale-development-introduction*
@@ -99,8 +98,8 @@ should also follow some additional rules designed to prevent mistakes. Some of
these are reported with ALE's `custom-linting-rules` script. See these are reported with ALE's `custom-linting-rules` script. See
|ale-development-tests|. |ale-development-tests|.
* Don't leave stray `:echo` lines in code. Write `" no-custom-checks` above * Don't leave stray `:echo` lines in code. Use `execute 'echo' ...` if you must
the line if you must echo something. echo something.
* For strings use |is#| instead of |==#|, `is?` instead of `==?`, `isnot#` * For strings use |is#| instead of |==#|, `is?` instead of `==?`, `isnot#`
instead of `!=#`, and `isnot?` instead of `!=?`. This is because `'x' ==# 0` 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 returns 1, while `'x' is# 0` returns 0, so you will experience fewer issues
@@ -155,9 +154,10 @@ ALE runs tests with the following versions of Vim in the following
environments. environments.
1. Vim 8.0.0027 on Linux via GitHub Actions. 1. Vim 8.0.0027 on Linux via GitHub Actions.
2. Vim 9.0.0133 on Linux via GitHub Actions. 2. Vim 8.2.2401 on Linux via GitHub Actions.
3. NeoVim 0.2.0 on Linux via GitHub Actions. 3. NeoVim 0.2.0 on Linux via GitHub Actions.
4. NeoVim 0.8.0 on Linux via GitHub Actions. 4. NeoVim 0.4.4 on Linux via GitHub Actions.
5. NeoVim 0.5.0 on Linux via GitHub Actions.
6. Vim 8 (stable builds) on Windows via AppVeyor. 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 If you are developing ALE code on Linux, Mac OSX, or BSD, you can run ALEs
@@ -326,6 +326,7 @@ given the above setup are as follows.
`AssertLSPProject project_root` - Check the root 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. `AssertLSPAddress address` - Check the address to an LSP server.
=============================================================================== ===============================================================================
4.2 Writing Fixer Tests *ale-development-fixer-tests* 4.2 Writing Fixer Tests *ale-development-fixer-tests*
@@ -367,6 +368,7 @@ given the above setup are as follows.
`AssertFixer results` - Check the fixer results `AssertFixer results` - Check the fixer results
`AssertFixerNotExecuted` - Check that fixers will not be executed. `AssertFixerNotExecuted` - Check that fixers will not be executed.
=============================================================================== ===============================================================================
4.3 Running Tests in a Windows VM *ale-development-windows-tests* 4.3 Running Tests in a Windows VM *ale-development-windows-tests*
@@ -461,76 +463,5 @@ and profile settings. See: https://docs.github.com/en/account-and-profile/
Unless configuring GitHub to expose contact details, commits will be rewritten Unless configuring GitHub to expose contact details, commits will be rewritten
to appear by `USERNAME <RANDOM_NUMBER+USERNAME@users.noreply.github.com>` . to appear by `USERNAME <RANDOM_NUMBER+USERNAME@users.noreply.github.com>` .
===============================================================================
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| text 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: vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

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