diff --git a/autoload/syntastic/preprocess.vim b/autoload/syntastic/preprocess.vim index 433ed146..36d8059b 100644 --- a/autoload/syntastic/preprocess.vim +++ b/autoload/syntastic/preprocess.vim @@ -284,6 +284,42 @@ function! syntastic#preprocess#rparse(errors) abort " {{{2 return out endfunction " }}}2 +function! syntastic#preprocess#scss_lint(errors) abort " {{{2 + let errs = join(a:errors, '') + if errs ==# '' + return [] + endif + + let json = s:_decode_JSON(errs) + + let out = [] + if type(json) == type({}) + for fname in keys(json) + if type(json[fname]) == type([]) + for e in json[fname] + try + cal add(out, fname . ':' . + \ e['severity'][0] . ':' . + \ e['line'] . ':' . + \ e['column'] . ':' . + \ e['length'] . ':' . + \ ( has_key(e, 'linter') ? e['linter'] . ': ' : '' ) . + \ e['reason']) + catch /\m^Vim\%((\a\+)\)\=:E716/ + call syntastic#log#warn('checker scss/scss_lint: unrecognized error item ' . string(e)) + let out = [] + endtry + endfor + else + call syntastic#log#warn('checker scss/scss_lint: unrecognized error format') + endif + endfor + else + call syntastic#log#warn('checker scss/scss_lint: unrecognized error format') + endif + return out +endfunction " }}}2 + function! syntastic#preprocess#stylelint(errors) abort " {{{2 let out = [] diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 8778698e..1cd1b5bf 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -19,7 +19,7 @@ if has('reltime') lockvar! g:_SYNTASTIC_START endif -let g:_SYNTASTIC_VERSION = '3.7.0-73' +let g:_SYNTASTIC_VERSION = '3.7.0-74' lockvar g:_SYNTASTIC_VERSION " Sanity checks {{{1 diff --git a/syntax_checkers/scss/scss_lint.vim b/syntax_checkers/scss/scss_lint.vim index f292554f..c0f921af 100644 --- a/syntax_checkers/scss/scss_lint.vim +++ b/syntax_checkers/scss/scss_lint.vim @@ -21,21 +21,28 @@ function! SyntaxCheckers_scss_scss_lint_IsAvailable() dict if !executable(self.getExec()) return 0 endif - return syntastic#util#versionIsAtLeast(self.getVersion(), [0, 12]) + return syntastic#util#versionIsAtLeast(self.getVersion(), [0, 29]) endfunction function! SyntaxCheckers_scss_scss_lint_GetLocList() dict - let makeprg = self.makeprgBuild({}) + let makeprg = self.makeprgBuild({ 'args_after': '-f JSON' }) - let errorformat = '%f:%l [%t] %m' + let errorformat = '%f:%t:%l:%c:%n:%m' let loclist = SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, + \ 'preprocess': 'scss_lint', + \ 'postprocess': ['guards'], \ 'returns': [0, 1, 2, 65, 66] }) let cutoff = strlen('Syntax Error: ') for e in loclist + if e['nr'] > 1 + let e['hl'] = '\%>' . (e['col'] - 1) . 'c\%<' . (e['col'] + e['nr']) . 'c' + endif + let e['nr'] = 0 + if e['text'][: cutoff-1] ==# 'Syntax Error: ' let e['text'] = e['text'][cutoff :] else