summaryrefslogtreecommitdiff
path: root/ale_linters/zig
diff options
context:
space:
mode:
authorSheheryar Parvaz <skipper308@hotmail.ca>2020-07-10 20:14:12 -0400
committerSheheryar Parvaz <skipper308@hotmail.ca>2020-07-10 22:33:37 -0400
commit23c58e63d426770cf3233553450acfdcd3a73525 (patch)
treeeb42abc92a33a175c48dc51ea8eee7e39fbd2054 /ale_linters/zig
parent106c27644b4ff7543d600ae54ab9c53bec909828 (diff)
downloadale-23c58e63d426770cf3233553450acfdcd3a73525.zip
Support zls language server for zig
Diffstat (limited to 'ale_linters/zig')
-rw-r--r--ale_linters/zig/zls.vim20
1 files changed, 20 insertions, 0 deletions
diff --git a/ale_linters/zig/zls.vim b/ale_linters/zig/zls.vim
new file mode 100644
index 00000000..1390f6b1
--- /dev/null
+++ b/ale_linters/zig/zls.vim
@@ -0,0 +1,20 @@
+" Author: CherryMan <skipper308@hotmail.ca>
+" Description: A language server for Zig
+
+call ale#Set('zig_zls_executable', 'zls')
+call ale#Set('zig_zls_config', {})
+
+function! ale_linters#zig#zls#GetProjectRoot(buffer) abort
+ let l:build_rs = ale#path#FindNearestFile(a:buffer, 'build.zig')
+
+ return !empty(l:build_rs) ? fnamemodify(l:build_rs, ':h') : ''
+endfunction
+
+call ale#linter#Define('zig', {
+\ 'name': 'zls',
+\ 'lsp': 'stdio',
+\ 'lsp_config': {b -> ale#Var(b, 'zig_zls_config')},
+\ 'executable': {b -> ale#Var(b, 'zig_zls_executable')},
+\ 'command': '%e',
+\ 'project_root': function('ale_linters#zig#zls#GetProjectRoot'),
+\})