Updated plugins
This commit is contained in:
parent
2f164fee9b
commit
cc997dc3d0
99 changed files with 1572 additions and 1151 deletions
|
@ -15,9 +15,9 @@ function! ale_linters#awk#gawk#GetCommand(buffer) abort
|
|||
" note the --source 'BEGIN ...' is to prevent
|
||||
" gawk from attempting to execute the body of the script
|
||||
" it is linting.
|
||||
return ale_linters#awk#gawk#GetExecutable(a:buffer)
|
||||
return ale#Escape(ale_linters#awk#gawk#GetExecutable(a:buffer))
|
||||
\ . " --source 'BEGIN { exit } END { exit 1 }'"
|
||||
\ . ' ' . ale#Var(a:buffer, 'awk_gawk_options')
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'awk_gawk_options'))
|
||||
\ . ' ' . '-f %t --lint /dev/null'
|
||||
endfunction
|
||||
|
||||
|
|
|
@ -30,5 +30,4 @@ call ale#linter#Define('cpp', {
|
|||
\ 'command_callback': 'ale_linters#cpp#cquery#GetCommand',
|
||||
\ 'project_root_callback': 'ale_linters#cpp#cquery#GetProjectRoot',
|
||||
\ 'initialization_options_callback': 'ale_linters#cpp#cquery#GetInitializationOptions',
|
||||
\ 'language': 'cpp',
|
||||
\})
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
let g:ale_cs_mcs_options = get(g:, 'ale_cs_mcs_options', '')
|
||||
|
||||
function! ale_linters#cs#mcs#GetCommand(buffer) abort
|
||||
return 'mcs -unsafe --parse ' . ale#Var(a:buffer, 'cs_mcs_options') . ' %t'
|
||||
let l:options = ale#Var(a:buffer, 'cs_mcs_options')
|
||||
|
||||
return 'mcs -unsafe --parse'
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
\ . ' %t'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#cs#mcs#Handle(buffer, lines) abort
|
||||
|
|
|
@ -29,16 +29,16 @@ function! ale_linters#cs#mcsc#GetCommand(buffer) abort
|
|||
\ : ''
|
||||
|
||||
" register temporary module target file with ale
|
||||
let l:out = tempname()
|
||||
call ale#engine#ManageFile(a:buffer, l:out)
|
||||
" register temporary module target file with ALE.
|
||||
let l:out = ale#engine#CreateFile(a:buffer)
|
||||
|
||||
" The code is compiled as a module and the output is redirected to a
|
||||
" temporary file.
|
||||
return ale#path#CdString(s:GetWorkingDirectory(a:buffer))
|
||||
\ . 'mcs -unsafe'
|
||||
\ . ' ' . ale#Var(a:buffer, 'cs_mcsc_options')
|
||||
\ . ' ' . l:lib_option
|
||||
\ . ' ' . l:r_option
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'cs_mcsc_options'))
|
||||
\ . ale#Pad(l:lib_option)
|
||||
\ . ale#Pad(l:r_option)
|
||||
\ . ' -out:' . l:out
|
||||
\ . ' -t:module'
|
||||
\ . ' -recurse:' . ale#Escape('*.cs')
|
||||
|
|
|
@ -10,7 +10,7 @@ endfunction
|
|||
|
||||
function! ale_linters#cuda#nvcc#GetCommand(buffer) abort
|
||||
" Unused: use ale#util#nul_file
|
||||
" let l:output_file = tempname() . '.ii'
|
||||
" let l:output_file = ale#util#Tempname() . '.ii'
|
||||
" call ale#engine#ManageFile(a:buffer, l:output_file)
|
||||
|
||||
return ale#Escape(ale_linters#cuda#nvcc#GetExecutable(a:buffer))
|
||||
|
|
|
@ -20,6 +20,5 @@ call ale#linter#Define('dart', {
|
|||
\ 'lsp': 'stdio',
|
||||
\ 'executable_callback': 'ale_linters#dart#language_server#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#dart#language_server#GetExecutable',
|
||||
\ 'language': 'dart',
|
||||
\ 'project_root_callback': 'ale_linters#dart#language_server#GetProjectRoot',
|
||||
\})
|
||||
|
|
|
@ -128,14 +128,7 @@ function! ale_linters#elm#make#HandleElm018Line(line, output) abort
|
|||
endfunction
|
||||
|
||||
function! ale_linters#elm#make#FileIsBuffer(path) abort
|
||||
let l:is_windows = has('win32')
|
||||
let l:temp_dir = l:is_windows ? $TMP : $TMPDIR
|
||||
|
||||
if has('win32')
|
||||
return a:path[0:len(l:temp_dir) - 1] is? l:temp_dir
|
||||
else
|
||||
return a:path[0:len(l:temp_dir) - 1] is# l:temp_dir
|
||||
endif
|
||||
return ale#path#IsTempName(a:path)
|
||||
endfunction
|
||||
|
||||
function! ale_linters#elm#make#ParseMessage(message) abort
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
let g:ale_erlang_erlc_options = get(g:, 'ale_erlang_erlc_options', '')
|
||||
|
||||
function! ale_linters#erlang#erlc#GetCommand(buffer) abort
|
||||
let l:output_file = tempname()
|
||||
let l:output_file = ale#util#Tempname()
|
||||
call ale#engine#ManageFile(a:buffer, l:output_file)
|
||||
|
||||
return 'erlc -o ' . ale#Escape(l:output_file)
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
" Author: RyanSquared <vandor2012@gmail.com>
|
||||
" Description: `fusion-lint` linter for FusionScript files
|
||||
|
||||
let g:ale_fuse_fusionlint_executable =
|
||||
\ get(g:, 'ale_fuse_fusionlint_executable', 'fusion-lint')
|
||||
|
||||
let g:ale_fuse_fusionlint_options =
|
||||
\ get(g:, 'ale_fuse_fusionlint_options', '')
|
||||
call ale#Set('fuse_fusionlint_executable', 'fusion-lint')
|
||||
call ale#Set('fuse_fusionlint_options', '')
|
||||
|
||||
function! ale_linters#fuse#fusionlint#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'fuse_fusionlint_executable')
|
||||
|
@ -13,7 +10,7 @@ endfunction
|
|||
|
||||
function! ale_linters#fuse#fusionlint#GetCommand(buffer) abort
|
||||
return ale#Escape(ale_linters#fuse#fusionlint#GetExecutable(a:buffer))
|
||||
\ . ' ' . ale#Var(a:buffer, 'fuse_fusionlint_options')
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'fuse_fusionlint_options'))
|
||||
\ . ' --filename %s -i'
|
||||
endfunction
|
||||
|
||||
|
|
|
@ -14,9 +14,9 @@ function! ale_linters#glsl#glslang#GetExecutable(buffer) abort
|
|||
endfunction
|
||||
|
||||
function! ale_linters#glsl#glslang#GetCommand(buffer) abort
|
||||
return ale_linters#glsl#glslang#GetExecutable(a:buffer)
|
||||
\ . ' ' . ale#Var(a:buffer, 'glsl_glslang_options')
|
||||
\ . ' ' . '-C %t'
|
||||
return ale#Escape(ale_linters#glsl#glslang#GetExecutable(a:buffer))
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'glsl_glslang_options'))
|
||||
\ . ' -C %t'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#glsl#glslang#Handle(buffer, lines) abort
|
||||
|
|
|
@ -29,6 +29,5 @@ call ale#linter#Define('glsl', {
|
|||
\ 'lsp': 'stdio',
|
||||
\ 'executable_callback': 'ale_linters#glsl#glslls#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#glsl#glslls#GetCommand',
|
||||
\ 'language': 'glsl',
|
||||
\ 'project_root_callback': 'ale_linters#glsl#glslls#GetProjectRoot',
|
||||
\})
|
||||
|
|
|
@ -3,10 +3,9 @@
|
|||
|
||||
function! ale_linters#go#gotype#GetCommand(buffer) abort
|
||||
if expand('#' . a:buffer . ':p') =~# '_test\.go$'
|
||||
return
|
||||
return ''
|
||||
endif
|
||||
|
||||
|
||||
return ale#path#BufferCdString(a:buffer) . ' gotype .'
|
||||
endfunction
|
||||
|
||||
|
|
|
@ -84,10 +84,10 @@ function! ale_linters#java#javac#GetCommand(buffer, import_paths) abort
|
|||
return ale#path#BufferCdString(a:buffer)
|
||||
\ . ale#Escape(l:executable)
|
||||
\ . ' -Xlint'
|
||||
\ . ' ' . l:cp_option
|
||||
\ . ' ' . l:sp_option
|
||||
\ . ale#Pad(l:cp_option)
|
||||
\ . ale#Pad(l:sp_option)
|
||||
\ . ' -d ' . ale#Escape(l:class_file_directory)
|
||||
\ . ' ' . ale#Var(a:buffer, 'java_javac_options')
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'java_javac_options'))
|
||||
\ . ' %t'
|
||||
endfunction
|
||||
|
||||
|
|
38
sources_non_forked/ale/ale_linters/javascript/flow_ls.vim
Normal file
38
sources_non_forked/ale/ale_linters/javascript/flow_ls.vim
Normal file
|
@ -0,0 +1,38 @@
|
|||
" Author: t_t <jamestthompson3@gmail.com>
|
||||
" Description: Integrate ALE with flow-language-server.
|
||||
|
||||
call ale#Set('javascript_flow_ls_executable', 'flow')
|
||||
call ale#Set('javascript_flow_ls_use_global',
|
||||
\ get(g:, 'ale_use_global_executables', 0)
|
||||
\)
|
||||
|
||||
function! ale_linters#javascript#flow_ls#GetExecutable(buffer) abort
|
||||
return ale#node#FindExecutable(a:buffer, 'javascript_flow_ls', [
|
||||
\ 'node_modules/.bin/flow',
|
||||
\])
|
||||
endfunction
|
||||
|
||||
function! ale_linters#javascript#flow_ls#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#javascript#flow_ls#GetExecutable(a:buffer)
|
||||
|
||||
return ale#Escape(l:executable) . ' lsp --from ale-lsp'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#javascript#flow_ls#FindProjectRoot(buffer) abort
|
||||
let l:flow_config = ale#path#FindNearestFile(a:buffer, '.flowconfig')
|
||||
|
||||
if !empty(l:flow_config)
|
||||
return fnamemodify(l:flow_config, ':h')
|
||||
endif
|
||||
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('javascript', {
|
||||
\ 'name': 'flow-language-server',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable_callback': 'ale_linters#javascript#flow_ls#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#javascript#flow_ls#GetCommand',
|
||||
\ 'project_root_callback': 'ale_linters#javascript#flow_ls#FindProjectRoot',
|
||||
\ 'language': 'javascript',
|
||||
\})
|
38
sources_non_forked/ale/ale_linters/kotlin/languageserver.vim
Normal file
38
sources_non_forked/ale/ale_linters/kotlin/languageserver.vim
Normal file
|
@ -0,0 +1,38 @@
|
|||
" Author: MTDL9 <https://github.com/MTDL9>
|
||||
" Description: Support for the Kotlin language server https://github.com/fwcd/KotlinLanguageServer
|
||||
|
||||
call ale#Set('kotlin_languageserver_executable', 'kotlin-language-server')
|
||||
|
||||
function! ale_linters#kotlin#languageserver#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'kotlin_languageserver_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#kotlin#languageserver#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#kotlin#languageserver#GetExecutable(a:buffer)
|
||||
return ale#Escape(l:executable)
|
||||
endfunction
|
||||
|
||||
function! ale_linters#kotlin#languageserver#GetProjectRoot(buffer) abort
|
||||
let l:gradle_root = ale#gradle#FindProjectRoot(a:buffer)
|
||||
|
||||
if !empty(l:gradle_root)
|
||||
return l:gradle_root
|
||||
endif
|
||||
|
||||
let l:maven_pom_file = ale#path#FindNearestFile(a:buffer, 'pom.xml')
|
||||
|
||||
if !empty(l:maven_pom_file)
|
||||
return fnamemodify(l:maven_pom_file, ':h')
|
||||
endif
|
||||
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('kotlin', {
|
||||
\ 'name': 'languageserver',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable_callback': 'ale_linters#kotlin#languageserver#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#kotlin#languageserver#GetCommand',
|
||||
\ 'language': 'kotlin',
|
||||
\ 'project_root_callback': 'ale_linters#kotlin#languageserver#GetProjectRoot',
|
||||
\})
|
|
@ -9,8 +9,7 @@ endfunction
|
|||
|
||||
function! ale_linters#llvm#llc#GetCommand(buffer) abort
|
||||
return ale#Escape(ale_linters#llvm#llc#GetExecutable(a:buffer))
|
||||
\ . ' -filetype=null -o='
|
||||
\ . ale#Escape(g:ale#util#nul_file)
|
||||
\ . ' -filetype=null -o=' . g:ale#util#nul_file
|
||||
endfunction
|
||||
|
||||
function! ale_linters#llvm#llc#HandleErrors(buffer, lines) abort
|
||||
|
|
|
@ -1,5 +1,23 @@
|
|||
" Author rhysd https://rhysd.github.io/, Dirk Roorda (dirkroorda), Adrián González Rus (@adrigzr)
|
||||
" Description: remark-lint for Markdown files
|
||||
call ale#Set('markdown_remark_lint_executable', 'remark')
|
||||
call ale#Set('markdown_remark_lint_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
call ale#Set('markdown_remark_lint_options', '')
|
||||
|
||||
function! ale_linters#markdown#remark_lint#GetExecutable(buffer) abort
|
||||
return ale#node#FindExecutable(a:buffer, 'markdown_remark_lint', [
|
||||
\ 'node_modules/.bin/remark',
|
||||
\])
|
||||
endfunction
|
||||
|
||||
function! ale_linters#markdown#remark_lint#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#markdown#remark_lint#GetExecutable(a:buffer)
|
||||
let l:options = ale#Var(a:buffer, 'markdown_remark_lint_options')
|
||||
|
||||
return ale#node#Executable(a:buffer, l:executable)
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
\ . ' --no-stdout --no-color'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#markdown#remark_lint#Handle(buffer, lines) abort
|
||||
" matches: ' 1:4 warning Incorrect list-item indent: add 1 space list-item-indent remark-lint'
|
||||
|
@ -26,9 +44,8 @@ endfunction
|
|||
|
||||
call ale#linter#Define('markdown', {
|
||||
\ 'name': 'remark-lint',
|
||||
\ 'executable': 'remark',
|
||||
\ 'command': 'remark --no-stdout --no-color %s',
|
||||
\ 'executable_callback': 'ale_linters#markdown#remark_lint#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#markdown#remark_lint#GetCommand',
|
||||
\ 'callback': 'ale_linters#markdown#remark_lint#Handle',
|
||||
\ 'lint_file': 1,
|
||||
\ 'output_stream': 'stderr',
|
||||
\})
|
||||
|
|
|
@ -42,9 +42,9 @@ endfunction
|
|||
|
||||
call ale#linter#Define('nasm', {
|
||||
\ 'name': 'nasm',
|
||||
\ 'executable': 'nasm',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'lint_file': 1,
|
||||
\ 'executable_callback': 'ale_linters#nasm#nasm#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#nasm#nasm#GetCommand',
|
||||
\ 'callback': 'ale_linters#nasm#nasm#Handle',
|
||||
\})
|
||||
|
|
|
@ -25,6 +25,5 @@ call ale#linter#Define('php', {
|
|||
\ 'lsp': 'stdio',
|
||||
\ 'executable_callback': 'ale_linters#php#langserver#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#php#langserver#GetCommand',
|
||||
\ 'language': 'php',
|
||||
\ 'project_root_callback': 'ale_linters#php#langserver#GetProjectRoot',
|
||||
\})
|
||||
|
|
45
sources_non_forked/ale/ale_linters/puppet/languageserver.vim
Normal file
45
sources_non_forked/ale/ale_linters/puppet/languageserver.vim
Normal file
|
@ -0,0 +1,45 @@
|
|||
" Author: Alexander Olofsson <alexander.olofsson@liu.se>
|
||||
" Description: Puppet Language Server integration for ALE
|
||||
|
||||
call ale#Set('puppet_languageserver_executable', 'puppet-languageserver')
|
||||
|
||||
function! ale_linters#puppet#languageserver#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'puppet_languageserver_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#puppet#languageserver#GetCommand(buffer) abort
|
||||
let l:exe = ale#Escape(ale_linters#puppet#languageserver#GetExecutable(a:buffer))
|
||||
|
||||
return l:exe . ' --stdio'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#puppet#languageserver#GetProjectRoot(buffer) abort
|
||||
" Note: The metadata.json file is recommended for Puppet 4+ modules, but
|
||||
" there's no requirement to have it, so fall back to the other possible
|
||||
" Puppet module directories
|
||||
let l:root_path = ale#path#FindNearestFile(a:buffer, 'metadata.json')
|
||||
if !empty(l:root_path)
|
||||
return fnamemodify(l:root_path, ':h')
|
||||
endif
|
||||
|
||||
for l:test_path in [
|
||||
\ 'manifests',
|
||||
\ 'templates',
|
||||
\]
|
||||
let l:root_path = ale#path#FindNearestDirectory(a:buffer, l:test_path)
|
||||
if !empty(l:root_path)
|
||||
return fnamemodify(l:root_path, ':h:h')
|
||||
endif
|
||||
endfor
|
||||
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('puppet', {
|
||||
\ 'name': 'languageserver',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable_callback': 'ale_linters#puppet#languageserver#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#puppet#languageserver#GetCommand',
|
||||
\ 'language': 'puppet',
|
||||
\ 'project_root_callback': 'ale_linters#puppet#languageserver#GetProjectRoot',
|
||||
\})
|
|
@ -23,7 +23,6 @@ call ale#linter#Define('python', {
|
|||
\ 'lsp': 'stdio',
|
||||
\ 'executable_callback': 'ale_linters#python#pyls#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#python#pyls#GetCommand',
|
||||
\ 'language': 'python',
|
||||
\ 'project_root_callback': 'ale#python#FindProjectRoot',
|
||||
\ 'completion_filter': 'ale#completion#python#CompletionItemFilter',
|
||||
\})
|
||||
|
|
|
@ -23,7 +23,6 @@ call ale#linter#Define('python', {
|
|||
\ 'lsp': 'stdio',
|
||||
\ 'executable_callback': 'ale_linters#python#pyre#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#python#pyre#GetCommand',
|
||||
\ 'language': 'python',
|
||||
\ 'project_root_callback': 'ale#python#FindProjectRoot',
|
||||
\ 'completion_filter': 'ale#completion#python#CompletionItemFilter',
|
||||
\})
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
" Author: Eddie Lebow https://github.com/elebow
|
||||
" Description: rails_best_practices, a code metric tool for rails projects
|
||||
|
||||
let g:ale_ruby_rails_best_practices_options =
|
||||
\ get(g:, 'ale_ruby_rails_best_practices_options', '')
|
||||
call ale#Set('ruby_rails_best_practices_options', '')
|
||||
call ale#Set('ruby_rails_best_practices_executable', 'rails_best_practices')
|
||||
|
||||
function! ale_linters#ruby#rails_best_practices#Handle(buffer, lines) abort
|
||||
let l:output = []
|
||||
|
@ -22,8 +22,12 @@ function! ale_linters#ruby#rails_best_practices#Handle(buffer, lines) abort
|
|||
return l:output
|
||||
endfunction
|
||||
|
||||
function! ale_linters#ruby#rails_best_practices#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'ruby_rails_best_practices_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#ruby#rails_best_practices#GetCommand(buffer) abort
|
||||
let l:executable = ale#handlers#rails_best_practices#GetExecutable(a:buffer)
|
||||
let l:executable = ale_linters#ruby#rails_best_practices#GetExecutable(a:buffer)
|
||||
let l:exec_args = l:executable =~? 'bundle$'
|
||||
\ ? ' exec rails_best_practices'
|
||||
\ : ''
|
||||
|
@ -46,7 +50,7 @@ endfunction
|
|||
|
||||
call ale#linter#Define('ruby', {
|
||||
\ 'name': 'rails_best_practices',
|
||||
\ 'executable_callback': 'ale#handlers#rails_best_practices#GetExecutable',
|
||||
\ 'executable_callback': 'ale_linters#ruby#rails_best_practices#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#ruby#rails_best_practices#GetCommand',
|
||||
\ 'callback': 'ale_linters#ruby#rails_best_practices#Handle',
|
||||
\ 'lint_file': 1,
|
||||
|
|
|
@ -30,6 +30,5 @@ call ale#linter#Define('rust', {
|
|||
\ 'lsp': 'stdio',
|
||||
\ 'executable_callback': 'ale_linters#rust#rls#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#rust#rls#GetCommand',
|
||||
\ 'language': 'rust',
|
||||
\ 'project_root_callback': 'ale_linters#rust#rls#GetProjectRoot',
|
||||
\})
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
" Author: Kevin Kays - https://github.com/okkays
|
||||
" Description: Support for the scalastyle checker.
|
||||
|
||||
let g:ale_scala_scalastyle_options =
|
||||
\ get(g:, 'ale_scala_scalastyle_options', '')
|
||||
|
||||
let g:ale_scalastyle_config_loc =
|
||||
call ale#Set('scala_scalastyle_options', '')
|
||||
" TODO: Remove support for the old option name in ALE 3.0.
|
||||
call ale#Set('scala_scalastyle_config',
|
||||
\ get(g:, 'ale_scalastyle_config_loc', '')
|
||||
\)
|
||||
|
||||
function! ale_linters#scala#scalastyle#Handle(buffer, lines) abort
|
||||
" Look for help output from scalastyle first, which indicates that no
|
||||
|
@ -66,23 +66,13 @@ function! ale_linters#scala#scalastyle#GetCommand(buffer) abort
|
|||
|
||||
" If all else fails, try the global config.
|
||||
if empty(l:scalastyle_config)
|
||||
let l:scalastyle_config = get(g:, 'ale_scalastyle_config_loc', '')
|
||||
let l:scalastyle_config = ale#Var(a:buffer, 'scala_scalastyle_config')
|
||||
endif
|
||||
|
||||
" Build the command using the config file and additional options.
|
||||
let l:command = 'scalastyle'
|
||||
|
||||
if !empty(l:scalastyle_config)
|
||||
let l:command .= ' --config ' . ale#Escape(l:scalastyle_config)
|
||||
endif
|
||||
|
||||
if !empty(g:ale_scala_scalastyle_options)
|
||||
let l:command .= ' ' . g:ale_scala_scalastyle_options
|
||||
endif
|
||||
|
||||
let l:command .= ' %t'
|
||||
|
||||
return l:command
|
||||
return 'scalastyle'
|
||||
\ . (!empty(l:scalastyle_config) ? ' --config ' . ale#Escape(l:scalastyle_config) : '')
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'scala_scalastyle_options'))
|
||||
\ . ' %t'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('scala', {
|
||||
|
|
|
@ -28,6 +28,5 @@ call ale#linter#Define('sh', {
|
|||
\ 'lsp': 'stdio',
|
||||
\ 'executable_callback': 'ale_linters#sh#language_server#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#sh#language_server#GetCommand',
|
||||
\ 'language': 'sh',
|
||||
\ 'project_root_callback': 'ale_linters#sh#language_server#GetProjectRoot',
|
||||
\})
|
||||
|
|
|
@ -20,14 +20,12 @@ function! ale_linters#thrift#thrift#GetCommand(buffer) abort
|
|||
let l:generators = ['cpp']
|
||||
endif
|
||||
|
||||
let l:output_dir = tempname()
|
||||
call mkdir(l:output_dir)
|
||||
call ale#engine#ManageDirectory(a:buffer, l:output_dir)
|
||||
let l:output_dir = ale#engine#CreateDirectory(a:buffer)
|
||||
|
||||
return ale#Escape(ale_linters#thrift#thrift#GetExecutable(a:buffer))
|
||||
\ . ' ' . join(map(copy(l:generators), "'--gen ' . v:val"))
|
||||
\ . ' ' . join(map(copy(l:includes), "'-I ' . v:val"))
|
||||
\ . ' ' . ale#Var(a:buffer, 'thrift_thrift_options')
|
||||
\ . ale#Pad(join(map(copy(l:generators), "'--gen ' . v:val")))
|
||||
\ . ale#Pad(join(map(copy(l:includes), "'-I ' . v:val")))
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'thrift_thrift_options'))
|
||||
\ . ' -out ' . ale#Escape(l:output_dir)
|
||||
\ . ' %t'
|
||||
endfunction
|
||||
|
|
|
@ -1,17 +1,7 @@
|
|||
" Author: Prashanth Chandra <https://github.com/prashcr>, Jonathan Clem <https://jclem.net>
|
||||
" Description: tslint for TypeScript files
|
||||
|
||||
call ale#Set('typescript_tslint_executable', 'tslint')
|
||||
call ale#Set('typescript_tslint_config_path', '')
|
||||
call ale#Set('typescript_tslint_rules_dir', '')
|
||||
call ale#Set('typescript_tslint_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
call ale#Set('typescript_tslint_ignore_empty_files', 0)
|
||||
|
||||
function! ale_linters#typescript#tslint#GetExecutable(buffer) abort
|
||||
return ale#node#FindExecutable(a:buffer, 'typescript_tslint', [
|
||||
\ 'node_modules/.bin/tslint',
|
||||
\])
|
||||
endfunction
|
||||
call ale#handlers#tslint#InitVariables()
|
||||
|
||||
function! ale_linters#typescript#tslint#Handle(buffer, lines) abort
|
||||
" Do not output any errors for empty files if the option is on.
|
||||
|
@ -70,7 +60,7 @@ function! ale_linters#typescript#tslint#GetCommand(buffer) abort
|
|||
\ : ''
|
||||
|
||||
return ale#path#BufferCdString(a:buffer)
|
||||
\ . ale#Escape(ale_linters#typescript#tslint#GetExecutable(a:buffer))
|
||||
\ . ale#Escape(ale#handlers#tslint#GetExecutable(a:buffer))
|
||||
\ . ' --format json'
|
||||
\ . l:tslint_config_option
|
||||
\ . l:tslint_rules_option
|
||||
|
@ -79,7 +69,7 @@ endfunction
|
|||
|
||||
call ale#linter#Define('typescript', {
|
||||
\ 'name': 'tslint',
|
||||
\ 'executable_callback': 'ale_linters#typescript#tslint#GetExecutable',
|
||||
\ 'executable_callback': 'ale#handlers#tslint#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#typescript#tslint#GetCommand',
|
||||
\ 'callback': 'ale_linters#typescript#tslint#Handle',
|
||||
\})
|
||||
|
|
|
@ -7,7 +7,7 @@ if !exists('g:ale_verilog_verilator_options')
|
|||
endif
|
||||
|
||||
function! ale_linters#verilog#verilator#GetCommand(buffer) abort
|
||||
let l:filename = tempname() . '_verilator_linted.v'
|
||||
let l:filename = ale#util#Tempname() . '_verilator_linted.v'
|
||||
|
||||
" Create a special filename, so we can detect it in the handler.
|
||||
call ale#engine#ManageFile(a:buffer, l:filename)
|
||||
|
|
32
sources_non_forked/ale/ale_linters/vue/vls.vim
Normal file
32
sources_non_forked/ale/ale_linters/vue/vls.vim
Normal file
|
@ -0,0 +1,32 @@
|
|||
" Author: Alexander Olofsson <alexander.olofsson@liu.se>
|
||||
" Description: Vue vls Language Server integration for ALE
|
||||
|
||||
call ale#Set('vue_vls_executable', 'vls')
|
||||
call ale#Set('vue_vls_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
|
||||
function! ale_linters#vue#vls#GetExecutable(buffer) abort
|
||||
return ale#node#FindExecutable(a:buffer, 'vue_vls', [
|
||||
\ 'node_modules/.bin/vls',
|
||||
\])
|
||||
endfunction
|
||||
|
||||
function! ale_linters#vue#vls#GetCommand(buffer) abort
|
||||
let l:exe = ale#Escape(ale_linters#vue#vls#GetExecutable(a:buffer))
|
||||
|
||||
return l:exe . ' --stdio'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#vue#vls#GetProjectRoot(buffer) abort
|
||||
let l:package_path = ale#path#FindNearestFile(a:buffer, 'package.json')
|
||||
|
||||
return !empty(l:package_path) ? fnamemodify(l:package_path, ':h') : ''
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('vue', {
|
||||
\ 'name': 'vls',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable_callback': 'ale_linters#vue#vls#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#vue#vls#GetCommand',
|
||||
\ 'language': 'vue',
|
||||
\ 'project_root_callback': 'ale_linters#vue#vls#GetProjectRoot',
|
||||
\})
|
|
@ -11,7 +11,7 @@ endfunction
|
|||
|
||||
function! ale_linters#xml#xmllint#GetCommand(buffer) abort
|
||||
return ale#Escape(ale_linters#xml#xmllint#GetExecutable(a:buffer))
|
||||
\ . ' ' . ale#Var(a:buffer, 'xml_xmllint_options')
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'xml_xmllint_options'))
|
||||
\ . ' --noout -'
|
||||
endfunction
|
||||
|
||||
|
|
|
@ -191,15 +191,12 @@ endfunction
|
|||
"
|
||||
" Every variable name will be prefixed with 'ale_'.
|
||||
function! ale#Var(buffer, variable_name) abort
|
||||
let l:nr = str2nr(a:buffer)
|
||||
let l:full_name = 'ale_' . a:variable_name
|
||||
let l:vars = getbufvar(str2nr(a:buffer), '', 0)
|
||||
|
||||
if bufexists(l:nr)
|
||||
let l:vars = getbufvar(l:nr, '')
|
||||
elseif has_key(g:, 'ale_fix_buffer_data')
|
||||
let l:vars = get(g:ale_fix_buffer_data, l:nr, {'vars': {}}).vars
|
||||
else
|
||||
let l:vars = {}
|
||||
if l:vars is 0
|
||||
" Look for variables from deleted buffers, saved from :ALEFix
|
||||
let l:vars = get(get(g:ale_fix_buffer_data, a:buffer, {}), 'vars', {})
|
||||
endif
|
||||
|
||||
return get(l:vars, l:full_name, g:[l:full_name])
|
||||
|
@ -210,10 +207,29 @@ endfunction
|
|||
" Every variable name will be prefixed with 'ale_'.
|
||||
function! ale#Set(variable_name, default) abort
|
||||
let l:full_name = 'ale_' . a:variable_name
|
||||
let l:value = get(g:, l:full_name, a:default)
|
||||
let g:[l:full_name] = l:value
|
||||
|
||||
return l:value
|
||||
if !has_key(g:, l:full_name)
|
||||
let g:[l:full_name] = a:default
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Given a string for adding to a command, return the string padded with a
|
||||
" space on the left if it is not empty. Otherwise return an empty string.
|
||||
"
|
||||
" This can be used for making command strings cleaner and easier to test.
|
||||
function! ale#Pad(string) abort
|
||||
return !empty(a:string) ? ' ' . a:string : ''
|
||||
endfunction
|
||||
|
||||
" Given a environment variable name and a value, produce part of a command for
|
||||
" setting an environment variable before running a command. The syntax will be
|
||||
" valid for cmd on Windows, or most shells on Unix.
|
||||
function! ale#Env(variable_name, value) abort
|
||||
if has('win32')
|
||||
return 'set ' . a:variable_name . '=' . ale#Escape(a:value) . ' && '
|
||||
endif
|
||||
|
||||
return a:variable_name . '=' . ale#Escape(a:value) . ' '
|
||||
endfunction
|
||||
|
||||
" Escape a string suitably for each platform.
|
||||
|
|
159
sources_non_forked/ale/autoload/ale/assert.vim
Normal file
159
sources_non_forked/ale/autoload/ale/assert.vim
Normal file
|
@ -0,0 +1,159 @@
|
|||
let s:chain_results = []
|
||||
|
||||
function! ale#assert#WithChainResults(...) abort
|
||||
let s:chain_results = a:000
|
||||
endfunction
|
||||
|
||||
function! s:GetLinter() abort
|
||||
let l:linters = ale#linter#GetLintersLoaded()
|
||||
let l:filetype_linters = get(values(l:linters), 0, [])
|
||||
|
||||
if len(l:linters) is 0 || len(l:filetype_linters) is 0
|
||||
throw 'No linters were loaded'
|
||||
endif
|
||||
|
||||
if len(l:linters) > 1 || len(l:filetype_linters) > 1
|
||||
throw 'More than one linter was loaded'
|
||||
endif
|
||||
|
||||
return l:filetype_linters[0]
|
||||
endfunction
|
||||
|
||||
" Load the currently loaded linter for a test case, and check that the command
|
||||
" matches the given string.
|
||||
function! ale#assert#Linter(expected_executable, expected_command) abort
|
||||
let l:buffer = bufnr('')
|
||||
let l:linter = s:GetLinter()
|
||||
let l:executable = ale#linter#GetExecutable(l:buffer, l:linter)
|
||||
|
||||
if has_key(l:linter, 'command_chain')
|
||||
let l:callbacks = map(copy(l:linter.command_chain), 'v:val.callback')
|
||||
|
||||
" If the expected command is a string, just check the last one.
|
||||
if type(a:expected_command) is type('')
|
||||
if len(l:callbacks) is 1
|
||||
let l:command = call(l:callbacks[0], [l:buffer])
|
||||
else
|
||||
let l:input = get(s:chain_results, len(l:callbacks) - 2, [])
|
||||
let l:command = call(l:callbacks[-1], [l:buffer, l:input])
|
||||
endif
|
||||
else
|
||||
let l:command = []
|
||||
let l:chain_index = 0
|
||||
|
||||
for l:Callback in l:callbacks
|
||||
if l:chain_index is 0
|
||||
call add(l:command, call(l:Callback, [l:buffer]))
|
||||
else
|
||||
let l:input = get(s:chain_results, l:chain_index - 1, [])
|
||||
call add(l:command, call(l:Callback, [l:buffer, l:input]))
|
||||
endif
|
||||
|
||||
let l:chain_index += 1
|
||||
endfor
|
||||
endif
|
||||
else
|
||||
let l:command = ale#linter#GetCommand(l:buffer, l:linter)
|
||||
" Replace %e with the escaped executable, so tests keep passing after
|
||||
" linters are changed to use %e.
|
||||
let l:command = substitute(l:command, '%e', '\=ale#Escape(l:executable)', 'g')
|
||||
endif
|
||||
|
||||
AssertEqual
|
||||
\ [a:expected_executable, a:expected_command],
|
||||
\ [l:executable, l:command]
|
||||
endfunction
|
||||
|
||||
function! ale#assert#LinterNotExecuted() abort
|
||||
let l:buffer = bufnr('')
|
||||
let l:linter = s:GetLinter()
|
||||
let l:executable = ale#linter#GetExecutable(l:buffer, l:linter)
|
||||
|
||||
Assert empty(l:executable), "The linter will be executed when it shouldn't be"
|
||||
endfunction
|
||||
|
||||
function! ale#assert#LSPOptions(expected_options) abort
|
||||
let l:buffer = bufnr('')
|
||||
let l:linter = s:GetLinter()
|
||||
let l:initialization_options = ale#lsp_linter#GetOptions(l:buffer, l:linter)
|
||||
|
||||
AssertEqual a:expected_options, l:initialization_options
|
||||
endfunction
|
||||
|
||||
function! ale#assert#LSPLanguage(expected_language) abort
|
||||
let l:buffer = bufnr('')
|
||||
let l:linter = s:GetLinter()
|
||||
let l:language = ale#util#GetFunction(l:linter.language_callback)(l:buffer)
|
||||
|
||||
AssertEqual a:expected_language, l:language
|
||||
endfunction
|
||||
|
||||
function! ale#assert#LSPProject(expected_root) abort
|
||||
let l:buffer = bufnr('')
|
||||
let l:linter = s:GetLinter()
|
||||
let l:root = ale#util#GetFunction(l:linter.project_root_callback)(l:buffer)
|
||||
|
||||
AssertEqual a:expected_root, l:root
|
||||
endfunction
|
||||
|
||||
" A dummy function for making sure this module is loaded.
|
||||
function! ale#assert#SetUpLinterTest(filetype, name) abort
|
||||
" Set up a marker so ALE doesn't create real random temporary filenames.
|
||||
let g:ale_create_dummy_temporary_file = 1
|
||||
|
||||
" Remove current linters.
|
||||
call ale#linter#Reset()
|
||||
call ale#linter#PreventLoading(a:filetype)
|
||||
|
||||
let l:prefix = 'ale_' . a:filetype . '_' . a:name
|
||||
let b:filter_expr = 'v:val[: len(l:prefix) - 1] is# l:prefix'
|
||||
|
||||
Save g:ale_c_build_dir
|
||||
unlet! g:ale_c_build_dir
|
||||
|
||||
" Save and clear linter variables.
|
||||
" We'll load the runtime file to reset them to defaults.
|
||||
for l:key in filter(keys(g:), b:filter_expr)
|
||||
execute 'Save g:' . l:key
|
||||
unlet g:[l:key]
|
||||
endfor
|
||||
|
||||
unlet! b:ale_c_build_dir
|
||||
|
||||
for l:key in filter(keys(b:), b:filter_expr)
|
||||
unlet b:[l:key]
|
||||
endfor
|
||||
|
||||
execute 'runtime ale_linters/' . a:filetype . '/' . a:name . '.vim'
|
||||
|
||||
call ale#test#SetDirectory('/testplugin/test/command_callback')
|
||||
|
||||
command! -nargs=+ WithChainResults :call ale#assert#WithChainResults(<args>)
|
||||
command! -nargs=+ AssertLinter :call ale#assert#Linter(<args>)
|
||||
command! -nargs=0 AssertLinterNotExecuted :call ale#assert#LinterNotExecuted()
|
||||
command! -nargs=+ AssertLSPOptions :call ale#assert#LSPOptions(<args>)
|
||||
command! -nargs=+ AssertLSPLanguage :call ale#assert#LSPLanguage(<args>)
|
||||
command! -nargs=+ AssertLSPProject :call ale#assert#LSPProject(<args>)
|
||||
endfunction
|
||||
|
||||
function! ale#assert#TearDownLinterTest() abort
|
||||
unlet! g:ale_create_dummy_temporary_file
|
||||
let s:chain_results = []
|
||||
|
||||
delcommand WithChainResults
|
||||
delcommand AssertLinter
|
||||
delcommand AssertLinterNotExecuted
|
||||
delcommand AssertLSPOptions
|
||||
delcommand AssertLSPLanguage
|
||||
delcommand AssertLSPProject
|
||||
|
||||
call ale#test#RestoreDirectory()
|
||||
|
||||
Restore
|
||||
|
||||
call ale#linter#Reset()
|
||||
|
||||
if exists('*ale#semver#ResetVersionCache')
|
||||
call ale#semver#ResetVersionCache()
|
||||
endif
|
||||
endfunction
|
|
@ -13,14 +13,14 @@ function! s:TemporaryFilename(buffer) abort
|
|||
|
||||
" Create a temporary filename, <temp_dir>/<original_basename>
|
||||
" The file itself will not be created by this function.
|
||||
return tempname() . (has('win32') ? '\' : '/') . l:filename
|
||||
return ale#util#Tempname() . (has('win32') ? '\' : '/') . l:filename
|
||||
endfunction
|
||||
|
||||
" Given a command string, replace every...
|
||||
" %s -> with the current filename
|
||||
" %t -> with the name of an unused file in a temporary directory
|
||||
" %% -> with a literal %
|
||||
function! ale#command#FormatCommand(buffer, command, pipe_file_if_needed) abort
|
||||
function! ale#command#FormatCommand(buffer, executable, command, pipe_file_if_needed) abort
|
||||
let l:temporary_file = ''
|
||||
let l:command = a:command
|
||||
|
||||
|
@ -28,6 +28,11 @@ function! ale#command#FormatCommand(buffer, command, pipe_file_if_needed) abort
|
|||
" with an ugly string.
|
||||
let l:command = substitute(l:command, '%%', '<<PERCENTS>>', 'g')
|
||||
|
||||
" Replace %e with the escaped executable, if available.
|
||||
if !empty(a:executable) && l:command =~# '%e'
|
||||
let l:command = substitute(l:command, '%e', '\=ale#Escape(a:executable)', 'g')
|
||||
endif
|
||||
|
||||
" Replace all %s occurrences in the string with the name of the current
|
||||
" file.
|
||||
if l:command =~# '%s'
|
||||
|
|
|
@ -1,6 +1,17 @@
|
|||
" Author: w0rp <devw0rp@gmail.com>
|
||||
" Description: Completion support for LSP linters
|
||||
|
||||
" The omnicompletion menu is shown through a special Plug mapping which is
|
||||
" only valid in Insert mode. This way, feedkeys() won't send these keys if you
|
||||
" quit Insert mode quickly enough.
|
||||
inoremap <silent> <Plug>(ale_show_completion_menu) <C-x><C-o>
|
||||
" If we hit the key sequence in normal mode, then we won't show the menu, so
|
||||
" we should restore the old settings right away.
|
||||
nnoremap <silent> <Plug>(ale_show_completion_menu) :call ale#completion#RestoreCompletionOptions()<CR>
|
||||
cnoremap <silent> <Plug>(ale_show_completion_menu) <Nop>
|
||||
vnoremap <silent> <Plug>(ale_show_completion_menu) <Nop>
|
||||
onoremap <silent> <Plug>(ale_show_completion_menu) <Nop>
|
||||
|
||||
let g:ale_completion_delay = get(g:, 'ale_completion_delay', 100)
|
||||
let g:ale_completion_excluded_words = get(g:, 'ale_completion_excluded_words', [])
|
||||
let g:ale_completion_max_suggestions = get(g:, 'ale_completion_max_suggestions', 50)
|
||||
|
@ -129,7 +140,16 @@ function! ale#completion#Filter(buffer, suggestions, prefix) abort
|
|||
return l:filtered_suggestions
|
||||
endfunction
|
||||
|
||||
function! s:ReplaceCompleteopt() abort
|
||||
function! s:ReplaceCompletionOptions() abort
|
||||
" Remember the old omnifunc value, if there is one.
|
||||
" If we don't store an old one, we'll just never reset the option.
|
||||
" This will stop some random exceptions from appearing.
|
||||
if !exists('b:ale_old_omnifunc') && !empty(&l:omnifunc)
|
||||
let b:ale_old_omnifunc = &l:omnifunc
|
||||
endif
|
||||
|
||||
let &l:omnifunc = 'ale#completion#OmniFunc'
|
||||
|
||||
if !exists('b:ale_old_completopt')
|
||||
let b:ale_old_completopt = &l:completeopt
|
||||
endif
|
||||
|
@ -141,6 +161,22 @@ function! s:ReplaceCompleteopt() abort
|
|||
endif
|
||||
endfunction
|
||||
|
||||
function! ale#completion#RestoreCompletionOptions() abort
|
||||
" Reset settings when completion is done.
|
||||
if exists('b:ale_old_omnifunc')
|
||||
if b:ale_old_omnifunc isnot# 'pythoncomplete#Complete'
|
||||
let &l:omnifunc = b:ale_old_omnifunc
|
||||
endif
|
||||
|
||||
unlet b:ale_old_omnifunc
|
||||
endif
|
||||
|
||||
if exists('b:ale_old_completopt')
|
||||
let &l:completeopt = b:ale_old_completopt
|
||||
unlet b:ale_old_completopt
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! ale#completion#OmniFunc(findstart, base) abort
|
||||
if a:findstart
|
||||
let l:line = b:ale_completion_info.line
|
||||
|
@ -163,33 +199,30 @@ function! ale#completion#OmniFunc(findstart, base) abort
|
|||
let b:ale_completion_result = function(l:parser)(l:response)
|
||||
endif
|
||||
|
||||
call s:ReplaceCompleteopt()
|
||||
call s:ReplaceCompletionOptions()
|
||||
|
||||
return get(b:, 'ale_completion_result', [])
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! ale#completion#Show(response, completion_parser) abort
|
||||
" Remember the old omnifunc value, if there is one.
|
||||
" If we don't store an old one, we'll just never reset the option.
|
||||
" This will stop some random exceptions from appearing.
|
||||
if !exists('b:ale_old_omnifunc') && !empty(&l:omnifunc)
|
||||
let b:ale_old_omnifunc = &l:omnifunc
|
||||
if ale#util#Mode() isnot# 'i'
|
||||
return
|
||||
endif
|
||||
|
||||
" Set the list in the buffer, temporarily replace omnifunc with our
|
||||
" function, and then start omni-completion.
|
||||
let b:ale_completion_response = a:response
|
||||
let b:ale_completion_parser = a:completion_parser
|
||||
let &l:omnifunc = 'ale#completion#OmniFunc'
|
||||
call s:ReplaceCompleteopt()
|
||||
call ale#util#FeedKeys("\<C-x>\<C-o>", 'n')
|
||||
call s:ReplaceCompletionOptions()
|
||||
call ale#util#FeedKeys("\<Plug>(ale_show_completion_menu)")
|
||||
endfunction
|
||||
|
||||
function! s:CompletionStillValid(request_id) abort
|
||||
let [l:line, l:column] = getcurpos()[1:2]
|
||||
|
||||
return has_key(b:, 'ale_completion_info')
|
||||
return ale#util#Mode() is# 'i'
|
||||
\&& has_key(b:, 'ale_completion_info')
|
||||
\&& b:ale_completion_info.request_id == a:request_id
|
||||
\&& b:ale_completion_info.line == l:line
|
||||
\&& b:ale_completion_info.column == l:column
|
||||
|
@ -477,7 +510,7 @@ function! s:TimerHandler(...) abort
|
|||
|
||||
" When running the timer callback, we have to be sure that the cursor
|
||||
" hasn't moved from where it was when we requested completions by typing.
|
||||
if s:timer_pos == [l:line, l:column]
|
||||
if s:timer_pos == [l:line, l:column] && ale#util#Mode() is# 'i'
|
||||
call ale#completion#GetCompletions()
|
||||
endif
|
||||
endfunction
|
||||
|
@ -518,19 +551,7 @@ endfunction
|
|||
function! ale#completion#Done() abort
|
||||
silent! pclose
|
||||
|
||||
" Reset settings when completion is done.
|
||||
if exists('b:ale_old_omnifunc')
|
||||
if b:ale_old_omnifunc isnot# 'pythoncomplete#Complete'
|
||||
let &l:omnifunc = b:ale_old_omnifunc
|
||||
endif
|
||||
|
||||
unlet b:ale_old_omnifunc
|
||||
endif
|
||||
|
||||
if exists('b:ale_old_completopt')
|
||||
let &l:completeopt = b:ale_old_completopt
|
||||
unlet b:ale_old_completopt
|
||||
endif
|
||||
call ale#completion#RestoreCompletionOptions()
|
||||
|
||||
let s:last_done_pos = getcurpos()[1:2]
|
||||
endfunction
|
||||
|
|
|
@ -96,9 +96,26 @@ function! ale#engine#ManageDirectory(buffer, directory) abort
|
|||
call add(g:ale_buffer_info[a:buffer].temporary_directory_list, a:directory)
|
||||
endfunction
|
||||
|
||||
function! ale#engine#CreateFile(buffer) abort
|
||||
" This variable can be set to 1 in tests to stub this out.
|
||||
if get(g:, 'ale_create_dummy_temporary_file')
|
||||
return 'TEMP'
|
||||
endif
|
||||
|
||||
let l:temporary_file = ale#util#Tempname()
|
||||
call ale#engine#ManageFile(a:buffer, l:temporary_file)
|
||||
|
||||
return l:temporary_file
|
||||
endfunction
|
||||
|
||||
" Create a new temporary directory and manage it in one go.
|
||||
function! ale#engine#CreateDirectory(buffer) abort
|
||||
let l:temporary_directory = tempname()
|
||||
" This variable can be set to 1 in tests to stub this out.
|
||||
if get(g:, 'ale_create_dummy_temporary_file')
|
||||
return 'TEMP_DIR'
|
||||
endif
|
||||
|
||||
let l:temporary_directory = ale#util#Tempname()
|
||||
" Create the temporary directory for the file, unreadable by 'other'
|
||||
" users.
|
||||
call mkdir(l:temporary_directory, '', 0750)
|
||||
|
@ -189,6 +206,7 @@ function! s:HandleExit(job_id, exit_code) abort
|
|||
let l:linter = l:job_info.linter
|
||||
let l:output = l:job_info.output
|
||||
let l:buffer = l:job_info.buffer
|
||||
let l:executable = l:job_info.executable
|
||||
let l:next_chain_index = l:job_info.next_chain_index
|
||||
|
||||
if g:ale_history_enabled
|
||||
|
@ -212,7 +230,7 @@ function! s:HandleExit(job_id, exit_code) abort
|
|||
endif
|
||||
|
||||
if l:next_chain_index < len(get(l:linter, 'command_chain', []))
|
||||
call s:InvokeChain(l:buffer, l:linter, l:next_chain_index, l:output)
|
||||
call s:InvokeChain(l:buffer, l:executable, l:linter, l:next_chain_index, l:output)
|
||||
return
|
||||
endif
|
||||
|
||||
|
@ -221,7 +239,12 @@ function! s:HandleExit(job_id, exit_code) abort
|
|||
call ale#history#RememberOutput(l:buffer, a:job_id, l:output[:])
|
||||
endif
|
||||
|
||||
let l:loclist = ale#util#GetFunction(l:linter.callback)(l:buffer, l:output)
|
||||
try
|
||||
let l:loclist = ale#util#GetFunction(l:linter.callback)(l:buffer, l:output)
|
||||
" Handle the function being unknown, or being deleted.
|
||||
catch /E700/
|
||||
let l:loclist = []
|
||||
endtry
|
||||
|
||||
call ale#engine#HandleLoclist(l:linter.name, l:buffer, l:loclist)
|
||||
endfunction
|
||||
|
@ -440,6 +463,12 @@ endfunction
|
|||
" Returns 1 when the job was started successfully.
|
||||
function! s:RunJob(options) abort
|
||||
let l:command = a:options.command
|
||||
|
||||
if empty(l:command)
|
||||
return 0
|
||||
endif
|
||||
|
||||
let l:executable = a:options.executable
|
||||
let l:buffer = a:options.buffer
|
||||
let l:linter = a:options.linter
|
||||
let l:output_stream = a:options.output_stream
|
||||
|
@ -447,11 +476,12 @@ function! s:RunJob(options) abort
|
|||
let l:read_buffer = a:options.read_buffer
|
||||
let l:info = g:ale_buffer_info[l:buffer]
|
||||
|
||||
if empty(l:command)
|
||||
return 0
|
||||
endif
|
||||
|
||||
let [l:temporary_file, l:command] = ale#command#FormatCommand(l:buffer, l:command, l:read_buffer)
|
||||
let [l:temporary_file, l:command] = ale#command#FormatCommand(
|
||||
\ l:buffer,
|
||||
\ l:executable,
|
||||
\ l:command,
|
||||
\ l:read_buffer,
|
||||
\)
|
||||
|
||||
if s:CreateTemporaryFileForJob(l:buffer, l:temporary_file)
|
||||
" If a temporary filename has been formatted in to the command, then
|
||||
|
@ -512,6 +542,7 @@ function! s:RunJob(options) abort
|
|||
let s:job_info_map[l:job_id] = {
|
||||
\ 'linter': l:linter,
|
||||
\ 'buffer': l:buffer,
|
||||
\ 'executable': l:executable,
|
||||
\ 'output': [],
|
||||
\ 'next_chain_index': l:next_chain_index,
|
||||
\}
|
||||
|
@ -604,8 +635,9 @@ function! ale#engine#ProcessChain(buffer, linter, chain_index, input) abort
|
|||
\}
|
||||
endfunction
|
||||
|
||||
function! s:InvokeChain(buffer, linter, chain_index, input) abort
|
||||
function! s:InvokeChain(buffer, executable, linter, chain_index, input) abort
|
||||
let l:options = ale#engine#ProcessChain(a:buffer, a:linter, a:chain_index, a:input)
|
||||
let l:options.executable = a:executable
|
||||
|
||||
return s:RunJob(l:options)
|
||||
endfunction
|
||||
|
@ -699,7 +731,7 @@ function! s:RunLinter(buffer, linter) abort
|
|||
let l:executable = ale#linter#GetExecutable(a:buffer, a:linter)
|
||||
|
||||
if ale#engine#IsExecutable(a:buffer, l:executable)
|
||||
return s:InvokeChain(a:buffer, a:linter, 0, [])
|
||||
return s:InvokeChain(a:buffer, l:executable, a:linter, 0, [])
|
||||
endif
|
||||
endif
|
||||
|
||||
|
|
|
@ -39,35 +39,48 @@ function! ale#events#SaveEvent(buffer) abort
|
|||
endif
|
||||
endfunction
|
||||
|
||||
function! s:LintOnEnter(buffer) abort
|
||||
if ale#Var(a:buffer, 'enabled')
|
||||
\&& g:ale_lint_on_enter
|
||||
\&& has_key(b:, 'ale_file_changed')
|
||||
call remove(b:, 'ale_file_changed')
|
||||
function! ale#events#LintOnEnter(buffer) abort
|
||||
" Unmark a file as being changed outside of Vim after we try to check it.
|
||||
call setbufvar(a:buffer, 'ale_file_changed', 0)
|
||||
|
||||
if ale#Var(a:buffer, 'enabled') && g:ale_lint_on_enter
|
||||
call ale#Queue(0, 'lint_file', a:buffer)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! ale#events#EnterEvent(buffer) abort
|
||||
function! ale#events#ReadOrEnterEvent(buffer) abort
|
||||
" Apply pattern options if the variable is set.
|
||||
if get(g:, 'ale_pattern_options_enabled', 1)
|
||||
\&& !empty(get(g:, 'ale_pattern_options'))
|
||||
call ale#pattern_options#SetOptions(a:buffer)
|
||||
endif
|
||||
|
||||
" When entering a buffer, we are no longer quitting it.
|
||||
call setbufvar(a:buffer, 'ale_quitting', 0)
|
||||
let l:filetype = getbufvar(a:buffer, '&filetype')
|
||||
call setbufvar(a:buffer, 'ale_original_filetype', l:filetype)
|
||||
|
||||
call s:LintOnEnter(a:buffer)
|
||||
" If the file changed outside of Vim, check it on BufEnter,BufRead
|
||||
if getbufvar(a:buffer, 'ale_file_changed')
|
||||
call ale#events#LintOnEnter(a:buffer)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! ale#events#FileTypeEvent(buffer, new_filetype) abort
|
||||
let l:filetype = getbufvar(a:buffer, 'ale_original_filetype', '')
|
||||
" The old filetype will be set to an empty string by the BuFEnter event,
|
||||
" and not linting when the old filetype hasn't been set yet prevents
|
||||
" buffers being checked when you enter them when linting on enter is off.
|
||||
let l:old_filetype = getbufvar(a:buffer, 'ale_original_filetype', v:null)
|
||||
|
||||
" If we're setting the filetype for the first time after it was blank,
|
||||
" and the option for linting on enter is off, then we should set this
|
||||
" filetype as the original filetype. Otherwise ALE will still appear to
|
||||
" lint files because of the BufEnter event, etc.
|
||||
if empty(l:filetype) && !ale#Var(a:buffer, 'lint_on_enter')
|
||||
if l:old_filetype isnot v:null
|
||||
\&& !empty(a |