diff --git a/autoload/syntastic/postprocess.vim b/autoload/syntastic/postprocess.vim index 0c4e12c2..65e98573 100644 --- a/autoload/syntastic/postprocess.vim +++ b/autoload/syntastic/postprocess.vim @@ -29,6 +29,7 @@ function syntastic#postprocess#compressWhitespace(errors) let llist = [] 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'], '\s\{2,}', ' ', 'g') call add(llist, e) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 9c92e117..fb788a3b 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -64,6 +64,12 @@ if !exists("g:syntastic_full_redraws") let g:syntastic_full_redraws = !( has('gui_running') || has('gui_macvim')) endif +" TODO: not documented +if !exists("g:syntastic_reuse_loc_lists") + " a relevant bug has been fixed in one of the pre-releases of Vim 7.4 + let g:syntastic_reuse_loc_lists = (v:version >= 704) +endif + let s:registry = g:SyntasticRegistry.Instance() let s:notifiers = g:SyntasticNotifiers.Instance() let s:modemap = g:SyntasticModeMap.Instance() @@ -145,8 +151,10 @@ function! s:UpdateErrors(auto_invoked, ...) let loclist = g:SyntasticLoclist.current() + let w:syntastic_loclist_set = 0 if g:syntastic_always_populate_loc_list || g:syntastic_auto_jump call setloclist(0, loclist.filteredRaw()) + let w:syntastic_loclist_set = 1 if run_checks && g:syntastic_auto_jump && loclist.hasErrorsOrWarningsToDisplay() silent! lrewind endif @@ -356,7 +364,6 @@ endfunction function! SyntasticMake(options) call syntastic#util#debug('SyntasticMake: called with options: '. string(a:options)) - let old_loclist = getloclist(0) let old_shell = &shell let old_shellredir = &shellredir let old_errorformat = &errorformat @@ -390,13 +397,13 @@ function! SyntasticMake(options) endif lgetexpr err_lines - let errors = getloclist(0) + let errors = copy(getloclist(0)) if has_key(a:options, 'cwd') exec 'lcd ' . fnameescape(old_cwd) endif - call setloclist(0, old_loclist) + silent! lolder let &errorformat = old_errorformat let &shellredir = old_shellredir let &shell=old_shell diff --git a/plugin/syntastic/loclist.vim b/plugin/syntastic/loclist.vim index d5cd6e39..104470dc 100644 --- a/plugin/syntastic/loclist.vim +++ b/plugin/syntastic/loclist.vim @@ -143,7 +143,12 @@ endfunction "display the cached errors for this buf in the location list function! g:SyntasticLoclist.show() - call setloclist(0, self.filteredRaw()) + if !exists('w:syntastic_loclist_set') + let w:syntastic_loclist_set = 0 + endif + call setloclist(0, self.filteredRaw(), g:syntastic_reuse_loc_lists && w:syntastic_loclist_set ? 'r' : ' ') + let w:syntastic_loclist_set = 1 + if self.hasErrorsOrWarningsToDisplay() let num = winnr() exec "lopen " . g:syntastic_loc_list_height diff --git a/syntax_checkers/coffee/coffeelint.vim b/syntax_checkers/coffee/coffeelint.vim index 4b59a8c2..2099359c 100644 --- a/syntax_checkers/coffee/coffeelint.vim +++ b/syntax_checkers/coffee/coffeelint.vim @@ -26,9 +26,9 @@ function! SyntaxCheckers_coffee_coffeelint_GetLocList() \ 'subchecker': 'coffeelint' }) let errorformat = - \ '%f\,%l\,%\d%\+\,%trror\,%m,' . + \ '%f\,%l\,%\d%#\,%trror\,%m,' . \ '%f\,%l\,%trror\,%m,' . - \ '%f\,%l\,%\d%\+\,%tarn\,%m,' . + \ '%f\,%l\,%\d%#\,%tarn\,%m,' . \ '%f\,%l\,%tarn\,%m' return SyntasticMake({ diff --git a/syntax_checkers/haskell/ghc-mod.vim b/syntax_checkers/haskell/ghc-mod.vim index f3677dc1..3dcc6e7e 100644 --- a/syntax_checkers/haskell/ghc-mod.vim +++ b/syntax_checkers/haskell/ghc-mod.vim @@ -10,16 +10,21 @@ " "============================================================================ -if exists("g:loaded_syntastic_haskell_ghc_mod_checker") +if exists('g:loaded_syntastic_haskell_ghc_mod_checker') finish endif -let g:loaded_syntastic_haskell_ghc_mod_checker=1 +let g:loaded_syntastic_haskell_ghc_mod_checker = 1 function! SyntaxCheckers_haskell_ghc_mod_IsAvailable() return executable('ghc-mod') endfunction function! SyntaxCheckers_haskell_ghc_mod_GetLocList() + let makeprg = syntastic#makeprg#build({ + \ 'exe': 'ghc-mod check', + \ 'filetype': 'haskell', + \ 'subchecker': 'ghc_mod' }) + let errorformat = \ '%-G%\s%#,' . \ '%f:%l:%c:%trror: %m,' . @@ -30,16 +35,10 @@ function! SyntaxCheckers_haskell_ghc_mod_GetLocList() \ '%E%f:%l:%c:,' . \ '%Z%m' - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'ghc-mod check', - \ 'filetype': 'haskell', - \ 'subchecker': 'ghc_mod' }) - - let loclist = SyntasticMake({ + return SyntasticMake({ \ 'makeprg': makeprg, - \ 'errorformat': errorformat }) - - return loclist + \ 'errorformat': errorformat, + \ 'postprocess': ['compressWhitespace'] }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/syntax_checkers/haskell/hlint.vim b/syntax_checkers/haskell/hlint.vim index c748b77c..f9f0fcd4 100644 --- a/syntax_checkers/haskell/hlint.vim +++ b/syntax_checkers/haskell/hlint.vim @@ -5,32 +5,30 @@ "License: BSD "============================================================================ -if exists("g:loaded_syntastic_haskell_hlint_checker") +if exists('g:loaded_syntastic_haskell_hlint_checker') finish endif -let g:loaded_syntastic_haskell_hlint_checker=1 +let g:loaded_syntastic_haskell_hlint_checker = 1 function! SyntaxCheckers_haskell_hlint_IsAvailable() return executable('hlint') endfunction function! SyntaxCheckers_haskell_hlint_GetLocList() - let errorformat = - \ '%E%f:%l:%c: Error: %m,' . - \ '%W%f:%l:%c: Warning: %m,' . - \ '%C%m' - let makeprg = syntastic#makeprg#build({ \ 'exe': 'hlint', \ 'filetype': 'haskell', \ 'subchecker': 'hlint' }) - let loclist = SyntasticMake({ + let errorformat = + \ '%E%f:%l:%c: Error: %m,' . + \ '%W%f:%l:%c: Warning: %m,' . + \ '%C%m' + + return SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, \ 'postprocess': ['compressWhitespace'] }) - - return loclist endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({