Show chacker output when whining that we can't parse version string.

This commit is contained in:
LCD 47 2015-07-10 20:14:23 +03:00
parent 2e60dd4af9
commit 74fd7e6b92
6 changed files with 45 additions and 35 deletions

View File

@ -19,7 +19,7 @@ if has('reltime')
lockvar! g:_SYNTASTIC_START
endif
let g:_SYNTASTIC_VERSION = '3.6.0-119'
let g:_SYNTASTIC_VERSION = '3.6.0-120'
lockvar g:_SYNTASTIC_VERSION
" Sanity checks {{{1

View File

@ -127,7 +127,13 @@ function! g:SyntasticChecker.getVersion(...) abort " {{{2
call self.log('getVersion: ' . string(command) . ': ' .
\ string(split(version_output, "\n", 1)) .
\ (v:shell_error ? ' (exit code ' . v:shell_error . ')' : '') )
call self.setVersion(syntastic#util#parseVersion(version_output))
let parsed_ver = syntastic#util#parseVersion(version_output)
if len(parsed_ver)
call self.setVersion(parsed_ver)
else
call syntastic#log#ndebug(g:_SYNTASTIC_DEBUG_LOCLIST, 'checker output:', split(version_output, "\n", 1))
call syntastic#log#error("checker " . self._filetype . "/" . self._name . ": can't parse version string (abnormal termination?)")
endif
endif
return get(self, '_version', [])
endfunction " }}}2
@ -136,8 +142,6 @@ function! g:SyntasticChecker.setVersion(version) abort " {{{2
if len(a:version)
let self._version = copy(a:version)
call self.log(self.getExec() . ' version =', a:version)
else
call syntastic#log#error("checker " . self._filetype . "/" . self._name . ": can't parse version string (abnormal termination?)")
endif
endfunction " }}}2

View File

@ -30,20 +30,23 @@ function! SyntaxCheckers_haskell_ghc_mod_IsAvailable() dict
" know the version in order to know how to find out the version. :)
" Try "ghc-mod version".
let ver = filter(split(syntastic#util#system(self.getExecEscaped() . ' version'), '\n'), 'v:val =~# ''\m\sversion''')
let version_output = split(syntastic#util#system(self.getExecEscaped() . ' version'), '\n', 1)
let ver = filter(copy(version_output), 'v:val =~# ''\m\sversion''')
if !len(ver)
" That didn't work. Try "ghc-mod" alone.
let ver = filter(split(syntastic#util#system(self.getExecEscaped()), '\n'), 'v:val =~# ''\m\sversion''')
let version_output = split(syntastic#util#system(self.getExecEscaped()), '\n', 1)
let ver = filter(copy(version_output), 'v:val =~# ''\m\sversion''')
endif
let parsed_ver = len(ver) ? syntastic#util#parseVersion(ver[0]) : []
if len(ver)
if len(parsed_ver)
" Encouraged by the great success in finding out the version, now we
" need either a Vim that can handle NULs in system() output, or a
" ghc-mod that has the "--boundary" option.
let parsed_ver = syntastic#util#parseVersion(ver[0])
call self.setVersion(parsed_ver)
let s:ghc_mod_new = syntastic#util#versionIsAtLeast(parsed_ver, [2, 1, 2])
else
call syntastic#log#ndebug(g:_SYNTASTIC_DEBUG_LOCLIST, 'checker output:', version_output)
call syntastic#log#error("checker haskell/ghc_mod: can't parse version string (abnormal termination?)")
let s:ghc_mod_new = -1
endif

View File

@ -18,15 +18,16 @@ let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_javascript_jsxhint_IsAvailable() dict
let jsxhint_version = syntastic#util#system(self.getExecEscaped() . ' --version')
if v:shell_error || (jsxhint_version !~# '\m^JSXHint\>')
return 0
let version_output = syntastic#util#system(self.getExecEscaped() . ' --version')
let parsed_ver = !v:shell_error && (version_output =~# '\m^JSXHint\>') ? syntastic#util#parseVersion(version_output) : []
if len(parsed_ver)
call self.setVersion(parsed_ver)
else
call syntastic#log#ndebug(g:_SYNTASTIC_DEBUG_LOCLIST, 'checker output:', split(version_output, "\n", 1))
call syntastic#log#error("checker javascript/jsxhint: can't parse version string (abnormal termination?)")
endif
let ver = syntastic#util#parseVersion(jsxhint_version)
call self.setVersion(ver)
return syntastic#util#versionIsAtLeast(ver, [0, 4, 1])
return syntastic#util#versionIsAtLeast(parsed_ver, [0, 4, 1])
endfunction
function! SyntaxCheckers_javascript_jsxhint_GetLocList() dict

View File

@ -1,7 +1,7 @@
"============================================================================
"File: pylint.vim
"Description: Syntax checking plugin for syntastic.vim
"Author: Parantapa Bhattacharya <parantapa at gmail dot com>
"Maintainer: Parantapa Bhattacharya <parantapa at gmail dot com>
"
"============================================================================
@ -32,13 +32,14 @@ function! SyntaxCheckers_python_pylint_IsAvailable() dict
" On new-ish Fedora it's "python3-pylint 1.2.0".
" Have you guys considered switching to creative writing yet? ;)
let pylint_version = filter( split(syntastic#util#system(self.getExecEscaped() . ' --version'), '\m, \=\|\n'),
\ 'v:val =~# ''\m^\(python[-0-9]*-\|\.\)\=pylint[-0-9]*\>''' )[0]
let ver = syntastic#util#parseVersion(substitute(pylint_version, '\v^\S+\s+', '', ''))
call self.setVersion(ver)
let version_output = syntastic#util#system(self.getExecEscaped() . ' --version')
let pylint_version = filter( split(version_output, '\m, \=\|\n'), 'v:val =~# ''\m^\(python[-0-9]*-\|\.\)\=pylint[-0-9]*\>''' )[0]
let parsed_ver = syntastic#util#parseVersion(substitute(pylint_version, '\v^\S+\s+', '', ''))
call self.setVersion(parsed_ver)
let s:pylint_new = syntastic#util#versionIsAtLeast(ver, [1])
let s:pylint_new = syntastic#util#versionIsAtLeast(parsed_ver, [1])
catch /\m^Vim\%((\a\+)\)\=:E684/
call syntastic#log#ndebug(g:_SYNTASTIC_DEBUG_LOCLIST, 'checker output:', split(version_output, "\n", 1))
call syntastic#log#error("checker python/pylint: can't parse version string (abnormal termination?)")
let s:pylint_new = -1
endtry

View File

@ -2,6 +2,7 @@
"File: tsc.vim
"Description: TypeScript syntax checker
"Maintainer: Bill Casarin <bill@casarin.ca>
"
"============================================================================
if exists('g:loaded_syntastic_typescript_tsc_checker')
@ -16,24 +17,24 @@ endif
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_typescript_tsc_GetLocList() dict
if !exists('s:tsc_new')
function! SyntaxCheckers_typescript_tsc_IsAvailable() dict
let version_output = split(syntastic#util#system(self.getExecEscaped() . ' --version'), '\n', 1)
let ver = filter(copy(version_output), 'v:val =~# ''\m\<Version ''')
let parsed_ver = len(ver) ? syntastic#util#parseVersion(ver[0], '\v<Version \zs\d+(\.\d+)\ze') : []
if len(parsed_ver)
call self.setVersion(parsed_ver)
let s:tsc_new = syntastic#util#versionIsAtLeast(parsed_ver, [1, 5])
else
call syntastic#log#ndebug(g:_SYNTASTIC_DEBUG_LOCLIST, 'checker output:', version_output)
call syntastic#log#error("checker typescript/tsc: can't parse version string (abnormal termination?)")
let s:tsc_new = -1
try
let tsc_version = filter(split(syntastic#util#system(self.getExecEscaped() . ' --version'), '\n'), 'v:val =~# ''\m\<Version ''')[0]
let ver = syntastic#util#parseVersion(tsc_version, '\v<Version \zs\d+(\.\d+)\ze')
call self.setVersion(ver)
let s:tsc_new = syntastic#util#versionIsAtLeast(ver, [1, 5])
catch /\m^Vim\%((\a\+)\)\=:E684/
call syntastic#log#error("checker typescript/tsc: can't parse version string (abnormal termination?)")
endtry
endif
if s:tsc_new < 0
return []
endif
return s:tsc_new >= 0
endfunction
function! SyntaxCheckers_typescript_tsc_GetLocList() dict
let makeprg = self.makeprgBuild({
\ 'args': '--module commonjs',
\ 'args_after': (s:tsc_new ? '--noEmit' : '--out ' . syntastic#util#DevNull()) })