1
0
mirror of https://github.com/amix/vimrc synced 2025-06-16 01:25:00 +08:00

Updated plugins

This commit is contained in:
Amir Salihefendic
2018-11-01 11:03:42 +01:00
parent 44dca49794
commit d2d303593e
105 changed files with 2141 additions and 510 deletions

View File

@ -1,6 +1,12 @@
" Author: Bjorn Neergaard <bjorn@neersighted.com>
" Description: ansible-lint for ansible-yaml files
call ale#Set('ansible_ansible_lint_executable', 'ansible-lint')
function! ale_linters#ansible#ansible_lint#GetExecutable(buffer) abort
return ale#Var(a:buffer, 'ansible_ansible_lint_executable')
endfunction
function! ale_linters#ansible#ansible_lint#Handle(buffer, lines) abort
for l:line in a:lines[:10]
if match(l:line, '^Traceback') >= 0
@ -42,8 +48,9 @@ function! ale_linters#ansible#ansible_lint#Handle(buffer, lines) abort
endfunction
call ale#linter#Define('ansible', {
\ 'name': 'ansible',
\ 'executable': 'ansible',
\ 'command': 'ansible-lint -p %t',
\ 'name': 'ansible_lint',
\ 'aliases': ['ansible', 'ansible-lint'],
\ 'executable_callback': 'ale_linters#ansible#ansible_lint#GetExecutable',
\ 'command': '%e -p %t',
\ 'callback': 'ale_linters#ansible#ansible_lint#Handle',
\})

View File

@ -10,7 +10,7 @@ call ale#Set('c_clangtidy_executable', 'clang-tidy')
" Consult the check list in clang-tidy's documentation:
" http://clang.llvm.org/extra/clang-tidy/checks/list.html
call ale#Set('c_clangtidy_checks', ['*'])
call ale#Set('c_clangtidy_checks', [])
" Set this option to manually set some options for clang-tidy.
" This will disable compile_commands.json detection.
call ale#Set('c_clangtidy_options', '')

View File

@ -4,7 +4,7 @@
call ale#Set('cpp_clangtidy_executable', 'clang-tidy')
" Set this option to check the checks clang-tidy will apply.
call ale#Set('cpp_clangtidy_checks', ['*'])
call ale#Set('cpp_clangtidy_checks', [])
" Set this option to manually set some options for clang-tidy.
" This will disable compile_commands.json detection.
call ale#Set('cpp_clangtidy_options', '')

View File

@ -0,0 +1,22 @@
" Author: aurieh <me@aurieh.me>
" Description: A Language Server implementation for D
call ale#Set('d_dls_executable', 'dls')
function! ale_linters#d#dls#GetExecutable(buffer) abort
return ale#Var(a:buffer, 'd_dls_executable')
endfunction
function! ale_linters#d#dls#FindProjectRoot(buffer) abort
" Note: this will return . if dub config is empty
" dls can run outside DUB projects just fine
return fnamemodify(ale#d#FindDUBConfig(a:buffer), ':h')
endfunction
call ale#linter#Define('d', {
\ 'name': 'dls',
\ 'lsp': 'stdio',
\ 'executable_callback': 'ale_linters#d#dls#GetExecutable',
\ 'command_callback': 'ale_linters#d#dls#GetExecutable',
\ 'project_root_callback': 'ale_linters#d#dls#FindProjectRoot',
\})

View File

@ -1,20 +1,6 @@
" Author: w0rp <devw0rp@gmail.com>
" Description: "dmd for D files"
function! s:FindDUBConfig(buffer) abort
" Find a DUB configuration file in ancestor paths.
" The most DUB-specific names will be tried first.
for l:possible_filename in ['dub.sdl', 'dub.json', 'package.json']
let l:dub_file = ale#path#FindNearestFile(a:buffer, l:possible_filename)
if !empty(l:dub_file)
return l:dub_file
endif
endfor
return ''
endfunction
function! ale_linters#d#dmd#DUBCommand(buffer) abort
" If we can't run dub, then skip this command.
if !executable('dub')
@ -22,7 +8,7 @@ function! ale_linters#d#dmd#DUBCommand(buffer) abort
return ''
endif
let l:dub_file = s:FindDUBConfig(a:buffer)
let l:dub_file = ale#d#FindDUBConfig(a:buffer)
if empty(l:dub_file)
return ''

View File

@ -0,0 +1,61 @@
" Author: Alexander Olofsson <alexander.olofsson@liu.se>
call ale#Set('dockerfile_dockerfile_lint_executable', 'dockerfile_lint')
call ale#Set('dockerfile_dockerfile_lint_options', '')
function! ale_linters#dockerfile#dockerfile_lint#GetType(type) abort
if a:type is? 'error'
return 'E'
elseif a:type is? 'warn'
return 'W'
endif
return 'I'
endfunction
function! ale_linters#dockerfile#dockerfile_lint#Handle(buffer, lines) abort
try
let l:data = json_decode(join(a:lines, ''))
catch
return []
endtry
if empty(l:data)
" Should never happen, but it's better to be on the safe side
return []
endif
let l:messages = []
for l:type in ['error', 'warn', 'info']
for l:object in l:data[l:type]['data']
let l:line = get(l:object, 'line', -1)
let l:message = l:object['message']
if get(l:object, 'description', 'None') isnot# 'None'
let l:message = l:message . '. ' . l:object['description']
endif
call add(l:messages, {
\ 'lnum': l:line,
\ 'text': l:message,
\ 'type': ale_linters#dockerfile#dockerfile_lint#GetType(l:type),
\})
endfor
endfor
return l:messages
endfunction
function! ale_linters#dockerfile#dockerfile_lint#GetCommand(buffer) abort
return '%e' . ale#Pad(ale#Var(a:buffer, 'dockerfile_dockerfile_lint_options'))
\ . ' -p -j -f'
\ . ' %t'
endfunction
call ale#linter#Define('dockerfile', {
\ 'name': 'dockerfile_lint',
\ 'executable_callback': ale#VarFunc('dockerfile_dockerfile_lint_executable'),
\ 'command_callback': 'ale_linters#dockerfile#dockerfile_lint#GetCommand',
\ 'callback': 'ale_linters#dockerfile#dockerfile_lint#Handle',
\})

View File

@ -11,10 +11,18 @@ function! ale_linters#elixir#credo#Handle(buffer, lines) abort
let l:type = l:match[3]
let l:text = l:match[4]
if l:type is# 'C'
let l:type = 'E'
elseif l:type is# 'R'
" Refactoring opportunities
if l:type is# 'F'
let l:type = 'W'
" Consistency
elseif l:type is# 'C'
let l:type = 'W'
" Software Design
elseif l:type is# 'D'
let l:type = 'I'
" Code Readability
elseif l:type is# 'R'
let l:type = 'I'
endif
call add(l:output, {
@ -29,9 +37,16 @@ function! ale_linters#elixir#credo#Handle(buffer, lines) abort
return l:output
endfunction
function! ale_linters#elixir#credo#GetCommand(buffer) abort
let l:project_root = ale#handlers#elixir#FindMixProjectRoot(a:buffer)
return ale#path#CdString(l:project_root)
\ . ' mix help credo && mix credo suggest --format=flycheck --read-from-stdin %s'
endfunction
call ale#linter#Define('elixir', {
\ 'name': 'credo',
\ 'executable': 'mix',
\ 'command': 'mix help credo && mix credo suggest --format=flycheck --read-from-stdin %s',
\ 'command_callback': 'ale_linters#elixir#credo#GetCommand',
\ 'callback': 'ale_linters#elixir#credo#Handle',
\})

View File

@ -25,10 +25,17 @@ function! ale_linters#elixir#dialyxir#Handle(buffer, lines) abort
return l:output
endfunction
function! ale_linters#elixir#dialyxir#GetCommand(buffer) abort
let l:project_root = ale#handlers#elixir#FindMixProjectRoot(a:buffer)
return ale#path#CdString(l:project_root)
\ . ' mix help dialyzer && mix dialyzer'
endfunction
call ale#linter#Define('elixir', {
\ 'name': 'dialyxir',
\ 'executable': 'mix',
\ 'command': 'mix help dialyzer && mix dialyzer',
\ 'command_callback': 'ale_linters#elixir#dialyxir#GetCommand',
\ 'callback': 'ale_linters#elixir#dialyxir#Handle',
\})

View File

@ -29,10 +29,17 @@ function! ale_linters#elixir#dogma#Handle(buffer, lines) abort
return l:output
endfunction
function! ale_linters#elixir#dogma#GetCommand(buffer) abort
let l:project_root = ale#handlers#elixir#FindMixProjectRoot(a:buffer)
return ale#path#CdString(l:project_root)
\ . ' mix help dogma && mix dogma %s --format=flycheck'
endfunction
call ale#linter#Define('elixir', {
\ 'name': 'dogma',
\ 'executable': 'mix',
\ 'command': 'mix help dogma && mix dogma %s --format=flycheck',
\ 'command_callback': 'ale_linters#elixir#dogma#GetCommand',
\ 'lint_file': 1,
\ 'callback': 'ale_linters#elixir#dogma#Handle',
\})

View File

@ -0,0 +1,19 @@
" Author: Jon Parise <jon@indelible.org>
" Description: elixir-ls integration (https://github.com/JakeBecker/elixir-ls)
call ale#Set('elixir_elixir_ls_release', 'elixir-ls')
function! ale_linters#elixir#elixir_ls#GetExecutable(buffer) abort
let l:dir = ale#path#Simplify(ale#Var(a:buffer, 'elixir_elixir_ls_release'))
let l:cmd = ale#Has('win32') ? '\language_server.bat' : '/language_server.sh'
return l:dir . l:cmd
endfunction
call ale#linter#Define('elixir', {
\ 'name': 'elixir-ls',
\ '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',
\})

View File

@ -29,18 +29,8 @@ function! ale_linters#elixir#mix#Handle(buffer, lines) abort
return l:output
endfunction
function! ale_linters#elixir#mix#FindProjectRoot(buffer) abort
let l:mix_file = ale#path#FindNearestFile(a:buffer, 'mix.exs')
if !empty(l:mix_file)
return fnamemodify(l:mix_file, ':p:h')
endif
return '.'
endfunction
function! ale_linters#elixir#mix#GetCommand(buffer) abort
let l:project_root = ale_linters#elixir#mix#FindProjectRoot(a:buffer)
let l:project_root = ale#handlers#elixir#FindMixProjectRoot(a:buffer)
let l:temp_dir = ale#engine#CreateDirectory(a:buffer)
@ -49,8 +39,8 @@ function! ale_linters#elixir#mix#GetCommand(buffer) abort
\ : 'MIX_BUILD_PATH=' . ale#Escape(l:temp_dir)
return ale#path#CdString(l:project_root)
\ . l:mix_build_path
\ . ' mix compile %s'
\ . l:mix_build_path
\ . ' mix compile %s'
endfunction
call ale#linter#Define('elixir', {

View File

@ -16,7 +16,7 @@ call ale#linter#Define('haskell', {
\ 'name': 'stack_build',
\ 'aliases': ['stack-build'],
\ 'output_stream': 'stderr',
\ 'executable': 'stack',
\ 'executable_callback': 'ale#handlers#haskell#GetStackExecutable',
\ 'command_callback': 'ale_linters#haskell#stack_build#GetCommand',
\ 'lint_file': 1,
\ 'callback': 'ale#handlers#haskell#HandleGHCFormat',

View File

@ -5,7 +5,7 @@ call ale#linter#Define('haskell', {
\ 'name': 'stack_ghc',
\ 'aliases': ['stack-ghc'],
\ 'output_stream': 'stderr',
\ 'executable': 'stack',
\ 'executable_callback': 'ale#handlers#haskell#GetStackExecutable',
\ 'command': 'stack ghc -- -fno-code -v0 %t',
\ 'callback': 'ale#handlers#haskell#HandleGHCFormat',
\})

View File

@ -2,7 +2,7 @@
" Description: PMD for Java files
function! ale_linters#java#pmd#Handle(buffer, lines) abort
let l:pattern = '"\(\d\+\)",".\+","\(.\+\)","\(\d\+\)","\(\d\+\)","\(.\+\)","\(.\+\)","\(.\+\)"$'
let l:pattern = '"\(\d\+\)",".*","\(.\+\)","\(\d\+\)","\(\d\+\)","\(.\+\)","\(.\+\)","\(.\+\)"$'
let l:output = []
for l:match in ale#util#GetMatches(a:lines, l:pattern)

View File

@ -18,7 +18,7 @@ function! ale_linters#javascript#jshint#GetCommand(buffer) abort
let l:command .= ' --config ' . ale#Escape(l:jshint_config)
endif
let l:command .= ' -'
let l:command .= ' --filename %s -'
return l:command
endfunction

View File

@ -0,0 +1,166 @@
" Author:Travis Gibson <https://github.com/Garland-g>
" Description: This file adds support for checking perl6 syntax
let g:ale_perl6_perl6_executable =
\ get(g:, 'ale_perl6_perl6_executable', 'perl6')
let g:ale_perl6_perl6_options =
\ get(g:, 'ale_perl6_perl6_options', '-c -Ilib')
let $PERL6_EXCEPTIONS_HANDLER = 'JSON'
let $RAKUDO_ERROR_COLOR = 0
function! ale_linters#perl6#perl6#GetExecutable(buffer) abort
return ale#Var(a:buffer, 'perl6_perl6_executable')
endfunction
function! ale_linters#perl6#perl6#GetCommand(buffer) abort
return ale_linters#perl6#perl6#GetExecutable(a:buffer)
\ . ' ' . ale#Var(a:buffer, 'perl6_perl6_options')
\ . ' %t'
endfunction
function! ale_linters#perl6#perl6#ExtractError(dict, item, type, buffer) abort
let l:file = ''
let l:line = 1
let l:column = ''
let l:text = ''
let l:pre = ''
let l:counter = 2
let l:end_line = ''
let l:linepatternmessage = 'at\s\+line\s\+\(\d\+\)'
if has_key(a:dict[a:item], 'filename') && !empty(a:dict[a:item]['filename'])
let l:file = a:dict[a:item]['filename']
endif
if has_key(a:dict[a:item], 'line') && !empty(a:dict[a:item]['line'])
let l:line = a:dict[a:item]['line']
let l:counter -= 1
endif
if has_key(a:dict[a:item], 'column') && !empty(a:dict[a:item]['column'])
let l:column = a:dict[a:item]['column']
endif
if has_key(a:dict[a:item], 'message') && !empty(a:dict[a:item]['message'])
let l:text = substitute(a:dict[a:item]['message'], '\s*\n\s*', ' ', 'g')
let l:counter -= 1
endif
if has_key(a:dict[a:item], 'line-real') && !empty(a:dict[a:item]['line-real'])
let l:end_line = l:line
let l:line = a:dict[a:item]['line-real']
endif
for l:match in ale#util#GetMatches(l:text, l:linepatternmessage)
let l:line = l:match[1]
let l:counter -= 1
endfor
" Currently, filenames and line numbers are not always given in the error output
if l:counter < 2
\&& ( ale#path#IsBufferPath(a:buffer, l:file) || l:file is# '' )
return {
\ 'lnum': '' . l:line,
\ 'text': l:text,
\ 'type': a:type,
\ 'col': l:column,
\ 'end_lnum': l:end_line,
\ 'code': a:item,
\}
endif
return ''
endfunction
function! ale_linters#perl6#perl6#Handle(buffer, lines) abort
let l:output = []
if empty(a:lines)
return l:output
endif
if a:lines[0] is# 'Syntax OK'
return l:output
endif
try
let l:json = json_decode(join(a:lines, ''))
catch /E474/
call add(l:output, {
\ 'lnum': '1',
\ 'text': 'Received output in the default Perl6 error format. See :ALEDetail for details',
\ 'detail': join(a:lines, "\n"),
\ 'type': 'W',
\ })
return l:output
endtry
if type(l:json) is v:t_dict
for l:key in keys(l:json)
if has_key(l:json[l:key], 'sorrows') &&
\ has_key(l:json[l:key], 'worries')
if !empty(l:json[l:key]['sorrows'])
for l:dictionary in get(l:json[l:key], 'sorrows')
for l:item in keys(l:dictionary)
let l:result =
\ ale_linters#perl6#perl6#ExtractError(
\ l:dictionary,
\ l:item,
\ 'E',
\ a:buffer,
\ )
if l:result isnot# ''
call add(l:output, l:result)
endif
endfor
endfor
endif
if !empty(l:json[l:key]['worries'])
for l:dictionary in get(l:json[l:key], 'worries')
for l:item in keys(l:dictionary)
let l:result =
\ ale_linters#perl6#perl6#ExtractError(
\ l:dictionary,
\ l:item,
\ 'W',
\ a:buffer,
\ )
if l:result isnot# ''
call add(l:output, l:result)
endif
endfor
endfor
endif
else
let l:result = ale_linters#perl6#perl6#ExtractError(
\ l:json,
\ l:key,
\ 'E',
\ a:buffer,
\ )
if l:result isnot# ''
call add(l:output, l:result)
endif
endif
endfor
endif
return l:output
endfunction
call ale#linter#Define('perl6', {
\ 'name': 'perl6',
\ 'executable_callback': 'ale_linters#perl6#perl6#GetExecutable',
\ 'output_stream': 'both',
\ 'command_callback': 'ale_linters#perl6#perl6#GetCommand',
\ 'callback': 'ale_linters#perl6#perl6#Handle',
\})

View File

@ -1,28 +1,21 @@
" Author: richard marmorstein <https://github.com/twitchard>
" Author: Matt Brown <https://github.com/muglug>
" Description: plugin for Psalm, static analyzer for PHP
call ale#Set('php_psalm_executable', 'psalm')
call ale#Set('psalm_langserver_executable', 'psalm-language-server')
call ale#Set('psalm_langserver_use_global', get(g:, 'ale_use_global_executables', 0))
function! ale_linters#php#psalm#Handle(buffer, lines) abort
" Matches patterns like the following:
let l:pattern = '^.*:\(\d\+\):\(\d\+\):\(\w\+\) - \(.*\)$'
let l:output = []
function! ale_linters#php#psalm#GetProjectRoot(buffer) abort
let l:git_path = ale#path#FindNearestDirectory(a:buffer, '.git')
for l:match in ale#util#GetMatches(a:lines, l:pattern)
call add(l:output, {
\ 'lnum': l:match[1] + 0,
\ 'text': l:match[4],
\ 'type': l:match[3][:0] is# 'e' ? 'E' : 'W',
\})
endfor
return l:output
return !empty(l:git_path) ? fnamemodify(l:git_path, ':h:h') : ''
endfunction
call ale#linter#Define('php', {
\ 'name': 'psalm',
\ 'command': '%e --diff --output-format=emacs %s',
\ 'executable_callback': ale#VarFunc('php_psalm_executable'),
\ 'callback': 'ale_linters#php#psalm#Handle',
\ 'lint_file': 1,
\ 'lsp': 'stdio',
\ 'executable_callback': ale#node#FindExecutableFunc('psalm_langserver', [
\ 'vendor/bin/psalm-language-server',
\ ]),
\ 'command': '%e',
\ 'project_root_callback': 'ale_linters#php#psalm#GetProjectRoot',
\})

View File

@ -0,0 +1,100 @@
" Author: Takuya Fujiwara <tyru.exe@gmail.com>
" Description: swipl syntax / semantic check for Prolog files
call ale#Set('prolog_swipl_executable', 'swipl')
call ale#Set('prolog_swipl_load', 'current_prolog_flag(argv, [File]), load_files(File, [sandboxed(true)]), halt.')
call ale#Set('prolog_swipl_timeout', 3)
call ale#Set('prolog_swipl_alarm', 'alarm(%t, (%h), _, [])')
call ale#Set('prolog_swipl_alarm_handler', 'writeln(user_error, "ERROR: Exceeded %t seconds, Please change g:prolog_swipl_timeout to modify the limit."), halt(1)')
function! ale_linters#prolog#swipl#GetCommand(buffer) abort
let l:goals = ale#Var(a:buffer, 'prolog_swipl_load')
let l:goals = l:goals =~# '^\s*$' ? 'halt' : l:goals
let l:timeout = ale#Var(a:buffer, 'prolog_swipl_timeout') + 0
if l:timeout > 0
let l:goals = s:GetAlarm(a:buffer, l:timeout) . ', ' . l:goals
endif
return '%e -g ' . ale#Escape(l:goals) . ' -- %s'
endfunction
function! s:GetAlarm(buffer, timeout) abort
let l:handler = ale#Var(a:buffer, 'prolog_swipl_alarm_handler')
let l:handler = s:Subst(l:handler, {'t': a:timeout})
let l:alarm = ale#Var(a:buffer, 'prolog_swipl_alarm')
let l:alarm = s:Subst(l:alarm, {'t': a:timeout, 'h': l:handler})
return l:alarm
endfunction
function! s:Subst(format, vars) abort
let l:vars = extend(copy(a:vars), {'%': '%'})
return substitute(a:format, '%\(.\)', '\=get(l:vars, submatch(1), "")', 'g')
endfunction
function! ale_linters#prolog#swipl#Handle(buffer, lines) abort
let l:pattern = '\v^(ERROR|Warning)+%(:\s*[^:]+:(\d+)%(:(\d+))?)?:\s*(.*)$'
let l:output = []
let l:i = 0
while l:i < len(a:lines)
let l:match = matchlist(a:lines[l:i], l:pattern)
if empty(l:match)
let l:i += 1
continue
endif
let [l:i, l:text] = s:GetErrMsg(l:i, a:lines, l:match[4])
let l:item = {
\ 'lnum': (l:match[2] + 0 ? l:match[2] + 0 : 1),
\ 'col': l:match[3] + 0,
\ 'text': l:text,
\ 'type': (l:match[1] is# 'ERROR' ? 'E' : 'W'),
\}
if !s:Ignore(l:item)
call add(l:output, l:item)
endif
endwhile
return l:output
endfunction
" This returns [<next line number>, <error message string>]
function! s:GetErrMsg(i, lines, text) abort
if a:text !~# '^\s*$'
return [a:i + 1, a:text]
endif
let l:i = a:i + 1
let l:text = []
while l:i < len(a:lines) && a:lines[l:i] =~# '^\s'
call add(l:text, s:Trim(a:lines[l:i]))
let l:i += 1
endwhile
return [l:i, join(l:text, '. ')]
endfunction
function! s:Trim(str) abort
return substitute(a:str, '\v^\s+|\s+$', '', 'g')
endfunction
" Skip sandbox error which is caused by directives
" because what we want is syntactic or semantic check.
function! s:Ignore(item) abort
return a:item.type is# 'E' &&
\ a:item.text =~# '\vNo permission to (call|directive|assert) sandboxed'
endfunction
call ale#linter#Define('prolog', {
\ 'name': 'swipl',
\ 'output_stream': 'stderr',
\ 'executable_callback': ale#VarFunc('prolog_swipl_executable'),
\ 'command_callback': 'ale_linters#prolog#swipl#GetCommand',
\ 'callback': 'ale_linters#prolog#swipl#Handle',
\})

View File

@ -30,7 +30,7 @@ function! ale_linters#ruby#reek#GetCommand(buffer, version_output) abort
\ : ''
return ale#handlers#ruby#EscapeExecutable(l:executable, 'reek')
\ . ' -f json --no-progress --no-color'
\ . ' -f json --no-progress --no-color --force-exclusion'
\ . l:display_name_args
endfunction

View File

@ -5,6 +5,7 @@
" Description: updated to use stdio
call ale#Set('ruby_solargraph_executable', 'solargraph')
call ale#Set('ruby_solargraph_options', {})
function! ale_linters#ruby#solargraph#GetCommand(buffer) abort
return '%e' . ale#Pad('stdio')
@ -17,4 +18,5 @@ call ale#linter#Define('ruby', {
\ 'executable_callback': ale#VarFunc('ruby_solargraph_executable'),
\ 'command_callback': 'ale_linters#ruby#solargraph#GetCommand',
\ 'project_root_callback': 'ale#ruby#FindProjectRoot',
\ 'initialization_options_callback': ale#VarFunc('ruby_solargraph_options'),
\})

View File

@ -9,6 +9,8 @@ call ale#Set('rust_cargo_check_tests', 0)
call ale#Set('rust_cargo_avoid_whole_workspace', 1)
call ale#Set('rust_cargo_default_feature_behavior', 'default')
call ale#Set('rust_cargo_include_features', '')
call ale#Set('rust_cargo_use_clippy', 0)
call ale#Set('rust_cargo_clippy_options', '')
function! ale_linters#rust#cargo#GetCargoExecutable(bufnr) abort
if ale#path#FindNearestFile(a:bufnr, 'Cargo.toml') isnot# ''
@ -70,14 +72,23 @@ function! ale_linters#rust#cargo#GetCommand(buffer, version_output) abort
let l:default_feature = ''
endif
let l:subcommand = l:use_check ? 'check' : 'build'
let l:clippy_options = ''
if ale#Var(a:buffer, 'rust_cargo_use_clippy')
let l:subcommand = 'clippy'
let l:clippy_options = ' ' . ale#Var(a:buffer, 'rust_cargo_clippy_options')
endif
return l:nearest_cargo_prefix . 'cargo '
\ . (l:use_check ? 'check' : 'build')
\ . l:subcommand
\ . (l:use_all_targets ? ' --all-targets' : '')
\ . (l:use_examples ? ' --examples' : '')
\ . (l:use_tests ? ' --tests' : '')
\ . ' --frozen --message-format=json -q'
\ . l:default_feature
\ . l:include_features
\ . l:clippy_options
endfunction
call ale#linter#Define('rust', {