vim_config/config/after/ale.vim

41 lines
1.1 KiB
VimL
Raw Permalink Normal View History

function! s:getValaProjectRoot(buffer) abort
let l:cur_path_abs = fnamemodify(a:buffer, ':p:h')
let l:maybe_doap_file = expand(l:cur_path_abs . s:sep . '*.doap')
if !empty(l:maybe_doap_file)
return l:cur_path_abs
endif
for l:path in ale#path#Upwards(expand('#' . a:buffer . ':p:h'))
if filereadable(expand(l:path . '*.doap'))
return l:path
endif
endfor
return ''
endfunction
function! s:curPath(buffer) abort
let l:cur_path = fnamemodify(a:buffer, ':p:h')
return l:cur_path
endfunction
call ale#linter#Define('vala', {
\ 'name': 'vala-language-server',
\ 'lsp': 'stdio',
\ 'output_stream': 'both',
\ 'executable': '/usr/bin/vala-language-server',
\ 'command': '%e',
\ 'project_root': function('s:getValaProjectRoot'),
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
\})
call ale#linter#Define('promql', {
\ 'name': 'promql-langserver',
\ 'lsp': 'stdio',
\ 'output_stream': 'both',
\ 'executable': '/usr/local/bin/promql-langserver',
\ 'command': '%e',
\ 'project_root': function('s:curPath'),
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
\})