2018-08-03 15:59:32 -04:00
|
|
|
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')
|
2018-09-04 11:51:18 -04:00
|
|
|
|
2018-08-03 15:59:32 -04:00
|
|
|
return !empty(l:project_root) ? fnamemodify(l:project_root, ':h') : ''
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
call ale#linter#Define('yang', {
|
|
|
|
\ 'name': 'yang_lsp',
|
|
|
|
\ 'lsp': 'stdio',
|
2019-02-22 13:05:04 -05:00
|
|
|
\ 'executable': {b -> ale#Var(b, 'yang_lsp_executable')},
|
|
|
|
\ 'project_root': function('ale_linters#yang#yang_lsp#GetProjectRoot'),
|
2018-08-03 15:59:32 -04:00
|
|
|
\ 'command': '%e',
|
|
|
|
\})
|