From bb8e259e3182f1741f57454485f4eaf2ec857e19 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Tue, 18 Feb 2014 08:53:24 +0200 Subject: [PATCH 1/6] phpcs: move --tab-width to args. --- syntax_checkers/php/phpcs.vim | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/syntax_checkers/php/phpcs.vim b/syntax_checkers/php/phpcs.vim index 11b183a1..23d539df 100644 --- a/syntax_checkers/php/phpcs.vim +++ b/syntax_checkers/php/phpcs.vim @@ -23,7 +23,8 @@ set cpo&vim function! SyntaxCheckers_php_phpcs_GetLocList() dict let makeprg = self.makeprgBuild({ - \ 'args_after': '--report=csv --tab-width=' . &tabstop }) + \ 'args': '--tab-width=' . &tabstop, + \ 'args_after': '--report=csv' }) let errorformat = \ '%-GFile\,Line\,Column\,Type\,Message\,Source\,Severity,'. @@ -37,7 +38,7 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'php', - \ 'name': 'phpcs'}) + \ 'name': 'phpcs' }) let &cpo = s:save_cpo unlet s:save_cpo From d3b25acb662090ed8ce09cf23662db36ebaf89b5 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Tue, 18 Feb 2014 19:58:41 +0200 Subject: [PATCH 2/6] syntastic#util#wideMsg() should use screen width rather than window width. --- autoload/syntastic/util.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autoload/syntastic/util.vim b/autoload/syntastic/util.vim index dabd7a43..1ab837a1 100644 --- a/autoload/syntastic/util.vim +++ b/autoload/syntastic/util.vim @@ -101,7 +101,7 @@ function! syntastic#util#wideMsg(msg) "width as the proper amount of characters let chunks = split(msg, "\t", 1) let msg = join(map(chunks[:-2], 'v:val . repeat(" ", &ts - s:width(v:val) % &ts)'), '') . chunks[-1] - let msg = strpart(msg, 0, winwidth(0) - 1) + let msg = strpart(msg, 0, &columns - 1) set noruler noshowcmd call syntastic#util#redraw(0) From 99126e38ff9fd661497f4143a6413359677937ff Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Wed, 19 Feb 2014 14:57:41 +0200 Subject: [PATCH 3/6] yamlxs: fix exec parameter. --- syntax_checkers/yaml/yamlxs.vim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/syntax_checkers/yaml/yamlxs.vim b/syntax_checkers/yaml/yamlxs.vim index 20665335..e9d33771 100644 --- a/syntax_checkers/yaml/yamlxs.vim +++ b/syntax_checkers/yaml/yamlxs.vim @@ -69,7 +69,8 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'yaml', - \ 'name': 'yamlxs' }) + \ 'name': 'yamlxs', + \ 'exec': 'perl' }) let &cpo = s:save_cpo unlet s:save_cpo From 09e6840d1fe52444128f987d68195e45334afaa7 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 21 Feb 2014 13:01:22 +0200 Subject: [PATCH 4/6] Fix debug output. --- autoload/syntastic/log.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/autoload/syntastic/log.vim b/autoload/syntastic/log.vim index 78e8b8eb..99698533 100644 --- a/autoload/syntastic/log.vim +++ b/autoload/syntastic/log.vim @@ -96,8 +96,8 @@ function! syntastic#log#debugShowOptions(level, names) let vlist = type(a:names) == type("") ? [a:names] : a:names if !empty(vlist) - call map(copy(vlist), "'&' . v:val . ' = ' . strtrans(string(eval('&' . v:val)))") - echomsg leader . join(vlist, ', ') + let vals = map(copy(vlist), "'&' . v:val . ' = ' . strtrans(string(eval('&' . v:val)))") + echomsg leader . join(vals, ', ') endif call s:logRedirect(0) endfunction From de9a021270781e9c5bc9b3cac1c92519543215d8 Mon Sep 17 00:00:00 2001 From: Thomas Boyt Date: Thu, 2 Jan 2014 17:36:07 -0500 Subject: [PATCH 5/6] Add jsxhint checker --- syntax_checkers/javascript/jsxhint.vim | 57 ++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 syntax_checkers/javascript/jsxhint.vim diff --git a/syntax_checkers/javascript/jsxhint.vim b/syntax_checkers/javascript/jsxhint.vim new file mode 100644 index 00000000..5851f3b1 --- /dev/null +++ b/syntax_checkers/javascript/jsxhint.vim @@ -0,0 +1,57 @@ +"============================================================================ +"File: jsxhint.vim +"Description: Javascript syntax checker - using jsxhint +"Maintainer: Thomas Boyt +"License: This program is free software. It comes without any warranty, +" to the extent permitted by applicable law. You can redistribute +" it and/or modify it under the terms of the Do What The Fuck You +" Want To Public License, Version 2, as published by Sam Hocevar. +" See http://sam.zoy.org/wtfpl/COPYING for more details. +"============================================================================ + +if exists('g:loaded_syntastic_javascript_jsxhint_checker') + finish +endif +let g:loaded_syntastic_javascript_jsxhint_checker=1 + +if !exists('g:syntastic_jsxhint_exec') + let g:syntastic_jsxhint_exec = 'jsxhint' +endif + +if !exists('g:syntastic_javascript_jsxhint_conf') + let g:syntastic_javascript_jsxhint_conf = '' +endif + +function! SyntaxCheckers_javascript_jsxhint_IsAvailable() dict + return executable(expand(g:syntastic_jsxhint_exec)) +endfunction + +function! SyntaxCheckers_javascript_jsxhint_GetLocList() dict + let jsxhint_new = s:JsxhintNew() + let makeprg = self.makeprgBuild({ + \ 'exe': expand(g:syntastic_jsxhint_exec), + \ 'post_args': (jsxhint_new ? ' --verbose ' : '') . s:Args() }) + + let errorformat = jsxhint_new ? + \ '%A%f: line %l\, col %v\, %m \(%t%*\d\)' : + \ '%E%f: line %l\, col %v\, %m' + + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'defaults': {'bufnr': bufnr('')} }) +endfunction + +function! s:JsxhintNew() + return syntastic#util#versionIsAtLeast(syntastic#util#getVersion(expand(g:syntastic_jsxhint_exec) . ' --version'), [1, 1]) +endfunction + +function! s:Args() + " jsxhint uses .jshintrc as config unless --config arg is present + return !empty(g:syntastic_javascript_jsxhint_conf) ? ' --config ' . g:syntastic_javascript_jsxhint_conf : '' +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'javascript', + \ 'name': 'jsxhint'}) + From d12bc4f1d122a5e60d08d765acde58272cb84cbb Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Sat, 22 Feb 2014 21:56:18 +0200 Subject: [PATCH 6/6] jsxhint: cleanup. --- README.markdown | 2 +- syntax_checkers/javascript/jsxhint.vim | 42 +++++++++++--------------- 2 files changed, 19 insertions(+), 25 deletions(-) diff --git a/README.markdown b/README.markdown index 04effa59..fb4b8bb4 100644 --- a/README.markdown +++ b/README.markdown @@ -38,7 +38,7 @@ At the time of this writing, syntax checking plugins exist for ActionScript, Ada, AppleScript, AsciiDoc, ASM, BEMHTML, Bourne shell, C, C++, C#, Chef, CoffeeScript, Coco, Coq, CSS, Cucumber, CUDA, D, Dart, DocBook, Dust, Elixir, Erlang, eRuby, Fortran, Gentoo metadata, GLSL, Go, Haml, Haskell, Haxe, -Handlebars, HSS, HTML, Java, JavaScript, JSON, LESS, Lex, Limbo, LISP, +Handlebars, HSS, HTML, Java, JavaScript, JSON, JSX, LESS, Lex, Limbo, LISP, LLVM intermediate language, Lua, MATLAB, NASM, Objective-C, Objective-C++, OCaml, Perl, Perl POD, PHP, gettext Portable Object, Puppet, Python, Racket, reStructuredText, Ruby, Rust, SASS/SCSS, Scala, Slim, Tcl, TeX, Texinfo, Twig, diff --git a/syntax_checkers/javascript/jsxhint.vim b/syntax_checkers/javascript/jsxhint.vim index 5851f3b1..3a77aba0 100644 --- a/syntax_checkers/javascript/jsxhint.vim +++ b/syntax_checkers/javascript/jsxhint.vim @@ -12,29 +12,28 @@ if exists('g:loaded_syntastic_javascript_jsxhint_checker') finish endif -let g:loaded_syntastic_javascript_jsxhint_checker=1 +let g:loaded_syntastic_javascript_jsxhint_checker = 1 -if !exists('g:syntastic_jsxhint_exec') - let g:syntastic_jsxhint_exec = 'jsxhint' -endif - -if !exists('g:syntastic_javascript_jsxhint_conf') - let g:syntastic_javascript_jsxhint_conf = '' -endif +let s:save_cpo = &cpo +set cpo&vim function! SyntaxCheckers_javascript_jsxhint_IsAvailable() dict - return executable(expand(g:syntastic_jsxhint_exec)) + if !executable('jshint') || !syntastic#util#versionIsAtLeast(syntastic#util#getVersion('jshint --version'), [1, 1]) + return 0 + endif + + let jsxhint_version = system(self.getExecEscaped() . ' --version') + return + \ v:shell_error == 0 && + \ jsxhint_version =~# '\m^JSXHint\>' && + \ syntastic#util#versionIsAtLeast(syntastic#util#parseVersion(jsxhint_version), [0, 4, 1]) endfunction function! SyntaxCheckers_javascript_jsxhint_GetLocList() dict - let jsxhint_new = s:JsxhintNew() let makeprg = self.makeprgBuild({ - \ 'exe': expand(g:syntastic_jsxhint_exec), - \ 'post_args': (jsxhint_new ? ' --verbose ' : '') . s:Args() }) + \ 'args_after': '--verbose' }) - let errorformat = jsxhint_new ? - \ '%A%f: line %l\, col %v\, %m \(%t%*\d\)' : - \ '%E%f: line %l\, col %v\, %m' + let errorformat = '%A%f: line %l\, col %v\, %m \(%t%*\d\)' return SyntasticMake({ \ 'makeprg': makeprg, @@ -42,16 +41,11 @@ function! SyntaxCheckers_javascript_jsxhint_GetLocList() dict \ 'defaults': {'bufnr': bufnr('')} }) endfunction -function! s:JsxhintNew() - return syntastic#util#versionIsAtLeast(syntastic#util#getVersion(expand(g:syntastic_jsxhint_exec) . ' --version'), [1, 1]) -endfunction - -function! s:Args() - " jsxhint uses .jshintrc as config unless --config arg is present - return !empty(g:syntastic_javascript_jsxhint_conf) ? ' --config ' . g:syntastic_javascript_jsxhint_conf : '' -endfunction - call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'javascript', \ 'name': 'jsxhint'}) +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: