From 3d5d219522cee81304ec8cb1d6b37278e2761cb8 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Thu, 16 Oct 2014 09:56:29 +0300 Subject: [PATCH] SyntasticInfo: if the current file will not be checked, explain why. --- plugin/syntastic.vim | 38 ++++++++++++++++++++++++++++++++++---- 1 file changed, 34 insertions(+), 4 deletions(-) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 18727e15..e78a94d8 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.5.0-66' +let g:syntastic_version = '3.5.0-67' lockvar g:syntastic_version " Sanity checks {{{1 @@ -180,10 +180,11 @@ command! -nargs=* -complete=custom,s:CompleteCheckerName SyntasticCheck \ call syntastic#util#redraw(g:syntastic_full_redraws) command! Errors call s:ShowLocList() command! -nargs=? -complete=custom,s:CompleteFiletypes SyntasticInfo - \ call s:modemap.modeInfo() | - \ call s:registry.echoInfoFor(s:resolveFiletypes()) + \ call s:modemap.modeInfo() + \ call s:registry.echoInfoFor(s:resolveFiletypes()) + \ call s:explainSkip() command! SyntasticReset - \ call s:ClearCache() | + \ call s:ClearCache() \ call s:notifiers.refresh(g:SyntasticLoclist.New([])) command! SyntasticSetLoclist call g:SyntasticLoclist.current().setloclist() @@ -582,6 +583,35 @@ function! s:skipFile() " {{{2 return skip endfunction " }}}2 +" Explain why checks will be skipped for the current file +function! s:explainSkip(...) " {{{2 + if !a:0 && s:skipFile() + let why = [] + let fname = expand('%') + + if get(b:, 'syntastic_skip_checks', 0) + call add(why, 'b:syntastic_skip_checks set') + endif + if &buftype != '' + call add(why, 'buftype = ' . string(&buftype)) + endif + if !filereadable(fname) + call add(why, 'file not readable / not local') + endif + if getwinvar(0, '&diff') + call add(why, 'diff mode') + endif + if s:ignoreFile(fname) + call add(why, 'filename matching g:syntastic_ignore_files') + endif + if fnamemodify(fname, ':e') =~? g:syntastic_ignore_extensions + call add(why, 'extension matching g:syntastic_ignore_extensions') + endif + + echomsg 'The current file will not be checked (' . join(why, ', ') . ')' + endif +endfunction " }}}2 + " Take a list of errors and add default values to them from a:options function! s:addToErrors(errors, options) " {{{2 for err in a:errors