SyntasticInfo: more details about modes. Minor cleanup.

This commit is contained in:
LCD 47 2014-07-15 12:43:53 +03:00
parent 06e77c1808
commit 13bdf9e4bd
3 changed files with 32 additions and 7 deletions

View File

@ -19,7 +19,7 @@ if has('reltime')
lockvar! g:syntastic_start lockvar! g:syntastic_start
endif endif
let g:syntastic_version = '3.4.0-99' let g:syntastic_version = '3.4.0-100'
lockvar g:syntastic_version lockvar g:syntastic_version
" Sanity checks {{{1 " Sanity checks {{{1
@ -168,7 +168,7 @@ command! -nargs=* -complete=custom,s:CompleteCheckerName SyntasticCheck
\ call syntastic#util#redraw(g:syntastic_full_redraws) \ call syntastic#util#redraw(g:syntastic_full_redraws)
command! Errors call s:ShowLocList() command! Errors call s:ShowLocList()
command! -nargs=? -complete=custom,s:CompleteFiletypes SyntasticInfo command! -nargs=? -complete=custom,s:CompleteFiletypes SyntasticInfo
\ call s:modemap.echoMode() | \ call s:modemap.modeInfo(<f-args>) |
\ call s:registry.echoInfoFor(s:resolveFiletypes(<f-args>)) \ call s:registry.echoInfoFor(s:resolveFiletypes(<f-args>))
command! SyntasticReset command! SyntasticReset
\ call s:ClearCache() | \ call s:ClearCache() |

View File

@ -62,6 +62,27 @@ function! g:SyntasticModeMap.echoMode() " {{{2
echo "Syntastic: " . self._mode . " mode enabled" echo "Syntastic: " . self._mode . " mode enabled"
endfunction " }}}2 endfunction " }}}2
function! g:SyntasticModeMap.modeInfo(...) " {{{2
echomsg 'Syntastic version: ' . g:syntastic_version
let type = a:0 ? a:1 : &filetype
echomsg 'Info for filetype: ' . type
call self.synch()
echomsg 'Mode: ' . self._mode
if self._mode ==# 'active'
if len(self._passiveFiletypes)
let plural = len(self._passiveFiletypes) != 1 ? 's' : ''
echomsg 'Passive filetype' . plural . ': ' . join(sort(copy(self._passiveFiletypes)))
endif
else
if len(self._activeFiletypes)
let plural = len(self._activeFiletypes) != 1 ? 's' : ''
echomsg 'Active filetype' . plural . ': ' . join(sort(copy(self._activeFiletypes)))
endif
endif
echomsg 'Current filetype is ' . (self.allowsAutoChecking(type) ? 'active' : 'passive')
endfunction " }}}2
" }}}1 " }}}1
" Private methods {{{1 " Private methods {{{1

View File

@ -179,9 +179,6 @@ function! g:SyntasticRegistry.getNamesOfAvailableCheckers(ftalias) " {{{2
endfunction " }}}2 endfunction " }}}2
function! g:SyntasticRegistry.echoInfoFor(ftalias_list) " {{{2 function! g:SyntasticRegistry.echoInfoFor(ftalias_list) " {{{2
echomsg "Syntastic version: " . g:syntastic_version
echomsg "Info for filetype: " . join(a:ftalias_list, '.')
let ft_list = syntastic#util#unique(map( copy(a:ftalias_list), 's:normaliseFiletype(v:val)' )) let ft_list = syntastic#util#unique(map( copy(a:ftalias_list), 's:normaliseFiletype(v:val)' ))
if len(ft_list) != 1 if len(ft_list) != 1
let available = [] let available = []
@ -197,8 +194,15 @@ function! g:SyntasticRegistry.echoInfoFor(ftalias_list) " {{{2
let active = map(self.getCheckersAvailable(ft, []), 'v:val.getName()') let active = map(self.getCheckersAvailable(ft, []), 'v:val.getName()')
endif endif
echomsg "Available checker(s): " . join(sort(available)) let cnt = len(available)
echomsg "Currently enabled checker(s): " . join(active) let plural = cnt != 1 ? 's' : ''
let cklist = cnt ? join(sort(available)) : '-'
echomsg 'Available checker' . plural . ': ' . cklist
let cnt = len(active)
let plural = cnt != 1 ? 's' : ''
let cklist = cnt ? join(active) : '-'
echomsg 'Currently enabled checker' . plural . ': ' . cklist
endfunction " }}}2 endfunction " }}}2
" }}}1 " }}}1