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 lockvar! g:_SYNTASTIC_START
endif endif
let g:_SYNTASTIC_VERSION = '3.6.0-119' let g:_SYNTASTIC_VERSION = '3.6.0-120'
lockvar g:_SYNTASTIC_VERSION lockvar g:_SYNTASTIC_VERSION
" Sanity checks {{{1 " Sanity checks {{{1

View File

@ -127,7 +127,13 @@ function! g:SyntasticChecker.getVersion(...) abort " {{{2
call self.log('getVersion: ' . string(command) . ': ' . call self.log('getVersion: ' . string(command) . ': ' .
\ string(split(version_output, "\n", 1)) . \ string(split(version_output, "\n", 1)) .
\ (v:shell_error ? ' (exit code ' . v:shell_error . ')' : '') ) \ (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 endif
return get(self, '_version', []) return get(self, '_version', [])
endfunction " }}}2 endfunction " }}}2
@ -136,8 +142,6 @@ function! g:SyntasticChecker.setVersion(version) abort " {{{2
if len(a:version) if len(a:version)
let self._version = copy(a:version) let self._version = copy(a:version)
call self.log(self.getExec() . ' version =', 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 endif
endfunction " }}}2 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. :) " know the version in order to know how to find out the version. :)
" Try "ghc-mod 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) if !len(ver)
" That didn't work. Try "ghc-mod" alone. " 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 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 " 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 " need either a Vim that can handle NULs in system() output, or a
" ghc-mod that has the "--boundary" option. " ghc-mod that has the "--boundary" option.
let parsed_ver = syntastic#util#parseVersion(ver[0])
call self.setVersion(parsed_ver) call self.setVersion(parsed_ver)
let s:ghc_mod_new = syntastic#util#versionIsAtLeast(parsed_ver, [2, 1, 2]) let s:ghc_mod_new = syntastic#util#versionIsAtLeast(parsed_ver, [2, 1, 2])
else 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?)") call syntastic#log#error("checker haskell/ghc_mod: can't parse version string (abnormal termination?)")
let s:ghc_mod_new = -1 let s:ghc_mod_new = -1
endif endif

View File

@ -18,15 +18,16 @@ let s:save_cpo = &cpo
set cpo&vim set cpo&vim
function! SyntaxCheckers_javascript_jsxhint_IsAvailable() dict function! SyntaxCheckers_javascript_jsxhint_IsAvailable() dict
let jsxhint_version = syntastic#util#system(self.getExecEscaped() . ' --version') let version_output = syntastic#util#system(self.getExecEscaped() . ' --version')
if v:shell_error || (jsxhint_version !~# '\m^JSXHint\>') let parsed_ver = !v:shell_error && (version_output =~# '\m^JSXHint\>') ? syntastic#util#parseVersion(version_output) : []
return 0 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 endif
let ver = syntastic#util#parseVersion(jsxhint_version) return syntastic#util#versionIsAtLeast(parsed_ver, [0, 4, 1])
call self.setVersion(ver)
return syntastic#util#versionIsAtLeast(ver, [0, 4, 1])
endfunction endfunction
function! SyntaxCheckers_javascript_jsxhint_GetLocList() dict function! SyntaxCheckers_javascript_jsxhint_GetLocList() dict

View File

@ -1,7 +1,7 @@
"============================================================================ "============================================================================
"File: pylint.vim "File: pylint.vim
"Description: Syntax checking plugin for syntastic.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". " On new-ish Fedora it's "python3-pylint 1.2.0".
" Have you guys considered switching to creative writing yet? ;) " Have you guys considered switching to creative writing yet? ;)
let pylint_version = filter( split(syntastic#util#system(self.getExecEscaped() . ' --version'), '\m, \=\|\n'), let version_output = syntastic#util#system(self.getExecEscaped() . ' --version')
\ 'v:val =~# ''\m^\(python[-0-9]*-\|\.\)\=pylint[-0-9]*\>''' )[0] let pylint_version = filter( split(version_output, '\m, \=\|\n'), 'v:val =~# ''\m^\(python[-0-9]*-\|\.\)\=pylint[-0-9]*\>''' )[0]
let ver = syntastic#util#parseVersion(substitute(pylint_version, '\v^\S+\s+', '', '')) let parsed_ver = syntastic#util#parseVersion(substitute(pylint_version, '\v^\S+\s+', '', ''))
call self.setVersion(ver) 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/ 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?)") call syntastic#log#error("checker python/pylint: can't parse version string (abnormal termination?)")
let s:pylint_new = -1 let s:pylint_new = -1
endtry endtry

View File

@ -2,6 +2,7 @@
"File: tsc.vim "File: tsc.vim
"Description: TypeScript syntax checker "Description: TypeScript syntax checker
"Maintainer: Bill Casarin <bill@casarin.ca> "Maintainer: Bill Casarin <bill@casarin.ca>
"
"============================================================================ "============================================================================
if exists('g:loaded_syntastic_typescript_tsc_checker') if exists('g:loaded_syntastic_typescript_tsc_checker')
@ -16,24 +17,24 @@ endif
let s:save_cpo = &cpo let s:save_cpo = &cpo
set cpo&vim set cpo&vim
function! SyntaxCheckers_typescript_tsc_GetLocList() dict function! SyntaxCheckers_typescript_tsc_IsAvailable() dict
if !exists('s:tsc_new') 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 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 endif
if s:tsc_new < 0 return s:tsc_new >= 0
return [] endfunction
endif
function! SyntaxCheckers_typescript_tsc_GetLocList() dict
let makeprg = self.makeprgBuild({ let makeprg = self.makeprgBuild({
\ 'args': '--module commonjs', \ 'args': '--module commonjs',
\ 'args_after': (s:tsc_new ? '--noEmit' : '--out ' . syntastic#util#DevNull()) }) \ 'args_after': (s:tsc_new ? '--noEmit' : '--out ' . syntastic#util#DevNull()) })