summaryrefslogtreecommitdiff
path: root/ale_linters/zig/zls.vim
blob: 1390f6b1d423e3fff821129ea5b0d32b2ec24bd0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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'),
\})