diff options
author | diartyz <diartyz@gmail.com> | 2016-12-06 21:14:14 +0800 |
---|---|---|
committer | diartyz <diartyz@gmail.com> | 2016-12-06 21:14:14 +0800 |
commit | 725957de6e8cdbe9ca9d295e2e5ae273260e6c7a (patch) | |
tree | ad6354af2204ea639cfddea5cc22ac4e45ebe187 /autoload | |
parent | 1a749a6b433815a90b4bb9e2c31a442e8b685006 (diff) | |
download | ale-725957de6e8cdbe9ca9d295e2e5ae273260e6c7a.zip |
add stylelint support
Diffstat (limited to 'autoload')
-rw-r--r-- | autoload/ale/handlers.vim | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/autoload/ale/handlers.vim b/autoload/ale/handlers.vim index 177cdc43..526b9b56 100644 --- a/autoload/ale/handlers.vim +++ b/autoload/ale/handlers.vim @@ -181,3 +181,37 @@ function! ale#handlers#HandleCSSLintFormat(buffer, lines) abort return l:output endfunction + +function! ale#handlers#HandleStyleLintFormat(buffer, lines) abort + " Matches patterns line the following: + " + " src/main.css + " 108:10 ✖ Unexpected leading zero number-leading-zero + " 116:20 ✖ Expected a trailing semicolon declaration-block-trailing-semicolon + let l:pattern = '^.* \(\d\+\):\(\d\+\) \s\+\(\S\+\)\s\+ \(\u.\+\) \(.\+\)$' + let l:output = [] + + for l:line in a:lines + let l:match = matchlist(l:line, l:pattern) + + if len(l:match) == 0 + continue + endif + + let l:text = l:match[4] + let l:type = l:match[3] + + " vcol is Needed to indicate that the column is a character. + call add(l:output, { + \ 'bufnr': a:buffer, + \ 'lnum': l:match[1] + 0, + \ 'vcol': 0, + \ 'col': l:match[2] + 0, + \ 'text': l:text, + \ 'type': l:type ==# '✖' ? 'E' : 'W', + \ 'nr': -1, + \}) + endfor + + return l:output +endfunction |