aboutsummaryrefslogtreecommitdiff
path: root/.vim/autoload/neomake/makers/ft/lua.vim
blob: c0e6bce72a0f91bc8d61cc233c171aaaf0c8623d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
function! neomake#makers#ft#lua#EnabledMakers() abort
    return executable('luacheck') ? ['luacheck'] : ['luac']
endfunction

" luacheck: postprocess: use pattern (%s) for end column.
function! neomake#makers#ft#lua#PostprocessLuacheck(entry) abort
    let end_col = matchstr(a:entry.pattern, '\v\d+')
    if !empty(end_col)
        let a:entry.length = end_col - a:entry.col + 1
    else
        echom 'luacheck: no end_col: '.string(a:entry)
    endif
    let a:entry.pattern = ''
endfunction

function! neomake#makers#ft#lua#luacheck() abort
    " cwd: luacheck looks for .luacheckrc upwards from there.
    return {
        \ 'args': ['--no-color', '--formatter=plain', '--ranges', '--codes', '--filename', '%:p'],
        \ 'cwd': '%:p:h',
        \ 'errorformat': '%E%f:%l:%c-%s: \(%t%n\) %m',
        \ 'postprocess': function('neomake#makers#ft#lua#PostprocessLuacheck'),
        \ 'supports_stdin': 1,
        \ }
endfunction

function! neomake#makers#ft#lua#luac() abort
    return {
        \ 'args': ['-p'],
        \ 'errorformat': '%*\f: %#%f:%l: %m',
        \ }
endfunction
" vim: ts=4 sw=4 et