mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-07 05:04:28 +08:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f0fa137721 | ||
|
|
7e2342ab52 |
10
.github/ISSUE_TEMPLATE/report-a-bug.md
vendored
10
.github/ISSUE_TEMPLATE/report-a-bug.md
vendored
@@ -40,9 +40,7 @@ Are you having trouble configuring ALE? Try asking for help on [Stack Exchange](
|
||||
2. Then this happened.
|
||||
|
||||
### :ALEInfo
|
||||
<details>
|
||||
<summary>Expand</summary>
|
||||
<!-- Paste the output of :ALEInfo here. Try :ALEInfoToClipboard -->
|
||||
<!-- Make sure to run :ALEInfo from the buffer where the bug occurred. -->
|
||||
<!-- Read the output. You might figure out what went wrong yourself. -->
|
||||
</details>
|
||||
|
||||
<!-- Paste the output of :ALEInfo here. Try :ALEInfoToClipboard -->
|
||||
<!-- Make sure to run :ALEInfo from the buffer where the bug occurred. -->
|
||||
<!-- Read the output. You might figure out what went wrong yourself. -->
|
||||
|
||||
5
.github/workflows/main.yml
vendored
5
.github/workflows/main.yml
vendored
@@ -27,9 +27,10 @@ jobs:
|
||||
matrix:
|
||||
vim-version:
|
||||
- '--vim-80-only'
|
||||
- '--vim-90-only'
|
||||
- '--vim-82-only'
|
||||
- '--neovim-02-only'
|
||||
- '--neovim-08-only'
|
||||
- '--neovim-04-only'
|
||||
- '--neovim-05-only'
|
||||
- '--linters-only'
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
FROM testbed/vim:24
|
||||
FROM testbed/vim:20
|
||||
|
||||
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.8.0 -build
|
||||
-tag neovim:v0.4.4 -build \
|
||||
-tag neovim:v0.5.0 -build
|
||||
|
||||
ENV PACKAGES="\
|
||||
bash \
|
||||
@@ -24,4 +25,4 @@ RUN git clone https://github.com/junegunn/vader.vim vader && \
|
||||
|
||||
ARG GIT_VERSION
|
||||
LABEL Version=${GIT_VERSION}
|
||||
LABEL Name=denseanalysis/ale
|
||||
LABEL Name=w0rp/ale
|
||||
|
||||
12
README.md
12
README.md
@@ -1,4 +1,4 @@
|
||||
# Asynchronous Lint Engine [](https://github.com/dense-analysis/ale/actions?query=event%3Apush+workflow%3ACI+branch%3Amaster++) [](https://ci.appveyor.com/project/dense-analysis/ale) [](https://discord.gg/5zFD6pQxDk)
|
||||
# Asynchronous Lint Engine [](https://github.com/dense-analysis/ale/actions?query=event%3Apush+workflow%3ACI+branch%3Amaster++) [](https://ci.appveyor.com/project/dense-analysis/ale) [](https://gitter.im/vim-ale/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
|
||||
|
||||

|
||||
@@ -359,7 +359,7 @@ See the Vundle documentation for more information.
|
||||
|
||||
<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)
|
||||
by adding the GitHub path for this repository to your `~/.vimrc`:
|
||||
@@ -386,8 +386,8 @@ If you are interested in the general direction of the project, check out the
|
||||
[wiki home page](https://github.com/dense-analysis/ale/wiki). The wiki includes
|
||||
a Roadmap for the future, and more.
|
||||
|
||||
If you'd liked to discuss ALE and more check out the Dense Analysis Discord
|
||||
server here: https://discord.gg/5zFD6pQxDk
|
||||
If you'd liked to discuss the project more directly, check out the `#vim-ale` channel
|
||||
on Libera Chat. Web chat is available [here](https://web.libera.chat/#vim-ale).
|
||||
|
||||
<a name="faq"></a>
|
||||
|
||||
@@ -931,14 +931,14 @@ If the terminal supports Unicode, you might try setting the value like below, to
|
||||
make it look nicer.
|
||||
|
||||
```vim
|
||||
let g:ale_floating_window_border = ['│', '─', '╭', '╮', '╯', '╰', '│', '─']
|
||||
let g:ale_floating_window_border = ['│', '─', '╭', '╮', '╯', '╰']
|
||||
```
|
||||
|
||||
Since vim's default uses nice unicode characters when possible, you can trick
|
||||
ale into using that default with
|
||||
|
||||
```vim
|
||||
let g:ale_floating_window_border = repeat([''], 8)
|
||||
let g:ale_floating_window_border = repeat([''], 6)
|
||||
```
|
||||
|
||||
<a name="faq-vim-lsp"></a>
|
||||
|
||||
@@ -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')}
|
||||
\})
|
||||
@@ -18,30 +18,9 @@ function! ale_linters#ansible#ansible_lint#Handle(buffer, version, lines) abort
|
||||
endif
|
||||
endfor
|
||||
|
||||
let l:version_group = ale#semver#GTE(a:version, [6, 0, 0]) ? '>=6.0.0' :
|
||||
\ ale#semver#GTE(a:version, [5, 0, 0]) ? '>=5.0.0' :
|
||||
\ '<5.0.0'
|
||||
let l:version_group = ale#semver#GTE(a:version, [5, 0, 0]) ? '>=5.0.0' : '<5.0.0'
|
||||
let l:output = []
|
||||
|
||||
if '>=6.0.0' is# l:version_group
|
||||
let l:error_codes = { 'blocker': 'E', 'critical': 'E', 'major': 'W', 'minor': 'W', 'info': 'I' }
|
||||
let l:linter_issues = ale#util#FuzzyJSONDecode(a:lines, [])
|
||||
|
||||
for l:issue in l:linter_issues
|
||||
if ale#path#IsBufferPath(a:buffer, l:issue.location.path)
|
||||
call add(l:output, {
|
||||
\ 'lnum': exists('l:issue.location.lines.begin.column') ? l:issue.location.lines.begin.line :
|
||||
\ l:issue.location.lines.begin,
|
||||
\ 'col': exists('l:issue.location.lines.begin.column') ? l:issue.location.lines.begin.column : 0,
|
||||
\ 'text': l:issue.check_name,
|
||||
\ 'detail': l:issue.description,
|
||||
\ 'code': l:issue.severity,
|
||||
\ 'type': l:error_codes[l:issue.severity],
|
||||
\})
|
||||
endif
|
||||
endfor
|
||||
endif
|
||||
|
||||
if '>=5.0.0' is# l:version_group
|
||||
" Matches patterns line the following:
|
||||
" test.yml:3:148: syntax-check 'var' is not a valid attribute for a Play
|
||||
@@ -94,13 +73,10 @@ endfunction
|
||||
|
||||
function! ale_linters#ansible#ansible_lint#GetCommand(buffer, version) abort
|
||||
let l:commands = {
|
||||
\ '>=6.0.0': '%e --nocolor -f json -x yaml %s',
|
||||
\ '>=5.0.0': '%e --nocolor --parseable-severity -x yaml %s',
|
||||
\ '<5.0.0': '%e --nocolor -p %t'
|
||||
\}
|
||||
let l:command = ale#semver#GTE(a:version, [6, 0]) ? l:commands['>=6.0.0'] :
|
||||
\ ale#semver#GTE(a:version, [5, 0]) ? l:commands['>=5.0.0'] :
|
||||
\ l:commands['<5.0.0']
|
||||
let l:command = ale#semver#GTE(a:version, [5, 0]) ? l:commands['>=5.0.0'] : l:commands['<5.0.0']
|
||||
|
||||
return l:command
|
||||
endfunction
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
" 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_options', '')
|
||||
@@ -9,9 +9,8 @@ function! ale_linters#awk#gawk#GetCommand(buffer) abort
|
||||
" gawk from attempting to execute the body of the script
|
||||
" it is linting.
|
||||
return '%e --source ' . ale#Escape('BEGIN { exit } END { exit 1 }')
|
||||
\ . ' --lint'
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'awk_gawk_options'))
|
||||
\ . ' -f %t /dev/null'
|
||||
\ . ' -f %t --lint /dev/null'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('awk', {
|
||||
|
||||
@@ -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,
|
||||
\})
|
||||
@@ -3,8 +3,6 @@
|
||||
|
||||
call ale#Set('c_cc_executable', '<auto>')
|
||||
call ale#Set('c_cc_options', '-std=c11 -Wall')
|
||||
call ale#Set('c_cc_use_header_lang_flag', -1)
|
||||
call ale#Set('c_cc_header_exts', ['h'])
|
||||
|
||||
function! ale_linters#c#cc#GetExecutable(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'c_cc_executable')
|
||||
@@ -33,24 +31,12 @@ function! ale_linters#c#cc#GetCommand(buffer, output) abort
|
||||
\ 'g')
|
||||
endif
|
||||
|
||||
" Select the correct language flag depending on the executable, options
|
||||
" and file extension
|
||||
let l:executable = ale_linters#c#cc#GetExecutable(a:buffer)
|
||||
let l:use_header_lang_flag = ale#Var(a:buffer, 'c_cc_use_header_lang_flag')
|
||||
let l:header_exts = ale#Var(a:buffer, 'c_cc_header_exts')
|
||||
let l:lang_flag = ale#c#GetLanguageFlag(
|
||||
\ a:buffer,
|
||||
\ l:executable,
|
||||
\ l:use_header_lang_flag,
|
||||
\ l:header_exts,
|
||||
\ 'c')
|
||||
|
||||
" -iquote with the directory the file is in makes #include work for
|
||||
" headers in the same directory.
|
||||
"
|
||||
" `-o /dev/null` or `-o null` is needed to catch all errors,
|
||||
" -fsyntax-only doesn't catch everything.
|
||||
return '%e -S -x ' . l:lang_flag
|
||||
return '%e -S -x c'
|
||||
\ . ' -o ' . g:ale#util#nul_file
|
||||
\ . ' -iquote %s:h'
|
||||
\ . ale#Pad(l:cflags)
|
||||
|
||||
@@ -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',
|
||||
\})
|
||||
@@ -8,8 +8,7 @@ function! ale_linters#clojure#clj_kondo#GetCommand(buffer) abort
|
||||
|
||||
let l:command = 'clj-kondo'
|
||||
\ . ale#Pad(l:options)
|
||||
\ . ' --lint -'
|
||||
\ . ' --filename %s'
|
||||
\ . ' --lint %t'
|
||||
|
||||
return l:command
|
||||
endfunction
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
|
||||
call ale#Set('cpp_cc_executable', '<auto>')
|
||||
call ale#Set('cpp_cc_options', '-std=c++14 -Wall')
|
||||
call ale#Set('cpp_cc_use_header_lang_flag', -1)
|
||||
call ale#Set('cpp_cc_header_exts', ['h', 'hpp'])
|
||||
|
||||
function! ale_linters#cpp#cc#GetExecutable(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'cpp_cc_executable')
|
||||
@@ -33,24 +31,12 @@ function! ale_linters#cpp#cc#GetCommand(buffer, output) abort
|
||||
\ 'g')
|
||||
endif
|
||||
|
||||
" Select the correct language flag depending on the executable, options
|
||||
" and file extension
|
||||
let l:executable = ale_linters#cpp#cc#GetExecutable(a:buffer)
|
||||
let l:use_header_lang_flag = ale#Var(a:buffer, 'cpp_cc_use_header_lang_flag')
|
||||
let l:header_exts = ale#Var(a:buffer, 'cpp_cc_header_exts')
|
||||
let l:lang_flag = ale#c#GetLanguageFlag(
|
||||
\ a:buffer,
|
||||
\ l:executable,
|
||||
\ l:use_header_lang_flag,
|
||||
\ l:header_exts,
|
||||
\ 'c++')
|
||||
|
||||
" -iquote with the directory the file is in makes #include work for
|
||||
" headers in the same directory.
|
||||
"
|
||||
" `-o /dev/null` or `-o null` is needed to catch all errors,
|
||||
" -fsyntax-only doesn't catch everything.
|
||||
return '%e -S -x ' . l:lang_flag
|
||||
return '%e -S -x c++'
|
||||
\ . ' -o ' . g:ale#util#nul_file
|
||||
\ . ' -iquote %s:h'
|
||||
\ . ale#Pad(l:cflags)
|
||||
|
||||
@@ -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
|
||||
" 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$'
|
||||
let l:options .= !empty(l:options) ? ' -x c++' : '-x c++'
|
||||
endif
|
||||
|
||||
@@ -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'),
|
||||
\})
|
||||
@@ -4,16 +4,15 @@
|
||||
call ale#Set('dart_analyze_executable', 'dart')
|
||||
|
||||
function! ale_linters#dart#dart_analyze#Handle(buffer, lines) abort
|
||||
let l:pattern = '\v([a-z]+) - (.+):(\d+):(\d+) - (.+) - (.+)$'
|
||||
let l:pattern = '\v^ ([a-z]+) - (.+):(\d+):(\d+) - (.+) - (.+)$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
let [l:type, l:filename, l:lnum, l:col, l:message, l:code] = l:match[1:6]
|
||||
call add(l:output, {
|
||||
\ 'type': l:type is# 'error' ? 'E' : l:type is# 'info' ? 'I' : 'W',
|
||||
\ 'text': l:code . ': ' . l:message,
|
||||
\ 'lnum': str2nr(l:lnum),
|
||||
\ 'col': str2nr(l:col),
|
||||
\ 'type': l:match[1] is# 'error' ? 'E' : 'W',
|
||||
\ 'text': l:match[6] . ': ' . l:match[5],
|
||||
\ 'lnum': str2nr(l:match[3]),
|
||||
\ 'col': str2nr(l:match[4]),
|
||||
\})
|
||||
endfor
|
||||
|
||||
@@ -23,7 +22,7 @@ endfunction
|
||||
call ale#linter#Define('dart', {
|
||||
\ 'name': 'dart_analyze',
|
||||
\ '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',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
" always, yes, never
|
||||
call ale#Set('dockerfile_hadolint_use_docker', 'never')
|
||||
call ale#Set('dockerfile_hadolint_docker_image', 'hadolint/hadolint')
|
||||
call ale#Set('dockerfile_hadolint_options', '')
|
||||
|
||||
function! ale_linters#dockerfile#hadolint#Handle(buffer, lines) abort
|
||||
" Matches patterns line the following:
|
||||
@@ -103,7 +102,7 @@ endfunction
|
||||
|
||||
function! ale_linters#dockerfile#hadolint#GetCommand(buffer) abort
|
||||
let l:command = ale_linters#dockerfile#hadolint#GetExecutable(a:buffer)
|
||||
let l:opts = ale#Var(a:buffer, 'dockerfile_hadolint_options') . ' --no-color -'
|
||||
let l:opts = '--no-color -'
|
||||
|
||||
if l:command is# 'docker'
|
||||
return printf('docker run --rm -i %s hadolint %s',
|
||||
|
||||
@@ -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'),
|
||||
\})
|
||||
@@ -24,7 +24,7 @@ function! ale_linters#go#golangci_lint#GetCommand(buffer) abort
|
||||
endfunction
|
||||
|
||||
function! ale_linters#go#golangci_lint#GetMatches(lines) abort
|
||||
let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):?(\d+)?:?:?:?\s\*?(.+)\s+\((.+)\)$'
|
||||
let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):?(\d+)?:?:?:?\s\*?(.+)$'
|
||||
|
||||
return ale#util#GetMatches(a:lines, l:pattern)
|
||||
endfunction
|
||||
@@ -34,20 +34,14 @@ function! ale_linters#go#golangci_lint#Handler(buffer, lines) abort
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale_linters#go#golangci_lint#GetMatches(a:lines)
|
||||
if l:match[5] is# 'typecheck'
|
||||
let l:msg_type = 'E'
|
||||
else
|
||||
let l:msg_type = 'W'
|
||||
endif
|
||||
|
||||
" l:match[1] will already be an absolute path, output from
|
||||
" golangci_lint
|
||||
call add(l:output, {
|
||||
\ 'filename': ale#path#GetAbsPath(l:dir, l:match[1]),
|
||||
\ 'lnum': l:match[2] + 0,
|
||||
\ 'col': l:match[3] + 0,
|
||||
\ 'type': l:msg_type,
|
||||
\ 'text': l:match[4] . ' (' . l:match[5] . ')',
|
||||
\ 'type': 'E',
|
||||
\ 'text': l:match[4],
|
||||
\})
|
||||
endfor
|
||||
|
||||
|
||||
@@ -11,17 +11,10 @@ function! ale_linters#handlebars#embertemplatelint#GetExecutable(buffer) abort
|
||||
endfunction
|
||||
|
||||
function! ale_linters#handlebars#embertemplatelint#GetCommand(buffer, version) abort
|
||||
if ale#semver#GTE(a:version, [4, 0, 0])
|
||||
" --json was removed in favor of --format=json in ember-template-lint@4.0.0
|
||||
return '%e --format=json --filename %s'
|
||||
endif
|
||||
|
||||
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'
|
||||
" Reading from stdin was introduced in ember-template-lint@1.6.0
|
||||
return ale#semver#GTE(a:version, [1, 6, 0])
|
||||
\ ? '%e --json --filename %s'
|
||||
\ : '%e --json %t'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#handlebars#embertemplatelint#GetCommandWithVersionCheck(buffer) abort
|
||||
|
||||
@@ -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'),
|
||||
\})
|
||||
@@ -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'),
|
||||
\})
|
||||
@@ -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',
|
||||
\})
|
||||
@@ -1,7 +1,5 @@
|
||||
" Author: aurieh - https://github.com/aurieh
|
||||
|
||||
call ale#Set('make_checkmake_config', '')
|
||||
|
||||
function! ale_linters#make#checkmake#Handle(buffer, lines) abort
|
||||
let l:pattern = '\v^(\d+):(.+):(.+)$'
|
||||
let l:output = []
|
||||
@@ -19,19 +17,9 @@ function! ale_linters#make#checkmake#Handle(buffer, lines) abort
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
function! ale_linters#make#checkmake#GetCommand(buffer) abort
|
||||
let l:config = ale#Var(a:buffer, 'make_checkmake_config')
|
||||
let l:cmd = 'checkmake'
|
||||
\ . ' --format="{{.LineNumber}}:{{.Rule}}:{{.Violation}}{{\"\r\n\"}}"'
|
||||
\ . (!empty(l:config) ? ' --config="' . l:config . '"' : '')
|
||||
\ . ' %s'
|
||||
|
||||
return l:cmd
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('make', {
|
||||
\ 'name': 'checkmake',
|
||||
\ 'executable': 'checkmake',
|
||||
\ 'command': function('ale_linters#make#checkmake#GetCommand'),
|
||||
\ 'command': 'checkmake %s --format="{{.LineNumber}}:{{.Rule}}:{{.Violation}}{{\"\r\n\"}}"',
|
||||
\ 'callback': 'ale_linters#make#checkmake#Handle',
|
||||
\})
|
||||
|
||||
@@ -1,15 +1,10 @@
|
||||
" Author: Ty-Lucas Kelley <tylucaskelley@gmail.com>
|
||||
" Description: Adds support for markdownlint
|
||||
|
||||
call ale#Set('markdown_markdownlint_executable', 'markdownlint')
|
||||
call ale#Set('markdown_markdownlint_options', '')
|
||||
|
||||
function! ale_linters#markdown#markdownlint#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'markdown_markdownlint_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#markdown#markdownlint#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#markdown#markdownlint#GetExecutable(a:buffer)
|
||||
let l:executable = 'markdownlint'
|
||||
|
||||
let l:options = ale#Var(a:buffer, 'markdown_markdownlint_options')
|
||||
|
||||
@@ -19,7 +14,7 @@ endfunction
|
||||
|
||||
call ale#linter#Define('markdown', {
|
||||
\ 'name': 'markdownlint',
|
||||
\ 'executable': function('ale_linters#markdown#markdownlint#GetExecutable'),
|
||||
\ 'executable': 'markdownlint',
|
||||
\ 'lint_file': 1,
|
||||
\ 'output_stream': 'both',
|
||||
\ 'command': function('ale_linters#markdown#markdownlint#GetCommand'),
|
||||
|
||||
@@ -17,7 +17,7 @@ function! ale_linters#matlab#mlint#Handle(buffer, lines) abort
|
||||
let l:code = l:match[3]
|
||||
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
|
||||
if l:code is# 'FNDEF'
|
||||
continue
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
function! ale_linters#nix#nix#Command(buffer, output, meta) abort
|
||||
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 -'
|
||||
else
|
||||
return 'nix-instantiate --parse -'
|
||||
|
||||
@@ -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,
|
||||
\ })
|
||||
@@ -13,7 +13,7 @@ function! ale_linters#powershell#psscriptanalyzer#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'powershell_psscriptanalyzer_executable')
|
||||
endfunction
|
||||
|
||||
" Run Invoke-ScriptAnalyzer and output each linting message as 4 separate lines
|
||||
" Run Invoke-ScriptAnalyzer and output each linting message as 4 seperate lines
|
||||
" for each parsing
|
||||
function! ale_linters#powershell#psscriptanalyzer#GetCommand(buffer) abort
|
||||
let l:exclude_option = ale#Var(
|
||||
|
||||
@@ -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',
|
||||
\})
|
||||
@@ -22,22 +22,6 @@ function! ale_linters#python#pylama#GetExecutable(buffer) abort
|
||||
return ale#python#FindExecutable(a:buffer, 'python_pylama', ['pylama'])
|
||||
endfunction
|
||||
|
||||
function! ale_linters#python#pylama#RunWithVersionCheck(buffer) abort
|
||||
let l:executable = ale_linters#python#pylama#GetExecutable(a:buffer)
|
||||
let l:exec_args = l:executable =~? 'pipenv\|poetry$'
|
||||
\ ? ' run pylama'
|
||||
\ : ''
|
||||
|
||||
let l:command = ale#Escape(l:executable) . l:exec_args . ' --version'
|
||||
|
||||
return ale#semver#RunWithVersionCheck(
|
||||
\ a:buffer,
|
||||
\ l:executable,
|
||||
\ l:command,
|
||||
\ function('ale_linters#python#pylama#GetCommand'),
|
||||
\)
|
||||
endfunction
|
||||
|
||||
function! ale_linters#python#pylama#GetCwd(buffer) abort
|
||||
if ale#Var(a:buffer, 'python_pylama_change_directory')
|
||||
" Pylama loads its configuration from the current directory only, and
|
||||
@@ -51,33 +35,27 @@ function! ale_linters#python#pylama#GetCwd(buffer) abort
|
||||
return ''
|
||||
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:exec_args = l:executable =~? 'pipenv\|poetry$'
|
||||
\ ? ' run pylama'
|
||||
\ : ''
|
||||
|
||||
" json format is added in version 8.1.4
|
||||
" https://github.com/klen/pylama/blob/develop/Changelog
|
||||
let l:format_json_args = ale#semver#GTE(a:version, [8, 1, 4])
|
||||
\ ? ' --format json'
|
||||
\ : ''
|
||||
|
||||
" Note: Using %t to lint changes would be preferable, but many pylama
|
||||
" checks use surrounding paths (e.g. C0103 module name, E0402 relative
|
||||
" import beyond top, etc.). Neither is ideal.
|
||||
return ale#Escape(l:executable) . l:exec_args
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'python_pylama_options'))
|
||||
\ . l:format_json_args
|
||||
\ . ' %s'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#python#pylama#Handle(buffer, version, lines) abort
|
||||
function! ale_linters#python#pylama#Handle(buffer, lines) abort
|
||||
if empty(a:lines)
|
||||
return []
|
||||
endif
|
||||
|
||||
let l:output = ale#python#HandleTraceback(a:lines, 1)
|
||||
let l:pattern = '\v^.{-}:([0-9]+):([0-9]+): +%(([A-Z][0-9]+):? +)?(.*)$'
|
||||
|
||||
" First letter of error code is a pylint-compatible message type
|
||||
" http://pylint.pycqa.org/en/latest/user_guide/output.html#source-code-analysis-section
|
||||
@@ -97,41 +75,16 @@ function! ale_linters#python#pylama#Handle(buffer, version, lines) abort
|
||||
\ 'D': 'style',
|
||||
\}
|
||||
|
||||
if ale#semver#GTE(a:version, [8, 1, 4])
|
||||
try
|
||||
let l:errors = json_decode(join(a:lines, ''))
|
||||
catch
|
||||
return l:output
|
||||
endtry
|
||||
|
||||
if empty(l:errors)
|
||||
return l:output
|
||||
endif
|
||||
|
||||
for l:error in l:errors
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:error['lnum'],
|
||||
\ 'col': l:error['col'],
|
||||
\ 'code': l:error['number'],
|
||||
\ 'type': get(l:pylint_type_to_ale_type, l:error['etype'], 'W'),
|
||||
\ 'sub_type': get(l:pylint_type_to_ale_sub_type, l:error['etype'], ''),
|
||||
\ 'text': printf('%s [%s]', l:error['message'], l:error['source']),
|
||||
\})
|
||||
endfor
|
||||
else
|
||||
let l:pattern = '\v^.{-}:([0-9]+):([0-9]+): +%(([A-Z][0-9]+):? +)?(.*)$'
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'lnum': str2nr(l:match[1]),
|
||||
\ 'col': str2nr(l:match[2]),
|
||||
\ 'code': l:match[3],
|
||||
\ 'type': get(l:pylint_type_to_ale_type, l:match[3][0], 'W'),
|
||||
\ 'sub_type': get(l:pylint_type_to_ale_sub_type, l:match[3][0], ''),
|
||||
\ 'text': l:match[4],
|
||||
\})
|
||||
endfor
|
||||
endif
|
||||
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
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
@@ -140,15 +93,7 @@ call ale#linter#Define('python', {
|
||||
\ 'name': 'pylama',
|
||||
\ 'executable': function('ale_linters#python#pylama#GetExecutable'),
|
||||
\ 'cwd': function('ale_linters#python#pylama#GetCwd'),
|
||||
\ 'command': function('ale_linters#python#pylama#RunWithVersionCheck'),
|
||||
\ 'callback': {buffer, lines -> ale#semver#RunWithVersionCheck(
|
||||
\ buffer,
|
||||
\ ale_linters#python#pylama#GetExecutable(buffer),
|
||||
\ '%e --version',
|
||||
\ {buffer, version -> ale_linters#python#pylama#Handle(
|
||||
\ buffer,
|
||||
\ l:version,
|
||||
\ lines)},
|
||||
\ )},
|
||||
\ 'command': function('ale_linters#python#pylama#GetCommand'),
|
||||
\ 'callback': 'ale_linters#python#pylama#Handle',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
||||
|
||||
@@ -22,19 +22,6 @@ function! ale_linters#python#pylsp#GetExecutable(buffer) abort
|
||||
return ale#python#FindExecutable(a:buffer, 'python_pylsp', ['pylsp'])
|
||||
endfunction
|
||||
|
||||
" Force the cwd of the server to be the same as the project root to
|
||||
" fix issues with treating local files matching first or third party library
|
||||
" names being imported incorrectly.
|
||||
function! ale_linters#python#pylsp#GetCwd(buffer) abort
|
||||
let l:fake_linter = {
|
||||
\ 'name': 'pylsp',
|
||||
\ 'project_root': function('ale#python#FindProjectRoot'),
|
||||
\}
|
||||
let l:root = ale#lsp_linter#FindProjectRoot(a:buffer, l:fake_linter)
|
||||
|
||||
return !empty(l:root) ? l:root : v:null
|
||||
endfunction
|
||||
|
||||
function! ale_linters#python#pylsp#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#python#pylsp#GetExecutable(a:buffer)
|
||||
|
||||
@@ -49,7 +36,6 @@ call ale#linter#Define('python', {
|
||||
\ 'name': 'pylsp',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': function('ale_linters#python#pylsp#GetExecutable'),
|
||||
\ 'cwd': function('ale_linters#python#pylsp#GetCwd'),
|
||||
\ 'command': function('ale_linters#python#pylsp#GetCommand'),
|
||||
\ 'project_root': function('ale#python#FindProjectRoot'),
|
||||
\ 'completion_filter': 'ale#completion#python#CompletionItemFilter',
|
||||
|
||||
@@ -32,24 +32,10 @@ function! ale_linters#python#pyright#GetConfig(buffer) abort
|
||||
return l:config
|
||||
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', {
|
||||
\ 'name': 'pyright',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': {b -> ale#Var(b, 'python_pyright_executable')},
|
||||
\ 'cwd': function('ale_linters#python#pyright#GetCwd'),
|
||||
\ 'command': '%e --stdio',
|
||||
\ 'project_root': function('ale#python#FindProjectRoot'),
|
||||
\ 'completion_filter': 'ale#completion#python#CompletionItemFilter',
|
||||
|
||||
@@ -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,
|
||||
\})
|
||||
@@ -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,
|
||||
\})
|
||||
@@ -1,4 +0,0 @@
|
||||
scriptencoding utf-8
|
||||
" Description: cspell support for rego files.
|
||||
|
||||
call ale#handlers#cspell#DefineLinter('rego')
|
||||
@@ -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',
|
||||
\})
|
||||
@@ -9,21 +9,9 @@ function! ale_linters#rust#analyzer#GetCommand(buffer) abort
|
||||
endfunction
|
||||
|
||||
function! ale_linters#rust#analyzer#GetProjectRoot(buffer) abort
|
||||
" Try to find nearest Cargo.toml for cargo projects
|
||||
let l:cargo_file = ale#path#FindNearestFile(a:buffer, 'Cargo.toml')
|
||||
|
||||
if !empty(l:cargo_file)
|
||||
return fnamemodify(l:cargo_file, ':h')
|
||||
endif
|
||||
|
||||
" Try to find nearest rust-project.json for non-cargo projects
|
||||
let l:rust_project = ale#path#FindNearestFile(a:buffer, 'rust-project.json')
|
||||
|
||||
if !empty(l:rust_project)
|
||||
return fnamemodify(l:rust_project, ':h')
|
||||
endif
|
||||
|
||||
return ''
|
||||
return !empty(l:cargo_file) ? fnamemodify(l:cargo_file, ':h') : ''
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('rust', {
|
||||
|
||||
@@ -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',
|
||||
\})
|
||||
@@ -21,13 +21,7 @@ function! ale_linters#terraform#terraform#GetType(severity) abort
|
||||
endfunction
|
||||
|
||||
function! ale_linters#terraform#terraform#GetDetail(error) abort
|
||||
let l:detail = get(a:error, 'detail', '')
|
||||
|
||||
if strlen(l:detail) > 0
|
||||
return l:detail
|
||||
else
|
||||
return get(a:error, 'summary', '')
|
||||
endif
|
||||
return get(a:error, 'detail', get(a:error, 'summary', ''))
|
||||
endfunction
|
||||
|
||||
function! ale_linters#terraform#terraform#Handle(buffer, lines) abort
|
||||
|
||||
@@ -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',
|
||||
\})
|
||||
@@ -13,7 +13,7 @@ function! ale_linters#tex#lacheck#Handle(buffer, lines) abort
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
" lacheck follows `\input{}` commands. If the cwd is not the same as the
|
||||
" file in the buffer then it will fail to find the inputted items. We do not
|
||||
" file in the buffer then it will fail to find the inputed items. We do not
|
||||
" want warnings from those items anyway
|
||||
if !empty(matchstr(l:match[3], '^Could not open ".\+"$'))
|
||||
continue
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
" Description: Volar Language Server integration for ALE adopted from
|
||||
" nvim-lspconfig and volar/packages/shared/src/types.ts
|
||||
|
||||
call ale#Set('vue_volar_executable', 'vue-language-server')
|
||||
call ale#Set('vue_volar_executable', 'volar-server')
|
||||
call ale#Set('vue_volar_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
call ale#Set('vue_volar_init_options', {
|
||||
\ 'documentFeatures': {
|
||||
@@ -73,7 +73,7 @@ call ale#linter#Define('vue', {
|
||||
\ 'name': 'volar',
|
||||
\ 'language': 'vue',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': {b -> ale#path#FindExecutable(b, 'vue_volar', ['node_modules/.bin/vue-language-server'])},
|
||||
\ 'executable': {b -> ale#path#FindExecutable(b, 'vue_volar', ['node_modules/.bin/volar-server'])},
|
||||
\ 'command': '%e --stdio',
|
||||
\ 'project_root': function('ale_linters#vue#volar#GetProjectRoot'),
|
||||
\ 'initialization_options': function('ale_linters#vue#volar#GetInitializationOptions'),
|
||||
|
||||
@@ -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',
|
||||
\})
|
||||
@@ -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',
|
||||
\})
|
||||
@@ -157,7 +157,7 @@ function! ale#Queue(delay, ...) abort
|
||||
endif
|
||||
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.
|
||||
function! ale#Has(feature) abort
|
||||
|
||||
@@ -585,38 +585,3 @@ function! ale#c#IncludeOptions(include_paths) abort
|
||||
|
||||
return join(l:option_list)
|
||||
endfunction
|
||||
|
||||
" Get the language flag depending on on the executable, options and
|
||||
" file extension
|
||||
function! ale#c#GetLanguageFlag(
|
||||
\ buffer,
|
||||
\ executable,
|
||||
\ use_header_lang_flag,
|
||||
\ header_exts,
|
||||
\ linter_lang_flag
|
||||
\) abort
|
||||
" Use only '-header' if the executable is 'clang' by default
|
||||
if a:use_header_lang_flag == -1
|
||||
let l:use_header_lang_flag = a:executable =~# 'clang'
|
||||
else
|
||||
let l:use_header_lang_flag = a:use_header_lang_flag
|
||||
endif
|
||||
|
||||
" If we don't use the header language flag, return the default linter
|
||||
" language flag
|
||||
if !l:use_header_lang_flag
|
||||
return a:linter_lang_flag
|
||||
endif
|
||||
|
||||
" Get the buffer file extension
|
||||
let l:buf_ext = expand('#' . a:buffer . ':e')
|
||||
|
||||
" If the buffer file is an header according to its extension, use
|
||||
" the linter language flag + '-header', ex: 'c-header'
|
||||
if index(a:header_exts, l:buf_ext) >= 0
|
||||
return a:linter_lang_flag . '-header'
|
||||
endif
|
||||
|
||||
" Else, use the default linter language flag
|
||||
return a:linter_lang_flag
|
||||
endfunction
|
||||
|
||||
@@ -216,7 +216,7 @@ function! s:UpdateCursor(cursor, start, end, offset) abort
|
||||
" to the end of the changes
|
||||
let l:cur_line = l:end_line + l:line_offset
|
||||
let l:cur_column = l:end_column + l:column_offset
|
||||
" else is not necessary, it means modifications are happening
|
||||
" else is not necesary, it means modifications are happening
|
||||
" after the cursor so no cursor updates need to be done
|
||||
endif
|
||||
endif
|
||||
|
||||
@@ -457,7 +457,7 @@ function! s:ExecuteGetCodeFix(linter, range, MenuCallback) abort
|
||||
let [l:end_line, l:end_column] = getpos("'>")[1:2]
|
||||
endif
|
||||
|
||||
let l:column = 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:Callback = function(
|
||||
|
||||
@@ -130,17 +130,14 @@ let s:should_complete_map = {
|
||||
\ '<default>': '\v[a-zA-Z$_][a-zA-Z$_0-9]*$|\.$',
|
||||
\ 'clojure': s:lisp_regex,
|
||||
\ 'lisp': s:lisp_regex,
|
||||
\ 'racket': '\k\+$',
|
||||
\ 'typescript': '\v[a-zA-Z$_][a-zA-Z$_0-9]*$|\.$|''$|"$',
|
||||
\ 'rust': '\v[a-zA-Z$_][a-zA-Z$_0-9]*$|\.$|::$',
|
||||
\ 'cpp': '\v[a-zA-Z$_][a-zA-Z$_0-9]*$|\.$|::$|-\>$',
|
||||
\ 'c': '\v[a-zA-Z$_][a-zA-Z$_0-9]*$|\.$|-\>$',
|
||||
\}
|
||||
|
||||
" Regular expressions for finding the start column to replace with completion.
|
||||
let s:omni_start_map = {
|
||||
\ '<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
|
||||
@@ -150,7 +147,6 @@ let s:trigger_character_map = {
|
||||
\ 'typescript': ['.', '''', '"'],
|
||||
\ 'rust': ['.', '::'],
|
||||
\ 'cpp': ['.', '::', '->'],
|
||||
\ 'c': ['.', '->'],
|
||||
\}
|
||||
|
||||
function! s:GetFiletypeValue(map, filetype) abort
|
||||
@@ -585,7 +581,7 @@ function! ale#completion#ParseLSPCompletions(response) abort
|
||||
continue
|
||||
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
|
||||
let l:text = l:item.textEdit.newText
|
||||
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 get(g:, 'ale_completion_tsserver_autoimport') is 1
|
||||
" no-custom-checks
|
||||
echom '`g:ale_completion_tsserver_autoimport` is deprecated. Use `g:ale_completion_autoimport` instead.'
|
||||
execute 'echom `g:ale_completion_tsserver_autoimport` is deprecated. Use `g:ale_completion_autoimport` instead.'''
|
||||
endif
|
||||
|
||||
let l:message = ale#lsp#tsserver_message#Completions(
|
||||
|
||||
@@ -10,21 +10,12 @@ let g:ale_echo_msg_format = get(g:, 'ale_echo_msg_format', '%code: %%s')
|
||||
|
||||
let s:cursor_timer = -1
|
||||
|
||||
" A wrapper for echon so we can test messages we echo in Vader tests.
|
||||
function! ale#cursor#Echom(message) abort
|
||||
" no-custom-checks
|
||||
exec "norm! :echom a:message\n"
|
||||
endfunction
|
||||
|
||||
function! ale#cursor#TruncatedEcho(original_message) abort
|
||||
let l:message = a:original_message
|
||||
" Change tabs to spaces.
|
||||
let l:message = substitute(l:message, "\t", ' ', 'g')
|
||||
" Remove any newlines in the message.
|
||||
let l:message = substitute(l:message, "\n", '', 'g')
|
||||
" Convert indentation groups into single spaces for better legibility when
|
||||
" put on a single line
|
||||
let l:message = substitute(l:message, ' \+', ' ', 'g')
|
||||
|
||||
" We need to remember the setting for shortmess and reset it again.
|
||||
let l:shortmess_options = &l:shortmess
|
||||
@@ -36,7 +27,7 @@ function! ale#cursor#TruncatedEcho(original_message) abort
|
||||
silent! setlocal shortmess+=T
|
||||
|
||||
try
|
||||
call ale#cursor#Echom(l:message)
|
||||
exec "norm! :echomsg l:message\n"
|
||||
catch /^Vim\%((\a\+)\)\=:E523/
|
||||
" Fallback into manual truncate (#1987)
|
||||
let l:winwidth = winwidth(0)
|
||||
@@ -96,9 +87,7 @@ function! ale#cursor#EchoCursorWarning(...) abort
|
||||
elseif get(l:info, 'echoed')
|
||||
" We'll only clear the echoed message when moving off errors once,
|
||||
" so we don't continually clear the echo line.
|
||||
"
|
||||
" no-custom-checks
|
||||
echo
|
||||
execute 'echo'
|
||||
let l:info.echoed = 0
|
||||
endif
|
||||
endif
|
||||
@@ -161,8 +150,7 @@ function! s:ShowCursorDetailForItem(loc, options) abort
|
||||
|
||||
" Clear the echo message if we manually displayed details.
|
||||
if !l:stay_here
|
||||
" no-custom-checks
|
||||
echo
|
||||
execute 'echo'
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
|
||||
@@ -62,8 +62,7 @@ let s:global_variable_list = [
|
||||
\]
|
||||
|
||||
function! s:Echo(message) abort
|
||||
" no-custom-checks
|
||||
echo a:message
|
||||
execute 'echo a:message'
|
||||
endfunction
|
||||
|
||||
function! s:GetLinterVariables(filetype, exclude_linter_names) abort
|
||||
|
||||
@@ -121,12 +121,6 @@ function! s:OnReady(line, column, options, capability, linter, lsp_details) abor
|
||||
\ a:line,
|
||||
\ a:column
|
||||
\)
|
||||
elseif a:capability is# 'implementation'
|
||||
let l:message = ale#lsp#tsserver_message#Implementation(
|
||||
\ l:buffer,
|
||||
\ a:line,
|
||||
\ a:column
|
||||
\)
|
||||
endif
|
||||
else
|
||||
" Send a message saying the buffer has changed first, or the
|
||||
@@ -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)
|
||||
elseif a:capability is# 'typeDefinition'
|
||||
let l:message = ale#lsp#message#TypeDefinition(l:buffer, a:line, a:column)
|
||||
elseif a:capability is# 'implementation'
|
||||
let l:message = ale#lsp#message#Implementation(l:buffer, a:line, a:column)
|
||||
else
|
||||
" XXX: log here?
|
||||
return
|
||||
@@ -183,14 +175,6 @@ function! ale#definition#GoToType(options) abort
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
function! ale#definition#GoToImpl(options) abort
|
||||
for l:linter in ale#linter#Get(&filetype)
|
||||
if !empty(l:linter.lsp)
|
||||
call s:GoToLSPDefinition(l:linter, a:options, 'implementation')
|
||||
endif
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
function! ale#definition#GoToCommandHandler(command, ...) abort
|
||||
let l:options = {}
|
||||
|
||||
@@ -216,8 +200,6 @@ function! ale#definition#GoToCommandHandler(command, ...) abort
|
||||
|
||||
if a:command is# 'type'
|
||||
call ale#definition#GoToType(l:options)
|
||||
elseif a:command is# 'implementation'
|
||||
call ale#definition#GoToImpl(l:options)
|
||||
else
|
||||
call ale#definition#GoTo(l:options)
|
||||
endif
|
||||
|
||||
@@ -203,10 +203,6 @@ function! ale#engine#SetResults(buffer, loclist) abort
|
||||
call ale#highlight#SetHighlights(a:buffer, a:loclist)
|
||||
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 g:ale_echo_cursor
|
||||
" Try and echo the warning now.
|
||||
@@ -214,7 +210,7 @@ function! ale#engine#SetResults(buffer, loclist) abort
|
||||
call ale#cursor#EchoCursorWarning()
|
||||
endif
|
||||
|
||||
if g:ale_virtualtext_cursor is# 'current' || g:ale_virtualtext_cursor == 1
|
||||
if g:ale_virtualtext_cursor
|
||||
" Try and show the warning now.
|
||||
" This will only do something meaningful if we're in normal mode.
|
||||
call ale#virtualtext#ShowCursorWarning()
|
||||
|
||||
@@ -139,7 +139,7 @@ function! ale#events#Init() abort
|
||||
autocmd InsertLeave * if exists('*ale#engine#Cleanup') | call ale#cursor#EchoCursorWarning() | 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
|
||||
" Look for a warning to echo as soon as we leave Insert mode.
|
||||
" The script's position variable used when moving the cursor will
|
||||
|
||||
@@ -77,8 +77,7 @@ function! ale#fix#ApplyFixes(buffer, output) abort
|
||||
call remove(g:ale_fix_buffer_data, a:buffer)
|
||||
|
||||
if !l:data.ignore_file_changed_errors
|
||||
" no-custom-checks
|
||||
echoerr 'The file was changed before fixing finished'
|
||||
execute 'echoerr ''The file was changed before fixing finished'''
|
||||
endif
|
||||
|
||||
return
|
||||
@@ -359,8 +358,7 @@ function! ale#fix#Fix(buffer, fixing_flag, ...) abort
|
||||
\ 'There is no fixer named `%s`. Check :ALEFixSuggest',
|
||||
\ l:function_name,
|
||||
\)
|
||||
" no-custom-checks
|
||||
echom l:echo_message
|
||||
execute 'echom l:echo_message'
|
||||
endif
|
||||
|
||||
return 0
|
||||
@@ -368,8 +366,7 @@ function! ale#fix#Fix(buffer, fixing_flag, ...) abort
|
||||
|
||||
if empty(l:callback_list)
|
||||
if a:fixing_flag is# ''
|
||||
" no-custom-checks
|
||||
echom 'No fixers have been defined. Try :ALEFixSuggest'
|
||||
execute 'echom ''No fixers have been defined. Try :ALEFixSuggest'''
|
||||
endif
|
||||
|
||||
return 0
|
||||
|
||||
@@ -37,21 +37,11 @@ let s:default_registry = {
|
||||
\ 'suggested_filetypes': ['python'],
|
||||
\ 'description': 'Fix PEP8 issues with black.',
|
||||
\ },
|
||||
\ 'buf-format': {
|
||||
\ 'function': 'ale#fixers#buf_format#Fix',
|
||||
\ 'suggested_filetypes': ['proto'],
|
||||
\ 'description': 'Fix .proto files with buf format.',
|
||||
\ },
|
||||
\ 'buildifier': {
|
||||
\ 'function': 'ale#fixers#buildifier#Fix',
|
||||
\ 'suggested_filetypes': ['bzl'],
|
||||
\ 'description': 'Format BUILD and .bzl files with buildifier.',
|
||||
\ },
|
||||
\ 'css-beautify': {
|
||||
\ 'function': 'ale#fixers#css_beautify#Fix',
|
||||
\ 'suggested_filetypes': ['css'],
|
||||
\ 'description': 'Format CSS using css-beautify from js-beautify.',
|
||||
\ },
|
||||
\ 'deno': {
|
||||
\ 'function': 'ale#fixers#deno#Fix',
|
||||
\ 'suggested_filetypes': ['typescript'],
|
||||
@@ -83,11 +73,6 @@ let s:default_registry = {
|
||||
\ 'suggested_filetypes': ['dhall'],
|
||||
\ 'description': 'Standard code formatter for the Dhall language and removing dead code',
|
||||
\ },
|
||||
\ 'dune': {
|
||||
\ 'function': 'ale#fixers#dune#Fix',
|
||||
\ 'suggested_filetypes': ['dune'],
|
||||
\ 'description': 'Fix dune files with dune format',
|
||||
\ },
|
||||
\ 'fecs': {
|
||||
\ 'function': 'ale#fixers#fecs#Fix',
|
||||
\ 'suggested_filetypes': ['javascript', 'css', 'html'],
|
||||
@@ -146,11 +131,6 @@ let s:default_registry = {
|
||||
\ 'description': 'Apply prettier-eslint to a file.',
|
||||
\ 'aliases': ['prettier-eslint'],
|
||||
\ },
|
||||
\ 'pyflyby': {
|
||||
\ 'function': 'ale#fixers#pyflyby#Fix',
|
||||
\ 'suggested_filetypes': ['python'],
|
||||
\ 'description': 'Tidy Python imports with pyflyby.',
|
||||
\ },
|
||||
\ 'importjs': {
|
||||
\ 'function': 'ale#fixers#importjs#Fix',
|
||||
\ 'suggested_filetypes': ['javascript'],
|
||||
@@ -226,11 +206,6 @@ let s:default_registry = {
|
||||
\ 'suggested_filetypes': ['swift'],
|
||||
\ 'description': 'Apply SwiftFormat to a file.',
|
||||
\ },
|
||||
\ 'syntax_tree': {
|
||||
\ 'function': 'ale#fixers#syntax_tree#Fix',
|
||||
\ 'suggested_filetypes': ['ruby'],
|
||||
\ 'description': 'Fix ruby files with stree write',
|
||||
\ },
|
||||
\ 'apple-swift-format': {
|
||||
\ 'function': 'ale#fixers#appleswiftformat#Fix',
|
||||
\ 'suggested_filetypes': ['swift'],
|
||||
@@ -246,11 +221,6 @@ let s:default_registry = {
|
||||
\ 'suggested_filetypes': ['php'],
|
||||
\ 'description': 'Fix PHP files with php-cs-fixer.',
|
||||
\ },
|
||||
\ 'pint': {
|
||||
\ 'function': 'ale#fixers#pint#Fix',
|
||||
\ 'suggested_filetypes': ['php'],
|
||||
\ 'description': 'Fix PHP files with Laravel Pint.',
|
||||
\ },
|
||||
\ 'astyle': {
|
||||
\ 'function': 'ale#fixers#astyle#Fix',
|
||||
\ 'suggested_filetypes': ['c', 'cpp'],
|
||||
@@ -263,8 +233,8 @@ let s:default_registry = {
|
||||
\ },
|
||||
\ 'clang-format': {
|
||||
\ 'function': 'ale#fixers#clangformat#Fix',
|
||||
\ 'suggested_filetypes': ['c', 'cpp', 'cs', 'cuda', 'java', 'javascript', 'json', 'objc', 'proto'],
|
||||
\ 'description': 'Fix C, C++, C#, CUDA, Java, JavaScript, JSON, ObjectiveC and Protobuf files with clang-format.',
|
||||
\ 'suggested_filetypes': ['c', 'cpp', 'cuda'],
|
||||
\ 'description': 'Fix C/C++ and cuda files with clang-format.',
|
||||
\ },
|
||||
\ 'cmakeformat': {
|
||||
\ 'function': 'ale#fixers#cmakeformat#Fix',
|
||||
@@ -386,11 +356,6 @@ let s:default_registry = {
|
||||
\ 'suggested_filetypes': ['sh'],
|
||||
\ 'description': 'Fix sh files with shfmt.',
|
||||
\ },
|
||||
\ 'sqlfluff': {
|
||||
\ 'function': 'ale#fixers#sqlfluff#Fix',
|
||||
\ 'suggested_filetypes': ['sql'],
|
||||
\ 'description': 'Fix SQL files with sqlfluff.',
|
||||
\ },
|
||||
\ 'sqlfmt': {
|
||||
\ 'function': 'ale#fixers#sqlfmt#Fix',
|
||||
\ 'suggested_filetypes': ['sql'],
|
||||
@@ -466,11 +431,6 @@ let s:default_registry = {
|
||||
\ 'suggested_filetypes': ['hcl', 'terraform'],
|
||||
\ 'description': 'Fix tf and hcl files with terraform fmt.',
|
||||
\ },
|
||||
\ 'packer': {
|
||||
\ 'function': 'ale#fixers#packer#Fix',
|
||||
\ 'suggested_filetypes': ['hcl', 'packer'],
|
||||
\ 'description': 'Fix Packer HCL files with packer fmt.',
|
||||
\ },
|
||||
\ 'crystal': {
|
||||
\ 'function': 'ale#fixers#crystal#Fix',
|
||||
\ 'suggested_filetypes': ['cr'],
|
||||
@@ -524,7 +484,7 @@ let s:default_registry = {
|
||||
\ 'html-beautify': {
|
||||
\ 'function': 'ale#fixers#html_beautify#Fix',
|
||||
\ 'suggested_filetypes': ['html', 'htmldjango'],
|
||||
\ 'description': 'Fix HTML files with html-beautify from js-beautify.',
|
||||
\ 'description': 'Fix HTML files with html-beautify.',
|
||||
\ },
|
||||
\ 'lua-format': {
|
||||
\ 'function': 'ale#fixers#lua_format#Fix',
|
||||
@@ -538,7 +498,7 @@ let s:default_registry = {
|
||||
\ },
|
||||
\ 'dprint': {
|
||||
\ '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',
|
||||
\ },
|
||||
\ 'stylua': {
|
||||
@@ -561,30 +521,10 @@ let s:default_registry = {
|
||||
\ 'suggested_filetypes': ['pascal'],
|
||||
\ 'description': 'Fix Pascal files with ptop.',
|
||||
\ },
|
||||
\ 'opafmt': {
|
||||
\ 'function': 'ale#fixers#opafmt#Fix',
|
||||
\ 'suggested_filetypes': ['rego'],
|
||||
\ 'description': 'Fix rego files with opa fmt.',
|
||||
\ },
|
||||
\ 'vfmt': {
|
||||
\ 'function': 'ale#fixers#vfmt#Fix',
|
||||
\ 'suggested_filetypes': ['v'],
|
||||
\ 'description': 'A formatter for V source code.',
|
||||
\ },
|
||||
\ 'zigfmt': {
|
||||
\ 'function': 'ale#fixers#zigfmt#Fix',
|
||||
\ 'suggested_filetypes': ['zig'],
|
||||
\ 'description': 'Official formatter for Zig',
|
||||
\ },
|
||||
\ '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.',
|
||||
\ }
|
||||
\}
|
||||
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -1,9 +1,10 @@
|
||||
" 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_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
call ale#Set('html_beautify_options', '')
|
||||
call ale#Set('html_beautify_change_directory', 1)
|
||||
|
||||
function! ale#fixers#html_beautify#Fix(buffer) abort
|
||||
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')
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable) . ' ' . l:options . ' -',
|
||||
\ 'command': ale#Escape(l:executable). ' ' . l:options . ' -',
|
||||
\}
|
||||
endfunction
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -5,13 +5,27 @@ scriptencoding utf-8
|
||||
call ale#Set('sh_shfmt_executable', 'shfmt')
|
||||
call ale#Set('sh_shfmt_options', '')
|
||||
|
||||
function! s:DefaultOption(buffer) abort
|
||||
if getbufvar(a:buffer, '&expandtab') == 0
|
||||
" Tab is used by default
|
||||
return ''
|
||||
endif
|
||||
|
||||
let l:tabsize = getbufvar(a:buffer, '&shiftwidth')
|
||||
|
||||
if l:tabsize == 0
|
||||
let l:tabsize = getbufvar(a:buffer, '&tabstop')
|
||||
endif
|
||||
|
||||
return ' -i ' . l:tabsize
|
||||
endfunction
|
||||
|
||||
function! ale#fixers#shfmt#Fix(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'sh_shfmt_executable')
|
||||
let l:options = ale#Var(a:buffer, 'sh_shfmt_options')
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable)
|
||||
\ . ' -filename=%s'
|
||||
\ . (empty(l:options) ? '' : ' ' . l:options)
|
||||
\ . (empty(l:options) ? s:DefaultOption(a:buffer) : ' ' . l:options)
|
||||
\}
|
||||
endfunction
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -1,15 +1,13 @@
|
||||
" Author: Jan-Grimo Sobez <jan-grimo.sobez@phys.chem.ethz.ch>
|
||||
" Author: Kevin Clark <kevin.clark@gmail.com>
|
||||
" Author: D. Ben Knoble <ben.knoble+github@gmail.com>
|
||||
" Author: Shaun Duncan <shaun.duncan@gmail.com>
|
||||
" Description: Floating preview window for showing whatever information in.
|
||||
|
||||
" Precondition: exists('*nvim_open_win') || has('popupwin')
|
||||
|
||||
function! ale#floating_preview#Show(lines, ...) abort
|
||||
if !exists('*nvim_open_win') && !has('popupwin')
|
||||
" no-custom-checks
|
||||
echom 'Floating windows not supported in this vim instance.'
|
||||
execute 'echom ''Floating windows not supported in this vim instance.'''
|
||||
|
||||
return
|
||||
endif
|
||||
@@ -107,20 +105,18 @@ function! s:NvimPrepareWindowContent(lines) abort
|
||||
let l:width += 2
|
||||
let l:height += 2
|
||||
|
||||
let l:left = get(g:ale_floating_window_border, 0, '|')
|
||||
let l:top = get(g:ale_floating_window_border, 1, '-')
|
||||
let l:top_left = get(g:ale_floating_window_border, 2, '+')
|
||||
let l:top_right = get(g:ale_floating_window_border, 3, '+')
|
||||
let l:bottom_right = get(g:ale_floating_window_border, 4, '+')
|
||||
let l:bottom_left = get(g:ale_floating_window_border, 5, '+')
|
||||
let l:right = get(g:ale_floating_window_border, 6, l:left)
|
||||
let l:bottom = get(g:ale_floating_window_border, 7, l:top)
|
||||
let l:hor = g:ale_floating_window_border[0]
|
||||
let l:top = g:ale_floating_window_border[1]
|
||||
let l:top_left = g:ale_floating_window_border[2]
|
||||
let l:top_right = g:ale_floating_window_border[3]
|
||||
let l:bottom_right = g:ale_floating_window_border[4]
|
||||
let l:bottom_left = g:ale_floating_window_border[5]
|
||||
|
||||
let l:lines = [l:top_left . repeat(l:top, l:width - 2) . l:top_right]
|
||||
|
||||
for l:line in a:lines
|
||||
let l:line_width = strchars(l:line)
|
||||
let l:lines = add(l:lines, l: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
|
||||
|
||||
" Truncate the lines
|
||||
@@ -128,24 +124,21 @@ function! s:NvimPrepareWindowContent(lines) abort
|
||||
let l:lines = l:lines[0:l:max_height]
|
||||
endif
|
||||
|
||||
let l:lines = add(l:lines, l:bottom_left . repeat(l: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]
|
||||
endfunction
|
||||
|
||||
function! s:NvimCreate(options) abort
|
||||
let l:popup_opts = extend({
|
||||
\ 'relative': 'cursor',
|
||||
\ 'row': 1,
|
||||
\ 'col': 0,
|
||||
\ 'width': 42,
|
||||
\ 'height': 4,
|
||||
\ 'style': 'minimal'
|
||||
\ }, s:GetPopupOpts())
|
||||
|
||||
let l:buffer = nvim_create_buf(v:false, v:false)
|
||||
let l:winid = nvim_open_win(l:buffer, v:false, 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, 'bufhidden', 'delete')
|
||||
call nvim_buf_set_option(l:buffer, 'swapfile', v:false)
|
||||
@@ -155,8 +148,7 @@ function! s:NvimCreate(options) abort
|
||||
endfunction
|
||||
|
||||
function! s:VimCreate(options) abort
|
||||
" default options
|
||||
let l:popup_opts = extend({
|
||||
let l:popup_id = popup_create([], {
|
||||
\ 'line': 'cursor+1',
|
||||
\ 'col': 'cursor',
|
||||
\ 'drag': v:true,
|
||||
@@ -165,19 +157,17 @@ function! s:VimCreate(options) abort
|
||||
\ 'padding': [0, 1, 0, 1],
|
||||
\ 'border': [],
|
||||
\ 'borderchars': empty(g:ale_floating_window_border) ? [' '] : [
|
||||
\ get(g:ale_floating_window_border, 1, '-'),
|
||||
\ get(g:ale_floating_window_border, 6, '|'),
|
||||
\ get(g:ale_floating_window_border, 7, '-'),
|
||||
\ get(g:ale_floating_window_border, 0, '|'),
|
||||
\ get(g:ale_floating_window_border, 2, '+'),
|
||||
\ get(g:ale_floating_window_border, 3, '+'),
|
||||
\ get(g:ale_floating_window_border, 4, '+'),
|
||||
\ get(g:ale_floating_window_border, 5, '+'),
|
||||
\ g:ale_floating_window_border[1],
|
||||
\ g:ale_floating_window_border[0],
|
||||
\ g:ale_floating_window_border[1],
|
||||
\ g:ale_floating_window_border[0],
|
||||
\ g:ale_floating_window_border[2],
|
||||
\ g:ale_floating_window_border[3],
|
||||
\ g:ale_floating_window_border[4],
|
||||
\ g:ale_floating_window_border[5],
|
||||
\ ],
|
||||
\ 'moved': 'any',
|
||||
\ }, s:GetPopupOpts())
|
||||
|
||||
let l:popup_id = popup_create([], l:popup_opts)
|
||||
\ })
|
||||
call setbufvar(winbufnr(l:popup_id), '&filetype', get(a:options, 'filetype', 'ale-preview'))
|
||||
let w:preview = {'id': l:popup_id}
|
||||
endfunction
|
||||
@@ -211,21 +201,3 @@ function! s:VimClose() abort
|
||||
call popup_close(w:preview['id'])
|
||||
unlet w:preview
|
||||
endfunction
|
||||
|
||||
" get either the results of a function callback or dictionary for popup overrides
|
||||
function! s:GetPopupOpts() abort
|
||||
if exists('g:ale_floating_preview_popup_opts')
|
||||
let l:ref = g:ale_floating_preview_popup_opts
|
||||
|
||||
if type(l:ref) is# v:t_dict
|
||||
return l:ref
|
||||
elseif type(l:ref) is# v:t_string
|
||||
try
|
||||
return function(l:ref)()
|
||||
catch /E700/
|
||||
endtry
|
||||
endif
|
||||
endif
|
||||
|
||||
return {}
|
||||
endfunction
|
||||
|
||||
@@ -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
|
||||
@@ -29,8 +29,6 @@ function! ale#handlers#deno#GetProjectRoot(buffer) abort
|
||||
endif
|
||||
|
||||
let l:possible_project_roots = [
|
||||
\ 'deno.json',
|
||||
\ 'deno.jsonc',
|
||||
\ 'tsconfig.json',
|
||||
\ '.git',
|
||||
\ bufname(a:buffer),
|
||||
|
||||
@@ -19,16 +19,6 @@ let s:temp_regex_prefix =
|
||||
\ . substitute(s:temp_dir, '\\', '\\\\', 'g')
|
||||
\ . '\.\{-}'
|
||||
|
||||
function! s:PanicOutput(lines) abort
|
||||
return [{
|
||||
\ 'lnum': 1,
|
||||
\ 'col': 1,
|
||||
\ 'text': 'ghc panic!',
|
||||
\ 'type': 'E',
|
||||
\ 'detail' : join(a:lines, "\n"),
|
||||
\}]
|
||||
endfunction
|
||||
|
||||
function! ale#handlers#haskell#HandleGHCFormat(buffer, lines) abort
|
||||
" Look for lines like the following.
|
||||
"
|
||||
@@ -44,14 +34,6 @@ function! ale#handlers#haskell#HandleGHCFormat(buffer, lines) abort
|
||||
|
||||
let l:corrected_lines = []
|
||||
|
||||
" If ghc panic error, put the whole message in details and exit.
|
||||
let l:panic_position = match(a:lines,'ghc: panic!')
|
||||
let l:panic_end = match(a:lines,'Please report this as a GHC bug:')
|
||||
|
||||
if l:panic_position >= 0
|
||||
return s:PanicOutput(a:lines[l:panic_position : l:panic_end])
|
||||
endif
|
||||
|
||||
" Group the lines into smaller lists.
|
||||
for l:line in a:lines
|
||||
if len(matchlist(l:line, l:pattern)) > 0
|
||||
|
||||
@@ -13,7 +13,7 @@ function! ale#handlers#hdl_checker#IsDotGit(path) abort
|
||||
return ! empty(a:path) && isdirectory(a:path)
|
||||
endfunction
|
||||
|
||||
" Should return (in order of preference)
|
||||
" Sould return (in order of preference)
|
||||
" 1. Nearest config file
|
||||
" 2. Nearest .git directory
|
||||
" 3. The current path
|
||||
|
||||
@@ -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
|
||||
@@ -46,7 +46,7 @@ function! ale#hover#HandleTSServerResponse(conn_id, response) abort
|
||||
call balloon_show(a:response.body.displayString)
|
||||
elseif get(l:options, 'truncated_echo', 0)
|
||||
if !empty(a:response.body.displayString)
|
||||
call ale#cursor#TruncatedEcho(a:response.body.displayString)
|
||||
call ale#cursor#TruncatedEcho(split(a:response.body.displayString, "\n")[0])
|
||||
endif
|
||||
elseif g:ale_hover_to_floating_preview || g:ale_floating_preview
|
||||
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')
|
||||
call balloon_show(join(l:lines, "\n"))
|
||||
elseif get(l:options, 'truncated_echo', 0)
|
||||
if type(l:lines[0]) is# v:t_list
|
||||
call ale#cursor#TruncatedEcho(join(l:lines[0], '\n'))
|
||||
else
|
||||
call ale#cursor#TruncatedEcho(l:lines[0])
|
||||
endif
|
||||
call ale#cursor#TruncatedEcho(l:lines[0])
|
||||
elseif g:ale_hover_to_floating_preview || g:ale_floating_preview
|
||||
call ale#floating_preview#Show(l:lines, {
|
||||
\ 'filetype': 'ale-preview.message',
|
||||
@@ -339,10 +335,6 @@ function! ale#hover#ShowTruncatedMessageAtCursor() abort
|
||||
let l:buffer = bufnr('')
|
||||
let l:pos = getpos('.')[0:2]
|
||||
|
||||
if !getbufvar(l:buffer, 'ale_enabled', 1)
|
||||
return
|
||||
endif
|
||||
|
||||
if l:pos != s:last_pos
|
||||
let s:last_pos = l:pos
|
||||
let [l:info, l:loc] = ale#util#FindItemAtCursor(l:buffer)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
" Author: Horacio Sanson https://github.com/hsanson
|
||||
" Description: Functions for integrating with Java tools
|
||||
|
||||
" Find the nearest dir contining a gradle or pom file and assume it
|
||||
" Find the nearest dir contining a gradle or pom file and asume it
|
||||
" the root of a java app.
|
||||
function! ale#java#FindProjectRoot(buffer) abort
|
||||
let l:gradle_root = ale#gradle#FindProjectRoot(a:buffer)
|
||||
|
||||
@@ -187,16 +187,10 @@ function! ale#job#PrepareCommand(buffer, command) abort
|
||||
\ : a:command
|
||||
|
||||
" If a custom shell is specified, use that.
|
||||
if exists('b:ale_shell')
|
||||
let l:ale_shell = b:ale_shell
|
||||
elseif exists('g:ale_shell')
|
||||
let l:ale_shell = g:ale_shell
|
||||
endif
|
||||
if exists('g:ale_shell')
|
||||
let l:shell_arguments = get(g:, 'ale_shell_arguments', &shellcmdflag)
|
||||
|
||||
if exists('l:ale_shell')
|
||||
let l:shell_arguments = get(b:, 'ale_shell_arguments', get(g:, 'ale_shell_arguments', &shellcmdflag))
|
||||
|
||||
return split(l:ale_shell) + split(l:shell_arguments) + [l:command]
|
||||
return split(g:ale_shell) + split(l:shell_arguments) + [l:command]
|
||||
endif
|
||||
|
||||
if has('win32')
|
||||
@@ -250,16 +244,10 @@ function! ale#job#Start(command, options) abort
|
||||
|
||||
if has_key(a:options, 'out_cb')
|
||||
let l:job_options.out_cb = function('s:VimOutputCallback')
|
||||
else
|
||||
" prevent buffering of output and excessive polling in case close_cb is set
|
||||
let l:job_options.out_cb = {->0}
|
||||
endif
|
||||
|
||||
if has_key(a:options, 'err_cb')
|
||||
let l:job_options.err_cb = function('s:VimErrorCallback')
|
||||
else
|
||||
" prevent buffering of output and excessive polling in case close_cb is set
|
||||
let l:job_options.err_cb = {->0}
|
||||
endif
|
||||
|
||||
if has_key(a:options, 'exit_cb')
|
||||
|
||||
@@ -19,7 +19,6 @@ let s:default_ale_linter_aliases = {
|
||||
\ 'rmd': 'r',
|
||||
\ 'systemverilog': 'verilog',
|
||||
\ 'typescriptreact': ['typescript', 'tsx'],
|
||||
\ 'vader': ['vim', 'vader'],
|
||||
\ 'verilog_systemverilog': ['verilog_systemverilog', 'verilog'],
|
||||
\ 'vimwiki': 'markdown',
|
||||
\ 'vue': ['vue', 'javascript'],
|
||||
@@ -46,20 +45,18 @@ let s:default_ale_linters = {
|
||||
\ 'hack': ['hack'],
|
||||
\ 'help': [],
|
||||
\ 'inko': ['inko'],
|
||||
\ 'json': ['jsonlint', 'spectral', 'vscodejson'],
|
||||
\ 'json': ['jsonlint', 'spectral'],
|
||||
\ 'json5': [],
|
||||
\ 'jsonc': [],
|
||||
\ 'perl': ['perlcritic'],
|
||||
\ 'perl6': [],
|
||||
\ 'python': ['flake8', 'mypy', 'pylint', 'pyright', 'ruff'],
|
||||
\ 'python': ['flake8', 'mypy', 'pylint', 'pyright'],
|
||||
\ 'rust': ['cargo', 'rls'],
|
||||
\ 'spec': [],
|
||||
\ 'text': [],
|
||||
\ 'vader': ['vimls'],
|
||||
\ 'vue': ['eslint', 'vls'],
|
||||
\ 'zsh': ['shell'],
|
||||
\ 'v': ['v'],
|
||||
\ 'yaml': ['spectral', 'yaml-language-server', 'yamllint'],
|
||||
\}
|
||||
|
||||
" Testing/debugging helper to unload all linters.
|
||||
|
||||
@@ -18,7 +18,7 @@ if !exists('s:timer_args')
|
||||
let s:timer_args = {}
|
||||
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
|
||||
let l:res = getqflist({ 'winid' : winnr() })
|
||||
|
||||
@@ -190,7 +190,7 @@ function! s:RestoreViewIfNeeded(buffer) abort
|
||||
return
|
||||
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
|
||||
let l:current_view = winsaveview()
|
||||
|
||||
|
||||
@@ -44,7 +44,6 @@ function! ale#lsp#Register(executable_or_address, project, init_options) abort
|
||||
\ 'completion_trigger_characters': [],
|
||||
\ 'definition': 0,
|
||||
\ 'typeDefinition': 0,
|
||||
\ 'implementation': 0,
|
||||
\ 'symbol_search': 0,
|
||||
\ 'code_actions': 0,
|
||||
\ 'did_save': 0,
|
||||
@@ -260,14 +259,6 @@ function! s:UpdateCapabilities(conn, capabilities) abort
|
||||
let a:conn.capabilities.typeDefinition = 1
|
||||
endif
|
||||
|
||||
if get(a:capabilities, 'implementationProvider') is v:true
|
||||
let a:conn.capabilities.implementation = 1
|
||||
endif
|
||||
|
||||
if type(get(a:capabilities, 'implementationProvider')) is v:t_dict
|
||||
let a:conn.capabilities.implementation = 1
|
||||
endif
|
||||
|
||||
if get(a:capabilities, 'workspaceSymbolProvider') is v:true
|
||||
let a:conn.capabilities.symbol_search = 1
|
||||
endif
|
||||
@@ -388,7 +379,6 @@ function! ale#lsp#MarkConnectionAsTsserver(conn_id) abort
|
||||
let l:conn.capabilities.completion_trigger_characters = ['.']
|
||||
let l:conn.capabilities.definition = 1
|
||||
let l:conn.capabilities.typeDefinition = 1
|
||||
let l:conn.capabilities.implementation = 1
|
||||
let l:conn.capabilities.symbol_search = 1
|
||||
let l:conn.capabilities.rename = 1
|
||||
let l:conn.capabilities.filerename = 1
|
||||
@@ -448,20 +438,11 @@ function! s:SendInitMessage(conn) abort
|
||||
\ 'typeDefinition': {
|
||||
\ 'dynamicRegistration': v:false,
|
||||
\ },
|
||||
\ 'implementation': {
|
||||
\ 'dynamicRegistration': v:false,
|
||||
\ 'linkSupport': v:false,
|
||||
\ },
|
||||
\ 'publishDiagnostics': {
|
||||
\ 'relatedInformation': v:true,
|
||||
\ },
|
||||
\ 'codeAction': {
|
||||
\ 'dynamicRegistration': v:false,
|
||||
\ 'codeActionLiteralSupport': {
|
||||
\ 'codeActionKind': {
|
||||
\ 'valueSet': []
|
||||
\ }
|
||||
\ }
|
||||
\ },
|
||||
\ 'rename': {
|
||||
\ 'dynamicRegistration': v:false,
|
||||
|
||||
@@ -139,15 +139,6 @@ function! ale#lsp#message#TypeDefinition(buffer, line, column) abort
|
||||
\}]
|
||||
endfunction
|
||||
|
||||
function! ale#lsp#message#Implementation(buffer, line, column) abort
|
||||
return [0, 'textDocument/implementation', {
|
||||
\ 'textDocument': {
|
||||
\ 'uri': ale#util#ToURI(expand('#' . a:buffer . ':p')),
|
||||
\ },
|
||||
\ 'position': {'line': a:line - 1, 'character': a:column - 1},
|
||||
\}]
|
||||
endfunction
|
||||
|
||||
function! ale#lsp#message#References(buffer, line, column) abort
|
||||
return [0, 'textDocument/references', {
|
||||
\ 'textDocument': {
|
||||
|
||||
@@ -72,14 +72,6 @@ function! ale#lsp#tsserver_message#TypeDefinition(buffer, line, column) abort
|
||||
\}]
|
||||
endfunction
|
||||
|
||||
function! ale#lsp#tsserver_message#Implementation(buffer, line, column) abort
|
||||
return [0, 'ts@implementation', {
|
||||
\ 'line': a:line,
|
||||
\ 'offset': a:column,
|
||||
\ 'file': expand('#' . a:buffer . ':p'),
|
||||
\}]
|
||||
endfunction
|
||||
|
||||
function! ale#lsp#tsserver_message#References(buffer, line, column) abort
|
||||
return [0, 'ts@references', {
|
||||
\ 'line': a:line,
|
||||
|
||||
@@ -141,10 +141,6 @@ function! s:HandleLSPErrorMessage(linter_name, response) abort
|
||||
return
|
||||
endif
|
||||
|
||||
call ale#lsp_linter#AddErrorMessage(a:linter_name, l:message)
|
||||
endfunction
|
||||
|
||||
function! ale#lsp_linter#AddErrorMessage(linter_name, message) abort
|
||||
" This global variable is set here so we don't load the debugging.vim file
|
||||
" until someone uses :ALEInfo.
|
||||
let g:ale_lsp_error_messages = get(g:, 'ale_lsp_error_messages', {})
|
||||
@@ -153,7 +149,7 @@ function! ale#lsp_linter#AddErrorMessage(linter_name, message) abort
|
||||
let g:ale_lsp_error_messages[a:linter_name] = []
|
||||
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
|
||||
|
||||
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 there's no project root, then we can't check files with LSP,
|
||||
" unless we are using tsserver, which doesn't use project roots.
|
||||
call ale#lsp_linter#AddErrorMessage(a:linter.name, "Failed to find project root, language server won't start.")
|
||||
|
||||
return 0
|
||||
endif
|
||||
|
||||
|
||||
@@ -26,15 +26,12 @@ function! ale#python#FindProjectRootIni(buffer) abort
|
||||
\|| filereadable(l:path . '/tox.ini')
|
||||
\|| filereadable(l:path . '/.pyre_configuration.local')
|
||||
\|| filereadable(l:path . '/mypy.ini')
|
||||
\|| filereadable(l:path . '/.mypy.ini')
|
||||
\|| filereadable(l:path . '/pycodestyle.cfg')
|
||||
\|| filereadable(l:path . '/.flake8')
|
||||
\|| filereadable(l:path . '/.flake8rc')
|
||||
\|| filereadable(l:path . '/pylama.ini')
|
||||
\|| filereadable(l:path . '/pylintrc')
|
||||
\|| filereadable(l:path . '/.pylintrc')
|
||||
\|| filereadable(l:path . '/pyrightconfig.json')
|
||||
\|| filereadable(l:path . '/pyrightconfig.toml')
|
||||
\|| filereadable(l:path . '/Pipfile')
|
||||
\|| filereadable(l:path . '/Pipfile.lock')
|
||||
\|| filereadable(l:path . '/poetry.lock')
|
||||
|
||||
@@ -62,34 +62,25 @@ function! ale#test#SetFilename(path) abort
|
||||
silent! noautocmd execute 'file ' . fnameescape(l:full_path)
|
||||
endfunction
|
||||
|
||||
function! RemoveNewerKeys(results) abort
|
||||
function! s:RemoveModule(results) abort
|
||||
for l:item in a:results
|
||||
if has_key(l:item, 'module')
|
||||
call remove(l:item, 'module')
|
||||
endif
|
||||
|
||||
if has_key(l:item, 'end_col')
|
||||
call remove(l:item, 'end_col')
|
||||
endif
|
||||
|
||||
if has_key(l:item, 'end_lnum')
|
||||
call remove(l:item, 'end_lnum')
|
||||
endif
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
" Return loclist data with only the keys supported by the lowest Vim versions.
|
||||
function! ale#test#GetLoclistWithoutNewerKeys() abort
|
||||
" Return loclist data without the module string, only in newer Vim versions.
|
||||
function! ale#test#GetLoclistWithoutModule() abort
|
||||
let l:results = getloclist(0)
|
||||
call RemoveNewerKeys(l:results)
|
||||
call s:RemoveModule(l:results)
|
||||
|
||||
return l:results
|
||||
endfunction
|
||||
|
||||
" Return quickfix data with only the keys supported by the lowest Vim versions.
|
||||
function! ale#test#GetQflistWithoutNewerKeys() abort
|
||||
function! ale#test#GetQflistWithoutModule() abort
|
||||
let l:results = getqflist()
|
||||
call RemoveNewerKeys(l:results)
|
||||
call s:RemoveModule(l:results)
|
||||
|
||||
return l:results
|
||||
endfunction
|
||||
|
||||
@@ -14,8 +14,8 @@ function! s:DisablePostamble() abort
|
||||
call ale#highlight#UpdateHighlights()
|
||||
endif
|
||||
|
||||
if g:ale_virtualtext_cursor is# 'current' || g:ale_virtualtext_cursor == 1
|
||||
call ale#virtualtext#Clear(bufnr(''))
|
||||
if g:ale_virtualtext_cursor
|
||||
call ale#virtualtext#Clear()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
@@ -64,8 +64,7 @@ function! ale#toggle#ToggleBuffer(buffer) abort
|
||||
" Disabling ALE globally removes autocmd events, so we cannot enable
|
||||
" linting locally when linting is disabled globally
|
||||
if l:enabled && !g:ale_enabled
|
||||
" no-custom-checks
|
||||
echom 'ALE cannot be enabled locally when disabled globally'
|
||||
execute 'echom ''ALE cannot be enabled locally when disabled globally'''
|
||||
|
||||
return
|
||||
endif
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
|
||||
function! s:OpenJDTLink(root, uri, line, column, options, result) abort
|
||||
if has_key(a:result, 'error')
|
||||
" no-custom-checks
|
||||
echoerr a:result.error.message
|
||||
execute 'echoerr a:result.error.message'
|
||||
|
||||
return
|
||||
endif
|
||||
@@ -12,8 +11,7 @@ function! s:OpenJDTLink(root, uri, line, column, options, result) abort
|
||||
let l:contents = a:result['result']
|
||||
|
||||
if type(l:contents) is# type(v:null)
|
||||
" no-custom-checks
|
||||
echoerr 'File content not found'
|
||||
execute 'echoerr ''File content not found'''
|
||||
endif
|
||||
|
||||
" disable autocmd when opening buffer
|
||||
@@ -61,8 +59,7 @@ endfunction
|
||||
|
||||
function! s:ReadClassFileContents(uri, result) abort
|
||||
if has_key(a:result, 'error')
|
||||
" no-custom-checks
|
||||
echoerr a:result.error.message
|
||||
execute 'echoerr a:result.error.message'
|
||||
|
||||
return
|
||||
endif
|
||||
@@ -70,8 +67,7 @@ function! s:ReadClassFileContents(uri, result) abort
|
||||
let l:contents = a:result['result']
|
||||
|
||||
if type(l:contents) is# type(v:null)
|
||||
" no-custom-checks
|
||||
echoerr 'File content not found'
|
||||
execute 'echoerr ''File content not found'''
|
||||
endif
|
||||
|
||||
call setline(1, split(l:contents, '\n'))
|
||||
|
||||
@@ -25,8 +25,7 @@ function! ale#util#ShowMessage(string, ...) abort
|
||||
|
||||
" We have to assume the user is using a monospace font.
|
||||
if has('nvim') || (a:string !~? "\n" && len(a:string) < &columns)
|
||||
" no-custom-checks
|
||||
echo a:string
|
||||
execute 'echo a:string'
|
||||
else
|
||||
call ale#preview#Show(split(a:string, "\n"), extend(
|
||||
\ {
|
||||
|
||||
@@ -8,59 +8,52 @@ let g:ale_virtualtext_delay = get(g:, 'ale_virtualtext_delay', 10)
|
||||
let s:cursor_timer = -1
|
||||
let s:last_pos = [0, 0, 0]
|
||||
let s:has_virt_text = 0
|
||||
let s:emulate_virt = 0
|
||||
|
||||
if has('nvim-0.3.2')
|
||||
let s:ns_id = nvim_create_namespace('ale')
|
||||
let s:has_virt_text = 1
|
||||
elseif has('textprop') && has('popupwin')
|
||||
call prop_type_add('ale', {})
|
||||
let s:last_popup = -1
|
||||
let s:has_virt_text = 1
|
||||
let s:emulate_virt = !has('patch-9.0.0297')
|
||||
let s:hl_list = []
|
||||
|
||||
if s:emulate_virt
|
||||
call prop_type_add('ale', {})
|
||||
let s:last_virt = -1
|
||||
endif
|
||||
endif
|
||||
|
||||
function! ale#virtualtext#Clear(buf) abort
|
||||
function! ale#virtualtext#Clear() abort
|
||||
if !s:has_virt_text
|
||||
return
|
||||
endif
|
||||
|
||||
let l:buffer = bufnr('')
|
||||
|
||||
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
|
||||
if s:emulate_virt && s:last_virt != -1
|
||||
if s:last_popup != -1
|
||||
call prop_remove({'type': 'ale'})
|
||||
call popup_close(s:last_virt)
|
||||
let s:last_virt = -1
|
||||
elseif !empty(s:hl_list)
|
||||
call prop_remove({
|
||||
\ 'types': s:hl_list,
|
||||
\ 'all': 1,
|
||||
\ 'bufnr': a:buf})
|
||||
call popup_close(s:last_popup)
|
||||
let s:last_popup = -1
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! ale#virtualtext#ShowMessage(message, hl_group, buf, line) abort
|
||||
if !s:has_virt_text || !bufexists(str2nr(a:buf))
|
||||
function! ale#virtualtext#ShowMessage(message, hl_group) abort
|
||||
if !s:has_virt_text
|
||||
return
|
||||
endif
|
||||
|
||||
let l:line = line('.')
|
||||
let l:buffer = bufnr('')
|
||||
let l:prefix = get(g:, 'ale_virtualtext_prefix', '> ')
|
||||
let l:msg = l:prefix.trim(substitute(a:message, '\n', ' ', 'g'))
|
||||
|
||||
if has('nvim')
|
||||
call nvim_buf_set_virtual_text(a:buf, s:ns_id, a:line-1, [[l:msg, a:hl_group]], {})
|
||||
elseif s:emulate_virt
|
||||
call nvim_buf_set_virtual_text(l:buffer, s:ns_id, l:line-1, [[l:msg, a:hl_group]], {})
|
||||
else
|
||||
let l:left_pad = col('$')
|
||||
call prop_add(a:line, l:left_pad, {
|
||||
call prop_add(l:line, l:left_pad, {
|
||||
\ 'type': 'ale',
|
||||
\})
|
||||
let s:last_virt = popup_create(l:msg, {
|
||||
let s:last_popup = popup_create(l:msg, {
|
||||
\ 'line': -1,
|
||||
\ 'padding': [0, 0, 0, 1],
|
||||
\ 'mask': [[1, 1, 1, 1]],
|
||||
@@ -70,19 +63,6 @@ function! ale#virtualtext#ShowMessage(message, hl_group, buf, line) abort
|
||||
\ 'wrap': 0,
|
||||
\ '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
|
||||
endfunction
|
||||
|
||||
@@ -93,26 +73,8 @@ function! s:StopCursorTimer() abort
|
||||
endif
|
||||
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
|
||||
if g:ale_virtualtext_cursor isnot# 'current' && g:ale_virtualtext_cursor != 1
|
||||
if !g:ale_virtualtext_cursor
|
||||
return
|
||||
endif
|
||||
|
||||
@@ -128,21 +90,35 @@ function! ale#virtualtext#ShowCursorWarning(...) abort
|
||||
|
||||
let [l:info, l:loc] = ale#util#FindItemAtCursor(l:buffer)
|
||||
|
||||
call ale#virtualtext#Clear(l:buffer)
|
||||
call ale#virtualtext#Clear()
|
||||
|
||||
if !empty(l:loc)
|
||||
let l:msg = l:loc.text
|
||||
let l:hl_group = 'ALEVirtualTextInfo'
|
||||
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)
|
||||
call ale#virtualtext#ShowMessage(l:msg, l:hl_group, l:buffer, line('.'))
|
||||
|
||||
if l:type is# 'E'
|
||||
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
|
||||
endfunction
|
||||
|
||||
function! ale#virtualtext#ShowCursorWarningWithDelay() abort
|
||||
let l:buffer = bufnr('')
|
||||
|
||||
if g:ale_virtualtext_cursor isnot# 'current' && g:ale_virtualtext_cursor != 1
|
||||
if !g:ale_virtualtext_cursor
|
||||
return
|
||||
endif
|
||||
|
||||
@@ -169,19 +145,3 @@ function! ale#virtualtext#ShowCursorWarningWithDelay() abort
|
||||
endif
|
||||
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
|
||||
|
||||
@@ -1,28 +1,6 @@
|
||||
===============================================================================
|
||||
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*
|
||||
@@ -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.
|
||||
|
||||
|
||||
===============================================================================
|
||||
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:
|
||||
|
||||
@@ -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:
|
||||
@@ -133,42 +133,7 @@ g:ale_c_cc_options *g:ale_c_cc_options*
|
||||
Type: |String|
|
||||
Default: `'-std=c11 -Wall'`
|
||||
|
||||
This variable can be changed to modify flags given to the C compiler.
|
||||
|
||||
|
||||
g:ale_c_cc_use_header_lang_flag *g:ale_c_cc_use_header_lang_flag*
|
||||
*b:ale_c_cc_use_header_lang_flag*
|
||||
Type: |Number|
|
||||
Default: `-1`
|
||||
|
||||
By default, ALE will use `'-x c-header'` instead of `'-x c'` for header files
|
||||
when using Clang.
|
||||
|
||||
This variable can be changed to manually activate or deactivate this flag
|
||||
for header files.
|
||||
|
||||
- When set to `-1`, the default beviour is used, `'-x c-header'` is used with
|
||||
Clang and `'-x c'` is used with other compilers.
|
||||
- When set to `0`, the flag is deactivated, `'-x c'` is always used
|
||||
independently of the compiler.
|
||||
- When set to `1`, the flag is activated, `'-x c-header'` is always used
|
||||
independently of the compiler.
|
||||
|
||||
Gcc does not support `'-x c-header'` when using `'-'` as input filename,
|
||||
which is what ALE does. This why, by default, ALE only uses `'-x c-header'`
|
||||
with Clang.
|
||||
|
||||
|
||||
g:ale_c_cc_header_exts *g:ale_c_cc_header_exts*
|
||||
*b:ale_c_cc_header_exts*
|
||||
Type: |List|
|
||||
Default: `['h']`
|
||||
|
||||
This variable can be changed to modify the list of extensions of the files
|
||||
considered as header files.
|
||||
|
||||
This variable is only used when `'-x c-header'` is used instead of `'-x c'`,
|
||||
see |ale_c_cc_use_header_lang_flag|.
|
||||
This variable can be change to modify flags given to the C compiler.
|
||||
|
||||
|
||||
===============================================================================
|
||||
|
||||
@@ -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'
|
||||
@@ -62,42 +62,7 @@ g:ale_cpp_cc_options *g:ale_cpp_cc_options*
|
||||
Type: |String|
|
||||
Default: `'-std=c++14 -Wall'`
|
||||
|
||||
This variable can be changed to modify flags given to the C++ compiler.
|
||||
|
||||
|
||||
g:ale_cpp_cc_use_header_lang_flag *g:ale_cpp_cc_use_header_lang_flag*
|
||||
*b:ale_cpp_cc_use_header_lang_flag*
|
||||
Type: |Number|
|
||||
Default: `-1`
|
||||
|
||||
By default, ALE will use `'-x c++-header'` instead of `'-x c++'` for header
|
||||
files when using Clang.
|
||||
|
||||
This variable can be changed to manually activate or deactivate this flag
|
||||
for header files.
|
||||
|
||||
- When set to `-1`, the default beviour is used, `'-x c++-header'` is used with
|
||||
Clang and `'-x c++'` is used with other compilers.
|
||||
- When set to `0`, the flag is deactivated, `'-x c++'` is always used
|
||||
independently of the compiler.
|
||||
- When set to `1`, the flag is activated, `'-x c++-header'` is always used
|
||||
independently of the compiler.
|
||||
|
||||
Gcc does not support `'-x c++-header'` when using `'-'` as input filename,
|
||||
which is what ALE does. This why, by default, ALE only uses `'-x c++-header'`
|
||||
with Clang.
|
||||
|
||||
|
||||
g:ale_cpp_cc_header_exts *g:ale_cpp_cc_header_exts*
|
||||
*b:ale_cpp_cc_header_exts*
|
||||
Type: |List|
|
||||
Default: `['h', 'hpp']`
|
||||
|
||||
This variable can be changed to modify the list of extensions of the files
|
||||
considered as header files.
|
||||
|
||||
This variable is only used when `'-x c++-header'` is used instead of `'-x c++'`,
|
||||
see |ale_cpp_cc_use_header_lang_flag|.
|
||||
This variable can be change to modify flags given to the C++ compiler.
|
||||
|
||||
|
||||
===============================================================================
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
===============================================================================
|
||||
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*
|
||||
|
||||
|
||||
@@ -8,33 +8,6 @@ cspell *ale-css-cspell*
|
||||
See |ale-cspell-options|
|
||||
|
||||
|
||||
===============================================================================
|
||||
css-beautify *ale-css-css-beautify*
|
||||
|
||||
g:ale_css_css_beautify_executable *g:ale_css_css_beautify_executable*
|
||||
*b:ale_css_css_beautify_executable*
|
||||
Type: |String|
|
||||
Default: `'css-beautify'`
|
||||
|
||||
See |ale-integrations-local-executables|
|
||||
|
||||
|
||||
g:ale_css_css_beautify_options *g:ale_css_css_beautify_options*
|
||||
*b:ale_css_css_beautify_options*
|
||||
Type: |String|
|
||||
Default: `''`
|
||||
|
||||
This variable can be set to pass additional options to css-beautify.
|
||||
|
||||
|
||||
g:ale_css_css_beautify_use_global *g:ale_css_css_beautify_use_global*
|
||||
*b:ale_css_css_beautify_use_global*
|
||||
Type: |String|
|
||||
Default: `get(g:, 'ale_use_global_executables', 0)`
|
||||
|
||||
See |ale-integrations-local-executables|
|
||||
|
||||
|
||||
===============================================================================
|
||||
fecs *ale-css-fecs*
|
||||
|
||||
@@ -76,18 +49,5 @@ g:ale_css_stylelint_use_global *g:ale_css_stylelint_use_global*
|
||||
See |ale-integrations-local-executables|
|
||||
|
||||
|
||||
===============================================================================
|
||||
vscodecss *ale-css-vscode*
|
||||
|
||||
Website: https://github.com/hrsh7th/vscode-langservers-extracted
|
||||
|
||||
Installation
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
Install VSCode css language server either globally or locally: >
|
||||
|
||||
npm install -g vscode-langservers-extracted
|
||||
<
|
||||
|
||||
===============================================================================
|
||||
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:
|
||||
|
||||
@@ -2,32 +2,6 @@
|
||||
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*
|
||||
|
||||
@@ -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.
|
||||
|
||||
===============================================================================
|
||||
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:
|
||||
|
||||
@@ -15,7 +15,6 @@ CONTENTS *ale-development-contents*
|
||||
4.2. Writing Fixer Tests..............|ale-development-fixer-tests|
|
||||
4.3. Running Tests in a Windows VM....|ale-development-windows-tests|
|
||||
5. Contributing.........................|ale-development-contributing|
|
||||
5.1. Preparing a Release..............|ale-development-release|
|
||||
|
||||
===============================================================================
|
||||
1. Introduction *ale-development-introduction*
|
||||
@@ -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
|
||||
|ale-development-tests|.
|
||||
|
||||
* Don't leave stray `:echo` lines in code. Write `" no-custom-checks` above
|
||||
the line if you must echo something.
|
||||
* Don't leave stray `:echo` lines in code. Use `execute 'echo' ...` if you must
|
||||
echo something.
|
||||
* For strings use |is#| instead of |==#|, `is?` instead of `==?`, `isnot#`
|
||||
instead of `!=#`, and `isnot?` instead of `!=?`. This is because `'x' ==# 0`
|
||||
returns 1, while `'x' is# 0` returns 0, so you will experience fewer issues
|
||||
@@ -155,9 +154,10 @@ ALE runs tests with the following versions of Vim in the following
|
||||
environments.
|
||||
|
||||
1. Vim 8.0.0027 on Linux via GitHub Actions.
|
||||
2. Vim 9.0.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.
|
||||
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.
|
||||
|
||||
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.
|
||||
`AssertLSPAddress address` - Check the address to an LSP server.
|
||||
|
||||
|
||||
===============================================================================
|
||||
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
|
||||
`AssertFixerNotExecuted` - Check that fixers will not be executed.
|
||||
|
||||
|
||||
===============================================================================
|
||||
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
|
||||
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:
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user