summaryrefslogtreecommitdiff
path: root/ale_linters/yang
diff options
context:
space:
mode:
authorBjorn Neergaard <bjorn@neersighted.com>2018-11-29 14:57:35 -0700
committerBjorn Neergaard <bjorn@neersighted.com>2018-11-29 14:57:35 -0700
commitd2b0ae8108b2ee395d4eb43c49d68b322a023a30 (patch)
treebb8145e69bf1bcb8968b29cb1a68c47ceb83674d /ale_linters/yang
parentef641dda80f45cb979bc93c2513c6e10cbd8e42a (diff)
parent0a384a49d371838903d8401c5358ec60f3f4266d (diff)
downloadale-d2b0ae8108b2ee395d4eb43c49d68b322a023a30.zip
Merge branch 'master' into sridhars
Diffstat (limited to 'ale_linters/yang')
-rw-r--r--ale_linters/yang/yang_lsp.vim15
1 files changed, 15 insertions, 0 deletions
diff --git a/ale_linters/yang/yang_lsp.vim b/ale_linters/yang/yang_lsp.vim
new file mode 100644
index 00000000..45776f98
--- /dev/null
+++ b/ale_linters/yang/yang_lsp.vim
@@ -0,0 +1,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_callback': ale#VarFunc('yang_lsp_executable'),
+\ 'project_root_callback': 'ale_linters#yang#yang_lsp#GetProjectRoot',
+\ 'command': '%e',
+\})