mirror of
https://github.com/dense-analysis/ale.git
synced 2026-03-01 21:07:00 +08:00
Break shared handlers up into their own files, and fix stylelint error handling
This commit is contained in:
28
autoload/ale/handlers/unix.vim
Normal file
28
autoload/ale/handlers/unix.vim
Normal 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
|
||||
Reference in New Issue
Block a user