New command :SyntasticSetLoclist.

This commit is contained in:
LCD 47 2013-11-16 12:49:43 +02:00
parent 7b00a18185
commit cfe2ac68a4
3 changed files with 18 additions and 4 deletions

View File

@ -161,6 +161,11 @@ filetype.
Resets the list of errors and turns off all error notifiers. Resets the list of errors and turns off all error notifiers.
:SyntasticSetLoclist *:SyntasticSetLoclist*
Updates Vim's current loclist with the list of detected errors. This is only
needed if |'syntastic_always_populate_loc_list'| is not set.
============================================================================== ==============================================================================
4. Global Options *syntastic-global-options* 4. Global Options *syntastic-global-options*

View File

@ -125,6 +125,7 @@ command! SyntasticInfo
command! SyntasticReset command! SyntasticReset
\ call s:ClearCache() | \ call s:ClearCache() |
\ call s:notifiers.refresh(g:SyntasticLoclist.New([])) \ call s:notifiers.refresh(g:SyntasticLoclist.New([]))
command! SyntasticSetLoclist call g:SyntasticLoclist.current().setloclist()
highlight link SyntasticError SpellBad highlight link SyntasticError SpellBad
highlight link SyntasticWarning SpellCap highlight link SyntasticWarning SpellCap
@ -211,9 +212,11 @@ function! s:UpdateErrors(auto_invoked, ...)
let w:syntastic_loclist_set = 0 let w:syntastic_loclist_set = 0
if g:syntastic_always_populate_loc_list || g:syntastic_auto_jump if g:syntastic_always_populate_loc_list || g:syntastic_auto_jump
call syntastic#log#debug(g:SyntasticDebugNotifications, 'loclist: setloclist (new)')
call setloclist(0, loclist.filteredRaw()) call setloclist(0, loclist.filteredRaw())
let w:syntastic_loclist_set = 1 let w:syntastic_loclist_set = 1
if run_checks && g:syntastic_auto_jump && loclist.hasErrorsOrWarningsToDisplay() if run_checks && g:syntastic_auto_jump && loclist.hasErrorsOrWarningsToDisplay()
call syntastic#log#debug(g:SyntasticDebugNotifications, 'loclist: jump')
silent! lrewind silent! lrewind
endif endif
endif endif

View File

@ -147,14 +147,20 @@ function! g:SyntasticLoclist.filter(filters)
return rv return rv
endfunction endfunction
"display the cached errors for this buf in the location list function! g:SyntasticLoclist.setloclist()
function! g:SyntasticLoclist.show()
call syntastic#log#debug(g:SyntasticDebugNotifications, 'loclist: show')
if !exists('w:syntastic_loclist_set') if !exists('w:syntastic_loclist_set')
let w:syntastic_loclist_set = 0 let w:syntastic_loclist_set = 0
endif endif
call setloclist(0, self.filteredRaw(), g:syntastic_reuse_loc_lists && w:syntastic_loclist_set ? 'r' : ' ') let replace = g:syntastic_reuse_loc_lists && w:syntastic_loclist_set
call syntastic#log#debug(g:SyntasticDebugNotifications, 'loclist: setloclist ' . (replace ? '(replace)' : '(new)'))
call setloclist(0, self.filteredRaw(), replace ? 'r' : ' ')
let w:syntastic_loclist_set = 1 let w:syntastic_loclist_set = 1
endfunction
"display the cached errors for this buf in the location list
function! g:SyntasticLoclist.show()
call syntastic#log#debug(g:SyntasticDebugNotifications, 'loclist: show')
call self.setloclist()
if self.hasErrorsOrWarningsToDisplay() if self.hasErrorsOrWarningsToDisplay()
let num = winnr() let num = winnr()