2018-03-31 10:55:20 -04:00
|
|
|
" Author: RyanSquared <vandor2012@gmail.com>
|
|
|
|
" Description: `fusion-lint` linter for FusionScript files
|
|
|
|
|
2018-07-19 08:52:53 -04:00
|
|
|
call ale#Set('fuse_fusionlint_executable', 'fusion-lint')
|
|
|
|
call ale#Set('fuse_fusionlint_options', '')
|
2018-03-31 10:55:20 -04:00
|
|
|
|
|
|
|
function! ale_linters#fuse#fusionlint#GetCommand(buffer) abort
|
2018-08-25 12:13:42 -04:00
|
|
|
return '%e' . ale#Pad(ale#Var(a:buffer, 'fuse_fusionlint_options'))
|
2018-03-31 10:55:20 -04:00
|
|
|
\ . ' --filename %s -i'
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
function! ale_linters#fuse#fusionlint#Handle(buffer, lines) abort
|
|
|
|
let l:pattern = '^.*:\(\d\+\):\(\d\+\): (\([WE]\)\d\+) \(.\+\)$'
|
|
|
|
let l:output = []
|
|
|
|
|
|
|
|
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
|
|
|
call add(l:output, {
|
|
|
|
\ 'lnum': l:match[1] + 0,
|
|
|
|
\ 'col': l:match[2] + 0,
|
|
|
|
\ 'text': l:match[4],
|
|
|
|
\ 'type': l:match[3],
|
|
|
|
\})
|
|
|
|
endfor
|
|
|
|
|
|
|
|
return l:output
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
call ale#linter#Define('fuse', {
|
|
|
|
\ 'name': 'fusionlint',
|
2019-03-08 06:04:56 -05:00
|
|
|
\ 'executable': {b -> ale#Var(b, 'fuse_fusionlint_executable')},
|
|
|
|
\ 'command': function('ale_linters#fuse#fusionlint#GetCommand'),
|
2018-03-31 10:55:20 -04:00
|
|
|
\ 'callback': 'ale_linters#fuse#fusionlint#Handle',
|
|
|
|
\})
|