From e0b8e87c939b96d7cc2548edb177021d4f9e27bf Mon Sep 17 00:00:00 2001 From: Martin Grenfell Date: Sun, 27 Jan 2013 20:08:30 +0000 Subject: [PATCH] refactor all the syntax checkers to use the new API and dir layout --- plugin/syntastic/checker.vim | 13 ++++++--- syntax_checkers/{ada.vim => ada/gcc.vim} | 10 ++++++- .../osacompile.vim} | 14 +++++----- syntax_checkers/c/checkpatch.vim | 20 +++++++++----- syntax_checkers/c/gcc.vim | 10 ++++--- syntax_checkers/c/sparse.vim | 13 +++++---- syntax_checkers/{co.vim => co/coco.vim} | 10 ++++++- syntax_checkers/{ => coffee}/coffee.vim | 14 ++++++---- syntax_checkers/{cpp.vim => cpp/gpp.vim} | 14 ++++++---- syntax_checkers/{cs.vim => cs/mcs.vim} | 11 +++++--- syntax_checkers/{css.vim => css/csslint.vim} | 17 +++++++----- syntax_checkers/{ => cucumber}/cucumber.vim | 13 +++++---- syntax_checkers/{cuda.vim => cuda/nvcc.vim} | 13 ++++++--- syntax_checkers/{d.vim => d/dmd.vim} | 14 ++++++---- syntax_checkers/dart.vim | 14 ---------- syntax_checkers/dart/dart_analyzer.vim | 10 ++++++- .../{docbk.vim => docbk/xmllint.vim} | 14 ++++++---- syntax_checkers/{ => elixir}/elixir.vim | 13 +++++---- syntax_checkers/{ => erlang}/erlang.vim | 14 +++++----- .../{ => erlang}/erlang_check_file.erl | 0 syntax_checkers/{eruby.vim => eruby/ruby.vim} | 14 ++++++---- .../{fortran.vim => fortran/gfortran.vim} | 15 ++++++----- .../xmllint.vim} | 11 +++----- syntax_checkers/go.vim | 17 ------------ syntax_checkers/go/go.vim | 10 ++++++- syntax_checkers/go/gofmt.vim | 10 ++++++- syntax_checkers/{ => haml}/haml.vim | 13 +++++---- syntax_checkers/haskell.vim | 27 ------------------- syntax_checkers/haskell/ghc-mod.vim | 12 ++++++--- syntax_checkers/haskell/hdevtools.vim | 13 ++++++--- syntax_checkers/{ => haxe}/haxe.vim | 13 +++++---- syntax_checkers/html.vim | 25 ----------------- syntax_checkers/html/tidy.vim | 11 +++++++- syntax_checkers/html/w3.vim | 11 +++++++- syntax_checkers/java.vim | 18 ------------- syntax_checkers/java/checkstyle.vim | 12 ++++++++- syntax_checkers/java/javac.vim | 11 +++++++- syntax_checkers/javascript.vim | 18 ------------- .../javascript/closurecompiler.vim | 14 ++++++---- syntax_checkers/javascript/gjslint.vim | 10 ++++++- syntax_checkers/javascript/jshint.vim | 11 +++++++- syntax_checkers/javascript/jsl.vim | 10 ++++++- syntax_checkers/javascript/jslint.vim | 12 +++++++-- syntax_checkers/json.vim | 18 ------------- syntax_checkers/json/jsonlint.vim | 14 +++++++--- syntax_checkers/json/jsonval.vim | 10 ++++++- syntax_checkers/{ => less}/less-lint.coffee | 0 syntax_checkers/{ => less}/less-lint.js | 0 syntax_checkers/{less.vim => less/lessc.vim} | 14 +++++----- syntax_checkers/{lisp.vim => lisp/clisp.vim} | 14 +++++----- syntax_checkers/{lua.vim => lua/luac.vim} | 13 +++++---- .../{matlab.vim => matlab/mlint.vim} | 12 +++++---- syntax_checkers/{ => nasm}/nasm.vim | 14 +++++----- syntax_checkers/{objc.vim => objc/gcc.vim} | 14 ++++++---- .../{ocaml.vim => ocaml/camlp4o.vim} | 13 +++++---- syntax_checkers/{ => perl}/efm_perl.pl | 0 syntax_checkers/{ => perl}/perl.vim | 13 +++++---- syntax_checkers/{ => php}/php.vim | 14 +++++----- .../{puppet.vim => puppet/puppetlint.vim} | 12 +++++---- syntax_checkers/python.vim | 21 --------------- syntax_checkers/python/flake8.vim | 5 +--- syntax_checkers/python/pyflakes.vim | 6 +---- syntax_checkers/python/pylint.vim | 6 ++--- syntax_checkers/python/python.vim | 8 +++--- .../{rst.vim => rst/rst2pseudoxml.vim} | 13 +++++---- syntax_checkers/ruby.vim | 21 --------------- syntax_checkers/ruby/jruby.vim | 10 ++++++- syntax_checkers/ruby/macruby.vim | 10 ++++++- syntax_checkers/ruby/mri.vim | 13 +++++---- syntax_checkers/{rust.vim => rust/rustc.vim} | 13 ++++----- syntax_checkers/{ => sass}/sass.vim | 13 +++++---- .../{scala.vim => scala/scalac.vim} | 13 +++++---- syntax_checkers/{scss.vim => scss/sass.vim} | 19 +++++++------ syntax_checkers/{ => sh}/sh.vim | 14 ++++++++-- syntax_checkers/{slim.vim => slim/slimrb.vim} | 13 +++++---- syntax_checkers/tcl.vim | 17 ------------ syntax_checkers/tcl/nagelfar.vim | 10 ++++++- syntax_checkers/tcl/tclsh.vim | 13 +++++---- syntax_checkers/{tex.vim => tex/lacheck.vim} | 13 +++++---- .../{twig.vim => twig/twiglint.vim} | 10 ++++++- .../{typescript.vim => typescript/tsc.vim} | 14 ++++++---- syntax_checkers/{vala.vim => vala/valac.vim} | 17 ++++++------ syntax_checkers/{xhtml.vim => xhtml/tidy.vim} | 13 +++++---- syntax_checkers/{xml.vim => xml/xmllint.vim} | 13 +++++---- .../{xslt.vim => xslt/xmllint.vim} | 14 +++++----- syntax_checkers/{yaml.vim => yaml/jsyaml.vim} | 12 ++++++--- .../{z80.vim => z80/z80syntaxchecker.vim} | 11 +++++--- syntax_checkers/{zpt.vim => zpt/zptlint.vim} | 13 +++++---- syntax_checkers/{ => zsh}/zsh.vim | 13 +++++---- 89 files changed, 618 insertions(+), 507 deletions(-) rename syntax_checkers/{ada.vim => ada/gcc.vim} (95%) rename syntax_checkers/{applescript.vim => applescript/osacompile.vim} (83%) rename syntax_checkers/{co.vim => co/coco.vim} (82%) rename syntax_checkers/{ => coffee}/coffee.vim (85%) rename syntax_checkers/{cpp.vim => cpp/gpp.vim} (95%) rename syntax_checkers/{cs.vim => cs/mcs.vim} (81%) rename syntax_checkers/{css.vim => css/csslint.vim} (79%) rename syntax_checkers/{ => cucumber}/cucumber.vim (78%) rename syntax_checkers/{cuda.vim => cuda/nvcc.vim} (89%) rename syntax_checkers/{d.vim => d/dmd.vim} (95%) delete mode 100644 syntax_checkers/dart.vim rename syntax_checkers/{docbk.vim => docbk/xmllint.vim} (81%) rename syntax_checkers/{ => elixir}/elixir.vim (79%) rename syntax_checkers/{ => erlang}/erlang.vim (85%) rename syntax_checkers/{ => erlang}/erlang_check_file.erl (100%) rename syntax_checkers/{eruby.vim => eruby/ruby.vim} (83%) rename syntax_checkers/{fortran.vim => fortran/gfortran.vim} (86%) rename syntax_checkers/{gentoo_metadata.vim => gentoo_metadata/xmllint.vim} (83%) delete mode 100644 syntax_checkers/go.vim rename syntax_checkers/{ => haml}/haml.vim (80%) delete mode 100644 syntax_checkers/haskell.vim rename syntax_checkers/{ => haxe}/haxe.vim (88%) delete mode 100644 syntax_checkers/html.vim delete mode 100644 syntax_checkers/java.vim delete mode 100644 syntax_checkers/javascript.vim delete mode 100644 syntax_checkers/json.vim rename syntax_checkers/{ => less}/less-lint.coffee (100%) rename syntax_checkers/{ => less}/less-lint.js (100%) rename syntax_checkers/{less.vim => less/lessc.vim} (87%) rename syntax_checkers/{lisp.vim => lisp/clisp.vim} (81%) rename syntax_checkers/{lua.vim => lua/luac.vim} (87%) rename syntax_checkers/{matlab.vim => matlab/mlint.vim} (79%) rename syntax_checkers/{ => nasm}/nasm.vim (82%) rename syntax_checkers/{objc.vim => objc/gcc.vim} (96%) rename syntax_checkers/{ocaml.vim => ocaml/camlp4o.vim} (95%) rename syntax_checkers/{ => perl}/efm_perl.pl (100%) rename syntax_checkers/{ => perl}/perl.vim (89%) rename syntax_checkers/{ => php}/php.vim (93%) rename syntax_checkers/{puppet.vim => puppet/puppetlint.vim} (93%) delete mode 100644 syntax_checkers/python.vim rename syntax_checkers/{rst.vim => rst/rst2pseudoxml.vim} (81%) delete mode 100644 syntax_checkers/ruby.vim rename syntax_checkers/{rust.vim => rust/rustc.vim} (82%) rename syntax_checkers/{ => sass}/sass.vim (87%) rename syntax_checkers/{scala.vim => scala/scalac.vim} (80%) rename syntax_checkers/{scss.vim => scss/sass.vim} (68%) rename syntax_checkers/{ => sh}/sh.vim (86%) rename syntax_checkers/{slim.vim => slim/slimrb.vim} (85%) delete mode 100644 syntax_checkers/tcl.vim rename syntax_checkers/{tex.vim => tex/lacheck.vim} (78%) rename syntax_checkers/{twig.vim => twig/twiglint.vim} (79%) rename syntax_checkers/{typescript.vim => typescript/tsc.vim} (69%) rename syntax_checkers/{vala.vim => vala/valac.vim} (87%) rename syntax_checkers/{xhtml.vim => xhtml/tidy.vim} (87%) rename syntax_checkers/{xml.vim => xml/xmllint.vim} (85%) rename syntax_checkers/{xslt.vim => xslt/xmllint.vim} (84%) rename syntax_checkers/{yaml.vim => yaml/jsyaml.vim} (81%) rename syntax_checkers/{z80.vim => z80/z80syntaxchecker.vim} (81%) rename syntax_checkers/{zpt.vim => zpt/zptlint.vim} (83%) rename syntax_checkers/{ => zsh}/zsh.vim (78%) diff --git a/plugin/syntastic/checker.vim b/plugin/syntastic/checker.vim index 519f76e1..f2a6c736 100644 --- a/plugin/syntastic/checker.vim +++ b/plugin/syntastic/checker.vim @@ -10,12 +10,19 @@ let g:SyntasticChecker = {} function! g:SyntasticChecker.New(args) let newObj = copy(self) - let newObj._locListFunc = a:args['loclistFunc'] - let newObj._isAvailableFunc = a:args['isAvailableFunc'] let newObj._filetype = a:args['filetype'] let newObj._name = a:args['name'] - let newObj._highlightRegexFunc = get(a:args, 'highlightRegexFunc', '') + + let prefix = 'SyntaxCheckers_' . newObj._filetype . '_' . newObj._name . '_' + let newObj._locListFunc = function(prefix . 'GetLocList') + let newObj._isAvailableFunc = function(prefix . 'IsAvailable') + + if exists('*' . prefix . 'GetHighlightRegex') + let newObj._highlightRegexFunc = function(prefix. 'GetHighlightRegex') + else + let newObj._highlightRegexFunc = '' + endif return newObj endfunction diff --git a/syntax_checkers/ada.vim b/syntax_checkers/ada/gcc.vim similarity index 95% rename from syntax_checkers/ada.vim rename to syntax_checkers/ada/gcc.vim index ea78ce12..b1bb5b7a 100644 --- a/syntax_checkers/ada.vim +++ b/syntax_checkers/ada/gcc.vim @@ -67,7 +67,11 @@ if !exists('g:syntastic_ada_config_file') let g:syntastic_ada_config_file = '.syntastic_ada_config' endif -function! SyntaxCheckers_ada_GetLocList() +function! SyntaxCheckers_ada_gcc_IsAvailable() + return executable('gcc') +endfunction + +function! SyntaxCheckers_ada_gcc_GetLocList() let makeprg = 'gcc -c -fsyntax-only ' let errorformat = '%-G%f:%s:,%f:%l:%c: %m,%f:%l: %m' @@ -121,6 +125,10 @@ function! SyntaxCheckers_ada_GetLocList() endif endfunction +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'ada', + \ 'name': 'gcc'}) + let &cpo = s:save_cpo unlet s:save_cpo diff --git a/syntax_checkers/applescript.vim b/syntax_checkers/applescript/osacompile.vim similarity index 83% rename from syntax_checkers/applescript.vim rename to syntax_checkers/applescript/osacompile.vim index 7aa5af9b..d3f3d18f 100644 --- a/syntax_checkers/applescript.vim +++ b/syntax_checkers/applescript/osacompile.vim @@ -24,13 +24,11 @@ " Hocevar. See http://sam.zoy.org/wtfpl/COPYING for more details. " "============================================================================ +function! SyntaxCheckers_applescript_osacompile_IsAvailable() + return executable('osacompile') +endfunction -"bail if the user doesnt have osacompile installed -if !executable("osacompile") - finish -endif - -function! SyntaxCheckers_applescript_GetLocList() +function! SyntaxCheckers_applescript_osacompile_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'osacompile', \ 'args': '-o ' . tempname() . '.scpt ' }) @@ -38,3 +36,7 @@ function! SyntaxCheckers_applescript_GetLocList() return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'applescript', + \ 'name': 'osacompile'}) diff --git a/syntax_checkers/c/checkpatch.vim b/syntax_checkers/c/checkpatch.vim index 27fe8ac6..ade875f0 100644 --- a/syntax_checkers/c/checkpatch.vim +++ b/syntax_checkers/c/checkpatch.vim @@ -18,11 +18,14 @@ if executable("checkpatch.pl") let g:syntastic_c_checker_checkpatch_location = 'checkpatch.pl' elseif executable("./scripts/checkpatch.pl") let g:syntastic_c_checker_checkpatch_location = './scripts/checkpatch.pl' -else - finish endif -function! SyntaxCheckers_c_GetLocList() +function SyntaxCheckers_c_checkpatch_IsAvailable() + exists("g:syntastic_c_checker_checkpatch_location") +endfunction + + +function! SyntaxCheckers_c_checkpatch_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': g:syntastic_c_checker_checkpatch_location, \ 'args': '--no-summary --no-tree --terse --file', @@ -30,8 +33,11 @@ function! SyntaxCheckers_c_GetLocList() let errorformat = '%f:%l: %tARNING: %m,%f:%l: %tRROR: %m' - let oclist = SyntasticMake({ 'makeprg': makeprg, - \ 'errorformat': errorformat, - \ 'defaults': {'bufnr': bufnr("")} }) - return loclist + return SyntasticMake({ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'defaults': {'bufnr': bufnr("")} }) endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'c', + \ 'name': 'checkpatch'}) diff --git a/syntax_checkers/c/gcc.vim b/syntax_checkers/c/gcc.vim index a481e46f..69c885ce 100644 --- a/syntax_checkers/c/gcc.vim +++ b/syntax_checkers/c/gcc.vim @@ -73,8 +73,8 @@ if exists('loaded_gcc_syntax_checker') endif let loaded_gcc_syntax_checker = 1 -if !executable(g:syntastic_c_checker) - finish +function SyntaxCheckers_c_gcc_IsAvailable() + return executable(g:syntastic_c_checker) endif let s:save_cpo = &cpo @@ -88,7 +88,7 @@ if !exists('g:syntastic_c_config_file') let g:syntastic_c_config_file = '.syntastic_c_config' endif -function! SyntaxCheckers_c_GetLocList() +function! SyntaxCheckers_c_gcc_GetLocList() let makeprg = g:syntastic_c_checker . ' -x c -fsyntax-only ' let errorformat = '%-G%f:%s:,%-G%f:%l: %#error: %#(Each undeclared '. \ 'identifier is reported only%.%#,%-G%f:%l: %#error: %#for '. @@ -159,6 +159,10 @@ function! SyntaxCheckers_c_GetLocList() endif endfunction +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'c', + \ 'name': 'gcc'}) + let &cpo = s:save_cpo unlet s:save_cpo diff --git a/syntax_checkers/c/sparse.vim b/syntax_checkers/c/sparse.vim index 9bbd02a8..5d2af8f3 100644 --- a/syntax_checkers/c/sparse.vim +++ b/syntax_checkers/c/sparse.vim @@ -13,12 +13,11 @@ if exists("loaded_sparse_syntax_checker") endif let loaded_sparse_syntax_checker = 1 -" Bail if the user doesn't have `sparse.pl` or ./scripts/checkpatch.pl installed. -if !executable("sparse") - finish -endif +function! SyntaxCheckers_c_sparse_IsAvailable() + return executable("sparse") +endfunction -function! SyntaxCheckers_c_GetLocList() +function! SyntaxCheckers_c_sparse_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'sparse', \ 'args': syntastic#c#ReadConfig(g:syntastic_sparse_config_file) }) @@ -31,3 +30,7 @@ function! SyntaxCheckers_c_GetLocList() \ 'defaults': {'bufnr': bufnr("")} }) return loclist endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'c', + \ 'name': 'sparse'}) diff --git a/syntax_checkers/co.vim b/syntax_checkers/co/coco.vim similarity index 82% rename from syntax_checkers/co.vim rename to syntax_checkers/co/coco.vim index 64ecfae0..8129a8ef 100644 --- a/syntax_checkers/co.vim +++ b/syntax_checkers/co/coco.vim @@ -15,7 +15,11 @@ if !executable("coco") finish endif -function! SyntaxCheckers_co_GetLocList() +function! SyntaxCheckers_co_coco_GetLocList() + return executable('coco') +endfunction + +function! SyntaxCheckers_co_coco_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'coco', \ 'args': '-c -o /tmp' }) @@ -23,3 +27,7 @@ function! SyntaxCheckers_co_GetLocList() return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'co', + \ 'name': 'coco'}) diff --git a/syntax_checkers/coffee.vim b/syntax_checkers/coffee/coffee.vim similarity index 85% rename from syntax_checkers/coffee.vim rename to syntax_checkers/coffee/coffee.vim index 100e62c0..26758798 100644 --- a/syntax_checkers/coffee.vim +++ b/syntax_checkers/coffee/coffee.vim @@ -10,17 +10,17 @@ " "============================================================================ -"bail if the user doesnt have coffee installed -if !executable("coffee") - finish -endif if !exists('g:syntastic_coffee_lint_options') let g:syntastic_coffee_lint_options = "" endif -function! SyntaxCheckers_coffee_GetLocList() +function! SyntaxCheckers_coffee_coffee_IsAvailable() + return executable("coffee") && executable('coffeelint') +endfunction + +function! SyntaxCheckers_coffee_coffee_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'coffee', \ 'args': '-c -l -o /tmp' }) @@ -45,3 +45,7 @@ function s:GetCoffeeLintErrors() return lint_results endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'coffee', + \ 'name': 'coffee'}) diff --git a/syntax_checkers/cpp.vim b/syntax_checkers/cpp/gpp.vim similarity index 95% rename from syntax_checkers/cpp.vim rename to syntax_checkers/cpp/gpp.vim index 7be44e37..8e2e3817 100644 --- a/syntax_checkers/cpp.vim +++ b/syntax_checkers/cpp/gpp.vim @@ -80,10 +80,6 @@ if !exists('g:syntastic_cpp_compiler_options') let g:syntastic_cpp_compiler_options = '' endif -if !executable(g:syntastic_cpp_compiler) - finish -endif - let s:save_cpo = &cpo set cpo&vim @@ -91,7 +87,11 @@ if !exists('g:syntastic_cpp_config_file') let g:syntastic_cpp_config_file = '.syntastic_cpp_config' endif -function! SyntaxCheckers_cpp_GetLocList() +function! SyntaxCheckers_cpp_gpp_IsAvailable() + return executable(g:syntastic_cpp_compiler) +endfunction + +function! SyntaxCheckers_cpp_gpp_GetLocList() let makeprg = g:syntastic_cpp_compiler . ' -x c++ -fsyntax-only ' . \ g:syntastic_cpp_compiler_options let errorformat = '%-G%f:%s:,%f:%l:%c: %trror: %m,%f:%l:%c: %tarning: '. @@ -150,6 +150,10 @@ function! SyntaxCheckers_cpp_GetLocList() endif endfunction +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'cpp', + \ 'name': 'gpp'}) + let &cpo = s:save_cpo unlet s:save_cpo diff --git a/syntax_checkers/cs.vim b/syntax_checkers/cs/mcs.vim similarity index 81% rename from syntax_checkers/cs.vim rename to syntax_checkers/cs/mcs.vim index e5408035..d45dc50f 100644 --- a/syntax_checkers/cs.vim +++ b/syntax_checkers/cs/mcs.vim @@ -10,11 +10,11 @@ " "============================================================================ -if !executable('mcs') - finish -endif +function! SyntaxCheckers_cs_mcs_IsAvailable() + return executable('mcs') +endfunction -function! SyntaxCheckers_cs_GetLocList() +function! SyntaxCheckers_cs_mcs_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'mcs', \ 'args': '--parse' }) @@ -24,3 +24,6 @@ function! SyntaxCheckers_cs_GetLocList() \ 'defaults': {'bufnr': bufnr("")} }) endfunction +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'cs', + \ 'name': 'mcs'}) diff --git a/syntax_checkers/css.vim b/syntax_checkers/css/csslint.vim similarity index 79% rename from syntax_checkers/css.vim rename to syntax_checkers/css/csslint.vim index f4a85b94..466375a4 100644 --- a/syntax_checkers/css.vim +++ b/syntax_checkers/css/csslint.vim @@ -18,12 +18,11 @@ if !exists('g:syntastic_csslint_options') let g:syntastic_csslint_options = "" endif -" Bail if the user doesn't have `csslint` installed. -if !executable("csslint") - finish -endif +function! SyntaxCheckers_css_csslint_IsAvailable() + return executable('csslint') +endfunction -function! SyntaxCheckers_css_GetLocList() +function! SyntaxCheckers_css_csslint_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'csslint', \ 'args': '--format=compact ' . g:syntastic_csslint_options }) @@ -32,7 +31,11 @@ function! SyntaxCheckers_css_GetLocList() let errorformat = '%-G,%-G%f: lint free!,%f: line %l\, col %c\, %trror - %m,%f: line %l\, col %c\, %tarning - %m,%f: line %l\, col %c\, %m,' return SyntasticMake({ 'makeprg': makeprg, - \ 'errorformat': errorformat, - \ 'defaults': {'bufnr': bufnr("")} }) + \ 'errorformat': errorformat, + \ 'defaults': {'bufnr': bufnr("")} }) endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'css', + \ 'name': 'csslint'}) diff --git a/syntax_checkers/cucumber.vim b/syntax_checkers/cucumber/cucumber.vim similarity index 78% rename from syntax_checkers/cucumber.vim rename to syntax_checkers/cucumber/cucumber.vim index 352c75a2..f5ee3ad4 100644 --- a/syntax_checkers/cucumber.vim +++ b/syntax_checkers/cucumber/cucumber.vim @@ -10,12 +10,11 @@ " "============================================================================ -"bail if the user doesnt have cucumber installed -if !executable("cucumber") - finish -endif +function! SyntaxCheckers_cucumber_cucumber_IsAvailable() + return executable('cucumber') +endfunction -function! SyntaxCheckers_cucumber_GetLocList() +function! SyntaxCheckers_cucumber_cucumber_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'cucumber', \ 'args': '--dry-run --quiet --strict --format pretty' }) @@ -23,3 +22,7 @@ function! SyntaxCheckers_cucumber_GetLocList() return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'cucumber', + \ 'name': 'cucumber'}) diff --git a/syntax_checkers/cuda.vim b/syntax_checkers/cuda/nvcc.vim similarity index 89% rename from syntax_checkers/cuda.vim rename to syntax_checkers/cuda/nvcc.vim index 3712f1cd..836f318e 100644 --- a/syntax_checkers/cuda.vim +++ b/syntax_checkers/cuda/nvcc.vim @@ -18,11 +18,12 @@ " " let g:syntastic_cuda_arch = "sm_20" -if !executable('nvcc') - finish -endif -function! SyntaxCheckers_cuda_GetLocList() +function! SyntaxCheckers_cuda_nvcc_IsAvailable() + return executable('nvcc') +endfunction + +function! SyntaxCheckers_cuda_nvcc_GetLocList() if exists('g:syntastic_cuda_arch') let arch_flag = '-arch='.g:syntastic_cuda_arch else @@ -42,3 +43,7 @@ function! SyntaxCheckers_cuda_GetLocList() return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'cuda', + \ 'name': 'nvcc'}) diff --git a/syntax_checkers/d.vim b/syntax_checkers/d/dmd.vim similarity index 95% rename from syntax_checkers/d.vim rename to syntax_checkers/d/dmd.vim index 5212115d..147c5bbd 100644 --- a/syntax_checkers/d.vim +++ b/syntax_checkers/d/dmd.vim @@ -64,10 +64,6 @@ " " let g:syntastic_d_remove_include_errors = 1 -if !executable('dmd') - finish -endif - let s:save_cpo = &cpo set cpo&vim @@ -75,7 +71,11 @@ if !exists('g:syntastic_d_config_file') let g:syntastic_d_config_file = '.syntastic_d_config' endif -function! SyntaxCheckers_d_GetLocList() +function! SyntaxCheckers_d_dmd_IsAvailable() + return executable('dmd') +endfunction + +function! SyntaxCheckers_d_dmd_GetLocList() let makeprg = 'dmd -of/dev/null -c ' let errorformat = '%-G%f:%s:,%f(%l): %m,%f:%l: %m' @@ -129,6 +129,10 @@ function! SyntaxCheckers_d_GetLocList() endif endfunction +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'd', + \ 'name': 'dmd'}) + let &cpo = s:save_cpo unlet s:save_cpo diff --git a/syntax_checkers/dart.vim b/syntax_checkers/dart.vim deleted file mode 100644 index 3cbe96ef..00000000 --- a/syntax_checkers/dart.vim +++ /dev/null @@ -1,14 +0,0 @@ -"============================================================================ -"File: dart.vim -"Description: Figures out which dart syntax checker (if any) to load -" from the dart directory. -"Maintainer: Maksim Ryzhikov -"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. -" -"============================================================================ - -call SyntasticLoadChecker('dart') diff --git a/syntax_checkers/dart/dart_analyzer.vim b/syntax_checkers/dart/dart_analyzer.vim index d78be395..af07a1a1 100644 --- a/syntax_checkers/dart/dart_analyzer.vim +++ b/syntax_checkers/dart/dart_analyzer.vim @@ -12,7 +12,11 @@ if !exists("g:syntastic_dart_analyzer_conf") let g:syntastic_dart_analyzer_conf = '' endif -function! SyntaxCheckers_dart_GetLocList() +function! SyntaxCheckers_dart_dart_analyser_IsAvailable() + return executable("dart_analyser") +endif + +function! SyntaxCheckers_dart_dart_analyser_GetLocList() let args = !empty(g:syntastic_dart_analyzer_conf) ? ' ' . g:syntastic_dart_analyzer_conf : '' let makeprg = syntastic#makeprg#build({ \ 'exe': 'dart_analyzer', @@ -22,3 +26,7 @@ function! SyntaxCheckers_dart_GetLocList() let errorformat = '%Efile:%f:%l:%c: %m' return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'dart', + \ 'name': 'dart_analyser'}) diff --git a/syntax_checkers/docbk.vim b/syntax_checkers/docbk/xmllint.vim similarity index 81% rename from syntax_checkers/docbk.vim rename to syntax_checkers/docbk/xmllint.vim index f690f76b..6a987b8a 100644 --- a/syntax_checkers/docbk.vim +++ b/syntax_checkers/docbk/xmllint.vim @@ -10,12 +10,12 @@ " "============================================================================ -"bail if the user doesnt have tidy or grep installed -if !executable("xmllint") - finish -endif -function! SyntaxCheckers_docbk_GetLocList() +function! SyntaxCheckers_docbk_xmllint_IsAvailable() + return executable('xmllint') +endfunction + +function! SyntaxCheckers_docbk_xmllint_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'xmllint', \ 'args': '--xinclude --noout --postvalid' }) @@ -24,3 +24,7 @@ function! SyntaxCheckers_docbk_GetLocList() return loclist endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'docbk', + \ 'name': 'xmllint'}) diff --git a/syntax_checkers/elixir.vim b/syntax_checkers/elixir/elixir.vim similarity index 79% rename from syntax_checkers/elixir.vim rename to syntax_checkers/elixir/elixir.vim index 3e187208..a2f9c7ed 100644 --- a/syntax_checkers/elixir.vim +++ b/syntax_checkers/elixir/elixir.vim @@ -9,12 +9,11 @@ " See http://sam.zoy.org/wtfpl/COPYING for more details. " "============================================================================ +function! SyntaxCheckers_elixir_elixir_IsAvailable() + return executable('elixir') +endfunction -if !executable('elixir') - finish -endif - -function! SyntaxCheckers_elixir_GetLocList() +function! SyntaxCheckers_elixir_elixir_GetLocList() let makeprg = syntastic#makeprg#build({ 'exe': 'elixir' }) let errorformat = '** %*[^\ ] %f:%l: %m' @@ -24,3 +23,7 @@ function! SyntaxCheckers_elixir_GetLocList() return elixir_results endif endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'elixir', + \ 'name': 'elixir'}) diff --git a/syntax_checkers/erlang.vim b/syntax_checkers/erlang/erlang.vim similarity index 85% rename from syntax_checkers/erlang.vim rename to syntax_checkers/erlang/erlang.vim index 2951388c..d03dda23 100644 --- a/syntax_checkers/erlang.vim +++ b/syntax_checkers/erlang/erlang.vim @@ -10,18 +10,16 @@ " "============================================================================ -"bail if the user doesnt have escript installed -if !executable("escript") - finish -endif - let s:check_file = expand(':p:h') . '/erlang_check_file.erl' if !exists("g:syntastic_erlc_include_path") let g:syntastic_erlc_include_path="" endif +function! SyntaxCheckers_erlang_escript_IsAvailable() + return executable('escript') +endfunction -function! SyntaxCheckers_erlang_GetLocList() +function! SyntaxCheckers_erlang_escript_GetLocList() let extension = expand('%:e') if match(extension, 'hrl') >= 0 return [] @@ -40,3 +38,7 @@ function! SyntaxCheckers_erlang_GetLocList() return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'erlang', + \ 'name': 'escript'}) diff --git a/syntax_checkers/erlang_check_file.erl b/syntax_checkers/erlang/erlang_check_file.erl similarity index 100% rename from syntax_checkers/erlang_check_file.erl rename to syntax_checkers/erlang/erlang_check_file.erl diff --git a/syntax_checkers/eruby.vim b/syntax_checkers/eruby/ruby.vim similarity index 83% rename from syntax_checkers/eruby.vim rename to syntax_checkers/eruby/ruby.vim index ecc71952..a20422a2 100644 --- a/syntax_checkers/eruby.vim +++ b/syntax_checkers/eruby/ruby.vim @@ -14,12 +14,12 @@ if !exists("g:syntastic_ruby_exec") let g:syntastic_ruby_exec = "ruby" endif -"bail if the user doesnt have ruby installed -if !executable(expand(g:syntastic_ruby_exec)) - finish -endif -function! SyntaxCheckers_eruby_GetLocList() +function! SyntaxCheckers_eruby_ruby_IsAvailable() + executable(expand(g:syntastic_ruby_exec)) +endfunction + +function! SyntaxCheckers_eruby_ruby_GetLocList() let ruby_exec=expand(g:syntastic_ruby_exec) if !has('win32') let ruby_exec='RUBYOPT= ' . ruby_exec @@ -34,3 +34,7 @@ function! SyntaxCheckers_eruby_GetLocList() return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat}) endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'erlang', + \ 'name': 'ruby'}) diff --git a/syntax_checkers/fortran.vim b/syntax_checkers/fortran/gfortran.vim similarity index 86% rename from syntax_checkers/fortran.vim rename to syntax_checkers/fortran/gfortran.vim index fc2a7a82..63678172 100644 --- a/syntax_checkers/fortran.vim +++ b/syntax_checkers/fortran/gfortran.vim @@ -18,16 +18,15 @@ " "============================================================================ -"bail if the user doesnt have fortran installed -if !executable("gfortran") - finish -endif - if !exists('g:syntastic_fortran_flags') let g:syntastic_fortran_flags = '' endif -function! SyntaxCheckers_fortran_GetLocList() +function! SyntaxCheckers_fortran_gfortran_IsAvailable() + return executable('gfortran') +endfunction + +function! SyntaxCheckers_fortran_gfortran_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'gfortran', \ 'args': s:args() }) @@ -42,3 +41,7 @@ function s:args() endif return rv endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'fortran', + \ 'name': 'gfortran'}) diff --git a/syntax_checkers/gentoo_metadata.vim b/syntax_checkers/gentoo_metadata/xmllint.vim similarity index 83% rename from syntax_checkers/gentoo_metadata.vim rename to syntax_checkers/gentoo_metadata/xmllint.vim index 0626714f..24bef2c8 100644 --- a/syntax_checkers/gentoo_metadata.vim +++ b/syntax_checkers/gentoo_metadata/xmllint.vim @@ -20,13 +20,8 @@ " See xmlcatalog(1) and http://www.xmlsoft.org/catalog.html for more " information. -"bail if the user doesn't have xmllint installed -if !executable("xmllint") - finish -endif +runtime syntax_checkers/xml/xmllint.vim -runtime syntax_checkers/xml.vim - -function! SyntaxCheckers_gentoo_metadata_GetLocList() - return SyntaxCheckers_xml_GetLocList() +function! SyntaxCheckers_gentoo_metadata_xmllint_GetLocList() + return SyntaxCheckers_xml_xmllint_GetLocList() endfunction diff --git a/syntax_checkers/go.vim b/syntax_checkers/go.vim deleted file mode 100644 index 712b656d..00000000 --- a/syntax_checkers/go.vim +++ /dev/null @@ -1,17 +0,0 @@ -"============================================================================ -"File: go.vim -"Description: Loads a go syntax checker from the go directory -"Maintainer: Martin Grenfell -"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. -" -" Use g:syntastic_go_checker option to specify which go executable -" should be used (see below for a list of supported checkers). -" If g:syntastic_go_checker is not set, just use the first syntax -" checker that we find installed. -"============================================================================ - -call SyntasticLoadChecker('go') diff --git a/syntax_checkers/go/go.vim b/syntax_checkers/go/go.vim index ddb32a93..52632581 100644 --- a/syntax_checkers/go/go.vim +++ b/syntax_checkers/go/go.vim @@ -12,7 +12,11 @@ " Use a BufWritePre autocommand to that end: " autocmd FileType go autocmd BufWritePre Fmt "============================================================================ -function! SyntaxCheckers_go_GetLocList() +function! SyntaxCheckers_go_go_IsAvailable() + return executable('go') +endfunction + +function! SyntaxCheckers_go_go_GetLocList() " Check with gofmt first, since `go build` and `go test` might not report " syntax errors in the current file if another file with syntax error is " compiled first. @@ -49,3 +53,7 @@ function! SyntaxCheckers_go_GetLocList() return errors endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'go', + \ 'name': 'go'}) diff --git a/syntax_checkers/go/gofmt.vim b/syntax_checkers/go/gofmt.vim index 4b777659..4aedcae4 100644 --- a/syntax_checkers/go/gofmt.vim +++ b/syntax_checkers/go/gofmt.vim @@ -12,7 +12,11 @@ " Use a BufWritePre autocommand to that end: " autocmd FileType go autocmd BufWritePre Fmt "============================================================================ -function! SyntaxCheckers_go_GetLocList() +function! SyntaxCheckers_go_gofmt_IsAvailable() + return executable('go') +endfunction + +function! SyntaxCheckers_go_gofmt_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'gofmt', \ 'args': '-l', @@ -21,3 +25,7 @@ function! SyntaxCheckers_go_GetLocList() let errorformat = '%f:%l:%c: %m,%-G%.%#' return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat, 'defaults': {'type': 'e'} }) endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'go', + \ 'name': 'gofmt'}) diff --git a/syntax_checkers/haml.vim b/syntax_checkers/haml/haml.vim similarity index 80% rename from syntax_checkers/haml.vim rename to syntax_checkers/haml/haml.vim index 6d4c1929..d62663ef 100644 --- a/syntax_checkers/haml.vim +++ b/syntax_checkers/haml/haml.vim @@ -10,15 +10,18 @@ " "============================================================================ -"bail if the user doesnt have the haml binary installed -if !executable("haml") - finish -endif +function! SyntaxCheckers_haml_haml_IsAvailable() + return executable('haml') +endfunction -function! SyntaxCheckers_haml_GetLocList() +function! SyntaxCheckers_haml_haml_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'haml', \ 'args': '-c' }) let errorformat = 'Haml error on line %l: %m,Syntax error on line %l: %m,%-G%.%#' return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'haml', + \ 'name': 'haml'}) diff --git a/syntax_checkers/haskell.vim b/syntax_checkers/haskell.vim deleted file mode 100644 index 3f029795..00000000 --- a/syntax_checkers/haskell.vim +++ /dev/null @@ -1,27 +0,0 @@ -"============================================================================ -"File: haskell.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: Anthony Carapetis -"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:syntastic_haskell_checker') - if executable('hdevtools') - runtime! syntax_checkers/haskell/hdevtools.vim - elseif executable('ghc-mod') - runtime! syntax_checkers/haskell/ghc-mod.vim - endif -elseif g:syntastic_haskell_checker == 'hdevtools' - if executable('hdevtools') - runtime! syntax_checkers/haskell/hdevtools.vim - endif -elseif g:syntastic_haskell_checker == 'ghc-mod' - if executable('ghc-mod') - runtime! syntax_checkers/haskell/ghc-mod.vim - endif -endif diff --git a/syntax_checkers/haskell/ghc-mod.vim b/syntax_checkers/haskell/ghc-mod.vim index 9b06ae65..2e0fbdae 100644 --- a/syntax_checkers/haskell/ghc-mod.vim +++ b/syntax_checkers/haskell/ghc-mod.vim @@ -14,7 +14,11 @@ if !exists('g:syntastic_haskell_checker_args') let g:syntastic_haskell_checker_args = '--ghcOpt="-fno-code" --hlintOpt="--language=XmlSyntax"' endif -function! SyntaxCheckers_haskell_GetLocList() +function! SyntaxCheckers_haskell_ghc_mod_IsAvailable() + return executable('ghc-mod') +endfunction + +function! SyntaxCheckers_haskell_ghc_mod_GetLocList() let ghcmod = 'ghc-mod ' . g:syntastic_haskell_checker_args let makeprg = \ "{ ". @@ -28,6 +32,6 @@ function! SyntaxCheckers_haskell_GetLocList() return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) endfunction -function! SyntaxCheckers_lhaskell_GetLocList() - return SyntaxCheckers_haskell_GetLocList() -endfunction +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'haskell', + \ 'name': 'ghc_mod'}) diff --git a/syntax_checkers/haskell/hdevtools.vim b/syntax_checkers/haskell/hdevtools.vim index ad479e76..d8c4a96e 100644 --- a/syntax_checkers/haskell/hdevtools.vim +++ b/syntax_checkers/haskell/hdevtools.vim @@ -10,7 +10,11 @@ " "============================================================================ -function! SyntaxCheckers_haskell_GetLocList() +function! SyntaxCheckers_haskell_hdevtools_IsAvailable() + return executable('hdevtools') +endfunction + +function! SyntaxCheckers_haskell_hdevtools_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'hdevtools check', \ 'args': get(g:, 'hdevtools_options', ''), @@ -27,6 +31,7 @@ function! SyntaxCheckers_haskell_GetLocList() return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) endfunction -function! SyntaxCheckers_lhaskell_GetLocList() - return SyntaxCheckers_haskell_GetLocList() -endfunction +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'haskell', + \ 'name': 'hdevtools'}) + diff --git a/syntax_checkers/haxe.vim b/syntax_checkers/haxe/haxe.vim similarity index 88% rename from syntax_checkers/haxe.vim rename to syntax_checkers/haxe/haxe.vim index 2bddbd72..ed9ec195 100644 --- a/syntax_checkers/haxe.vim +++ b/syntax_checkers/haxe/haxe.vim @@ -10,10 +10,9 @@ " "============================================================================ -"bail if the user doesn't have haxe installed -if !executable("haxe") - finish -endif +function! SyntaxCheckers_haxe_haxe_IsAvailable() + return executable('haxe') +endfunction " s:FindInParent " find the file argument and returns the path to it. @@ -39,7 +38,7 @@ function! s:FindInParent(fln,flsrt,flstp) return ['fail', '', ''] endfunction -function! SyntaxCheckers_haxe_GetLocList() +function! SyntaxCheckers_haxe_haxe_GetLocList() let [success, hxmldir, hxmlname] = s:FindInParent('*.hxml', expand('%:p:h'), '/') if success == 'ok' let makeprg = 'cd ' . hxmldir . '; haxe ' . hxmlname @@ -49,3 +48,7 @@ function! SyntaxCheckers_haxe_GetLocList() return SyntasticMake({}) endif endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'haxe', + \ 'name': 'haxe'}) diff --git a/syntax_checkers/html.vim b/syntax_checkers/html.vim deleted file mode 100644 index a6a09014..00000000 --- a/syntax_checkers/html.vim +++ /dev/null @@ -1,25 +0,0 @@ -"============================================================================ -"File: html.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: Martin Grenfell -"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:syntastic_html_checker') - let g:syntastic_html_checker = "tidy" -endif - -if g:syntastic_html_checker == "tidy" - if executable("tidy") && executable("grep") - runtime! syntax_checkers/html/tidy.vim - endif -elseif g:syntastic_html_checker == "w3" - if executable("curl") && executable("sed") - runtime! syntax_checkers/html/w3.vim - endif -endif diff --git a/syntax_checkers/html/tidy.vim b/syntax_checkers/html/tidy.vim index 1e8b2e38..f073deaf 100644 --- a/syntax_checkers/html/tidy.vim +++ b/syntax_checkers/html/tidy.vim @@ -57,7 +57,11 @@ function s:Args() let args .= " -e" endfunction -function! SyntaxCheckers_html_GetLocList() +function! SyntaxCheckers_html_tidy_IsAvailable() + return executable('tidy') +endfunction + +function! SyntaxCheckers_html_tidy_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'tidy', \ 'args': s:Args(), @@ -85,3 +89,8 @@ function! SyntaxCheckers_html_GetLocList() return loclist endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'html', + \ 'name': 'tidy'}) + diff --git a/syntax_checkers/html/w3.vim b/syntax_checkers/html/w3.vim index 032de314..345cb9aa 100644 --- a/syntax_checkers/html/w3.vim +++ b/syntax_checkers/html/w3.vim @@ -9,7 +9,11 @@ " See http://sam.zoy.org/wtfpl/COPYING for more details. " "============================================================================ -function! SyntaxCheckers_html_GetLocList() +function! SyntaxCheckers_html_w3_IsAvailable() + return executable('curl') && executable('sed') +endfunction + +function! SyntaxCheckers_html_w3_GetLocList() let makeprg2="curl -s -F output=text -F \"uploaded_file=@".expand('%:p').";type=text/html\" http://validator.w3.org/check \\| sed -n -e '/\Line\.\*/ \{ N; s/\\n//; N; s/\\n//; /msg/p; \}' -e ''/msg_warn/p'' -e ''/msg_info/p'' \\| sed -e 's/[ ]\\+/ /g' -e 's/\<[\^\>]\*\>//g' -e 's/\^[ ]//g'" let errorformat2='Line %l\, Column %c: %m' let loclist = SyntasticMake({ 'makeprg': makeprg2, 'errorformat': errorformat2 }) @@ -30,3 +34,8 @@ function! SyntaxCheckers_html_GetLocList() return loclist endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'html', + \ 'name': 'w3'}) + diff --git a/syntax_checkers/java.vim b/syntax_checkers/java.vim deleted file mode 100644 index 7208ac26..00000000 --- a/syntax_checkers/java.vim +++ /dev/null @@ -1,18 +0,0 @@ -"============================================================================ -"File: java.vim -"Description: Figures out which java syntax checker (if any) to load -" from the java directory. -"Maintainer: Dmitry Geurkov -"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. -" -" Use g:syntastic_java_checker option to specify which java syntax checker -" should be used (see below for a list of supported checkers). -" If g:syntastic_java_checker is not set, just use the first syntax -" checker that we find installed. -"============================================================================ - -call SyntasticLoadChecker('java') diff --git a/syntax_checkers/java/checkstyle.vim b/syntax_checkers/java/checkstyle.vim index ddca0cec..8b208c6f 100644 --- a/syntax_checkers/java/checkstyle.vim +++ b/syntax_checkers/java/checkstyle.vim @@ -17,7 +17,12 @@ endif if !exists("g:syntastic_java_checkstyle_conf_file") let g:syntastic_java_checkstyle_conf_file = 'sun_checks.xml' endif -function! SyntaxCheckers_java_GetLocList() + +function! SyntaxCheckers_java_checkstyle_IsAvailable() + return executable('java') +endfunction + +function! SyntaxCheckers_java_checkstyle_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'java', \ 'args': '-cp ' . g:syntastic_java_checkstyle_classpath . ' com.puppycrawl.tools.checkstyle.Main -c ' . g:syntastic_java_checkstyle_conf_file, @@ -31,3 +36,8 @@ function! SyntaxCheckers_java_GetLocList() return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'java', + \ 'name': 'checkstyle'}) + diff --git a/syntax_checkers/java/javac.vim b/syntax_checkers/java/javac.vim index fcbbe81d..46505f15 100644 --- a/syntax_checkers/java/javac.vim +++ b/syntax_checkers/java/javac.vim @@ -158,7 +158,11 @@ function! s:GetMavenClasspath() return '' endfunction -function! SyntaxCheckers_java_GetLocList() +function! SyntaxCheckers_java_javac_IsAvailable() + return executable(g:syntastic_java_javac_executable) +endfunction + +function! SyntaxCheckers_java_javac_GetLocList() let javac_opts = g:syntastic_java_javac_options @@ -232,3 +236,8 @@ function! SyntaxCheckers_java_GetLocList() return r endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'java', + \ 'name': 'javac'}) + diff --git a/syntax_checkers/javascript.vim b/syntax_checkers/javascript.vim deleted file mode 100644 index 28561a5a..00000000 --- a/syntax_checkers/javascript.vim +++ /dev/null @@ -1,18 +0,0 @@ -"============================================================================ -"File: javascript.vim -"Description: Figures out which javascript syntax checker (if any) to load -" from the javascript directory. -"Maintainer: Martin Grenfell -"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. -" -" Use g:syntastic_javascript_checker option to specify which jslint executable -" should be used (see below for a list of supported checkers). -" If g:syntastic_javascript_checker is not set, just use the first syntax -" checker that we find installed. -"============================================================================ - -call SyntasticLoadChecker('javascript') diff --git a/syntax_checkers/javascript/closurecompiler.vim b/syntax_checkers/javascript/closurecompiler.vim index 3e32846f..afb081e2 100644 --- a/syntax_checkers/javascript/closurecompiler.vim +++ b/syntax_checkers/javascript/closurecompiler.vim @@ -25,12 +25,11 @@ if !exists("g:syntastic_javascript_closure_compiler_options") let g:syntastic_javascript_closure_compiler_options = "" endif -"bail if the user does not specify the path to closure compiler. -if !exists("g:syntastic_javascript_closure_compiler_path") - finish -endif +function! SyntaxCheckers_javascript_closurecompiler_IsAvailable() + return exists("g:syntastic_javascript_closure_compiler_path") +endfunction -function! SyntaxCheckers_javascript_GetLocList() +function! SyntaxCheckers_javascript_closurecompiler_GetLocList() if exists("g:syntastic_javascript_closure_compiler_file_list") let file_list = join(readfile(g:syntastic_javascript_closure_compiler_file_list), ' ') else @@ -46,3 +45,8 @@ function! SyntaxCheckers_javascript_GetLocList() let errorformat = '%-GOK,%E%f:%l: ERROR - %m,%Z%p^,%W%f:%l: WARNING - %m,%Z%p^' return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'javascript', + \ 'name': 'closurecompiler'}) + diff --git a/syntax_checkers/javascript/gjslint.vim b/syntax_checkers/javascript/gjslint.vim index b4d75e94..2c79cae6 100644 --- a/syntax_checkers/javascript/gjslint.vim +++ b/syntax_checkers/javascript/gjslint.vim @@ -12,7 +12,11 @@ if !exists("g:syntastic_javascript_gjslint_conf") let g:syntastic_javascript_gjslint_conf = "" endif -function! SyntaxCheckers_javascript_GetLocList() +function! SyntaxCheckers_javascript_gjslint_IsAvailable() + return executable('gjslint') +endfunction + +function! SyntaxCheckers_javascript_gjslint_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'gjslint', \ 'args': g:syntastic_javascript_gjslint_conf . " --nosummary --unix_mode --nodebug_indentation --nobeep", @@ -21,3 +25,7 @@ function! SyntaxCheckers_javascript_GetLocList() return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) endfunction +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'javascript', + \ 'name': 'gjslint'}) + diff --git a/syntax_checkers/javascript/jshint.vim b/syntax_checkers/javascript/jshint.vim index 600cb351..1557f712 100644 --- a/syntax_checkers/javascript/jshint.vim +++ b/syntax_checkers/javascript/jshint.vim @@ -12,7 +12,11 @@ if !exists("g:syntastic_javascript_jshint_conf") let g:syntastic_javascript_jshint_conf = "" endif -function! SyntaxCheckers_javascript_GetLocList() +function! SyntaxCheckers_javascript_jshint_IsAvailable() + return executable('jshint') +endfunction + +function! SyntaxCheckers_javascript_jshint_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'jshint', \ 'post_args': s:Args(), @@ -26,3 +30,8 @@ function s:Args() " node-jshint uses .jshintrc as config unless --config arg is present return !empty(g:syntastic_javascript_jshint_conf) ? ' --config ' . g:syntastic_javascript_jshint_conf : '' endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'javascript', + \ 'name': 'jshint'}) + diff --git a/syntax_checkers/javascript/jsl.vim b/syntax_checkers/javascript/jsl.vim index fc1c9899..ebf351ed 100644 --- a/syntax_checkers/javascript/jsl.vim +++ b/syntax_checkers/javascript/jsl.vim @@ -20,7 +20,11 @@ function s:ConfFlag() return "" endfunction -function! SyntaxCheckers_javascript_GetLocList() +function! SyntaxCheckers_javascript_jsl_IsAvailable() + return executable('jsl') +endfunction + +function! SyntaxCheckers_javascript_jsl_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'jsl', \ 'args': s:ConfFlag() . " -nologo -nofilelisting -nosummary -nocontext -process", @@ -29,3 +33,7 @@ function! SyntaxCheckers_javascript_GetLocList() return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) endfunction +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'javascript', + \ 'name': 'jsl'}) + diff --git a/syntax_checkers/javascript/jslint.vim b/syntax_checkers/javascript/jslint.vim index 44abed70..1c83b748 100644 --- a/syntax_checkers/javascript/jslint.vim +++ b/syntax_checkers/javascript/jslint.vim @@ -14,13 +14,17 @@ if !exists("g:syntastic_javascript_jslint_conf") let g:syntastic_javascript_jslint_conf = "--white --undef --nomen --regexp --plusplus --bitwise --newcap --sloppy --vars" endif -function! SyntaxCheckers_javascript_HighlightTerm(error) +function! SyntaxCheckers_javascript_jslint_IsAvailable() + return executable('jslint') +endfunction + +function! SyntaxCheckers_javascript_jslint_HighlightTerm(error) let unexpected = matchstr(a:error['text'], 'Expected.*and instead saw \'\zs.*\ze\'') if len(unexpected) < 1 | return '' | end return '\V'.split(unexpected, "'")[1] endfunction -function! SyntaxCheckers_javascript_GetLocList() +function! SyntaxCheckers_javascript_jslint_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'jslint', \ 'args': g:syntastic_javascript_jslint_conf, @@ -29,3 +33,7 @@ function! SyntaxCheckers_javascript_GetLocList() return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat, 'defaults': {'bufnr': bufnr("")} }) endfunction +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'javascript', + \ 'name': 'jslint'}) + diff --git a/syntax_checkers/json.vim b/syntax_checkers/json.vim deleted file mode 100644 index e6a1f25a..00000000 --- a/syntax_checkers/json.vim +++ /dev/null @@ -1,18 +0,0 @@ -"============================================================================ -"File: json.vim -"Description: Figures out which json syntax checker (if any) to load -" from the json directory. -"Maintainer: Miller Medeiros -"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. -" -" Use g:syntastic_json_checker option to specify which jsonlint executable -" should be used (see below for a list of supported checkers). -" If g:syntastic_json_checker is not set, just use the first syntax -" checker that we find installed. -"============================================================================ - -call SyntasticLoadChecker('json') diff --git a/syntax_checkers/json/jsonlint.vim b/syntax_checkers/json/jsonlint.vim index 6b697486..97a85795 100644 --- a/syntax_checkers/json/jsonlint.vim +++ b/syntax_checkers/json/jsonlint.vim @@ -1,7 +1,5 @@ "============================================================================ -"File: jsonlint.vim -"Description: JSON syntax checker - using jsonlint -"Maintainer: Miller Medeiros +"File: jsonlint.vim "Description: JSON syntax checker - using jsonlint "Maintainer: Miller Medeiros "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 @@ -9,7 +7,11 @@ " See http://sam.zoy.org/wtfpl/COPYING for more details. "============================================================================ -function! SyntaxCheckers_json_GetLocList() +function! SyntaxCheckers_json_jsonlint_IsAvailable() + return executable('jsonlint') +endfunction + +function! SyntaxCheckers_json_jsonlint_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'jsonlint', \ 'post_args': '--compact', @@ -17,3 +19,7 @@ function! SyntaxCheckers_json_GetLocList() let errorformat = '%ELine %l:%c,%Z\\s%#Reason: %m,%C%.%#,%f: line %l\, col %c\, %m,%-G%.%#' return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat, 'defaults': {'bufnr': bufnr('')} }) endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'json', + \ 'name': 'jsonlint'}) diff --git a/syntax_checkers/json/jsonval.vim b/syntax_checkers/json/jsonval.vim index 6a80ce91..4d65fa4e 100644 --- a/syntax_checkers/json/jsonval.vim +++ b/syntax_checkers/json/jsonval.vim @@ -9,9 +9,17 @@ " See http://sam.zoy.org/wtfpl/COPYING for more details. "============================================================================ -function! SyntaxCheckers_json_GetLocList() +function! SyntaxCheckers_json_jsonlint_IsAvailable() + return executable('jsonval') +endfunction + +function! SyntaxCheckers_json_jsonval_GetLocList() " based on https://gist.github.com/1196345 let makeprg = syntastic#makeprg#build({ 'exe': 'jsonval', 'subchecker': 'jsonval' }) let errorformat = '%E%f:\ %m\ at\ line\ %l,%-G%.%#' return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat, 'defaults': {'bufnr': bufnr('')} }) endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'json', + \ 'name': 'jsonval'}) diff --git a/syntax_checkers/less-lint.coffee b/syntax_checkers/less/less-lint.coffee similarity index 100% rename from syntax_checkers/less-lint.coffee rename to syntax_checkers/less/less-lint.coffee diff --git a/syntax_checkers/less-lint.js b/syntax_checkers/less/less-lint.js similarity index 100% rename from syntax_checkers/less-lint.js rename to syntax_checkers/less/less-lint.js diff --git a/syntax_checkers/less.vim b/syntax_checkers/less/lessc.vim similarity index 87% rename from syntax_checkers/less.vim rename to syntax_checkers/less/lessc.vim index 9747cfed..111a3a24 100644 --- a/syntax_checkers/less.vim +++ b/syntax_checkers/less/lessc.vim @@ -17,11 +17,6 @@ " To use less-lint instead of less set the variable " g:syntastic_less_use_less_lint. -"bail if the user doesnt have the lessc binary installed -if !executable("lessc") - finish -endif - if !exists("g:syntastic_less_options") let g:syntastic_less_options = "--no-color" endif @@ -36,7 +31,11 @@ else let s:check_file = 'lessc' end -function! SyntaxCheckers_less_GetLocList() +function! SyntaxCheckers_less_lessc_GetLocList() + return executable('lessc') +endfunction + +function! SyntaxCheckers_less_lessc_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': s:check_file, \ 'args': g:syntastic_less_options, @@ -48,3 +47,6 @@ function! SyntaxCheckers_less_GetLocList() \ 'defaults': {'bufnr': bufnr(""), 'text': "Syntax error"} }) endfunction +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'less', + \ 'name': 'lessc'}) diff --git a/syntax_checkers/lisp.vim b/syntax_checkers/lisp/clisp.vim similarity index 81% rename from syntax_checkers/lisp.vim rename to syntax_checkers/lisp/clisp.vim index a7e826ee..fa03651f 100644 --- a/syntax_checkers/lisp.vim +++ b/syntax_checkers/lisp/clisp.vim @@ -9,13 +9,11 @@ " See http://sam.zoy.org/wtfpl/COPYING for more details. " "============================================================================ +function! SyntaxCheckers_lisp_clisp_IsAvailable() + return executable("clisp") +endfunction -" Bail if the user doesnt have clisp installed -if !executable("clisp") - finish -endif - -function! SyntaxCheckers_lisp_GetLocList() +function! SyntaxCheckers_lisp_clisp_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'clisp', \ 'args': '-c' @@ -26,3 +24,7 @@ function! SyntaxCheckers_lisp_GetLocList() let efm .= '%-G%.%#' return SyntasticMake({ 'makeprg': makeprg, 'errorformat': efm }) endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'lisp', + \ 'name': 'clisp'}) diff --git a/syntax_checkers/lua.vim b/syntax_checkers/lua/luac.vim similarity index 87% rename from syntax_checkers/lua.vim rename to syntax_checkers/lua/luac.vim index 441b1415..9b7e33dd 100644 --- a/syntax_checkers/lua.vim +++ b/syntax_checkers/lua/luac.vim @@ -10,10 +10,9 @@ " "============================================================================ -" check if the lua compiler is installed -if !executable('luac') - finish -endif +function! SyntaxCheckers_lua_luac_IsAvailable() + return executable('luac') +endfunction function! SyntaxCheckers_lua_GetHighlightRegex(pos) let near = matchstr(a:pos['text'], "near '[^']\\+'") @@ -38,7 +37,8 @@ function! SyntaxCheckers_lua_GetHighlightRegex(pos) return result endfunction -function! SyntaxCheckers_lua_GetLocList() + +function! SyntaxCheckers_lua_luac_GetLocList() let makeprg = syntastic#makeprg#build({ 'exe': 'luac', 'args': '-p' }) let errorformat = 'luac: %#%f:%l: %m' @@ -48,3 +48,6 @@ function! SyntaxCheckers_lua_GetLocList() endfunction +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'lua', + \ 'name': 'luac'}) diff --git a/syntax_checkers/matlab.vim b/syntax_checkers/matlab/mlint.vim similarity index 79% rename from syntax_checkers/matlab.vim rename to syntax_checkers/matlab/mlint.vim index 9ba0c0d6..1c1d00fe 100644 --- a/syntax_checkers/matlab.vim +++ b/syntax_checkers/matlab/mlint.vim @@ -10,14 +10,16 @@ " "============================================================================ -"bail if the user doesn't have mlint installed -if !executable("mlint") - finish -endif +function! SyntaxCheckers_matlab_mlint_IsAvailable() + return executable("mlint") +endfunction -function! SyntaxCheckers_matlab_GetLocList() +function! SyntaxCheckers_matlab_mlint_GetLocList() let makeprg = syntastic#makeprg#build({ 'exe': 'mlint', 'args': '-id $*' }) let errorformat = 'L %l (C %c): %*[a-zA-Z0-9]: %m,L %l (C %c-%*[0-9]): %*[a-zA-Z0-9]: %m' return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat, 'defaults': {'bufnr': bufnr("")} }) endfunction +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'matlab', + \ 'name': 'mlint'}) diff --git a/syntax_checkers/nasm.vim b/syntax_checkers/nasm/nasm.vim similarity index 82% rename from syntax_checkers/nasm.vim rename to syntax_checkers/nasm/nasm.vim index a49241a0..0d6157ca 100644 --- a/syntax_checkers/nasm.vim +++ b/syntax_checkers/nasm/nasm.vim @@ -9,13 +9,11 @@ " See http://sam.zoy.org/wtfpl/COPYING for more details. " "============================================================================ +function! SyntaxCheckers_nasm_nasm_GetLocList() + return executable("nasm") +endfunction -"bail if the user doesnt have nasm installed -if !executable("nasm") - finish -endif - -function! SyntaxCheckers_nasm_GetLocList() +function! SyntaxCheckers_nasm_nasm_GetLocList() if has("win32") let outfile="NUL" else @@ -28,3 +26,7 @@ function! SyntaxCheckers_nasm_GetLocList() let errorformat = '%f:%l: %t%*[^:]: %m' return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'nasm', + \ 'name': 'nasm'}) diff --git a/syntax_checkers/objc.vim b/syntax_checkers/objc/gcc.vim similarity index 96% rename from syntax_checkers/objc.vim rename to syntax_checkers/objc/gcc.vim index c532e10f..3162c3f0 100644 --- a/syntax_checkers/objc.vim +++ b/syntax_checkers/objc/gcc.vim @@ -64,10 +64,6 @@ " " let g:syntastic_objc_errorformat = '%f:%l:%c: %trror: %m' -if !executable('gcc') - finish -endif - let s:save_cpo = &cpo set cpo&vim @@ -79,7 +75,11 @@ if !exists('g:syntastic_objc_config_file') let g:syntastic_objc_config_file = '.syntastic_objc_config' endif -function! SyntaxCheckers_objc_GetLocList() +function! SyntaxCheckers_objc_gcc_IsAvailable() + return executable('gcc') +endfunction + +function! SyntaxCheckers_objc_gcc_GetLocList() let makeprg = 'gcc -fsyntax-only -lobjc' let errorformat = \ '%-G%f:%s:,'. @@ -149,6 +149,10 @@ function! SyntaxCheckers_objc_GetLocList() endif endfunction +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'objc', + \ 'name': 'gcc'}) + let &cpo = s:save_cpo unlet s:save_cpo diff --git a/syntax_checkers/ocaml.vim b/syntax_checkers/ocaml/camlp4o.vim similarity index 95% rename from syntax_checkers/ocaml.vim rename to syntax_checkers/ocaml/camlp4o.vim index e8c886fd..450e1bdc 100644 --- a/syntax_checkers/ocaml.vim +++ b/syntax_checkers/ocaml/camlp4o.vim @@ -55,10 +55,9 @@ else let s:ocamlpp="camlp4o" endif -"bail if the user doesnt have the preprocessor -if !executable(s:ocamlpp) - finish -endif +function! SyntaxCheckers_ocaml_camlp4o_IsAvailable() + return executable(s:ocamlpp) +endfunction if !exists('g:syntastic_ocaml_use_ocamlc') || !executable('ocamlc') let g:syntastic_ocaml_use_ocamlc = 0 @@ -72,7 +71,7 @@ if !exists('g:syntastic_ocaml_use_ocamlbuild') || !executable("ocamlbuild") let g:syntastic_ocaml_use_ocamlbuild = 0 endif -function! SyntaxCheckers_ocaml_GetLocList() +function! SyntaxCheckers_ocaml_camlp4o_GetLocList() let makeprg = s:GetMakeprg() if makeprg == "" return [] @@ -138,3 +137,7 @@ function s:GetOtherMakeprg() return makeprg endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'ocaml', + \ 'name': 'camlp4o'}) diff --git a/syntax_checkers/efm_perl.pl b/syntax_checkers/perl/efm_perl.pl similarity index 100% rename from syntax_checkers/efm_perl.pl rename to syntax_checkers/perl/efm_perl.pl diff --git a/syntax_checkers/perl.vim b/syntax_checkers/perl/perl.vim similarity index 89% rename from syntax_checkers/perl.vim rename to syntax_checkers/perl/perl.vim index b1baa333..3dcc847b 100644 --- a/syntax_checkers/perl.vim +++ b/syntax_checkers/perl/perl.vim @@ -25,16 +25,15 @@ " let g:syntastic_perl_efm_program = "foo.pl -o -m -g" " -"bail if the user doesnt have perl installed -if !executable("perl") - finish -endif +function! SyntaxCheckers_perl_perl_IsAvailable() + return executable("perl") +endfunction if !exists("g:syntastic_perl_efm_program") let g:syntastic_perl_efm_program = 'perl ' . shellescape(expand(':p:h') . '/efm_perl.pl') . ' -c -w' endif -function! SyntaxCheckers_perl_GetLocList() +function! SyntaxCheckers_perl_perl_GetLocList() if exists("g:syntastic_perl_lib_path") let makeprg = g:syntastic_perl_efm_program . ' -I' . g:syntastic_perl_lib_path . ' ' . shellescape(expand('%')) else @@ -55,3 +54,7 @@ function! s:ExtraMakeprgArgs() return '' endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'perl', + \ 'name': 'perl'}) diff --git a/syntax_checkers/php.vim b/syntax_checkers/php/php.vim similarity index 93% rename from syntax_checkers/php.vim rename to syntax_checkers/php/php.vim index de74acf1..b1632e18 100644 --- a/syntax_checkers/php.vim +++ b/syntax_checkers/php/php.vim @@ -21,11 +21,9 @@ " "There are options below to config and disable phpcs and phpmd. - -"bail if the user doesnt have php installed -if !executable("php") - finish -endif +function! SyntaxCheckers_php_php_IsAvailable() + return executable("php") +endfunction "Support passing configuration directives to phpcs if !exists("g:syntastic_phpcs_conf") @@ -55,7 +53,7 @@ function! SyntaxCheckers_php_GetHighlightRegex(item) return '\V'.split(unexpected, "'")[1] endfunction -function! SyntaxCheckers_php_GetLocList() +function! SyntaxCheckers_php_php_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'php', \ 'args': '-l -d error_reporting=E_ALL -d display_errors=1 -d log_errors=0', @@ -94,3 +92,7 @@ function! s:GetPHPMDErrors() let errorformat = '%E%f:%l%m' return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat, 'subtype' : 'Style' }) endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'php', + \ 'name': 'php'}) diff --git a/syntax_checkers/puppet.vim b/syntax_checkers/puppet/puppetlint.vim similarity index 93% rename from syntax_checkers/puppet.vim rename to syntax_checkers/puppet/puppetlint.vim index dcc01cfb..0308968c 100644 --- a/syntax_checkers/puppet.vim +++ b/syntax_checkers/puppet/puppetlint.vim @@ -10,10 +10,9 @@ " "============================================================================ -"bail if the user doesnt have puppet installed -if !executable("puppet") - finish -endif +function! SyntaxCheckers_puppet_puppetlint_IsAvailable() + return executable("puppet") +endfunction if !exists("g:syntastic_puppet_validate_disable") let g:syntastic_puppet_validate_disable = 0 @@ -90,7 +89,7 @@ function! s:getPuppetEfm() return errorformat endfunction -function! SyntaxCheckers_puppet_GetLocList() +function! SyntaxCheckers_puppet_puppetlint_GetLocList() let errors = [] if !g:syntastic_puppet_validate_disable @@ -104,3 +103,6 @@ function! SyntaxCheckers_puppet_GetLocList() return errors endfunction +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'puppet', + \ 'name': 'puppetlint'}) diff --git a/syntax_checkers/python.vim b/syntax_checkers/python.vim deleted file mode 100644 index f8e17c9f..00000000 --- a/syntax_checkers/python.vim +++ /dev/null @@ -1,21 +0,0 @@ -"============================================================================ -"File: python.vim -"Description: Syntax checking plugin for syntastic.vim -" -"Authors: Martin Grenfell -" kstep -" Parantapa Bhattacharya -" -" -" For forcing the use of flake8, pyflakes, or pylint set -" -" let g:syntastic_python_checker = 'pyflakes' -" -" in your .vimrc. Default is flake8. -"============================================================================ - -if !exists('g:syntastic_python_checker_args') - let g:syntastic_python_checker_args = '' -endif - -call SyntasticLoadChecker('python') diff --git a/syntax_checkers/python/flake8.vim b/syntax_checkers/python/flake8.vim index 70af251c..3e886c18 100644 --- a/syntax_checkers/python/flake8.vim +++ b/syntax_checkers/python/flake8.vim @@ -34,8 +34,5 @@ function! SyntaxCheckers_python_flake8_GetLocList() endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'loclistFunc': function("SyntaxCheckers_python_flake8_GetLocList"), - \ 'highlightRegexFunc': function("SyntaxCheckers_python_flake8_GetHighlightRegex"), \ 'filetype': 'python', - \ 'name': 'flake8', - \ 'isAvailableFunc': function("SyntaxCheckers_python_flake8_IsAvailable")} ) + \ 'name': 'flake8'}) diff --git a/syntax_checkers/python/pyflakes.vim b/syntax_checkers/python/pyflakes.vim index 49ad1d14..41824c9b 100644 --- a/syntax_checkers/python/pyflakes.vim +++ b/syntax_checkers/python/pyflakes.vim @@ -29,7 +29,6 @@ endfunction function! SyntaxCheckers_python_pyflakes_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'pyflakes', - \ 'args': g:syntastic_python_checker_args, \ 'subchecker': 'pyflakes' }) let errorformat = '%E%f:%l: could not compile,%-Z%p^,%E%f:%l:%c: %m,%E%f:%l: %m,%-G%.%#' @@ -39,8 +38,5 @@ function! SyntaxCheckers_python_pyflakes_GetLocList() endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'loclistFunc': function('SyntaxCheckers_python_pyflakes_GetLocList'), - \ 'highlightRegexFunc': function('SyntaxCheckers_python_pyflakes_GetHighlightRegex'), \ 'filetype': 'python', - \ 'name': 'pyflakes', - \ 'isAvailableFunc': function('SyntaxCheckers_python_pyflakes_IsAvailable')} ) + \ 'name': 'pyflakes'}) diff --git a/syntax_checkers/python/pylint.vim b/syntax_checkers/python/pylint.vim index b6ccfa1a..9348d339 100644 --- a/syntax_checkers/python/pylint.vim +++ b/syntax_checkers/python/pylint.vim @@ -11,7 +11,7 @@ endfunction function! SyntaxCheckers_python_pylint_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'pylint', - \ 'args': g:syntastic_python_checker_args. ' -f parseable -r n -i y', + \ 'args': ' -f parseable -r n -i y', \ 'tail': s:MakeprgTail(), \ 'subchecker': 'pylint' }) let errorformat = '%f:%l: [%t] %m,%Z,%-GNo config %m' @@ -25,7 +25,5 @@ function! s:MakeprgTail() endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'loclistFunc': function('SyntaxCheckers_python_pylint_GetLocList'), \ 'filetype': 'python', - \ 'name': 'pylint', - \ 'isAvailableFunc': function('SyntaxCheckers_python_pylint_IsAvailable')} ) + \ 'name': 'pylint' }) diff --git a/syntax_checkers/python/python.vim b/syntax_checkers/python/python.vim index e8388342..1cc30c85 100644 --- a/syntax_checkers/python/python.vim +++ b/syntax_checkers/python/python.vim @@ -7,11 +7,11 @@ " http://www.vim.org/scripts/download_script.php?src_id=1392 " "============================================================================ -function! SyntaxCheckers_python_pyflakes_IsAvailable() +function! SyntaxCheckers_python_python_IsAvailable() return executable('python') endfunction -function! SyntaxCheckers_python_pyflakes_GetLocList() +function! SyntaxCheckers_python_python_GetLocList() let l:path = shellescape(expand('%')) let l:cmd = "compile(open(" . l:path . ").read(), " . l:path . ", 'exec')" let l:makeprg = 'python -c "' . l:cmd . '"' @@ -30,7 +30,5 @@ function! SyntaxCheckers_python_pyflakes_GetLocList() endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'loclistFunc': function('SyntaxCheckers_python_pyflakes_GetLocList'), \ 'filetype': 'python', - \ 'name': 'python', - \ 'isAvailableFunc': function('SyntaxCheckers_python_pyflakes_IsAvailable')} ) + \ 'name': 'python'}) diff --git a/syntax_checkers/rst.vim b/syntax_checkers/rst/rst2pseudoxml.vim similarity index 81% rename from syntax_checkers/rst.vim rename to syntax_checkers/rst/rst2pseudoxml.vim index 0ea723b7..0bd57493 100644 --- a/syntax_checkers/rst.vim +++ b/syntax_checkers/rst/rst2pseudoxml.vim @@ -13,12 +13,11 @@ " We use rst2pseudoxml.py, as it is ever so marginally faster than the other " rst2${x} tools in docutils. -"bail if the user doesn't have rst2pseudoxml.py installed -if !executable("rst2pseudoxml.py") - finish -endif +function! SyntaxCheckers_rst_rst2pseudoxml_IsAvailable() + return executable("rst2pseudoxml.py") +endfunction -function! SyntaxCheckers_rst_GetLocList() +function! SyntaxCheckers_rst_rst2pseudoxml_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'rst2pseudoxml.py', \ 'args': '--report=2 --exit-status=1', @@ -32,3 +31,7 @@ function! SyntaxCheckers_rst_GetLocList() return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'rst', + \ 'name': 'rst2pseudoxml'}) diff --git a/syntax_checkers/ruby.vim b/syntax_checkers/ruby.vim deleted file mode 100644 index 183da6a3..00000000 --- a/syntax_checkers/ruby.vim +++ /dev/null @@ -1,21 +0,0 @@ -"============================================================================ -"File: ruby.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: Martin Grenfell -"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. -" -"Supports MRI and JRuby but loads the MRI syntax checker by default. -" -"Use the g:syntastic_ruby_checker option to specify which checker to load - -"set it to "jruby" to load the jruby checker. -"============================================================================ - -if !exists("g:syntastic_ruby_checker") - let g:syntastic_ruby_checker = "mri" -endif -exec "runtime! syntax_checkers/ruby/" . g:syntastic_ruby_checker . ".vim" - diff --git a/syntax_checkers/ruby/jruby.vim b/syntax_checkers/ruby/jruby.vim index 4f9383d7..43bf3793 100644 --- a/syntax_checkers/ruby/jruby.vim +++ b/syntax_checkers/ruby/jruby.vim @@ -9,7 +9,11 @@ " See http://sam.zoy.org/wtfpl/COPYING for more details. " "============================================================================ -function! SyntaxCheckers_ruby_GetLocList() +function! SyntaxCheckers_ruby_jruby_IsAvailable() + return executable('jruby') +endfunction + +function! SyntaxCheckers_ruby_jruby_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': s:exe(), \ 'args': s:args(), @@ -27,3 +31,7 @@ endfunction function s:exe() return has('win32') ? 'jruby' : 'RUBYOPT= jruby' endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'ruby', + \ 'name': 'jruby'}) diff --git a/syntax_checkers/ruby/macruby.vim b/syntax_checkers/ruby/macruby.vim index 067c7745..fdd929ec 100644 --- a/syntax_checkers/ruby/macruby.vim +++ b/syntax_checkers/ruby/macruby.vim @@ -8,7 +8,11 @@ " See http://sam.zoy.org/wtfpl/COPYING for more details. " "============================================================================ -function! SyntaxCheckers_ruby_GetLocList() +function! SyntaxCheckers_ruby_macruby_GetLocList() + return executable('macruby') +endfunction + +function! SyntaxCheckers_ruby_macruby_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'RUBYOPT= macruby', \ 'args': '-W1 -c', @@ -16,3 +20,7 @@ function! SyntaxCheckers_ruby_GetLocList() let errorformat = '%-GSyntax OK,%E%f:%l: syntax error\, %m,%Z%p^,%W%f:%l: warning: %m,%Z%p^,%W%f:%l: %m,%-C%.%#' return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'ruby', + \ 'name': 'macruby'}) diff --git a/syntax_checkers/ruby/mri.vim b/syntax_checkers/ruby/mri.vim index 57df7d3f..e1017fa3 100644 --- a/syntax_checkers/ruby/mri.vim +++ b/syntax_checkers/ruby/mri.vim @@ -21,12 +21,11 @@ if !exists("g:syntastic_ruby_exec") let g:syntastic_ruby_exec = s:FindRubyExec() endif -"bail if the user doesnt have ruby installed where they said it is -if !executable(expand(g:syntastic_ruby_exec)) - finish -endif +function! SyntaxCheckers_ruby_mri_GetLocList() + return executable(expand(g:syntastic_ruby_exec)) +endfunction -function! SyntaxCheckers_ruby_GetLocList() +function! SyntaxCheckers_ruby_mri_GetLocList() let exe = expand(g:syntastic_ruby_exec) if !has('win32') let exe = 'RUBYOPT= ' . exe @@ -55,3 +54,7 @@ function! SyntaxCheckers_ruby_GetLocList() let errorformat .= ',%Z%p^,%W%f:%l: warning: %m,%Z%p^,%W%f:%l: %m,%-C%.%#' return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'ruby', + \ 'name': 'mri'}) diff --git a/syntax_checkers/rust.vim b/syntax_checkers/rust/rustc.vim similarity index 82% rename from syntax_checkers/rust.vim rename to syntax_checkers/rust/rustc.vim index c7f7ea33..d232e42f 100644 --- a/syntax_checkers/rust.vim +++ b/syntax_checkers/rust/rustc.vim @@ -10,12 +10,11 @@ " "============================================================================ -"bail if the user doesnt have rustc installed -if !executable("rustc") - finish -endif +function! SyntaxCheckers_rust_rustc_IsAvailable() + return executable("rustc") +endfunction -function! SyntaxCheckers_rust_GetLocList() +function! SyntaxCheckers_rust_rustc_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'rustc', \ 'args': '--parse-only' }) @@ -28,4 +27,6 @@ function! SyntaxCheckers_rust_GetLocList() return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) endfunction - +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'rust', + \ 'name': 'rustc'}) diff --git a/syntax_checkers/sass.vim b/syntax_checkers/sass/sass.vim similarity index 87% rename from syntax_checkers/sass.vim rename to syntax_checkers/sass/sass.vim index 57969bc5..5c4b00c5 100644 --- a/syntax_checkers/sass.vim +++ b/syntax_checkers/sass/sass.vim @@ -10,10 +10,9 @@ " "============================================================================ -"bail if the user doesnt have the sass binary installed -if !executable("sass") - finish -endif +function! SyntaxCheckers_sass_sass_IsAvailable() + return executable("sass") +endfunction "sass caching for large files drastically speeds up the checking, but store it "in a temp location otherwise sass puts .sass_cache dirs in the users project @@ -30,7 +29,7 @@ if executable("compass") let s:imports = "--compass" endif -function! SyntaxCheckers_sass_GetLocList() +function! SyntaxCheckers_sass_sass_GetLocList() if !g:syntastic_sass_check_partials && expand('%:t')[0] == '_' return [] end @@ -43,3 +42,7 @@ function! SyntaxCheckers_sass_GetLocList() return loclist endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'sass', + \ 'name': 'sass'}) diff --git a/syntax_checkers/scala.vim b/syntax_checkers/scala/scalac.vim similarity index 80% rename from syntax_checkers/scala.vim rename to syntax_checkers/scala/scalac.vim index 6c11c862..fd234f19 100644 --- a/syntax_checkers/scala.vim +++ b/syntax_checkers/scala/scalac.vim @@ -10,16 +10,16 @@ " "============================================================================ -"bail if the user doesnt have the scala binary installed -if !executable("scalac") - finish -endif +function! SyntaxCheckers_scala_scalac_IsAvailable() + return executable("scalac") +endfunction if !exists("g:syntastic_scala_options") let g:syntastic_scala_options = " " endif -function! SyntaxCheckers_scala_GetLocList() + +function! SyntaxCheckers_scala_scalac_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'scalac', \ 'args': '-Ystop-after:parser '. g:syntastic_scala_options }) @@ -29,3 +29,6 @@ function! SyntaxCheckers_scala_GetLocList() return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) endfunction +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'scala', + \ 'name': 'scalac'}) diff --git a/syntax_checkers/scss.vim b/syntax_checkers/scss/sass.vim similarity index 68% rename from syntax_checkers/scss.vim rename to syntax_checkers/scss/sass.vim index 1e627c53..0a1e752b 100644 --- a/syntax_checkers/scss.vim +++ b/syntax_checkers/scss/sass.vim @@ -11,13 +11,16 @@ " "============================================================================ -"bail if the user doesnt have the sass binary installed -if !executable("sass") - finish -endif +runtime syntax_checkers/sass/sass.vim -runtime syntax_checkers/sass.vim - -function! SyntaxCheckers_scss_GetLocList() - return SyntaxCheckers_sass_GetLocList() +function! SyntaxCheckers_scss_sass_IsAvailable() + return executable("sass") endfunction + +function! SyntaxCheckers_scss_sass_GetLocList() + return SyntaxCheckers_sass_sass_GetLocList() +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'scss', + \ 'name': 'sass'}) diff --git a/syntax_checkers/sh.vim b/syntax_checkers/sh/sh.vim similarity index 86% rename from syntax_checkers/sh.vim rename to syntax_checkers/sh/sh.vim index dbe92e82..b5c5dff0 100644 --- a/syntax_checkers/sh.vim +++ b/syntax_checkers/sh/sh.vim @@ -29,18 +29,24 @@ endfunction function! s:ForwardToZshChecker() if SyntasticCheckable('zsh') - return SyntaxCheckers_zsh_GetLocList() + return SyntaxCheckers_zsh_zsh_GetLocList() else return [] endif endfunction + function! s:IsShellValid() return len(s:GetShell()) > 0 && executable(s:GetShell()) endfunction -function! SyntaxCheckers_sh_GetLocList() + +function! SyntaxCheckers_sh_sh_IsAvailable() + return s:IsShellValid() +endfunction + +function! SyntaxCheckers_sh_sh_GetLocList() if s:GetShell() == 'zsh' return s:ForwardToZshChecker() endif @@ -56,3 +62,7 @@ function! SyntaxCheckers_sh_GetLocList() let errorformat = '%f: line %l: %m' return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat}) endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'sh', + \ 'name': 'sh'}) diff --git a/syntax_checkers/slim.vim b/syntax_checkers/slim/slimrb.vim similarity index 85% rename from syntax_checkers/slim.vim rename to syntax_checkers/slim/slimrb.vim index 2ee55cc4..5b4d3d9e 100644 --- a/syntax_checkers/slim.vim +++ b/syntax_checkers/slim/slimrb.vim @@ -10,10 +10,9 @@ " "============================================================================ -"bail if the user doesnt have the slim binary installed -if !executable("slimrb") - finish -endif +function! SyntaxCheckers_slim_slimrb_IsAvailable() + return executable("slimrb") +endfunction function! s:SlimrbVersion() if !exists('s:slimrb_version') @@ -25,7 +24,7 @@ function! s:SlimrbVersion() return s:slimrb_version endfunction -function! SyntaxCheckers_slim_GetLocList() +function! SyntaxCheckers_slim_slimrb_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'slimrb', \ 'args': '-c' }) @@ -36,3 +35,7 @@ function! SyntaxCheckers_slim_GetLocList() endif return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'slim', + \ 'name': 'slimrb'}) diff --git a/syntax_checkers/tcl.vim b/syntax_checkers/tcl.vim deleted file mode 100644 index 94750160..00000000 --- a/syntax_checkers/tcl.vim +++ /dev/null @@ -1,17 +0,0 @@ -"============================================================================ -"File: tcl.vim -"Description: Figures out which tcl syntax checker (if any) to load -" from the tcl directory. -"Maintainer: James Pickard -"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. -" -" Use g:syntastic_tcl_checker option to specify which tcl checker executable -" should be used (see below for a list of supported checkers). -" If g:syntastic_tcl_checker is not set, just use the first syntax -" checker that we find installed. -"============================================================================ -call SyntasticLoadChecker('tcl') diff --git a/syntax_checkers/tcl/nagelfar.vim b/syntax_checkers/tcl/nagelfar.vim index 3e84708e..2fb92cb6 100644 --- a/syntax_checkers/tcl/nagelfar.vim +++ b/syntax_checkers/tcl/nagelfar.vim @@ -11,7 +11,11 @@ " See nagelfar homepage http://nagelfar.berlios.de/. " "============================================================================ -function! SyntaxCheckers_tcl_GetLocList() +function! SyntaxCheckers_tcl_nagelfar_IsAvailable() + return executable('nagelfar') +endfunction + +function! SyntaxCheckers_tcl_nagelfar_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'nagelfar', \ 'args': '-H ' . g:syntastic_tcl_nagelfar_conf, @@ -20,3 +24,7 @@ function! SyntaxCheckers_tcl_GetLocList() return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'tcl', + \ 'name': 'nagelfar'}) diff --git a/syntax_checkers/tcl/tclsh.vim b/syntax_checkers/tcl/tclsh.vim index 69dd4a4e..c94d63bf 100644 --- a/syntax_checkers/tcl/tclsh.vim +++ b/syntax_checkers/tcl/tclsh.vim @@ -10,14 +10,17 @@ " "============================================================================ -"bail if the user doesnt have tclsh installed -if !executable("tclsh") - finish -endif +function! SyntaxCheckers_tcl_tclsh_IsAvailable() + return executable('tclsh') +endfunction -function! SyntaxCheckers_tclsh_GetLocList() +function! SyntaxCheckers_tcl_tclsh_GetLocList() let makeprg = syntastic#makeprg#build({'exe': 'tclsh'}) let errorformat = '%f:%l:%m' return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'tcl', + \ 'name': 'tclsh'}) diff --git a/syntax_checkers/tex.vim b/syntax_checkers/tex/lacheck.vim similarity index 78% rename from syntax_checkers/tex.vim rename to syntax_checkers/tex/lacheck.vim index 27f987a3..f8836375 100644 --- a/syntax_checkers/tex.vim +++ b/syntax_checkers/tex/lacheck.vim @@ -10,13 +10,16 @@ " "============================================================================ -"bail if the user doesnt have lacheck installed -if !executable("lacheck") - finish -endif +function! SyntaxCheckers_tex_lacheck_IsAvailable() + return executable("lacheck") +endfunction -function! SyntaxCheckers_tex_GetLocList() +function! SyntaxCheckers_tex_lacheck_GetLocList() let makeprg = syntastic#makeprg#build({ 'exe': 'lacheck' }) let errorformat = '%-G** %f:,%E"%f"\, line %l: %m' return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'tex', + \ 'name': 'lacheck'}) diff --git a/syntax_checkers/twig.vim b/syntax_checkers/twig/twiglint.vim similarity index 79% rename from syntax_checkers/twig.vim rename to syntax_checkers/twig/twiglint.vim index 9116c410..c910a726 100644 --- a/syntax_checkers/twig.vim +++ b/syntax_checkers/twig/twiglint.vim @@ -15,8 +15,16 @@ function! SyntaxCheckers_twig_GetHighlightRegex(item) return '\V' endfunction -function! SyntaxCheckers_twig_GetLocList() +function! SyntaxCheckers_twig_twiglint_IsAvailable() + return executable('twig-lint') +endfunction + +function! SyntaxCheckers_twig_twiglint_GetLocList() let makeprg = "twig-lint lint --format=csv ".shellescape(expand('%')) let errorformat = '"%f"\,%l\,%m' return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat}) endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'twig', + \ 'name': 'twiglint'}) diff --git a/syntax_checkers/typescript.vim b/syntax_checkers/typescript/tsc.vim similarity index 69% rename from syntax_checkers/typescript.vim rename to syntax_checkers/typescript/tsc.vim index 61e86e9f..a328500a 100644 --- a/syntax_checkers/typescript.vim +++ b/syntax_checkers/typescript/tsc.vim @@ -4,15 +4,19 @@ "Maintainer: Bill Casarin "============================================================================ -"bail if the user doesnt have tsc installed -if !executable("tsc") - finish -endif +function! SyntaxCheckers_typescript_tsc_IsAvailable() + return executable("tsc") +endfunction -function! SyntaxCheckers_typescript_GetLocList() + +function! SyntaxCheckers_typescript_tsc_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'tsc', \ 'post_args': '--out ' . syntastic#util#DevNull() }) let errorformat = '%f %#(%l\,%c): %m' return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'typescript', + \ 'name': 'tsc'}) diff --git a/syntax_checkers/vala.vim b/syntax_checkers/vala/valac.vim similarity index 87% rename from syntax_checkers/vala.vim rename to syntax_checkers/vala/valac.vim index 22d66b3e..6b5f0967 100644 --- a/syntax_checkers/vala.vim +++ b/syntax_checkers/vala/valac.vim @@ -22,15 +22,11 @@ " "============================================================================ -if !executable('valac') - finish -endif +function! SyntaxCheckers_vala_valac_IsAvailable() + return executable('valac') || (exists('g:syntastic_vala_check_disabled') && g:syntastic_vala_check_disabled) +endfunction -if exists('g:syntastic_vala_check_disabled') && g:syntastic_vala_check_disabled - finish -endif - -function! SyntaxCheckers_vala_GetHighlightRegex(pos) +function! SyntaxCheckers_vala_valac_GetHighlightRegex(pos) let strlength = strlen(matchstr(a:pos['text'], '\^\+$')) return '\%>'.(a:pos.col-1).'c.*\%<'.(a:pos.col+strlength+1).'c' endfunction @@ -51,7 +47,7 @@ function! s:GetValaModules() return split(strpart(modules_str, 12), '\s\+') endfunction -function! SyntaxCheckers_vala_GetLocList() +function! SyntaxCheckers_vala_valac_GetLocList() let vala_pkg_args = join(map(s:GetValaModules(), '"--pkg ".v:val'), ' ') let makeprg = syntastic#makeprg#build({ \ 'exe': 'valac', @@ -63,3 +59,6 @@ function! SyntaxCheckers_vala_GetLocList() \ 'defaults': {'force_highlight_callback': 1} }) endfunction +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'vala', + \ 'name': 'valac'}) diff --git a/syntax_checkers/xhtml.vim b/syntax_checkers/xhtml/tidy.vim similarity index 87% rename from syntax_checkers/xhtml.vim rename to syntax_checkers/xhtml/tidy.vim index 61c0e4a3..5cbc7b91 100644 --- a/syntax_checkers/xhtml.vim +++ b/syntax_checkers/xhtml/tidy.vim @@ -10,10 +10,9 @@ " "============================================================================ -"bail if the user doesnt have tidy or grep installed -if !executable("tidy") - finish -endif +function! SyntaxCheckers_xhtml_tidy_IsAvailable() + return executable("tidy") +endfunction " TODO: join this with html.vim DRY's sake? function! s:TidyEncOptByFenc() @@ -33,7 +32,7 @@ function! s:TidyEncOptByFenc() return get(tidy_opts, &fileencoding, '-utf8') endfunction -function! SyntaxCheckers_xhtml_GetLocList() +function! SyntaxCheckers_xhtml_tidy_GetLocList() let encopt = s:TidyEncOptByFenc() let makeprg = syntastic#makeprg#build({ \ 'exe': 'tidy', @@ -41,3 +40,7 @@ function! SyntaxCheckers_xhtml_GetLocList() let errorformat='%Wline %l column %c - Warning: %m,%Eline %l column %c - Error: %m,%-G%.%#,%-G%.%#' return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat, 'defaults': {'bufnr': bufnr("")} }) endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'xhtml', + \ 'name': 'tidy'}) diff --git a/syntax_checkers/xml.vim b/syntax_checkers/xml/xmllint.vim similarity index 85% rename from syntax_checkers/xml.vim rename to syntax_checkers/xml/xmllint.vim index 471d1467..de349661 100644 --- a/syntax_checkers/xml.vim +++ b/syntax_checkers/xml/xmllint.vim @@ -14,12 +14,11 @@ " and allow you to validate XML data without network access, see xmlcatalog(1) " and http://www.xmlsoft.org/catalog.html for more information. -"bail if the user doesnt have tidy or grep installed -if !executable("xmllint") - finish -endif +function! SyntaxCheckers_xml_xmllint_IsAvailable() + return executable("xmllint") +endfunction -function! SyntaxCheckers_xml_GetLocList() +function! SyntaxCheckers_xml_xmllint_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'xmllint', \ 'args': '--xinclude --noout --postvalid' }) @@ -36,3 +35,7 @@ function! SyntaxCheckers_xml_GetLocList() return loclist endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'xml', + \ 'name': 'xmllint'}) diff --git a/syntax_checkers/xslt.vim b/syntax_checkers/xslt/xmllint.vim similarity index 84% rename from syntax_checkers/xslt.vim rename to syntax_checkers/xslt/xmllint.vim index 3111db20..2d1d3498 100644 --- a/syntax_checkers/xslt.vim +++ b/syntax_checkers/xslt/xmllint.vim @@ -10,13 +10,11 @@ " "============================================================================ -"bail if the user doesnt have tidy or grep installed -if !executable("xmllint") - finish -endif - -function! SyntaxCheckers_xslt_GetLocList() +function! SyntaxCheckers_xslt_xmllint_GetLocList() + return executable("xmllint") +endfunction +function! SyntaxCheckers_xslt_xmllint_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'xmllint', \ 'args': '--xinclude --noout --postvalid' }) @@ -34,3 +32,7 @@ function! SyntaxCheckers_xslt_GetLocList() return loclist endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'xslt', + \ 'name': 'xmllint'}) diff --git a/syntax_checkers/yaml.vim b/syntax_checkers/yaml/jsyaml.vim similarity index 81% rename from syntax_checkers/yaml.vim rename to syntax_checkers/yaml/jsyaml.vim index fe9d1fad..b0738317 100644 --- a/syntax_checkers/yaml.vim +++ b/syntax_checkers/yaml/jsyaml.vim @@ -13,11 +13,11 @@ " "============================================================================ -if !executable("js-yaml") - finish -endif +function! SyntaxCheckers_yaml_jsyaml_GetLocList() + return executable("js-yaml") +endfunction -function! SyntaxCheckers_yaml_GetLocList() +function! SyntaxCheckers_yaml_jsyaml_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'js-yaml', \ 'args': '--compact' }) @@ -26,3 +26,7 @@ function! SyntaxCheckers_yaml_GetLocList() \ 'errorformat': errorformat, \ 'defaults': {'bufnr': bufnr("")} }) endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'yaml', + \ 'name': 'jsyaml'}) diff --git a/syntax_checkers/z80.vim b/syntax_checkers/z80/z80syntaxchecker.vim similarity index 81% rename from syntax_checkers/z80.vim rename to syntax_checkers/z80/z80syntaxchecker.vim index 8a9cf181..564d5b75 100644 --- a/syntax_checkers/z80.vim +++ b/syntax_checkers/z80/z80syntaxchecker.vim @@ -14,14 +14,17 @@ "To obtain this application there are two solutions: " - Install this python package: https://github.com/rgiot/pycpcdemotools " - Copy/paste this script in your search path: https://raw.github.com/rgiot/pycpcdemotools/master/cpcdemotools/source_checker/z80_syntax_checker.py -if !executable("z80_syntax_checker.py") - finish -endif +function! SyntaxCheckers_z80_z80syntaxchecker_IsAvailable() + return executable("z80_syntax_checker.py") +endfunction -function! SyntaxCheckers_z80_GetLocList() +function! SyntaxCheckers_z80_z80syntaxchecker_GetLocList() let makeprg = syntastic#makeprg#build({ 'exe': 'z80_syntax_checker.py' }) let errorformat = '%f:%l %m' let loclist = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) return loclist endfunction +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'z80', + \ 'name': 'z80syntaxchecker'}) diff --git a/syntax_checkers/zpt.vim b/syntax_checkers/zpt/zptlint.vim similarity index 83% rename from syntax_checkers/zpt.vim rename to syntax_checkers/zpt/zptlint.vim index 9531c150..0bae70b8 100644 --- a/syntax_checkers/zpt.vim +++ b/syntax_checkers/zpt/zptlint.vim @@ -19,13 +19,16 @@ " Then install the zptlint program, found on pypi: " http://pypi.python.org/pypi/zptlint -" Bail if the user doesn't have zptlint installed -if !executable("zptlint") - finish -endif +function! SyntaxCheckers_zpt_zptlint_GetLocList() + return executable("zptlint") +endfunction -function! SyntaxCheckers_zpt_GetLocList() +function! SyntaxCheckers_zpt_zptlint_GetLocList() let makeprg = syntastic#makeprg#build({ 'exe': 'zptlint' }) let errorformat='%-P*** Error in: %f,%Z%*\s\, at line %l\, column %c,%E%*\s%m,%-Q' return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'zpt', + \ 'name': 'zptlint'}) diff --git a/syntax_checkers/zsh.vim b/syntax_checkers/zsh/zsh.vim similarity index 78% rename from syntax_checkers/zsh.vim rename to syntax_checkers/zsh/zsh.vim index 64ff613f..bf08eb03 100644 --- a/syntax_checkers/zsh.vim +++ b/syntax_checkers/zsh/zsh.vim @@ -10,13 +10,16 @@ " "============================================================================ -"bail if the user doesnt have zsh installed -if !executable("zsh") - finish -endif +function! SyntaxCheckers_zsh_zsh_IsAvailable() + return executable("zsh") +endfunction -function! SyntaxCheckers_zsh_GetLocList() +function! SyntaxCheckers_zsh_zsh_GetLocList() let makeprg = syntastic#makeprg#build({ 'exe': 'zsh', 'args': '-n' }) let errorformat = '%f:%l: %m' return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat}) endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'zsh', + \ 'name': 'zsh'})