mirror of
https://github.com/amix/vimrc
synced 2025-06-16 09:35:01 +08:00
plugins update
This commit is contained in:
@ -11,26 +11,35 @@ let g:ale_kotlin_kotlinc_module_filename = get(g:, 'ale_kotlin_kotlinc_module_fi
|
||||
|
||||
let s:classpath_sep = has('unix') ? ':' : ';'
|
||||
|
||||
function! ale_linters#kotlin#kotlinc#GetImportPaths(buffer) abort
|
||||
function! ale_linters#kotlin#kotlinc#RunWithImportPaths(buffer) abort
|
||||
let l:command = ''
|
||||
|
||||
" exec maven/gradle only if classpath is not set
|
||||
if ale#Var(a:buffer, 'kotlin_kotlinc_classpath') isnot# ''
|
||||
return ''
|
||||
else
|
||||
let l:pom_path = ale#path#FindNearestFile(a:buffer, 'pom.xml')
|
||||
|
||||
if !empty(l:pom_path) && executable('mvn')
|
||||
return ale#path#CdString(fnamemodify(l:pom_path, ':h'))
|
||||
\ . 'mvn dependency:build-classpath'
|
||||
endif
|
||||
|
||||
let l:classpath_command = ale#gradle#BuildClasspathCommand(a:buffer)
|
||||
|
||||
if !empty(l:classpath_command)
|
||||
return l:classpath_command
|
||||
endif
|
||||
|
||||
return ''
|
||||
return ale_linters#kotlin#kotlinc#GetCommand(a:buffer, [], {})
|
||||
endif
|
||||
|
||||
let l:pom_path = ale#path#FindNearestFile(a:buffer, 'pom.xml')
|
||||
|
||||
if !empty(l:pom_path) && executable('mvn')
|
||||
let l:command = ale#path#CdString(fnamemodify(l:pom_path, ':h'))
|
||||
\ . 'mvn dependency:build-classpath'
|
||||
endif
|
||||
|
||||
" Try to use Gradle if Maven isn't available.
|
||||
if empty(l:command)
|
||||
let l:command = ale#gradle#BuildClasspathCommand(a:buffer)
|
||||
endif
|
||||
|
||||
if empty(l:command)
|
||||
return ale_linters#kotlin#kotlinc#GetCommand(a:buffer, [], {})
|
||||
endif
|
||||
|
||||
return ale#command#Run(
|
||||
\ a:buffer,
|
||||
\ l:command,
|
||||
\ function('ale_linters#kotlin#kotlinc#GetCommand')
|
||||
\)
|
||||
endfunction
|
||||
|
||||
function! s:BuildClassPathOption(buffer, import_paths) abort
|
||||
@ -46,7 +55,7 @@ function! s:BuildClassPathOption(buffer, import_paths) abort
|
||||
\ : ''
|
||||
endfunction
|
||||
|
||||
function! ale_linters#kotlin#kotlinc#GetCommand(buffer, import_paths) abort
|
||||
function! ale_linters#kotlin#kotlinc#GetCommand(buffer, import_paths, meta) abort
|
||||
let l:kotlinc_opts = ale#Var(a:buffer, 'kotlin_kotlinc_options')
|
||||
let l:command = 'kotlinc '
|
||||
|
||||
@ -165,11 +174,7 @@ endfunction
|
||||
call ale#linter#Define('kotlin', {
|
||||
\ 'name': 'kotlinc',
|
||||
\ 'executable': 'kotlinc',
|
||||
\ 'command_chain': [
|
||||
\ {'callback': 'ale_linters#kotlin#kotlinc#GetImportPaths', 'output_stream': 'stdout'},
|
||||
\ {'callback': 'ale_linters#kotlin#kotlinc#GetCommand', 'output_stream': 'stderr'},
|
||||
\ ],
|
||||
\ 'command': function('ale_linters#kotlin#kotlinc#RunWithImportPaths'),
|
||||
\ 'callback': 'ale_linters#kotlin#kotlinc#Handle',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
||||
|
||||
|
Reference in New Issue
Block a user