summaryrefslogtreecommitdiff
path: root/ale_linters/yang/yang_lsp.vim
blob: 81fcaa0e63101b420ab1ceb5982ccf8c90984d0e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
call ale#Set('yang_lsp_executable', 'yang-language-server')

function! ale_linters#yang#yang_lsp#GetProjectRoot(buffer) abort
    let l:project_root = ale#path#FindNearestFile(a:buffer, 'yang.settings')

    return !empty(l:project_root) ? fnamemodify(l:project_root, ':h') : ''
endfunction

call ale#linter#Define('yang', {
\   'name': 'yang_lsp',
\   'lsp': 'stdio',
\   'executable': {b -> ale#Var(b, 'yang_lsp_executable')},
\   'project_root': function('ale_linters#yang#yang_lsp#GetProjectRoot'),
\   'command': '%e',
\})