2018-07-15 17:54:18 +00:00
|
|
|
" 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#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',
|
2023-09-13 23:38:12 +00:00
|
|
|
\ 'aliaes': ['kotlin_language_server'],
|
2018-07-15 17:54:18 +00:00
|
|
|
\ 'lsp': 'stdio',
|
2019-02-22 18:05:04 +00:00
|
|
|
\ 'executable': {b -> ale#Var(b, 'kotlin_languageserver_executable')},
|
2018-08-24 09:41:33 +00:00
|
|
|
\ 'command': '%e',
|
2018-07-15 17:54:18 +00:00
|
|
|
\ 'language': 'kotlin',
|
2019-02-22 18:05:04 +00:00
|
|
|
\ 'project_root': function('ale_linters#kotlin#languageserver#GetProjectRoot'),
|
2018-07-15 17:54:18 +00:00
|
|
|
\})
|