mirror of
1
0
Fork 0

Updated vim plugins

This commit is contained in:
Amir Salihefendic 2018-12-17 12:28:27 +01:00
parent d2d303593e
commit e99e9e9c3e
137 changed files with 2129 additions and 846 deletions

View File

@ -1,7 +1,8 @@
" Author: Jon Parise <jon@indelible.org>
" Description: elixir-ls integration (https://github.com/JakeBecker/elixir-ls)
" Description: ElixirLS integration (https://github.com/JakeBecker/elixir-ls)
call ale#Set('elixir_elixir_ls_release', 'elixir-ls')
call ale#Set('elixir_elixir_ls_config', {})
function! ale_linters#elixir#elixir_ls#GetExecutable(buffer) abort
let l:dir = ale#path#Simplify(ale#Var(a:buffer, 'elixir_elixir_ls_release'))
@ -15,5 +16,6 @@ call ale#linter#Define('elixir', {
\ 'lsp': 'stdio',
\ 'executable_callback': 'ale_linters#elixir#elixir_ls#GetExecutable',
\ 'command_callback': 'ale_linters#elixir#elixir_ls#GetExecutable',
\ 'project_root_callback': 'ale#handlers#elixir#FindMixProjectRoot',
\ 'project_root_callback': 'ale#handlers#elixir#FindMixUmbrellaRoot',
\ 'lsp_config_callback': ale#VarFunc('elixir_elixir_ls_config'),
\})

View File

@ -1,10 +1,21 @@
" Author: neersighted <bjorn@neersighted.com>
" Description: golint for Go files
call ale#Set('go_golint_executable', 'golint')
call ale#Set('go_golint_options', '')
function! ale_linters#go#golint#GetCommand(buffer) abort
let l:options = ale#Var(a:buffer, 'go_golint_options')
return '%e'
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ' %t'
endfunction
call ale#linter#Define('go', {
\ 'name': 'golint',
\ 'output_stream': 'both',
\ 'executable': 'golint',
\ 'command': 'golint %t',
\ 'executable_callback': ale#VarFunc('go_golint_executable'),
\ 'command_callback': 'ale_linters#go#golint#GetCommand',
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
\})

View File

@ -1,6 +1,12 @@
" Author: Patrick Lewis - https://github.com/patricklewis, thenoseman - https://github.com/thenoseman
" Description: haml-lint for Haml files
call ale#Set('haml_hamllint_executable', 'haml-lint')
function! ale_linters#haml#hamllint#GetExecutable(buffer) abort
return ale#Var(a:buffer, 'haml_hamllint_executable')
endfunction
function! ale_linters#haml#hamllint#GetCommand(buffer) abort
let l:prefix = ''
@ -21,7 +27,7 @@ function! ale_linters#haml#hamllint#GetCommand(buffer) abort
endif
return (!empty(l:prefix) ? l:prefix . ' ' : '')
\ . 'haml-lint'
\ . ale_linters#haml#hamllint#GetExecutable(a:buffer)
\ . (!empty(l:hamllint_config_file_path) ? ' --config ' . ale#Escape(l:hamllint_config_file_path) : '')
\ . ' %t'
endfunction
@ -45,7 +51,7 @@ endfunction
call ale#linter#Define('haml', {
\ 'name': 'hamllint',
\ 'executable': 'haml-lint',
\ 'executable_callback': 'ale_linters#haml#hamllint#GetExecutable',
\ 'command_callback': 'ale_linters#haml#hamllint#GetCommand',
\ 'callback': 'ale_linters#haml#hamllint#Handle'
\})

View File

@ -2,9 +2,11 @@
" Description: checkstyle for Java files
function! ale_linters#java#checkstyle#Handle(buffer, lines) abort
let l:pattern = '\v\[(WARN|ERROR)\] [a-zA-Z]?:?[^:]+:(\d+):(\d+)?:? (.*) \[(.+)\]$'
let l:output = []
" modern checkstyle versions
let l:pattern = '\v\[(WARN|ERROR)\] [a-zA-Z]?:?[^:]+:(\d+):(\d+)?:? (.*) \[(.+)\]$'
for l:match in ale#util#GetMatches(a:lines, l:pattern)
call add(l:output, {
\ 'type': l:match[1] is? 'WARN' ? 'W' : 'E',
@ -15,13 +17,24 @@ function! ale_linters#java#checkstyle#Handle(buffer, lines) abort
\})
endfor
" old checkstyle versions
let l:pattern = '\v(.+):(\d+): ([^:]+): (.+)$'
for l:match in ale#util#GetMatches(a:lines, l:pattern)
call add(l:output, {
\ 'type': l:match[3] is? 'warning' ? 'W' : 'E',
\ 'lnum': l:match[2] + 0,
\ 'text': l:match[4],
\})
endfor
return l:output
endfunction
function! ale_linters#java#checkstyle#GetCommand(buffer) abort
return 'checkstyle '
\ . ale#Var(a:buffer, 'java_checkstyle_options')
\ . ' %t'
\ . ' %s'
endfunction
if !exists('g:ale_java_checkstyle_options')
@ -33,4 +46,5 @@ call ale#linter#Define('java', {
\ 'executable': 'checkstyle',
\ 'command_callback': 'ale_linters#java#checkstyle#GetCommand',
\ 'callback': 'ale_linters#java#checkstyle#Handle',
\ 'lint_file': 1,
\})

View File

@ -2,15 +2,17 @@
" Description: Support for the Java language server https://github.com/georgewfraser/vscode-javac
call ale#Set('java_javalsp_jar', 'javacs.jar')
call ale#Set('java_javalsp_executable', 'java')
function! ale_linters#java#javalsp#Executable(buffer) abort
return 'java'
return ale#Var(a:buffer, 'java_javalsp_executable')
endfunction
function! ale_linters#java#javalsp#Command(buffer) abort
let l:jar = ale#Var(a:buffer, 'java_javalsp_jar')
let l:executable = ale_linters#java#javalsp#Executable(a:buffer)
return ale#Escape('java -cp ' . l:jar . ' -Xverify:none org.javacs.Main')
return ale#Escape(l:executable) . ' -cp ' . l:jar . ' -Xverify:none org.javacs.Main'
endfunction
call ale#linter#Define('java', {

View File

@ -1,6 +1,8 @@
" Author: Spencer Wood <https://github.com/scwood>, Adriaan Zonnenberg <amz@adriaan.xyz>
" Description: This file adds support for checking PHP with php-cli
call ale#Set('php_php_executable', 'php')
function! ale_linters#php#php#Handle(buffer, lines) abort
" Matches patterns like the following:
"
@ -30,8 +32,8 @@ endfunction
call ale#linter#Define('php', {
\ 'name': 'php',
\ 'executable': 'php',
\ 'executable_callback': ale#VarFunc('php_php_executable'),
\ 'output_stream': 'stdout',
\ 'command': 'php -l -d error_reporting=E_ALL -d display_errors=1 -d log_errors=0 --',
\ 'command': '%e -l -d error_reporting=E_ALL -d display_errors=1 -d log_errors=0 --',
\ 'callback': 'ale_linters#php#php#Handle',
\})

View File

@ -6,15 +6,40 @@ let g:ale_php_phpstan_executable = get(g:, 'ale_php_phpstan_executable', 'phpsta
let g:ale_php_phpstan_level = get(g:, 'ale_php_phpstan_level', '4')
let g:ale_php_phpstan_configuration = get(g:, 'ale_php_phpstan_configuration', '')
function! ale_linters#php#phpstan#GetCommand(buffer) abort
function! ale_linters#php#phpstan#GetExecutable(buffer) abort
return ale#Var(a:buffer, 'php_phpstan_executable')
endfunction
function! ale_linters#php#phpstan#VersionCheck(buffer) abort
let l:executable = ale_linters#php#phpstan#GetExecutable(a:buffer)
" If we have previously stored the version number in a cache, then
" don't look it up again.
if ale#semver#HasVersion(l:executable)
" Returning an empty string skips this command.
return ''
endif
let l:executable = ale#Escape(l:executable)
return l:executable . ' --version'
endfunction
function! ale_linters#php#phpstan#GetCommand(buffer, version_output) abort
let l:configuration = ale#Var(a:buffer, 'php_phpstan_configuration')
let l:configuration_option = !empty(l:configuration)
\ ? ' -c ' . l:configuration
\ : ''
let l:executable = ale_linters#php#phpstan#GetExecutable(a:buffer)
let l:version = ale#semver#GetVersion(l:executable, a:version_output)
let l:error_format = ale#semver#GTE(l:version, [0, 10, 3])
\ ? ' --error-format raw'
\ : ' --errorFormat raw'
return '%e analyze -l'
\ . ale#Var(a:buffer, 'php_phpstan_level')
\ . ' --errorFormat raw'
\ . l:error_format
\ . l:configuration_option
\ . ' %s'
endfunction
@ -40,7 +65,10 @@ endfunction
call ale#linter#Define('php', {
\ 'name': 'phpstan',
\ 'executable_callback': ale#VarFunc('php_phpstan_executable'),
\ 'command_callback': 'ale_linters#php#phpstan#GetCommand',
\ 'executable_callback': 'ale_linters#php#phpstan#GetExecutable',
\ 'command_chain': [
\ {'callback': 'ale_linters#php#phpstan#VersionCheck'},
\ {'callback': 'ale_linters#php#phpstan#GetCommand'},
\ ],
\ 'callback': 'ale_linters#php#phpstan#Handle',
\})

View File

@ -110,6 +110,7 @@ function! ale_linters#python#flake8#Handle(buffer, lines) abort
let l:item = {
\ 'lnum': l:match[1] + 0,
\ 'col': l:match[2] + 0,
\ 'vcol': 1,
\ 'text': l:match[4],
\ 'code': l:code,
\ 'type': 'W',

View File

@ -13,36 +13,6 @@ function! ale_linters#ruby#rubocop#GetCommand(buffer) abort
\ . ' --stdin ' . ale#Escape(expand('#' . a:buffer . ':p'))
endfunction
function! ale_linters#ruby#rubocop#Handle(buffer, lines) abort
try
let l:errors = json_decode(a:lines[0])
catch
return []
endtry
if !has_key(l:errors, 'summary')
\|| l:errors['summary']['offense_count'] == 0
\|| empty(l:errors['files'])
return []
endif
let l:output = []
for l:error in l:errors['files'][0]['offenses']
let l:start_col = l:error['location']['column'] + 0
call add(l:output, {
\ 'lnum': l:error['location']['line'] + 0,
\ 'col': l:start_col,
\ 'end_col': l:start_col + l:error['location']['length'] - 1,
\ 'code': l:error['cop_name'],
\ 'text': l:error['message'],
\ 'type': ale_linters#ruby#rubocop#GetType(l:error['severity']),
\})
endfor
return l:output
endfunction
function! ale_linters#ruby#rubocop#GetType(severity) abort
if a:severity is? 'convention'
\|| a:severity is? 'warning'
@ -57,5 +27,5 @@ call ale#linter#Define('ruby', {
\ 'name': 'rubocop',
\ 'executable_callback': ale#VarFunc('ruby_rubocop_executable'),
\ 'command_callback': 'ale_linters#ruby#rubocop#GetCommand',
\ 'callback': 'ale_linters#ruby#rubocop#Handle',
\ 'callback': 'ale#ruby#HandleRubocopOutput',
\})

View File

@ -1,9 +1,28 @@
" Author: KabbAmine - https://github.com/KabbAmine,
" Ben Falconer <ben@falconers.me.uk>
" Author: sQVe - https://github.com/sQVe
call ale#Set('sass_sasslint_executable', 'sass-lint')
call ale#Set('sass_sasslint_options', '')
call ale#Set('sass_sasslint_use_global', get(g:, 'ale_use_global_executables', 0))
function! ale_linters#sass#sasslint#GetExecutable(buffer) abort
return ale#node#FindExecutable(a:buffer, 'sass_sasslint', [
\ 'node_modules/sass-lint/bin/sass-lint.js',
\ 'node_modules/.bin/sass-lint',
\])
endfunction
function! ale_linters#sass#sasslint#GetCommand(buffer) abort
let l:executable = ale_linters#sass#sasslint#GetExecutable(a:buffer)
let l:options = ale#Var(a:buffer, 'sass_sasslint_options')
return ale#node#Executable(a:buffer, l:executable)
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ' -v -q -f compact %t'
endfunction
call ale#linter#Define('sass', {
\ 'name': 'sasslint',
\ 'executable': 'sass-lint',
\ 'command_callback': 'ale#handlers#sasslint#GetCommand',
\ 'executable_callback': 'ale_linters#sass#sasslint#GetExecutable',
\ 'command_callback': 'ale_linters#sass#sasslint#GetCommand',
\ 'callback': 'ale#handlers#css#HandleCSSLintFormat',
\})

View File

@ -1,18 +1,28 @@
" Author: KabbAmine - https://github.com/KabbAmine, Ben Falconer
" <ben@falconers.me.uk>
" Author: sQVe - https://github.com/sQVe
call ale#Set('scss_sasslint_executable', 'sass-lint')
call ale#Set('scss_sasslint_options', '')
call ale#Set('scss_sasslint_use_global', get(g:, 'ale_use_global_executables', 0))
function! ale_linters#scss#sasslint#GetExecutable(buffer) abort
return ale#node#FindExecutable(a:buffer, 'scss_sasslint', [
\ 'node_modules/sass-lint/bin/sass-lint.js',
\ 'node_modules/.bin/sass-lint',
\])
endfunction
function! ale_linters#scss#sasslint#GetCommand(buffer) abort
return ale#path#BufferCdString(a:buffer)
\ . ale#Escape('sass-lint')
\ . ' -v'
\ . ' -q'
\ . ' -f compact'
\ . ' %t'
let l:executable = ale_linters#scss#sasslint#GetExecutable(a:buffer)
let l:options = ale#Var(a:buffer, 'scss_sasslint_options')
return ale#node#Executable(a:buffer, l:executable)
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ' -v -q -f compact %t'
endfunction
call ale#linter#Define('scss', {
\ 'name': 'sasslint',
\ 'executable': 'sass-lint',
\ 'executable_callback': 'ale_linters#scss#sasslint#GetExecutable',
\ 'command_callback': 'ale_linters#scss#sasslint#GetCommand',
\ 'callback': 'ale#handlers#css#HandleCSSLintFormat',
\})

View File

@ -1,6 +1,24 @@
" Author: David Mohundro <david@mohundro.com>
" Author: David Mohundro <david@mohundro.com>, Gordon Fontenot <gordon@fonten.io>
" Description: swiftlint for swift files
call ale#Set('swift_swiftlint_executable', 'swiftlint')
call ale#Set('swift_swiftlint_use_global', get(g:, 'ale_use_global_executables', 0))
function! ale_linters#swift#swiftlint#GetExecutable(buffer) abort
return ale#node#FindExecutable(a:buffer, 'swift_swiftlint', [
\ 'Pods/SwiftLint/swiftlint',
\ 'ios/Pods/SwiftLint/swiftlint',
\ 'swiftlint',
\])
endfunction
function! ale_linters#swift#swiftlint#GetCommand(buffer) abort
let l:executable = ale_linters#swift#swiftlint#GetExecutable(a:buffer)
let l:args = 'lint --use-stdin'
return ale#Escape(l:executable)
\ . ' ' .l:args
endfunction
function! ale_linters#swift#swiftlint#Handle(buffer, lines) abort
let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):(\d+)?:? ([^:]+): (.+)$'
@ -8,10 +26,10 @@ function! ale_linters#swift#swiftlint#Handle(buffer, lines) abort
for l:match in ale#util#GetMatches(a:lines, l:pattern)
let l:item = {
\ 'lnum': str2nr(l:match[2]),
\ 'type': l:match[4] is# 'error' ? 'E' : 'W',
\ 'text': l:match[5],
\}
\ 'lnum': str2nr(l:match[2]),
\ 'type': l:match[4] is# 'error' ? 'E' : 'W',
\ 'text': l:match[5],
\}
if l:match[4] is# 'error'
let l:item.type = 'E'
@ -45,7 +63,7 @@ endfunction
call ale#linter#Define('swift', {
\ 'name': 'swiftlint',
\ 'executable': 'swiftlint',
\ 'command': 'swiftlint lint --use-stdin',
\ 'executable_callback': 'ale_linters#swift#swiftlint#GetExecutable',
\ 'command_callback': 'ale_linters#swift#swiftlint#GetCommand',
\ 'callback': 'ale_linters#swift#swiftlint#Handle',
\})

View File

@ -8,20 +8,26 @@ function! ale_linters#tex#lacheck#Handle(buffer, lines) abort
"
" "book.tex", line 37: possible unwanted space at "{"
" "book.tex", line 38: missing `\ ' after "etc."
let l:pattern = '^".\+", line \(\d\+\): \(.\+\)$'
let l:pattern = '^"\(.\+\)", line \(\d\+\): \(.\+\)$'
let l:output = []
for l:match in ale#util#GetMatches(a:lines, l:pattern)
" lacheck follows `\input{}` commands. If the cwd is not the same as the
" file in the buffer then it will fail to find the inputed items. We do not
" want warnings from those items anyway
if !empty(matchstr(l:match[2], '^Could not open ".\+"$'))
if !empty(matchstr(l:match[3], '^Could not open ".\+"$'))
continue
endif
" lacheck follows `\input{}` commands. We are only interested in
" reporting errors for the current buffer only.
if empty(matchstr(fnamemodify(l:match[1], ':t'), fnamemodify(bufname(a:buffer), ':t')))
continue
endif
call add(l:output, {
\ 'lnum': l:match[1] + 0,
\ 'text': l:match[2],
\ 'lnum': l:match[2] + 0,
\ 'text': l:match[3],
\ 'type': 'W',
\})
endfor

View File

@ -50,12 +50,17 @@ function! ale#c#ParseCFlags(path_prefix, cflag_line) abort
let l:cflags_list = []
let l:previous_options = []
for l:option in split(a:cflag_line, '-')
let l:split_lines = split(a:cflag_line, '-')
let l:option_index = 0
while l:option_index < len(l:split_lines)
let l:option = l:split_lines[l:option_index]
let l:option_index = l:option_index + 1
call add(l:previous_options, l:option)
" Check if cflag contained a '-' and should not have been splitted
let l:option_list = split(l:option, '\zs')
if len(l:option_list) > 0 && l:option_list[-1] isnot# ' '
if len(l:option_list) > 0 && l:option_list[-1] isnot# ' ' && l:option_index < len(l:split_lines)
continue
endif
@ -81,7 +86,7 @@ function! ale#c#ParseCFlags(path_prefix, cflag_line) abort
call add(l:cflags_list, l:option)
endif
endif
endfor
endwhile
return join(l:cflags_list, ' ')
endfunction

View File

@ -52,16 +52,6 @@ function! ale#cursor#TruncatedEcho(original_message) abort
endtry
endfunction
function! s:FindItemAtCursor(buffer) abort
let l:info = get(g:ale_buffer_info, a:buffer, {})
let l:loclist = get(l:info, 'loclist', [])
let l:pos = getcurpos()
let l:index = ale#util#BinarySearch(l:loclist, a:buffer, l:pos[1], l:pos[2])
let l:loc = l:index >= 0 ? l:loclist[l:index] : {}
return [l:info, l:loc]
endfunction
function! s:StopCursorTimer() abort
if s:cursor_timer != -1
call timer_stop(s:cursor_timer)
@ -85,7 +75,7 @@ function! ale#cursor#EchoCursorWarning(...) abort
return
endif
let [l:info, l:loc] = s:FindItemAtCursor(l:buffer)
let [l:info, l:loc] = ale#util#FindItemAtCursor(l:buffer)
if g:ale_echo_cursor
if !empty(l:loc)
@ -169,7 +159,7 @@ function! ale#cursor#ShowCursorDetail() abort
call s:StopCursorTimer()
let [l:info, l:loc] = s:FindItemAtCursor(l:buffer)
let [l:info, l:loc] = ale#util#FindItemAtCursor(l:buffer)
if !empty(l:loc)
call s:ShowCursorDetailForItem(l:loc, {'stay_here': 0})

View File

@ -22,14 +22,14 @@ let s:global_variable_list = [
\ 'ale_lint_delay',
\ 'ale_lint_on_enter',
\ 'ale_lint_on_filetype_changed',
\ 'ale_lint_on_insert_leave',
\ 'ale_lint_on_save',
\ 'ale_lint_on_text_changed',
\ 'ale_lint_on_insert_leave',
\ 'ale_linter_aliases',
\ 'ale_linters',
\ 'ale_linters_explicit',
\ 'ale_list_window_size',
\ 'ale_list_vertical',
\ 'ale_list_window_size',
\ 'ale_loclist_msg_format',
\ 'ale_max_buffer_history_size',
\ 'ale_max_signs',
@ -52,6 +52,7 @@ let s:global_variable_list = [
\ 'ale_statusline_format',
\ 'ale_type_map',
\ 'ale_use_global_executables',
\ 'ale_virtualtext_cursor',
\ 'ale_warn_about_trailing_blank_lines',
\ 'ale_warn_about_trailing_whitespace',
\]
@ -236,10 +237,11 @@ function! ale#debugging#Info() abort
endfunction
function! ale#debugging#InfoToClipboard() abort
redir @+>
redir => l:output
silent call ale#debugging#Info()
redir END
let @+ = l:output
call s:Echo('ALEInfo copied to your clipboard')
endfunction

View File

@ -304,6 +304,12 @@ function! ale#engine#SetResults(buffer, loclist) abort
call ale#cursor#EchoCursorWarning()
endif
if g:ale_virtualtext_cursor
" Try and show the warning now.
" This will only do something meaningful if we're in normal mode.
call ale#virtualtext#ShowCursorWarning()
endif
" Reset the save event marker, used for opening windows, etc.
call setbufvar(a:buffer, 'ale_save_event_fired', 0)
" Set a marker showing how many times a buffer has been checked.

View File

@ -29,7 +29,7 @@ function! ale#events#SaveEvent(buffer) abort
call setbufvar(a:buffer, 'ale_save_event_fired', 1)
endif
if ale#Var(a:buffer, 'fix_on_save')
if ale#Var(a:buffer, 'fix_on_save') && !ale#events#QuitRecently(a:buffer)
let l:will_fix = ale#fix#Fix(a:buffer, 'save_file')
let l:should_lint = l:should_lint && !l:will_fix
endif
@ -139,6 +139,14 @@ function! ale#events#Init() abort
autocmd InsertLeave * if exists('*ale#engine#Cleanup') | call ale#cursor#EchoCursorWarning() | endif
endif
if g:ale_virtualtext_cursor
autocmd CursorMoved,CursorHold * if exists('*ale#engine#Cleanup') | call ale#virtualtext#ShowCursorWarningWithDelay() | endif
" Look for a warning to echo as soon as we leave Insert mode.
" The script's position variable used when moving the cursor will
" not be changed here.
autocmd InsertLeave * if exists('*ale#engine#Cleanup') | call ale#virtualtext#ShowCursorWarning() | endif
endif
if g:ale_close_preview_on_insert
autocmd InsertEnter * if exists('*ale#preview#CloseIfTypeMatches') | call ale#preview#CloseIfTypeMatches('ale-preview') | endif
endif

View File

@ -17,6 +17,11 @@ let s:default_registry = {
\ 'suggested_filetypes': ['python'],
\ 'description': 'Fix PEP8 issues with autopep8.',
\ },
\ 'bibclean': {
\ 'function': 'ale#fixers#bibclean#Fix',
\ 'suggested_filetypes': ['bib'],
\ 'description': 'Format bib files using bibclean.',
\ },
\ 'black': {
\ 'function': 'ale#fixers#black#Fix',
\ 'suggested_filetypes': ['python'],
@ -56,7 +61,7 @@ let s:default_registry = {
\ },
\ 'prettier': {
\ 'function': 'ale#fixers#prettier#Fix',
\ 'suggested_filetypes': ['javascript', 'typescript', 'css', 'less', 'scss', 'json', 'json5', 'graphql', 'markdown', 'vue'],
\ 'suggested_filetypes': ['javascript', 'typescript', 'css', 'less', 'scss', 'json', 'json5', 'graphql', 'markdown', 'vue', 'html', 'yaml'],
\ 'description': 'Apply prettier to a file.',
\ },
\ 'prettier_eslint': {
@ -110,6 +115,11 @@ let s:default_registry = {
\ 'suggested_filetypes': ['javascript'],
\ 'description': 'Fix JavaScript files using standard --fix',
\ },
\ 'standardrb': {
\ 'function': 'ale#fixers#standardrb#Fix',
\ 'suggested_filetypes': ['ruby'],
\ 'description': 'Fix ruby files with standardrb --fix',
\ },
\ 'stylelint': {
\ 'function': 'ale#fixers#stylelint#Fix',
\ 'suggested_filetypes': ['css', 'sass', 'scss', 'stylus'],

View File

@ -5,14 +5,14 @@ call ale#Set('ocaml_ocamlformat_executable', 'ocamlformat')
call ale#Set('ocaml_ocamlformat_options', '')
function! ale#fixers#ocamlformat#Fix(buffer) abort
let l:filename = expand('#' . a:buffer . ':p')
let l:executable = ale#Var(a:buffer, 'ocaml_ocamlformat_executable')
let l:options = ale#Var(a:buffer, 'ocaml_ocamlformat_options')
return {
\ 'command': ale#Escape(l:executable)
\ . (empty(l:options) ? '' : ' ' . l:options)
\ . ' --inplace'
\ . ' %t',
\ 'read_temporary_file': 1,
\ . ' --name=' . ale#Escape(l:filename)
\ . ' -'
\}
endfunction

View File

@ -58,6 +58,7 @@ function! ale#fixers#prettier#ApplyFixForVersion(buffer, version_output) abort
\ 'markdown': 'markdown',
\ 'vue': 'vue',
\ 'yaml': 'yaml',
\ 'html': 'html',
\}
let l:parser = ''

View File

@ -1,13 +1,28 @@
" Author: Matteo Centenaro (bugant) - https://github.com/bugant
"
" Description: find the root directory for an elixir project that uses mix
" Author: Jon Parise <jon@indelible.org>
" Description: Functions for working with Elixir projects
" Find the root directory for an elixir project that uses mix.
function! ale#handlers#elixir#FindMixProjectRoot(buffer) abort
let l:mix_file = ale#path#FindNearestFile(a:buffer, 'mix.exs')
if !empty(l:mix_file)
return fnamemodify(l:mix_file, ':p:h')
return fnamemodify(l:mix_file, ':p:h')
endif
return '.'
endfunction
" Similar to ale#handlers#elixir#FindMixProjectRoot but also continue the
" search upward for a potential umbrella project root. If an umbrella root
" does not exist, the initial project root will be returned.
function! ale#handlers#elixir#FindMixUmbrellaRoot(buffer) abort
let l:app_root = ale#handlers#elixir#FindMixProjectRoot(a:buffer)
let l:umbrella_root = fnamemodify(l:app_root, ':h:h')
if filereadable(l:umbrella_root . '/mix.exs')
return l:umbrella_root
endif
return l:app_root
endfunction

View File

@ -1,8 +0,0 @@
" Author: KabbAmine - https://github.com/KabbAmine,
" Ben Falconer <ben@falconers.me.uk>
function! ale#handlers#sasslint#GetCommand(buffer) abort
return ale#path#BufferCdString(a:buffer)
\ . ale#Escape('sass-lint')
\ . ' -v -q -f compact %t'
endfunction

View File

@ -24,7 +24,21 @@ 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
if get(l:options, 'hover_from_balloonexpr', 0)
" If we pass the show_documentation flag, we should show the full
" documentation, and always in the preview window.
if get(l:options, 'show_documentation', 0)
let l:documentation = get(a:response.body, 'documentation', '')
" displayString is not included here, because it can be very
" noisy and run on for many lines for complex types. A less
" verbose alternative may be nice in future.
if !empty(l:documentation)
call ale#preview#Show(split(l:documentation, "\n"), {
\ 'filetype': 'ale-preview.message',
\ 'stay_here': 1,
\})
endif
elseif get(l:options, 'hover_from_balloonexpr', 0)
\&& exists('*balloon_show')
\&& ale#Var(l:options.buffer, 'set_balloons')
call balloon_show(a:response.body.displayString)
@ -126,6 +140,7 @@ function! s:OnReady(linter, lsp_details, line, column, opt, ...) abort
\ 'line': a:line,
\ 'column': l:column,
\ 'hover_from_balloonexpr': get(a:opt, 'called_from_balloonexpr', 0),
\ 'show_documentation': get(a:opt, 'show_documentation', 0),
\}
endfunction
@ -153,9 +168,30 @@ endfunction
" - in the balloon if opt.called_from_balloonexpr and balloon_show is detected
" - as status message otherwise
function! ale#hover#Show(buffer, line, col, opt) abort
let l:show_documentation = get(a:opt, 'show_documentation', 0)
for l:linter in ale#linter#Get(getbufvar(a:buffer, '&filetype'))
" Only tsserver supports documentation requests at the moment.
if !empty(l:linter.lsp)
\&& (!l:show_documentation || l:linter.lsp is# 'tsserver')
call s:ShowDetails(l:linter, a:buffer, a:line, a:col, a:opt)
endif
endfor
endfunction
" This function implements the :ALEHover command.
function! ale#hover#ShowAtCursor() abort
let l:buffer = bufnr('')
let l:pos = getcurpos()
call ale#hover#Show(l:buffer, l:pos[1], l:pos[2], {})
endfunction
" This function implements the :ALEDocumentation command.
function! ale#hover#ShowDocumentationAtCursor() abort
let l:buffer = bufnr('')
let l:pos = getcurpos()
let l:options = {'show_documentation': 1}
call ale#hover#Show(l:buffer, l:pos[1], l:pos[2], l:options)
endfunction

View File

@ -16,6 +16,7 @@ let s:default_ale_linter_aliases = {
\ 'systemverilog': 'verilog',
\ 'verilog_systemverilog': ['verilog_systemverilog', 'verilog'],
\ 'vimwiki': 'markdown',
\ 'vue': ['vue', 'javascript'],
\ 'zsh': 'sh',
\}
@ -31,6 +32,7 @@ let s:default_ale_linter_aliases = {
" NOTE: Update the g:ale_linters documentation when modifying this.
let s:default_ale_linters = {
\ 'csh': ['shell'],
\ 'elixir': ['credo', 'dialyxir', 'dogma', 'elixir-ls'],
\ 'go': ['gofmt', 'golint', 'go vet'],
\ 'hack': ['hack'],
\ 'help': [],
@ -40,6 +42,7 @@ let s:default_ale_linters = {
\ 'rust': ['cargo'],
\ 'spec': [],
\ 'text': [],
\ 'vue': ['eslint', 'vls'],
\ 'zsh': ['shell'],
\}

View File

@ -66,6 +66,10 @@ function! ale#lsp#response#ReadDiagnostics(response) abort
let l:loclist_item.detail = l:diagnostic.message . "\n" . join(l:related, "\n")
endif
if has_key(l:diagnostic, 'source')
let l:loclist_item.detail = printf('[%s] %s', l:diagnostic.source, l:diagnostic.message)
endif
call add(l:loclist, l:loclist_item)
endfor

View File

@ -42,3 +42,35 @@ function! ale#ruby#FindProjectRoot(buffer) abort
return ''
endfunction
" Handle output from rubocop and linters that depend on it (e.b. standardrb)
function! ale#ruby#HandleRubocopOutput(buffer, lines) abort
try
let l:errors = json_decode(a:lines[0])
catch
return []
endtry
if !has_key(l:errors, 'summary')
\|| l:errors['summary']['offense_count'] == 0
\|| empty(l:errors['files'])
return []
endif
let l:output = []
for l:error in l:errors['files'][0]['offenses']
let l:start_col = l:error['location']['column'] + 0
call add(l:output, {
\ 'lnum': l:error['location']['line'] + 0,
\ 'col': l:start_col,
\ 'end_col': l:start_col + l:error['location']['length'] - 1,
\ 'code': l:error['cop_name'],
\ 'text': l:error['message'],
\ 'type': ale_linters#ruby#rubocop#GetType(l:error['severity']),
\})
endfor
return l:output
endfunction

View File

@ -75,3 +75,13 @@ function! ale#test#GetQflistWithoutModule() abort
return l:results
endfunction
function! ale#test#GetPreviewWindowText() abort
for l:window in range(1, winnr('$'))
if getwinvar(l:window, '&previewwindow', 0)
let l:buffer = winbufnr(l:window)
return getbufline(l:buffer, 1, '$')
endif
endfor
endfunction

View File

@ -452,3 +452,14 @@ function! ale#util#Col(str, chr) abort
return strlen(join(split(a:str, '\zs')[0:a:chr - 2], '')) + 1
endfunction
function! ale#util#FindItemAtCursor(buffer) abort
let l:info = get(g:ale_buffer_info, a:buffer, {})
let l:loclist = get(l:info, 'loclist', [])
let l:pos = getcurpos()
let l:index = ale#util#BinarySearch(l:loclist, a:buffer, l:pos[1], l:pos[2])
let l:loc = l:index >= 0 ? l:loclist[l:index] : {}
return [l:info, l:loc]
endfunction

View File

@ -5,6 +5,11 @@ ALE Elixir Integration *ale-elixir-options*
===============================================================================
mix *ale-elixir-mix*
The `mix` linter is disabled by default, as it can bee too expensive to run.
See `:help g:ale_linters`
g:ale_elixir_mix_options *g:ale_elixir_mix_options*
*b:ale_elixir_mix_options*
Type: |String|
@ -53,5 +58,20 @@ g:ale_elixir_elixir_ls_release *g:ale_elixir_elixir_ls_release*
Location of the elixir-ls release directory. This directory must contain
the language server scripts (language_server.sh and language_server.bat).
g:ale_elixir_elixir_ls_config *g:ale_elixir_elixir_ls_config*
*b:ale_elixir_elixir_ls_config*
Type: |Dictionary|
Default: `{}`
Dictionary containing configuration settings that will be passed to the
language server. For example, to disable Dialyzer: >
{
\ 'elixirLS': {
\ 'dialyzerEnabled': v:false,
\ },
\ }
<
Consult the ElixirLS documentation for more information about settings.
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View File

@ -1,15 +1,37 @@
===============================================================================
ALE Eruby Integration *ale-eruby-options*
There are three linters for `eruby` files:
There are four linters for `eruby` files:
- `erb`
- `erubis`
- `erubi`
- `ruumba`
`erb` is in the Ruby standard library and is mostly universal. `erubis` is the
default parser in Rails between 3.0 and 5.1. `erubi` is the default in Rails
5.1 and later. To selectively enable a subset, see |g:ale_linters|.
5.1 and later. `ruumba` can extract Ruby from eruby files and run rubocop on
the result. To selectively enable a subset, see |g:ale_linters|.
===============================================================================
ruumba *ale-eruby-ruumba*
g:ale_eruby_ruumba_executable *g:ale_eruby_ruumba_executable*
*b:ale_eruby_ruumba_executable*
Type: String
Default: `'ruumba`
Override the invoked ruumba binary. This is useful for running ruumba
from binstubs or a bundle.
g:ale_eruby_ruumba_options *g:ale_ruby_ruumba_options*
*b:ale_ruby_ruumba_options*
Type: |String|
Default: `''`
This variable can be change to modify flags given to ruumba.
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View File

@ -27,7 +27,7 @@ g:ale_go_go_executable *g:ale_go_go_options*
Default: `'go'`
The executable that will be run for the `gobuild` and `govet` linters, and
the gomod` fixer.
the `gomod` fixer.
===============================================================================
@ -53,6 +53,25 @@ g:ale_go_gofmt_options *g:ale_go_gofmt_options*
This variable can be set to pass additional options to the gofmt fixer.
===============================================================================
golint *ale-go-golint*
g:ale_go_golint_executable *g:ale_go_golint_executable*
*b:ale_go_golint_executable*
Type: |String|
Default: `'golint'`
This variable can be set to change the golint executable path.
g:ale_go_golint_options *g:ale_go_golint_options*
*b:ale_go_golint_options*
Type: |String|
Default: `''`
This variable can be set to pass additional options to the golint linter.
===============================================================================
govet *ale-go-govet*

View File

@ -79,6 +79,12 @@ g:ale_html_tidy_use_global *g:html_tidy_use_global*
See |ale-integrations-local-executables|
===============================================================================
prettier *ale-html-prettier*
See |ale-javascript-prettier| for information about the available options.
===============================================================================
stylelint *ale-html-stylelint*

View File

@ -88,14 +88,20 @@ This generates a out/fat-jar.jar file that contains the language server. To
let ALE use this language server you need to set the g:ale_java_javalsp_jar
variable to the absolute path of this jar file.
g:ale_java_javalsp_executable *g:ale_java_javalsp_executable*
*b:ale_java_javalsp_executable*
Type: |String|
Default: `'java'`
This variable can be changed to use a different executable for java.
g:ale_java_javalsp_jar *g:ale_java_javalsp_jar*
*b:ale_java_javalsp_jar*
Type: String
Default: 'fat-jar.jar
Type: |String|
Default: `'fat-jar.jar'`
Path to the location of the vscode-javac language server plugin.
and -d. They are added automatically.
===============================================================================

View File

@ -203,5 +203,15 @@ g:ale_php_cs_fixer_options *g:ale_php_cs_fixer_options*
This variable can be set to pass additional options to php-cs-fixer.
===============================================================================
php *ale-php-php*
g:ale_php_php_executable *g:ale_php_php_executable*
*b:ale_php_php_executable*
Type: |String|
Default: `'php'`
This variable sets the executable used for php.
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View File

@ -328,6 +328,46 @@ g:ale_python_pycodestyle_auto_pipenv *g:ale_python_pycodestyle_auto_pipenv*
if true. This is overridden by a manually-set executable.
===============================================================================
pydocstyle *ale-python-pydocstyle*
g:ale_python_pydocstyle_executable *g:ale_python_pydocstyle_executable*
*b:ale_python_pydocstyle_executable*
Type: |String|
Default: `'pydocstyle'`
See |ale-integrations-local-executables|
Set this to `'pipenv'` to invoke `'pipenv` `run` `pydocstyle'`.
g:ale_python_pydocstyle_options *g:ale_python_pydocstyle_options*
*b:ale_python_pydocstyle_options*
Type: |String|
Default: `''`
This variable can be changed to add command-line arguments to the
pydocstyle invocation.
g:ale_python_pydocstyle_use_global *g:ale_python_pydocstyle_use_global*
*b:ale_python_pydocstyle_use_global*
Type: |Number|
Default: `get(g:, 'ale_use_global_executables', 0)`
See |ale-integrations-local-executables|
g:ale_python_pydocstyle_auto_pipenv *g:ale_python_pydocstyle_auto_pipenv*
*b:ale_python_pydocstyle_auto_pipenv*
Type: |Number|
Default: `0`
Detect whether the file is inside a pipenv, and set the executable to `pipenv`
if true. This is overridden by a manually-set executable.
===============================================================================
pyflakes *ale-python-pyflakes*

View File

@ -129,5 +129,27 @@ g:ale_ruby_solargraph_executable *g:ale_ruby_solargraph_executable*
from binstubs or a bundle.
===============================================================================
standardrb *ale-ruby-standardrb*
g:ale_ruby_standardrb_executable *g:ale_ruby_standardrb_executable*
*b:ale_ruby_standardrb_executable*
Type: String
Default: `'standardrb'`
Override the invoked standardrb binary. Set this to `'bundle'` to invoke
`'bundle` `exec` standardrb'.
g:ale_ruby_standardrb_options *g:ale_ruby_standardrb_options*
*b:ale_ruby_standardrb_options*
Type: |String|
Default: `''`
This variable can be change to modify flags given to standardrb.
===============================================================================
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View File

@ -2,6 +2,12 @@
ALE SASS Integration *ale-sass-options*
===============================================================================
sasslint *ale-sass-sasslint*
See |ale-scss-sasslint| for information about the available options.
===============================================================================
stylelint *ale-sass-stylelint*

View File

@ -8,6 +8,33 @@ prettier *ale-scss-prettier*
See |ale-javascript-prettier| for information about the available options.
===============================================================================
sasslint *ale-scss-sasslint*
g:ale_scss_sasslint_executable *g:ale_scss_sasslint_executable*
*b:ale_scss_sasslint_executable*
Type: |String|
Default: `'sass-lint'`
See |ale-integrations-local-executables|
g:ale_scss_sasslint_options *g:ale_scss_sasslint_options*
*b:ale_scss_sasslint_options*
Type: |String|
Default: `''`
This variable can be set to pass additional options to sass-lint.
g:ale_scss_sasslint_use_global *g:ale_scss_sasslint_use_global*
*b:ale_scss_sasslint_use_global*
Type: |Number|
Default: `get(g:, 'ale_use_global_executables', 0)`
See |ale-integrations-local-executables|
===============================================================================
stylelint *ale-scss-stylelint*

View File

@ -21,9 +21,11 @@ tslint *ale-typescript-tslint*
This linter isn't recommended, because TSLint can't be used for checking for
problems while you type. You should probably use the tsserver plugin instead.
tsserver plugins are described here:
https://github.com/Microsoft/TypeScript/wiki/Writing-a-Language-Service-Plugin
Follow the instructions on the plugin website for installing it:
https://github.com/angelozerr/tsserver-plugins
https://github.com/Microsoft/typescript-tslint-plugin
Then disable TSLint in vimrc or any other Vim configuration file. >
let g:ale_linters_ignore = {'typescript': ['tslint']}

View File

@ -21,6 +21,8 @@ CONTENTS *ale-contents*
6.1 Highlights........................|ale-highlights|
6.2 Options for write-good Linter.....|ale-write-good-options|
7. Integration Documentation............|ale-integrations|
ada...................................|ale-ada-options|
gcc.................................|ale-ada-gcc|
ansible...............................|ale-ansible-options|
ansible-lint........................|ale-ansible-ansible-lint|
asciidoc..............................|ale-asciidoc-options|
@ -29,6 +31,8 @@ CONTENTS *ale-contents*
gcc.................................|ale-asm-gcc|
awk...................................|ale-awk-options|
gawk................................|ale-awk-gawk|
bib...................................|ale-bib-options|
bibclean............................|ale-bib-bibclean|
c.....................................|ale-c-options|
clang...............................|ale-c-clang|
clangd..............................|ale-c-clangd|
@ -92,6 +96,7 @@ CONTENTS *ale-contents*
erlc................................|ale-erlang-erlc|
syntaxerl...........................|ale-erlang-syntaxerl|
eruby.................................|ale-eruby-options|
ruumba..............................|ale-eruby-ruumba|
fish..................................|ale-fish-options|
fortran...............................|ale-fortran-options|
gcc.................................|ale-fortran-gcc|
@ -107,6 +112,7 @@ CONTENTS *ale-contents*
go....................................|ale-go-options|
gobuild.............................|ale-go-gobuild|
gofmt...............................|ale-go-gofmt|
golint..............................|ale-go-golint|
govet...............................|ale-go-govet|
gometalinter........................|ale-go-gometalinter|
staticcheck.........................|ale-go-staticcheck|
@ -138,10 +144,13 @@ CONTENTS *ale-contents*
html..................................|ale-html-options|
htmlhint............................|ale-html-htmlhint|
tidy................................|ale-html-tidy|
prettier............................|ale-html-prettier|
stylelint...........................|ale-html-stylelint|
write-good..........................|ale-html-write-good|
idris.................................|ale-idris-options|
idris...............................|ale-idris-idris|
ispc..................................|ale-ispc-options|
ispc................................|ale-ispc-ispc|
java..................................|ale-java-options|
checkstyle..........................|ale-java-checkstyle|
javac...............................|ale-java-javac|
@ -224,6 +233,7 @@ CONTENTS *ale-contents*
phpstan.............................|ale-php-phpstan|
psalm...............................|ale-php-psalm|
php-cs-fixer........................|ale-php-php-cs-fixer|
php.................................|ale-php-php|
po....................................|ale-po-options|
write-good..........................|ale-po-write-good|
pod...................................|ale-pod-options|
@ -250,6 +260,7 @@ CONTENTS *ale-contents*
mypy................................|ale-python-mypy|
prospector..........................|ale-python-prospector|
pycodestyle.........................|ale-python-pycodestyle|
pydocstyle..........................|ale-python-pydocstyle|
pyflakes............................|ale-python-pyflakes|
pylint..............................|ale-python-pylint|
pyls................................|ale-python-pyls|
@ -274,12 +285,14 @@ CONTENTS *ale-contents*
ruby................................|ale-ruby-ruby|
rufo................................|ale-ruby-rufo|
solargraph..........................|ale-ruby-solargraph|
standardrb..........................|ale-ruby-standardrb|
rust..................................|ale-rust-options|
cargo...............................|ale-rust-cargo|
rls.................................|ale-rust-rls|
rustc...............................|ale-rust-rustc|
rustfmt.............................|ale-rust-rustfmt|
sass..................................|ale-sass-options|
sasslint............................|ale-sass-sasslint|
stylelint...........................|ale-sass-stylelint|
scala.................................|ale-scala-options|
sbtserver...........................|ale-scala-sbtserver|
@ -287,6 +300,7 @@ CONTENTS *ale-contents*
scalastyle..........................|ale-scala-scalastyle|
scss..................................|ale-scss-options|
prettier............................|ale-scss-prettier|
sasslint............................|ale-scss-sasslint|
stylelint...........................|ale-scss-stylelint|
sh....................................|ale-sh-options|
sh-language-server..................|ale-sh-language-server|
@ -388,12 +402,14 @@ Notes:
`^` No linters for text or Vim help filetypes are enabled by default.
`!!` These linters check only files on disk. See |ale-lint-file-linters|