Break shared handlers up into their own files, and fix stylelint error handling

This commit is contained in:
w0rp
2017-04-24 22:27:18 +01:00
parent b4c0335ebc
commit a03121f5b0
44 changed files with 263 additions and 272 deletions

View File

@@ -0,0 +1,28 @@
" Author: w0rp <devw0rp@gmail.com>
" Description: Error handling for errors in a Unix format.
let s:path_pattern = '[a-zA-Z]\?\\\?:\?[[:alnum:]/\.\-_]\+'
function! s:HandleUnixFormat(buffer, lines, type) abort
let l:pattern = '^' . s:path_pattern . ':\(\d\+\):\?\(\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[3],
\ 'type': a:type,
\})
endfor
return l:output
endfunction
function! ale#handlers#unix#HandleAsError(buffer, lines) abort
return s:HandleUnixFormat(a:buffer, a:lines, 'E')
endfunction
function! ale#handlers#unix#HandleAsWarning(buffer, lines) abort
return s:HandleUnixFormat(a:buffer, a:lines, 'W')
endfunction