Merge remote-tracking branch 'upstream/master'

Signed-off-by: Pierre-Nicolas Clauss <pinicarus@protonmail.com>
This commit is contained in:
Pierre-Nicolas Clauss 2021-01-23 19:06:59 +01:00
commit 0ac7595fe9
No known key found for this signature in database
GPG Key ID: BED1B8A689160C89
188 changed files with 5099 additions and 424 deletions

23
.github/workflows/main.yml vendored Normal file
View File

@ -0,0 +1,23 @@
name: CI
on:
push:
branches: [ master ]
tags:
- /^v\d+\.\d+\.(x|\d+)$/
pull_request:
branches: [ master ]
jobs:
test_ale:
runs-on: ubuntu-latest
strategy:
matrix:
vim-version:
- '--vim-80-only'
- '--vim-81-only'
- '--neovim-only'
- '--linters-only'
steps:
- uses: actions/checkout@v2
- name: Run tests
run: ./run-tests -v ${{ matrix.vim-version }}

View File

@ -1,16 +0,0 @@
---
sudo: required
services:
- docker
language: generic
branches:
only:
- master
- /^v\d+\.\d+\.(x|\d+)$/
env:
- OPTIONS=--vim-80-only
- OPTIONS=--vim-81-only
- OPTIONS=--neovim-only
- OPTIONS=--linters-only
script: |
./run-tests -v $OPTIONS

View File

@ -10,6 +10,8 @@ ENV PACKAGES="\
git \
python \
py-pip \
grep \
sed \
"
RUN apk --update add $PACKAGES && \
rm -rf /var/cache/apk/* /tmp/* /var/tmp/*

View File

@ -53,6 +53,7 @@ other content at [w0rp.com](https://w0rp.com).
5. [Find References](#usage-find-references)
6. [Hovering](#usage-hover)
7. [Symbol Search](#usage-symbol-search)
8. [Refactoring: Rename, Actions](#usage-refactoring)
3. [Installation](#installation)
1. [Installation with Vim package management](#standard-installation)
2. [Installation with Pathogen](#installation-with-pathogen)
@ -253,6 +254,18 @@ similar to a given query string.
See `:help ale-symbol-search` for more information.
<a name="usage-refactoring"></a>
### 2.viii Refactoring: Rename, Actions
ALE supports renaming symbols in symbols in code such as variables or class
names with the `ALERename` command.
`ALECodeAction` will execute actions on the cursor or applied to a visual
range selection, such as automatically fixing errors.
See `:help ale-refactor` for more information.
<a name="installation"></a>
## 3. Installation
@ -328,12 +341,14 @@ git clone https://github.com/dense-analysis/ale.git
### 3.iii. Installation with Vundle
You can install this plugin using [Vundle](https://github.com/VundleVim/Vundle.vim)
by using the path on GitHub for this repository.
by adding the GitHub path for this repository to your `~/.vimrc`:
```vim
Plugin 'dense-analysis/ale'
```
Then run the command `:PluginInstall` in Vim.
See the Vundle documentation for more information.
<a name="installation-with-vim-plug"></a>
@ -341,13 +356,16 @@ See the Vundle documentation for more information.
### 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`
and running `:PlugInstall`.
by adding the GitHub path for this repository to your `~/.vimrc`:
```vim
Plug 'dense-analysis/ale'
```
Then run the command `:PlugInstall` in Vim.
See the Vim-Plug documentation for more information.
<a name="contributing"></a>
## 4. Contributing

26
ale_linters/ada/adals.vim Normal file
View File

@ -0,0 +1,26 @@
" Author: Bartek Jasicki http://github.com/thindil
" Description: Support for Ada Language Server
call ale#Set('ada_adals_executable', 'ada_language_server')
call ale#Set('ada_adals_project', 'default.gpr')
call ale#Set('ada_adals_encoding', 'utf-8')
function! ale_linters#ada#adals#GetAdaLSConfig(buffer) abort
return {
\ 'ada.projectFile': ale#Var(a:buffer, 'ada_adals_project'),
\ 'ada.defaultCharset': ale#Var(a:buffer, 'ada_adals_encoding')
\}
endfunction
function! ale_linters#ada#adals#GetRootDirectory(buffer) abort
return fnamemodify(bufname(a:buffer), ':p:h')
endfunction
call ale#linter#Define('ada', {
\ 'name': 'adals',
\ 'lsp': 'stdio',
\ 'executable': {b -> ale#Var(b, 'ada_adals_executable')},
\ 'command': '%e',
\ 'project_root': function('ale_linters#ada#adals#GetRootDirectory'),
\ 'lsp_config': function('ale_linters#ada#adals#GetAdaLSConfig')
\})

View File

@ -0,0 +1,12 @@
" Author: Leo <thinkabit.ukim@gmail.com>
" Description: apkbuild-lint from atools linter for APKBUILDs
call ale#Set('apkbuild_apkbuild_lint_executable', 'apkbuild-lint')
call ale#linter#Define('apkbuild', {
\ 'name': 'apkbuild_lint',
\ 'output_stream': 'stdout',
\ 'executable': {b -> ale#Var(b, 'apkbuild_apkbuild_lint_executable')},
\ 'command': '%e %t',
\ 'callback': 'ale#handlers#atools#Handle',
\})

View File

@ -0,0 +1,12 @@
" Author: Leo <thinkabit.ukim@gmail.com>
" Description: secfixes-check from atools linter for APKBUILDs
call ale#Set('apkbuild_secfixes_check_executable', 'secfixes-check')
call ale#linter#Define('apkbuild', {
\ 'name': 'secfixes_check',
\ 'output_stream': 'stdout',
\ 'executable': {b -> ale#Var(b, 'apkbuild_secfixes_check_executable')},
\ 'command': '%e %t',
\ 'callback': 'ale#handlers#atools#Handle',
\})

View File

@ -23,11 +23,13 @@ function! ale_linters#cpp#clangtidy#GetCommand(buffer, output) abort
let l:options = ale#Var(a:buffer, 'cpp_clangtidy_options')
let l:cflags = ale#c#GetCFlags(a:buffer, a:output)
let l:options .= !empty(l:options) ? ale#Pad(l:cflags) : l:cflags
endif
" Tell clang-tidy a .h header with a C++ filetype in Vim is a C++ file.
if expand('#' . a:buffer) =~# '\.h$'
let l:options .= !empty(l:options) ? ' -x c++' : '-x c++'
" 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 commmands.
if expand('#' . a:buffer) =~# '\.h$'
let l:options .= !empty(l:options) ? ' -x c++' : '-x c++'
endif
endif
" Get the options to pass directly to clang-tidy

View File

@ -6,7 +6,7 @@ function! ale_linters#dafny#dafny#Handle(buffer, lines) abort
for l:match in ale#util#GetMatches(a:lines, l:pattern)
call add(l:output, {
\ 'bufnr': a:buffer,
\ 'filename': l:match[1],
\ 'col': l:match[3] + 0,
\ 'lnum': l:match[2] + 0,
\ 'text': l:match[5],
@ -14,13 +14,28 @@ function! ale_linters#dafny#dafny#Handle(buffer, lines) abort
\ })
endfor
for l:match in ale#util#GetMatches(a:lines, '\v(.*)\((\d+),(\d+)\): (Verification of .{-} timed out after \d+ seconds)')
call add(l:output, {
\ 'bufnr': a:buffer,
\ 'col': l:match[3] + 0,
\ 'lnum': l:match[2] + 0,
\ 'text': l:match[4],
\ 'type': 'E',
\ })
endfor
return l:output
endfunction
function! ale_linters#dafny#dafny#GetCommand(buffer) abort
return printf('dafny %%s /compile:0 /timeLimit:%d', ale#Var(a:buffer, 'dafny_dafny_timelimit'))
endfunction
call ale#Set('dafny_dafny_timelimit', 10)
call ale#linter#Define('dafny', {
\ 'name': 'dafny',
\ 'executable': 'dafny',
\ 'command': 'dafny %s /compile:0',
\ 'command': function('ale_linters#dafny#dafny#GetCommand'),
\ 'callback': 'ale_linters#dafny#dafny#Handle',
\ 'lint_file': 1,
\ })

View File

@ -0,0 +1,29 @@
" Author: Nelson Yeung <nelsyeung@gmail.com>
" Description: Check Dart files with dart analysis server LSP
call ale#Set('dart_analysis_server_executable', 'dart')
function! ale_linters#dart#analysis_server#GetProjectRoot(buffer) abort
" Note: pub only looks for pubspec.yaml, there's no point in adding
" support for pubspec.yml
let l:pubspec = ale#path#FindNearestFile(a:buffer, 'pubspec.yaml')
return !empty(l:pubspec) ? fnamemodify(l:pubspec, ':h:h') : '.'
endfunction
function! ale_linters#dart#analysis_server#GetCommand(buffer) abort
let l:executable = ale#Var(a:buffer, 'dart_analysis_server_executable')
let l:dart = resolve(exepath(l:executable))
return '%e '
\ . fnamemodify(l:dart, ':h') . '/snapshots/analysis_server.dart.snapshot'
\ . ' --lsp'
endfunction
call ale#linter#Define('dart', {
\ 'name': 'analysis_server',
\ 'lsp': 'stdio',
\ 'executable': {b -> ale#Var(b, 'dart_analysis_server_executable')},
\ 'command': function('ale_linters#dart#analysis_server#GetCommand'),
\ 'project_root': function('ale_linters#dart#analysis_server#GetProjectRoot'),
\})

View File

@ -45,6 +45,16 @@ function! ale_linters#elixir#credo#GetMode() abort
endif
endfunction
function! ale_linters#elixir#credo#GetConfigFile() abort
let l:config_file = get(g:, 'ale_elixir_credo_config_file', '')
if empty(l:config_file)
return ''
endif
return ' --config-file ' . l:config_file
endfunction
function! ale_linters#elixir#credo#GetCommand(buffer) abort
let l:project_root = ale#handlers#elixir#FindMixUmbrellaRoot(a:buffer)
let l:mode = ale_linters#elixir#credo#GetMode()
@ -52,6 +62,7 @@ function! ale_linters#elixir#credo#GetCommand(buffer) abort
return ale#path#CdString(l:project_root)
\ . 'mix help credo && '
\ . 'mix credo ' . ale_linters#elixir#credo#GetMode()
\ . ale_linters#elixir#credo#GetConfigFile()
\ . ' --format=flycheck --read-from-stdin %s'
endfunction

View File

@ -0,0 +1,39 @@
" Author: Dmitri Vereshchagin <dmitri.vereshchagin@gmail.com>
" Description: Elvis linter for Erlang files
call ale#Set('erlang_elvis_executable', 'elvis')
function! ale_linters#erlang#elvis#Handle(buffer, lines) abort
let l:pattern = '\v:(\d+):[^:]+:(.+)'
let l:loclist = []
for l:match in ale#util#GetMatches(a:lines, l:pattern)
call add(l:loclist, {
\ 'lnum': str2nr(l:match[1]),
\ 'text': s:AbbreviateMessage(l:match[2]),
\ 'type': 'W',
\})
endfor
return l:loclist
endfunction
function! s:AbbreviateMessage(text) abort
let l:pattern = '\v\c^(line \d+ is too long):.*$'
return substitute(a:text, l:pattern, '\1.', '')
endfunction
function! s:GetCommand(buffer) abort
let l:file = ale#Escape(expand('#' . a:buffer . ':.'))
return '%e rock --output-format=parsable ' . l:file
endfunction
call ale#linter#Define('erlang', {
\ 'name': 'elvis',
\ 'callback': 'ale_linters#erlang#elvis#Handle',
\ 'executable': {b -> ale#Var(b, 'erlang_elvis_executable')},
\ 'command': function('s:GetCommand'),
\ 'lint_file': 1,
\})

33
ale_linters/inko/inko.vim Normal file
View File

@ -0,0 +1,33 @@
" Author: Yorick Peterse <yorick@yorickpeterse.com>
" Description: linting of Inko source code using the Inko compiler
call ale#Set('inko_inko_executable', 'inko')
function! ale_linters#inko#inko#GetCommand(buffer) abort
let l:include = ''
" Include the tests source directory, but only for test files.
if expand('#' . a:buffer . ':p') =~? '\vtests[/\\]test[/\\]'
let l:test_dir = ale#path#FindNearestDirectory(a:buffer, 'tests')
if isdirectory(l:test_dir)
let l:include = '--include ' . ale#Escape(l:test_dir)
endif
endif
" We use %s instead of %t so the compiler determines the correct module
" names for the file being edited. Not doing so may lead to errors in
" certain cases.
return '%e build --check --format=json'
\ . ale#Pad(l:include)
\ . ' %s'
endfunction
call ale#linter#Define('inko', {
\ 'name': 'inko',
\ 'executable': {b -> ale#Var(b, 'inko_inko_executable')},
\ 'command': function('ale_linters#inko#inko#GetCommand'),
\ 'callback': 'ale#handlers#inko#Handle',
\ 'output_stream': 'stderr',
\ 'lint_file': 1
\})

View File

@ -9,7 +9,7 @@ function! ale_linters#java#checkstyle#Handle(buffer, lines) abort
let l:output = []
" modern checkstyle versions
let l:pattern = '\v\[(WARN|ERROR)\] [a-zA-Z]?:?[^:]+:(\d+):(\d+)?:? (.*) \[(.+)\]$'
let l:pattern = '\v\[(WARN|ERROR)\] [a-zA-Z]?:?[^:]+:(\d+):(\d+)?:? (.*) \[(.+)\]'
for l:match in ale#util#GetMatches(a:lines, l:pattern)
call add(l:output, {

View File

@ -1,26 +1,9 @@
" Author: Daniel Lupu <lupu.daniel.f@gmail.com>
" Description: xo for JavaScript files
call ale#Set('javascript_xo_executable', 'xo')
call ale#Set('javascript_xo_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('javascript_xo_options', '')
function! ale_linters#javascript#xo#GetExecutable(buffer) abort
return ale#node#FindExecutable(a:buffer, 'javascript_xo', [
\ 'node_modules/.bin/xo',
\])
endfunction
function! ale_linters#javascript#xo#GetCommand(buffer) abort
return ale#Escape(ale_linters#javascript#xo#GetExecutable(a:buffer))
\ . ' ' . ale#Var(a:buffer, 'javascript_xo_options')
\ . ' --reporter json --stdin --stdin-filename %s'
endfunction
" xo uses eslint and the output format is the same
call ale#linter#Define('javascript', {
\ 'name': 'xo',
\ 'executable': function('ale_linters#javascript#xo#GetExecutable'),
\ 'command': function('ale_linters#javascript#xo#GetCommand'),
\ 'callback': 'ale#handlers#eslint#HandleJSON',
\ 'executable': function('ale#handlers#xo#GetExecutable'),
\ 'command': function('ale#handlers#xo#GetLintCommand'),
\ 'callback': 'ale#handlers#xo#HandleJSON',
\})

View File

@ -0,0 +1,14 @@
" Author: t2h5 <https://github.com/t2h5>
" Description: Integration of Stoplight Spectral CLI with ALE.
call ale#Set('json_spectral_executable', 'spectral')
call ale#Set('json_spectral_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#linter#Define('json', {
\ 'name': 'spectral',
\ 'executable': {b -> ale#node#FindExecutable(b, 'json_spectral', [
\ 'node_modules/.bin/spectral',
\ ])},
\ 'command': '%e lint --ignore-unknown-format -q -f text %t',
\ 'callback': 'ale#handlers#spectral#HandleSpectralOutput'
\})

View File

@ -6,9 +6,9 @@ call ale#Set('julia_executable', 'julia')
function! ale_linters#julia#languageserver#GetCommand(buffer) abort
let l:julia_executable = ale#Var(a:buffer, 'julia_executable')
let l:cmd_string = 'using LanguageServer; server = LanguageServer.LanguageServerInstance(isdefined(Base, :stdin) ? stdin : STDIN, isdefined(Base, :stdout) ? stdout : STDOUT, false); server.runlinter = true; run(server);'
let l:cmd_string = 'using LanguageServer; using Pkg; import StaticLint; import SymbolServer; server = LanguageServer.LanguageServerInstance(isdefined(Base, :stdin) ? stdin : STDIN, isdefined(Base, :stdout) ? stdout : STDOUT, dirname(Pkg.Types.Context().env.project_file)); server.runlinter = true; run(server);'
return ale#Escape(l:julia_executable) . ' --startup-file=no --history-file=no -e ' . ale#Escape(l:cmd_string)
return ale#Escape(l:julia_executable) . ' --project=@. --startup-file=no --history-file=no -e ' . ale#Escape(l:cmd_string)
endfunction
call ale#linter#Define('julia', {

View File

@ -0,0 +1,16 @@
" Author: jD91mZM2 <me@krake.one>
" Description: rnix-lsp language client
function! ale_linters#nix#rnix_lsp#GetProjectRoot(buffer) abort
" rnix-lsp does not yet use the project root, so getting it right is not
" important
return fnamemodify(a:buffer, ':h')
endfunction
call ale#linter#Define('nix', {
\ 'name': 'rnix_lsp',
\ 'lsp': 'stdio',
\ 'executable': 'rnix-lsp',
\ 'command': '%e',
\ 'project_root': function('ale_linters#nix#rnix_lsp#GetProjectRoot'),
\})

View File

@ -0,0 +1,58 @@
" Author: Horacio Sanson <hsanson@gmail.com>
call ale#Set('openapi_ibm_validator_executable', 'lint-openapi')
call ale#Set('openapi_ibm_validator_options', '')
function! ale_linters#openapi#ibm_validator#GetCommand(buffer) abort
return '%e' . ale#Pad(ale#Var(a:buffer, 'openapi_ibm_validator_options'))
\ . ' %t'
endfunction
function! ale_linters#openapi#ibm_validator#Handle(buffer, lines) abort
let l:output = []
let l:type = 'E'
let l:message = ''
let l:nr = -1
for l:line in a:lines
let l:match = matchlist(l:line, '^errors$')
if !empty(l:match)
let l:type = 'E'
endif
let l:match = matchlist(l:line, '^warnings$')
if !empty(l:match)
let l:type = 'W'
endif
let l:match = matchlist(l:line, '^ *Message : *\(.\+\)$')
if !empty(l:match)
let l:message = l:match[1]
endif
let l:match = matchlist(l:line, '^ *Line *: *\(\d\+\)$')
if !empty(l:match)
let l:nr = l:match[1]
call add(l:output, {
\ 'lnum': l:nr + 0,
\ 'col': 0,
\ 'text': l:message,
\ 'type': l:type,
\})
endif
endfor
return l:output
endfunction
call ale#linter#Define('openapi', {
\ 'name': 'ibm_validator',
\ 'executable': {b -> ale#Var(b, 'openapi_ibm_validator_executable')},
\ 'command': function('ale_linters#openapi#ibm_validator#GetCommand'),
\ 'callback': 'ale_linters#openapi#ibm_validator#Handle',
\})

View File

@ -0,0 +1,9 @@
call ale#Set('yaml_yamllint_executable', 'yamllint')
call ale#Set('yaml_yamllint_options', '')
call ale#linter#Define('openapi', {
\ 'name': 'yamllint',
\ 'executable': {b -> ale#Var(b, 'yaml_yamllint_executable')},
\ 'command': function('ale#handlers#yamllint#GetCommand'),
\ 'callback': 'ale#handlers#yamllint#Handle',
\})

View File

@ -0,0 +1,32 @@
" Author: Eric Stern <eric@ericstern.com>,
" Arnold Chand <creativenull@outlook.com>
" Description: Intelephense language server integration for ALE
call ale#Set('php_intelephense_executable', 'intelephense')
call ale#Set('php_intelephense_use_global', 1)
call ale#Set('php_intelephense_config', {})
function! ale_linters#php#intelephense#GetProjectRoot(buffer) abort
let l:composer_path = ale#path#FindNearestFile(a:buffer, 'composer.json')
if (!empty(l:composer_path))
return fnamemodify(l:composer_path, ':h')
endif
let l:git_path = ale#path#FindNearestDirectory(a:buffer, '.git')
return !empty(l:git_path) ? fnamemodify(l:git_path, ':h:h') : ''
endfunction
function! ale_linters#php#intelephense#GetInitializationOptions(buffer) abort
return ale#Var(a:buffer, 'php_intelephense_config')
endfunction
call ale#linter#Define('php', {
\ 'name': 'intelephense',
\ 'lsp': 'stdio',
\ 'initialization_options': function('ale_linters#php#intelephense#GetInitializationOptions'),
\ 'executable': {b -> ale#node#FindExecutable(b, 'php_intelephense', [])},
\ 'command': '%e --stdio',
\ 'project_root': function('ale_linters#php#intelephense#GetProjectRoot'),
\})

View File

@ -23,7 +23,7 @@ function! ale_linters#php#phpcs#Handle(buffer, lines) abort
" Matches against lines like the following:
"
" /path/to/some-filename.php:18:3: error - Line indented incorrectly; expected 4 spaces, found 2 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
let l:pattern = '^.*:\(\d\+\):\(\d\+\): \(.\+\) - \(.\+\) (\(.\+\))$'
let l:pattern = '^.*:\(\d\+\):\(\d\+\): \(.\+\) - \(.\+\) (\(.\+\)).*$'
let l:output = []
for l:match in ale#util#GetMatches(a:lines, l:pattern)

80
ale_linters/php/tlint.vim Normal file
View File

@ -0,0 +1,80 @@
" Author: Jose Soto <jose@tighten.co>
"
" Description: Tighten Opinionated PHP Linting
" Website: https://github.com/tightenco/tlint
call ale#Set('php_tlint_executable', 'tlint')
call ale#Set('php_tlint_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('php_tlint_options', '')
function! ale_linters#php#tlint#GetProjectRoot(buffer) abort
let l:composer_path = ale#path#FindNearestFile(a:buffer, 'composer.json')
if !empty(l:composer_path)
return fnamemodify(l:composer_path, ':h')
endif
let l:git_path = ale#path#FindNearestDirectory(a:buffer, '.git')
return !empty(l:git_path) ? fnamemodify(l:git_path, ':h:h') : ''
endfunction
function! ale_linters#php#tlint#GetExecutable(buffer) abort
return ale#node#FindExecutable(a:buffer, 'php_tlint', [
\ 'vendor/bin/tlint',
\ 'tlint',
\])
endfunction
function! ale_linters#php#tlint#GetCommand(buffer) abort
let l:executable = ale_linters#php#tlint#GetExecutable(a:buffer)
let l:options = ale#Var(a:buffer, 'php_tlint_options')
return ale#node#Executable(a:buffer, l:executable)
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ' lint %s'
endfunction
function! ale_linters#php#tlint#Handle(buffer, lines) abort
" Matches against lines like the following:
"
" ! There should be 1 space around `.` concatenations, and additional lines should always start with a `.`
" 22 : ` $something = 'a'.'name';`
"
let l:loop_count = 0
let l:messages_pattern = '^\! \(.*\)'
let l:output = []
let l:pattern = '^\(\d\+\) \:'
let l:temp_messages = []
for l:message in ale#util#GetMatches(a:lines, l:messages_pattern)
call add(l:temp_messages, l:message)
endfor
let l:loop_count = 0
for l:match in ale#util#GetMatches(a:lines, l:pattern)
let l:num = l:match[1]
let l:text = l:temp_messages[l:loop_count]
call add(l:output, {
\ 'lnum': l:num,
\ 'col': 0,
\ 'text': l:text,
\ 'type': 'W',
\ 'sub_type': 'style',
\})
let l:loop_count += 1
endfor
return l:output
endfunction
call ale#linter#Define('php', {
\ 'name': 'tlint',
\ 'executable': function('ale_linters#php#tlint#GetExecutable'),
\ 'command': function('ale_linters#php#tlint#GetCommand'),
\ 'callback': 'ale_linters#php#tlint#Handle',
\ 'project_root': function('ale_linters#php#tlint#GetProjectRoot'),
\})

View File

@ -0,0 +1,34 @@
" Author: Dalius Dobravolskas <dalius.dobravolskas@gmail.com>
" Description: https://github.com/pappasam/jedi-language-server
call ale#Set('python_jedils_executable', 'jedi-language-server')
call ale#Set('python_jedils_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('python_jedils_auto_pipenv', 0)
function! ale_linters#python#jedils#GetExecutable(buffer) abort
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_jedils_auto_pipenv'))
\ && ale#python#PipenvPresent(a:buffer)
return 'pipenv'
endif
return ale#python#FindExecutable(a:buffer, 'python_jedils', ['jedi-language-server'])
endfunction
function! ale_linters#python#jedils#GetCommand(buffer) abort
let l:executable = ale_linters#python#jedils#GetExecutable(a:buffer)
let l:exec_args = l:executable =~? 'pipenv$'
\ ? ' run jedi-language-server'
\ : ''
return ale#Escape(l:executable) . l:exec_args
endfunction
call ale#linter#Define('python', {
\ 'name': 'jedils',
\ 'lsp': 'stdio',
\ 'executable': function('ale_linters#python#jedils#GetExecutable'),
\ 'command': function('ale_linters#python#jedils#GetCommand'),
\ 'project_root': function('ale#python#FindProjectRoot'),
\ 'completion_filter': 'ale#completion#python#CompletionItemFilter',
\})

View File

@ -0,0 +1,26 @@
" Author: Eric Zhao <21zhaoe@protonmail.com>
" Description: Implementation of the Language Server Protocol for R.
call ale#Set('r_languageserver_cmd', 'languageserver::run()')
call ale#Set('r_languageserver_config', {})
function! ale_linters#r#languageserver#GetCommand(buffer) abort
let l:cmd_string = ale#Var(a:buffer, 'r_languageserver_cmd')
return 'Rscript --vanilla -e ' . ale#Escape(l:cmd_string)
endfunction
function! ale_linters#r#languageserver#GetProjectRoot(buffer) abort
let l:project_root = ale#path#FindNearestFile(a:buffer, '.Rprofile')
return !empty(l:project_root) ? fnamemodify(l:project_root, ':h') : fnamemodify(a:buffer, ':h')
endfunction
call ale#linter#Define('r', {
\ 'name': 'languageserver',
\ 'lsp': 'stdio',
\ 'lsp_config': {b -> ale#Var(b, 'r_languageserver_config')},
\ 'executable': 'Rscript',
\ 'command': function('ale_linters#r#languageserver#GetCommand'),
\ 'project_root': function('ale_linters#r#languageserver#GetProjectRoot')
\})

View File

@ -1,14 +1,17 @@
call ale#Set('ruby_sorbet_executable', 'srb')
call ale#Set('ruby_sorbet_options', '')
call ale#Set('ruby_sorbet_enable_watchman', 0)
function! ale_linters#ruby#sorbet#GetCommand(buffer) abort
let l:executable = ale#Var(a:buffer, 'ruby_sorbet_executable')
let l:options = ale#Var(a:buffer, 'ruby_sorbet_options')
let l:enable_watchman = ale#Var(a:buffer, 'ruby_sorbet_enable_watchman')
return ale#ruby#EscapeExecutable(l:executable, 'srb')
\ . ' tc'
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ' --lsp --disable-watchman'
\ . ' --lsp'
\ . (l:enable_watchman ? '' : ' --disable-watchman')
endfunction
call ale#linter#Define('ruby', {

View File

@ -17,7 +17,7 @@ endfunction
call ale#linter#Define('rust', {
\ 'name': 'analyzer',
\ 'lsp': 'stdio',
\ 'lsp_config': {b -> ale#Var(b, 'rust_analyzer_config')},
\ 'initialization_options': {b -> ale#Var(b, 'rust_analyzer_config')},
\ 'executable': {b -> ale#Var(b, 'rust_analyzer_executable')},
\ 'command': function('ale_linters#rust#analyzer#GetCommand'),
\ 'project_root': function('ale_linters#rust#analyzer#GetProjectRoot'),

View File

@ -0,0 +1,33 @@
" Author: Benjamin BINIER <poulpatine@gmail.com>
" Description: salt-lint, saltstack linter
call ale#Set('salt_salt_lint_executable', 'salt-lint')
call ale#Set('salt_salt_lint_options', '')
function! ale_linters#salt#salt_lint#GetCommand(buffer) abort
return '%e' . ale#Pad(ale#Var(a:buffer, 'salt_salt_lint_options'))
\ . ' --json'
endfunction
function! ale_linters#salt#salt_lint#Handle(buffer, lines) abort
let l:output = []
for l:error in ale#util#FuzzyJSONDecode(a:lines, [])
call add(l:output, {
\ 'lnum': l:error.linenumber + 0,
\ 'code': l:error.id + 0,
\ 'text': l:error.message,
\ 'type': l:error.severity is# 'HIGH' ? 'E' : 'W',
\})
endfor
return l:output
endfunction
call ale#linter#Define('salt', {
\ 'name': 'salt_lint',
\ 'aliases': ['salt-lint'],
\ 'executable': {b -> ale#Var(b, 'salt_salt_lint_executable')},
\ 'command': function('ale_linters#salt#salt_lint#GetCommand'),
\ 'callback': 'ale_linters#salt#salt_lint#Handle'
\})

View File

@ -0,0 +1,25 @@
" Author: Mohammed Chelouti - https://github.com/motato1
" Description: Deno lsp linter for TypeScript files.
call ale#linter#Define('typescript', {
\ 'name': 'deno',
\ 'lsp': 'stdio',
\ 'executable': function('ale#handlers#deno#GetExecutable'),
\ 'command': '%e lsp',
\ 'project_root': function('ale#handlers#deno#GetProjectRoot'),
\ 'initialization_options': function('ale_linters#typescript#deno#GetInitializationOptions'),
\})
function! ale_linters#typescript#deno#GetInitializationOptions(buffer) abort
let l:options = {
\ 'enable': v:true,
\ 'lint': v:true,
\ 'unstable': v:false,
\ }
if ale#Var(a:buffer, 'deno_unstable')
let l:options.unstable = v:true
endif
return l:options
endfunction

View File

@ -9,6 +9,7 @@ call ale#linter#Define('typescript', {
\ 'name': 'tsserver',
\ 'lsp': 'tsserver',
\ 'executable': {b -> ale#node#FindExecutable(b, 'typescript_tsserver', [
\ '.yarn/sdks/typescript/bin/tsserver',
\ 'node_modules/.bin/tsserver',
\ ])},
\ 'command': '%e',

View File

@ -1,23 +1,6 @@
call ale#Set('typescript_xo_executable', 'xo')
call ale#Set('typescript_xo_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('typescript_xo_options', '')
function! ale_linters#typescript#xo#GetExecutable(buffer) abort
return ale#node#FindExecutable(a:buffer, 'typescript_xo', [
\ 'node_modules/.bin/xo',
\])
endfunction
function! ale_linters#typescript#xo#GetCommand(buffer) abort
return ale#Escape(ale_linters#typescript#xo#GetExecutable(a:buffer))
\ . ale#Pad(ale#Var(a:buffer, 'typescript_xo_options'))
\ . ' --reporter json --stdin --stdin-filename %s'
endfunction
" xo uses eslint and the output format is the same
call ale#linter#Define('typescript', {
\ 'name': 'xo',
\ 'executable': function('ale_linters#typescript#xo#GetExecutable'),
\ 'command': function('ale_linters#typescript#xo#GetCommand'),
\ 'callback': 'ale#handlers#eslint#HandleJSON',
\ 'executable': function('ale#handlers#xo#GetExecutable'),
\ 'command': function('ale#handlers#xo#GetLintCommand'),
\ 'callback': 'ale#handlers#xo#HandleJSON',
\})

View File

@ -0,0 +1,66 @@
" Author: Atsuya Takagi <asoftonight@gmail.com>
" Description: A linter for Vala using Vala-Lint.
call ale#Set('vala_vala_lint_config_filename', 'vala-lint.conf')
call ale#Set('vala_vala_lint_executable', 'io.elementary.vala-lint')
function! ale_linters#vala#vala_lint#GetExecutable(buffer) abort
return ale#Var(a:buffer, 'vala_vala_lint_executable')
endfunction
function! ale_linters#vala#vala_lint#GetCommand(buffer) abort
let l:command = ale_linters#vala#vala_lint#GetExecutable(a:buffer)
let l:config_filename = ale#Var(a:buffer, 'vala_vala_lint_config_filename')
let l:config_path = ale#path#FindNearestFile(a:buffer, l:config_filename)
if !empty(l:config_path)
let l:command .= ' -c ' . l:config_path
endif
return l:command . ' %s'
endfunction
function! ale_linters#vala#vala_lint#Handle(buffer, lines) abort
let l:pattern = '^\s*\(\d\+\)\.\(\d\+\)\s\+\(error\|warn\)\s\+\(.\+\)\s\([A-Za-z0-9_\-]\+\)'
let l:output = []
for l:line in a:lines
" remove color escape sequences since vala-lint doesn't support
" output without colors
let l:cleaned_line = substitute(l:line, '\e\[[0-9;]\+[mK]', '', 'g')
let l:match = matchlist(l:cleaned_line, l:pattern)
if len(l:match) == 0
continue
endif
let l:refined_type = l:match[3] is# 'warn' ? 'W' : 'E'
let l:cleaned_text = substitute(l:match[4], '^\s*\(.\{-}\)\s*$', '\1', '')
let l:lnum = l:match[1] + 0
let l:column = l:match[2] + 0
let l:type = l:refined_type
let l:text = l:cleaned_text
let l:code = l:match[5]
call add(l:output, {
\ 'lnum': l:lnum,
\ 'col': l:column,
\ 'text': l:text,
\ 'type': l:type,
\ 'code': l:code,
\})
endfor
return l:output
endfunction
call ale#linter#Define('vala', {
\ 'name': 'vala_lint',
\ 'output_stream': 'stdout',
\ 'executable': function('ale_linters#vala#vala_lint#GetExecutable'),
\ 'command': function('ale_linters#vala#vala_lint#GetCommand'),
\ 'callback': 'ale_linters#vala#vala_lint#Handle',
\ 'lint_file': 1,
\})

View File

@ -0,0 +1,14 @@
" Author: t2h5 <https://github.com/t2h5>
" Description: Integration of Stoplight Spectral CLI with ALE.
call ale#Set('yaml_spectral_executable', 'spectral')
call ale#Set('yaml_spectral_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#linter#Define('yaml', {
\ 'name': 'spectral',
\ 'executable': {b -> ale#node#FindExecutable(b, 'yaml_spectral', [
\ 'node_modules/.bin/spectral',
\ ])},
\ 'command': '%e lint --ignore-unknown-format -q -f text %t',
\ 'callback': 'ale#handlers#spectral#HandleSpectralOutput'
\})

View File

@ -3,48 +3,9 @@
call ale#Set('yaml_yamllint_executable', 'yamllint')
call ale#Set('yaml_yamllint_options', '')
function! ale_linters#yaml#yamllint#GetCommand(buffer) abort
return '%e' . ale#Pad(ale#Var(a:buffer, 'yaml_yamllint_options'))
\ . ' -f parsable %t'
endfunction
function! ale_linters#yaml#yamllint#Handle(buffer, lines) abort
" Matches patterns line the following:
" something.yaml:1:1: [warning] missing document start "---" (document-start)
" something.yml:2:1: [error] syntax error: expected the node content, but found '<stream end>'
let l:pattern = '\v^.*:(\d+):(\d+): \[(error|warning)\] (.+)$'
let l:output = []
for l:match in ale#util#GetMatches(a:lines, l:pattern)
let l:item = {
\ 'lnum': l:match[1] + 0,
\ 'col': l:match[2] + 0,
\ 'text': l:match[4],
\ 'type': l:match[3] is# 'error' ? 'E' : 'W',
\}
let l:code_match = matchlist(l:item.text, '\v^(.+) \(([^)]+)\)$')
if !empty(l:code_match)
if l:code_match[2] is# 'trailing-spaces'
\&& !ale#Var(a:buffer, 'warn_about_trailing_whitespace')
" Skip warnings for trailing whitespace if the option is off.
continue
endif
let l:item.text = l:code_match[1]
let l:item.code = l:code_match[2]
endif
call add(l:output, l:item)
endfor
return l:output
endfunction
call ale#linter#Define('yaml', {
\ 'name': 'yamllint',
\ 'executable': {b -> ale#Var(b, 'yaml_yamllint_executable')},
\ 'command': function('ale_linters#yaml#yamllint#GetCommand'),
\ 'callback': 'ale_linters#yaml#yamllint#Handle',
\ 'command': function('ale#handlers#yamllint#GetCommand'),
\ 'callback': 'ale#handlers#yamllint#Handle',
\})

View File

@ -2,23 +2,39 @@
" Description: balloonexpr support for ALE.
function! ale#balloon#MessageForPos(bufnr, lnum, col) abort
let l:set_balloons = ale#Var(a:bufnr, 'set_balloons')
let l:show_problems = 0
let l:show_hover = 0
if l:set_balloons is 1
let l:show_problems = 1
let l:show_hover = 1
elseif l:set_balloons is# 'hover'
let l:show_hover = 1
endif
" Don't show balloons if they are disabled, or linting is disabled.
if !ale#Var(a:bufnr, 'set_balloons')
if !(l:show_problems || l:show_hover)
\|| !g:ale_enabled
\|| !getbufvar(a:bufnr, 'ale_enabled', 1)
return ''
endif
let l:loclist = get(g:ale_buffer_info, a:bufnr, {'loclist': []}).loclist
let l:index = ale#util#BinarySearch(l:loclist, a:bufnr, a:lnum, a:col)
if l:show_problems
let l:loclist = get(g:ale_buffer_info, a:bufnr, {'loclist': []}).loclist
let l:index = ale#util#BinarySearch(l:loclist, a:bufnr, a:lnum, a:col)
endif
" Show the diagnostics message if found, 'Hover' output otherwise
if l:index >= 0
if l:show_problems && l:index >= 0
return l:loclist[l:index].text
elseif exists('*balloon_show') || getbufvar(
\ a:bufnr,
\ 'ale_set_balloons_legacy_echo',
\ get(g:, 'ale_set_balloons_legacy_echo', 0)
elseif l:show_hover && (
\ exists('*balloon_show')
\ || getbufvar(
\ a:bufnr,
\ 'ale_set_balloons_legacy_echo',
\ get(g:, 'ale_set_balloons_legacy_echo', 0)
\ )
\)
" Request LSP/tsserver hover information, but only if this version of
" Vim supports the balloon_show function, or if we turned a legacy

View File

@ -152,6 +152,7 @@ function! ale#c#ParseCFlags(path_prefix, should_quote, raw_arguments) abort
\ || stridx(l:option, '-idirafter') == 0
\ || stridx(l:option, '-iframework') == 0
\ || stridx(l:option, '-include') == 0
\ || stridx(l:option, '-imacros') == 0
if stridx(l:option, '-I') == 0 && l:option isnot# '-I'
let l:arg = join(split(l:option, '\zs')[2:], '')
let l:option = '-I'

View File

@ -1,28 +1,24 @@
" Author: Jerko Steiner <jerko.steiner@gmail.com>
" Description: Code action support for LSP / tsserver
function! ale#code_action#ReloadBuffer() abort
let l:buffer = bufnr('')
execute 'augroup ALECodeActionReloadGroup' . l:buffer
autocmd!
augroup END
silent! execute 'augroup! ALECodeActionReloadGroup' . l:buffer
call ale#util#Execute(':e!')
endfunction
function! ale#code_action#HandleCodeAction(code_action, options) abort
let l:current_buffer = bufnr('')
let l:changes = a:code_action.changes
let l:should_save = get(a:options, 'should_save')
let l:force_save = get(a:options, 'force_save')
let l:safe_changes = []
for l:file_code_edit in l:changes
let l:buf = bufnr(l:file_code_edit.fileName)
if l:buf != -1 && l:buf != l:current_buffer && getbufvar(l:buf, '&mod')
if !l:force_save
call ale#util#Execute('echom ''Aborting action, file is unsaved''')
return
endif
else
call add(l:safe_changes, l:file_code_edit)
endif
endfor
for l:file_code_edit in l:safe_changes
call ale#code_action#ApplyChanges(
\ l:file_code_edit.fileName,
\ l:file_code_edit.textChanges,
@ -85,29 +81,14 @@ function! ale#code_action#ApplyChanges(filename, changes, should_save) abort
let l:pos = [1, 1]
endif
" We have to keep track of how many lines we have added, and offset
" changes accordingly.
let l:line_offset = 0
let l:column_offset = 0
let l:last_end_line = 0
" Changes have to be sorted so we apply them from top-to-bottom.
for l:code_edit in sort(copy(a:changes), function('s:ChangeCmp'))
if l:code_edit.start.line isnot l:last_end_line
let l:column_offset = 0
endif
let l:line = l:code_edit.start.line + l:line_offset
let l:column = l:code_edit.start.offset + l:column_offset
let l:end_line = l:code_edit.end.line + l:line_offset
let l:end_column = l:code_edit.end.offset + l:column_offset
" Changes have to be sorted so we apply them from bottom-to-top
for l:code_edit in reverse(sort(copy(a:changes), function('s:ChangeCmp')))
let l:line = l:code_edit.start.line
let l:column = l:code_edit.start.offset
let l:end_line = l:code_edit.end.line
let l:end_column = l:code_edit.end.offset
let l:text = l:code_edit.newText
let l:cur_line = l:pos[0]
let l:cur_column = l:pos[1]
let l:last_end_line = l:end_line
" Adjust the ends according to previous edits.
if l:end_line > len(l:lines)
let l:end_line_len = 0
@ -125,6 +106,12 @@ function! ale#code_action#ApplyChanges(filename, changes, should_save) abort
let l:start = l:lines[: l:line - 2]
endif
" Special case when text must be added after new line
if l:column > len(l:lines[l:line - 1])
call extend(l:start, [l:lines[l:line - 1]])
let l:column = 1
endif
if l:column is 1
" We need to handle column 1 specially, because we can't slice an
" empty string ending on index 0.
@ -134,13 +121,17 @@ function! ale#code_action#ApplyChanges(filename, changes, should_save) abort
endif
call extend(l:middle, l:insertions[1:])
let l:middle[-1] .= l:lines[l:end_line - 1][l:end_column - 1 :]
if l:end_line <= len(l:lines)
" Only extend the last line if end_line is within the range of
" lines.
let l:middle[-1] .= l:lines[l:end_line - 1][l:end_column - 1 :]
endif
let l:lines_before_change = len(l:lines)
let l:lines = l:start + l:middle + l:lines[l:end_line :]
let l:current_line_offset = len(l:lines) - l:lines_before_change
let l:line_offset += l:current_line_offset
let l:column_offset = len(l:middle[-1]) - l:end_line_len
let l:pos = s:UpdateCursor(l:pos,
@ -166,6 +157,20 @@ function! ale#code_action#ApplyChanges(filename, changes, should_save) abort
call setpos('.', [0, l:pos[0], l:pos[1], 0])
endif
if a:should_save && l:buffer > 0 && !l:is_current_buffer
" Set up a one-time use event that will delete itself to reload the
" buffer next time it's entered to view the changes made to it.
execute 'augroup ALECodeActionReloadGroup' . l:buffer
autocmd!
execute printf(
\ 'autocmd BufEnter <buffer=%d>'
\ . ' call ale#code_action#ReloadBuffer()',
\ l:buffer
\)
augroup END
endif
endfunction
function! s:UpdateCursor(cursor, start, end, offset) abort
@ -215,3 +220,163 @@ function! s:UpdateCursor(cursor, start, end, offset) abort
return [l:cur_line, l:cur_column]
endfunction
function! ale#code_action#GetChanges(workspace_edit) abort
let l:changes = {}
if has_key(a:workspace_edit, 'changes') && !empty(a:workspace_edit.changes)
return a:workspace_edit.changes
elseif has_key(a:workspace_edit, 'documentChanges')
let l:document_changes = []
if type(a:workspace_edit.documentChanges) is v:t_dict
\ && has_key(a:workspace_edit.documentChanges, 'edits')
call add(l:document_changes, a:workspace_edit.documentChanges)
elseif type(a:workspace_edit.documentChanges) is v:t_list
let l:document_changes = a:workspace_edit.documentChanges
endif
for l:text_document_edit in l:document_changes
let l:filename = l:text_document_edit.textDocument.uri
let l:edits = l:text_document_edit.edits
let l:changes[l:filename] = l:edits
endfor
endif
return l:changes
endfunction
function! ale#code_action#BuildChangesList(changes_map) abort
let l:changes = []
for l:file_name in keys(a:changes_map)
let l:text_edits = a:changes_map[l:file_name]
let l:text_changes = []
for l:edit in l:text_edits
let l:range = l:edit.range
let l:new_text = l:edit.newText
call add(l:text_changes, {
\ 'start': {
\ 'line': l:range.start.line + 1,
\ 'offset': l:range.start.character + 1,
\ },
\ 'end': {
\ 'line': l:range.end.line + 1,
\ 'offset': l:range.end.character + 1,
\ },
\ 'newText': l:new_text,
\})
endfor
call add(l:changes, {
\ 'fileName': ale#path#FromURI(l:file_name),
\ 'textChanges': l:text_changes,
\})
endfor
return l:changes
endfunction
function! s:EscapeMenuName(text) abort
return substitute(a:text, '\\\| \|\.\|&', '\\\0', 'g')
endfunction
function! s:UpdateMenu(data, menu_items) abort
silent! aunmenu PopUp.Refactor\.\.\.
if empty(a:data)
return
endif
for [l:type, l:item] in a:menu_items
let l:name = l:type is# 'tsserver' ? l:item.name : l:item.title
let l:func_name = l:type is# 'tsserver'
\ ? 'ale#codefix#ApplyTSServerCodeAction'
\ : 'ale#codefix#ApplyLSPCodeAction'
execute printf(
\ 'anoremenu <silent> PopUp.&Refactor\.\.\..%s'
\ . ' :call %s(%s, %s)<CR>',
\ s:EscapeMenuName(l:name),
\ l:func_name,
\ string(a:data),
\ string(l:item),
\)
endfor
if empty(a:menu_items)
silent! anoremenu PopUp.Refactor\.\.\..(None) :silent
endif
endfunction
function! s:GetCodeActions(linter, options) abort
let l:buffer = bufnr('')
let [l:line, l:column] = getpos('.')[1:2]
let l:column = min([l:column, len(getline(l:line))])
let l:location = {
\ 'buffer': l:buffer,
\ 'line': l:line,
\ 'column': l:column,
\ 'end_line': l:line,
\ 'end_column': l:column,
\}
let l:Callback = function('s:OnReady', [l:location, a:options])
call ale#lsp_linter#StartLSP(l:buffer, a:linter, l:Callback)
endfunction
function! ale#code_action#GetCodeActions(options) abort
silent! aunmenu PopUp.Rename
silent! aunmenu PopUp.Refactor\.\.\.
" Only display the menu items if there's an LSP server.
let l:has_lsp = 0
for l:linter in ale#linter#Get(&filetype)
if !empty(l:linter.lsp)
let l:has_lsp = 1
break
endif
endfor
if l:has_lsp
if !empty(expand('<cword>'))
silent! anoremenu <silent> PopUp.Rename :ALERename<CR>
endif
silent! anoremenu <silent> PopUp.Refactor\.\.\..(None) :silent<CR>
call ale#codefix#Execute(
\ mode() is# 'v' || mode() is# "\<C-V>",
\ function('s:UpdateMenu')
\)
endif
endfunction
function! s:Setup(enabled) abort
augroup ALECodeActionsGroup
autocmd!
if a:enabled
autocmd MenuPopup * :call ale#code_action#GetCodeActions({})
endif
augroup END
if !a:enabled
silent! augroup! ALECodeActionsGroup
silent! aunmenu PopUp.Rename
silent! aunmenu PopUp.Refactor\.\.\.
endif
endfunction
function! ale#code_action#EnablePopUpMenu() abort
call s:Setup(1)
endfunction
function! ale#code_action#DisablePopUpMenu() abort
call s:Setup(0)
endfunction

487
autoload/ale/codefix.vim Normal file
View File

@ -0,0 +1,487 @@
" Author: Dalius Dobravolskas <dalius.dobravolskas@gmail.com>
" Description: Code Fix support for tsserver and LSP servers
let s:codefix_map = {}
" Used to get the codefix map in tests.
function! ale#codefix#GetMap() abort
return deepcopy(s:codefix_map)
endfunction
" Used to set the codefix map in tests.
function! ale#codefix#SetMap(map) abort
let s:codefix_map = a:map
endfunction
function! ale#codefix#ClearLSPData() abort
let s:codefix_map = {}
endfunction
function! s:message(message) abort
call ale#util#Execute('echom ' . string(a:message))
endfunction
function! ale#codefix#ApplyTSServerCodeAction(data, item) abort
if has_key(a:item, 'changes')
let l:changes = a:item.changes
call ale#code_action#HandleCodeAction(
\ {
\ 'description': 'codefix',
\ 'changes': l:changes,
\ },
\ {},
\)
else
let l:message = ale#lsp#tsserver_message#GetEditsForRefactor(
\ a:data.buffer,
\ a:data.line,
\ a:data.column,
\ a:data.end_line,
\ a:data.end_column,
\ a:item.id[0],
\ a:item.id[1],
\)
let l:request_id = ale#lsp#Send(a:data.connection_id, l:message)
let s:codefix_map[l:request_id] = a:data
endif
endfunction
function! ale#codefix#HandleTSServerResponse(conn_id, response) abort
if !has_key(a:response, 'request_seq')
\ || !has_key(s:codefix_map, a:response.request_seq)
return
endif
let l:data = remove(s:codefix_map, a:response.request_seq)
let l:MenuCallback = get(l:data, 'menu_callback', v:null)
if get(a:response, 'command', '') is# 'getCodeFixes'
if get(a:response, 'success', v:false) is v:false
\&& l:MenuCallback is v:null
let l:message = get(a:response, 'message', 'unknown')
call s:message('Error while getting code fixes. Reason: ' . l:message)
return
endif
let l:result = get(a:response, 'body', [])
call filter(l:result, 'has_key(v:val, ''changes'')')
if l:MenuCallback isnot v:null
call l:MenuCallback(
\ l:data,
\ map(copy(l:result), '[''tsserver'', v:val]')
\)
return
endif
if len(l:result) == 0
call s:message('No code fixes available.')
return
endif
let l:code_fix_to_apply = 0
if len(l:result) == 1
let l:code_fix_to_apply = 1
else
let l:codefix_no = 1
let l:codefixstring = "Code Fixes:\n"
for l:codefix in l:result
let l:codefixstring .= l:codefix_no . ') '
\ . l:codefix.description . "\n"
let l:codefix_no += 1
endfor
let l:codefixstring .= 'Type number and <Enter> (empty cancels): '
let l:code_fix_to_apply = ale#util#Input(l:codefixstring, '')
let l:code_fix_to_apply = str2nr(l:code_fix_to_apply)
if l:code_fix_to_apply == 0
return
endif
endif
call ale#codefix#ApplyTSServerCodeAction(
\ l:data,
\ l:result[l:code_fix_to_apply - 1],
\)
elseif get(a:response, 'command', '') is# 'getApplicableRefactors'
if get(a:response, 'success', v:false) is v:false
\&& l:MenuCallback is v:null
let l:message = get(a:response, 'message', 'unknown')
call s:message('Error while getting applicable refactors. Reason: ' . l:message)
return
endif
let l:result = get(a:response, 'body', [])
if len(l:result) == 0
call s:message('No applicable refactors available.')
return
endif
let l:refactors = []
for l:item in l:result
for l:action in l:item.actions
call add(l:refactors, {
\ 'name': l:action.description,
\ 'id': [l:item.name, l:action.name],
\})
endfor
endfor
if l:MenuCallback isnot v:null
call l:MenuCallback(
\ l:data,
\ map(copy(l:refactors), '[''tsserver'', v:val]')
\)
return
endif
let l:refactor_no = 1
let l:refactorstring = "Applicable refactors:\n"
for l:refactor in l:refactors
let l:refactorstring .= l:refactor_no . ') '
\ . l:refactor.name . "\n"
let l:refactor_no += 1
endfor
let l:refactorstring .= 'Type number and <Enter> (empty cancels): '
let l:refactor_to_apply = ale#util#Input(l:refactorstring, '')
let l:refactor_to_apply = str2nr(l:refactor_to_apply)
if l:refactor_to_apply == 0
return
endif
let l:id = l:refactors[l:refactor_to_apply - 1].id
call ale#codefix#ApplyTSServerCodeAction(
\ l:data,
\ l:refactors[l:refactor_to_apply - 1],
\)
elseif get(a:response, 'command', '') is# 'getEditsForRefactor'
if get(a:response, 'success', v:false) is v:false
let l:message = get(a:response, 'message', 'unknown')
call s:message('Error while getting edits for refactor. Reason: ' . l:message)
return
endif
call ale#code_action#HandleCodeAction(
\ {
\ 'description': 'editsForRefactor',
\ 'changes': a:response.body.edits,
\ },
\ {},
\)
endif
endfunction
function! ale#codefix#ApplyLSPCodeAction(data, item) abort
if has_key(a:item, 'command')
\&& type(a:item.command) == v:t_dict
let l:command = a:item.command
let l:message = ale#lsp#message#ExecuteCommand(
\ l:command.command,
\ l:command.arguments,
\)
let l:request_id = ale#lsp#Send(a:data.connection_id, l:message)
elseif has_key(a:item, 'edit') || has_key(a:item, 'arguments')
if has_key(a:item, 'edit')
let l:topass = a:item.edit
else
let l:topass = a:item.arguments[0]
endif
let l:changes_map = ale#code_action#GetChanges(l:topass)
if empty(l:changes_map)
return
endif
let l:changes = ale#code_action#BuildChangesList(l:changes_map)
call ale#code_action#HandleCodeAction(
\ {
\ 'description': 'codeaction',
\ 'changes': l:changes,
\ },
\ {},
\)
endif
endfunction
function! ale#codefix#HandleLSPResponse(conn_id, response) abort
if has_key(a:response, 'method')
\ && a:response.method is# 'workspace/applyEdit'
\ && has_key(a:response, 'params')
let l:params = a:response.params
let l:changes_map = ale#code_action#GetChanges(l:params.edit)
if empty(l:changes_map)
return
endif
let l:changes = ale#code_action#BuildChangesList(l:changes_map)
call ale#code_action#HandleCodeAction(
\ {
\ 'description': 'applyEdit',
\ 'changes': l:changes,
\ },
\ {}
\)
elseif has_key(a:response, 'id')
\&& has_key(s:codefix_map, a:response.id)
let l:data = remove(s:codefix_map, a:response.id)
let l:MenuCallback = get(l:data, 'menu_callback', v:null)
let l:result = get(a:response, 'result')
if type(l:result) != v:t_list
let l:result = []
endif
" Send the results to the menu callback, if set.
if l:MenuCallback isnot v:null
call l:MenuCallback(
\ l:data,
\ map(copy(l:result), '[''lsp'', v:val]')
\)
return
endif
if len(l:result) == 0
call s:message('No code actions received from server')
return
endif
let l:codeaction_no = 1
let l:codeactionstring = "Code Fixes:\n"
for l:codeaction in l:result
let l:codeactionstring .= l:codeaction_no . ') '
\ . l:codeaction.title . "\n"
let l:codeaction_no += 1
endfor
let l:codeactionstring .= 'Type number and <Enter> (empty cancels): '
let l:codeaction_to_apply = ale#util#Input(l:codeactionstring, '')
let l:codeaction_to_apply = str2nr(l:codeaction_to_apply)
if l:codeaction_to_apply == 0
return
endif
let l:item = l:result[l:codeaction_to_apply - 1]
call ale#codefix#ApplyLSPCodeAction(l:data, l:item)
endif
endfunction
function! s:FindError(buffer, line, column, end_line, end_column) abort
let l:nearest_error = v:null
if a:line == a:end_line
\&& a:column == a:end_column
\&& has_key(g:ale_buffer_info, a:buffer)
let l:nearest_error_diff = -1
for l:error in get(g:ale_buffer_info[a:buffer], 'loclist', [])
if has_key(l:error, 'code') && l:error.lnum == a:line
let l:diff = abs(l:error.col - a:column)
if l:nearest_error_diff == -1 || l:diff < l:nearest_error_diff
let l:nearest_error_diff = l:diff
let l:nearest_error = l:error
endif
endif
endfor
endif
return l:nearest_error
endfunction
function! s:OnReady(
\ line,
\ column,
\ end_line,
\ end_column,
\ MenuCallback,
\ linter,
\ lsp_details,
\) abort
let l:id = a:lsp_details.connection_id
if !ale#lsp#HasCapability(l:id, 'code_actions')
return
endif
let l:buffer = a:lsp_details.buffer
if a:linter.lsp is# 'tsserver'
let l:nearest_error =
\ s:FindError(l:buffer, a:line, a:column, a:end_line, a:end_column)
if l:nearest_error isnot v:null
let l:message = ale#lsp#tsserver_message#GetCodeFixes(
\ l:buffer,
\ a:line,
\ a:column,
\ a:line,
\ a:column,
\ [l:nearest_error.code],
\)
else
let l:message = ale#lsp#tsserver_message#GetApplicableRefactors(
\ l:buffer,
\ a:line,
\ a:column,
\ a:end_line,
\ a:end_column,
\)
endif
else
" Send a message saying the buffer has changed first, otherwise
" completions won't know what text is nearby.
call ale#lsp#NotifyForChanges(l:id, l:buffer)
let l:diagnostics = []
let l:nearest_error =
\ s:FindError(l:buffer, a:line, a:column, a:end_line, a:end_column)
if l:nearest_error isnot v:null
let l:diagnostics = [
\ {
\ 'code': l:nearest_error.code,
\ 'message': l:nearest_error.text,
\ 'range': {
\ 'start': {
\ 'line': l:nearest_error.lnum - 1,
\ 'character': l:nearest_error.col - 1,
\ },
\ 'end': {
\ 'line': l:nearest_error.end_lnum - 1,
\ 'character': l:nearest_error.end_col,
\ },
\ },
\ },
\]
endif
let l:message = ale#lsp#message#CodeAction(
\ l:buffer,
\ a:line,
\ a:column,
\ a:end_line,
\ a:end_column,
\ l:diagnostics,
\)
endif
let l:Callback = a:linter.lsp is# 'tsserver'
\ ? function('ale#codefix#HandleTSServerResponse')
\ : function('ale#codefix#HandleLSPResponse')
call ale#lsp#RegisterCallback(l:id, l:Callback)
let l:request_id = ale#lsp#Send(l:id, l:message)
let s:codefix_map[l:request_id] = {
\ 'connection_id': l:id,
\ 'buffer': l:buffer,
\ 'line': a:line,
\ 'column': a:column,
\ 'end_line': a:end_line,
\ 'end_column': a:end_column,
\ 'menu_callback': a:MenuCallback,
\}
endfunction
function! s:ExecuteGetCodeFix(linter, range, MenuCallback) abort
let l:buffer = bufnr('')
if a:range == 0
let [l:line, l:column] = getpos('.')[1:2]
let l:end_line = l:line
let l:end_column = l:column
" Expand the range to cover the current word, if there is one.
let l:cword = expand('<cword>')
if !empty(l:cword)
let l:search_pos = searchpos('\V' . l:cword, 'bn', l:line)
if l:search_pos != [0, 0]
let l:column = l:search_pos[1]
let l:end_column = l:column + len(l:cword) - 1
endif
endif
elseif mode() is# 'v' || mode() is# "\<C-V>"
" You need to get the start and end in a different way when you're in
" visual mode.
let [l:line, l:column] = getpos('v')[1:2]
let [l:end_line, l:end_column] = getpos('.')[1:2]
else
let [l:line, l:column] = getpos("'<")[1:2]
let [l:end_line, l:end_column] = getpos("'>")[1:2]
endif
let l:column = min([l:column, len(getline(l:line))])
let l:end_column = min([l:end_column, len(getline(l:end_line))])
let l:Callback = function(
\ 's:OnReady', [l:line, l:column, l:end_line, l:end_column, a:MenuCallback]
\)
call ale#lsp_linter#StartLSP(l:buffer, a:linter, l:Callback)
endfunction
function! ale#codefix#Execute(range, ...) abort
if a:0 > 1
throw 'Too many arguments'
endif
let l:MenuCallback = get(a:000, 0, v:null)
let l:lsp_linters = []
for l:linter in ale#linter#Get(&filetype)
if !empty(l:linter.lsp)
call add(l:lsp_linters, l:linter)
endif
endfor
if empty(l:lsp_linters)
if l:MenuCallback is v:null
call s:message('No active LSPs')
else
call l:MenuCallback({}, [])
endif
return
endif
for l:lsp_linter in l:lsp_linters
call s:ExecuteGetCodeFix(l:lsp_linter, a:range, l:MenuCallback)
endfor
endfunction

View File

@ -606,17 +606,21 @@ function! ale#completion#ParseLSPCompletions(response) abort
let l:doc = l:doc.value
endif
" Collapse whitespaces and line breaks into a single space.
let l:detail = substitute(get(l:item, 'detail', ''), '\_s\+', ' ', 'g')
let l:result = {
\ 'word': l:word,
\ 'kind': ale#completion#GetCompletionSymbols(get(l:item, 'kind', '')),
\ 'icase': 1,
\ 'menu': get(l:item, 'detail', ''),
\ 'menu': l:detail,
\ 'info': (type(l:doc) is v:t_string ? l:doc : ''),
\}
" This flag is used to tell if this completion came from ALE or not.
let l:user_data = {'_ale_completion_item': 1}
if has_key(l:item, 'additionalTextEdits')
\ && l:item.additionalTextEdits isnot v:null
let l:text_changes = []
for l:edit in l:item.additionalTextEdits

View File

@ -9,7 +9,6 @@ let g:ale_echo_delay = get(g:, 'ale_echo_delay', 10)
let g:ale_echo_msg_format = get(g:, 'ale_echo_msg_format', '%code: %%s')
let s:cursor_timer = -1
let s:last_pos = [0, 0, 0]
function! ale#cursor#TruncatedEcho(original_message) abort
let l:message = a:original_message
@ -118,14 +117,18 @@ function! ale#cursor#EchoCursorWarningWithDelay() abort
let l:pos = getpos('.')[0:2]
if !exists('w:last_pos')
let w:last_pos = [0, 0, 0]
endif
" Check the current buffer, line, and column number against the last
" recorded position. If the position has actually changed, *then*
" we should echo something. Otherwise we can end up doing processing
" the echo message far too frequently.
if l:pos != s:last_pos
if l:pos != w:last_pos
let l:delay = ale#Var(l:buffer, 'echo_delay')
let s:last_pos = l:pos
let w:last_pos = l:pos
let s:cursor_timer = timer_start(
\ l:delay,
\ function('ale#cursor#EchoCursorWarning')
@ -139,11 +142,16 @@ function! s:ShowCursorDetailForItem(loc, options) abort
let s:last_detailed_line = line('.')
let l:message = get(a:loc, 'detail', a:loc.text)
let l:lines = split(l:message, "\n")
call ale#preview#Show(l:lines, {'stay_here': l:stay_here})
" Clear the echo message if we manually displayed details.
if !l:stay_here
execute 'echo'
if g:ale_floating_preview || g:ale_detail_to_floating_preview
call ale#floating_preview#Show(l:lines)
else
call ale#preview#Show(l:lines, {'stay_here': l:stay_here})
" Clear the echo message if we manually displayed details.
if !l:stay_here
execute 'echo'
endif
endif
endfunction

24
autoload/ale/dhall.vim Normal file
View File

@ -0,0 +1,24 @@
" Author: Pat Brisbin <pbrisbin@gmail.com>, toastal <toastal@protonmail.com>
" Description: Functions for working with Dhalls executable
call ale#Set('dhall_executable', 'dhall')
call ale#Set('dhall_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('dhall_options', '')
function! ale#dhall#GetExecutable(buffer) abort
let l:executable = ale#Var(a:buffer, 'dhall_executable')
" Dhall is written in Haskell and commonly installed with Stack
return ale#handlers#haskell_stack#EscapeExecutable(l:executable, 'dhall')
endfunction
function! ale#dhall#GetExecutableWithOptions(buffer) abort
let l:executable = ale#dhall#GetExecutable(a:buffer)
return l:executable
\ . ale#Pad(ale#Var(a:buffer, 'dhall_options'))
endfunction
function! ale#dhall#GetCommand(buffer) abort
return '%e ' . ale#Pad(ale#Var(a:buffer, 'dhall_options'))
endfunction

View File

@ -12,6 +12,11 @@ let s:default_registry = {
\ 'suggested_filetypes': ['help'],
\ 'description': 'Align help tags to the right margin',
\ },
\ 'autoimport': {
\ 'function': 'ale#fixers#autoimport#Fix',
\ 'suggested_filetypes': ['python'],
\ 'description': 'Fix import issues with autoimport.',
\ },
\ 'autopep8': {
\ 'function': 'ale#fixers#autopep8#Fix',
\ 'suggested_filetypes': ['python'],
@ -27,11 +32,37 @@ let s:default_registry = {
\ 'suggested_filetypes': ['python'],
\ 'description': 'Fix PEP8 issues with black.',
\ },
\ 'deno': {
\ 'function': 'ale#fixers#deno#Fix',
\ 'suggested_filetypes': ['typescript'],
\ 'description': 'Fix TypeScript using deno fmt.',
\ },
\ 'dfmt': {
\ 'function': 'ale#fixers#dfmt#Fix',
\ 'suggested_filetypes': ['d'],
\ 'description': 'Fix D files with dfmt.',
\ },
\ 'dhall': {
\ 'function': 'ale#fixers#dhall#Fix',
\ 'suggested_filetypes': ['dhall'],
\ 'description': 'Fix Dhall files with dhall-format.',
\ },
\ 'dhall-format': {
\ 'function': 'ale#fixers#dhall_format#Fix',
\ 'suggested_filetypes': ['dhall'],
\ 'description': 'Standard code formatter for the Dhall language',
\ 'aliases': ['dhall'],
\ },
\ 'dhall-freeze': {
\ 'function': 'ale#fixers#dhall_freeze#Freeze',
\ 'suggested_filetypes': ['dhall'],
\ 'description': 'Add integrity checks to remote import statements of an expression for the Dhall language',
\ },
\ 'dhall-lint': {
\ 'function': 'ale#fixers#dhall_lint#Fix',
\ 'suggested_filetypes': ['dhall'],
\ 'description': 'Standard code formatter for the Dhall language and removing dead code',
\ },
\ 'fecs': {
\ 'function': 'ale#fixers#fecs#Fix',
\ 'suggested_filetypes': ['javascript', 'css', 'html'],
@ -76,7 +107,7 @@ let s:default_registry = {
\ },
\ 'prettier': {
\ 'function': 'ale#fixers#prettier#Fix',
\ 'suggested_filetypes': ['javascript', 'typescript', 'css', 'less', 'scss', 'json', 'json5', 'graphql', 'markdown', 'vue', 'html', 'yaml'],
\ 'suggested_filetypes': ['javascript', 'typescript', 'css', 'less', 'scss', 'json', 'json5', 'graphql', 'markdown', 'vue', 'html', 'yaml', 'openapi'],
\ 'description': 'Apply prettier to a file.',
\ },
\ 'prettier_eslint': {
@ -105,6 +136,11 @@ let s:default_registry = {
\ 'suggested_filetypes': [],
\ 'description': 'Remove all trailing whitespace characters at the end of every line.',
\ },
\ 'yamlfix': {
\ 'function': 'ale#fixers#yamlfix#Fix',
\ 'suggested_filetypes': ['yaml'],
\ 'description': 'Fix yaml files with yamlfix.',
\ },
\ 'yapf': {
\ 'function': 'ale#fixers#yapf#Fix',
\ 'suggested_filetypes': ['python'],
@ -122,7 +158,7 @@ let s:default_registry = {
\ },
\ 'scalafmt': {
\ 'function': 'ale#fixers#scalafmt#Fix',
\ 'suggested_filetypes': ['scala'],
\ 'suggested_filetypes': ['sbt', 'scala'],
\ 'description': 'Fix Scala files using scalafmt',
\ },
\ 'sorbet': {
@ -332,7 +368,7 @@ let s:default_registry = {
\ },
\ 'ktlint': {
\ 'function': 'ale#fixers#ktlint#Fix',
\ 'suggested_filetypes': ['kt'],
\ 'suggested_filetypes': ['kt', 'kotlin'],
\ 'description': 'Fix Kotlin files with ktlint.',
\ },
\ 'styler': {
@ -375,11 +411,16 @@ let s:default_registry = {
\ 'suggested_filetypes': ['html', 'htmldjango'],
\ 'description': 'Fix HTML files with html-beautify.',
\ },
\ 'dhall': {
\ 'function': 'ale#fixers#dhall#Fix',
\ 'suggested_filetypes': ['dhall'],
\ 'description': 'Fix Dhall files with dhall-format.',
\ 'luafmt': {
\ 'function': 'ale#fixers#luafmt#Fix',
\ 'suggested_filetypes': ['lua'],
\ 'description': 'Fix Lua files with luafmt.',
\ },
\ 'ormolu': {
\ 'function': 'ale#fixers#ormolu#Fix',
\ 'suggested_filetypes': ['haskell'],
\ 'description': 'A formatter for Haskell source code.',
\ }
\}
" Reset the function registry to the default entries.

View File

@ -0,0 +1,25 @@
" Author: lyz-code
" Description: Fixing Python imports with autoimport.
call ale#Set('python_autoimport_executable', 'autoimport')
call ale#Set('python_autoimport_options', '')
call ale#Set('python_autoimport_use_global', get(g:, 'ale_use_global_executables', 0))
function! ale#fixers#autoimport#Fix(buffer) abort
let l:options = ale#Var(a:buffer, 'python_autoimport_options')
let l:executable = ale#python#FindExecutable(
\ a:buffer,
\ 'python_autoimport',
\ ['autoimport'],
\)
if !executable(l:executable)
return 0
endif
return {
\ 'command': ale#path#BufferCdString(a:buffer)
\ . ale#Escape(l:executable) . (!empty(l:options) ? ' ' . l:options : '') . ' -',
\}
endfunction

View File

@ -0,0 +1,17 @@
function! ale#fixers#deno#Fix(buffer) abort
let l:executable = ale#handlers#deno#GetExecutable(a:buffer)
if !executable(l:executable)
return 0
endif
let l:options = ' fmt -'
if ale#Var(a:buffer, 'deno_unstable')
let l:options = l:options . ' --unstable'
endif
return {
\ 'command': ale#Escape(l:executable) . l:options
\}
endfunction

View File

@ -1,23 +0,0 @@
" Author: Pat Brisbin <pbrisbin@gmail.com>
" Description: Integration of dhall-format with ALE.
call ale#Set('dhall_format_executable', 'dhall')
function! ale#fixers#dhall#GetExecutable(buffer) abort
let l:executable = ale#Var(a:buffer, 'dhall_format_executable')
" Dhall is written in Haskell and commonly installed with Stack
return ale#handlers#haskell_stack#EscapeExecutable(l:executable, 'dhall')
endfunction
function! ale#fixers#dhall#Fix(buffer) abort
let l:executable = ale#fixers#dhall#GetExecutable(a:buffer)
return {
\ 'command': l:executable
\ . ' format'
\ . ' --inplace'
\ . ' %t',
\ 'read_temporary_file': 1,
\}
endfunction

View File

@ -0,0 +1,14 @@
" Author: toastal <toastal@protonmail.com>
" Description: Dhalls built-in formatter
"
function! ale#fixers#dhall_format#Fix(buffer) abort
let l:executable = ale#dhall#GetExecutableWithOptions(a:buffer)
let l:command = l:executable
\ . ' format'
\ . ' --inplace %t'
return {
\ 'command': l:command,
\ 'read_temporary_file': 1,
\}
endfunction

View File

@ -0,0 +1,18 @@
" Author: toastal <toastal@protonmail.com>
" Description: Dhalls package freezing
call ale#Set('dhall_freeze_options', '')
function! ale#fixers#dhall_freeze#Freeze(buffer) abort
let l:executable = ale#dhall#GetExecutableWithOptions(a:buffer)
let l:command = l:executable
\ . ' freeze'
\ . ale#Pad(ale#Var(a:buffer, 'dhall_freeze_options'))
\ . ' --inplace %t'
return {
\ 'command': l:command,
\ 'read_temporary_file': 1,
\}
endfunction

View File

@ -0,0 +1,14 @@
" Author: toastal <toastal@protonmail.com>
" Description: Dhalls built-in linter/formatter
function! ale#fixers#dhall_lint#Fix(buffer) abort
let l:executable = ale#dhall#GetExecutableWithOptions(a:buffer)
let l:command = l:executable
\ . ' lint'
\ . ' --inplace %t'
return {
\ 'command': l:command,
\ 'read_temporary_file': 1,
\}
endfunction

View File

@ -11,9 +11,6 @@ function! ale#fixers#gofmt#Fix(buffer) abort
return {
\ 'command': l:env . ale#Escape(l:executable)
\ . ' -l -w'
\ . (empty(l:options) ? '' : ' ' . l:options)
\ . ' %t',
\ 'read_temporary_file': 1,
\}
endfunction

View File

@ -2,24 +2,35 @@
" Description: Fixing Python imports with isort.
call ale#Set('python_isort_executable', 'isort')
call ale#Set('python_isort_options', '')
call ale#Set('python_isort_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('python_isort_options', '')
call ale#Set('python_isort_auto_pipenv', 0)
function! ale#fixers#isort#GetExecutable(buffer) abort
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_isort_auto_pipenv'))
\ && ale#python#PipenvPresent(a:buffer)
return 'pipenv'
endif
return ale#python#FindExecutable(a:buffer, 'python_isort', ['isort'])
endfunction
function! ale#fixers#isort#Fix(buffer) abort
let l:options = ale#Var(a:buffer, 'python_isort_options')
let l:executable = ale#python#FindExecutable(
\ a:buffer,
\ 'python_isort',
\ ['isort'],
\)
let l:executable = ale#fixers#isort#GetExecutable(a:buffer)
if !executable(l:executable)
let l:exec_args = l:executable =~? 'pipenv$'
\ ? ' run isort'
\ : ''
if !executable(l:executable) && l:executable isnot# 'pipenv'
return 0
endif
return {
\ 'command': ale#path#BufferCdString(a:buffer)
\ . ale#Escape(l:executable) . (!empty(l:options) ? ' ' . l:options : '') . ' -',
\ . ale#Escape(l:executable) . l:exec_args
\ . (!empty(l:options) ? ' ' . l:options : '') . ' -',
\}
endfunction

View File

@ -0,0 +1,13 @@
call ale#Set('lua_luafmt_executable', 'luafmt')
call ale#Set('lua_luafmt_options', '')
function! ale#fixers#luafmt#Fix(buffer) abort
let l:executable = ale#Var(a:buffer, 'lua_luafmt_executable')
let l:options = ale#Var(a:buffer, 'lua_luafmt_options')
return {
\ 'command': ale#Escape(l:executable)
\ . (empty(l:options) ? '' : ' ' . l:options)
\ . ' --stdin',
\}
endfunction

View File

@ -0,0 +1,12 @@
call ale#Set('haskell_ormolu_executable', 'ormolu')
call ale#Set('haskell_ormolu_options', '')
function! ale#fixers#ormolu#Fix(buffer) abort
let l:executable = ale#Var(a:buffer, 'haskell_ormolu_executable')
let l:options = ale#Var(a:buffer, 'haskell_ormolu_options')
return {
\ 'command': ale#Escape(l:executable)
\ . (empty(l:options) ? '' : ' ' . l:options),
\}
endfunction

View File

@ -2,6 +2,7 @@
" Description: Fixing files with phpcbf.
call ale#Set('php_phpcbf_standard', '')
call ale#Set('php_phpcbf_options', '')
call ale#Set('php_phpcbf_executable', 'phpcbf')
call ale#Set('php_phpcbf_use_global', get(g:, 'ale_use_global_executables', 0))
@ -20,6 +21,6 @@ function! ale#fixers#phpcbf#Fix(buffer) abort
\ : ''
return {
\ 'command': ale#Escape(l:executable) . ' --stdin-path=%s ' . l:standard_option . ' -'
\ 'command': ale#Escape(l:executable) . ' --stdin-path=%s ' . l:standard_option . ale#Pad(ale#Var(a:buffer, 'php_phpcbf_options')) . ' -'
\}
endfunction

View File

@ -83,6 +83,7 @@ function! ale#fixers#prettier#ApplyFixForVersion(buffer, version) abort
\ 'markdown': 'markdown',
\ 'vue': 'vue',
\ 'yaml': 'yaml',
\ 'openapi': 'yaml',
\ 'html': 'html',
\}

View File

@ -12,12 +12,12 @@ function! ale#fixers#standardrb#GetCommand(buffer) abort
return ale#ruby#EscapeExecutable(l:executable, 'standardrb')
\ . (!empty(l:config) ? ' --config ' . ale#Escape(l:config) : '')
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ' --fix --force-exclusion %t'
\ . ' --fix --force-exclusion --stdin %s'
endfunction
function! ale#fixers#standardrb#Fix(buffer) abort
return {
\ 'command': ale#fixers#standardrb#GetCommand(a:buffer),
\ 'read_temporary_file': 1,
\ 'process_with': 'ale#fixers#rubocop#PostProcess'
\}
endfunction

View File

@ -1,23 +1,36 @@
" Author: Albert Marquez - https://github.com/a-marquez
" Description: Fixing files with XO.
call ale#Set('javascript_xo_executable', 'xo')
call ale#Set('javascript_xo_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('javascript_xo_options', '')
function! ale#fixers#xo#Fix(buffer) abort
let l:executable = ale#handlers#xo#GetExecutable(a:buffer)
let l:options = ale#handlers#xo#GetOptions(a:buffer)
function! ale#fixers#xo#GetExecutable(buffer) abort
return ale#node#FindExecutable(a:buffer, 'javascript_xo', [
\ 'node_modules/xo/cli.js',
\ 'node_modules/.bin/xo',
\])
return ale#semver#RunWithVersionCheck(
\ a:buffer,
\ l:executable,
\ '%e --version',
\ {b, v -> ale#fixers#xo#ApplyFixForVersion(b, v, l:executable, l:options)}
\)
endfunction
function! ale#fixers#xo#Fix(buffer) abort
let l:executable = ale#fixers#xo#GetExecutable(a:buffer)
function! ale#fixers#xo#ApplyFixForVersion(buffer, version, executable, options) abort
let l:executable = ale#node#Executable(a:buffer, a:executable)
let l:options = ale#Pad(a:options)
" 0.30.0 is the first version with a working --stdin --fix
if ale#semver#GTE(a:version, [0, 30, 0])
return {
\ 'command': l:executable
\ . ' --stdin --stdin-filename %s'
\ . ' --fix'
\ . l:options,
\}
endif
return {
\ 'command': ale#node#Executable(a:buffer, l:executable)
\ . ' --fix %t',
\ 'command': l:executable
\ . ' --fix %t'
\ . l:options,
\ 'read_temporary_file': 1,
\}
endfunction

View File

@ -0,0 +1,25 @@
" Author: lyz-code
" Description: Fixing yaml files with yamlfix.
call ale#Set('yaml_yamlfix_executable', 'yamlfix')
call ale#Set('yaml_yamlfix_options', '')
call ale#Set('yaml_yamlfix_use_global', get(g:, 'ale_use_global_executables', 0))
function! ale#fixers#yamlfix#Fix(buffer) abort
let l:options = ale#Var(a:buffer, 'yaml_yamlfix_options')
let l:executable = ale#python#FindExecutable(
\ a:buffer,
\ 'yaml_yamlfix',
\ ['yamlfix'],
\)
if !executable(l:executable)
return 0
endif
return {
\ 'command': ale#path#BufferCdString(a:buffer)
\ . ale#Escape(l:executable) . (!empty(l:options) ? ' ' . l:options : '') . ' -',
\}
endfunction

View File

@ -0,0 +1,91 @@
" Author: Jan-Grimo Sobez <jan-grimo.sobez@phys.chem.ethz.ch>
" Author: Kevin Clark <kevin.clark@gmail.com>
" Description: Floating preview window for showing whatever information in.
" Precondition: exists('*nvim_open_win')
function! ale#floating_preview#Show(lines, ...) abort
if !exists('*nvim_open_win')
execute 'echom ''Floating windows not supported in this vim instance.'''
return
endif
" Remove the close autocmd so it doesn't happen mid update
augroup ale_floating_preview_window
autocmd!
augroup END
let l:options = get(a:000, 0, {})
" Only create a new window if we need it
if !exists('w:preview') || index(nvim_list_wins(), w:preview['id']) is# -1
call s:Create(l:options)
else
call nvim_buf_set_option(w:preview['buffer'], 'modifiable', v:true)
endif
" Execute commands in window context
let l:parent_window = nvim_get_current_win()
call nvim_set_current_win(w:preview['id'])
for l:command in get(l:options, 'commands', [])
call execute(l:command)
endfor
call nvim_set_current_win(l:parent_window)
" Return to parent context on move
augroup ale_floating_preview_window
autocmd!
if g:ale_close_preview_on_insert
autocmd CursorMoved,TabLeave,WinLeave,InsertEnter <buffer> ++once call s:Close()
else
autocmd CursorMoved,TabLeave,WinLeave <buffer> ++once call s:Close()
endif
augroup END
let l:width = max(map(copy(a:lines), 'strdisplaywidth(v:val)'))
let l:height = min([len(a:lines), 10])
call nvim_win_set_width(w:preview['id'], l:width)
call nvim_win_set_height(w:preview['id'], l:height)
call nvim_buf_set_lines(w:preview['buffer'], 0, -1, v:false, a:lines)
call nvim_buf_set_option(w:preview['buffer'], 'modified', v:false)
call nvim_buf_set_option(w:preview['buffer'], 'modifiable', v:false)
endfunction
function! s:Create(options) abort
let l:buffer = nvim_create_buf(v:false, v:false)
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)
call nvim_buf_set_option(l:buffer, 'filetype', get(a:options, 'filetype', 'ale-preview'))
let w:preview = {'id': l:winid, 'buffer': l:buffer}
endfunction
function! s:Close() abort
if !exists('w:preview')
return
endif
call setbufvar(w:preview['buffer'], '&modified', 0)
if win_id2win(w:preview['id']) > 0
execute win_id2win(w:preview['id']).'wincmd c'
endif
unlet w:preview
endfunction

View File

@ -0,0 +1,41 @@
" Author: Leo <thinkabit.ukim@gmail.com>
" Description: Handlers for output expected from atools
function! ale#handlers#atools#Handle(buffer, lines) abort
" Format: SEVERITY:[TAG]:PATH:LINENUM:MSG
" Example: MC:[AL5]:./APKBUILD:12:variable set to empty string: install=
let l:pattern = '\([^:]\+\):\([^:]\+\):\([^:]\+\):\(\d\+\):\(.\+\)$'
let l:output = []
for l:match in ale#util#GetMatches(a:lines, l:pattern)
" We are expected to receive 2 characters, the first character
" can be 'S', 'I', 'M' 'T', which are respectively:
" Serious (Error)
" Important (Error)
" Minor (Warning)
" Style (Warning)
"
" The second character can be either 'C' or 'P', which are respectively:
" Certain (Error)
" Possible (Warning)
let l:severity = matchstr(l:match[1], '^.')
let l:certainty = matchstr(l:match[1], '.$')
let l:type = 'E'
" If the tag returns 'Minor' or 'Style' or is 'Possible'
" then return a warning
if l:severity is# 'M' || l:severity is# 'T' || l:certainty is# 'P'
let l:type = 'W'
endif
call add(l:output, {
\ 'lnum': l:match[4] + 0,
\ 'text': l:match[5],
\ 'type': l:type,
\ 'code': matchstr(l:match[2], 'AL[0-9]*'),
\})
endfor
return l:output
endfunction

View File

@ -0,0 +1,52 @@
" Author: Mohammed Chelouti - https://github.com/motato1
" Description: Handler functions for Deno.
call ale#Set('deno_executable', 'deno')
call ale#Set('deno_unstable', 0)
call ale#Set('deno_lsp_project_root', '')
function! ale#handlers#deno#GetExecutable(buffer) abort
return ale#Var(a:buffer, 'deno_executable')
endfunction
" Find project root for Deno's language server.
"
" Deno projects do not require a project or configuration file at the project root.
" This means the root directory has to be guessed,
" unless it is explicitly specified by the user.
"
" The project root is determined by ...
" 1. using a user-specified value from deno_lsp_project_root
" 2. looking for common top-level files/dirs
" 3. using the buffer's directory
function! ale#handlers#deno#GetProjectRoot(buffer) abort
let l:project_root = ale#Var(a:buffer, 'deno_lsp_project_root')
if !empty(l:project_root)
return l:project_root
endif
let l:possible_project_roots = [
\ 'tsconfig.json',
\ '.git',
\ bufname(a:buffer),
\]
for l:possible_root in l:possible_project_roots
let l:project_root = ale#path#FindNearestFile(a:buffer, l:possible_root)
if empty(l:project_root)
let l:project_root = ale#path#FindNearestDirectory(a:buffer, l:possible_root)
endif
if !empty(l:project_root)
" dir:p expands to /full/path/to/dir/ whereas
" file:p expands to /full/path/to/file (no trailing slash)
" Appending '/' ensures that :h:h removes the path's last segment
" regardless of whether it is a directory or not.
return fnamemodify(l:project_root . '/', ':p:h:h')
endif
endfor
return ''
endfunction

View File

@ -5,6 +5,7 @@ let s:executables = [
\ 'node_modules/.bin/eslint_d',
\ 'node_modules/eslint/bin/eslint.js',
\ 'node_modules/.bin/eslint',
\ '.yarn/sdks/eslint/bin/eslint',
\]
let s:sep = has('win32') ? '\' : '/'

View File

@ -0,0 +1,37 @@
" Author: Yorick Peterse <yorick@yorickpeterse.com>
" Description: output handlers for the Inko JSON format
function! ale#handlers#inko#GetType(severity) abort
if a:severity is? 'warning'
return 'W'
endif
return 'E'
endfunction
function! ale#handlers#inko#Handle(buffer, lines) abort
try
let l:errors = json_decode(join(a:lines, ''))
catch
return []
endtry
if empty(l:errors)
return []
endif
let l:output = []
let l:dir = expand('#' . a:buffer . ':p:h')
for l:error in l:errors
call add(l:output, {
\ 'filename': ale#path#GetAbsPath(l:dir, l:error['file']),
\ 'lnum': l:error['line'],
\ 'col': l:error['column'],
\ 'text': l:error['message'],
\ 'type': ale#handlers#inko#GetType(l:error['level']),
\})
endfor
return l:output
endfunction

View File

@ -1,18 +1,28 @@
" Author: w0rp <devw0rp@gmail.com>
" Get the shell type for a buffer, based on the hashbang line.
function! ale#handlers#sh#GetShellType(buffer) abort
let l:bang_line = get(getbufline(a:buffer, 1), 0, '')
let l:shebang = get(getbufline(a:buffer, 1), 0, '')
let l:command = ''
" Take the shell executable from the hashbang, if we can.
if l:bang_line[:1] is# '#!'
" Take the shell executable from the shebang, if we can.
if l:shebang[:1] is# '#!'
" Remove options like -e, etc.
let l:command = substitute(l:bang_line, ' --\?[a-zA-Z0-9]\+', '', 'g')
let l:command = substitute(l:shebang, ' --\?[a-zA-Z0-9]\+', '', 'g')
endif
" If we couldn't find a hashbang, try the filetype
" With no shebang line, attempt to use Vim's buffer-local variables.
if l:command is# ''
if getbufvar(a:buffer, 'is_bash', 0)
let l:command = 'bash'
elseif getbufvar(a:buffer, 'is_sh', 0)
let l:command = 'sh'
elseif getbufvar(a:buffer, 'is_kornshell', 0)
let l:command = 'ksh'
endif
endif
" If we couldn't find a shebang, try the filetype
if l:command is# ''
let l:command = &filetype
endif

View File

@ -1,8 +1,32 @@
" Author: w0rp <devw0rp@gmail.com>
" Description: This file adds support for using the shellcheck linter
" Shellcheck supports shell directives to define the shell dialect for scripts
" that do not have a shebang for some reason.
" https://github.com/koalaman/shellcheck/wiki/Directive#shell
function! ale#handlers#shellcheck#GetShellcheckDialectDirective(buffer) abort
let l:linenr = 0
let l:pattern = '\s\{-}#\s\{-}shellcheck\s\{-}shell=\(.*\)'
let l:possible_shell = ['bash', 'dash', 'ash', 'tcsh', 'csh', 'zsh', 'ksh', 'sh']
while l:linenr < min([50, line('$')])
let l:linenr += 1
let l:match = matchlist(getline(l:linenr), l:pattern)
if len(l:match) > 1 && index(l:possible_shell, l:match[1]) >= 0
return l:match[1]
endif
endwhile
return ''
endfunction
function! ale#handlers#shellcheck#GetDialectArgument(buffer) abort
let l:shell_type = ale#handlers#sh#GetShellType(a:buffer)
let l:shell_type = ale#handlers#shellcheck#GetShellcheckDialectDirective(a:buffer)
if empty(l:shell_type)
let l:shell_type = ale#handlers#sh#GetShellType(a:buffer)
endif
if !empty(l:shell_type)
" Use the dash dialect for /bin/ash, etc.
@ -13,15 +37,6 @@ function! ale#handlers#shellcheck#GetDialectArgument(buffer) abort
return l:shell_type
endif
" If there's no hashbang, try using Vim's buffer variables.
if getbufvar(a:buffer, 'is_bash', 0)
return 'bash'
elseif getbufvar(a:buffer, 'is_sh', 0)
return 'sh'
elseif getbufvar(a:buffer, 'is_kornshell', 0)
return 'ksh'
endif
return ''
endfunction

View File

@ -0,0 +1,31 @@
" Author: t2h5 <https://github.com/t2h5>
" Description: Integration of Stoplight Spectral CLI with ALE.
function! ale#handlers#spectral#HandleSpectralOutput(buffer, lines) abort
" Matches patterns like the following:
" openapi.yml:1:1 error oas3-schema "Object should have required property `info`."
" openapi.yml:1:1 warning oas3-api-servers "OpenAPI `servers` must be present and non-empty array."
let l:pattern = '\v^.*:(\d+):(\d+) (error|warning) (.*)$'
let l:output = []
for l:match in ale#util#GetMatches(a:lines, l:pattern)
let l:obj = {
\ 'lnum': l:match[1] + 0,
\ 'col': l:match[2] + 0,
\ 'type': l:match[3] is# 'error' ? 'E' : 'W',
\ 'text': l:match[4],
\}
let l:code_match = matchlist(l:obj.text, '\v^(.+) "(.+)"$')
if !empty(l:code_match)
let l:obj.code = l:code_match[1]
let l:obj.text = l:code_match[2]
endif
call add(l:output, l:obj)
endfor
return l:output
endfunction

View File

@ -0,0 +1,44 @@
call ale#Set('javascript_xo_executable', 'xo')
call ale#Set('javascript_xo_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('javascript_xo_options', '')
call ale#Set('typescript_xo_executable', 'xo')
call ale#Set('typescript_xo_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('typescript_xo_options', '')
function! ale#handlers#xo#GetExecutable(buffer) abort
let l:type = ale#handlers#xo#GetType(a:buffer)
return ale#node#FindExecutable(a:buffer, l:type . '_xo', [
\ 'node_modules/xo/cli.js',
\ 'node_modules/.bin/xo',
\])
endfunction
function! ale#handlers#xo#GetLintCommand(buffer) abort
return ale#Escape(ale#handlers#xo#GetExecutable(a:buffer))
\ . ale#Pad(ale#handlers#xo#GetOptions(a:buffer))
\ . ' --reporter json --stdin --stdin-filename %s'
endfunction
function! ale#handlers#xo#GetOptions(buffer) abort
let l:type = ale#handlers#xo#GetType(a:buffer)
return ale#Var(a:buffer, l:type . '_xo_options')
endfunction
" xo uses eslint and the output format is the same
function! ale#handlers#xo#HandleJSON(buffer, lines) abort
return ale#handlers#eslint#HandleJSON(a:buffer, a:lines)
endfunction
function! ale#handlers#xo#GetType(buffer) abort
let l:filetype = getbufvar(a:buffer, '&filetype')
let l:type = 'javascript'
if l:filetype =~# 'typescript'
let l:type = 'typescript'
endif
return l:type
endfunction

View File

@ -0,0 +1,39 @@
function! ale#handlers#yamllint#GetCommand(buffer) abort
return '%e' . ale#Pad(ale#Var(a:buffer, 'yaml_yamllint_options'))
\ . ' -f parsable %t'
endfunction
function! ale#handlers#yamllint#Handle(buffer, lines) abort
" Matches patterns line the following:
" something.yaml:1:1: [warning] missing document start "---" (document-start)
" something.yml:2:1: [error] syntax error: expected the node content, but found '<stream end>'
let l:pattern = '\v^.*:(\d+):(\d+): \[(error|warning)\] (.+)$'
let l:output = []
for l:match in ale#util#GetMatches(a:lines, l:pattern)
let l:item = {
\ 'lnum': l:match[1] + 0,
\ 'col': l:match[2] + 0,
\ 'text': l:match[4],
\ 'type': l:match[3] is# 'error' ? 'E' : 'W',
\}
let l:code_match = matchlist(l:item.text, '\v^(.+) \(([^)]+)\)$')
if !empty(l:code_match)
if l:code_match[2] is# 'trailing-spaces'
\&& !ale#Var(a:buffer, 'warn_about_trailing_whitespace')
" Skip warnings for trailing whitespace if the option is off.
continue
endif
let l:item.text = l:code_match[1]
let l:item.code = l:code_match[2]
endif
call add(l:output, l:item)
endfor
return l:output
endfunction

View File

@ -24,6 +24,8 @@ function! ale#hover#HandleTSServerResponse(conn_id, response) abort
if get(a:response, 'success', v:false) is v:true
\&& get(a:response, 'body', v:null) isnot v:null
let l:set_balloons = ale#Var(l:options.buffer, 'set_balloons')
" If we pass the show_documentation flag, we should show the full
" documentation, and always in the preview window.
if get(l:options, 'show_documentation', 0)
@ -40,10 +42,14 @@ function! ale#hover#HandleTSServerResponse(conn_id, response) abort
endif
elseif get(l:options, 'hover_from_balloonexpr', 0)
\&& exists('*balloon_show')
\&& ale#Var(l:options.buffer, 'set_balloons')
\&& (l:set_balloons is 1 || l:set_balloons is# 'hover')
call balloon_show(a:response.body.displayString)
elseif get(l:options, 'truncated_echo', 0)
call ale#cursor#TruncatedEcho(split(a:response.body.displayString, "\n")[0])
elseif g:ale_hover_to_floating_preview || g:ale_floating_preview
call ale#floating_preview#Show(split(a:response.body.displayString, "\n"), {
\ 'filetype': 'ale-preview.message',
\})
elseif g:ale_hover_to_preview
call ale#preview#Show(split(a:response.body.displayString, "\n"), {
\ 'filetype': 'ale-preview.message',
@ -216,12 +222,19 @@ function! ale#hover#HandleLSPResponse(conn_id, response) abort
let [l:commands, l:lines] = ale#hover#ParseLSPResult(l:result.contents)
if !empty(l:lines)
let l:set_balloons = ale#Var(l:options.buffer, 'set_balloons')
if get(l:options, 'hover_from_balloonexpr', 0)
\&& exists('*balloon_show')
\&& ale#Var(l:options.buffer, 'set_balloons')
\&& (l:set_balloons is 1 || l:set_balloons is# 'hover')
call balloon_show(join(l:lines, "\n"))
elseif get(l:options, 'truncated_echo', 0)
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',
\ 'commands': l:commands,
\})
elseif g:ale_hover_to_preview
call ale#preview#Show(l:lines, {
\ 'filetype': 'ale-preview.message',

View File

@ -38,11 +38,13 @@ let s:default_ale_linter_aliases = {
"
" NOTE: Update the g:ale_linters documentation when modifying this.
let s:default_ale_linters = {
\ 'apkbuild': ['apkbuild_lint', 'secfixes_check'],
\ 'csh': ['shell'],
\ 'elixir': ['credo', 'dialyxir', 'dogma'],
\ 'go': ['gofmt', 'golint', 'go vet'],
\ 'hack': ['hack'],
\ 'help': [],
\ 'inko': ['inko'],
\ 'perl': ['perlcritic'],
\ 'perl6': [],
\ 'python': ['flake8', 'mypy', 'pylint', 'pyright'],

View File

@ -44,6 +44,7 @@ function! ale#lsp#Register(executable_or_address, project, init_options) abort
\ 'definition': 0,
\ 'typeDefinition': 0,
\ 'symbol_search': 0,
\ 'code_actions': 0,
\ },
\}
endif
@ -219,6 +220,14 @@ function! s:UpdateCapabilities(conn, capabilities) abort
let a:conn.capabilities.rename = 1
endif
if get(a:capabilities, 'codeActionProvider') is v:true
let a:conn.capabilities.code_actions = 1
endif
if type(get(a:capabilities, 'codeActionProvider')) is v:t_dict
let a:conn.capabilities.code_actions = 1
endif
if !empty(get(a:capabilities, 'completionProvider'))
let a:conn.capabilities.completion = 1
endif
@ -350,6 +359,7 @@ function! ale#lsp#MarkConnectionAsTsserver(conn_id) abort
let l:conn.capabilities.definition = 1
let l:conn.capabilities.symbol_search = 1
let l:conn.capabilities.rename = 1
let l:conn.capabilities.code_actions = 1
endfunction
function! s:SendInitMessage(conn) abort

View File

@ -172,3 +172,25 @@ function! ale#lsp#message#Rename(buffer, line, column, new_name) abort
\ 'newName': a:new_name,
\}]
endfunction
function! ale#lsp#message#CodeAction(buffer, line, column, end_line, end_column, diagnostics) abort
return [0, 'textDocument/codeAction', {
\ 'textDocument': {
\ 'uri': ale#path#ToURI(expand('#' . a:buffer . ':p')),
\ },
\ 'range': {
\ 'start': {'line': a:line - 1, 'character': a:column - 1},
\ 'end': {'line': a:end_line - 1, 'character': a:end_column},
\ },
\ 'context': {
\ 'diagnostics': a:diagnostics
\ },
\}]
endfunction
function! ale#lsp#message#ExecuteCommand(command, arguments) abort
return [0, 'workspace/executeCommand', {
\ 'command': a:command,
\ 'arguments': a:arguments,
\}]
endfunction

View File

@ -56,6 +56,7 @@ function! ale#lsp#response#ReadDiagnostics(response) abort
endif
if has_key(l:diagnostic, 'relatedInformation')
\ && l:diagnostic.relatedInformation isnot v:null
let l:related = deepcopy(l:diagnostic.relatedInformation)
call map(l:related, {key, val ->
\ ale#path#FromURI(val.location.uri) .

View File

@ -103,3 +103,39 @@ function! ale#lsp#tsserver_message#OrganizeImports(buffer) abort
\ },
\}]
endfunction
function! ale#lsp#tsserver_message#GetCodeFixes(buffer, line, column, end_line, end_column, error_codes) abort
" The lines and columns are 1-based.
" The errors codes must be a list of tsserver error codes to fix.
return [0, 'ts@getCodeFixes', {
\ 'startLine': a:line,
\ 'startOffset': a:column,
\ 'endLine': a:end_line,
\ 'endOffset': a:end_column + 1,
\ 'file': expand('#' . a:buffer . ':p'),
\ 'errorCodes': a:error_codes,
\}]
endfunction
function! ale#lsp#tsserver_message#GetApplicableRefactors(buffer, line, column, end_line, end_column) abort
" The arguments for this request can also be just 'line' and 'offset'
return [0, 'ts@getApplicableRefactors', {
\ 'startLine': a:line,
\ 'startOffset': a:column,
\ 'endLine': a:end_line,
\ 'endOffset': a:end_column + 1,
\ 'file': expand('#' . a:buffer . ':p'),
\}]
endfunction
function! ale#lsp#tsserver_message#GetEditsForRefactor(buffer, line, column, end_line, end_column, refactor, action) abort
return [0, 'ts@getEditsForRefactor', {
\ 'startLine': a:line,
\ 'startOffset': a:column,
\ 'endLine': a:end_line,
\ 'endOffset': a:end_column + 1,
\ 'file': expand('#' . a:buffer . ':p'),
\ 'refactor': a:refactor,
\ 'action': a:action,
\}]
endfunction

View File

@ -85,12 +85,18 @@ function! s:HandleTSServerDiagnostics(response, error_type) abort
endif
let l:info.syntax_loclist = l:thislist
else
elseif a:error_type is# 'semantic'
if len(l:thislist) is 0 && len(get(l:info, 'semantic_loclist', [])) is 0
let l:no_changes = 1
endif
let l:info.semantic_loclist = l:thislist
else
if len(l:thislist) is 0 && len(get(l:info, 'suggestion_loclist', [])) is 0
let l:no_changes = 1
endif
let l:info.suggestion_loclist = l:thislist
endif
if l:no_changes
@ -98,6 +104,7 @@ function! s:HandleTSServerDiagnostics(response, error_type) abort
endif
let l:loclist = get(l:info, 'semantic_loclist', [])
\ + get(l:info, 'suggestion_loclist', [])
\ + get(l:info, 'syntax_loclist', [])
call ale#engine#HandleLoclist(l:linter_name, l:buffer, l:loclist, 0)
@ -150,6 +157,10 @@ function! ale#lsp_linter#HandleLSPResponse(conn_id, response) abort
elseif get(a:response, 'type', '') is# 'event'
\&& get(a:response, 'event', '') is# 'syntaxDiag'
call s:HandleTSServerDiagnostics(a:response, 'syntax')
elseif get(a:response, 'type', '') is# 'event'
\&& get(a:response, 'event', '') is# 'suggestionDiag'
\&& get(g:, 'ale_lsp_suggestions', '1') == 1
call s:HandleTSServerDiagnostics(a:response, 'suggestion')
endif
endfunction

View File

@ -25,7 +25,7 @@ function! ale#maven#FindExecutable(buffer) abort
let l:wrapper_cmd = has('unix') ? 'mvnw' : 'mvnw.cmd'
let l:wrapper_path = ale#path#FindNearestFile(a:buffer, l:wrapper_cmd)
if executable(l:wrapper_path)
if !empty(l:wrapper_path) && executable(l:wrapper_path)
return l:wrapper_path
endif

View File

@ -32,6 +32,8 @@ function! ale#python#FindProjectRootIni(buffer) abort
\|| filereadable(l:path . '/.pylintrc')
\|| filereadable(l:path . '/Pipfile')
\|| filereadable(l:path . '/Pipfile.lock')
\|| filereadable(l:path . '/poetry.lock')
\|| filereadable(l:path . '/pyproject.toml')
return l:path
endif
endfor

View File

@ -85,36 +85,10 @@ function! ale#rename#HandleTSServerResponse(conn_id, response) abort
\ },
\ {
\ 'should_save': 1,
\ 'force_save': get(l:options, 'force_save'),
\ },
\)
endfunction
function! s:getChanges(workspace_edit) abort
let l:changes = {}
if has_key(a:workspace_edit, 'changes') && !empty(a:workspace_edit.changes)
return a:workspace_edit.changes
elseif has_key(a:workspace_edit, 'documentChanges')
let l:document_changes = []
if type(a:workspace_edit.documentChanges) is v:t_dict
\ && has_key(a:workspace_edit.documentChanges, 'edits')
call add(l:document_changes, a:workspace_edit.documentChanges)
elseif type(a:workspace_edit.documentChanges) is v:t_list
let l:document_changes = a:workspace_edit.documentChanges
endif
for l:text_document_edit in l:document_changes
let l:filename = l:text_document_edit.textDocument.uri
let l:edits = l:text_document_edit.edits
let l:changes[l:filename] = l:edits
endfor
endif
return l:changes
endfunction
function! ale#rename#HandleLSPResponse(conn_id, response) abort
if has_key(a:response, 'id')
\&& has_key(s:rename_map, a:response.id)
@ -126,7 +100,7 @@ function! ale#rename#HandleLSPResponse(conn_id, response) abort
return
endif
let l:changes_map = s:getChanges(a:response.result)
let l:changes_map = ale#code_action#GetChanges(a:response.result)
if empty(l:changes_map)
call s:message('No changes received from server')
@ -134,34 +108,7 @@ function! ale#rename#HandleLSPResponse(conn_id, response) abort
return
endif
let l:changes = []
for l:file_name in keys(l:changes_map)
let l:text_edits = l:changes_map[l:file_name]
let l:text_changes = []
for l:edit in l:text_edits
let l:range = l:edit.range
let l:new_text = l:edit.newText
call add(l:text_changes, {
\ 'start': {
\ 'line': l:range.start.line + 1,
\ 'offset': l:range.start.character + 1,
\ },
\ 'end': {
\ 'line': l:range.end.line + 1,
\ 'offset': l:range.end.character + 1,
\ },
\ 'newText': l:new_text,
\})
endfor
call add(l:changes, {
\ 'fileName': ale#path#FromURI(l:file_name),
\ 'textChanges': l:text_changes,
\})
endfor
let l:changes = ale#code_action#BuildChangesList(l:changes_map)
call ale#code_action#HandleCodeAction(
\ {
@ -170,7 +117,6 @@ function! ale#rename#HandleLSPResponse(conn_id, response) abort
\ },
\ {
\ 'should_save': 1,
\ 'force_save': get(l:options, 'force_save'),
\ },
\)
endif
@ -229,7 +175,7 @@ function! s:ExecuteRename(linter, options) abort
call ale#lsp_linter#StartLSP(l:buffer, a:linter, l:Callback)
endfunction
function! ale#rename#Execute(options) abort
function! ale#rename#Execute() abort
let l:lsp_linters = []
for l:linter in ale#linter#Get(&filetype)
@ -257,7 +203,6 @@ function! ale#rename#Execute(options) abort
call s:ExecuteRename(l:lsp_linter, {
\ 'old_name': l:old_name,
\ 'new_name': l:new_name,
\ 'force_save': get(a:options, 'force_save') is 1,
\})
endfor
endfunction

View File

@ -32,5 +32,35 @@ g:ale_ada_gnatpp_options *g:ale_ada_gnatpp_options*
This variable can be set to pass extra options to the gnatpp fixer.
===============================================================================
ada-language-server *ale-ada-language-server*
g:ale_ada_adals_executable *g:ale_ada_adals_executable*
*b:ale_ada_adals_executable*
Type: |String|
Default: `'ada_language_server'`
This variable can be changed to use a different executable for Ada Language
Server.
g:ale_ada_adals_project *g:ale_ada_adals_project*
*b:ale_ada_adals_project*
Type: |String|
Default: `'default.gpr'`
This variable can be changed to use a different GPR file for
Ada Language Server.
g:ale_ada_adals_encoding *g:ale_ada_adals_encoding*
*b:ale_ada_adals_encoding*
Type: |String|
Default: `'utf-8'`
This variable can be changed to use a different file encoding for
Ada Language Server.
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

30
doc/ale-apkbuild.txt Normal file
View File

@ -0,0 +1,30 @@
===============================================================================
ALE APKBUILD Integration *ale-apkbuild-options*
===============================================================================
apkbuild-lint *ale-apkbuild-apkbuild-lint*
g:ale_apkbuild_apkbuild_lint_executable
*g:ale_apkbuild_apkbuild_lint_executable*
*b:ale_apkbuild_apkbuild_lint_executable*
Type: |String|
Default: `'apkbuild-lint'`
This variable can be set to change the path to apkbuild-lint
===============================================================================
secfixes-check *ale-apkbuild-secfixes-check*
g:ale_apkbuild_secfixes_check_executable
*g:ale_apkbuild_secfixes_check_executable*
*b:ale_apkbuild_secfixes_check_executable*
Type: |String|
Default: `'secfixes-check'`
This variable can be set to change the path to secfixes-check
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

16
doc/ale-dafny.txt Normal file
View File

@ -0,0 +1,16 @@
===============================================================================
ALE Dafny Integration *ale-dafny-options*
===============================================================================
dafny *ale-dafny-dafny*
g:ale_dafny_dafny_timelimit *g:ale_dafny_dafny_timelimit*
*b:ale_dafny_dafny_timelimit*
Type: |Number|
Default: `10`
This variable sets the `/timeLimit` used for dafny.
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View File

@ -2,6 +2,31 @@
ALE Dart Integration *ale-dart-options*
===============================================================================
analysis_server *ale-dart-analysis_server*
Installation
-------------------------------------------------------------------------------
Install Dart via whatever means. `analysis_server` will be included in the SDK.
In case that `dart` is not in your path, try to set the executable option to
its absolute path. : >
" Set the executable path for dart to the absolute path to it.
let g:ale_dart_analysis_server_executable = '/usr/local/bin/dart'
<
Options
-------------------------------------------------------------------------------
g:ale_dart_analysis_server_executable *g:ale_dart_analysis_server_executable*
*b:ale_dart_analysis_server_executable*
Type: |String|
Default: `'dart'`
This variable can be set to change the path of dart.
===============================================================================
dartanalyzer *ale-dart-dartanalyzer*

52
doc/ale-dhall.txt Normal file
View File

@ -0,0 +1,52 @@
===============================================================================
ALE Dhall Integration *ale-dhall-options*
g:ale_dhall_executable *g:ale_dhall_executable*
*b:ale_dhall_executable*
Type: |String|
Default: `'dhall'`
g:ale_dhall_options g:ale_dhall_options
b:ale_dhall_options
Type: |String|
Default: `''`
This variable can be set to pass additional options to the 'dhall` executable.
This is shared with `dhall-freeze` and `dhall-lint`.
>
let g:dhall_options = '--ascii'
<
===============================================================================
dhall-format *ale-dhall-format*
Dhall
(https://dhall-lang.org/)
===============================================================================
dhall-freeze *ale-dhall-freeze*
Dhall
(https://dhall-lang.org/)
g:ale_dhall_freeze_options g:ale_dhall_freeze_options
b:ale_dhall_freeze_options
Type: |String|
Default: `''`
This variable can be set to pass additional options to the 'dhall freeze`
executable.
>
let g:dhall_freeze_options = '--all'
<
===============================================================================
dhall-lint *ale-dhall-lint*
Dhall
(https://dhall-lang.org/)
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View File

@ -85,5 +85,12 @@ g:ale_elixir_credo_strict *g:ale_elixir_credo_strict*
Tells credo to run in strict mode or suggest mode. Set variable to 1 to
enable --strict mode.
g:ale_elixir_credo_config_file g:ale_elixir_credo_config_file
Type: String
Default: ''
Tells credo to use a custom configuration file.
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View File

@ -39,6 +39,18 @@ g:ale_erlang_dialyzer_rebar3_profile *g:ale_erlang_dialyzer_rebar3_profile*
This variable can be changed to specify the profile that is used to
run dialyzer with rebar3.
-------------------------------------------------------------------------------
elvis *ale-erlang-elvis*
g:ale_erlang_elvis_executable *g:ale_erlang_elvis_executable*
*b:ale_erlang_elvis_executable*
Type: |String|
Default: `'elvis'`
This variable can be changed to specify the elvis executable.
-------------------------------------------------------------------------------
erlc *ale-erlang-erlc*

View File

@ -172,5 +172,25 @@ g:ale_haskell_hie_executable *g:ale_haskell_hie_executable*
ide engine. i.e. `'hie-wrapper'`
===============================================================================
ormolu *ale-haskell-ormolu*
g:ale_haskell_ormolu_executable *g:ale_haskell_ormolu_executable*
*b:ale_haskell_ormolu_executable*
Type: |String|
Default: `'ormolu'`
This variable can be changed to use a different executable for ormolu.
g:ale_haskell_ormolu_options *g:ale_haskell_ormolu_options*
*b:ale_haskell_ormolu_options*
Type: String
Default: ''
This variable can be used to pass extra options to the underlying ormolu
executable.
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

22
doc/ale-inko.txt Normal file
View File

@ -0,0 +1,22 @@
===============================================================================
ALE Inko Integration *ale-inko-options*
*ale-integration-inko*
===============================================================================
Integration Information
Currently, the only supported linter for Inko is the Inko compiler itself.
===============================================================================
inko *ale-inko-inko*
g:ale_inko_inko_executable *g:ale_inko_inko_executable*
*b:ale_inko_inko_executable*
Type: |String|
Default: `'inko'`
This variable can be modified to change the executable path for `inko`.
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View File

@ -101,5 +101,37 @@ prettier *ale-json-prettier*
See |ale-javascript-prettier| for information about the available options.
===============================================================================
spectral *ale-json-spectral*
Website: https://github.com/stoplightio/spectral
Installation
-------------------------------------------------------------------------------
Install spectral either globally or locally: >
npm install @stoplight/spectral -g # global
npm install @stoplight/spectral # local
<
Options
-------------------------------------------------------------------------------
g:ale_json_spectral_executable *g:ale_json_spectral_executable*
*b:ale_json_spectral_executable*
Type: |String|
Default: `'spectral'`
This variable can be set to change the path to spectral.
g:ale_json_spectral_use_global *g:ale_json_spectral_use_global*
*b:ale_json_spectral_use_global*
Type: |String|
Default: `get(g:, 'ale_use_global_executables', 0)`
See |ale-integrations-local-executables|
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View File

@ -30,5 +30,21 @@ g:ale_lua_luacheck_options *g:ale_lua_luacheck_options*
This variable can be set to pass additional options to luacheck.
===============================================================================
luafmt *ale-lua-luafmt*
g:ale_lua_luafmt_executable *g:ale_lua_luafmt_executable*
*b:ale_lua_luafmt_executable*
Type: |String|
Default: `'luafmt'`
This variable can be set to use a different executable for luafmt.
g:ale_lua_luafmt_options *g:ale_lua_luafmt_options*
*b:ale_lua_luafmt_options*
Type: |String|
Default: `''`
This variable can be set to pass additional options to the luafmt fixer.
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

74
doc/ale-openapi.txt Normal file
View File

@ -0,0 +1,74 @@
===============================================================================
ALE OpenApi Integration *ale-openapi-options*
===============================================================================
ibm_validator *ale-openapi-ibm-validator*
Website: https://github.com/IBM/openapi-validator
Installation
-------------------------------------------------------------------------------
Install ibm-openapi-validator either globally or locally: >
npm install ibm-openapi-validator -g # global
npm install ibm-openapi-validator # local
<
Configuration
-------------------------------------------------------------------------------
OpenAPI files can be written in YAML or JSON so in order for ALE plugins to
work with these files we must set the buffer |filetype| to either |openapi.yaml|
or |openapi.json| respectively. This causes ALE to lint the file with linters
configured for openapi and yaml files or openapi and json files respectively.
For example setting filetype to |openapi.yaml| on a buffer and the following
|g:ale_linters| configuration will enable linting of openapi files using both
|ibm_validator| and |yamlint|:
>
let g:ale_linters = {
\ 'yaml': ['yamllint'],
\ 'openapi': ['ibm_validator']
\}
<
The following plugin will detect openapi files automatically and set the
filetype to |openapi.yaml| or |openapi.json|:
https://github.com/hsanson/vim-openapi
Options
-------------------------------------------------------------------------------
g:ale_openapi_ibm_validator_executable *g:ale_openapi_ibm_validator_executable*
*b:ale_openapi_ibm_validator_executable*
Type: |String|
Default: `'lint-openapi'`
This variable can be set to change the path to lint-openapi.
g:ale_openapi_ibm_validator_options *g:ale_openapi_ibm_validator_options*
*b:ale_openapi_ibm_validator_options*
Type: |String|
Default: `''`
This variable can be set to pass additional options to lint-openapi.
===============================================================================
prettier *ale-openapi-prettier*
See |ale-javascript-prettier| for information about the available options.
===============================================================================
yamllint *ale-openapi-yamllint*
See |ale-yaml-yamllint| for information about the available options.
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View File

@ -85,6 +85,14 @@ g:ale_php_phpcbf_use_global *g:ale_php_phpcbf_use_global*
See |ale-integrations-local-executables|
g:ale_php_phpcbf_options *g:ale_php_phpcbf_options*
*b:ale_php_phpcbf_options*
Type: |String|
Default: `''`
This variable can be set to pass additional options to php-cbf
===============================================================================
phpcs *ale-php-phpcs*
@ -243,5 +251,70 @@ g:ale_php_php_executable *g:ale_php_php_executable*
This variable sets the executable used for php.
===============================================================================
tlint *ale-php-tlint*
g:ale_php_tlint_executable *g:ale_php_tlint_executable*
*b:ale_php_tlint_executable*
Type: |String|
Default: `'tlint'`
See |ale-integrations-local-executables|
g:ale_php_tlint_use_global *g:ale_php_tlint_use_global*
*b:ale_php_tlint_use_global*
Type: |Number|
Default: `get(g:, 'ale_use_global_executables', 0)`
See |ale-integrations-local-executables|
g:ale_php_tlint_options *g:ale_php_tlint_options*
*b:ale_php_tlint_options*
Type: |String|
Default: `''`
This variable can be set to pass additional options to tlint
===============================================================================
intelephense *ale-php-intelephense*
g:ale_php_intelephense_executable *g:ale_php_intelephense_executable*
*b:ale_php_intelephense_executable*
Type: |String|
Default: `'intelephense'`
The variable can be set to configure the executable that will be used for
running the intelephense language server. `node_modules` directory
executable will be preferred instead of this setting if
|g:ale_php_intelephense_use_global| is `0`.
See: |ale-integrations-local-executables|
g:ale_php_intelephense_use_global *g:ale_php_intelephense_use_global*
*b:ale_php_intelephense_use_global*
Type: |Number|
Default: `get(g:, 'ale_use_global_executables', 0)`
This variable can be set to `1` to force the language server to be run with
the executable set for |g:ale_php_intelephense_executable|.
See: |ale-integrations-local-executables|
g:ale_php_intelephense_config *g:ale_php_intelephense_config*
*b:ale_php_intelephense_config*
Type: |Dictionary|
Default: `{}`
The initialization options config specified by Intelephense. Refer to the
installation docs provided by intelephense (github.com/bmewburn/intelephense
-docs).
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View File

@ -36,11 +36,39 @@ ALE will look for configuration files with the following filenames. >
.pylintrc
Pipfile
Pipfile.lock
poetry.lock
pyproject.toml
<
The first directory containing any of the files named above will be used.
===============================================================================
autoimport *ale-python-autoimport*
g:ale_python_autoimport_executable *g:ale_python_autoimport_executable*
*b:ale_python_autoimport_executable*
Type: |String|
Default: `'autoimport'`
See |ale-integrations-local-executables|
g:ale_python_autoimport_options *g:ale_python_autoimport_options*
*b:ale_python_autoimport_options*
Type: |String|
Default: `''`
This variable can be set to pass extra options to autoimport.
g:ale_python_autoimport_use_global *g:ale_python_autoimport_use_global*
*b:ale_python_autoimport_use_global*
Type: |Number|
Default: `get(g:, 'ale_use_global_executables', 0)`
See |ale-integrations-local-executables|
===============================================================================
autopep8 *ale-python-autopep8*
@ -254,6 +282,15 @@ g:ale_python_isort_use_global *g:ale_python_isort_use_global*
See |ale-integrations-local-executables|
g:ale_python_isort_auto_pipenv *g:ale_python_isort_auto_pipenv*
*b:ale_python_isort_auto_pipenv*
Type: |Number|
Default: `0`
Detect whether the file is inside a pipenv, and set the executable to `pipenv`
if true. This is overridden by a manually-set executable.
===============================================================================
mypy *ale-python-mypy*
@ -687,7 +724,7 @@ g:ale_python_pyre_auto_pipenv *g:ale_python_pyre_auto_pipenv*
===============================================================================
pyright *ale-python-pyright*
The `pyrlight` linter requires a recent version of `pyright` which includes
The `pyright` linter requires a recent version of `pyright` which includes
the `pyright-langserver` executable. You can install `pyright` on your system
through `npm` with `sudo npm install -g pyright` or similar.

View File

@ -2,6 +2,29 @@
ALE R Integration *ale-r-options*
===============================================================================
languageserver *ale-r-languageserver*
g:ale_r_languageserver_cmd *g:ale_r_languageserver_cmd*
*b:ale_r_languageserver_cmd*
Type: |String|
Default: `'languageserver::run()'`
This option can be configured to change the execution command for
languageserver.
See the languageserver documentation for more options.
g:ale_r_languageserver_config *g:ale_r_languageserver_config*
*b:ale_r_languageserver_config*
Type: |Dictionary|
Default: `{}`
This option can be configured to change settings for languageserver. See the
languageserver documentation for more information.
===============================================================================
lintr *ale-r-lintr*
@ -22,7 +45,7 @@ g:ale_r_lintr_lint_package *g:ale_r_lintr_lint_package*
Default: `0`
When set to `1`, the file will be checked with `lintr::lint_package` instead
of `lintr::lint`. This prevents erroneous namespace warnings when linting
of `lintr::lint`. This prevents erroneous namespace warnings when linting
package files.
@ -36,8 +59,8 @@ g:ale_r_styler_options *g:ale_r_styler_options*
This option can be configured to change the options for styler.
The value of this option will be used as the `style` argument for the
`styler::style_file` options. Consult the styler documentation
The value of this option will be used as the `style` argument for the
`styler::style_file` options. Consult the styler documentation
for more information.

View File

@ -177,6 +177,16 @@ g:ale_ruby_sorbet_options *g:ale_ruby_sorbet_options*
This variable can be changed to modify flags given to sorbet.
g:ale_ruby_sorbet_enable_watchman *g:ale_ruby_sorbet_enable_watchman*
*b:ale_ruby_sorbet_enable_watchman*
Type: |Number|
Default: `0`
Whether or not to use watchman to let the LSP server to know about changes
to files from outside of vim. Defaults to disable watchman because it
requires watchman to be installed separately from sorbet.
===============================================================================
standardrb *ale-ruby-standardrb*

View File

@ -22,12 +22,12 @@ Integration Information
3. rls -- If you have `rls` installed, you might prefer using this linter
over cargo. rls implements the Language Server Protocol for incremental
compilation of Rust code, and can check Rust files while you type. `rls`
requires Rust files to contained in Cargo projects.
requires Rust files to be contained in Cargo projects.
4. analyzer -- If you have rust-analyzer installed, you might prefer using
this linter over cargo and rls. rust-analyzer also implements the
Language Server Protocol for incremental compilation of Rust code, and is
the next iteration of rls. rust-analyzer, like rls, requires Rust files
to contained in Cargo projects.
to be contained in Cargo projects.
5. rustfmt -- If you have `rustfmt` installed, you can use it as a fixer to
consistently reformat your Rust code.

43
doc/ale-salt.tmt Normal file
View File

@ -0,0 +1,43 @@
===============================================================================
ALE SALT Integration *ale-salt-options*
===============================================================================
salt-lint *ale-salt-salt-lint*
Website: https://github.com/warpnet/salt-lint
Installation
-------------------------------------------------------------------------------
Install salt-lint in your a virtualenv directory, locally, or globally: >
pip install salt-lint # After activating virtualenv
pip install --user salt-lint # Install to ~/.local/bin
sudo pip install salt-lint # Install globally
See |g:ale_virtualenv_dir_names| for configuring how ALE searches for
virtualenv directories.
Options
-------------------------------------------------------------------------------
g:ale_salt_salt-lint_executable *g:ale_salt_salt_lint_executable*
*b:ale_salt_salt_lint_executable*
Type: |String|
Default: `'salt-lint'`
This variable can be set to change the path to salt-lint.
g:ale_salt_salt-lint_options *g:ale_salt_salt-lint_options*
*b:ale_salt_salt-lint_options*
Type: |String|
Default: `''`
This variable can be set to pass additional options to salt-lint.
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View File

@ -13,12 +13,16 @@ Notes:
`!!` These linters check only files on disk. See |ale-lint-file-linters|
* Ada
* `ada_language_server`
* `gcc`
* `gnatpp`
* Ansible
* `ansible-lint`
* API Blueprint
* `drafter`
* APKBUILD
* `apkbuild-lint`
* `secfixes-check`
* AsciiDoc
* `alex`!!
* `languagetool`!!
@ -49,8 +53,8 @@ Notes:
* `astyle`
* `ccls`
* `clang` (`cc`)
* `clangd`
* `clang-format`
* `clangd`
* `clangtidy`!!
* `cppcheck`
* `cpplint`!!
@ -67,9 +71,9 @@ Notes:
* `astyle`
* `ccls`
* `clang` (`cc`)
* `clang-format`
* `clangcheck`!!
* `clangd`
* `clang-format`
* `clangtidy`!!
* `clazy`!!
* `cppcheck`
@ -116,11 +120,14 @@ Notes:
* Dafny
* `dafny`!!
* Dart
* `analysis_server`
* `dartanalyzer`!!
* `dartfmt`!!
* `language_server`
* Dhall
* `dhall-format`
* `dhall-freeze`
* `dhall-lint`
* Dockerfile
* `dockerfile_lint`
* `hadolint`
@ -140,8 +147,9 @@ Notes:
* `erubis`
* `ruumba`
* Erlang
* `erlc`
* `SyntaxErl`
* `elvis`!!
* `erlc`
* Fish
* `fish` (-n flag)
* Fortran
@ -159,17 +167,17 @@ Notes:
* Go
* `bingo`
* `go build`!!
* `go mod`!!
* `go vet`!!
* `gofmt`
* `goimports`
* `golangci-lint`!!
* `golangserver`
* `golint`
* `gometalinter`!!
* `go mod`!!
* `gopls`
* `gosimple`!!
* `gotype`!!
* `go vet`!!
* `revive`!!
* `staticcheck`!!
* GraphQL
@ -195,16 +203,17 @@ Notes:
* `hie`
* `hindent`
* `hlint`
* `ormolu`
* `stack-build`!!
* `stack-ghc`
* `stylish-haskell`
* HCL
* `terraform-fmt`
* HTML
* `HTMLHint`
* `alex`!!
* `fecs`
* `html-beautify`
* `HTMLHint`
* `prettier`
* `proselint`
* `tidy`
@ -213,15 +222,17 @@ Notes:
* `idris`
* Ink
* `ink-language-server`
* Inko
* `inko` !!
* ISPC
* `ispc`!!
* Java
* `PMD`
* `checkstyle`
* `eclipselsp`
* `google-java-format`
* `javac`
* `javalsp`
* `PMD`
* `uncrustify`
* JavaScript
* `eslint`
@ -240,6 +251,7 @@ Notes:
* `jq`
* `jsonlint`
* `prettier`
* `spectral`
* Julia
* `languageserver`
* Kotlin
@ -265,6 +277,7 @@ Notes:
* Lua
* `luac`
* `luacheck`
* `luafmt`
* Mail
* `alex`!!
* `languagetool`!!
@ -297,6 +310,7 @@ Notes:
* nix
* `nix-instantiate`
* `nixpkgs-fmt`
* `rnix-lsp`
* nroff
* `alex`!!
* `proselint`
@ -315,6 +329,10 @@ Notes:
* `ocamlformat`
* `ocp-indent`
* `ols`
* OpenApi
* `ibm_validator`
* `prettier`
* `yamllint`
* Pawn
* `uncrustify`
* Perl
@ -324,15 +342,17 @@ Notes:
* Perl6
* `perl6 -c`
* PHP
* `intelephense`
* `langserver`
* `phan`
* `php -l`
* `php-cs-fixer`
* `phpcbf`
* `phpcs`
* `php-cs-fixer`
* `php -l`
* `phpmd`
* `phpstan`
* `psalm`!!
* `tlint`
* PO
* `alex`!!
* `msgfmt`
@ -361,6 +381,7 @@ Notes:
* `purescript-language-server`
* `purty`
* Python
* `autoimport`
* `autopep8`
* `bandit`
* `black`
@ -383,10 +404,13 @@ Notes:
* `qmlfmt`
* `qmllint`
* R
* `languageserver`
* `lintr`
* `styler`
* Racket
* `raco`
* Re:VIEW
* `redpen`
* ReasonML
* `merlin`
* `ols`
@ -400,8 +424,6 @@ Notes:
* `textlint`
* `vale`
* `write-good`
* Re:VIEW
* `redpen`
* RPM spec
* `rpmlint`
* Ruby
@ -421,6 +443,8 @@ Notes:
* `rust-analyzer`
* `rustc` (see |ale-integration-rust|)
* `rustfmt`
* Salt
* `salt-lint`
* Sass
* `sass-lint`
* `stylelint`
@ -446,10 +470,10 @@ Notes:
* `solium`
* SQL
* `pgformatter`
* `sql-lint`
* `sqlfmt`
* `sqlformat`
* `sqlint`
* `sql-lint`
* Stylus
* `stylelint`
* SugarSS
@ -479,6 +503,7 @@ Notes:
* Thrift
* `thrift`
* TypeScript
* `deno`
* `eslint`
* `fecs`
* `prettier`
@ -488,6 +513,7 @@ Notes:
* `typecheck`
* VALA
* `uncrustify`
* `vala_lint`!!
* Verilog
* `hdl-checker`
* `iverilog`
@ -516,7 +542,9 @@ Notes:
* `xmllint`
* YAML
* `prettier`
* `spectral`
* `swaglint`
* `yamlfix`
* `yamllint`
* YANG
* `yang-lsp`

View File

@ -2,6 +2,39 @@
ALE TypeScript Integration *ale-typescript-options*
===============================================================================
deno *ale-typescript-deno*
Starting from version 1.6.0, Deno comes with its own language server. Earlier
versions are not supported.
g:ale_deno_executable *g:ale_deno_executable*
*b:ale_deno_executable*
Type: |String|
Default: `'deno'`
g:ale_deno_lsp_project_root *g:ale_deno_lsp_project_root*
*b:ale_deno_lsp_project_root*
Type: |String|
Default: `''`
If this variable is left unset, ALE will try to find the project root by
executing the following steps in the given order:
1. Find an ancestor directory containing a tsconfig.json.
2. Find an ancestory irectory containing a .git folder.
3. Use the directory of the current buffer (if the buffer was opened from
a file).
g:ale_deno_unstable *g:ale_deno_unstable*
*b:ale_deno_unstable*
Type: |Number|
Default: `0`
Enable or disable unstable Deno features and APIs.
===============================================================================
eslint *ale-typescript-eslint*
@ -138,5 +171,32 @@ g:ale_typescript_tsserver_use_global *g:ale_typescript_tsserver_use_global*
tsserver in node_modules.
===============================================================================
xo *ale-typescript-xo*
g:ale_typescript_xo_executable *g:ale_typescript_xo_executable*
*b:ale_typescript_xo_executable*
Type: |String|
Default: `'xo'`
See |ale-integrations-local-executables|
g:ale_typescript_xo_options *g:ale_typescript_xo_options*
*b:ale_typescript_xo_options*
Type: |String|
Default: `''`
This variable can be set to pass additional options to xo.
g:ale_typescript_xo_use_global *g:ale_typescript_xo_use_global*
*b:ale_typescript_xo_use_global*
Type: |Number|
Default: `get(g:, 'ale_use_global_executables', 0)`
See |ale-integrations-local-executables|
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View File

@ -8,5 +8,26 @@ uncrustify *ale-vala-uncrustify*
See |ale-c-uncrustify| for information about the available options.
===============================================================================
Vala-Lint *ale-vala-vala-lint*
g:vala_vala_lint_executable *g:vala_vala_lint_executable*
*b:vala_vala_lint_executable*
Type: |String|
Default: `'io.elementary.vala-lint'`
This variable can be set to specify a Vala-Lint executable file.
g:vala_vala_lint_config_filename *g:vala_vala_lint_config_filename*
*b:vala_vala_lint_config_filename*
Type: |String|
Default: `'vala-lint.conf'`
This variable can be set to specify a Vala-Lint config filename. When a file
with the specified name was not found or this variable was set to empty,
Vala-Lint will be executed without specifying a config filename.
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View File

@ -15,7 +15,38 @@ Install prettier either globally or locally: >
npm install prettier -g # global
npm install prettier # local
<
===============================================================================
spectral *ale-yaml-spectral*
Website: https://github.com/stoplightio/spectral
Installation
-------------------------------------------------------------------------------
Install spectral either globally or locally: >
npm install @stoplight/spectral -g # global
npm install @stoplight/spectral # local
<
Options
-------------------------------------------------------------------------------
g:ale_yaml_spectral_executable *g:ale_yaml_spectral_executable*
*b:ale_yaml_spectral_executable*
Type: |String|
Default: `'spectral'`
This variable can be set to change the path to spectral.
g:ale_yaml_spectral_use_global *g:ale_yaml_spectral_use_global*
*b:ale_yaml_spectral_use_global*
Type: |String|
Default: `get(g:, 'ale_use_global_executables', 0)`
See |ale-integrations-local-executables|
===============================================================================
swaglint *ale-yaml-swaglint*
@ -49,6 +80,43 @@ g:ale_yaml_swaglint_use_global *g:ale_yaml_swaglint_use_global*
See |ale-integrations-local-executables|
===============================================================================
yamlfix *ale-yaml-yamlfix*
Website: https://lyz-code.github.io/yamlfix
Installation
-------------------------------------------------------------------------------
Install yamlfix: >
pip install yamlfix
<
Options
-------------------------------------------------------------------------------
g:ale_yaml_yamlfix_executable *g:ale_yaml_yamlfix_executable*
*b:ale_yaml_yamlfix_executable*
Type: |String|
Default: `'yamlfix'`
See |ale-integrations-local-executables|
g:ale_yaml_yamlfix_options *g:ale_yaml_yamlfix_options*
*b:ale_yaml_yamlfix_options*
Type: |String|
Default: `''`
This variable can be set to pass extra options to yamlfix.
g:ale_yaml_yamlfix_use_global *g:ale_yaml_yamlfix_use_global*
*b:ale_yaml_yamlfix_use_global*
Type: |Number|
Default: `get(g:, 'ale_use_global_executables', 0)`
See |ale-integrations-local-executables|
===============================================================================
yamllint *ale-yaml-yamllint*

View File

@ -20,6 +20,7 @@ CONTENTS *ale-contents*
5.4 Find References...................|ale-find-references|
5.5 Hovering..........................|ale-hover|
5.6 Symbol Search.....................|ale-symbol-search|
5.7 Refactoring: Rename, Actions......|ale-refactor|
6. Global Options.......................|ale-options|
6.1 Highlights........................|ale-highlights|
7. Linter/Fixer Options.................|ale-integration-options|
@ -645,6 +646,9 @@ problem will be displayed in a balloon instead of hover information.
Hover information can be displayed in the preview window instead by setting
|g:ale_hover_to_preview| to `1`.
When using Neovim, if |g:ale_hover_to_floating_preview| or |g:ale_floating_preview|
is set to 1, the hover information will show in a floating window.
For Vim 8.1+ terminals, mouse hovering is disabled by default. Enabling
|balloonexpr| commands in terminals can cause scrolling issues in terminals,
so ALE will not attempt to show balloons unless |g:ale_set_balloons| is set to
@ -669,6 +673,34 @@ ALE supports searching for workspace symbols via LSP linters with the
|ALESymbolSearch| command. See the documentation for the command
for a full list of options.
-------------------------------------------------------------------------------
5.7 Refactoring: Rename, Actions *ale-refactor*
ALE supports renaming symbols in code such as variables or class names with
the |ALERename| command.
|ALECodeAction| will execute actions on the cursor or applied to a visual
range selection, such as automatically fixing errors.
Actions will appear in the right click mouse menu by default for GUI versions
of Vim, unless disabled by setting |g:ale_popup_menu_enabled| to `0`.
Make sure to set your Vim to move the cursor position whenever you right
click, and enable the mouse menu: >
set mouse=a
set mousemodel=popup_setpos
<
You may wish to remove some other menu items you don't want to see: >
silent! aunmenu PopUp.Select\ Word
silent! aunmenu PopUp.Select\ Sentence
silent! aunmenu PopUp.Select\ Paragraph
silent! aunmenu PopUp.Select\ Line
silent! aunmenu PopUp.Select\ Block
silent! aunmenu PopUp.Select\ Blockwise
silent! aunmenu PopUp.Select\ All
<
===============================================================================
6. Global Options *ale-options*
@ -925,6 +957,15 @@ g:ale_default_navigation *g:ale_default_navigation*
buffer, such as for |ALEFindReferences|, or |ALEGoToDefinition|.
g:ale_detail_to_floating_preview *g:ale_detail_to_floating_preview*
*b:ale_detail_to_floating_preview*
Type: |Number|
Default: `0`
When this option is set to `1`, Neovim will use a floating window for
ALEDetail output.
g:ale_disable_lsp *g:ale_disable_lsp*
*b:ale_disable_lsp*
@ -1148,6 +1189,16 @@ g:ale_fix_on_save_ignore *g:ale_fix_on_save_ignore*
let g:ale_fix_on_save_ignore = [g:AddBar]
<
g:ale_floating_preview *g:ale_floating_preview*
Type: |Number|
Default: `0`
When set to `1`, Neovim will use a floating window for ale's preview window.
This is equivalent to setting |g:ale_hover_to_floating_preview| and
|g:ale_detail_to_floating_preview| to `1`.
g:ale_history_enabled *g:ale_history_enabled*
Type: |Number|
@ -1206,6 +1257,14 @@ g:ale_hover_to_preview *g:ale_hover_to_preview*
instead of in balloons or the message line.
g:ale_hover_to_floating_preview *g:ale_hover_to_floating_preview*
*b:ale_hover_to_floating_preview*
Type: |Number|
Default: `0`
If set to `1`, Neovim will use floating windows for hover messages.
g:ale_keep_list_window_open *g:ale_keep_list_window_open*
*b:ale_keep_list_window_open*
Type: |Number|
@ -1497,11 +1556,13 @@ g:ale_linters *g:ale_linters*
following values: >
{
\ 'apkbuild': ['apkbuild_lint', 'secfixes_check'],
\ 'csh': ['shell'],
\ 'elixir': ['credo', 'dialyxir', 'dogma'],
\ 'go': ['gofmt', 'golint', 'go vet'],
\ 'hack': ['hack'],
\ 'help': [],
\ 'inko': ['inko'],
\ 'perl': ['perlcritic'],
\ 'perl6': [],
\ 'python': ['flake8', 'mypy', 'pylint', 'pyright'],
@ -1648,6 +1709,15 @@ g:ale_lsp_show_message_severity *g:ale_lsp_show_message_severity*
`'disabled'` - Doesn't display any information at all.
g:ale_lsp_suggestions *g:ale_lsp_suggestions*
Type: |Number|
Default: 1
This variable defines if suggestions must be collected from LSP or tsserver
and shown.
g:ale_lsp_root *g:ale_lsp_root*
*b:ale_lsp_root*
@ -1665,6 +1735,7 @@ g:ale_lsp_root *g:ale_lsp_root*
If neither variable yields a result, a linter-specific function is invoked to
detect a project root. If this, too, yields no result, the linter is disabled.
g:ale_max_buffer_history_size *g:ale_max_buffer_history_size*
Type: |Number|
@ -1773,6 +1844,19 @@ g:ale_pattern_options_enabled *g:ale_pattern_options_enabled*
will not set buffer variables per |g:ale_pattern_options|.
g:ale_popup_menu_enabled *g:ale_popup_menu_enabled*
Type: |Number|
Default: `has('gui_running')`
When this option is set to `1`, ALE will show code actions and rename
capabilities in the right click mouse menu when there's a LSP server or
tsserver available. See |ale-refactor|.
This setting must be set to `1` before ALE is loaded for this behavior
to be enabled. See |ale-lint-settings-on-startup|.
g:ale_rename_tsserver_find_in_comments *g:ale_rename_tsserver_find_in_comments*
Type: |Number|
@ -1797,7 +1881,7 @@ g:ale_rename_tsserver_find_in_strings *g:ale_rename_tsserver_find_in_strings*
g:ale_set_balloons *g:ale_set_balloons*
*b:ale_set_balloons*
Type: |Number|
Type: |Number| or |String|
Default: `has('balloon_eval') && has('gui_running')`
When this option is set to `1`, balloon messages will be displayed for
@ -1808,6 +1892,13 @@ g:ale_set_balloons *g:ale_set_balloons*
supporting "Hover" information, per |ale-hover|, then brief information
about the symbol under the cursor will be displayed in a balloon.
This option can be set to `'hover'` to only enable balloons for hover
message, so diagnostics are never shown in balloons. You may wish to
configure use this setting only in GUI Vim like so: >
let g:ale_set_balloons = has('gui_running') ? 'hover' : 0
<
Balloons can be enabled for terminal versions of Vim that support balloons,
but some versions of Vim will produce strange mouse behavior when balloons
are enabled. To configure balloons for your terminal, you should first
@ -2506,8 +2597,12 @@ documented in additional help files.
ada.....................................|ale-ada-options|
gcc...................................|ale-ada-gcc|
gnatpp................................|ale-ada-gnatpp|
ada-language-server...................|ale-ada-language-server|
ansible.................................|ale-ansible-options|
ansible-lint..........................|ale-ansible-ansible-lint|
apkbuild................................|ale-apkbuild-options|
apkbuild-lint.........................|ale-apkbuild-apkbuild-lint|
secfixes-check........................|ale-apkbuild-secfixes-check|
asciidoc................................|ale-asciidoc-options|
write-good............................|ale-asciidoc-write-good|
textlint..............................|ale-asciidoc-textlint|
@ -2571,9 +2666,16 @@ documented in additional help files.
dfmt..................................|ale-d-dfmt|
dls...................................|ale-d-dls|
uncrustify............................|ale-d-uncrustify|
dafny...................................|ale-dafny-options|
dafny.................................|ale-dafny-dafny|
dart....................................|ale-dart-options|
analysis_server.......................|ale-dart-analysis_server|
dartanalyzer..........................|ale-dart-dartanalyzer|
dartfmt...............................|ale-dart-dartfmt|
dhall...................................|ale-dhall-options|
dhall-format..........................|ale-dhall-format|
dhall-freeze..........................|ale-dhall-freeze|
dhall-lint............................|ale-dhall-lint|
dockerfile..............................|ale-dockerfile-options|
dockerfile_lint.......................|ale-dockerfile-dockerfile_lint|
hadolint..............................|ale-dockerfile-hadolint|
@ -2589,6 +2691,7 @@ documented in additional help files.
elm-make..............................|ale-elm-elm-make|
erlang..................................|ale-erlang-options|
dialyzer..............................|ale-erlang-dialyzer|
elvis.................................|ale-erlang-elvis|
erlc..................................|ale-erlang-erlc|
syntaxerl.............................|ale-erlang-syntaxerl|
eruby...................................|ale-eruby-options|
@ -2642,6 +2745,7 @@ documented in additional help files.
stack-ghc.............................|ale-haskell-stack-ghc|
stylish-haskell.......................|ale-haskell-stylish-haskell|
hie...................................|ale-haskell-hie|
ormolu................................|ale-haskell-ormolu|
hcl.....................................|ale-hcl-options|
terraform-fmt.........................|ale-hcl-terraform-fmt|
html....................................|ale-html-options|
@ -2656,6 +2760,8 @@ documented in additional help files.
idris.................................|ale-idris-idris|
ink.....................................|ale-ink-options|
ink-language-server...................|ale-ink-language-server|
inko....................................|ale-inko-options|
inko..................................|ale-inko-inko|
ispc....................................|ale-ispc-options|
ispc..................................|ale-ispc-ispc|
java....................................|ale-java-options|
@ -2683,6 +2789,7 @@ documented in additional help files.
jsonlint..............................|ale-json-jsonlint|
jq....................................|ale-json-jq|
prettier..............................|ale-json-prettier|
spectral..............................|ale-json-spectral|
julia...................................|ale-julia-options|
languageserver........................|ale-julia-languageserver|
kotlin..................................|ale-kotlin-options|
@ -2701,6 +2808,7 @@ documented in additional help files.
lua.....................................|ale-lua-options|
luac..................................|ale-lua-luac|
luacheck..............................|ale-lua-luacheck|
luafmt................................|ale-lua-luafmt|
markdown................................|ale-markdown-options|
markdownlint..........................|ale-markdown-markdownlint|
mdl...................................|ale-markdown-mdl|
@ -2734,6 +2842,10 @@ documented in additional help files.
ols...................................|ale-ocaml-ols|
ocamlformat...........................|ale-ocaml-ocamlformat|
ocp-indent............................|ale-ocaml-ocp-indent|
openapi.................................|ale-openapi-options|
ibm_validator.........................|ale-openapi-ibm-validator|
prettier..............................|ale-openapi-prettier|
yamllint..............................|ale-openapi-yamllint|
pawn....................................|ale-pawn-options|
uncrustify............................|ale-pawn-uncrustify|
perl....................................|ale-perl-options|
@ -2752,6 +2864,8 @@ documented in additional help files.
psalm.................................|ale-php-psalm|
php-cs-fixer..........................|ale-php-php-cs-fixer|
php...................................|ale-php-php|
tlint.................................|ale-php-tlint|
intelephense..........................|ale-php-intelephense|
po......................................|ale-po-options|
write-good............................|ale-po-write-good|
pod.....................................|ale-pod-options|
@ -2777,6 +2891,7 @@ documented in additional help files.
pyrex (cython)..........................|ale-pyrex-options|
cython................................|ale-pyrex-cython|
python..................................|ale-python-options|
autoimport............................|ale-python-autoimport|
autopep8..............................|ale-python-autopep8|
bandit................................|ale-python-bandit|
black.................................|ale-python-black|
@ -2798,6 +2913,7 @@ documented in additional help files.
qml.....................................|ale-qml-options|
qmlfmt................................|ale-qml-qmlfmt|
r.......................................|ale-r-options|
languageserver........................|ale-r-languageserver|
lintr.................................|ale-r-lintr|
styler................................|ale-r-styler|
reasonml................................|ale-reasonml-options|
@ -2825,6 +2941,8 @@ documented in additional help files.
rls...................................|ale-rust-rls|
rustc.................................|ale-rust-rustc|
rustfmt...............................|ale-rust-rustfmt|
salt....................................|ale-salt-options|
salt-lint.............................|ale-salt-salt-lint|
sass....................................|ale-sass-options|
sasslint..............................|ale-sass-sasslint|
stylelint.............................|ale-sass-stylelint|
@ -2881,11 +2999,13 @@ documented in additional help files.
thrift..................................|ale-thrift-options|
thrift................................|ale-thrift-thrift|
typescript..............................|ale-typescript-options|
deno..................................|ale-typescript-deno|
eslint................................|ale-typescript-eslint|
prettier..............................|ale-typescript-prettier|
standard..............................|ale-typescript-standard|
tslint................................|ale-typescript-tslint|
tsserver..............................|ale-typescript-tsserver|
xo....................................|ale-typescript-xo|
vala....................................|ale-vala-options|
uncrustify............................|ale-vala-uncrustify|
verilog/systemverilog...................|ale-verilog-options|
@ -2899,11 +3019,11 @@ documented in additional help files.
hdl-checker...........................|ale-vhdl-hdl-checker|
vcom..................................|ale-vhdl-vcom|
xvhdl.................................|ale-vhdl-xvhdl|
vim help................................|ale-vim-help-options|
write-good............................|ale-vim-help-write-good|
vim.....................................|ale-vim-options|
vimls.................................|ale-vim-vimls|
vint..................................|ale-vim-vint|
vim help................................|ale-vim-help-options|
write-good............................|ale-vim-help-write-good|
vue.....................................|ale-vue-options|
prettier..............................|ale-vue-prettier|
vls...................................|ale-vue-vls|
@ -2913,7 +3033,9 @@ documented in additional help files.
xmllint...............................|ale-xml-xmllint|
yaml....................................|ale-yaml-options|
prettier..............................|ale-yaml-prettier|
spectral..............................|ale-yaml-spectral|
swaglint..............................|ale-yaml-swaglint|
yamlfix...............................|ale-yaml-yamlfix|
yamllint..............................|ale-yaml-yamllint|
yang....................................|ale-yang-options|
yang-lsp..............................|ale-yang-lsp|
@ -3099,11 +3221,17 @@ ALERename *ALERename*
The symbol where the cursor is resting will be the symbol renamed, and a
prompt will open to request a new name.
ALE will refuse to complete a rename operation if there are files to modify
which have not yet been saved in Vim. If the command is run with a bang
(`:ALERename!`), all warnings will be suppressed, and files that are still
open in Vim and not saved will be ignored and left in a state where symbols
in those files will not be updated.
ALECodeAction *ALECodeAction*
Apply a code action via LSP servers or `tsserver`.
If there is an error present on a line that can be fixed, ALE will
automatically fix a line, unless there are multiple possible code fixes to
apply.
This command can be run in visual mode apply actions, such as applicable
refactors. A menu will be shown to select code action to apply.
ALERepeatSelection *ALERepeatSelection*

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