diff options
Diffstat (limited to 'ale_linters/kotlin')
-rw-r--r-- | ale_linters/kotlin/kotlinc.vim | 7 | ||||
-rw-r--r-- | ale_linters/kotlin/languageserver.vim | 13 |
2 files changed, 8 insertions, 12 deletions
diff --git a/ale_linters/kotlin/kotlinc.vim b/ale_linters/kotlin/kotlinc.vim index 00f94be5..4a993986 100644 --- a/ale_linters/kotlin/kotlinc.vim +++ b/ale_linters/kotlin/kotlinc.vim @@ -17,12 +17,14 @@ function! ale_linters#kotlin#kotlinc#GetImportPaths(buffer) abort 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 @@ -78,12 +80,13 @@ function! ale_linters#kotlin#kotlinc#GetCommand(buffer, import_paths) abort endif let l:fname = '' + if ale#Var(a:buffer, 'kotlin_kotlinc_sourcepath') isnot# '' let l:fname .= expand(ale#Var(a:buffer, 'kotlin_kotlinc_sourcepath'), 1) . ' ' else " Find the src directory for files in this project. - let l:project_root = ale#gradle#FindProjectRoot(a:buffer) + if !empty(l:project_root) let l:src_dir = l:project_root else @@ -93,6 +96,7 @@ function! ale_linters#kotlin#kotlinc#GetCommand(buffer, import_paths) abort let l:fname .= expand(l:src_dir, 1) . ' ' endif + let l:fname .= ale#Escape(expand('#' . a:buffer . ':p')) let l:command .= l:kotlinc_opts . ' ' . l:fname @@ -124,6 +128,7 @@ function! ale_linters#kotlin#kotlinc#Handle(buffer, lines) abort if l:buf_abspath isnot# l:curbuf_abspath continue endif + let l:type_marker_str = l:type is# 'warning' ? 'W' : 'E' call add(l:output, { diff --git a/ale_linters/kotlin/languageserver.vim b/ale_linters/kotlin/languageserver.vim index 0ab673ec..aea817ba 100644 --- a/ale_linters/kotlin/languageserver.vim +++ b/ale_linters/kotlin/languageserver.vim @@ -3,15 +3,6 @@ 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) @@ -31,8 +22,8 @@ endfunction call ale#linter#Define('kotlin', { \ 'name': 'languageserver', \ 'lsp': 'stdio', -\ 'executable_callback': 'ale_linters#kotlin#languageserver#GetExecutable', -\ 'command_callback': 'ale_linters#kotlin#languageserver#GetCommand', +\ 'executable_callback': ale#VarFunc('kotlin_languageserver_executable'), +\ 'command': '%e', \ 'language': 'kotlin', \ 'project_root_callback': 'ale_linters#kotlin#languageserver#GetProjectRoot', \}) |