X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/0ee596c5c5e11fc79598407eaf22f83d279f7e9e..5a4872f466ebd76ddd532bdf2798554421c53df4:/.vim/bundle/ale/ale_linters/zig/zlint.vim?ds=sidebyside diff --git a/.vim/bundle/ale/ale_linters/zig/zlint.vim b/.vim/bundle/ale/ale_linters/zig/zlint.vim new file mode 100644 index 00000000..b7be1e22 --- /dev/null +++ b/.vim/bundle/ale/ale_linters/zig/zlint.vim @@ -0,0 +1,30 @@ +" Author: Don Isaac +" Description: A linter for the Zig programming language + +call ale#Set('zig_zlint_executable', 'zlint') + +function! ale_linters#zig#zlint#Handle(buffer, lines) abort + " GitHub Actions format: ::severity file=file,line=line,col=col,title=code::message + let l:pattern = '::\([a-z]\+\) file=\([^,]\+\),line=\(\d\+\),col=\(\d\+\),title=\([^:]\+\)::\(.*\)' + let l:output = [] + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + call add(l:output, { + \ 'filename': l:match[2], + \ 'lnum': str2nr(l:match[3]), + \ 'col': str2nr(l:match[4]), + \ 'text': l:match[6], + \ 'type': l:match[1] =~? 'error\|fail' ? 'E' : 'W', + \ 'code': l:match[5], + \}) + endfor + + return l:output +endfunction + +call ale#linter#Define('zig', { +\ 'name': 'zlint', +\ 'executable': {b -> ale#Var(b, "zig_zlint_executable")}, +\ 'command': '%e %s -f gh', +\ 'callback': 'ale_linters#zig#zlint#Handle', +\})