12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- if exists('g:loaded_syntastic_postprocess_autoload') || !exists('g:loaded_syntastic_plugin')
- finish
- endif
- let g:loaded_syntastic_postprocess_autoload = 1
- let s:save_cpo = &cpo
- set cpo&vim
- function! syntastic#postprocess#compressWhitespace(errors) abort " {{{2
- for e in a:errors
- let e['text'] = substitute(e['text'], "\001", '', 'g')
- let e['text'] = substitute(e['text'], '\n', ' ', 'g')
- let e['text'] = substitute(e['text'], '\m\s\{2,}', ' ', 'g')
- let e['text'] = substitute(e['text'], '\m^\s\+', '', '')
- let e['text'] = substitute(e['text'], '\m\s\+$', '', '')
- endfor
- return a:errors
- endfunction
- function! syntastic#postprocess#cygwinRemoveCR(errors) abort " {{{2
- if has('win32unix')
- for e in a:errors
- let e['text'] = substitute(e['text'], '\r', '', 'g')
- endfor
- endif
- return a:errors
- endfunction
- function! syntastic#postprocess#decodeXMLEntities(errors) abort " {{{2
- for e in a:errors
- let e['text'] = syntastic#util#decodeXMLEntities(e['text'])
- endfor
- return a:errors
- endfunction
- function! syntastic#postprocess#filterForeignErrors(errors) abort " {{{2
- return filter(copy(a:errors), 'get(v:val, "bufnr") == ' . bufnr(''))
- endfunction
- function! syntastic#postprocess#guards(errors) abort " {{{2
- let buffers = syntastic#util#unique(map(filter(copy(a:errors), 'v:val["valid"]'), 'str2nr(v:val["bufnr"])'))
- let guards = {}
- for b in buffers
- let guards[b] = len(getbufline(b, 1, '$'))
- endfor
- for e in a:errors
- if e['valid'] && e['lnum'] > guards[e['bufnr']]
- let e['lnum'] = guards[e['bufnr']]
- endif
- endfor
- return a:errors
- endfunction
- let &cpo = s:save_cpo
- unlet s:save_cpo
|