Skip to content
This repository has been archived by the owner on Sep 20, 2023. It is now read-only.

hdevtools: Preserve multi-line comments #1701

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions autoload/syntastic/postprocess.vim
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,27 @@ function! syntastic#postprocess#compressWhitespace(errors) abort " {{{2
return a:errors
endfunction " }}}2

" remove initial empty lines
function! syntastic#postprocess#removeEmptyLines(errors) abort " {{{2
for e in a:errors
let e['text'] = substitute(e['text'], '\m^\n\+', '', '')
endfor

return a:errors
endfunction " }}}2

" unindent consistently
function! syntastic#postprocess#unindent(errors) abort " {{{2
for e in a:errors
let lines = split(e['text'], '\n', 1)
let indent = min(map(copy(lines), 'len(matchstr(v:val,"^ \\+"))'))
let lines = map(lines, 'v:val[' . indent . ':]')
let e['text'] = join(lines, "\n")
endfor

return a:errors
endfunction " }}}2

" remove spurious CR under Cygwin
function! syntastic#postprocess#cygwinRemoveCR(errors) abort " {{{2
if has('win32unix')
Expand Down
2 changes: 1 addition & 1 deletion syntax_checkers/haskell/hdevtools.vim
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function! SyntaxCheckers_haskell_hdevtools_GetLocList() dict
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'defaults': {'vcol': 1},
\ 'postprocess': ['compressWhitespace'] })
\ 'postprocess': ['removeEmptyLines', 'unindent'] })
endfunction

call g:SyntasticRegistry.CreateAndRegisterChecker({
Expand Down