From a24ebbba39fb8035d094471b69f13a83c47147a0 Mon Sep 17 00:00:00 2001 From: Eddie Monge Jr Date: Mon, 20 May 2013 15:00:42 -0600 Subject: [PATCH 0001/1271] Add main to list of block level elements HTML5 now supports main element http://www.w3.org/html/wg/drafts/html/master/grouping-content.html#the-main-element --- syntax_checkers/html/tidy.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntax_checkers/html/tidy.vim b/syntax_checkers/html/tidy.vim index 31ec5f64d..a3002d25f 100644 --- a/syntax_checkers/html/tidy.vim +++ b/syntax_checkers/html/tidy.vim @@ -74,7 +74,7 @@ endfunction function s:Args() let args = s:TidyEncOptByFenc() . - \ ' --new-blocklevel-tags ' . shellescape('section, article, aside, hgroup, header, footer, nav, figure, figcaption') . + \ ' --new-blocklevel-tags ' . shellescape('main, section, article, aside, hgroup, header, footer, nav, figure, figcaption') . \ ' --new-inline-tags ' . shellescape('video, audio, source, embed, mark, progress, meter, time, ruby, rt, rp, canvas, command, details, datalist') . \ ' --new-empty-tags ' . shellescape('wbr, keygen') . \ ' -e' From b74a3057d0d544937e752dd88f0fc19f73a1d9a9 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Tue, 21 May 2013 10:03:04 +0300 Subject: [PATCH 0002/1271] GCC refactor. --- autoload/syntastic/c.vim | 93 ++++++++++---------- autoload/syntastic/gcc.vim | 76 ++++++++++++++++ syntax_checkers/ada/gcc.vim | 132 ++-------------------------- syntax_checkers/c/gcc.vim | 150 ++++---------------------------- syntax_checkers/cpp/gcc.vim | 143 +++--------------------------- syntax_checkers/d/dmd.vim | 131 ++-------------------------- syntax_checkers/llvm/llvm.vim | 2 +- syntax_checkers/objc/gcc.vim | 153 ++++----------------------------- syntax_checkers/objcpp/gcc.vim | 63 ++++++++++++++ syntax_checkers/objcpp/ycm.vim | 34 ++++++++ 10 files changed, 278 insertions(+), 699 deletions(-) create mode 100644 autoload/syntastic/gcc.vim create mode 100644 syntax_checkers/objcpp/gcc.vim create mode 100644 syntax_checkers/objcpp/ycm.vim diff --git a/autoload/syntastic/c.vim b/autoload/syntastic/c.vim index aac6fc38d..06ce8ac11 100644 --- a/autoload/syntastic/c.vim +++ b/autoload/syntastic/c.vim @@ -6,51 +6,14 @@ let g:loaded_syntastic_c_autoload = 1 let s:save_cpo = &cpo set cpo&vim -" initialize c/cpp syntax checker handlers -function! s:Init() - let s:handlers = [] - let s:cflags = {} - - call s:RegHandler('gtk', 'syntastic#c#CheckPKG', - \ ['gtk', 'gtk+-2.0', 'gtk+', 'glib-2.0', 'glib']) - call s:RegHandler('glib', 'syntastic#c#CheckPKG', - \ ['glib', 'glib-2.0', 'glib']) - call s:RegHandler('glade', 'syntastic#c#CheckPKG', - \ ['glade', 'libglade-2.0', 'libglade']) - call s:RegHandler('libsoup', 'syntastic#c#CheckPKG', - \ ['libsoup', 'libsoup-2.4', 'libsoup-2.2']) - call s:RegHandler('webkit', 'syntastic#c#CheckPKG', - \ ['webkit', 'webkit-1.0']) - call s:RegHandler('cairo', 'syntastic#c#CheckPKG', - \ ['cairo', 'cairo']) - call s:RegHandler('pango', 'syntastic#c#CheckPKG', - \ ['pango', 'pango']) - call s:RegHandler('libxml', 'syntastic#c#CheckPKG', - \ ['libxml', 'libxml-2.0', 'libxml']) - call s:RegHandler('freetype', 'syntastic#c#CheckPKG', - \ ['freetype', 'freetype2', 'freetype']) - call s:RegHandler('SDL', 'syntastic#c#CheckPKG', - \ ['sdl', 'sdl']) - call s:RegHandler('opengl', 'syntastic#c#CheckPKG', - \ ['opengl', 'gl']) - call s:RegHandler('ruby', 'syntastic#c#CheckRuby', []) - call s:RegHandler('Python\.h', 'syntastic#c#CheckPython', []) - call s:RegHandler('php\.h', 'syntastic#c#CheckPhp', []) -endfunction - -" default include directories -let s:default_includes = [ '.', '..', 'include', 'includes', - \ '../include', '../includes' ] +" Public functions {{{1 " convenience function to determine the 'null device' parameter " based on the current operating system -function! syntastic#c#GetNullDevice() - if has('win32') - return '-o nul' - elseif has('unix') || has('mac') - return '-o /dev/null' - endif - return '' +function! syntastic#c#NullOutput(ft) + let known_os = has('win32') || has('unix') || has('mac') + let opt_o = ft ==# 'd' ? '-of' : '-o ' + return known_os ? opt_o . syntastic#util#DevNull() : '' endfunction " get the gcc include directory argument depending on the default @@ -112,7 +75,7 @@ function! syntastic#c#SearchHeaders() let includes = '' let files = [] let found = [] - let lines = filter(getline(1, 100), 'v:val =~# "#\s*include"') + let lines = filter(getline(1, 100), 'v:val =~# "^\s*#\s*include"') " search current buffer for line in lines @@ -140,7 +103,7 @@ function! syntastic#c#SearchHeaders() catch /E484/ continue endtry - let lines = filter(lines, 'v:val =~# "#\s*include"') + let lines = filter(lines, 'v:val =~# "^\s*#\s*include"') for handler in s:handlers if index(found, handler["regex"]) != -1 continue @@ -159,6 +122,40 @@ function! syntastic#c#SearchHeaders() return includes endfunction +" Private functions {{{1 + +" initialize c/cpp syntax checker handlers +function! s:Init() + let s:handlers = [] + let s:cflags = {} + + call s:RegHandler('gtk', 'syntastic#c#CheckPKG', + \ ['gtk', 'gtk+-2.0', 'gtk+', 'glib-2.0', 'glib']) + call s:RegHandler('glib', 'syntastic#c#CheckPKG', + \ ['glib', 'glib-2.0', 'glib']) + call s:RegHandler('glade', 'syntastic#c#CheckPKG', + \ ['glade', 'libglade-2.0', 'libglade']) + call s:RegHandler('libsoup', 'syntastic#c#CheckPKG', + \ ['libsoup', 'libsoup-2.4', 'libsoup-2.2']) + call s:RegHandler('webkit', 'syntastic#c#CheckPKG', + \ ['webkit', 'webkit-1.0']) + call s:RegHandler('cairo', 'syntastic#c#CheckPKG', + \ ['cairo', 'cairo']) + call s:RegHandler('pango', 'syntastic#c#CheckPKG', + \ ['pango', 'pango']) + call s:RegHandler('libxml', 'syntastic#c#CheckPKG', + \ ['libxml', 'libxml-2.0', 'libxml']) + call s:RegHandler('freetype', 'syntastic#c#CheckPKG', + \ ['freetype', 'freetype2', 'freetype']) + call s:RegHandler('SDL', 'syntastic#c#CheckPKG', + \ ['sdl', 'sdl']) + call s:RegHandler('opengl', 'syntastic#c#CheckPKG', + \ ['opengl', 'gl']) + call s:RegHandler('ruby', 'syntastic#c#CheckRuby', []) + call s:RegHandler('Python\.h', 'syntastic#c#CheckPython', []) + call s:RegHandler('php\.h', 'syntastic#c#CheckPhp', []) +endfunction + " try to find library with 'pkg-config' " search possible libraries from first to last given " argument until one is found @@ -231,9 +228,15 @@ function! s:RegHandler(regex, function, args) call add(s:handlers, handler) endfunction +" }}}1 + +" default include directories +let s:default_includes = [ '.', '..', 'include', 'includes', + \ '../include', '../includes' ] + call s:Init() let &cpo = s:save_cpo unlet s:save_cpo -" vim: set et sts=4 sw=4: +" vim: set et sts=4 sw=4 fdm=marker: diff --git a/autoload/syntastic/gcc.vim b/autoload/syntastic/gcc.vim new file mode 100644 index 000000000..c0fe109f0 --- /dev/null +++ b/autoload/syntastic/gcc.vim @@ -0,0 +1,76 @@ +if exists("g:loaded_syntastic_gcc_autoload") + finish +endif +let g:loaded_syntastic_gcc_autoload = 1 + +let s:save_cpo = &cpo +set cpo&vim + + +function! syntastic#gcc#GetLocList(filetype, options) + let ft = a:filetype + let errorformat = exists('g:syntastic_' . ft . '_errorformat') ? + \ g:syntastic_{ft}_errorformat : a:options['errorformat'] + + " determine whether to parse header files as well + if expand('%') =~? a:options['headers_pattern'] + if exists('g:syntastic_' . ft . '_check_header') && g:syntastic_{ft}_check_header + let makeprg = + \ g:syntastic_{ft}_compiler . + \ ' ' . get(a:options, 'makeprg_headers', '') . + \ ' ' . g:syntastic_{ft}_compiler_options . + \ ' ' . syntastic#c#GetIncludeDirs(ft) . + \ ' ' . syntastic#c#NullOutput(ft) . + \ ' -c ' . shellescape(expand('%')) + else + return [] + endif + else + let makeprg = + \ g:syntastic_{ft}_compiler . + \ ' ' . get(a:options, 'makeprg_main', '') . + \ ' ' . g:syntastic_{ft}_compiler_options . + \ ' ' . syntastic#c#GetIncludeDirs(ft) . + \ ' ' . shellescape(expand('%')) + endif + + " check if the user manually set some cflags + if !exists('b:syntastic_' . ft . '_cflags') + " check whether to search for include files at all + if !exists('g:syntastic_' . ft . '_no_include_search') || !g:syntastic_{ft}_no_include_search + if ft ==# 'c' || ft ==# 'cpp' + " refresh the include file search if desired + if exists('g:syntastic_' . ft . '_auto_refresh_includes') && g:syntastic_{ft}_auto_refresh_includes + let makeprg .= ' ' . syntastic#c#SearchHeaders() + else + " search for header includes if not cached already + if !exists('b:syntastic_' . ft . '_includes') + let b:syntastic_{ft}_includes = syntastic#c#SearchHeaders() + endif + let makeprg .= ' ' . b:syntastic_{ft}_includes + endif + endif + endif + else + " use the user-defined cflags + let makeprg .= ' ' . b:syntastic_{ft}_cflags + endif + + " add optional config file parameters + let makeprg .= ' ' . syntastic#c#ReadConfig(g:syntastic_{ft}_config_file) + + " process makeprg + let errors = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) + + " filter the processed errors if desired + if exists('g:syntastic_' . ft . '_remove_include_errors') && g:syntastic_{ft}_remove_include_errors + call filter(errors, 'get(v:val, "bufnr") == ' . bufnr('')) + endif + + return errors +endfunction + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4 fdm=marker: diff --git a/syntax_checkers/ada/gcc.vim b/syntax_checkers/ada/gcc.vim index 39001fd26..e9fd965f8 100644 --- a/syntax_checkers/ada/gcc.vim +++ b/syntax_checkers/ada/gcc.vim @@ -7,68 +7,6 @@ " "============================================================================ -" In order to also check header files add this to your .vimrc: -" -" let g:syntastic_ada_check_header = 1 -" -" To disable the search of included header files after special -" libraries like gtk and glib add this line to your .vimrc: -" -" let g:syntastic_ada_no_include_search = 1 -" -" To disable the include of the default include dirs (such as /usr/include) -" add this line to your .vimrc: -" -" let g:syntastic_ada_no_default_include_dirs = 1 -" -" To enable header files being re-checked on every file write add the -" following line to your .vimrc. Otherwise the header files are checked only -" one time on initially loading the file. -" In order to force syntastic to refresh the header includes simply -" unlet b:syntastic_ada_includes. Then the header files are being re-checked -" on the next file write. -" -" let g:syntastic_ada_auto_refresh_includes = 1 -" -" Alternatively you can set the buffer local variable b:syntastic_ada_cflags. -" If this variable is set for the current buffer no search for additional -" libraries is done. I.e. set the variable like this: -" -" let b:syntastic_ada_cflags = ' -I/usr/include/libsoup-2.4' -" -" In order to add some custom include directories that should be added to the -" gcc command line you can add those to the global variable -" g:syntastic_ada_include_dirs. This list can be used like this: -" -" let g:syntastic_ada_include_dirs = [ 'includes', 'headers' ] -" -" Moreover it is possible to add additional compiler options to the syntax -" checking execution via the variable 'g:syntastic_ada_compiler_options': -" -" let g:syntastic_ada_compiler_options = ' -std=c++0x' -" -" Additionally the setting 'g:syntastic_ada_config_file' allows you to define -" a file that contains additional compiler arguments like include directories -" or CFLAGS. The file is expected to contain one option per line. If none is -" given the filename defaults to '.syntastic_ada_config': -" -" let g:syntastic_ada_config_file = '.config' -" -" Using the global variable 'g:syntastic_ada_remove_include_errors' you can -" specify whether errors of files included via the -" g:syntastic_ada_include_dirs' setting are removed from the result set: -" -" let g:syntastic_ada_remove_include_errors = 1 -" -" Use the variable 'g:syntastic_ada_errorformat' to override the default error -" format: -" -" let g:syntastic_ada_errorformat = '%f:%l:%c: %trror: %m' -" -" Set your compiler executable with e.g. (defaults to gcc) -" -" let g:syntastic_ada_compiler = 'gcc' - if exists('g:loaded_syntastic_ada_gcc_checker') finish endif @@ -94,68 +32,14 @@ if !exists('g:syntastic_ada_config_file') endif function! SyntaxCheckers_ada_gcc_GetLocList() - let makeprg = g:syntastic_ada_compiler . ' -c -x ada -fsyntax-only ' - let errorformat = '%-G%f:%s:,%f:%l:%c: %m,%f:%l: %m' - - if exists('g:syntastic_c_errorformat') - let errorformat = g:syntastic_c_errorformat - endif - - " add optional user-defined compiler options - let makeprg .= g:syntastic_ada_compiler_options - - let makeprg .= ' ' . shellescape(expand('%')) . - \ ' ' . syntastic#c#GetIncludeDirs('ada') - - " determine whether to parse header files as well - if expand('%') =~? '\.ads$' - if exists('g:syntastic_ada_check_header') - let makeprg = g:syntastic_ada_compiler . - \ ' -c ' . shellescape(expand('%')) . - \ ' ' . g:syntastic_ada_compiler_options . - \ ' ' . syntastic#c#GetIncludeDirs('ada') - else - return [] - endif - endif - - " check if the user manually set some cflags - if !exists('b:syntastic_ada_cflags') - " check whether to search for include files at all - if !exists('g:syntastic_ada_no_include_search') || - \ g:syntastic_ada_no_include_search != 1 - " refresh the include file search if desired - if exists('g:syntastic_ada_auto_refresh_includes') && - \ g:syntastic_ada_auto_refresh_includes != 0 - let makeprg .= syntastic#c#SearchHeaders() - else - " search for header includes if not cached already - if !exists('b:syntastic_ada_includes') - let b:syntastic_ada_includes = syntastic#c#SearchHeaders() - endif - let makeprg .= b:syntastic_ada_includes - endif - endif - else - " use the user-defined cflags - let makeprg .= b:syntastic_ada_cflags - endif - - " add optional config file parameters - let makeprg .= ' ' . syntastic#c#ReadConfig(g:syntastic_ada_config_file) - - " process makeprg - let errors = SyntasticMake({ 'makeprg': makeprg, - \ 'errorformat': errorformat }) - - " filter the processed errors if desired - if exists('g:syntastic_ada_remove_include_errors') && - \ g:syntastic_ada_remove_include_errors != 0 - return filter(errors, - \ 'has_key(v:val, "bufnr") && v:val["bufnr"]=='.bufnr('')) - else - return errors - endif + return syntastic#gcc#GetLocList('ada', { + \ 'errorformat': + \ '%-G%f:%s:,' . + \ '%f:%l:%c: %m,' . + \ '%f:%l: %m', + \ 'makeprg_main': '-c -x ada -fsyntax-only', + \ 'makeprg_headers': '-x ada', + \ 'headers_pattern': '\.ads$' }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/syntax_checkers/c/gcc.vim b/syntax_checkers/c/gcc.vim index b8d72e177..3cca035fb 100644 --- a/syntax_checkers/c/gcc.vim +++ b/syntax_checkers/c/gcc.vim @@ -10,67 +10,6 @@ " "============================================================================ -" In order to also check header files add this to your .vimrc: -" -" let g:syntastic_c_check_header = 1 -" -" To disable the search of included header files after special -" libraries like gtk and glib add this line to your .vimrc: -" -" let g:syntastic_c_no_include_search = 1 -" -" To disable the include of the default include dirs (such as /usr/include) -" add this line to your .vimrc: -" -" let g:syntastic_c_no_default_include_dirs = 1 -" -" To enable header files being re-checked on every file write add the -" following line to your .vimrc. Otherwise the header files are checked only -" one time on initially loading the file. -" In order to force syntastic to refresh the header includes simply -" unlet b:syntastic_c_includes. Then the header files are being re-checked on -" the next file write. -" -" let g:syntastic_c_auto_refresh_includes = 1 -" -" Alternatively you can set the buffer local variable b:syntastic_c_cflags. -" If this variable is set for the current buffer no search for additional -" libraries is done. I.e. set the variable like this: -" -" let b:syntastic_c_cflags = ' -I/usr/include/libsoup-2.4' -" -" In order to add some custom include directories that should be added to the -" gcc command line you can add those to the global variable -" g:syntastic_c_include_dirs. This list can be used like this: -" -" let g:syntastic_c_include_dirs = [ 'includes', 'headers' ] -" -" Moreover it is possible to add additional compiler options to the syntax -" checking execution via the variable 'g:syntastic_c_compiler_options': -" -" let g:syntastic_c_compiler_options = ' -ansi' -" -" Additionally the setting 'g:syntastic_c_config_file' allows you to define a -" file that contains additional compiler arguments like include directories or -" CFLAGS. The file is expected to contain one option per line. If none is -" given the filename defaults to '.syntastic_c_config': -" -" let g:syntastic_c_config_file = '.config' -" -" Using the global variable 'g:syntastic_c_remove_include_errors' you can -" specify whether errors of files included via the g:syntastic_c_include_dirs' -" setting are removed from the result set: -" -" let g:syntastic_c_remove_include_errors = 1 -" -" Use the variable 'g:syntastic_c_errorformat' to override the default error -" format: -" -" let g:syntastic_c_errorformat = '%f:%l:%c: %trror: %m' -" -" Set your compiler executable with e.g. (defaults to gcc) -" -" let g:syntastic_c_compiler = 'clang' if exists('g:loaded_syntastic_c_gcc_checker') finish @@ -97,80 +36,21 @@ if !exists('g:syntastic_c_config_file') endif function! SyntaxCheckers_c_gcc_GetLocList() - let makeprg = g:syntastic_c_compiler . ' -x c -fsyntax-only ' - let errorformat = - \ '%-G%f:%s:,' . - \ '%-G%f:%l: %#error: %#(Each undeclared identifier is reported only%.%#,' . - \ '%-G%f:%l: %#error: %#for each function it appears%.%#,' . - \ '%-GIn file included%.%#,' . - \ '%-G %#from %f:%l\,,' . - \ '%f:%l:%c: %trror: %m,' . - \ '%f:%l:%c: %tarning: %m,' . - \ '%f:%l:%c: %m,' . - \ '%f:%l: %trror: %m,' . - \ '%f:%l: %tarning: %m,'. - \ '%f:%l: %m' - - if exists('g:syntastic_c_errorformat') - let errorformat = g:syntastic_c_errorformat - endif - - " add optional user-defined compiler options - let makeprg .= g:syntastic_c_compiler_options - - let makeprg .= ' ' . shellescape(expand('%')) . - \ ' ' . syntastic#c#GetIncludeDirs('c') - - " determine whether to parse header files as well - if expand('%') =~? '\.h$' - if exists('g:syntastic_c_check_header') - let makeprg = g:syntastic_c_compiler . - \ ' -c ' . shellescape(expand('%')) . - \ ' ' . g:syntastic_c_compiler_options . - \ ' ' . syntastic#c#GetNullDevice() . - \ ' ' . syntastic#c#GetIncludeDirs('c') - else - return [] - endif - endif - - " check if the user manually set some cflags - if !exists('b:syntastic_c_cflags') - " check whether to search for include files at all - if !exists('g:syntastic_c_no_include_search') || - \ g:syntastic_c_no_include_search != 1 - " refresh the include file search if desired - if exists('g:syntastic_c_auto_refresh_includes') && - \ g:syntastic_c_auto_refresh_includes != 0 - let makeprg .= syntastic#c#SearchHeaders() - else - " search for header includes if not cached already - if !exists('b:syntastic_c_includes') - let b:syntastic_c_includes = syntastic#c#SearchHeaders() - endif - let makeprg .= b:syntastic_c_includes - endif - endif - else - " use the user-defined cflags - let makeprg .= b:syntastic_c_cflags - endif - - " add optional config file parameters - let makeprg .= ' ' . syntastic#c#ReadConfig(g:syntastic_c_config_file) - - " process makeprg - let errors = SyntasticMake({ 'makeprg': makeprg, - \ 'errorformat': errorformat }) - - " filter the processed errors if desired - if exists('g:syntastic_c_remove_include_errors') && - \ g:syntastic_c_remove_include_errors != 0 - return filter(errors, - \ 'has_key(v:val, "bufnr") && v:val["bufnr"]=='.bufnr('')) - else - return errors - endif + return syntastic#gcc#GetLocList('c', { + \ 'errorformat': + \ '%-G%f:%s:,' . + \ '%-G%f:%l: %#error: %#(Each undeclared identifier is reported only%.%#,' . + \ '%-G%f:%l: %#error: %#for each function it appears%.%#,' . + \ '%-GIn file included%.%#,' . + \ '%-G %#from %f:%l\,,' . + \ '%f:%l:%c: %trror: %m,' . + \ '%f:%l:%c: %tarning: %m,' . + \ '%f:%l:%c: %m,' . + \ '%f:%l: %trror: %m,' . + \ '%f:%l: %tarning: %m,'. + \ '%f:%l: %m', + \ 'makeprg_main': '-x c -fsyntax-only', + \ 'headers_pattern': '\.h$' }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/syntax_checkers/cpp/gcc.vim b/syntax_checkers/cpp/gcc.vim index 44178f19f..930dc4ab4 100644 --- a/syntax_checkers/cpp/gcc.vim +++ b/syntax_checkers/cpp/gcc.vim @@ -10,68 +10,6 @@ " "============================================================================ -" In order to also check header files add this to your .vimrc: -" -" let g:syntastic_cpp_check_header = 1 -" -" To disable the search of included header files after special -" libraries like gtk and glib add this line to your .vimrc: -" -" let g:syntastic_cpp_no_include_search = 1 -" -" To disable the include of the default include dirs (such as /usr/include) -" add this line to your .vimrc: -" -" let g:syntastic_cpp_no_default_include_dirs = 1 -" -" To enable header files being re-checked on every file write add the -" following line to your .vimrc. Otherwise the header files are checked only -" one time on initially loading the file. -" In order to force syntastic to refresh the header includes simply -" unlet b:syntastic_cpp_includes. Then the header files are being re-checked -" on the next file write. -" -" let g:syntastic_cpp_auto_refresh_includes = 1 -" -" Alternatively you can set the buffer local variable b:syntastic_cpp_cflags. -" If this variable is set for the current buffer no search for additional -" libraries is done. I.e. set the variable like this: -" -" let b:syntastic_cpp_cflags = ' -I/usr/include/libsoup-2.4' -" -" In order to add some custom include directories that should be added to the -" gcc command line you can add those to the global variable -" g:syntastic_cpp_include_dirs. This list can be used like this: -" -" let g:syntastic_cpp_include_dirs = [ 'includes', 'headers' ] -" -" Moreover it is possible to add additional compiler options to the syntax -" checking execution via the variable 'g:syntastic_cpp_compiler_options': -" -" let g:syntastic_cpp_compiler_options = ' -std=c++0x' -" -" Additionally the setting 'g:syntastic_cpp_config_file' allows you to define -" a file that contains additional compiler arguments like include directories -" or CFLAGS. The file is expected to contain one option per line. If none is -" given the filename defaults to '.syntastic_cpp_config': -" -" let g:syntastic_cpp_config_file = '.config' -" -" Using the global variable 'g:syntastic_cpp_remove_include_errors' you can -" specify whether errors of files included via the -" g:syntastic_cpp_include_dirs' setting are removed from the result set: -" -" let g:syntastic_cpp_remove_include_errors = 1 -" -" Use the variable 'g:syntastic_cpp_errorformat' to override the default error -" format: -" -" let g:syntastic_cpp_errorformat = '%f:%l:%c: %trror: %m' -" -" Set your compiler executable with e.g. (defaults to g++) -" -" let g:syntastic_cpp_compiler = 'clang++' - if exists('g:loaded_syntastic_cpp_gcc_checker') finish endif @@ -97,76 +35,17 @@ if !exists('g:syntastic_cpp_config_file') endif function! SyntaxCheckers_cpp_gcc_GetLocList() - let makeprg = g:syntastic_cpp_compiler . ' -x c++ -fsyntax-only ' - let errorformat = - \ '%-G%f:%s:,' . - \ '%f:%l:%c: %trror: %m,' . - \ '%f:%l:%c: %tarning: %m,' . - \ '%f:%l:%c: %m,'. - \ '%f:%l: %trror: %m,'. - \ '%f:%l: %tarning: %m,'. - \ '%f:%l: %m' - - if exists('g:syntastic_cpp_errorformat') - let errorformat = g:syntastic_cpp_errorformat - endif - - " add optional user-defined compiler options - let makeprg .= g:syntastic_cpp_compiler_options - - let makeprg .= ' ' . shellescape(expand('%')) . - \ ' ' . syntastic#c#GetIncludeDirs('cpp') - - " determine whether to parse header files as well - if expand('%') =~? '\.\(h\|hpp\|hh\)$' - if exists('g:syntastic_cpp_check_header') - let makeprg = g:syntastic_cpp_compiler . - \ ' -c ' . shellescape(expand('%')) . - \ ' ' . g:syntastic_cpp_compiler_options . - \ ' ' . syntastic#c#GetNullDevice() . - \ ' ' . syntastic#c#GetIncludeDirs('cpp') - else - return [] - endif - endif - - " check if the user manually set some cflags - if !exists('b:syntastic_cpp_cflags') - " check whether to search for include files at all - if !exists('g:syntastic_cpp_no_include_search') || - \ g:syntastic_cpp_no_include_search != 1 - " refresh the include file search if desired - if exists('g:syntastic_cpp_auto_refresh_includes') && - \ g:syntastic_cpp_auto_refresh_includes != 0 - let makeprg .= syntastic#c#SearchHeaders() - else - " search for header includes if not cached already - if !exists('b:syntastic_cpp_includes') - let b:syntastic_cpp_includes = syntastic#c#SearchHeaders() - endif - let makeprg .= b:syntastic_cpp_includes - endif - endif - else - " use the user-defined cflags - let makeprg .= b:syntastic_cpp_cflags - endif - - " add optional config file parameters - let makeprg .= ' ' . syntastic#c#ReadConfig(g:syntastic_cpp_config_file) - - " process makeprg - let errors = SyntasticMake({ 'makeprg': makeprg, - \ 'errorformat': errorformat }) - - " filter the processed errors if desired - if exists('g:syntastic_cpp_remove_include_errors') && - \ g:syntastic_cpp_remove_include_errors != 0 - return filter(errors, - \ 'has_key(v:val, "bufnr") && v:val["bufnr"]=='.bufnr('')) - else - return errors - endif + return syntastic#gcc#GetLocList('cpp', { + \ 'errorformat': + \ '%-G%f:%s:,' . + \ '%f:%l:%c: %trror: %m,' . + \ '%f:%l:%c: %tarning: %m,' . + \ '%f:%l:%c: %m,'. + \ '%f:%l: %trror: %m,'. + \ '%f:%l: %tarning: %m,'. + \ '%f:%l: %m', + \ 'makeprg_main': '-x c++ -fsyntax-only', + \ 'headers_pattern': '\.\(h\|hpp\|hh\)$' }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/syntax_checkers/d/dmd.vim b/syntax_checkers/d/dmd.vim index 0cb1de71f..7415f78c8 100644 --- a/syntax_checkers/d/dmd.vim +++ b/syntax_checkers/d/dmd.vim @@ -15,68 +15,6 @@ " "============================================================================ -" In order to also check header files add this to your .vimrc: -" -" let g:syntastic_d_check_header = 1 -" -" To disable the search of included header files after special -" libraries like gtk and glib add this line to your .vimrc: -" -" let g:syntastic_d_no_include_search = 1 -" -" To disable the include of the default include dirs (such as /usr/include) -" add this line to your .vimrc: -" -" let g:syntastic_d_no_default_include_dirs = 1 -" -" To enable header files being re-checked on every file write add the -" following line to your .vimrc. Otherwise the header files are checked only -" one time on initially loading the file. -" In order to force syntastic to refresh the header includes simply -" unlet b:syntastic_d_includes. Then the header files are being re-checked -" on the next file write. -" -" let g:syntastic_d_auto_refresh_includes = 1 -" -" Alternatively you can set the buffer local variable b:syntastic_d_cflags. -" If this variable is set for the current buffer no search for additional -" libraries is done. I.e. set the variable like this: -" -" let b:syntastic_d_cflags = ' -I/usr/include/libsoup-2.4' -" -" In order to add some custom include directories that should be added to the -" dmd command line you can add those to the global variable -" g:syntastic_d_include_dirs. This list can be used like this: -" -" let g:syntastic_d_include_dirs = [ 'includes', 'headers' ] -" -" Moreover it is possible to add additional compiler options to the syntax -" checking execution via the variable 'g:syntastic_d_compiler_options': -" -" let g:syntastic_d_compiler_options = ' -std=c++0x' -" -" Additionally the setting 'g:syntastic_d_config_file' allows you to define -" a file that contains additional compiler arguments like include directories -" or CFLAGS. The file is expected to contain one option per line. If none is -" given the filename defaults to '.syntastic_d_config': -" -" let g:syntastic_d_config_file = '.config' -" -" Using the global variable 'g:syntastic_d_remove_include_errors' you can -" specify whether errors of files included via the -" g:syntastic_d_include_dirs' setting are removed from the result set: -" -" let g:syntastic_d_remove_include_errors = 1 -" -" Use the variable 'g:syntastic_d_errorformat' to override the default error -" format: -" -" let g:syntastic_d_errorformat = '%f:%l:%c: %trror: %m' -" -" Set your compiler executable with e.g. (defaults to dmd) -" -" let g:syntastic_d_compiler = 'clang++' - if exists('g:loaded_syntastic_d_dmd_checker') finish endif @@ -102,69 +40,12 @@ if !exists('g:syntastic_d_config_file') endif function! SyntaxCheckers_d_dmd_GetLocList() - let makeprg = g:syntastic_d_compiler . ' -c -of' . syntastic#util#DevNull() . ' ' - let errorformat = '%-G%f:%s:,%f(%l): %m,%f:%l: %m' - - if exists('g:syntastic_d_errorformat') - let errorformat = g:syntastic_d_errorformat - endif - - " add optional user-defined compiler options - let makeprg .= g:syntastic_d_compiler_options - - let makeprg .= ' ' . shellescape(expand('%')) . - \ ' ' . syntastic#c#GetIncludeDirs('d') - - " determine whether to parse header files as well - if expand('%') =~? '\.di$' - if exists('g:syntastic_d_check_header') - let makeprg = g:syntastic_d_compiler . - \ ' -c ' . shellescape(expand('%')) . - \ ' -of' . syntastic#util#DevNull() . - \ ' ' . g:syntastic_d_compiler_options . - \ ' ' . syntastic#c#GetIncludeDirs('d') - else - return [] - endif - endif - - " check if the user manually set some cflags - if !exists('b:syntastic_d_cflags') - " check whether to search for include files at all - if !exists('g:syntastic_d_no_include_search') || - \ g:syntastic_d_no_include_search != 1 - " refresh the include file search if desired - if exists('g:syntastic_d_auto_refresh_includes') && - \ g:syntastic_d_auto_refresh_includes != 0 - let makeprg .= syntastic#c#SearchHeaders() - else - " search for header includes if not cached already - if !exists('b:syntastic_d_includes') - let b:syntastic_d_includes = syntastic#c#SearchHeaders() - endif - let makeprg .= b:syntastic_d_includes - endif - endif - else - " use the user-defined cflags - let makeprg .= b:syntastic_d_cflags - endif - - " add optional config file parameters - let makeprg .= ' ' . syntastic#c#ReadConfig(g:syntastic_d_config_file) - - " process makeprg - let errors = SyntasticMake({ 'makeprg': makeprg, - \ 'errorformat': errorformat }) - - " filter the processed errors if desired - if exists('g:syntastic_d_remove_include_errors') && - \ g:syntastic_d_remove_include_errors != 0 - return filter(errors, - \ 'has_key(v:val, "bufnr") && v:val["bufnr"]=='.bufnr('')) - else - return errors - endif + return syntastic#gcc#GetLocList('d', { + \ 'errorformat': + \ '%-G%f:%s:,%f(%l): %m,' . + \ '%f:%l: %m', + \ 'makeprg_main': '-c', + \ 'headers_pattern': '\.di$' }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/syntax_checkers/llvm/llvm.vim b/syntax_checkers/llvm/llvm.vim index 5a1f18ed4..6bb3778ca 100644 --- a/syntax_checkers/llvm/llvm.vim +++ b/syntax_checkers/llvm/llvm.vim @@ -21,7 +21,7 @@ endfunction function! SyntaxCheckers_llvm_llvm_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'llc', - \ 'args': syntastic#c#GetNullDevice(), + \ 'args': syntastic#c#NullOutput('llvm'), \ 'subchecker': 'llvm' }) let errorformat = 'llc: %f:%l:%c: %trror: %m' diff --git a/syntax_checkers/objc/gcc.vim b/syntax_checkers/objc/gcc.vim index 0cd135867..a224b27d7 100644 --- a/syntax_checkers/objc/gcc.vim +++ b/syntax_checkers/objc/gcc.vim @@ -10,69 +10,6 @@ " "============================================================================ -" In order to also check header files add this to your .vimrc: -" (this usually creates a .gch file in your source directory) -" -" let g:syntastic_objc_check_header = 1 -" -" To disable the search of included header files after special -" libraries like gtk and glib add this line to your .vimrc: -" -" let g:syntastic_objc_no_include_search = 1 -" -" To disable the include of the default include dirs (such as /usr/include) -" add this line to your .vimrc: -" -" let g:syntastic_objc_no_default_include_dirs = 1 -" -" To enable header files being re-checked on every file write add the -" following line to your .vimrc. Otherwise the header files are checked only -" one time on initially loading the file. -" In order to force syntastic to refresh the header includes simply -" unlet b:syntastic_objc_includes. Then the header files are being re-checked on -" the next file write. -" -" let g:syntastic_objc_auto_refresh_includes = 1 -" -" Alternatively you can set the buffer local variable b:syntastic_objc_cflags. -" If this variable is set for the current buffer no search for additional -" libraries is done. I.e. set the variable like this: -" -" let b:syntastic_objc_cflags = ' -I/usr/include/libsoup-2.4' -" -" In order to add some custom include directories that should be added to the -" gcc command line you can add those to the global variable -" g:syntastic_objc_include_dirs. This list can be used like this: -" -" let g:syntastic_objc_include_dirs = [ 'includes', 'headers' ] -" -" Moreover it is possible to add additional compiler options to the syntax -" checking execution via the variable 'g:syntastic_objc_compiler_options': -" -" let g:syntastic_objc_compiler_options = ' -ansi' -" -" Additionally the setting 'g:syntastic_objc_config_file' allows you to define a -" file that contains additional compiler arguments like include directories or -" CFLAGS. The file is expected to contain one option per line. If none is -" given the filename defaults to '.syntastic_objc_config': -" -" let g:syntastic_objc_config_file = '.config' -" -" Using the global variable 'g:syntastic_objc_remove_include_errors' you can -" specify whether errors of files included via the g:syntastic_objc_include_dirs' -" setting are removed from the result set: -" -" let g:syntastic_objc_remove_include_errors = 1 -" -" Use the variable 'g:syntastic_objc_errorformat' to override the default error -" format: -" -" let g:syntastic_objc_errorformat = '%f:%l:%c: %trror: %m' -" -" Set your compiler executable with e.g. (defaults to gcc) -" -" let g:syntastic_objc_compiler = 'clang' - if exists('g:loaded_syntastic_objc_gcc_checker') finish endif @@ -98,80 +35,22 @@ if !exists('g:syntastic_objc_config_file') endif function! SyntaxCheckers_objc_gcc_GetLocList() - let makeprg = g:syntastic_objc_compiler . ' -x objective-c -fsyntax-only -lobjc' - let errorformat = - \ '%-G%f:%s:,' . - \ '%-G%f:%l: %#error: %#(Each undeclared identifier is reported only%.%#,' . - \ '%-G%f:%l: %#error: %#for each function it appears%.%#,' . - \ '%-GIn file included%.%#,'. - \ '%-G %#from %f:%l\,,' . - \ '%f:%l:%c: %trror: %m,' . - \ '%f:%l:%c: %tarning: %m,' . - \ '%f:%l:%c: %m,' . - \ '%f:%l: %trror: %m,' . - \ '%f:%l: %tarning: %m,' . - \ '%f:%l: %m' - - if exists('g:syntastic_objc_errorformat') - let errorformat = g:syntastic_objc_errorformat - endif - - " add optional user-defined compiler options - let makeprg .= g:syntastic_objc_compiler_options - - let makeprg .= ' ' . shellescape(expand('%')) . - \ ' ' . syntastic#c#GetIncludeDirs('objc') - - " determine whether to parse header files as well - if expand('%') =~? '\.h$' - if exists('g:syntastic_objc_check_header') - let makeprg = g:syntastic_objc_compiler . - \ ' -x objective-c-header ' . - \ ' -c ' . shellescape(expand('%')) . - \ ' ' . g:syntastic_objc_compiler_options . - \ ' ' . syntastic#c#GetIncludeDirs('objc') - else - return [] - endif - endif - - " check if the user manually set some cflags - if !exists('b:syntastic_objc_cflags') - " check whether to search for include files at all - if !exists('g:syntastic_objc_no_include_search') || - \ g:syntastic_objc_no_include_search != 1 - " refresh the include file search if desired - if exists('g:syntastic_objc_auto_refresh_includes') && - \ g:syntastic_objc_auto_refresh_includes != 0 - let makeprg .= syntastic#c#SearchHeaders() - else - " search for header includes if not cached already - if !exists('b:syntastic_objc_includes') - let b:syntastic_objc_includes = syntastic#c#SearchHeaders() - endif - let makeprg .= b:syntastic_objc_includes - endif - endif - else - " use the user-defined cflags - let makeprg .= b:syntastic_objc_cflags - endif - - " add optional config file parameters - let makeprg .= ' ' . syntastic#c#ReadConfig(g:syntastic_objc_config_file) - - " process makeprg - let errors = SyntasticMake({ 'makeprg': makeprg, - \ 'errorformat': errorformat }) - - " filter the processed errors if desired - if exists('g:syntastic_objc_remove_include_errors') && - \ g:syntastic_objc_remove_include_errors != 0 - return filter(errors, - \ 'has_key(v:val, "bufnr") && v:val["bufnr"]=='.bufnr('')) - else - return errors - endif + return syntastic#gcc#GetLocList('objc', { + \ 'errorformat': + \ '%-G%f:%s:,' . + \ '%-G%f:%l: %#error: %#(Each undeclared identifier is reported only%.%#,' . + \ '%-G%f:%l: %#error: %#for each function it appears%.%#,' . + \ '%-GIn file included%.%#,'. + \ '%-G %#from %f:%l\,,' . + \ '%f:%l:%c: %trror: %m,' . + \ '%f:%l:%c: %tarning: %m,' . + \ '%f:%l:%c: %m,' . + \ '%f:%l: %trror: %m,' . + \ '%f:%l: %tarning: %m,' . + \ '%f:%l: %m', + \ 'makeprg_main': '-x objective-c -fsyntax-only', + \ 'makeprg_headers': '-x objective-c-header -lobjc', + \ 'headers_pattern': '\.h$' }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/syntax_checkers/objcpp/gcc.vim b/syntax_checkers/objcpp/gcc.vim new file mode 100644 index 000000000..8b6fb70b1 --- /dev/null +++ b/syntax_checkers/objcpp/gcc.vim @@ -0,0 +1,63 @@ +"============================================================================ +"File: objcpp.vim +"Description: Syntax checking plugin for syntastic.vim +"Maintainer: Gregor Uhlenheuer +"License: This program is free software. It comes without any warranty, +" to the extent permitted by applicable law. You can redistribute +" it and/or modify it under the terms of the Do What The Fuck You +" Want To Public License, Version 2, as published by Sam Hocevar. +" See http://sam.zoy.org/wtfpl/COPYING for more details. +" +"============================================================================ + +if exists('g:loaded_syntastic_objcpp_gcc_checker') + finish +endif +let g:loaded_syntastic_objcpp_gcc_checker = 1 + +if !exists('g:syntastic_objcpp_compiler') + let g:syntastic_objcpp_compiler = 'gcc' +endif + +function! SyntaxCheckers_objcpp_gcc_IsAvailable() + return executable(g:syntastic_objcpp_compiler) +endfunction + +let s:save_cpo = &cpo +set cpo&vim + +if !exists('g:syntastic_objcpp_compiler_options') + let g:syntastic_objcpp_compiler_options = '-std=gnu99' +endif + +if !exists('g:syntastic_objcpp_config_file') + let g:syntastic_objcpp_config_file = '.syntastic_objcpp_config' +endif + +function! SyntaxCheckers_objcpp_gcc_GetLocList() + return syntastic#gcc#GetLocList('objcpp', { + \ 'errorformat': + \ '%-G%f:%s:,' . + \ '%-G%f:%l: %#error: %#(Each undeclared identifier is reported only%.%#,' . + \ '%-G%f:%l: %#error: %#for each function it appears%.%#,' . + \ '%-GIn file included%.%#,'. + \ '%-G %#from %f:%l\,,' . + \ '%f:%l:%c: %trror: %m,' . + \ '%f:%l:%c: %tarning: %m,' . + \ '%f:%l:%c: %m,' . + \ '%f:%l: %trror: %m,' . + \ '%f:%l: %tarning: %m,' . + \ '%f:%l: %m', + \ 'makeprg_main': '-x objective-c++ -fsyntax-only', + \ 'makeprg_headers': '-x objective-c++-header -lobjc', + \ 'headers_pattern': '\.h$' }) +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'objcpp', + \ 'name': 'gcc'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/objcpp/ycm.vim b/syntax_checkers/objcpp/ycm.vim new file mode 100644 index 000000000..785a1994a --- /dev/null +++ b/syntax_checkers/objcpp/ycm.vim @@ -0,0 +1,34 @@ +"============================================================================ +"File: ycm.vim +"Description: Syntax checking plugin for syntastic.vim +"Maintainer: Val Markovic +"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("loaded_ycm_objcpp_syntax_checker") + finish +endif +let loaded_ycm_objcpp_syntax_checker = 1 + +runtime syntax_checkers/c/ycm.vim + +function! SyntaxCheckers_objcpp_ycm_IsAvailable() + return SyntaxCheckers_c_ycm_IsAvailable() +endfunction + +if !exists('g:loaded_youcompleteme') + finish +endif + +function! SyntaxCheckers_objcpp_ycm_GetLocList() + return SyntaxCheckers_c_ycm_GetLocList() +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'objcpp', + \ 'name': 'ycm'}) From 0de1daa40034b42df543a44b313ea29b1521ed12 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Tue, 21 May 2013 15:02:42 +0300 Subject: [PATCH 0003/1271] Small fixes. --- syntax_checkers/c/gcc.vim | 1 + syntax_checkers/cpp/gcc.vim | 1 + syntax_checkers/d/dmd.vim | 2 +- syntax_checkers/nasm/nasm.vim | 7 +------ 4 files changed, 4 insertions(+), 7 deletions(-) diff --git a/syntax_checkers/c/gcc.vim b/syntax_checkers/c/gcc.vim index 3cca035fb..0d4885bdd 100644 --- a/syntax_checkers/c/gcc.vim +++ b/syntax_checkers/c/gcc.vim @@ -50,6 +50,7 @@ function! SyntaxCheckers_c_gcc_GetLocList() \ '%f:%l: %tarning: %m,'. \ '%f:%l: %m', \ 'makeprg_main': '-x c -fsyntax-only', + \ 'makeprg_headers': '-x c', \ 'headers_pattern': '\.h$' }) endfunction diff --git a/syntax_checkers/cpp/gcc.vim b/syntax_checkers/cpp/gcc.vim index 930dc4ab4..7f7e44c52 100644 --- a/syntax_checkers/cpp/gcc.vim +++ b/syntax_checkers/cpp/gcc.vim @@ -45,6 +45,7 @@ function! SyntaxCheckers_cpp_gcc_GetLocList() \ '%f:%l: %tarning: %m,'. \ '%f:%l: %m', \ 'makeprg_main': '-x c++ -fsyntax-only', + \ 'makeprg_headers': '-x c++', \ 'headers_pattern': '\.\(h\|hpp\|hh\)$' }) endfunction diff --git a/syntax_checkers/d/dmd.vim b/syntax_checkers/d/dmd.vim index 7415f78c8..5c66e7a7c 100644 --- a/syntax_checkers/d/dmd.vim +++ b/syntax_checkers/d/dmd.vim @@ -44,7 +44,7 @@ function! SyntaxCheckers_d_dmd_GetLocList() \ 'errorformat': \ '%-G%f:%s:,%f(%l): %m,' . \ '%f:%l: %m', - \ 'makeprg_main': '-c', + \ 'makeprg_main': '-c ' . syntastic#c#NullOutput('d'), \ 'headers_pattern': '\.di$' }) endfunction diff --git a/syntax_checkers/nasm/nasm.vim b/syntax_checkers/nasm/nasm.vim index 0cf0b51a4..61a2b4ade 100644 --- a/syntax_checkers/nasm/nasm.vim +++ b/syntax_checkers/nasm/nasm.vim @@ -19,15 +19,10 @@ function! SyntaxCheckers_nasm_nasm_IsAvailable() endfunction function! SyntaxCheckers_nasm_nasm_GetLocList() - if has("win32") - let outfile="NUL" - else - let outfile="/dev/null" - endif let wd = shellescape(expand("%:p:h") . "/") let makeprg = syntastic#makeprg#build({ \ 'exe': 'nasm', - \ 'args': '-X gnu -f elf -I ' . wd . ' -o ' . outfile, + \ 'args': '-X gnu -f elf -I ' . wd . ' ' . syntastic#c#NullOutput('nasm'), \ 'subchecker': 'nasm' }) let errorformat = '%f:%l: %t%*[^:]: %m' return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) From 6260e99966bddfb72e39ed9859d069802725524a Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Thu, 23 May 2013 11:50:26 +0300 Subject: [PATCH 0004/1271] Minor optimisation related to syntastic_ignore_files. --- plugin/syntastic.vim | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 41c4a7d25..8fa4745de 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -354,7 +354,11 @@ function! SyntasticMake(options) endif " Apply ignore patterns - call filter(errors, '!s:IgnoreFile(bufname(str2nr(v:val["bufnr"])))') + let ignore = {} + for buf in syntastic#util#unique(map(copy(errors), 'v:val["bufnr"]')) + let ignore[buf] = s:IgnoreFile(bufname(str2nr(buf))) + endfor + call filter(errors, '!ignore[v:val["bufnr"]]') " Add subtype info if present. if has_key(a:options, 'subtype') From 08340d4e1028531192c96aa70f7481c9727e8a1d Mon Sep 17 00:00:00 2001 From: Garrison Jensen Date: Thu, 23 May 2013 18:04:13 -0600 Subject: [PATCH 0005/1271] Change 'call' to 'execute' According to https://github.com/tpope/vim-pathogen --- README.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.markdown b/README.markdown index d46b57d4d..7a28bd037 100644 --- a/README.markdown +++ b/README.markdown @@ -66,7 +66,7 @@ and the directories it needs: Next you *need to add this* to your ~/.vimrc: - call pathogen#infect() + execute pathogen#infect() Step 2: Install syntastic as a pathogen bundle ---------------------------------------------- From 2ff3624f19582e2ce88807c56e7a58fd2b3bb0ed Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Sun, 26 May 2013 17:47:52 +0300 Subject: [PATCH 0006/1271] Coffee checker: "--lint" is now deprecated. --- syntax_checkers/coffee/coffee.vim | 1 - 1 file changed, 1 deletion(-) diff --git a/syntax_checkers/coffee/coffee.vim b/syntax_checkers/coffee/coffee.vim index 039db2084..aa965bb60 100644 --- a/syntax_checkers/coffee/coffee.vim +++ b/syntax_checkers/coffee/coffee.vim @@ -21,7 +21,6 @@ endfunction function! SyntaxCheckers_coffee_coffee_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'coffee', - \ 'args': '--lint', \ 'subchecker': 'coffee' }) let errorformat = \ '%E%f:%l:%c: %trror: %m,' . From 840a4f600102f4c30f933ee4b1c22f4f79ab4232 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Mon, 27 May 2013 09:23:09 +0300 Subject: [PATCH 0007/1271] Clear loclist if there are no errors. Fixes #650. --- plugin/syntastic.vim | 4 ++-- plugin/syntastic/loclist.vim | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 8fa4745de..a03a5aed0 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -133,9 +133,9 @@ function! s:UpdateErrors(auto_invoked, ...) let loclist = g:SyntasticLoclist.current() call s:notifiers.refresh(loclist) - if (g:syntastic_always_populate_loc_list || g:syntastic_auto_jump) && loclist.hasErrorsOrWarningsToDisplay() + if g:syntastic_always_populate_loc_list || g:syntastic_auto_jump call setloclist(0, loclist.filteredRaw()) - if g:syntastic_auto_jump + if g:syntastic_auto_jump && loclist.hasErrorsOrWarningsToDisplay() silent! lrewind endif endif diff --git a/plugin/syntastic/loclist.vim b/plugin/syntastic/loclist.vim index 1b9b53914..2dd0bd5a1 100644 --- a/plugin/syntastic/loclist.vim +++ b/plugin/syntastic/loclist.vim @@ -133,8 +133,8 @@ endfunction "display the cached errors for this buf in the location list function! g:SyntasticLoclist.show() + call setloclist(0, self.filteredRaw()) if self.hasErrorsOrWarningsToDisplay() - call setloclist(0, self.filteredRaw()) let num = winnr() exec "lopen " . g:syntastic_loc_list_height if num != winnr() From 5c3e7deb1fe17de93dbf484fac4efaf5c79c5d50 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Mon, 27 May 2013 10:20:44 +0300 Subject: [PATCH 0008/1271] Add a note about syntastic_always_populate_loc_list. Formatting. --- README.markdown | 64 +++++++++++++++++++++++++++---------------------- 1 file changed, 35 insertions(+), 29 deletions(-) diff --git a/README.markdown b/README.markdown index 7a28bd037..b1d83bcc7 100644 --- a/README.markdown +++ b/README.markdown @@ -31,8 +31,7 @@ gentoo_metadata, go, haml, haskell, haxe, html, java, javascript, json, less, li nasm, objc, ocaml, perl, php, puppet, python, rst, ruby, rust, sass/scss, scala, sh, slim, tcl, tex, twig, typescript, vala, vhdl, xhtml, xml, xslt, yaml, z80, zpt, zsh -Screenshot ----------- +## Screenshot Below is a screenshot showing the methods that Syntastic uses to display syntax errors. Note that, in practise, you will only have a subset of these methods @@ -47,14 +46,12 @@ enabled. 5. Hover the mouse over a line containing an error and the error message is displayed as a balloon. 6. (not shown) Highlighting errors with syntax highlighting. Erroneous parts of lines can be highlighted. -Installation ------------- +## Installation Installing syntastic is easy but first you need to have the pathogen plugin installed. If you already have pathogen working then skip Step 1 and go to Step 2. -Step 1: Install pathogen.vim ----------------------------- +### Step 1: Install pathogen.vim First I'll show you how to install tpope's [pathogen.vim](https://github.com/tpope/vim-pathogen) so that it's easy to install syntastic. Do this in your Terminal so that you get the pathogen.vim file @@ -68,8 +65,7 @@ Next you *need to add this* to your ~/.vimrc: execute pathogen#infect() -Step 2: Install syntastic as a pathogen bundle ----------------------------------------------- +### Step 2: Install syntastic as a pathogen bundle You now have pathogen installed and can put syntastic into ~/.vim/bundle like this: @@ -90,22 +86,20 @@ step 1 and make sure you did the following: 4. Have permissions to access all of these directories. -Google group ------------- +## Google group To get information or make suggestions check out the [google group](https://groups.google.com/group/vim-syntastic). -FAQ ---- +## FAQ -__Q. I installed syntastic but it isn't reporting any errors ...__ +### Q. I installed syntastic but it isn't reporting any errors... A. The most likely reason is that the syntax checker that it requires isn't installed. For example: python requires either `flake8`, `pyflakes` or `pylint` to be installed and in `$PATH`. To see which executable is required, just look in `syntax_checkers/.vim`. Note that aliases do not work; the actual executable must be available in your `$PATH`. Symbolic links are okay. Another reason it could fail is that the error output for the syntax checker may have changed. In this case, make sure you have the latest version of the syntax checker installed. If it still fails then create an issue - or better yet, create a pull request. -__Q. Recently some of my syntax checker options have stopped working...__ +### Q. Recently some of my syntax checker options have stopped working... A. The options are still there, they have just been renamed. Recently, almost all syntax checkers were refactored to use the new `syntastic#makeprg#build()` function. This made a lot of the old explicit options redundant - as they are now implied. The new implied options usually have slightly different names to the old options. @@ -113,49 +107,61 @@ e.g. Previously there was `g:syntastic_phpcs_conf`, now you must use `g:syntasti See `:help syntastic-checker-options` for more information. -__Q. How can I pass additional arguments to a checker?__ +### Q. I run a chacker and the location list is not updated... -A. Almost all syntax checkers use the `syntastic#makeprg#build()` function. Those checkers that do can be configured using global variables. The general form of the global args variables are: +A. By default, the location list is changed only when you run the `:Errors` command, in order to minimise conflicts with other plugins. If you want the location list to always be updated when you run the checkers, add this line to your vimrc: +```vim +let g:syntastic_always_populate_loc_list=1 +``` -`syntastic_[filetype]_[subchecker]_args` +### Q. How can I pass additional arguments to a checker? -So, If you wanted to pass "--my --args --here" to the ruby mri checker you would add this line to your vimrc: +A. Almost all syntax checkers use the `syntastic#makeprg#build()` function. Those checkers that do can be configured using global variables. The general form of the global args variables are: +```vim +syntastic_[filetype]_[subchecker]_args +``` -`let g:syntastic_ruby_mri_args="--my --args --here"` +So, If you wanted to pass "--my --args --here" to the ruby mri checker you would add this line to your vimrc: +```vim +let g:syntastic_ruby_mri_args="--my --args --here" +``` See `:help syntastic-checker-options` for more information. -__Q. Syntastic supports several checkers for my filetype - how do I tell it which one(s) to use?__ +### Q. Syntastic supports several checkers for my filetype - how do I tell it which one(s) to use? A. Stick a line like this in your vimrc: - -`let g:syntastic__checkers=['']` +```vim +let g:syntastic__checkers=[''] +``` To see the list of checkers for your filetype, look in `syntax_checkers//`. e.g. Python has the following checkers: `flake8`, `pyflakes`, `pylint` and a native `python` checker. To tell syntastic to use `pylint`, you would use this setting: - -`let g:syntastic_python_checkers=['pylint']` +```vim +let g:syntastic_python_checkers=['pylint'] +``` Some filetypes, like PHP, have style checkers as well as syntax checkers. These can be chained together like this: - -`let g:syntastic_php_checkers=['php', 'phpcs', 'phpmd']` +```vim +let g:syntastic_php_checkers=['php', 'phpcs', 'phpmd'] +``` This is telling syntastic to run the `php` checker first, and if no errors are found, run `phpcs`, and then `phpmd`. -__Q. How can I jump between the different errors without using the location list at the bottom of the window?__ +### Q. How can I jump between the different errors without using the location list at the bottom of the window? A. Vim provides several built in commands for this. See `:help :lnext` and `:help :lprev`. If you use these commands a lot then you may want to add shortcut mappings to your vimrc, or install something like [unimpaired](https://github.com/tpope/vim-unimpaired) - which provides such mappings (among other things). -__Q. A syntax checker is giving me unwanted/strange style tips?__ +### Q. A syntax checker is giving me unwanted/strange style tips? A. Some filetypes (e.g. php) have style checkers as well as syntax checkers. You can usually configure the options that are passed to the style checkers, or just disable them. Take a look at the syntax checker integration file (e.g. `syntax_checkers/php.vim`) to see what options are available. -__Q. The error window is closed automatically when I :quit the current buffer but not when I :bdelete it?__ +### Q. The error window is closed automatically when I :quit the current buffer but not when I :bdelete it? A. There is no safe way to handle that situation automatically, but you can work around it: From da72fc39beb03db0939d61b85e694ad9bcbe357e Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Mon, 27 May 2013 10:43:11 +0300 Subject: [PATCH 0009/1271] Minor update to the docs. --- README.markdown | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/README.markdown b/README.markdown index b1d83bcc7..e2d109a05 100644 --- a/README.markdown +++ b/README.markdown @@ -25,11 +25,14 @@ demand, or automatically as files are saved. If syntax errors are detected, the user is notified and is happy because they didn't have to compile their code or execute their script to find them. -At the time of this writing, syntax checking plugins exist for ada, applescript, c, co, -coffee, coq, cpp, cs, css, cucumber, cuda, d, dart, docbk, elixir, erlang, eruby, fortran, -gentoo_metadata, go, haml, haskell, haxe, html, java, javascript, json, less, lisp, lua, matlab, -nasm, objc, ocaml, perl, php, puppet, python, rst, ruby, rust, sass/scss, scala, sh, slim, tcl, tex, -twig, typescript, vala, vhdl, xhtml, xml, xslt, yaml, z80, zpt, zsh +At the time of this writing, syntax checking plugins exist for Ada, +AppleScript, Bourne shell, C, C++, C#, CoffeeScript, Coco, Coq, CSS, +Cucumber, CUDA, D, Dart, DocBook, Elixir, Erlang, eRuby, Fortran, Gentoo +metadata, Go, Haml, Haskell, Haxe, HTML, Java, JavaScript, JSON, LESS, +LISP, LLVM intermediate language, Lua, MATLAB, NASM, Objective-C, OCaml, +Perl, Perl POD, PHP, Puppet, Python, reStructuredText, Ruby, Rust, +SASS/SCSS, Scala, Slim, Tcl, TeX, Twig, TypeScript, Vala, VHDL, xHtml, +XML, XSLT, YAML, z80, Zope page templates, zsh. ## Screenshot @@ -155,11 +158,11 @@ This is telling syntastic to run the `php` checker first, and if no errors are f A. Vim provides several built in commands for this. See `:help :lnext` and `:help :lprev`. -If you use these commands a lot then you may want to add shortcut mappings to your vimrc, or install something like [unimpaired](https://github.com/tpope/vim-unimpaired) - which provides such mappings (among other things). +If you use these commands a lot then you may want to add shortcut mappings to your vimrc, or install something like [unimpaired](https://github.com/tpope/vim-unimpaired), which provides such mappings (among other things). ### Q. A syntax checker is giving me unwanted/strange style tips? -A. Some filetypes (e.g. php) have style checkers as well as syntax checkers. You can usually configure the options that are passed to the style checkers, or just disable them. Take a look at the syntax checker integration file (e.g. `syntax_checkers/php.vim`) to see what options are available. +A. Some filetypes (e.g. php) have style checkers as well as syntax checkers. You can usually configure the options that are passed to the style checkers, or just disable them. Take a look at the [wiki](https://github.com/scrooloose/syntastic/wiki/Syntaxcheckers) to see what options are available. ### Q. The error window is closed automatically when I :quit the current buffer but not when I :bdelete it? From 331815d756c82a6ff67a1c4323a687b3411e9001 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Tue, 28 May 2013 10:26:30 +0300 Subject: [PATCH 0010/1271] Formatting, again. --- README.markdown | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/README.markdown b/README.markdown index e2d109a05..1daa1696a 100644 --- a/README.markdown +++ b/README.markdown @@ -96,13 +96,13 @@ To get information or make suggestions check out the [google group](https://grou ## FAQ -### Q. I installed syntastic but it isn't reporting any errors... +__Q. I installed syntastic but it isn't reporting any errors...__ A. The most likely reason is that the syntax checker that it requires isn't installed. For example: python requires either `flake8`, `pyflakes` or `pylint` to be installed and in `$PATH`. To see which executable is required, just look in `syntax_checkers/.vim`. Note that aliases do not work; the actual executable must be available in your `$PATH`. Symbolic links are okay. Another reason it could fail is that the error output for the syntax checker may have changed. In this case, make sure you have the latest version of the syntax checker installed. If it still fails then create an issue - or better yet, create a pull request. -### Q. Recently some of my syntax checker options have stopped working... +__Q. Recently some of my syntax checker options have stopped working...__ A. The options are still there, they have just been renamed. Recently, almost all syntax checkers were refactored to use the new `syntastic#makeprg#build()` function. This made a lot of the old explicit options redundant - as they are now implied. The new implied options usually have slightly different names to the old options. @@ -110,14 +110,14 @@ e.g. Previously there was `g:syntastic_phpcs_conf`, now you must use `g:syntasti See `:help syntastic-checker-options` for more information. -### Q. I run a chacker and the location list is not updated... +__Q. I run a chacker and the location list is not updated...__ A. By default, the location list is changed only when you run the `:Errors` command, in order to minimise conflicts with other plugins. If you want the location list to always be updated when you run the checkers, add this line to your vimrc: ```vim let g:syntastic_always_populate_loc_list=1 ``` -### Q. How can I pass additional arguments to a checker? +__Q. How can I pass additional arguments to a checker?__ A. Almost all syntax checkers use the `syntastic#makeprg#build()` function. Those checkers that do can be configured using global variables. The general form of the global args variables are: ```vim @@ -131,7 +131,7 @@ let g:syntastic_ruby_mri_args="--my --args --here" See `:help syntastic-checker-options` for more information. -### Q. Syntastic supports several checkers for my filetype - how do I tell it which one(s) to use? +__Q. Syntastic supports several checkers for my filetype - how do I tell it which one(s) to use?__ A. Stick a line like this in your vimrc: ```vim @@ -154,17 +154,17 @@ let g:syntastic_php_checkers=['php', 'phpcs', 'phpmd'] This is telling syntastic to run the `php` checker first, and if no errors are found, run `phpcs`, and then `phpmd`. -### Q. How can I jump between the different errors without using the location list at the bottom of the window? +__Q. How can I jump between the different errors without using the location list at the bottom of the window?__ A. Vim provides several built in commands for this. See `:help :lnext` and `:help :lprev`. If you use these commands a lot then you may want to add shortcut mappings to your vimrc, or install something like [unimpaired](https://github.com/tpope/vim-unimpaired), which provides such mappings (among other things). -### Q. A syntax checker is giving me unwanted/strange style tips? +__Q. A syntax checker is giving me unwanted/strange style tips?__ A. Some filetypes (e.g. php) have style checkers as well as syntax checkers. You can usually configure the options that are passed to the style checkers, or just disable them. Take a look at the [wiki](https://github.com/scrooloose/syntastic/wiki/Syntaxcheckers) to see what options are available. -### Q. The error window is closed automatically when I :quit the current buffer but not when I :bdelete it? +__Q. The error window is closed automatically when I :quit the current buffer but not when I :bdelete it?__ A. There is no safe way to handle that situation automatically, but you can work around it: From 9495e4d7e64ed94e04b138035dbca85707d787f5 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Wed, 29 May 2013 09:55:42 +0300 Subject: [PATCH 0011/1271] Relax parsing of version strings. --- autoload/syntastic/util.vim | 18 ++++++++++-------- syntax_checkers/javascript/jshint.vim | 3 +-- syntax_checkers/puppet/puppetlint.vim | 9 ++------- syntax_checkers/slim/slimrb.vim | 11 ++++------- 4 files changed, 17 insertions(+), 24 deletions(-) diff --git a/autoload/syntastic/util.vim b/autoload/syntastic/util.vim index e68f6c95f..4e777b3db 100644 --- a/autoload/syntastic/util.vim +++ b/autoload/syntastic/util.vim @@ -43,18 +43,20 @@ function! syntastic#util#parseShebang() return {'exe': '', 'args': []} endfunction -" Verify that the 'installed' version is at the 'required' version, if not -" better. -" -" 'installed' and 'required' must be arrays. Only the -" first three elements (major, minor, patch) are looked at. +" Run 'command' in a shell and parse output as a version string. +" Returns an array of version components. +function! syntastic#util#parseVersion(command) + return split(matchstr( system(a:command), '\v^\D*\zs\d+(\.\d+)+\ze' ), '\.') +endfunction + +" Verify that the 'installed' version is at least the 'required' version. " -" Either array may be less than three elements. The "missing" elements -" will be assumed to be '0' for the purposes of checking. +" 'installed' and 'required' must be arrays. If they have different lengths, +" the "missing" elements will be assumed to be 0 for the purposes of checking. " " See http://semver.org for info about version numbers. function! syntastic#util#versionIsAtLeast(installed, required) - for index in [0,1,2] + for index in range(max([len(a:installed), len(a:required)])) if len(a:installed) <= index let installed_element = 0 else diff --git a/syntax_checkers/javascript/jshint.vim b/syntax_checkers/javascript/jshint.vim index 0101a7017..9b10c1809 100644 --- a/syntax_checkers/javascript/jshint.vim +++ b/syntax_checkers/javascript/jshint.vim @@ -36,8 +36,7 @@ function! SyntaxCheckers_javascript_jshint_GetLocList() endfunction function s:JshintNew() - let ver = matchlist(system('jshint --version'), '^\D*\(\d\+\)\.\(\d\+\)') - return (ver[1] > 1 || (ver[1] == 1 && ver[2] >= 1)) + return syntastic#util#versionIsAtLeast(syntastic#util#parseVersion('jshint --version'), [1, 1]) endfunction function s:Args() diff --git a/syntax_checkers/puppet/puppetlint.vim b/syntax_checkers/puppet/puppetlint.vim index 721738591..32ccd9010 100644 --- a/syntax_checkers/puppet/puppetlint.vim +++ b/syntax_checkers/puppet/puppetlint.vim @@ -33,19 +33,14 @@ endif function! s:PuppetVersion() if !exists("s:puppet_version") - let output = system("puppet --version 2>/dev/null") - let output = substitute(output, '\n$', '', '') - let s:puppet_version = split(output, '\.') + let s:puppet_version = syntastic#util#parseVersion("puppet --version 2>/dev/null") endif return s:puppet_version endfunction function! s:PuppetLintVersion() if !exists("s:puppet_lint_version") - let output = system("puppet-lint --version 2>/dev/null") - let output = substitute(output, '\n$', '', '') - let output = substitute(output, '^puppet-lint ', '', 'i') - let s:puppet_lint_version = split(output, '\.') + let s:puppet_lint_version = syntastic#util#parseVersion("puppet-lint --version 2>/dev/null") endif return s:puppet_lint_version endfunction diff --git a/syntax_checkers/slim/slimrb.vim b/syntax_checkers/slim/slimrb.vim index d9c5849b0..342203373 100644 --- a/syntax_checkers/slim/slimrb.vim +++ b/syntax_checkers/slim/slimrb.vim @@ -21,19 +21,16 @@ endfunction function! s:SlimrbVersion() if !exists('s:slimrb_version') - let output = system("slimrb --version 2>/dev/null") - let output = substitute(output, '\n$', '', '') - let output = substitute(output, '^slim ', '', 'i') - let s:slimrb_version = split(output, '\.') + let s:slimrb_version = syntastic#util#parseVersion('slimrb --version 2>/dev/null') end return s:slimrb_version endfunction function! SyntaxCheckers_slim_slimrb_GetLocList() let makeprg = syntastic#makeprg#build({ - \ 'exe': 'slimrb', - \ 'args': '-c', - \ 'subchecker': 'slimrb' }) + \ 'exe': 'slimrb', + \ 'args': '-c', + \ 'subchecker': 'slimrb' }) if syntastic#util#versionIsAtLeast(s:SlimrbVersion(), [1,3,1]) let errorformat = \ '%C\ %#%f\, Line %l\, Column %c,'. From 381202d509e939e1ac0da98ff37d8d5663aec83f Mon Sep 17 00:00:00 2001 From: unc0 Date: Wed, 29 May 2013 16:10:46 +0800 Subject: [PATCH 0012/1271] add oclint syntax checker for c/c++ --- syntax_checkers/c/oclint.vim | 53 ++++++++++++++++++++++++++++++++++ syntax_checkers/cpp/oclint.vim | 53 ++++++++++++++++++++++++++++++++++ 2 files changed, 106 insertions(+) create mode 100644 syntax_checkers/c/oclint.vim create mode 100644 syntax_checkers/cpp/oclint.vim diff --git a/syntax_checkers/c/oclint.vim b/syntax_checkers/c/oclint.vim new file mode 100644 index 000000000..efd84f2ee --- /dev/null +++ b/syntax_checkers/c/oclint.vim @@ -0,0 +1,53 @@ +"============================================================================ +"File: oclint.vim +"Description: Syntax checking plugin for syntastic.vim +"Maintainer: "UnCO" Lin +"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. +"============================================================================ +" +" The setting 'g:syntastic_oclint_config_file' allows you to define a file +" that contains additional compiler arguments like include directories or +" CFLAGS. The file is expected to contain one option per line. If none is +" given the filename defaults to '.syntastic_oclint_config': +" +" let g:syntastic_oclint_config_file = '.config' + +if exists("loaded_oclint_syntax_checker") + finish +endif +let loaded_oclint_syntax_checker = 1 + +function! SyntaxCheckers_c_oclint_IsAvailable() + return executable("oclint") +endfunction + +if !exists('g:syntastic_oclint_config_file') + let g:syntastic_oclint_config_file = '.syntastic_oclint_config' +endif + +function! SyntaxCheckers_c_oclint_GetLocList() + let makeprg = syntastic#makeprg#build({ + \ 'exe': 'oclint', + \ 'args': '-text', + \ 'post_args': '-- -c' . syntastic#c#ReadConfig(g:syntastic_oclint_config_file), + \ 'subchecker': 'oclint' }) + + let errorformat = + \ '%f:%l:%c:\ %m,' . + \ '%-G%.%#' + + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'subtype': 'Style', + \ 'postprocess': ['compressWhitespace'], + \ 'defaults': {'type': 'W'} }) +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'c', + \ 'name': 'oclint'}) diff --git a/syntax_checkers/cpp/oclint.vim b/syntax_checkers/cpp/oclint.vim new file mode 100644 index 000000000..d6e43dde1 --- /dev/null +++ b/syntax_checkers/cpp/oclint.vim @@ -0,0 +1,53 @@ +"============================================================================ +"File: oclint.vim +"Description: Syntax checking plugin for syntastic.vim +"Maintainer: "UnCO" Lin +"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. +"============================================================================ +" +" The setting 'g:syntastic_oclint_config_file' allows you to define a file +" that contains additional compiler arguments like include directories or +" CFLAGS. The file is expected to contain one option per line. If none is +" given the filename defaults to '.syntastic_oclint_config': +" +" let g:syntastic_oclint_config_file = '.config' + +if exists("loaded_oclint_syntax_checker") + finish +endif +let loaded_oclint_syntax_checker = 1 + +function! SyntaxCheckers_cpp_oclint_IsAvailable() + return executable("oclint") +endfunction + +if !exists('g:syntastic_oclint_config_file') + let g:syntastic_oclint_config_file = '.syntastic_oclint_config' +endif + +function! SyntaxCheckers_cpp_oclint_GetLocList() + let makeprg = syntastic#makeprg#build({ + \ 'exe': 'oclint', + \ 'args': '-text', + \ 'post_args': '-- -c' . syntastic#c#ReadConfig(g:syntastic_oclint_config_file), + \ 'subchecker': 'oclint' }) + + let errorformat = + \ '%f:%l:%c:\ %m,' . + \ '%-G%.%#' + + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'subtype': 'Style', + \ 'postprocess': ['compressWhitespace'], + \ 'defaults': {'type': 'W'} }) +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'cpp', + \ 'name': 'oclint'}) From 5113d52a445542fec396e1b27462d89a1973163a Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Wed, 29 May 2013 14:25:33 +0300 Subject: [PATCH 0013/1271] OClint can check Objective-C files. Cleanup. --- syntax_checkers/c/oclint.vim | 20 +++++++---- syntax_checkers/cpp/oclint.vim | 20 +++++++---- syntax_checkers/objc/oclint.vim | 61 +++++++++++++++++++++++++++++++++ 3 files changed, 89 insertions(+), 12 deletions(-) create mode 100644 syntax_checkers/objc/oclint.vim diff --git a/syntax_checkers/c/oclint.vim b/syntax_checkers/c/oclint.vim index efd84f2ee..32cdd57ab 100644 --- a/syntax_checkers/c/oclint.vim +++ b/syntax_checkers/c/oclint.vim @@ -16,10 +16,10 @@ " " let g:syntastic_oclint_config_file = '.config' -if exists("loaded_oclint_syntax_checker") +if exists("g:loaded_syntastic_c_oclint_checker") finish endif -let loaded_oclint_syntax_checker = 1 +let g:loaded_syntastic_c_oclint_checker = 1 function! SyntaxCheckers_c_oclint_IsAvailable() return executable("oclint") @@ -37,15 +37,23 @@ function! SyntaxCheckers_c_oclint_GetLocList() \ 'subchecker': 'oclint' }) let errorformat = - \ '%f:%l:%c:\ %m,' . + \ '%W%f:%l:%c: %m,' . + \ '%E%f:%l:%c: error: %m,' . \ '%-G%.%#' - return SyntasticMake({ + let loclist = SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, \ 'subtype': 'Style', - \ 'postprocess': ['compressWhitespace'], - \ 'defaults': {'type': 'W'} }) + \ 'postprocess': ['compressWhitespace', 'sort'] }) + + for n in range(len(loclist)) + if loclist[n]['text'] =~# ' P[12] \=$' + let loclist[n]['type'] = 'E' + endif + endfor + + return loclist endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/syntax_checkers/cpp/oclint.vim b/syntax_checkers/cpp/oclint.vim index d6e43dde1..b3edbfbc2 100644 --- a/syntax_checkers/cpp/oclint.vim +++ b/syntax_checkers/cpp/oclint.vim @@ -16,10 +16,10 @@ " " let g:syntastic_oclint_config_file = '.config' -if exists("loaded_oclint_syntax_checker") +if exists("g:loaded_syntastic_cpp_oclint_checker") finish endif -let loaded_oclint_syntax_checker = 1 +let g:loaded_syntastic_cpp_oclint_checker = 1 function! SyntaxCheckers_cpp_oclint_IsAvailable() return executable("oclint") @@ -37,15 +37,23 @@ function! SyntaxCheckers_cpp_oclint_GetLocList() \ 'subchecker': 'oclint' }) let errorformat = - \ '%f:%l:%c:\ %m,' . + \ '%W%f:%l:%c: %m,' . + \ '%E%f:%l:%c: error: %m,' . \ '%-G%.%#' - return SyntasticMake({ + let loclist = SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, \ 'subtype': 'Style', - \ 'postprocess': ['compressWhitespace'], - \ 'defaults': {'type': 'W'} }) + \ 'postprocess': ['compressWhitespace', 'sort'] }) + + for n in range(len(loclist)) + if loclist[n]['text'] =~# ' P[12] \=$' + let loclist[n]['type'] = 'E' + endif + endfor + + return loclist endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/syntax_checkers/objc/oclint.vim b/syntax_checkers/objc/oclint.vim new file mode 100644 index 000000000..4441b2a52 --- /dev/null +++ b/syntax_checkers/objc/oclint.vim @@ -0,0 +1,61 @@ +"============================================================================ +"File: oclint.vim +"Description: Syntax checking plugin for syntastic.vim +"Maintainer: "UnCO" Lin +"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. +"============================================================================ +" +" The setting 'g:syntastic_oclint_config_file' allows you to define a file +" that contains additional compiler arguments like include directories or +" CFLAGS. The file is expected to contain one option per line. If none is +" given the filename defaults to '.syntastic_oclint_config': +" +" let g:syntastic_oclint_config_file = '.config' + +if exists("g:loaded_syntastic_objc_oclint_checker") + finish +endif +let g:loaded_syntastic_objc_oclint_checker = 1 + +function! SyntaxCheckers_objc_oclint_IsAvailable() + return executable("oclint") +endfunction + +if !exists('g:syntastic_oclint_config_file') + let g:syntastic_oclint_config_file = '.syntastic_oclint_config' +endif + +function! SyntaxCheckers_objc_oclint_GetLocList() + let makeprg = syntastic#makeprg#build({ + \ 'exe': 'oclint', + \ 'args': '-text', + \ 'post_args': '-- -c' . syntastic#c#ReadConfig(g:syntastic_oclint_config_file), + \ 'subchecker': 'oclint' }) + + let errorformat = + \ '%W%f:%l:%c: %m,' . + \ '%E%f:%l:%c: error: %m,' . + \ '%-G%.%#' + + let loclist = SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'subtype': 'Style', + \ 'postprocess': ['compressWhitespace', 'sort'] }) + + for n in range(len(loclist)) + if loclist[n]['text'] =~# ' P[12] \=$' + let loclist[n]['type'] = 'E' + endif + endfor + + return loclist +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'objc', + \ 'name': 'oclint'}) From 56e47bfc9de3875525393fd9852574e523f20179 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Wed, 29 May 2013 14:50:29 +0300 Subject: [PATCH 0014/1271] Uniform naming for load guards. --- syntax_checkers/c/checkpatch.vim | 6 +++--- syntax_checkers/c/make.vim | 4 ++-- syntax_checkers/c/sparse.vim | 4 ++-- syntax_checkers/c/splint.vim | 4 ++-- syntax_checkers/c/ycm.vim | 4 ++-- syntax_checkers/cpp/ycm.vim | 4 ++-- syntax_checkers/objc/ycm.vim | 4 ++-- syntax_checkers/vala/valac.vim | 5 +++++ syntax_checkers/vhdl/ghdl.vim | 4 ++-- 9 files changed, 22 insertions(+), 17 deletions(-) diff --git a/syntax_checkers/c/checkpatch.vim b/syntax_checkers/c/checkpatch.vim index 90745ef75..15066bac5 100644 --- a/syntax_checkers/c/checkpatch.vim +++ b/syntax_checkers/c/checkpatch.vim @@ -1,6 +1,6 @@ "============================================================================ "File: checkpatch.vim -"Description: Syntax checking plugin for syntastic.vim using checkpatch.pl +"Description: Syntax checking plugin for syntastic.vim using checkpatch.pl "Maintainer: Daniel Walker "License: This program is free software. It comes without any warranty, " to the extent permitted by applicable law. You can redistribute @@ -8,10 +8,10 @@ " Want To Public License, Version 2, as published by Sam Hocevar. " See http://sam.zoy.org/wtfpl/COPYING for more details. "============================================================================ -if exists("loaded_checkpatch_syntax_checker") +if exists("g:loaded_syntastic_c_checkpatch_checker") finish endif -let loaded_checkpatch_syntax_checker = 1 +let g:loaded_syntastic_c_checkpatch_checker = 1 " Bail if the user doesn't have `checkpatch.pl` or ./scripts/checkpatch.pl installed. if executable("checkpatch.pl") diff --git a/syntax_checkers/c/make.vim b/syntax_checkers/c/make.vim index 68557ac7d..a0ccbf616 100644 --- a/syntax_checkers/c/make.vim +++ b/syntax_checkers/c/make.vim @@ -10,10 +10,10 @@ " "============================================================================ -if exists('loaded_make_syntax_checker') +if exists('g:loaded_syntastic_c_make_checker') finish endif -let loaded_make_syntax_checker = 1 +let g:loaded_syntastic_c_make_checker = 1 function SyntaxCheckers_c_make_IsAvailable() return executable('make') diff --git a/syntax_checkers/c/sparse.vim b/syntax_checkers/c/sparse.vim index 5db602413..f4d0013b5 100644 --- a/syntax_checkers/c/sparse.vim +++ b/syntax_checkers/c/sparse.vim @@ -16,10 +16,10 @@ " " let g:syntastic_sparse_config_file = '.config' -if exists("loaded_sparse_syntax_checker") +if exists("g:loaded_syntastic_c_sparse_checker") finish endif -let loaded_sparse_syntax_checker = 1 +let g:loaded_syntastic_c_sparse_checker = 1 function! SyntaxCheckers_c_sparse_IsAvailable() return executable("sparse") diff --git a/syntax_checkers/c/splint.vim b/syntax_checkers/c/splint.vim index e71349e0c..3fa92a7a5 100644 --- a/syntax_checkers/c/splint.vim +++ b/syntax_checkers/c/splint.vim @@ -16,10 +16,10 @@ " " let g:syntastic_splint_config_file = '.config' -if exists("loaded_splint_syntax_checker") +if exists("g:loaded_syntastic_c_splint_checker") finish endif -let loaded_splint_syntax_checker = 1 +let g:loaded_syntastic_c_splint_checker = 1 function! SyntaxCheckers_c_splint_IsAvailable() return executable("splint") diff --git a/syntax_checkers/c/ycm.vim b/syntax_checkers/c/ycm.vim index bc35b7cfb..5cce6fc56 100644 --- a/syntax_checkers/c/ycm.vim +++ b/syntax_checkers/c/ycm.vim @@ -10,10 +10,10 @@ " "============================================================================ -if exists("loaded_ycm_c_syntax_checker") +if exists("g:loaded_syntastic_c_ycm_checker") finish endif -let loaded_ycm_c_syntax_checker = 1 +let g:loaded_syntastic_c_ycm_checker = 1 function! SyntaxCheckers_c_ycm_IsAvailable() return exists('g:loaded_youcompleteme') diff --git a/syntax_checkers/cpp/ycm.vim b/syntax_checkers/cpp/ycm.vim index 97827a081..f7c19e955 100644 --- a/syntax_checkers/cpp/ycm.vim +++ b/syntax_checkers/cpp/ycm.vim @@ -10,10 +10,10 @@ " "============================================================================ -if exists("loaded_ycm_cpp_syntax_checker") +if exists("g:loaded_syntastic_cpp_ycm_checker") finish endif -let loaded_ycm_cpp_syntax_checker = 1 +let g:loaded_syntastic_cpp_ycm_checker = 1 runtime syntax_checkers/c/ycm.vim diff --git a/syntax_checkers/objc/ycm.vim b/syntax_checkers/objc/ycm.vim index 1406dd83a..a2250a3c5 100644 --- a/syntax_checkers/objc/ycm.vim +++ b/syntax_checkers/objc/ycm.vim @@ -10,10 +10,10 @@ " "============================================================================ -if exists("loaded_ycm_objc_syntax_checker") +if exists("g:loaded_syntastic_objc_ycm_checker") finish endif -let loaded_ycm_objc_syntax_checker = 1 +let g:loaded_syntastic_objc_ycm_checker = 1 runtime syntax_checkers/c/ycm.vim diff --git a/syntax_checkers/vala/valac.vim b/syntax_checkers/vala/valac.vim index a74572356..b4ede28ad 100644 --- a/syntax_checkers/vala/valac.vim +++ b/syntax_checkers/vala/valac.vim @@ -22,6 +22,11 @@ " "============================================================================ +if exists("g:loaded_syntastic_vala_valac_checker") + finish +endif +let g:loaded_syntastic_vala_valac_checker = 1 + function! SyntaxCheckers_vala_valac_IsAvailable() return executable('valac') endfunction diff --git a/syntax_checkers/vhdl/ghdl.vim b/syntax_checkers/vhdl/ghdl.vim index 57faa9dea..4c7a39f75 100644 --- a/syntax_checkers/vhdl/ghdl.vim +++ b/syntax_checkers/vhdl/ghdl.vim @@ -9,10 +9,10 @@ " See http://sam.zoy.org/wtfpl/COPYING for more details. " "============================================================================ -if exists("loaded_vhdl_ghdl_syntax_checker") +if exists("g:loaded_syntastic_vhdl_ghdl_checker") finish endif -let loaded_vhdl_ghdl_syntax_checker = 1 +let g:loaded_syntastic_vhdl_ghdl_checker = 1 function! SyntaxCheckers_vhdl_ghdl_IsAvailable() return executable("ghdl") From d4a3d4bfc9fad45af0090948de710370e117d3b7 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Wed, 29 May 2013 14:57:29 +0300 Subject: [PATCH 0015/1271] Remove duplicated code. --- syntax_checkers/cpp/oclint.vim | 33 ++++----------------------------- syntax_checkers/objc/oclint.vim | 33 ++++----------------------------- 2 files changed, 8 insertions(+), 58 deletions(-) diff --git a/syntax_checkers/cpp/oclint.vim b/syntax_checkers/cpp/oclint.vim index b3edbfbc2..1586d8350 100644 --- a/syntax_checkers/cpp/oclint.vim +++ b/syntax_checkers/cpp/oclint.vim @@ -21,39 +21,14 @@ if exists("g:loaded_syntastic_cpp_oclint_checker") endif let g:loaded_syntastic_cpp_oclint_checker = 1 +runtime syntax_checkers/c/oclint.vim + function! SyntaxCheckers_cpp_oclint_IsAvailable() - return executable("oclint") + return SyntaxCheckers_c_oclint_IsAvailable() endfunction -if !exists('g:syntastic_oclint_config_file') - let g:syntastic_oclint_config_file = '.syntastic_oclint_config' -endif - function! SyntaxCheckers_cpp_oclint_GetLocList() - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'oclint', - \ 'args': '-text', - \ 'post_args': '-- -c' . syntastic#c#ReadConfig(g:syntastic_oclint_config_file), - \ 'subchecker': 'oclint' }) - - let errorformat = - \ '%W%f:%l:%c: %m,' . - \ '%E%f:%l:%c: error: %m,' . - \ '%-G%.%#' - - let loclist = SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat, - \ 'subtype': 'Style', - \ 'postprocess': ['compressWhitespace', 'sort'] }) - - for n in range(len(loclist)) - if loclist[n]['text'] =~# ' P[12] \=$' - let loclist[n]['type'] = 'E' - endif - endfor - - return loclist + return SyntaxCheckers_c_oclint_GetLocList() endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/syntax_checkers/objc/oclint.vim b/syntax_checkers/objc/oclint.vim index 4441b2a52..59a3996b0 100644 --- a/syntax_checkers/objc/oclint.vim +++ b/syntax_checkers/objc/oclint.vim @@ -21,39 +21,14 @@ if exists("g:loaded_syntastic_objc_oclint_checker") endif let g:loaded_syntastic_objc_oclint_checker = 1 +runtime syntax_checkers/c/oclint.vim + function! SyntaxCheckers_objc_oclint_IsAvailable() - return executable("oclint") + return SyntaxCheckers_c_oclint_IsAvailable() endfunction -if !exists('g:syntastic_oclint_config_file') - let g:syntastic_oclint_config_file = '.syntastic_oclint_config' -endif - function! SyntaxCheckers_objc_oclint_GetLocList() - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'oclint', - \ 'args': '-text', - \ 'post_args': '-- -c' . syntastic#c#ReadConfig(g:syntastic_oclint_config_file), - \ 'subchecker': 'oclint' }) - - let errorformat = - \ '%W%f:%l:%c: %m,' . - \ '%E%f:%l:%c: error: %m,' . - \ '%-G%.%#' - - let loclist = SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat, - \ 'subtype': 'Style', - \ 'postprocess': ['compressWhitespace', 'sort'] }) - - for n in range(len(loclist)) - if loclist[n]['text'] =~# ' P[12] \=$' - let loclist[n]['type'] = 'E' - endif - endfor - - return loclist + return SyntaxCheckers_c_oclint_GetLocList() endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ From 2bf959f33149ac66c816cb14c771ca53d48a5d8e Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Wed, 29 May 2013 18:03:14 +0300 Subject: [PATCH 0016/1271] New checker: text/atdtool. --- syntax_checkers/text/atdtool.vim | 50 ++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 syntax_checkers/text/atdtool.vim diff --git a/syntax_checkers/text/atdtool.vim b/syntax_checkers/text/atdtool.vim new file mode 100644 index 000000000..0a687b2a5 --- /dev/null +++ b/syntax_checkers/text/atdtool.vim @@ -0,0 +1,50 @@ +"============================================================================ +"File: atdtool.vim +"Description: Syntax checking plugin for syntastic.vim +"Maintainer: LCD 47 +"License: This program is free software. It comes without any warranty, +" to the extent permitted by applicable law. You can redistribute +" it and/or modify it under the terms of the Do What The Fuck You +" Want To Public License, Version 2, as published by Sam Hocevar. +" See http://sam.zoy.org/wtfpl/COPYING for more details. +" +"============================================================================ + +if exists("g:loaded_syntastic_text_atdtool_checker") + finish +endif +let g:loaded_syntastic_text_atdtool_checker = 1 + +function! SyntaxCheckers_text_atdtool_IsAvailable() + return executable('atdtool') +endfunction + +function! SyntaxCheckers_text_atdtool_GetHighlightRegex(item) + return matchstr(a:item['text'], '\m "\zs[^"]\+\ze"\($\| | suggestions:\)') +endfunction + +function! SyntaxCheckers_text_atdtool_GetLocList() + let makeprg = syntastic#makeprg#build({ + \ 'exe': 'atdtool', + \ 'tail': '2>/dev/null', + \ 'subchecker': 'atdtool' }) + + let errorformat = + \ '%W%f:%l:%c: %m,'. + \ '%+C suggestions:%.%#' + + let loclist = SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'subtype': 'Style' }) + + for n in range(len(loclist)) + let loclist[n]['text'] = substitute(loclist[n]['text'], '\n\s\+', ' | ', 'g') + endfor + + return loclist +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'text', + \ 'name': 'atdtool'}) From b9fc278c1b1d8aaa463d2e81cec098b101b14b83 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Thu, 30 May 2013 13:01:37 +0300 Subject: [PATCH 0017/1271] Better handling of errorformat for OClint. --- syntax_checkers/c/oclint.vim | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/syntax_checkers/c/oclint.vim b/syntax_checkers/c/oclint.vim index 32cdd57ab..96687e610 100644 --- a/syntax_checkers/c/oclint.vim +++ b/syntax_checkers/c/oclint.vim @@ -37,23 +37,18 @@ function! SyntaxCheckers_c_oclint_GetLocList() \ 'subchecker': 'oclint' }) let errorformat = - \ '%W%f:%l:%c: %m,' . + \ '%E%f:%l:%c: %m P1 ,' . + \ '%E%f:%l:%c: %m P2 ,' . + \ '%W%f:%l:%c: %m P3 ,' . \ '%E%f:%l:%c: error: %m,' . + \ '%W%f:%l:%c: warning: %m,' . \ '%-G%.%#' - let loclist = SyntasticMake({ + return SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, \ 'subtype': 'Style', \ 'postprocess': ['compressWhitespace', 'sort'] }) - - for n in range(len(loclist)) - if loclist[n]['text'] =~# ' P[12] \=$' - let loclist[n]['type'] = 'E' - endif - endfor - - return loclist endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ From 39eb0dedf0e87f160571d9b7ec153a2931bf800a Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Thu, 30 May 2013 18:40:37 +0300 Subject: [PATCH 0018/1271] More errorformar adjustments for OClint. --- syntax_checkers/c/oclint.vim | 1 + 1 file changed, 1 insertion(+) diff --git a/syntax_checkers/c/oclint.vim b/syntax_checkers/c/oclint.vim index 96687e610..f51c5494c 100644 --- a/syntax_checkers/c/oclint.vim +++ b/syntax_checkers/c/oclint.vim @@ -40,6 +40,7 @@ function! SyntaxCheckers_c_oclint_GetLocList() \ '%E%f:%l:%c: %m P1 ,' . \ '%E%f:%l:%c: %m P2 ,' . \ '%W%f:%l:%c: %m P3 ,' . + \ '%E%f:%l:%c: fatal error: %m,' . \ '%E%f:%l:%c: error: %m,' . \ '%W%f:%l:%c: warning: %m,' . \ '%-G%.%#' From cef31c0d7d1b7da83e4ba80fc4e51e6e84036c44 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Thu, 30 May 2013 18:55:39 +0300 Subject: [PATCH 0019/1271] Added checkers for Objective-C++ (mostly cloned from Objective-C). --- syntax_checkers/objcpp/gcc.vim | 184 ++++++++++++++++++++++++++++++ syntax_checkers/objcpp/oclint.vim | 36 ++++++ syntax_checkers/objcpp/ycm.vim | 34 ++++++ 3 files changed, 254 insertions(+) create mode 100644 syntax_checkers/objcpp/gcc.vim create mode 100644 syntax_checkers/objcpp/oclint.vim create mode 100644 syntax_checkers/objcpp/ycm.vim diff --git a/syntax_checkers/objcpp/gcc.vim b/syntax_checkers/objcpp/gcc.vim new file mode 100644 index 000000000..8d8a2ebd1 --- /dev/null +++ b/syntax_checkers/objcpp/gcc.vim @@ -0,0 +1,184 @@ +"============================================================================ +"File: objcpp.vim +"Description: Syntax checking plugin for syntastic.vim +"Maintainer: Gregor Uhlenheuer +"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. +" +"============================================================================ + +" In order to also check header files add this to your .vimrc: +" (this usually creates a .gch file in your source directory) +" +" let g:syntastic_objcpp_check_header = 1 +" +" To disable the search of included header files after special +" libraries like gtk and glib add this line to your .vimrc: +" +" let g:syntastic_objcpp_no_include_search = 1 +" +" To disable the include of the default include dirs (such as /usr/include) +" add this line to your .vimrc: +" +" let g:syntastic_objcpp_no_default_include_dirs = 1 +" +" To enable header files being re-checked on every file write add the +" following line to your .vimrc. Otherwise the header files are checked only +" one time on initially loading the file. +" In order to force syntastic to refresh the header includes simply +" unlet b:syntastic_objcpp_includes. Then the header files are being re-checked on +" the next file write. +" +" let g:syntastic_objcpp_auto_refresh_includes = 1 +" +" Alternatively you can set the buffer local variable b:syntastic_objcpp_cflags. +" If this variable is set for the current buffer no search for additional +" libraries is done. I.e. set the variable like this: +" +" let b:syntastic_objcpp_cflags = ' -I/usr/include/libsoup-2.4' +" +" In order to add some custom include directories that should be added to the +" gcc command line you can add those to the global variable +" g:syntastic_objcpp_include_dirs. This list can be used like this: +" +" let g:syntastic_objcpp_include_dirs = [ 'includes', 'headers' ] +" +" Moreover it is possible to add additional compiler options to the syntax +" checking execution via the variable 'g:syntastic_objcpp_compiler_options': +" +" let g:syntastic_objcpp_compiler_options = ' -ansi' +" +" Additionally the setting 'g:syntastic_objcpp_config_file' allows you to define a +" file that contains additional compiler arguments like include directories or +" CFLAGS. The file is expected to contain one option per line. If none is +" given the filename defaults to '.syntastic_objcpp_config': +" +" let g:syntastic_objcpp_config_file = '.config' +" +" Using the global variable 'g:syntastic_objcpp_remove_include_errors' you can +" specify whether errors of files included via the g:syntastic_objcpp_include_dirs' +" setting are removed from the result set: +" +" let g:syntastic_objcpp_remove_include_errors = 1 +" +" Use the variable 'g:syntastic_objcpp_errorformat' to override the default error +" format: +" +" let g:syntastic_objcpp_errorformat = '%f:%l:%c: %trror: %m' +" +" Set your compiler executable with e.g. (defaults to gcc) +" +" let g:syntastic_objcpp_compiler = 'clang' + +if exists('g:loaded_syntastic_objcpp_gcc_checker') + finish +endif +let g:loaded_syntastic_objcpp_gcc_checker = 1 + +if !exists('g:syntastic_objcpp_compiler') + let g:syntastic_objcpp_compiler = 'gcc' +endif + +function! SyntaxCheckers_objcpp_gcc_IsAvailable() + return executable(g:syntastic_objcpp_compiler) +endfunction + +let s:save_cpo = &cpo +set cpo&vim + +if !exists('g:syntastic_objcpp_compiler_options') + let g:syntastic_objcpp_compiler_options = '-std=gnu99' +endif + +if !exists('g:syntastic_objcpp_config_file') + let g:syntastic_objcpp_config_file = '.syntastic_objcpp_config' +endif + +function! SyntaxCheckers_objcpp_gcc_GetLocList() + let makeprg = g:syntastic_objcpp_compiler . ' -x objective-c++ -fsyntax-only -lobjc' + let errorformat = + \ '%-G%f:%s:,' . + \ '%-G%f:%l: %#error: %#(Each undeclared identifier is reported only%.%#,' . + \ '%-G%f:%l: %#error: %#for each function it appears%.%#,' . + \ '%-GIn file included%.%#,'. + \ '%-G %#from %f:%l\,,' . + \ '%f:%l:%c: %trror: %m,' . + \ '%f:%l:%c: %tarning: %m,' . + \ '%f:%l:%c: %m,' . + \ '%f:%l: %trror: %m,' . + \ '%f:%l: %tarning: %m,' . + \ '%f:%l: %m' + + if exists('g:syntastic_objcpp_errorformat') + let errorformat = g:syntastic_objcpp_errorformat + endif + + " add optional user-defined compiler options + let makeprg .= g:syntastic_objcpp_compiler_options + + let makeprg .= ' ' . shellescape(expand('%')) . + \ ' ' . syntastic#c#GetIncludeDirs('objcpp') + + " determine whether to parse header files as well + if expand('%') =~? '\.h$' + if exists('g:syntastic_objcpp_check_header') + let makeprg = g:syntastic_objcpp_compiler . + \ ' -x objective-c++-header ' . + \ ' -c ' . shellescape(expand('%')) . + \ ' ' . g:syntastic_objcpp_compiler_options . + \ ' ' . syntastic#c#GetIncludeDirs('objcpp') + else + return [] + endif + endif + + " check if the user manually set some cflags + if !exists('b:syntastic_objcpp_cflags') + " check whether to search for include files at all + if !exists('g:syntastic_objcpp_no_include_search') || + \ g:syntastic_objcpp_no_include_search != 1 + " refresh the include file search if desired + if exists('g:syntastic_objcpp_auto_refresh_includes') && + \ g:syntastic_objcpp_auto_refresh_includes != 0 + let makeprg .= syntastic#c#SearchHeaders() + else + " search for header includes if not cached already + if !exists('b:syntastic_objcpp_includes') + let b:syntastic_objcpp_includes = syntastic#c#SearchHeaders() + endif + let makeprg .= b:syntastic_objcpp_includes + endif + endif + else + " use the user-defined cflags + let makeprg .= b:syntastic_objcpp_cflags + endif + + " add optional config file parameters + let makeprg .= ' ' . syntastic#c#ReadConfig(g:syntastic_objcpp_config_file) + + " process makeprg + let errors = SyntasticMake({ 'makeprg': makeprg, + \ 'errorformat': errorformat }) + + " filter the processed errors if desired + if exists('g:syntastic_objcpp_remove_include_errors') && + \ g:syntastic_objcpp_remove_include_errors != 0 + return filter(errors, + \ 'has_key(v:val, "bufnr") && v:val["bufnr"]=='.bufnr('')) + else + return errors + endif +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'objcpp', + \ 'name': 'gcc'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/objcpp/oclint.vim b/syntax_checkers/objcpp/oclint.vim new file mode 100644 index 000000000..9a02abb76 --- /dev/null +++ b/syntax_checkers/objcpp/oclint.vim @@ -0,0 +1,36 @@ +"============================================================================ +"File: oclint.vim +"Description: Syntax checking plugin for syntastic.vim +"Maintainer: "UnCO" Lin +"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. +"============================================================================ +" +" The setting 'g:syntastic_oclint_config_file' allows you to define a file +" that contains additional compiler arguments like include directories or +" CFLAGS. The file is expected to contain one option per line. If none is +" given the filename defaults to '.syntastic_oclint_config': +" +" let g:syntastic_oclint_config_file = '.config' + +if exists("g:loaded_syntastic_objcpp_oclint_checker") + finish +endif +let g:loaded_syntastic_objcpp_oclint_checker = 1 + +runtime syntax_checkers/c/oclint.vim + +function! SyntaxCheckers_objcpp_oclint_IsAvailable() + return SyntaxCheckers_c_oclint_IsAvailable() +endfunction + +function! SyntaxCheckers_objcpp_oclint_GetLocList() + return SyntaxCheckers_c_oclint_GetLocList() +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'objcpp', + \ 'name': 'oclint'}) diff --git a/syntax_checkers/objcpp/ycm.vim b/syntax_checkers/objcpp/ycm.vim new file mode 100644 index 000000000..14f73517d --- /dev/null +++ b/syntax_checkers/objcpp/ycm.vim @@ -0,0 +1,34 @@ +"============================================================================ +"File: ycm.vim +"Description: Syntax checking plugin for syntastic.vim +"Maintainer: Val Markovic +"License: This program is free software. It comes without any warranty, +" to the extent permitted by applicable law. You can redistribute +" it and/or modify it under the terms of the Do What The Fuck You +" Want To Public License, Version 2, as published by Sam Hocevar. +" See http://sam.zoy.org/wtfpl/COPYING for more details. +" +"============================================================================ + +if exists("g:loaded_syntastic_objcpp_ycm_checker") + finish +endif +let g:loaded_syntastic_objcpp_ycm_checker = 1 + +runtime syntax_checkers/c/ycm.vim + +function! SyntaxCheckers_objcpp_ycm_IsAvailable() + return SyntaxCheckers_c_ycm_IsAvailable() +endfunction + +if !exists('g:loaded_youcompleteme') + finish +endif + +function! SyntaxCheckers_objcpp_ycm_GetLocList() + return SyntaxCheckers_c_ycm_GetLocList() +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'objcpp', + \ 'name': 'ycm'}) From 31001b10e678eee5278068c6ff5aa61c18ba188b Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Thu, 30 May 2013 19:08:12 +0300 Subject: [PATCH 0020/1271] Minor fixes. --- README.markdown | 9 +++++---- plugin/syntastic/registry.vim | 4 ++++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/README.markdown b/README.markdown index 1daa1696a..fb8423ef6 100644 --- a/README.markdown +++ b/README.markdown @@ -29,10 +29,11 @@ At the time of this writing, syntax checking plugins exist for Ada, AppleScript, Bourne shell, C, C++, C#, CoffeeScript, Coco, Coq, CSS, Cucumber, CUDA, D, Dart, DocBook, Elixir, Erlang, eRuby, Fortran, Gentoo metadata, Go, Haml, Haskell, Haxe, HTML, Java, JavaScript, JSON, LESS, -LISP, LLVM intermediate language, Lua, MATLAB, NASM, Objective-C, OCaml, -Perl, Perl POD, PHP, Puppet, Python, reStructuredText, Ruby, Rust, -SASS/SCSS, Scala, Slim, Tcl, TeX, Twig, TypeScript, Vala, VHDL, xHtml, -XML, XSLT, YAML, z80, Zope page templates, zsh. +LISP, LLVM intermediate language, Lua, MATLAB, NASM, Objective-C, +Objective-C++, OCaml, Perl, Perl POD, PHP, Puppet, Python, +reStructuredText, Ruby, Rust, SASS/SCSS, Scala, Slim, Tcl, TeX, Twig, +TypeScript, Vala, VHDL, xHtml, XML, XSLT, YAML, z80, Zope page +templates, zsh. ## Screenshot diff --git a/plugin/syntastic/registry.vim b/plugin/syntastic/registry.vim index 5fc01b650..07495f08f 100644 --- a/plugin/syntastic/registry.vim +++ b/plugin/syntastic/registry.vim @@ -9,7 +9,11 @@ let s:defaultCheckers = { \ 'cpp': ['gcc'], \ 'html': ['tidy'], \ 'java': ['javac'], + \ 'javascript': ['jshint', 'jslint'], \ 'objc': ['gcc'], + \ 'objcpp': ['gcc'], + \ 'perl': ['perl'], + \ 'python': ['python', 'flake8', 'pylint'], \ 'php': ['php', 'phpcs', 'phpmd'], \ 'ruby': ['mri'] \ } From d546fef4b00c4ca2dfdea380d227202207cf416a Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Thu, 30 May 2013 19:44:12 +0300 Subject: [PATCH 0021/1271] Moved syntastic#gcc#GetLocList() to autoload/syntastic/c.vim. --- autoload/syntastic/c.vim | 64 ++++++++++++++++++++++++++++ autoload/syntastic/gcc.vim | 76 ---------------------------------- syntax_checkers/ada/gcc.vim | 2 +- syntax_checkers/c/gcc.vim | 2 +- syntax_checkers/c/oclint.vim | 2 +- syntax_checkers/cpp/gcc.vim | 2 +- syntax_checkers/d/dmd.vim | 2 +- syntax_checkers/objc/gcc.vim | 2 +- syntax_checkers/objcpp/gcc.vim | 2 +- 9 files changed, 71 insertions(+), 83 deletions(-) delete mode 100644 autoload/syntastic/gcc.vim diff --git a/autoload/syntastic/c.vim b/autoload/syntastic/c.vim index 06ce8ac11..ec0537d3e 100644 --- a/autoload/syntastic/c.vim +++ b/autoload/syntastic/c.vim @@ -122,6 +122,70 @@ function! syntastic#c#SearchHeaders() return includes endfunction +" GetLocList() for C-like compilers +function! syntastic#c#GetLocList(filetype, options) + let ft = a:filetype + let errorformat = exists('g:syntastic_' . ft . '_errorformat') ? + \ g:syntastic_{ft}_errorformat : a:options['errorformat'] + + " determine whether to parse header files as well + if expand('%') =~? a:options['headers_pattern'] + if exists('g:syntastic_' . ft . '_check_header') && g:syntastic_{ft}_check_header + let makeprg = + \ g:syntastic_{ft}_compiler . + \ ' ' . get(a:options, 'makeprg_headers', '') . + \ ' ' . g:syntastic_{ft}_compiler_options . + \ ' ' . syntastic#c#GetIncludeDirs(ft) . + \ ' ' . syntastic#c#NullOutput(ft) . + \ ' -c ' . shellescape(expand('%')) + else + return [] + endif + else + let makeprg = + \ g:syntastic_{ft}_compiler . + \ ' ' . get(a:options, 'makeprg_main', '') . + \ ' ' . g:syntastic_{ft}_compiler_options . + \ ' ' . syntastic#c#GetIncludeDirs(ft) . + \ ' ' . shellescape(expand('%')) + endif + + " check if the user manually set some cflags + if !exists('b:syntastic_' . ft . '_cflags') + " check whether to search for include files at all + if !exists('g:syntastic_' . ft . '_no_include_search') || !g:syntastic_{ft}_no_include_search + if ft ==# 'c' || ft ==# 'cpp' + " refresh the include file search if desired + if exists('g:syntastic_' . ft . '_auto_refresh_includes') && g:syntastic_{ft}_auto_refresh_includes + let makeprg .= ' ' . syntastic#c#SearchHeaders() + else + " search for header includes if not cached already + if !exists('b:syntastic_' . ft . '_includes') + let b:syntastic_{ft}_includes = syntastic#c#SearchHeaders() + endif + let makeprg .= ' ' . b:syntastic_{ft}_includes + endif + endif + endif + else + " use the user-defined cflags + let makeprg .= ' ' . b:syntastic_{ft}_cflags + endif + + " add optional config file parameters + let makeprg .= ' ' . syntastic#c#ReadConfig(g:syntastic_{ft}_config_file) + + " process makeprg + let errors = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) + + " filter the processed errors if desired + if exists('g:syntastic_' . ft . '_remove_include_errors') && g:syntastic_{ft}_remove_include_errors + call filter(errors, 'get(v:val, "bufnr") == ' . bufnr('')) + endif + + return errors +endfunction + " Private functions {{{1 " initialize c/cpp syntax checker handlers diff --git a/autoload/syntastic/gcc.vim b/autoload/syntastic/gcc.vim deleted file mode 100644 index c0fe109f0..000000000 --- a/autoload/syntastic/gcc.vim +++ /dev/null @@ -1,76 +0,0 @@ -if exists("g:loaded_syntastic_gcc_autoload") - finish -endif -let g:loaded_syntastic_gcc_autoload = 1 - -let s:save_cpo = &cpo -set cpo&vim - - -function! syntastic#gcc#GetLocList(filetype, options) - let ft = a:filetype - let errorformat = exists('g:syntastic_' . ft . '_errorformat') ? - \ g:syntastic_{ft}_errorformat : a:options['errorformat'] - - " determine whether to parse header files as well - if expand('%') =~? a:options['headers_pattern'] - if exists('g:syntastic_' . ft . '_check_header') && g:syntastic_{ft}_check_header - let makeprg = - \ g:syntastic_{ft}_compiler . - \ ' ' . get(a:options, 'makeprg_headers', '') . - \ ' ' . g:syntastic_{ft}_compiler_options . - \ ' ' . syntastic#c#GetIncludeDirs(ft) . - \ ' ' . syntastic#c#NullOutput(ft) . - \ ' -c ' . shellescape(expand('%')) - else - return [] - endif - else - let makeprg = - \ g:syntastic_{ft}_compiler . - \ ' ' . get(a:options, 'makeprg_main', '') . - \ ' ' . g:syntastic_{ft}_compiler_options . - \ ' ' . syntastic#c#GetIncludeDirs(ft) . - \ ' ' . shellescape(expand('%')) - endif - - " check if the user manually set some cflags - if !exists('b:syntastic_' . ft . '_cflags') - " check whether to search for include files at all - if !exists('g:syntastic_' . ft . '_no_include_search') || !g:syntastic_{ft}_no_include_search - if ft ==# 'c' || ft ==# 'cpp' - " refresh the include file search if desired - if exists('g:syntastic_' . ft . '_auto_refresh_includes') && g:syntastic_{ft}_auto_refresh_includes - let makeprg .= ' ' . syntastic#c#SearchHeaders() - else - " search for header includes if not cached already - if !exists('b:syntastic_' . ft . '_includes') - let b:syntastic_{ft}_includes = syntastic#c#SearchHeaders() - endif - let makeprg .= ' ' . b:syntastic_{ft}_includes - endif - endif - endif - else - " use the user-defined cflags - let makeprg .= ' ' . b:syntastic_{ft}_cflags - endif - - " add optional config file parameters - let makeprg .= ' ' . syntastic#c#ReadConfig(g:syntastic_{ft}_config_file) - - " process makeprg - let errors = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) - - " filter the processed errors if desired - if exists('g:syntastic_' . ft . '_remove_include_errors') && g:syntastic_{ft}_remove_include_errors - call filter(errors, 'get(v:val, "bufnr") == ' . bufnr('')) - endif - - return errors -endfunction - -let &cpo = s:save_cpo -unlet s:save_cpo - -" vim: set et sts=4 sw=4 fdm=marker: diff --git a/syntax_checkers/ada/gcc.vim b/syntax_checkers/ada/gcc.vim index e9fd965f8..7a11f7c5c 100644 --- a/syntax_checkers/ada/gcc.vim +++ b/syntax_checkers/ada/gcc.vim @@ -32,7 +32,7 @@ if !exists('g:syntastic_ada_config_file') endif function! SyntaxCheckers_ada_gcc_GetLocList() - return syntastic#gcc#GetLocList('ada', { + return syntastic#c#GetLocList('ada', { \ 'errorformat': \ '%-G%f:%s:,' . \ '%f:%l:%c: %m,' . diff --git a/syntax_checkers/c/gcc.vim b/syntax_checkers/c/gcc.vim index 0d4885bdd..4dc1bfe71 100644 --- a/syntax_checkers/c/gcc.vim +++ b/syntax_checkers/c/gcc.vim @@ -36,7 +36,7 @@ if !exists('g:syntastic_c_config_file') endif function! SyntaxCheckers_c_gcc_GetLocList() - return syntastic#gcc#GetLocList('c', { + return syntastic#c#GetLocList('c', { \ 'errorformat': \ '%-G%f:%s:,' . \ '%-G%f:%l: %#error: %#(Each undeclared identifier is reported only%.%#,' . diff --git a/syntax_checkers/c/oclint.vim b/syntax_checkers/c/oclint.vim index f51c5494c..8944b75e5 100644 --- a/syntax_checkers/c/oclint.vim +++ b/syntax_checkers/c/oclint.vim @@ -33,7 +33,7 @@ function! SyntaxCheckers_c_oclint_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'oclint', \ 'args': '-text', - \ 'post_args': '-- -c' . syntastic#c#ReadConfig(g:syntastic_oclint_config_file), + \ 'post_args': '-- -c ' . syntastic#c#ReadConfig(g:syntastic_oclint_config_file), \ 'subchecker': 'oclint' }) let errorformat = diff --git a/syntax_checkers/cpp/gcc.vim b/syntax_checkers/cpp/gcc.vim index 7f7e44c52..c9b4f1b73 100644 --- a/syntax_checkers/cpp/gcc.vim +++ b/syntax_checkers/cpp/gcc.vim @@ -35,7 +35,7 @@ if !exists('g:syntastic_cpp_config_file') endif function! SyntaxCheckers_cpp_gcc_GetLocList() - return syntastic#gcc#GetLocList('cpp', { + return syntastic#c#GetLocList('cpp', { \ 'errorformat': \ '%-G%f:%s:,' . \ '%f:%l:%c: %trror: %m,' . diff --git a/syntax_checkers/d/dmd.vim b/syntax_checkers/d/dmd.vim index 5c66e7a7c..f69dbb1e8 100644 --- a/syntax_checkers/d/dmd.vim +++ b/syntax_checkers/d/dmd.vim @@ -40,7 +40,7 @@ if !exists('g:syntastic_d_config_file') endif function! SyntaxCheckers_d_dmd_GetLocList() - return syntastic#gcc#GetLocList('d', { + return syntastic#c#GetLocList('d', { \ 'errorformat': \ '%-G%f:%s:,%f(%l): %m,' . \ '%f:%l: %m', diff --git a/syntax_checkers/objc/gcc.vim b/syntax_checkers/objc/gcc.vim index a224b27d7..e59d5c696 100644 --- a/syntax_checkers/objc/gcc.vim +++ b/syntax_checkers/objc/gcc.vim @@ -35,7 +35,7 @@ if !exists('g:syntastic_objc_config_file') endif function! SyntaxCheckers_objc_gcc_GetLocList() - return syntastic#gcc#GetLocList('objc', { + return syntastic#c#GetLocList('objc', { \ 'errorformat': \ '%-G%f:%s:,' . \ '%-G%f:%l: %#error: %#(Each undeclared identifier is reported only%.%#,' . diff --git a/syntax_checkers/objcpp/gcc.vim b/syntax_checkers/objcpp/gcc.vim index 8b6fb70b1..cab7efd4f 100644 --- a/syntax_checkers/objcpp/gcc.vim +++ b/syntax_checkers/objcpp/gcc.vim @@ -35,7 +35,7 @@ if !exists('g:syntastic_objcpp_config_file') endif function! SyntaxCheckers_objcpp_gcc_GetLocList() - return syntastic#gcc#GetLocList('objcpp', { + return syntastic#c#GetLocList('objcpp', { \ 'errorformat': \ '%-G%f:%s:,' . \ '%-G%f:%l: %#error: %#(Each undeclared identifier is reported only%.%#,' . From 7993e61a3306b2ba90554a90cdb963e3c29d7120 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Thu, 30 May 2013 19:45:33 +0300 Subject: [PATCH 0022/1271] Typo in OClint checker. --- syntax_checkers/c/oclint.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntax_checkers/c/oclint.vim b/syntax_checkers/c/oclint.vim index f51c5494c..8944b75e5 100644 --- a/syntax_checkers/c/oclint.vim +++ b/syntax_checkers/c/oclint.vim @@ -33,7 +33,7 @@ function! SyntaxCheckers_c_oclint_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'oclint', \ 'args': '-text', - \ 'post_args': '-- -c' . syntastic#c#ReadConfig(g:syntastic_oclint_config_file), + \ 'post_args': '-- -c ' . syntastic#c#ReadConfig(g:syntastic_oclint_config_file), \ 'subchecker': 'oclint' }) let errorformat = From d7305ad9e6c195f48ccd7bd0ffc77e2009b7c3a0 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 31 May 2013 10:19:52 +0300 Subject: [PATCH 0023/1271] Adds filetype aliases. This allows checking of files with non-standard filetypes. --- doc/syntastic.txt | 9 ++++++ plugin/syntastic.vim | 19 ++++++++---- plugin/syntastic/makeprg_builder.vim | 2 +- plugin/syntastic/registry.vim | 44 ++++++++++++++++------------ 4 files changed, 49 insertions(+), 25 deletions(-) diff --git a/doc/syntastic.txt b/doc/syntastic.txt index 6e005a719..5a43f6bfe 100644 --- a/doc/syntastic.txt +++ b/doc/syntastic.txt @@ -264,6 +264,15 @@ patterns. > let g:syntastic_ignore_files=['^/usr/include/', '\c\.h$'] < + *'syntastic_filetype_map'* +Default: {} +Use this option to map non-standard filetypes to standard ones. Corresponding +checkers are mapped accordingly, which allows syntastic to check files with +non-standard filetypes: > + let g:syntastic_filetype_map = { 'latex': 'tex', + \ 'gentoo-metadata': 'xml' } +< + *'syntastic_mode_map'* Default: { "mode": "active", "active_filetypes": [], diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index a03a5aed0..3e7aba55e 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -52,6 +52,10 @@ if !exists("g:syntastic_ignore_files") let g:syntastic_ignore_files = [] endif +if !exists("g:syntastic_filetype_map") + let g:syntastic_filetype_map = {} +endif + let s:registry = g:SyntasticRegistry.Instance() let s:notifiers = g:SyntasticNotifiers.New() let s:modemap = g:SyntasticModeMap.Instance() @@ -69,7 +73,7 @@ endfunction command! SyntasticToggleMode call s:ToggleMode() command! -nargs=? -complete=custom,s:CompleteCheckerName SyntasticCheck call s:UpdateErrors(0, ) call s:Redraw() command! Errors call s:ShowLocList() -command! SyntasticInfo call s:registry.echoInfoFor(&ft) +command! SyntasticInfo call s:registry.echoInfoFor(&filetype) highlight link SyntasticError SpellBad highlight link SyntasticWarning SpellCap @@ -148,10 +152,7 @@ function! s:ClearCache() endfunction function! s:CurrentFiletypes() - "sub - for _ in filetypes otherwise we cant name syntax checker - "functions legally for filetypes like "gentoo-metadata" - let fts = substitute(&ft, '-', '_', 'g') - return split(fts, '\.') + return split(&filetype, '\.') endfunction "detect and cache all syntax errors in this buffer @@ -386,4 +387,12 @@ function! SyntasticAddToErrors(errors, options) return a:errors endfunction +"resolve filetype aliases, and replace - with _ otherwise we cant name +"syntax checker functions legally for filetypes like "gentoo-metadata" +function! SyntasticNormalizeFiletype(ftalias) + let ft = get(g:syntastic_filetype_map, a:ftalias, a:ftalias) + let ft = substitute(ft, '-', '_', 'g') + return ft +endfunction + " vim: set et sts=4 sw=4: diff --git a/plugin/syntastic/makeprg_builder.vim b/plugin/syntastic/makeprg_builder.vim index 9f6a90f14..cc861e760 100644 --- a/plugin/syntastic/makeprg_builder.vim +++ b/plugin/syntastic/makeprg_builder.vim @@ -57,7 +57,7 @@ function! g:SyntasticMakeprgBuilder._optExists(name) endfunction function! g:SyntasticMakeprgBuilder._optName(name) - let setting = "g:syntastic_" . &ft + let setting = "g:syntastic_" . SyntasticNormalizeFiletype(&filetype) if !empty(self._subchecker) let setting .= '_' . self._subchecker endif diff --git a/plugin/syntastic/registry.vim b/plugin/syntastic/registry.vim index 07495f08f..b026fc338 100644 --- a/plugin/syntastic/registry.vim +++ b/plugin/syntastic/registry.vim @@ -20,6 +20,10 @@ let s:defaultCheckers = { let g:SyntasticRegistry = {} +" TODO: Handling of filetype aliases: all public methods take aliases as +" parameters, all private methods take normalized filetypes. Public methods +" are thus supposed to normalize filetypes before calling private methods. + " Public methods {{{1 function! g:SyntasticRegistry.Instance() @@ -49,22 +53,23 @@ function! g:SyntasticRegistry.registerChecker(checker) abort call add(self._checkerMap[ft], a:checker) endfunction -function! g:SyntasticRegistry.checkable(filetype) - return !empty(self.getActiveCheckers(a:filetype)) +function! g:SyntasticRegistry.checkable(ftalias) + return !empty(self.getActiveCheckers(a:ftalias)) endfunction -function! g:SyntasticRegistry.getActiveCheckers(filetype) - let checkers = self.availableCheckersFor(a:filetype) +function! g:SyntasticRegistry.getActiveCheckers(ftalias) + let filetype = SyntasticNormalizeFiletype(a:ftalias) + let checkers = self.availableCheckersFor(filetype) - if self._userHasFiletypeSettings(a:filetype) - return self._filterCheckersByUserSettings(checkers, a:filetype) + if self._userHasFiletypeSettings(filetype) + return self._filterCheckersByUserSettings(checkers, filetype) endif - if has_key(s:defaultCheckers, a:filetype) - return self._filterCheckersByDefaultSettings(checkers, a:filetype) + if has_key(s:defaultCheckers, filetype) + return self._filterCheckersByDefaultSettings(checkers, filetype) endif - let checkers = self.availableCheckersFor(a:filetype) + let checkers = self.availableCheckersFor(filetype) if !empty(checkers) return [checkers[0]] @@ -73,13 +78,13 @@ function! g:SyntasticRegistry.getActiveCheckers(filetype) return [] endfunction -function! g:SyntasticRegistry.getActiveCheckerNames(filetype) - let checkers = self.getActiveCheckers(a:filetype) +function! g:SyntasticRegistry.getActiveCheckerNames(ftalias) + let checkers = self.getActiveCheckers(a:ftalias) return join(map(checkers, 'v:val.name()')) endfunction -function! g:SyntasticRegistry.getChecker(filetype, name) - for checker in self.availableCheckersFor(a:filetype) +function! g:SyntasticRegistry.getChecker(ftalias, name) + for checker in self.availableCheckersFor(a:ftalias) if checker.name() == a:name return checker endif @@ -88,18 +93,19 @@ function! g:SyntasticRegistry.getChecker(filetype, name) return {} endfunction -function! g:SyntasticRegistry.availableCheckersFor(filetype) - let checkers = copy(self._allCheckersFor(a:filetype)) +function! g:SyntasticRegistry.availableCheckersFor(ftalias) + let filetype = SyntasticNormalizeFiletype(a:ftalias) + let checkers = copy(self._allCheckersFor(filetype)) return self._filterCheckersByAvailability(checkers) endfunction -function! g:SyntasticRegistry.echoInfoFor(filetype) - echomsg "Syntastic info for filetype: " . a:filetype +function! g:SyntasticRegistry.echoInfoFor(ftalias) + echomsg "Syntastic info for filetype: " . a:ftalias - let available = self.availableCheckersFor(a:filetype) + let available = self.availableCheckersFor(a:ftalias) echomsg "Available checkers: " . join(map(available, "v:val.name()")) - echomsg "Currently active checker(s): " . self.getActiveCheckerNames(a:filetype) + echomsg "Currently active checker(s): " . self.getActiveCheckerNames(a:ftalias) endfunction " Private methods {{{1 From f3877f3e585f835ca6347e47a08f420ce943164b Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 31 May 2013 14:37:51 +0300 Subject: [PATCH 0024/1271] Added some registry defaults. --- plugin/syntastic/registry.vim | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/plugin/syntastic/registry.vim b/plugin/syntastic/registry.vim index 07495f08f..61acf5538 100644 --- a/plugin/syntastic/registry.vim +++ b/plugin/syntastic/registry.vim @@ -4,18 +4,23 @@ endif let g:loaded_syntastic_registry = 1 let s:defaultCheckers = { - \ 'c': ['gcc'], - \ 'coffee': ['coffee', 'coffeelint'], - \ 'cpp': ['gcc'], - \ 'html': ['tidy'], - \ 'java': ['javac'], + \ 'c': ['gcc'], + \ 'coffee': ['coffee', 'coffeelint'], + \ 'cpp': ['gcc'], + \ 'css': ['csslint', 'phpcs'], + \ 'go': ['go'], + \ 'html': ['tidy'], + \ 'java': ['javac'], \ 'javascript': ['jshint', 'jslint'], - \ 'objc': ['gcc'], - \ 'objcpp': ['gcc'], - \ 'perl': ['perl'], - \ 'python': ['python', 'flake8', 'pylint'], - \ 'php': ['php', 'phpcs', 'phpmd'], - \ 'ruby': ['mri'] + \ 'json': ['jsonlint', 'jsonval'], + \ 'objc': ['gcc'], + \ 'objcpp': ['gcc'], + \ 'perl': ['perl', 'perlcritic'], + \ 'php': ['php', 'phpcs', 'phpmd'], + \ 'python': ['python', 'flake8', 'pylint'], + \ 'ruby': ['mri'], + \ 'sh': ['sh'], + \ 'tex': ['lacheck'] \ } let g:SyntasticRegistry = {} From 6123b65d7ac02616a3716c675a61d9d1a7332c0b Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 31 May 2013 19:06:33 +0300 Subject: [PATCH 0025/1271] Bug fix: :SyntasticInfo didn't return information for composite filetypes. --- plugin/syntastic.vim | 2 +- plugin/syntastic/checker.vim | 2 ++ plugin/syntastic/registry.vim | 20 ++++++++++---------- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 3e7aba55e..a4ece2da0 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -73,7 +73,7 @@ endfunction command! SyntasticToggleMode call s:ToggleMode() command! -nargs=? -complete=custom,s:CompleteCheckerName SyntasticCheck call s:UpdateErrors(0, ) call s:Redraw() command! Errors call s:ShowLocList() -command! SyntasticInfo call s:registry.echoInfoFor(&filetype) +command! SyntasticInfo call s:registry.echoInfoFor(s:CurrentFiletypes()) highlight link SyntasticError SpellBad highlight link SyntasticWarning SpellCap diff --git a/plugin/syntastic/checker.vim b/plugin/syntastic/checker.vim index 51dc0c80b..5f4e8fd30 100644 --- a/plugin/syntastic/checker.vim +++ b/plugin/syntastic/checker.vim @@ -53,6 +53,8 @@ function! g:SyntasticChecker.isAvailable() return self._isAvailableFunc() endfunction +" Private methods {{{1 + function! g:SyntasticChecker._populateHighlightRegexes(list) let list = a:list if !empty(self._highlightRegexFunc) diff --git a/plugin/syntastic/registry.vim b/plugin/syntastic/registry.vim index b026fc338..43197c348 100644 --- a/plugin/syntastic/registry.vim +++ b/plugin/syntastic/registry.vim @@ -78,11 +78,6 @@ function! g:SyntasticRegistry.getActiveCheckers(ftalias) return [] endfunction -function! g:SyntasticRegistry.getActiveCheckerNames(ftalias) - let checkers = self.getActiveCheckers(a:ftalias) - return join(map(checkers, 'v:val.name()')) -endfunction - function! g:SyntasticRegistry.getChecker(ftalias, name) for checker in self.availableCheckersFor(a:ftalias) if checker.name() == a:name @@ -99,13 +94,18 @@ function! g:SyntasticRegistry.availableCheckersFor(ftalias) return self._filterCheckersByAvailability(checkers) endfunction -function! g:SyntasticRegistry.echoInfoFor(ftalias) - echomsg "Syntastic info for filetype: " . a:ftalias +function! g:SyntasticRegistry.echoInfoFor(ftalias_list) + echomsg "Syntastic info for filetype: " . join(a:ftalias_list, '.') - let available = self.availableCheckersFor(a:ftalias) - echomsg "Available checkers: " . join(map(available, "v:val.name()")) + let available = [] + let active = [] + for ftalias in a:ftalias_list + call extend(available, self.availableCheckersFor(ftalias)) + call extend(active, self.getActiveCheckers(ftalias)) + endfor - echomsg "Currently active checker(s): " . self.getActiveCheckerNames(a:ftalias) + echomsg "Available checkers: " . join(syntastic#util#unique(map(available, "v:val.name()"))) + echomsg "Currently active checker(s): " . join(syntastic#util#unique(map(active, "v:val.name()"))) endfunction " Private methods {{{1 From f1c6ecc6a991e3d63b887d0516e989db42cbf514 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 31 May 2013 21:05:45 +0300 Subject: [PATCH 0026/1271] Make syntastic#makeprg#build() aware of filetypes. Fixes #667. --- autoload/syntastic/makeprg.vim | 1 + plugin/syntastic.vim | 8 ---- plugin/syntastic/makeprg_builder.vim | 11 ++++- plugin/syntastic/registry.vim | 14 ++++++- syntax_checkers/applescript/osacompile.vim | 7 ++-- syntax_checkers/c/checkpatch.vim | 14 ++++--- syntax_checkers/c/oclint.vim | 1 + syntax_checkers/c/sparse.vim | 14 ++++--- syntax_checkers/c/splint.vim | 1 + syntax_checkers/co/coco.vim | 8 ++-- syntax_checkers/coffee/coffee.vim | 6 ++- syntax_checkers/coffee/coffeelint.vim | 16 +++++--- syntax_checkers/coq/coqtop.vim | 12 ++++-- syntax_checkers/cpp/cpplint.vim | 12 ++++-- syntax_checkers/cs/mcs.vim | 16 +++++--- syntax_checkers/css/csslint.vim | 14 ++++--- syntax_checkers/css/prettycss.vim | 1 + syntax_checkers/cucumber/cucumber.vim | 12 ++++-- syntax_checkers/dart/dart_analyzer.vim | 22 +++++----- syntax_checkers/elixir/elixir.vim | 6 ++- syntax_checkers/fortran/gfortran.vim | 13 ++++-- syntax_checkers/go/gofmt.vim | 16 +++++--- syntax_checkers/haml/haml.vim | 18 ++++++--- syntax_checkers/haskell/ghc-mod.vim | 16 ++++++-- syntax_checkers/haskell/hdevtools.vim | 1 + syntax_checkers/html/tidy.vim | 7 +++- syntax_checkers/java/checkstyle.vim | 6 ++- syntax_checkers/java/javac.vim | 6 ++- .../javascript/closurecompiler.vim | 14 ++++--- syntax_checkers/javascript/gjslint.vim | 20 +++++++--- syntax_checkers/javascript/jshint.vim | 17 +++++--- syntax_checkers/javascript/jsl.vim | 13 ++++-- syntax_checkers/javascript/jslint.vim | 14 +++++-- syntax_checkers/json/jsonlint.vim | 14 +++++-- syntax_checkers/json/jsonval.vim | 16 ++++++-- syntax_checkers/less/lessc.vim | 17 ++++---- syntax_checkers/lisp/clisp.vim | 40 +++++++++---------- syntax_checkers/llvm/llvm.vim | 12 ++++-- syntax_checkers/lua/luac.vim | 9 +++-- syntax_checkers/matlab/mlint.vim | 8 +++- syntax_checkers/nasm/nasm.vim | 13 ++++-- syntax_checkers/nroff/mandoc.vim | 6 ++- syntax_checkers/perl/perlcritic.vim | 16 +++++--- syntax_checkers/php/php.vim | 13 ++++-- syntax_checkers/php/phpcs.vim | 14 +++++-- syntax_checkers/php/phpmd.vim | 14 +++++-- syntax_checkers/pod/podchecker.vim | 6 ++- syntax_checkers/python/flake8.vim | 11 +++-- syntax_checkers/python/pep8.vim | 8 +++- syntax_checkers/python/py3kwarn.vim | 11 +++-- syntax_checkers/python/pyflakes.vim | 13 +++--- syntax_checkers/python/pylint.vim | 2 + syntax_checkers/python/python.vim | 8 +++- syntax_checkers/rst/rst2pseudoxml.vim | 13 +++--- syntax_checkers/ruby/jruby.vim | 11 +++-- syntax_checkers/ruby/macruby.vim | 13 ++++-- syntax_checkers/ruby/mri.vim | 12 ++++-- syntax_checkers/ruby/rubocop.vim | 13 +++--- syntax_checkers/rust/rustc.vim | 11 +++-- syntax_checkers/sass/sass.vim | 9 ++++- syntax_checkers/scala/scalac.vim | 11 +++-- syntax_checkers/sh/checkbashisms.vim | 6 ++- syntax_checkers/sh/sh.vim | 12 ++++-- syntax_checkers/slim/slimrb.vim | 7 +++- syntax_checkers/tcl/nagelfar.vim | 12 ++++-- syntax_checkers/tex/chktex.vim | 1 + syntax_checkers/tex/lacheck.vim | 11 ++++- syntax_checkers/text/atdtool.vim | 1 + syntax_checkers/twig/twiglint.vim | 12 ++++-- syntax_checkers/typescript/tsc.vim | 13 ++++-- syntax_checkers/vala/valac.vim | 12 +++--- syntax_checkers/vhdl/ghdl.vim | 12 ++++-- syntax_checkers/xhtml/tidy.vim | 8 +++- syntax_checkers/xml/xmllint.vim | 13 +++--- syntax_checkers/yaml/jsyaml.vim | 16 +++++--- syntax_checkers/z80/z80syntaxchecker.vim | 8 +++- syntax_checkers/zpt/zptlint.vim | 11 ++++- syntax_checkers/zsh/zsh.vim | 7 +++- 78 files changed, 591 insertions(+), 272 deletions(-) diff --git a/autoload/syntastic/makeprg.vim b/autoload/syntastic/makeprg.vim index 59311f7db..b032e1235 100644 --- a/autoload/syntastic/makeprg.vim +++ b/autoload/syntastic/makeprg.vim @@ -39,6 +39,7 @@ function! syntastic#makeprg#build(opts) \ get(a:opts, 'fname', ''), \ get(a:opts, 'post_args', ''), \ get(a:opts, 'tail', ''), + \ get(a:opts, 'filetype', ''), \ get(a:opts, 'subchecker', '') ) return builder.makeprg() diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index a4ece2da0..1bbca8884 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -387,12 +387,4 @@ function! SyntasticAddToErrors(errors, options) return a:errors endfunction -"resolve filetype aliases, and replace - with _ otherwise we cant name -"syntax checker functions legally for filetypes like "gentoo-metadata" -function! SyntasticNormalizeFiletype(ftalias) - let ft = get(g:syntastic_filetype_map, a:ftalias, a:ftalias) - let ft = substitute(ft, '-', '_', 'g') - return ft -endfunction - " vim: set et sts=4 sw=4: diff --git a/plugin/syntastic/makeprg_builder.vim b/plugin/syntastic/makeprg_builder.vim index cc861e760..4271a4803 100644 --- a/plugin/syntastic/makeprg_builder.vim +++ b/plugin/syntastic/makeprg_builder.vim @@ -5,13 +5,16 @@ let g:loaded_syntastic_makeprg_builder = 1 let g:SyntasticMakeprgBuilder = {} -function! g:SyntasticMakeprgBuilder.New(exe, args, fname, post_args, tail, subchecker) +" Public methods {{{1 + +function! g:SyntasticMakeprgBuilder.New(exe, args, fname, post_args, tail, filetype, subchecker) let newObj = copy(self) let newObj._exe = a:exe let newObj._args = a:args let newObj._fname = a:fname let newObj._post_args = a:post_args let newObj._tail = a:tail + let newObj._filetype = empty(a:filetype) ? &filetype : a:filetype let newObj._subchecker = a:subchecker return newObj endfunction @@ -44,6 +47,8 @@ function! g:SyntasticMakeprgBuilder.tail() return self._getOpt('tail') endfunction +" Private methods {{{1 + function g:SyntasticMakeprgBuilder._getOpt(name) if self._optExists(a:name) return {self._optName(a:name)} @@ -57,9 +62,11 @@ function! g:SyntasticMakeprgBuilder._optExists(name) endfunction function! g:SyntasticMakeprgBuilder._optName(name) - let setting = "g:syntastic_" . SyntasticNormalizeFiletype(&filetype) + let setting = "g:syntastic_" . self._filetype if !empty(self._subchecker) let setting .= '_' . self._subchecker endif return setting . '_' . a:name endfunction + +" vim: set sw=4 sts=4 et fdm=marker: diff --git a/plugin/syntastic/registry.vim b/plugin/syntastic/registry.vim index a22c50b02..3905324f0 100644 --- a/plugin/syntastic/registry.vim +++ b/plugin/syntastic/registry.vim @@ -63,7 +63,7 @@ function! g:SyntasticRegistry.checkable(ftalias) endfunction function! g:SyntasticRegistry.getActiveCheckers(ftalias) - let filetype = SyntasticNormalizeFiletype(a:ftalias) + let filetype = s:SyntasticRegistryNormaliseFiletype(a:ftalias) let checkers = self.availableCheckersFor(filetype) if self._userHasFiletypeSettings(filetype) @@ -94,7 +94,7 @@ function! g:SyntasticRegistry.getChecker(ftalias, name) endfunction function! g:SyntasticRegistry.availableCheckersFor(ftalias) - let filetype = SyntasticNormalizeFiletype(a:ftalias) + let filetype = s:SyntasticRegistryNormaliseFiletype(a:ftalias) let checkers = copy(self._allCheckersFor(filetype)) return self._filterCheckersByAvailability(checkers) endfunction @@ -178,4 +178,14 @@ function! g:SyntasticRegistry._validateUniqueName(checker) abort endfor endfunction +" Private functions {{{1 + +"resolve filetype aliases, and replace - with _ otherwise we cant name +"syntax checker functions legally for filetypes like "gentoo-metadata" +function! s:SyntasticRegistryNormaliseFiletype(ftalias) + let ft = get(g:syntastic_filetype_map, a:ftalias, a:ftalias) + let ft = substitute(ft, '-', '_', 'g') + return ft +endfunction + " vim: set sw=4 sts=4 et fdm=marker: diff --git a/syntax_checkers/applescript/osacompile.vim b/syntax_checkers/applescript/osacompile.vim index 4ce21e732..7567eb081 100644 --- a/syntax_checkers/applescript/osacompile.vim +++ b/syntax_checkers/applescript/osacompile.vim @@ -36,9 +36,10 @@ endfunction function! SyntaxCheckers_applescript_osacompile_GetLocList() let makeprg = syntastic#makeprg#build({ - \ 'exe': 'osacompile', - \ 'args': '-o ' . tempname() . '.scpt ', - \ 'subchecker': 'osacompile' }) + \ 'exe': 'osacompile', + \ 'args': '-o ' . tempname() . '.scpt ', + \ 'filetype': 'applescript', + \ 'subchecker': 'osacompile' }) let errorformat = '%f:%l:%m' return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) diff --git a/syntax_checkers/c/checkpatch.vim b/syntax_checkers/c/checkpatch.vim index 15066bac5..d87d57bd5 100644 --- a/syntax_checkers/c/checkpatch.vim +++ b/syntax_checkers/c/checkpatch.vim @@ -27,15 +27,17 @@ 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', - \ 'subchecker': 'checkpatch' }) + \ 'exe': g:syntastic_c_checker_checkpatch_location, + \ 'args': '--no-summary --no-tree --terse --file', + \ 'filetype': 'c', + \ 'subchecker': 'checkpatch' }) let errorformat = '%f:%l: %tARNING: %m,%f:%l: %tRROR: %m' - return SyntasticMake({ 'makeprg': makeprg, - \ 'errorformat': errorformat, - \ 'defaults': {'bufnr': bufnr("")} }) + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'defaults': {'bufnr': bufnr("")} }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/syntax_checkers/c/oclint.vim b/syntax_checkers/c/oclint.vim index 8944b75e5..e366a7abf 100644 --- a/syntax_checkers/c/oclint.vim +++ b/syntax_checkers/c/oclint.vim @@ -34,6 +34,7 @@ function! SyntaxCheckers_c_oclint_GetLocList() \ 'exe': 'oclint', \ 'args': '-text', \ 'post_args': '-- -c ' . syntastic#c#ReadConfig(g:syntastic_oclint_config_file), + \ 'filetype': 'c', \ 'subchecker': 'oclint' }) let errorformat = diff --git a/syntax_checkers/c/sparse.vim b/syntax_checkers/c/sparse.vim index f4d0013b5..4b3e6ee36 100644 --- a/syntax_checkers/c/sparse.vim +++ b/syntax_checkers/c/sparse.vim @@ -31,15 +31,17 @@ endif function! SyntaxCheckers_c_sparse_GetLocList() let makeprg = syntastic#makeprg#build({ - \ 'exe': 'sparse', - \ 'args': '-ftabstop=' . &ts . ' ' . syntastic#c#ReadConfig(g:syntastic_sparse_config_file), - \ 'subchecker': 'sparse' }) + \ 'exe': 'sparse', + \ 'args': '-ftabstop=' . &ts . ' ' . syntastic#c#ReadConfig(g:syntastic_sparse_config_file), + \ 'filetype': 'c', + \ 'subchecker': 'sparse' }) let errorformat = '%f:%l:%v: %trror: %m,%f:%l:%v: %tarning: %m,' - let loclist = SyntasticMake({ 'makeprg': makeprg, - \ 'errorformat': errorformat, - \ 'defaults': {'bufnr': bufnr("")} }) + let loclist = SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'defaults': {'bufnr': bufnr("")} }) return loclist endfunction diff --git a/syntax_checkers/c/splint.vim b/syntax_checkers/c/splint.vim index 3fa92a7a5..6b2a1c1bc 100644 --- a/syntax_checkers/c/splint.vim +++ b/syntax_checkers/c/splint.vim @@ -33,6 +33,7 @@ function! SyntaxCheckers_c_splint_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'splint', \ 'post_args': '-showfunc -hints +quiet ' . syntastic#c#ReadConfig(g:syntastic_splint_config_file), + \ 'filetype': 'c', \ 'subchecker': 'splint' }) let errorformat = diff --git a/syntax_checkers/co/coco.vim b/syntax_checkers/co/coco.vim index e9b7e1f72..a3186108c 100644 --- a/syntax_checkers/co/coco.vim +++ b/syntax_checkers/co/coco.vim @@ -25,9 +25,11 @@ endfunction function! SyntaxCheckers_co_coco_GetLocList() let makeprg = syntastic#makeprg#build({ - \ 'exe': 'coco', - \ 'args': '-c -o /tmp', - \ 'subchecker': 'coco' }) + \ 'exe': 'coco', + \ 'args': '-c -o /tmp', + \ 'filetype': 'co', + \ 'subchecker': 'coco' }) + let errorformat = \ '%EFailed at: %f,' . \ '%ZSyntax%trror: %m on line %l,'. diff --git a/syntax_checkers/coffee/coffee.vim b/syntax_checkers/coffee/coffee.vim index aa965bb60..3390734c5 100644 --- a/syntax_checkers/coffee/coffee.vim +++ b/syntax_checkers/coffee/coffee.vim @@ -20,8 +20,10 @@ endfunction function! SyntaxCheckers_coffee_coffee_GetLocList() let makeprg = syntastic#makeprg#build({ - \ 'exe': 'coffee', - \ 'subchecker': 'coffee' }) + \ 'exe': 'coffee', + \ 'filetype': 'coffee', + \ 'subchecker': 'coffee' }) + let errorformat = \ '%E%f:%l:%c: %trror: %m,' . \ 'Syntax%trror: In %f\, %m on line %l,' . diff --git a/syntax_checkers/coffee/coffeelint.vim b/syntax_checkers/coffee/coffeelint.vim index d58da16de..cae5c40c5 100644 --- a/syntax_checkers/coffee/coffeelint.vim +++ b/syntax_checkers/coffee/coffeelint.vim @@ -20,11 +20,17 @@ endfunction function! SyntaxCheckers_coffee_coffeelint_GetLocList() let makeprg = syntastic#makeprg#build({ - \ 'exe': 'coffeelint', - \ 'subchecker': 'coffeelint', - \ 'args': '--csv' }) - let efm = '%f\,%l\,%trror\,%m' - return SyntasticMake({ 'makeprg': makeprg, 'errorformat': efm, 'subtype': 'Style' }) + \ 'exe': 'coffeelint', + \ 'args': '--csv', + \ 'filetype': 'coffee', + \ 'subchecker': 'coffeelint' }) + + let errorformat = '%f\,%l\,%trror\,%m' + + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'subtype': 'Style' }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/syntax_checkers/coq/coqtop.vim b/syntax_checkers/coq/coqtop.vim index e1dd239c0..f1efa4d88 100644 --- a/syntax_checkers/coq/coqtop.vim +++ b/syntax_checkers/coq/coqtop.vim @@ -21,14 +21,18 @@ endfunction function! SyntaxCheckers_coq_coqtop_GetLocList() let makeprg = syntastic#makeprg#build({ - \ 'exe': 'coqtop', - \ 'args': '-noglob -batch -load-vernac-source', - \ 'subchecker': 'coqtop' }) + \ 'exe': 'coqtop', + \ 'args': '-noglob -batch -load-vernac-source', + \ 'filetype': 'coq', + \ 'subchecker': 'coqtop' }) + let errorformat = \ '%AFile \"%f\"\, line %l\, characters %c\-%.%#\:,'. \ '%C%m' - return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/syntax_checkers/cpp/cpplint.vim b/syntax_checkers/cpp/cpplint.vim index 48cf415ba..35e77ccc5 100644 --- a/syntax_checkers/cpp/cpplint.vim +++ b/syntax_checkers/cpp/cpplint.vim @@ -41,10 +41,16 @@ endfunction function! SyntaxCheckers_cpp_cpplint_GetLocList() let makeprg = syntastic#makeprg#build({ - \ 'exe': 'cpplint.py', - \ 'subchecker': 'cpplint' }) + \ 'exe': 'cpplint.py', + \ 'filetype': 'cpp', + \ 'subchecker': 'cpplint' }) + let errorformat = '%A%f:%l: %m [%t],%-G%.%#' - let loclist = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat, 'subtype': 'Style' }) + + let loclist = SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'subtype': 'Style' }) " change error types according to the prescribed threshold for n in range(len(loclist)) diff --git a/syntax_checkers/cs/mcs.vim b/syntax_checkers/cs/mcs.vim index da809fd32..b3c96a958 100644 --- a/syntax_checkers/cs/mcs.vim +++ b/syntax_checkers/cs/mcs.vim @@ -21,13 +21,17 @@ endfunction function! SyntaxCheckers_cs_mcs_GetLocList() let makeprg = syntastic#makeprg#build({ - \ 'exe': 'mcs', - \ 'args': '--parse', - \ 'subchecker': 'mcs' }) + \ 'exe': 'mcs', + \ 'args': '--parse', + \ 'filetype': 'cs', + \ 'subchecker': 'mcs' }) + let errorformat = '%f(%l\,%c): %trror %m' - return SyntasticMake({ 'makeprg': makeprg, - \ 'errorformat': errorformat, - \ 'defaults': {'bufnr': bufnr("")} }) + + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'defaults': {'bufnr': bufnr("")} }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/syntax_checkers/css/csslint.vim b/syntax_checkers/css/csslint.vim index 269a9c8d8..6a2659d79 100644 --- a/syntax_checkers/css/csslint.vim +++ b/syntax_checkers/css/csslint.vim @@ -29,9 +29,10 @@ endfunction function! SyntaxCheckers_css_csslint_GetLocList() let makeprg = syntastic#makeprg#build({ - \ 'exe': 'csslint', - \ 'args': '--format=compact ' . g:syntastic_csslint_options, - \ 'subchecker': 'csslint' }) + \ 'exe': 'csslint', + \ 'args': '--format=compact ' . g:syntastic_csslint_options, + \ 'filetype': 'css', + \ 'subchecker': 'csslint' }) " Print CSS Lint's error/warning messages from compact format. Ignores blank lines. let errorformat = @@ -41,9 +42,10 @@ function! SyntaxCheckers_css_csslint_GetLocList() \ '%f: line %l\, col %c\, %tarning - %m,'. \ '%f: line %l\, col %c\, %m,' - return SyntasticMake({ 'makeprg': makeprg, - \ 'errorformat': errorformat, - \ 'defaults': {'bufnr': bufnr("")} }) + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'defaults': {'bufnr': bufnr("")} }) endfunction diff --git a/syntax_checkers/css/prettycss.vim b/syntax_checkers/css/prettycss.vim index 204b5142a..c3cd9de1a 100644 --- a/syntax_checkers/css/prettycss.vim +++ b/syntax_checkers/css/prettycss.vim @@ -35,6 +35,7 @@ endfunction function! SyntaxCheckers_css_prettycss_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'prettycss', + \ 'filetype': 'css', \ 'subchecker': 'prettycss' }) " Print CSS Lint's error/warning messages from compact format. Ignores blank lines. diff --git a/syntax_checkers/cucumber/cucumber.vim b/syntax_checkers/cucumber/cucumber.vim index 70e5bab81..4458c78f6 100644 --- a/syntax_checkers/cucumber/cucumber.vim +++ b/syntax_checkers/cucumber/cucumber.vim @@ -21,16 +21,20 @@ endfunction function! SyntaxCheckers_cucumber_cucumber_GetLocList() let makeprg = syntastic#makeprg#build({ - \ 'exe': 'cucumber', - \ 'args': '--dry-run --quiet --strict --format pretty', - \ 'subchecker': 'cucumber' }) + \ 'exe': 'cucumber', + \ 'args': '--dry-run --quiet --strict --format pretty', + \ 'filetype': 'cucumber', + \ 'subchecker': 'cucumber' }) + let errorformat = \ '%f:%l:%c:%m,' . \ '%W %.%# (%m),' . \ '%-Z%f:%l:%.%#,'. \ '%-G%.%#' - return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/syntax_checkers/dart/dart_analyzer.vim b/syntax_checkers/dart/dart_analyzer.vim index f7b1e01df..a0835c41c 100644 --- a/syntax_checkers/dart/dart_analyzer.vim +++ b/syntax_checkers/dart/dart_analyzer.vim @@ -22,19 +22,21 @@ function! SyntaxCheckers_dart_dart_analyzer_IsAvailable() endfunction function! SyntaxCheckers_dart_dart_analyzer_GetHighlightRegex(error) - let lcol = a:error['col'] - 1 - let rcol = a:error['nr'] + lcol + 1 + let lcol = a:error['col'] - 1 + let rcol = a:error['nr'] + lcol + 1 - return '\%>'.lcol.'c\%<'.rcol.'c' + return '\%>'.lcol.'c\%<'.rcol.'c' endfunction function! SyntaxCheckers_dart_dart_analyzer_GetLocList() let args = !empty(g:syntastic_dart_analyzer_conf) ? ' ' . g:syntastic_dart_analyzer_conf : '' let makeprg = syntastic#makeprg#build({ - \ 'exe': 'dart_analyzer', - \ 'args': '--error_format machine', - \ 'post_args': args, - \ 'subchecker': 'dart_analyzer' }) + \ 'exe': 'dart_analyzer', + \ 'args': '--error_format machine', + \ 'post_args': args, + \ 'filetype': 'dart', + \ 'subchecker': 'dart_analyzer' }) + " Machine readable format looks like: " SEVERITY|TYPE|ERROR_CODE|file:FILENAME|LINE_NUMBER|COLUMN|LENGTH|MESSAGE " SEVERITY: (WARNING|ERROR) @@ -52,9 +54,11 @@ function! SyntaxCheckers_dart_dart_analyzer_GetLocList() " TODO(amouravski): simply take everything after ERROR|WARNING as a message " and then parse it by hand later. let errorformat = '%EERROR'.l:commonformat.','. - \'%WWARNING'.l:commonformat + \'%WWARNING'.l:commonformat - return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/syntax_checkers/elixir/elixir.vim b/syntax_checkers/elixir/elixir.vim index cbd91c8c9..612ba8bf1 100644 --- a/syntax_checkers/elixir/elixir.vim +++ b/syntax_checkers/elixir/elixir.vim @@ -31,10 +31,14 @@ endfunction function! SyntaxCheckers_elixir_elixir_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': s:syntastic_elixir_compile_command, + \ 'filetype': 'elixir', \ 'subchecker': 'elixir' }) + let errorformat = '** %*[^\ ] %f:%l: %m' - return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/syntax_checkers/fortran/gfortran.vim b/syntax_checkers/fortran/gfortran.vim index 0f529df33..0df45d3ab 100644 --- a/syntax_checkers/fortran/gfortran.vim +++ b/syntax_checkers/fortran/gfortran.vim @@ -33,16 +33,21 @@ endfunction function! SyntaxCheckers_fortran_gfortran_GetLocList() let makeprg = syntastic#makeprg#build({ - \ 'exe': 'gfortran', - \ 'args': s:args(), - \ 'subchecker': 'gfortran' }) + \ 'exe': 'gfortran', + \ 'args': s:args(), + \ 'filetype': 'fortran', + \ 'subchecker': 'gfortran' }) + let errorformat = \ '%-C %#,'. \ '%-C %#%.%#,'. \ '%A%f:%l.%c:,'. \ '%Z%m,'. \ '%G%.%#' - return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) + + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat }) endfunction function s:args() diff --git a/syntax_checkers/go/gofmt.vim b/syntax_checkers/go/gofmt.vim index 804065f97..b150916fd 100644 --- a/syntax_checkers/go/gofmt.vim +++ b/syntax_checkers/go/gofmt.vim @@ -23,12 +23,18 @@ endfunction function! SyntaxCheckers_go_gofmt_GetLocList() let makeprg = syntastic#makeprg#build({ - \ 'exe': 'gofmt', - \ 'args': '-l', - \ 'tail': '1>' . syntastic#util#DevNull(), - \ 'subchecker': 'gofmt' }) + \ 'exe': 'gofmt', + \ 'args': '-l', + \ 'tail': '1>' . syntastic#util#DevNull(), + \ 'filetype': 'go', + \ 'subchecker': 'gofmt' }) + let errorformat = '%f:%l:%c: %m,%-G%.%#' - return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat, 'defaults': {'type': 'e'} }) + + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'defaults': {'type': 'e'} }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/syntax_checkers/haml/haml.vim b/syntax_checkers/haml/haml.vim index 62fdfafe5..3582eecc4 100644 --- a/syntax_checkers/haml/haml.vim +++ b/syntax_checkers/haml/haml.vim @@ -21,11 +21,19 @@ endfunction function! SyntaxCheckers_haml_haml_GetLocList() let makeprg = syntastic#makeprg#build({ - \ 'exe': 'haml', - \ 'args': '-c', - \ 'subchecker': 'haml' }) - let errorformat = 'Haml error on line %l: %m,Syntax error on line %l: %m,%-G%.%#' - return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) + \ 'exe': 'haml', + \ 'args': '-c', + \ 'filetype': 'haml', + \ 'subchecker': 'haml' }) + + 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({ diff --git a/syntax_checkers/haskell/ghc-mod.vim b/syntax_checkers/haskell/ghc-mod.vim index 43131001c..9340c381e 100644 --- a/syntax_checkers/haskell/ghc-mod.vim +++ b/syntax_checkers/haskell/ghc-mod.vim @@ -32,13 +32,21 @@ function! SyntaxCheckers_haskell_ghc_mod_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'ghc-mod check', - \ 'args': '--hlintOpt="--language=XmlSyntax"' }) - let loclist1 = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) + \ 'args': '--hlintOpt="--language=XmlSyntax"', + \ 'filetype': 'haskell', + \ 'subchecker': 'ghc_mod' }) + let loclist1 = SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat }) let makeprg = syntastic#makeprg#build({ \ 'exe': 'ghc-mod lint', - \ 'args': '--hlintOpt="--language=XmlSyntax"' }) - let loclist2 = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) + \ 'args': '--hlintOpt="--language=XmlSyntax"', + \ 'filetype': 'haskell', + \ 'subchecker': 'ghc_mod' }) + let loclist2 = SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat }) return loclist1 + loclist2 endfunction diff --git a/syntax_checkers/haskell/hdevtools.vim b/syntax_checkers/haskell/hdevtools.vim index fd43b3498..3f4b0b737 100644 --- a/syntax_checkers/haskell/hdevtools.vim +++ b/syntax_checkers/haskell/hdevtools.vim @@ -23,6 +23,7 @@ function! SyntaxCheckers_haskell_hdevtools_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'hdevtools check', \ 'args': get(g:, 'hdevtools_options', ''), + \ 'filetype': 'haskell', \ 'subchecker': 'hdevtools' }) let errorformat= '\%-Z\ %#,'. diff --git a/syntax_checkers/html/tidy.vim b/syntax_checkers/html/tidy.vim index a3002d25f..957dd6ee4 100644 --- a/syntax_checkers/html/tidy.vim +++ b/syntax_checkers/html/tidy.vim @@ -86,13 +86,18 @@ function! SyntaxCheckers_html_tidy_GetLocList() \ 'exe': 'tidy', \ 'args': s:Args(), \ 'tail': '2>&1', + \ 'filetype': 'html', \ 'subchecker': 'tidy' }) + let errorformat = \ '%Wline %l column %v - Warning: %m,' . \ '%Eline %l column %v - Error: %m,' . \ '%-G%.%#' - let loclist = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat, 'defaults': {'bufnr': bufnr("")} }) + let loclist = SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'defaults': {'bufnr': bufnr("")} }) " filter out valid HTML5 from the errors for n in range(len(loclist)) diff --git a/syntax_checkers/java/checkstyle.vim b/syntax_checkers/java/checkstyle.vim index 7438b66ad..a368df315 100644 --- a/syntax_checkers/java/checkstyle.vim +++ b/syntax_checkers/java/checkstyle.vim @@ -40,12 +40,16 @@ function! SyntaxCheckers_java_checkstyle_GetLocList() \ 'args': '-cp ' . g:syntastic_java_checkstyle_classpath . \ ' com.puppycrawl.tools.checkstyle.Main -c ' . g:syntastic_java_checkstyle_conf_file, \ 'fname': fname, + \ 'filetype': 'java', \ 'subchecker': 'checkstyle' }) " check style format let errorformat = '%f:%l:%c:\ %m,%f:%l:\ %m' - return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat, 'postprocess': ['cygwinRemoveCR'] }) + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'postprocess': ['cygwinRemoveCR'] }) endfunction diff --git a/syntax_checkers/java/javac.vim b/syntax_checkers/java/javac.vim index a05a074ab..a14380257 100644 --- a/syntax_checkers/java/javac.vim +++ b/syntax_checkers/java/javac.vim @@ -278,6 +278,7 @@ function! SyntaxCheckers_java_javac_GetLocList() \ 'args': javac_opts, \ 'fname': fname, \ 'tail': '2>&1', + \ 'filetype': 'java', \ 'subchecker': 'javac' }) " unashamedly stolen from *errorformat-javac* (quickfix.txt) and modified to include error types @@ -292,7 +293,10 @@ function! SyntaxCheckers_java_javac_GetLocList() if g:syntastic_java_javac_delete_output silent! call mkdir(output_dir,'p') endif - let errors = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat, 'postprocess': ['cygwinRemoveCR'] }) + let errors = SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'postprocess': ['cygwinRemoveCR'] }) if g:syntastic_java_javac_delete_output call s:RemoveDir(output_dir) diff --git a/syntax_checkers/javascript/closurecompiler.vim b/syntax_checkers/javascript/closurecompiler.vim index b8ed88318..f15f60603 100644 --- a/syntax_checkers/javascript/closurecompiler.vim +++ b/syntax_checkers/javascript/closurecompiler.vim @@ -42,10 +42,11 @@ function! SyntaxCheckers_javascript_closurecompiler_GetLocList() endif let makeprg = syntastic#makeprg#build({ - \ 'exe': 'java -jar ' . g:syntastic_javascript_closure_compiler_path, - \ 'args': g:syntastic_javascript_closure_compiler_options . ' --js' , - \ 'fname': file_list, - \ 'subchecker': 'closurecompiler' }) + \ 'exe': 'java -jar ' . g:syntastic_javascript_closure_compiler_path, + \ 'args': g:syntastic_javascript_closure_compiler_options . ' --js' , + \ 'fname': file_list, + \ 'filetype': 'javascript', + \ 'subchecker': 'closurecompiler' }) let errorformat = \ '%-GOK,'. @@ -53,7 +54,10 @@ function! SyntaxCheckers_javascript_closurecompiler_GetLocList() \ '%Z%p^,'. \ '%W%f:%l: WARNING - %m,'. \ '%Z%p^' - return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) + + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/syntax_checkers/javascript/gjslint.vim b/syntax_checkers/javascript/gjslint.vim index f619c6760..039d0eed0 100644 --- a/syntax_checkers/javascript/gjslint.vim +++ b/syntax_checkers/javascript/gjslint.vim @@ -23,11 +23,21 @@ 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", - \ 'subchecker': 'gjslint' }) - let errorformat="%f:%l:(New Error -%\\?\%n) %m,%f:%l:(-%\\?%n) %m,%-G1 files checked, no errors found.,%-G%.%#" - return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) + \ 'exe': 'gjslint', + \ 'args': g:syntastic_javascript_gjslint_conf . " --nosummary --unix_mode --nodebug_indentation --nobeep", + \ 'filetype': 'javascript', + \ 'subchecker': 'gjslint' }) + + let errorformat = + \ "%f:%l:(New Error -%\\?\%n) %m," . + \ "%f:%l:(-%\\?%n) %m," . + \ "%-G1 files checked," . + \ " no errors found.," . + \ "%-G%.%#" + + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/syntax_checkers/javascript/jshint.vim b/syntax_checkers/javascript/jshint.vim index 9b10c1809..e98e56289 100644 --- a/syntax_checkers/javascript/jshint.vim +++ b/syntax_checkers/javascript/jshint.vim @@ -25,14 +25,19 @@ endfunction function! SyntaxCheckers_javascript_jshint_GetLocList() let jshint_new = s:JshintNew() let makeprg = syntastic#makeprg#build({ - \ 'exe': 'jshint', - \ 'post_args': (jshint_new ? ' --verbose ' : '') . s:Args(), - \ 'subchecker': 'jshint' }) + \ 'exe': 'jshint', + \ 'post_args': (jshint_new ? ' --verbose ' : '') . s:Args(), + \ 'filetype': 'javascript', + \ 'subchecker': 'jshint' }) let errorformat = jshint_new ? - \ '%f: line %l\, col %c\, %m \(%t%*\d\)' : - \ '%E%f: line %l\, col %c\, %m' - return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat, 'defaults': {'bufnr': bufnr('')} }) + \ '%f: line %l\, col %c\, %m \(%t%*\d\)' : + \ '%E%f: line %l\, col %c\, %m' + + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'defaults': {'bufnr': bufnr('')} }) endfunction function s:JshintNew() diff --git a/syntax_checkers/javascript/jsl.vim b/syntax_checkers/javascript/jsl.vim index 0491b59fb..bef1b89aa 100644 --- a/syntax_checkers/javascript/jsl.vim +++ b/syntax_checkers/javascript/jsl.vim @@ -31,9 +31,11 @@ endfunction function! SyntaxCheckers_javascript_jsl_GetLocList() let makeprg = syntastic#makeprg#build({ - \ 'exe': 'jsl', - \ 'args': s:ConfFlag() . " -nologo -nofilelisting -nosummary -nocontext -process", - \ 'subchecker': 'jsl' }) + \ 'exe': 'jsl', + \ 'args': s:ConfFlag() . " -nologo -nofilelisting -nosummary -nocontext -process", + \ 'filetype': 'javascript', + \ 'subchecker': 'jsl' }) + let errorformat = \ '%W%f(%l): lint warning: %m,'. \ '%-Z%p^,'. @@ -42,7 +44,10 @@ function! SyntaxCheckers_javascript_jsl_GetLocList() \ '%E%f(%l): SyntaxError: %m,'. \ '%-Z%p^,'. \ '%-G' - return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) + + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/syntax_checkers/javascript/jslint.vim b/syntax_checkers/javascript/jslint.vim index 46eeddbd3..ab6469d4f 100644 --- a/syntax_checkers/javascript/jslint.vim +++ b/syntax_checkers/javascript/jslint.vim @@ -31,14 +31,20 @@ endfunction function! SyntaxCheckers_javascript_jslint_GetLocList() let makeprg = syntastic#makeprg#build({ - \ 'exe': 'jslint', - \ 'args': g:syntastic_javascript_jslint_conf, - \ 'subchecker': 'jslint' }) + \ 'exe': 'jslint', + \ 'args': g:syntastic_javascript_jslint_conf, + \ 'filetype': 'javascript', + \ 'subchecker': 'jslint' }) + let errorformat = \ '%E %##%n %m,'. \ '%-Z%.%#Line %l\, Pos %c,'. \ '%-G%.%#' - return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat, 'defaults': {'bufnr': bufnr("")} }) + + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'defaults': {'bufnr': bufnr("")} }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/syntax_checkers/json/jsonlint.vim b/syntax_checkers/json/jsonlint.vim index 93b358a18..7c6b34d53 100644 --- a/syntax_checkers/json/jsonlint.vim +++ b/syntax_checkers/json/jsonlint.vim @@ -20,16 +20,22 @@ endfunction function! SyntaxCheckers_json_jsonlint_GetLocList() let makeprg = syntastic#makeprg#build({ - \ 'exe': 'jsonlint', - \ 'post_args': '--compact', - \ 'subchecker': 'jsonlint' }) + \ 'exe': 'jsonlint', + \ 'post_args': '--compact', + \ 'filetype': 'json', + \ 'subchecker': 'jsonlint' }) + 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('')} }) + + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'defaults': {'bufnr': bufnr('')} }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/syntax_checkers/json/jsonval.vim b/syntax_checkers/json/jsonval.vim index 632cda2f5..4359e86c5 100644 --- a/syntax_checkers/json/jsonval.vim +++ b/syntax_checkers/json/jsonval.vim @@ -20,9 +20,19 @@ 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('')} }) + let makeprg = syntastic#makeprg#build({ + \ 'exe': 'jsonval', + \ 'filetype': 'json', + \ '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({ diff --git a/syntax_checkers/less/lessc.vim b/syntax_checkers/less/lessc.vim index 7ceddad85..001be3512 100644 --- a/syntax_checkers/less/lessc.vim +++ b/syntax_checkers/less/lessc.vim @@ -42,15 +42,18 @@ endfunction function! SyntaxCheckers_less_lessc_GetLocList() let makeprg = syntastic#makeprg#build({ - \ 'exe': s:check_file, - \ 'args': g:syntastic_less_options, - \ 'tail': syntastic#util#DevNull(), - \ 'subchecker': 'lessc' }) + \ 'exe': s:check_file, + \ 'args': g:syntastic_less_options, + \ 'tail': syntastic#util#DevNull(), + \ 'filetype': 'less', + \ 'subchecker': 'lessc' }) + let errorformat = '%m in %f:%l:%c' - return SyntasticMake({ 'makeprg': makeprg, - \ 'errorformat': errorformat, - \ 'defaults': {'bufnr': bufnr(""), 'text': "Syntax error"} }) + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'defaults': {'bufnr': bufnr(""), 'text': "Syntax error"} }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/syntax_checkers/lisp/clisp.vim b/syntax_checkers/lisp/clisp.vim index 60650c387..caf094f18 100644 --- a/syntax_checkers/lisp/clisp.vim +++ b/syntax_checkers/lisp/clisp.vim @@ -20,26 +20,26 @@ endfunction function! SyntaxCheckers_lisp_clisp_GetLocList() let makeprg = syntastic#makeprg#build({ - \ 'exe': 'clisp', - \ 'args': '-q -c', - \ 'tail': '-o /tmp/clisp-vim-compiled-file', - \ 'subchecker': 'clisp' }) - - let efm = '%-G;%.%#,' - - let efm .= '%W%>WARNING:%.%#line %l : %m,' - let efm .= '%Z %#%m,' - - let efm .= '%W%>WARNING:%.%#lines %l..%\d\# : %m,' - let efm .= '%Z %#%m,' - - let efm .= '%E%>The following functions were %m,' - let efm .= '%Z %m,' - - let efm .= '%-G%.%#' - return SyntasticMake({ 'makeprg': makeprg, - \ 'errorformat': efm, - \ 'defaults': {'bufnr': bufnr('')} }) + \ 'exe': 'clisp', + \ 'args': '-q -c', + \ 'tail': '-o /tmp/clisp-vim-compiled-file', + \ 'filetype': 'lisp', + \ 'subchecker': 'clisp' }) + + let errorformat = + \ '%-G;%.%#,' . + \ '%W%>WARNING:%.%#line %l : %m,' . + \ '%Z %#%m,' . + \ '%W%>WARNING:%.%#lines %l..%\d\# : %m,' . + \ '%Z %#%m,' . + \ '%E%>The following functions were %m,' . + \ '%Z %m,' . + \ '%-G%.%#' + + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'defaults': {'bufnr': bufnr('')} }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/syntax_checkers/llvm/llvm.vim b/syntax_checkers/llvm/llvm.vim index 5a1f18ed4..ea4fa04bf 100644 --- a/syntax_checkers/llvm/llvm.vim +++ b/syntax_checkers/llvm/llvm.vim @@ -20,12 +20,16 @@ endfunction function! SyntaxCheckers_llvm_llvm_GetLocList() let makeprg = syntastic#makeprg#build({ - \ 'exe': 'llc', - \ 'args': syntastic#c#GetNullDevice(), - \ 'subchecker': 'llvm' }) + \ 'exe': 'llc', + \ 'args': syntastic#c#GetNullDevice(), + \ 'filetype': 'llvm', + \ 'subchecker': 'llvm' }) + let errorformat = 'llc: %f:%l:%c: %trror: %m' - return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/syntax_checkers/lua/luac.vim b/syntax_checkers/lua/luac.vim index 77f017eb4..c26e520a4 100644 --- a/syntax_checkers/lua/luac.vim +++ b/syntax_checkers/lua/luac.vim @@ -47,12 +47,15 @@ function! SyntaxCheckers_lua_luac_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'luac', \ 'args': '-p', + \ 'filetype': 'lua', \ 'subchecker': 'luac' }) + let errorformat = 'luac: %#%f:%l: %m' - return SyntasticMake({ 'makeprg': makeprg, - \ 'errorformat': errorformat, - \ 'defaults': { 'bufnr': bufnr(''), 'type': 'E' } }) + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'defaults': { 'bufnr': bufnr(''), 'type': 'E' } }) endfunction diff --git a/syntax_checkers/matlab/mlint.vim b/syntax_checkers/matlab/mlint.vim index 3cdc1b7f5..380d22c89 100644 --- a/syntax_checkers/matlab/mlint.vim +++ b/syntax_checkers/matlab/mlint.vim @@ -23,11 +23,17 @@ function! SyntaxCheckers_matlab_mlint_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'mlint', \ 'args': '-id $*', + \ 'filetype': 'matlab', \ 'subchecker': 'mlint' }) + 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("")} }) + + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'defaults': {'bufnr': bufnr("")} }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/syntax_checkers/nasm/nasm.vim b/syntax_checkers/nasm/nasm.vim index 0cf0b51a4..3bab07dc9 100644 --- a/syntax_checkers/nasm/nasm.vim +++ b/syntax_checkers/nasm/nasm.vim @@ -26,11 +26,16 @@ function! SyntaxCheckers_nasm_nasm_GetLocList() endif let wd = shellescape(expand("%:p:h") . "/") let makeprg = syntastic#makeprg#build({ - \ 'exe': 'nasm', - \ 'args': '-X gnu -f elf -I ' . wd . ' -o ' . outfile, - \ 'subchecker': 'nasm' }) + \ 'exe': 'nasm', + \ 'args': '-X gnu -f elf -I ' . wd . ' -o ' . outfile, + \ 'filetype': 'nasm', + \ 'subchecker': 'nasm' }) + let errorformat = '%f:%l: %t%*[^:]: %m' - return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) + + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/syntax_checkers/nroff/mandoc.vim b/syntax_checkers/nroff/mandoc.vim index 06ccddf92..05e28775d 100644 --- a/syntax_checkers/nroff/mandoc.vim +++ b/syntax_checkers/nroff/mandoc.vim @@ -22,12 +22,16 @@ function! SyntaxCheckers_nroff_mandoc_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'mandoc', \ 'args': '-Tlint', + \ 'filetype': 'nroff', \ 'subchecker': 'mandoc' }) + let errorformat = \ '%E%f:%l:%c: %tRROR: %m,' . \ '%W%f:%l:%c: %tARNING: %m' - return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/syntax_checkers/perl/perlcritic.vim b/syntax_checkers/perl/perlcritic.vim index 45a6cec21..2bfa56c32 100644 --- a/syntax_checkers/perl/perlcritic.vim +++ b/syntax_checkers/perl/perlcritic.vim @@ -39,11 +39,17 @@ endfunction function! SyntaxCheckers_perl_perlcritic_GetLocList() let makeprg = syntastic#makeprg#build({ - \ 'exe': 'perlcritic', - \ 'post_args': '--quiet --nocolor --verbose "\%s:\%f:\%l:\%c:(\%s) \%m (\%e)\n"', - \ 'subchecker': 'perlcritic' }) - let errorformat='%t:%f:%l:%c:%m' - let loclist = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat, 'subtype': 'Style' }) + \ 'exe': 'perlcritic', + \ 'post_args': '--quiet --nocolor --verbose "\%s:\%f:\%l:\%c:(\%s) \%m (\%e)\n"', + \ 'filetype': 'perl', + \ 'subchecker': 'perlcritic' }) + + let errorformat = '%t:%f:%l:%c:%m' + + let loclist = SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'subtype': 'Style' }) " change error types according to the prescribed threshold for n in range(len(loclist)) diff --git a/syntax_checkers/php/php.vim b/syntax_checkers/php/php.vim index e5039ea52..a6abffb12 100644 --- a/syntax_checkers/php/php.vim +++ b/syntax_checkers/php/php.vim @@ -29,9 +29,11 @@ endfunction 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 -d xdebug.cli_color=0', - \ 'subchecker': 'php' }) + \ 'exe': 'php', + \ 'args': '-l -d error_reporting=E_ALL -d display_errors=1 -d log_errors=0 -d xdebug.cli_color=0', + \ 'filetype': 'php', + \ 'subchecker': 'php' }) + let errorformat = \ '%-GNo syntax errors detected in%.%#,'. \ 'Parse error: %#syntax %trror\, %m in %f on line %l,'. @@ -39,7 +41,10 @@ function! SyntaxCheckers_php_php_GetLocList() \ 'Fatal %trror: %m in %f on line %l,'. \ '%-G\s%#,'. \ '%-GErrors parsing %.%#' - return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) + + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/syntax_checkers/php/phpcs.vim b/syntax_checkers/php/phpcs.vim index 321f0f5a7..f6646c666 100644 --- a/syntax_checkers/php/phpcs.vim +++ b/syntax_checkers/php/phpcs.vim @@ -24,13 +24,19 @@ endfunction function! SyntaxCheckers_php_phpcs_GetLocList() let makeprg = syntastic#makeprg#build({ - \ 'exe': 'phpcs', - \ 'args': '--report=csv', - \ 'subchecker': 'phpcs' }) + \ 'exe': 'phpcs', + \ 'args': '--report=csv', + \ 'filetype': 'php', + \ 'subchecker': 'phpcs' }) + let errorformat = \ '%-GFile\,Line\,Column\,Type\,Message\,Source\,Severity,'. \ '"%f"\,%l\,%c\,%t%*[a-zA-Z]\,"%m"\,%*[a-zA-Z0-9_.-]\,%*[0-9]' - return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat, 'subtype': 'Style' }) + + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'subtype': 'Style' }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/syntax_checkers/php/phpmd.vim b/syntax_checkers/php/phpmd.vim index bf27a1ca7..c21362f9f 100644 --- a/syntax_checkers/php/phpmd.vim +++ b/syntax_checkers/php/phpmd.vim @@ -60,11 +60,17 @@ endfunction function! SyntaxCheckers_php_phpmd_GetLocList() let makeprg = syntastic#makeprg#build({ - \ 'exe': 'phpmd', - \ 'post_args': 'text codesize,design,unusedcode,naming', - \ 'subchecker': 'phpmd' }) + \ 'exe': 'phpmd', + \ 'post_args': 'text codesize,design,unusedcode,naming', + \ 'filetype': 'php', + \ 'subchecker': 'phpmd' }) + let errorformat = '%E%f:%l%\s%#%m' - return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat, 'subtype' : 'Style' }) + + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'subtype' : 'Style' }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/syntax_checkers/pod/podchecker.vim b/syntax_checkers/pod/podchecker.vim index 212e4329a..4f2152018 100644 --- a/syntax_checkers/pod/podchecker.vim +++ b/syntax_checkers/pod/podchecker.vim @@ -21,12 +21,16 @@ endfunction function! SyntaxCheckers_pod_podchecker_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'podchecker', + \ 'filetype': 'pod', \ 'subchecker': 'podchecker' }) + let errorformat = \ '%W%[%#]%[%#]%[%#] WARNING: %m at line %l in file %f,' . \ '%E%[%#]%[%#]%[%#] ERROR: %m at line %l in file %f' - return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/syntax_checkers/python/flake8.vim b/syntax_checkers/python/flake8.vim index 0dfa14db7..703ba9a9d 100644 --- a/syntax_checkers/python/flake8.vim +++ b/syntax_checkers/python/flake8.vim @@ -32,8 +32,10 @@ endfunction function! SyntaxCheckers_python_flake8_GetLocList() let makeprg = syntastic#makeprg#build({ - \ 'exe': 'flake8', - \ 'subchecker': 'flake8' }) + \ 'exe': 'flake8', + \ 'filetype': 'python', + \ 'subchecker': 'flake8' }) + let errorformat = \ '%E%f:%l: could not compile,%-Z%p^,'. \ '%W%f:%l:%c: F%n %m,'. @@ -41,7 +43,10 @@ function! SyntaxCheckers_python_flake8_GetLocList() \ '%E%f:%l:%c: %t%n %m,'. \ '%E%f:%l: %t%n %m,'. \ '%-G%.%#' - return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) + + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/syntax_checkers/python/pep8.vim b/syntax_checkers/python/pep8.vim index 4cf194f56..71837187d 100644 --- a/syntax_checkers/python/pep8.vim +++ b/syntax_checkers/python/pep8.vim @@ -24,9 +24,15 @@ endfunction function! SyntaxCheckers_python_pep8_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'pep8', + \ 'filetype': 'python', \ 'subchecker': 'pep8' }) + let errorformat = '%f:%l:%c: %m' - let loclist = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat, 'subtype': 'Style' }) + + let loclist = SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'subtype': 'Style' }) for n in range(len(loclist)) let loclist[n]['type'] = loclist[n]['text'] =~? '^W' ? 'W' : 'E' diff --git a/syntax_checkers/python/py3kwarn.vim b/syntax_checkers/python/py3kwarn.vim index bb76aa772..44d036551 100644 --- a/syntax_checkers/python/py3kwarn.vim +++ b/syntax_checkers/python/py3kwarn.vim @@ -15,10 +15,15 @@ endfunction function! SyntaxCheckers_python_py3kwarn_GetLocList() let makeprg = syntastic#makeprg#build({ - \ 'exe': 'py3kwarn', - \ 'subchecker': 'py3kwarn' }) + \ 'exe': 'py3kwarn', + \ 'filetype': 'python', + \ 'subchecker': 'py3kwarn' }) + let errorformat = '%W%f:%l:%c: %m' - return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) + + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/syntax_checkers/python/pyflakes.vim b/syntax_checkers/python/pyflakes.vim index de434414e..80351367d 100644 --- a/syntax_checkers/python/pyflakes.vim +++ b/syntax_checkers/python/pyflakes.vim @@ -33,8 +33,10 @@ endfunction function! SyntaxCheckers_python_pyflakes_GetLocList() let makeprg = syntastic#makeprg#build({ - \ 'exe': 'pyflakes', - \ 'subchecker': 'pyflakes' }) + \ 'exe': 'pyflakes', + \ 'filetype': 'python', + \ 'subchecker': 'pyflakes' }) + let errorformat = \ '%E%f:%l: could not compile,'. \ '%-Z%p^,'. @@ -42,9 +44,10 @@ function! SyntaxCheckers_python_pyflakes_GetLocList() \ '%E%f:%l: %m,'. \ '%-G%.%#' - return SyntasticMake({ 'makeprg': makeprg, - \ 'errorformat': errorformat, - \ 'defaults': {'text': "Syntax error"} }) + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'defaults': {'text': "Syntax error"} }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/syntax_checkers/python/pylint.vim b/syntax_checkers/python/pylint.vim index b7bfa1227..923664d40 100644 --- a/syntax_checkers/python/pylint.vim +++ b/syntax_checkers/python/pylint.vim @@ -17,7 +17,9 @@ function! SyntaxCheckers_python_pylint_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'pylint', \ 'args': ' -f parseable -r n -i y', + \ 'filetype': 'python', \ 'subchecker': 'pylint' }) + let errorformat = \ '%A%f:%l:%m,' . \ '%A%f:(%l):%m,' . diff --git a/syntax_checkers/python/python.vim b/syntax_checkers/python/python.vim index 8ede8fd11..7169a6f67 100644 --- a/syntax_checkers/python/python.vim +++ b/syntax_checkers/python/python.vim @@ -18,18 +18,24 @@ endfunction function! SyntaxCheckers_python_python_GetLocList() let fname = "'" . escape(expand('%'), "\\'") . "'" + let makeprg = syntastic#makeprg#build({ \ 'exe': 'python', \ 'args': '-c', \ 'fname': shellescape("compile(open(" . fname . ").read(), " . fname . ", 'exec')"), + \ 'filetype': 'python', \ 'subchecker': 'python' }) + let errorformat = \ '%E File "%f"\, line %l,' . \ '%C %p^,' . \ '%C %.%#,' . \ '%Z%m,' . \ '%-G%.%#' - return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) + + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/syntax_checkers/rst/rst2pseudoxml.vim b/syntax_checkers/rst/rst2pseudoxml.vim index 734cff3a3..dcdcf062e 100644 --- a/syntax_checkers/rst/rst2pseudoxml.vim +++ b/syntax_checkers/rst/rst2pseudoxml.vim @@ -24,10 +24,11 @@ endfunction function! SyntaxCheckers_rst_rst2pseudoxml_GetLocList() let makeprg = syntastic#makeprg#build({ - \ 'exe': s:exe(), - \ 'args': '--report=2 --exit-status=1', - \ 'tail': syntastic#util#DevNull(), - \ 'subchecker': 'rst2pseudoxml' }) + \ 'exe': s:exe(), + \ 'args': '--report=2 --exit-status=1', + \ 'tail': syntastic#util#DevNull(), + \ 'filetype': 'rst', + \ 'subchecker': 'rst2pseudoxml' }) let errorformat = \ '%f:%l:\ (%tNFO/1)\ %m,'. @@ -36,7 +37,9 @@ function! SyntaxCheckers_rst_rst2pseudoxml_GetLocList() \ '%f:%l:\ (%tEVERE/4)\ %m,'. \ '%-G%.%#' - return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat }) endfunction function s:exe() diff --git a/syntax_checkers/ruby/jruby.vim b/syntax_checkers/ruby/jruby.vim index d421741c8..bef2b5f5e 100644 --- a/syntax_checkers/ruby/jruby.vim +++ b/syntax_checkers/ruby/jruby.vim @@ -20,9 +20,10 @@ endfunction function! SyntaxCheckers_ruby_jruby_GetLocList() let makeprg = syntastic#makeprg#build({ - \ 'exe': s:exe(), - \ 'args': s:args(), - \ 'subchecker': 'jruby' }) + \ 'exe': s:exe(), + \ 'args': s:args(), + \ 'filetype': 'ruby', + \ 'subchecker': 'jruby' }) let errorformat = \ '%-GSyntax OK for %f,'. @@ -33,7 +34,9 @@ function! SyntaxCheckers_ruby_jruby_GetLocList() \ '%W%f:%l: %m,'. \ '%-C%.%#' - return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat }) endfunction function s:args() diff --git a/syntax_checkers/ruby/macruby.vim b/syntax_checkers/ruby/macruby.vim index 02c1a7d30..9226e41eb 100644 --- a/syntax_checkers/ruby/macruby.vim +++ b/syntax_checkers/ruby/macruby.vim @@ -19,9 +19,11 @@ endfunction function! SyntaxCheckers_ruby_macruby_GetLocList() let makeprg = syntastic#makeprg#build({ - \ 'exe': 'RUBYOPT= macruby', - \ 'args': '-W1 -c', - \ 'subchecker': 'macruby' }) + \ 'exe': 'RUBYOPT= macruby', + \ 'args': '-W1 -c', + \ 'filetype': 'ruby', + \ 'subchecker': 'macruby' }) + let errorformat = \ '%-GSyntax OK,'. \ '%E%f:%l: syntax error\, %m,'. @@ -30,7 +32,10 @@ function! SyntaxCheckers_ruby_macruby_GetLocList() \ '%Z%p^,'. \ '%W%f:%l: %m,'. \ '%-C%.%#' - return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) + + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/syntax_checkers/ruby/mri.vim b/syntax_checkers/ruby/mri.vim index 3438e132b..27a46a481 100644 --- a/syntax_checkers/ruby/mri.vim +++ b/syntax_checkers/ruby/mri.vim @@ -39,9 +39,10 @@ function! SyntaxCheckers_ruby_mri_GetLocList() endif let makeprg = syntastic#makeprg#build({ - \ 'exe': exe, - \ 'args': '-w -T1 -c', - \ 'subchecker': 'mri' }) + \ 'exe': exe, + \ 'args': '-w -T1 -c', + \ 'filetype': 'ruby', + \ 'subchecker': 'mri' }) "this is a hack to filter out a repeated useless warning in rspec files "containing lines like @@ -65,7 +66,10 @@ function! SyntaxCheckers_ruby_mri_GetLocList() \ '%Z%p^,'. \ '%W%f:%l: %m,'. \ '%-C%.%#' - return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) + + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/syntax_checkers/ruby/rubocop.vim b/syntax_checkers/ruby/rubocop.vim index 9570c4a7b..cf9b979cf 100644 --- a/syntax_checkers/ruby/rubocop.vim +++ b/syntax_checkers/ruby/rubocop.vim @@ -24,16 +24,17 @@ endfunction function! SyntaxCheckers_ruby_rubocop_GetLocList() let makeprg = syntastic#makeprg#build({ - \ 'exe': 'rubocop', - \ 'args': '--emacs --silent', - \ 'subchecker': 'rubocop' }) + \ 'exe': 'rubocop', + \ 'args': '--emacs --silent', + \ 'filetype': 'ruby', + \ 'subchecker': 'rubocop' }) let errorformat = '%f:%l:\ %t:\ %m' let loclist = SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat, - \ 'subtype': 'Style'}) + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'subtype': 'Style'}) " convert rubocop severities to error types recognized by syntastic for n in range(len(loclist)) diff --git a/syntax_checkers/rust/rustc.vim b/syntax_checkers/rust/rustc.vim index 28268b334..e88b4cf98 100644 --- a/syntax_checkers/rust/rustc.vim +++ b/syntax_checkers/rust/rustc.vim @@ -21,9 +21,10 @@ endfunction function! SyntaxCheckers_rust_rustc_GetLocList() let makeprg = syntastic#makeprg#build({ - \ 'exe': 'rustc', - \ 'args': '--parse-only', - \ 'subchecker': 'rustc' }) + \ 'exe': 'rustc', + \ 'args': '--parse-only', + \ 'filetype': 'rust', + \ 'subchecker': 'rustc' }) let errorformat = \ '%E%f:%l:%c: \\d%#:\\d%# %.%\{-}error:%.%\{-} %m,' . @@ -31,7 +32,9 @@ function! SyntaxCheckers_rust_rustc_GetLocList() \ '%C%f:%l %m,' . \ '%-Z%.%#' - return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/syntax_checkers/sass/sass.vim b/syntax_checkers/sass/sass.vim index de99c617c..15b852640 100644 --- a/syntax_checkers/sass/sass.vim +++ b/syntax_checkers/sass/sass.vim @@ -37,11 +37,14 @@ endif function! SyntaxCheckers_sass_sass_GetLocList() if !g:syntastic_sass_check_partials && expand('%:t')[0] == '_' return [] - end + endif + let makeprg = syntastic#makeprg#build({ \ 'exe': 'sass', \ 'args': '--cache-location ' . s:sass_cache_location . ' ' . s:imports . ' --check', + \ 'filetype': 'sass', \ 'subchecker': 'sass' }) + let errorformat = \ '%ESyntax %trror:%m,' . \ '%C on line %l of %f,' . @@ -50,7 +53,9 @@ function! SyntaxCheckers_sass_sass_GetLocList() \ '%Z%m,' . \ 'Syntax %trror on line %l: %m' - return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/syntax_checkers/scala/scalac.vim b/syntax_checkers/scala/scalac.vim index a2394c104..9bd288ece 100644 --- a/syntax_checkers/scala/scalac.vim +++ b/syntax_checkers/scala/scalac.vim @@ -26,13 +26,16 @@ endif function! SyntaxCheckers_scala_scalac_GetLocList() let makeprg = syntastic#makeprg#build({ - \ 'exe': 'scalac', - \ 'args': '-Ystop-after:parser '. g:syntastic_scala_options, - \ 'subchecker': 'scalac' }) + \ 'exe': 'scalac', + \ 'args': '-Ystop-after:parser '. g:syntastic_scala_options, + \ 'filetype': 'scala', + \ 'subchecker': 'scalac' }) let errorformat = '%f\:%l: %trror: %m' - return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/syntax_checkers/sh/checkbashisms.vim b/syntax_checkers/sh/checkbashisms.vim index 744b00061..ed3645b0e 100644 --- a/syntax_checkers/sh/checkbashisms.vim +++ b/syntax_checkers/sh/checkbashisms.vim @@ -21,6 +21,7 @@ function! SyntaxCheckers_sh_checkbashisms_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'checkbashisms', \ 'args': '-fpx', + \ 'filetype': 'sh', \ 'subchecker': 'checkbashisms'}) let errorformat = @@ -32,7 +33,10 @@ function! SyntaxCheckers_sh_checkbashisms_GetLocList() \ '%Wpossible bashism in %f line %l (%m):,%C%.%#,%Z.%#,' . \ '%-G%.%#' - return SyntasticMake({'makeprg': makeprg, 'errorformat': errorformat, 'subtype': 'Style'}) + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'subtype': 'Style'}) endfunction diff --git a/syntax_checkers/sh/sh.vim b/syntax_checkers/sh/sh.vim index 55b841e77..8c44960b8 100644 --- a/syntax_checkers/sh/sh.vim +++ b/syntax_checkers/sh/sh.vim @@ -66,12 +66,16 @@ function! SyntaxCheckers_sh_sh_GetLocList() endif let makeprg = syntastic#makeprg#build({ - \ 'exe': s:GetShell(), - \ 'args': '-n', - \ 'subchecker': 'sh'}) + \ 'exe': s:GetShell(), + \ 'args': '-n', + \ 'filetype': 'sh', + \ 'subchecker': 'sh'}) let errorformat = '%f: line %l: %m' - return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat}) + + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat}) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/syntax_checkers/slim/slimrb.vim b/syntax_checkers/slim/slimrb.vim index 342203373..106a1b515 100644 --- a/syntax_checkers/slim/slimrb.vim +++ b/syntax_checkers/slim/slimrb.vim @@ -30,7 +30,9 @@ function! SyntaxCheckers_slim_slimrb_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'slimrb', \ 'args': '-c', + \ 'filetype': 'slim', \ 'subchecker': 'slimrb' }) + if syntastic#util#versionIsAtLeast(s:SlimrbVersion(), [1,3,1]) let errorformat = \ '%C\ %#%f\, Line %l\, Column %c,'. @@ -44,7 +46,10 @@ function! SyntaxCheckers_slim_slimrb_GetLocList() \ '%ESlim::Parser::SyntaxError: %m,'. \ '%+C%.%#' endif - return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) + + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/syntax_checkers/tcl/nagelfar.vim b/syntax_checkers/tcl/nagelfar.vim index 046120ac5..b93b17b93 100644 --- a/syntax_checkers/tcl/nagelfar.vim +++ b/syntax_checkers/tcl/nagelfar.vim @@ -22,15 +22,19 @@ endfunction function! SyntaxCheckers_tcl_nagelfar_GetLocList() let makeprg = syntastic#makeprg#build({ - \ 'exe': 'nagelfar', - \ 'args': '-H ' . g:syntastic_tcl_nagelfar_conf, - \ 'subchecker': 'nagelfar' }) + \ 'exe': 'nagelfar', + \ 'args': '-H ' . g:syntastic_tcl_nagelfar_conf, + \ 'filetype': 'tcl', + \ 'subchecker': 'nagelfar' }) + let errorformat = \ '%I%f: %l: N %m,'. \ '%f: %l: %t %m,'. \ '%-GChecking file %f' - return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/syntax_checkers/tex/chktex.vim b/syntax_checkers/tex/chktex.vim index d0fb30cbf..d7a55e0f0 100644 --- a/syntax_checkers/tex/chktex.vim +++ b/syntax_checkers/tex/chktex.vim @@ -40,6 +40,7 @@ function! SyntaxCheckers_tex_chktex_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'chktex', \ 'post_args': '-q -v1', + \ 'filetype': 'tex', \ 'subchecker': 'chktex' }) let errorformat = diff --git a/syntax_checkers/tex/lacheck.vim b/syntax_checkers/tex/lacheck.vim index a8d8d6bf8..38510e856 100644 --- a/syntax_checkers/tex/lacheck.vim +++ b/syntax_checkers/tex/lacheck.vim @@ -20,9 +20,16 @@ function! SyntaxCheckers_tex_lacheck_IsAvailable() endfunction function! SyntaxCheckers_tex_lacheck_GetLocList() - let makeprg = syntastic#makeprg#build({ 'exe': 'lacheck', 'subchecker': 'lacheck' }) + let makeprg = syntastic#makeprg#build({ + \ 'exe': 'lacheck', + \ 'filetype': 'tex', + \ 'subchecker': 'lacheck' }) + let errorformat = '%-G** %f:,%E"%f"\, line %l: %m' - return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) + + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/syntax_checkers/text/atdtool.vim b/syntax_checkers/text/atdtool.vim index 0a687b2a5..62d62b1ca 100644 --- a/syntax_checkers/text/atdtool.vim +++ b/syntax_checkers/text/atdtool.vim @@ -27,6 +27,7 @@ function! SyntaxCheckers_text_atdtool_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'atdtool', \ 'tail': '2>/dev/null', + \ 'filetype': 'text', \ 'subchecker': 'atdtool' }) let errorformat = diff --git a/syntax_checkers/twig/twiglint.vim b/syntax_checkers/twig/twiglint.vim index 919ec48bb..7cbba5f48 100644 --- a/syntax_checkers/twig/twiglint.vim +++ b/syntax_checkers/twig/twiglint.vim @@ -26,12 +26,16 @@ endfunction function! SyntaxCheckers_twig_twiglint_GetLocList() let makeprg = syntastic#makeprg#build({ - \ 'exe': 'twig-lint', - \ 'args': 'lint --format=csv', - \ 'subchecker': 'twiglint' }) + \ 'exe': 'twig-lint', + \ 'args': 'lint --format=csv', + \ 'filetype': 'twig', + \ 'subchecker': 'twiglint' }) let errorformat = '"%f"\,%l\,%m' - return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat}) + + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat}) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/syntax_checkers/typescript/tsc.vim b/syntax_checkers/typescript/tsc.vim index a3279c36d..784698224 100644 --- a/syntax_checkers/typescript/tsc.vim +++ b/syntax_checkers/typescript/tsc.vim @@ -16,11 +16,16 @@ endfunction function! SyntaxCheckers_typescript_tsc_GetLocList() let makeprg = syntastic#makeprg#build({ - \ 'exe': 'tsc', - \ 'post_args': '--out ' . syntastic#util#DevNull(), - \ 'subchecker': 'tsc' }) + \ 'exe': 'tsc', + \ 'post_args': '--out ' . syntastic#util#DevNull(), + \ 'filetype': 'typescript', + \ 'subchecker': 'tsc' }) + let errorformat = '%f %#(%l\,%c): %m' - return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) + + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/syntax_checkers/vala/valac.vim b/syntax_checkers/vala/valac.vim index b4ede28ad..09b6c28b7 100644 --- a/syntax_checkers/vala/valac.vim +++ b/syntax_checkers/vala/valac.vim @@ -55,16 +55,18 @@ endfunction function! SyntaxCheckers_vala_valac_GetLocList() let vala_pkg_args = join(map(s:GetValaModules(), '"--pkg ".v:val'), ' ') let makeprg = syntastic#makeprg#build({ - \ 'exe': 'valac', - \ 'args': '-C ' . vala_pkg_args, - \ 'subchecker': 'valac' }) + \ 'exe': 'valac', + \ 'args': '-C ' . vala_pkg_args, + \ 'filetype': 'vala', + \ 'subchecker': 'valac' }) let errorformat = \ '%A%f:%l.%c-%\d%\+.%\d%\+: %t%[a-z]%\+: %m,'. \ '%C%m,'. \ '%Z%m' - return SyntasticMake({ 'makeprg': makeprg, - \ 'errorformat': errorformat }) + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/syntax_checkers/vhdl/ghdl.vim b/syntax_checkers/vhdl/ghdl.vim index 4c7a39f75..7158cd78f 100644 --- a/syntax_checkers/vhdl/ghdl.vim +++ b/syntax_checkers/vhdl/ghdl.vim @@ -20,12 +20,16 @@ endfunction function! SyntaxCheckers_vhdl_ghdl_GetLocList() let makeprg = syntastic#makeprg#build({ - \ 'exe': 'ghdl', - \ 'args': '-s', - \ 'subchecker': 'ghdl' }) + \ 'exe': 'ghdl', + \ 'args': '-s', + \ 'filetype': 'vhdl', + \ 'subchecker': 'ghdl' }) + let errorformat = '%f:%l:%c: %m' - return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/syntax_checkers/xhtml/tidy.vim b/syntax_checkers/xhtml/tidy.vim index 2983866a7..9431e568f 100644 --- a/syntax_checkers/xhtml/tidy.vim +++ b/syntax_checkers/xhtml/tidy.vim @@ -61,12 +61,18 @@ function! SyntaxCheckers_xhtml_tidy_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'tidy', \ 'args': encopt . ' -xml -e', + \ 'filetype': 'xhtml', \ 'subchecker': 'tidy' }) + let errorformat= \ '%Wline %l column %v - Warning: %m,' . \ '%Eline %l column %v - Error: %m,' . \ '%-G%.%#' - let loclist = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat, 'defaults': {'bufnr': bufnr("")} }) + + let loclist = SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'defaults': {'bufnr': bufnr("")} }) for n in range(len(loclist)) if loclist[n]['valid'] && s:IgnoreErrror(loclist[n]['text']) == 1 diff --git a/syntax_checkers/xml/xmllint.vim b/syntax_checkers/xml/xmllint.vim index b44397995..f0715a25c 100644 --- a/syntax_checkers/xml/xmllint.vim +++ b/syntax_checkers/xml/xmllint.vim @@ -25,9 +25,11 @@ endfunction function! SyntaxCheckers_xml_xmllint_GetLocList() let makeprg = syntastic#makeprg#build({ - \ 'exe': 'xmllint', - \ 'args': '--xinclude --noout --postvalid', - \ 'subchecker': 'xmllint' }) + \ 'exe': 'xmllint', + \ 'args': '--xinclude --noout --postvalid', + \ 'filetype': 'xml', + \ 'subchecker': 'xmllint' }) + let errorformat= \ '%E%f:%l: error : %m,' . \ '%-G%f:%l: validity error : Validation failed: no DTD found %m,' . @@ -38,9 +40,10 @@ function! SyntaxCheckers_xml_xmllint_GetLocList() \ '%E%f:%l: %m,' . \ '%-Z%p^,' . \ '%-G%.%#' - let loclist = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) - return loclist + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/syntax_checkers/yaml/jsyaml.vim b/syntax_checkers/yaml/jsyaml.vim index bc91f1bbb..9ffdc658e 100644 --- a/syntax_checkers/yaml/jsyaml.vim +++ b/syntax_checkers/yaml/jsyaml.vim @@ -24,13 +24,17 @@ endfunction function! SyntaxCheckers_yaml_jsyaml_GetLocList() let makeprg = syntastic#makeprg#build({ - \ 'exe': 'js-yaml', - \ 'args': '--compact', - \ 'subchecker': 'jsyaml' }) + \ 'exe': 'js-yaml', + \ 'args': '--compact', + \ 'filetype': 'yaml', + \ 'subchecker': 'jsyaml' }) + let errorformat='Error on line %l\, col %c:%m,%-G%.%#' - return SyntasticMake({ 'makeprg': makeprg, - \ 'errorformat': errorformat, - \ 'defaults': {'bufnr': bufnr("")} }) + + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'defaults': {'bufnr': bufnr("")} }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/syntax_checkers/z80/z80syntaxchecker.vim b/syntax_checkers/z80/z80syntaxchecker.vim index bb8af00da..b68acf130 100644 --- a/syntax_checkers/z80/z80syntaxchecker.vim +++ b/syntax_checkers/z80/z80syntaxchecker.vim @@ -26,10 +26,14 @@ endfunction function! SyntaxCheckers_z80_z80syntaxchecker_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'z80_syntax_checker.py', + \ 'filetype': 'z80', \ 'subchecker': 'z80syntaxchecker' }) + let errorformat = '%f:%l %m' - let loclist = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) - return loclist + + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/syntax_checkers/zpt/zptlint.vim b/syntax_checkers/zpt/zptlint.vim index 573906323..ae6ab8a31 100644 --- a/syntax_checkers/zpt/zptlint.vim +++ b/syntax_checkers/zpt/zptlint.vim @@ -29,13 +29,20 @@ function! SyntaxCheckers_zpt_zptlint_IsAvailable() endfunction function! SyntaxCheckers_zpt_zptlint_GetLocList() - let makeprg = syntastic#makeprg#build({ 'exe': 'zptlint', 'subchecker': 'zptlint' }) + let makeprg = syntastic#makeprg#build({ + \ 'exe': 'zptlint', + \ 'filetype': 'zpt', + \ 'subchecker': 'zptlint' }) + let errorformat= \ '%-P*** Error in: %f,'. \ '%Z%*\s\, at line %l\, column %c,'. \ '%E%*\s%m,'. \ '%-Q' - return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) + + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/syntax_checkers/zsh/zsh.vim b/syntax_checkers/zsh/zsh.vim index 6cb776c5d..5e339a9c6 100644 --- a/syntax_checkers/zsh/zsh.vim +++ b/syntax_checkers/zsh/zsh.vim @@ -23,9 +23,14 @@ function! SyntaxCheckers_zsh_zsh_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'zsh', \ 'args': '-n', + \ 'filetype': 'zsh', \ 'subchecker': 'zsh' }) + let errorformat = '%f:%l: %m' - return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat}) + + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat}) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ From f2257b2cb182e83c43c9847e8dd212d8a079cd4b Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 31 May 2013 21:31:35 +0300 Subject: [PATCH 0027/1271] Atdtool: make syntax highlighting more robust. --- syntax_checkers/text/atdtool.vim | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/syntax_checkers/text/atdtool.vim b/syntax_checkers/text/atdtool.vim index 62d62b1ca..5cc99b873 100644 --- a/syntax_checkers/text/atdtool.vim +++ b/syntax_checkers/text/atdtool.vim @@ -20,7 +20,12 @@ function! SyntaxCheckers_text_atdtool_IsAvailable() endfunction function! SyntaxCheckers_text_atdtool_GetHighlightRegex(item) - return matchstr(a:item['text'], '\m "\zs[^"]\+\ze"\($\| | suggestions:\)') + let term = matchstr(a:item['text'], '\m "\zs[^"]\+\ze"\($\| | suggestions:\)') + if term != '' + let col = get(a:item, 'col', 0) + let term = (col != 0 ? '\%' . col . 'c' : '') . '\V' . term + endif + return term endfunction function! SyntaxCheckers_text_atdtool_GetLocList() From 88b00dcef9ce9540f0174d1d6899b39c579eda96 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Sat, 1 Jun 2013 07:45:42 +0300 Subject: [PATCH 0028/1271] Cleanup: method naming. --- plugin/syntastic.vim | 8 ++++---- plugin/syntastic/checker.vim | 4 ++-- plugin/syntastic/loclist.vim | 2 +- plugin/syntastic/modemap.vim | 5 +++++ plugin/syntastic/notifiers.vim | 29 ++++++++++++++++++----------- plugin/syntastic/registry.vim | 18 +++++++++--------- 6 files changed, 39 insertions(+), 27 deletions(-) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 1bbca8884..5c2e770b9 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -57,14 +57,14 @@ if !exists("g:syntastic_filetype_map") endif let s:registry = g:SyntasticRegistry.Instance() -let s:notifiers = g:SyntasticNotifiers.New() +let s:notifiers = g:SyntasticNotifiers.Instance() let s:modemap = g:SyntasticModeMap.Instance() function! s:CompleteCheckerName(argLead, cmdLine, cursorPos) let checker_names = [] for ft in s:CurrentFiletypes() for checker in s:registry.availableCheckersFor(ft) - call add(checker_names, checker.name()) + call add(checker_names, checker.getName()) endfor endfor return join(checker_names, "\n") @@ -172,7 +172,7 @@ function! s:CacheErrors(...) endif for checker in checkers - call syntastic#util#debug("CacheErrors: Invoking checker: " . checker.name()) + call syntastic#util#debug("CacheErrors: Invoking checker: " . checker.getName()) let loclist = checker.getLocList() @@ -258,7 +258,7 @@ endfunction function! SyntasticStatuslineFlag() let loclist = g:SyntasticLoclist.current() let issues = loclist.filteredRaw() - let num_issues = loclist.length() + let num_issues = loclist.getLength() if loclist.hasErrorsOrWarningsToDisplay() let errors = loclist.errors() let warnings = loclist.warnings() diff --git a/plugin/syntastic/checker.vim b/plugin/syntastic/checker.vim index 5f4e8fd30..a5a54cba9 100644 --- a/plugin/syntastic/checker.vim +++ b/plugin/syntastic/checker.vim @@ -27,11 +27,11 @@ function! g:SyntasticChecker.New(args) return newObj endfunction -function! g:SyntasticChecker.filetype() +function! g:SyntasticChecker.getFiletype() return self._filetype endfunction -function! g:SyntasticChecker.name() +function! g:SyntasticChecker.getName() return self._name endfunction diff --git a/plugin/syntastic/loclist.vim b/plugin/syntastic/loclist.vim index 2dd0bd5a1..637c6b822 100644 --- a/plugin/syntastic/loclist.vim +++ b/plugin/syntastic/loclist.vim @@ -55,7 +55,7 @@ function! g:SyntasticLoclist.isEmpty() return empty(self._rawLoclist) endfunction -function! g:SyntasticLoclist.length() +function! g:SyntasticLoclist.getLength() return len(self._rawLoclist) endfunction diff --git a/plugin/syntastic/modemap.vim b/plugin/syntastic/modemap.vim index 058c695a3..2a838883b 100644 --- a/plugin/syntastic/modemap.vim +++ b/plugin/syntastic/modemap.vim @@ -5,6 +5,8 @@ let g:loaded_syntastic_modemap = 1 let g:SyntasticModeMap = {} +" Public methods {{{1 + function! g:SyntasticModeMap.Instance() if !exists('s:SyntasticModeMapInstance') let s:SyntasticModeMapInstance = copy(self) @@ -40,6 +42,8 @@ function! g:SyntasticModeMap.echoMode() echo "Syntastic: " . self._mode . " mode enabled" endfunction +" Private methods {{{1 + function! g:SyntasticModeMap._initModeMapFromGlobalOpts() let self._mode = "active" let self._activeFiletypes = [] @@ -60,3 +64,4 @@ function! g:SyntasticModeMap._noFiletypesArePassive(filetypes) return empty(filter(a:filetypes, 'index(self._passiveFiletypes, v:val) != -1')) endfunction +" vim: set sw=4 sts=4 et fdm=marker: diff --git a/plugin/syntastic/notifiers.vim b/plugin/syntastic/notifiers.vim index 5a7c84329..1a7766aad 100644 --- a/plugin/syntastic/notifiers.vim +++ b/plugin/syntastic/notifiers.vim @@ -9,18 +9,13 @@ let s:notifier_types = ['signs', 'balloons', 'highlighting', 'cursor', 'autolocl " Public methods {{{1 -function! g:SyntasticNotifiers.New() - let newObj = copy(self) +function! g:SyntasticNotifiers.Instance() + if !exists('s:SyntasticNotifiersInstance') + let s:SyntasticNotifiersInstance = copy(self) + call s:SyntasticNotifiersInstance._initNotifiers() + endif - let newObj._notifier = {} - for type in s:notifier_types - let class = substitute(type, '.*', 'Syntastic\u&Notifier', '') - let newObj._notifier[type] = g:{class}.New() - endfor - - let newObj._enabled_types = copy(s:notifier_types) - - return newObj + return s:SyntasticNotifiersInstance endfunction function! g:SyntasticNotifiers.refresh(loclist) @@ -41,4 +36,16 @@ function! g:SyntasticNotifiers.reset(loclist) endfor endfunction +" Private methods {{{1 + +function! g:SyntasticNotifiers._initNotifiers() + let self._notifier = {} + for type in s:notifier_types + let class = substitute(type, '.*', 'Syntastic\u&Notifier', '') + let self._notifier[type] = g:{class}.New() + endfor + + let self._enabled_types = copy(s:notifier_types) +endfunction + " vim: set sw=4 sts=4 et fdm=marker: diff --git a/plugin/syntastic/registry.vim b/plugin/syntastic/registry.vim index 3905324f0..9842809b8 100644 --- a/plugin/syntastic/registry.vim +++ b/plugin/syntastic/registry.vim @@ -47,7 +47,7 @@ function! g:SyntasticRegistry.CreateAndRegisterChecker(args) endfunction function! g:SyntasticRegistry.registerChecker(checker) abort - let ft = a:checker.filetype() + let ft = a:checker.getFiletype() if !has_key(self._checkerMap, ft) let self._checkerMap[ft] = [] @@ -85,7 +85,7 @@ endfunction function! g:SyntasticRegistry.getChecker(ftalias, name) for checker in self.availableCheckersFor(a:ftalias) - if checker.name() == a:name + if checker.getName() == a:name return checker endif endfor @@ -109,8 +109,8 @@ function! g:SyntasticRegistry.echoInfoFor(ftalias_list) call extend(active, self.getActiveCheckers(ftalias)) endfor - echomsg "Available checkers: " . join(syntastic#util#unique(map(available, "v:val.name()"))) - echomsg "Currently active checker(s): " . join(syntastic#util#unique(map(active, "v:val.name()"))) + echomsg "Available checkers: " . join(syntastic#util#unique(map(available, "v:val.getName()"))) + echomsg "Currently active checker(s): " . join(syntastic#util#unique(map(active, "v:val.getName()"))) endfunction " Private methods {{{1 @@ -127,7 +127,7 @@ endfunction function! g:SyntasticRegistry._filterCheckersByDefaultSettings(checkers, filetype) if has_key(s:defaultCheckers, a:filetype) let whitelist = s:defaultCheckers[a:filetype] - return filter(a:checkers, "index(whitelist, v:val.name()) != -1") + return filter(a:checkers, "index(whitelist, v:val.getName()) != -1") endif return a:checkers @@ -139,7 +139,7 @@ function! g:SyntasticRegistry._filterCheckersByUserSettings(checkers, filetype) else let whitelist = g:syntastic_{a:filetype}_checkers endif - return filter(a:checkers, "index(whitelist, v:val.name()) != -1") + return filter(a:checkers, "index(whitelist, v:val.getName()) != -1") endfunction function! g:SyntasticRegistry._filterCheckersByAvailability(checkers) @@ -171,9 +171,9 @@ function! g:SyntasticRegistry._userHasFiletypeSettings(filetype) endfunction function! g:SyntasticRegistry._validateUniqueName(checker) abort - for checker in self._allCheckersFor(a:checker.filetype()) - if checker.name() == a:checker.name() - throw "Syntastic: Duplicate syntax checker name for: " . a:checker.name() + for checker in self._allCheckersFor(a:checker.getFiletype()) + if checker.getName() == a:checker.getName() + throw "Syntastic: Duplicate syntax checker name for: " . a:checker.getName() endif endfor endfunction From 50fd2f2da9415ab6a240becc7cd2529a8e8a99cf Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Sun, 2 Jun 2013 13:28:49 +0300 Subject: [PATCH 0029/1271] Bug fix: nasm output. --- syntax_checkers/nasm/nasm.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntax_checkers/nasm/nasm.vim b/syntax_checkers/nasm/nasm.vim index 7b5020b63..2b508c243 100644 --- a/syntax_checkers/nasm/nasm.vim +++ b/syntax_checkers/nasm/nasm.vim @@ -22,7 +22,7 @@ function! SyntaxCheckers_nasm_nasm_GetLocList() let wd = shellescape(expand("%:p:h") . "/") let makeprg = syntastic#makeprg#build({ \ 'exe': 'nasm', - \ 'args': '-X gnu -f elf -I ' . wd . ' -o ' . outfile, + \ 'args': '-X gnu -f elf -I ' . wd . ' ' . syntastic#c#NullOutput('nasm'), \ 'filetype': 'nasm', \ 'subchecker': 'nasm' }) From e2c9349ae84b3c11de0d3847b23ca7c0ada388bf Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Sun, 2 Jun 2013 18:28:42 +0300 Subject: [PATCH 0030/1271] Update description of syntastic#makeprg#build(). --- autoload/syntastic/makeprg.vim | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/autoload/syntastic/makeprg.vim b/autoload/syntastic/makeprg.vim index b032e1235..4d7a0331f 100644 --- a/autoload/syntastic/makeprg.vim +++ b/autoload/syntastic/makeprg.vim @@ -17,13 +17,17 @@ let g:loaded_syntastic_makeprg_autoload = 1 " \ 'args': '-a -b -c', " \ 'post_args': '--more --args', " \ 'tail': '> /tmp/output', +" \ 'filetype': 'ruby', " \ 'subchecker': 'mri' }) " "Note that the current filename is added by default - but can be overridden by "passing in an 'fname' arg. " -"All options can be overriden by the user with global variables - even when -"not specified by the checker in syntastic#makeprg#build(). +"Arguments 'filetype' and 'subchecker' are mandatory, handling of composite +"types and user-defined variables breaks if you omit them. +" +"All other options can be overriden by the user with global variables - even +"when not specified by the checker in syntastic#makeprg#build(). " "E.g. They could override the checker exe with " From 1a23bb2d562770b56dbac5c0a77f1459dcb27dbd Mon Sep 17 00:00:00 2001 From: hirochachacha Date: Tue, 4 Jun 2013 01:12:04 +0900 Subject: [PATCH 0031/1271] add golint to syntax_checkers --- syntax_checkers/go/golint.vim | 37 +++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 syntax_checkers/go/golint.vim diff --git a/syntax_checkers/go/golint.vim b/syntax_checkers/go/golint.vim new file mode 100644 index 000000000..954a7c2a6 --- /dev/null +++ b/syntax_checkers/go/golint.vim @@ -0,0 +1,37 @@ +"============================================================================ +"File: golint.vim +"Description: Check go syntax using 'golint' +"Maintainer: Hiroshi Ioka +"License: This program is free software. It comes without any warranty, +" to the extent permitted by applicable law. You can redistribute +" it and/or modify it under the terms of the Do What The Fuck You +" Want To Public License, Version 2, as published by Sam Hocevar. +" See http://sam.zoy.org/wtfpl/COPYING for more details. +" +"============================================================================ +if exists("g:loaded_syntastic_go_golint_checker") + finish +endif +let g:loaded_syntastic_go_golint_checker=1 + +function! SyntaxCheckers_go_golint_IsAvailable() + return executable('golint') +endfunction + +function! SyntaxCheckers_go_golint_GetLocList() + let makeprg = syntastic#makeprg#build({ + \ 'exe': 'golint', + \ 'filetype': 'go', + \ 'subchecker': 'golint' }) + + let errorformat = '%f:%l:%c: %m,%-G%.%#' + + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'subtype': 'Style' }) +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'go', + \ 'name': 'golint'}) From 3c698030533ec8390afce367083a4019a49e3293 Mon Sep 17 00:00:00 2001 From: William Ting Date: Tue, 4 Jun 2013 07:53:06 -0500 Subject: [PATCH 0032/1271] fix errror misspellings --- doc/syntastic.txt | 2 +- syntax_checkers/html/tidy.vim | 4 ++-- syntax_checkers/xhtml/tidy.vim | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/syntastic.txt b/doc/syntastic.txt index 5a43f6bfe..84ddfb517 100644 --- a/doc/syntastic.txt +++ b/doc/syntastic.txt @@ -175,7 +175,7 @@ variable to 0. > *'syntastic_echo_current_error'* Default: 1 -If enabled, syntastic will echo the errror associated with the current line to +If enabled, syntastic will echo the error associated with the current line to the command window. If multiple errors are found, the first will be used. > let g:syntastic_echo_current_error=1 < diff --git a/syntax_checkers/html/tidy.vim b/syntax_checkers/html/tidy.vim index 957dd6ee4..0f528026b 100644 --- a/syntax_checkers/html/tidy.vim +++ b/syntax_checkers/html/tidy.vim @@ -63,7 +63,7 @@ let s:ignore_html_errors = [ \ " attribute \"type\" has invalid value \"search\"" \ ] -function! s:IgnoreErrror(text) +function! s:IgnoreError(text) for i in s:ignore_html_errors + g:syntastic_html_tidy_ignore_errors if stridx(a:text, i) != -1 return 1 @@ -101,7 +101,7 @@ function! SyntaxCheckers_html_tidy_GetLocList() " filter out valid HTML5 from the errors for n in range(len(loclist)) - if loclist[n]['valid'] && s:IgnoreErrror(loclist[n]['text']) == 1 + if loclist[n]['valid'] && s:IgnoreError(loclist[n]['text']) == 1 let loclist[n]['valid'] = 0 endif endfor diff --git a/syntax_checkers/xhtml/tidy.vim b/syntax_checkers/xhtml/tidy.vim index 9431e568f..72e4de936 100644 --- a/syntax_checkers/xhtml/tidy.vim +++ b/syntax_checkers/xhtml/tidy.vim @@ -47,7 +47,7 @@ function! s:TidyEncOptByFenc() return get(tidy_opts, &fileencoding, '-utf8') endfunction -function! s:IgnoreErrror(text) +function! s:IgnoreError(text) for i in g:syntastic_xhtml_tidy_ignore_errors if stridx(a:text, i) != -1 return 1 @@ -75,7 +75,7 @@ function! SyntaxCheckers_xhtml_tidy_GetLocList() \ 'defaults': {'bufnr': bufnr("")} }) for n in range(len(loclist)) - if loclist[n]['valid'] && s:IgnoreErrror(loclist[n]['text']) == 1 + if loclist[n]['valid'] && s:IgnoreError(loclist[n]['text']) == 1 let loclist[n]['valid'] = 0 endif endfor From ef31f0ec54912e5d35cedda76454e7378265131f Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Tue, 4 Jun 2013 21:34:42 +0300 Subject: [PATCH 0033/1271] Unbreaks coffee-script. Partial fix for #663. --- syntax_checkers/coffee/coffee.vim | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/syntax_checkers/coffee/coffee.vim b/syntax_checkers/coffee/coffee.vim index 3390734c5..1ad50a136 100644 --- a/syntax_checkers/coffee/coffee.vim +++ b/syntax_checkers/coffee/coffee.vim @@ -19,8 +19,13 @@ function! SyntaxCheckers_coffee_coffee_IsAvailable() endfunction function! SyntaxCheckers_coffee_coffee_GetLocList() + " TODO: This creates a .js file in the same directory as the source. + " Adding an option '-o /tmp' is not acceptable, since it would make + " impossible for other users to check a file with the same name. + " Sadly, Vim doesn't have a function to create temporary directories. let makeprg = syntastic#makeprg#build({ \ 'exe': 'coffee', + \ 'args': '-c', \ 'filetype': 'coffee', \ 'subchecker': 'coffee' }) From d591bc5e5631fcf47ed3770d5fcb0ac7acf90e13 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Wed, 5 Jun 2013 10:21:21 +0300 Subject: [PATCH 0034/1271] Document the "filetype" argument to syntastic#makeprg#build(). --- doc/syntastic.txt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/doc/syntastic.txt b/doc/syntastic.txt index 84ddfb517..a33b9325f 100644 --- a/doc/syntastic.txt +++ b/doc/syntastic.txt @@ -395,11 +395,14 @@ Checkers that use 'syntastic#makeprg#build()' look like this: > \ 'args': '-a -b -c', \ 'post_args': '--more --args', \ 'tail': '> /tmp/output', + \ 'filetype': 'ruby', \ 'subchecker': 'mri' }) < -All of the parameters above can be overriden by setting global variables - -even parameters not specified in the call to syntastic#makeprg#build(). +The 'filetype' and 'subchecker' parameters are mandatory. All of the other +parameters above are optional (well, you probably need at least 'exe'), and +can be overriden by setting global variables - even parameters not specified +in the call to syntastic#makeprg#build(). E.g. To override the checker exe above, you could do this: > let g:syntastic_ruby_mri_exe="another_ruby_checker_exe.rb" From c9d87bd36c312498c2d1eced6b3e9c0c3bed4648 Mon Sep 17 00:00:00 2001 From: Michael Hart Date: Wed, 5 Jun 2013 18:25:54 +1000 Subject: [PATCH 0035/1271] Change coffee arg from -c to -t to prevent JS file pollution The -t flag will output tokens (and syntax errors if there are any) - it is quite a lot quicker than another alternative, -n, especially for large files. --- syntax_checkers/coffee/coffee.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntax_checkers/coffee/coffee.vim b/syntax_checkers/coffee/coffee.vim index 1ad50a136..007201523 100644 --- a/syntax_checkers/coffee/coffee.vim +++ b/syntax_checkers/coffee/coffee.vim @@ -25,7 +25,7 @@ function! SyntaxCheckers_coffee_coffee_GetLocList() " Sadly, Vim doesn't have a function to create temporary directories. let makeprg = syntastic#makeprg#build({ \ 'exe': 'coffee', - \ 'args': '-c', + \ 'args': '-t', \ 'filetype': 'coffee', \ 'subchecker': 'coffee' }) From ab2fa6dbc01c673047c56ca8ace5adf3e7f402d6 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Wed, 5 Jun 2013 11:36:20 +0300 Subject: [PATCH 0036/1271] Remove obsolete comment. --- syntax_checkers/coffee/coffee.vim | 4 ---- 1 file changed, 4 deletions(-) diff --git a/syntax_checkers/coffee/coffee.vim b/syntax_checkers/coffee/coffee.vim index 007201523..1fa3ce34c 100644 --- a/syntax_checkers/coffee/coffee.vim +++ b/syntax_checkers/coffee/coffee.vim @@ -19,10 +19,6 @@ function! SyntaxCheckers_coffee_coffee_IsAvailable() endfunction function! SyntaxCheckers_coffee_coffee_GetLocList() - " TODO: This creates a .js file in the same directory as the source. - " Adding an option '-o /tmp' is not acceptable, since it would make - " impossible for other users to check a file with the same name. - " Sadly, Vim doesn't have a function to create temporary directories. let makeprg = syntastic#makeprg#build({ \ 'exe': 'coffee', \ 'args': '-t', From aa4d193eb874257e24e9eee25f57fca83bb0f16b Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Wed, 5 Jun 2013 15:56:07 +0300 Subject: [PATCH 0037/1271] Changed arguments for coffee-script, again. With "-t" some errors (e.g. "unexpected INDENT") are not caught. Apparently "-n" works better. --- syntax_checkers/coffee/coffee.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntax_checkers/coffee/coffee.vim b/syntax_checkers/coffee/coffee.vim index 1fa3ce34c..23ae62166 100644 --- a/syntax_checkers/coffee/coffee.vim +++ b/syntax_checkers/coffee/coffee.vim @@ -21,7 +21,7 @@ endfunction function! SyntaxCheckers_coffee_coffee_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'coffee', - \ 'args': '-t', + \ 'args': '-n', \ 'filetype': 'coffee', \ 'subchecker': 'coffee' }) From f18f80a7146998e9c3ad6edc213c0ad94d96b80c Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Wed, 5 Jun 2013 17:00:34 +0300 Subject: [PATCH 0038/1271] CoffeeScript changes, again. Version check: errorformat depends on the combination of node version and CoffeeScript version. When run under recent nodes, only 1.6.2 and newer produce errors we know how to parse. Changed again "-t", this time to "-cp". --- syntax_checkers/coffee/coffee.vim | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/syntax_checkers/coffee/coffee.vim b/syntax_checkers/coffee/coffee.vim index 23ae62166..c49d7c26e 100644 --- a/syntax_checkers/coffee/coffee.vim +++ b/syntax_checkers/coffee/coffee.vim @@ -9,19 +9,23 @@ " See http://sam.zoy.org/wtfpl/COPYING for more details. " "============================================================================ +" +" Note: this script requires CoffeeScript version 1.6.2 or newer. +" if exists("g:loaded_syntastic_coffee_coffee_checker") finish endif let g:loaded_syntastic_coffee_coffee_checker=1 function! SyntaxCheckers_coffee_coffee_IsAvailable() - return executable("coffee") + return executable("coffee") && + \ syntastic#util#versionIsAtLeast(syntastic#util#parseVersion('coffee --version 2>/dev/null'), [1,6,2]) endfunction function! SyntaxCheckers_coffee_coffee_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'coffee', - \ 'args': '-n', + \ 'args': '-cp', \ 'filetype': 'coffee', \ 'subchecker': 'coffee' }) From 814b7a418e5f0c8f22507c294511b543930c05e4 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Thu, 6 Jun 2013 13:06:10 +0300 Subject: [PATCH 0039/1271] Reset locales when running lmake. Fixes #665. --- plugin/syntastic.vim | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 5c2e770b9..f4b091c0e 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -321,6 +321,7 @@ function! SyntasticMake(options) let old_shellpipe = &shellpipe let old_shell = &shell let old_errorformat = &l:errorformat + let old_lc_all = $LC_ALL if s:OSSupportsShellpipeHack() "this is a hack to stop the screen needing to be ':redraw'n when @@ -337,7 +338,10 @@ function! SyntasticMake(options) let &l:errorformat = a:options['errorformat'] endif + let $LC_ALL = 'C' silent lmake! + let $LC_ALL = old_lc_all + let errors = getloclist(0) call setloclist(0, old_loclist) From ac9772f42869ea2a80d7869a36fa22e4b2565c50 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Thu, 6 Jun 2013 14:06:47 +0300 Subject: [PATCH 0040/1271] Makes the haml executable configurable. See #677. --- syntax_checkers/haml/haml.vim | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/syntax_checkers/haml/haml.vim b/syntax_checkers/haml/haml.vim index 3582eecc4..77d0a8dc6 100644 --- a/syntax_checkers/haml/haml.vim +++ b/syntax_checkers/haml/haml.vim @@ -15,13 +15,17 @@ if exists("g:loaded_syntastic_haml_haml_checker") endif let g:loaded_syntastic_haml_haml_checker=1 +if !exists("g:syntastic_haml_interpreter") + let g:syntastic_haml_interpreter = "haml" +endif + function! SyntaxCheckers_haml_haml_IsAvailable() - return executable('haml') + return executable(g:syntastic_haml_interpreter) endfunction function! SyntaxCheckers_haml_haml_GetLocList() let makeprg = syntastic#makeprg#build({ - \ 'exe': 'haml', + \ 'exe': g:syntastic_haml_interpreter, \ 'args': '-c', \ 'filetype': 'haml', \ 'subchecker': 'haml' }) From 9cddf3a29a4783448acd603104bb91b11764217a Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 7 Jun 2013 00:34:05 +0300 Subject: [PATCH 0041/1271] Sets the status line of the location window. Shows the command used to produce the error list on the status line of the location window. Also fixed a (harmless) refresh bug. --- plugin/syntastic.vim | 4 +++- plugin/syntastic/loclist.vim | 21 +++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index f4b091c0e..4f7cfba8e 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -135,7 +135,6 @@ function! s:UpdateErrors(auto_invoked, ...) end let loclist = g:SyntasticLoclist.current() - call s:notifiers.refresh(loclist) if g:syntastic_always_populate_loc_list || g:syntastic_auto_jump call setloclist(0, loclist.filteredRaw()) @@ -143,6 +142,8 @@ function! s:UpdateErrors(auto_invoked, ...) silent! lrewind endif endif + + call s:notifiers.refresh(loclist) endfunction "clear the loc list for the buffer @@ -178,6 +179,7 @@ function! s:CacheErrors(...) if !loclist.isEmpty() let newLoclist = newLoclist.extend(loclist) + call newLoclist.setName(checker.getName()) "only get errors from one checker at a time break diff --git a/plugin/syntastic/loclist.vim b/plugin/syntastic/loclist.vim index 637c6b822..dbeff6385 100644 --- a/plugin/syntastic/loclist.vim +++ b/plugin/syntastic/loclist.vim @@ -23,6 +23,8 @@ function! g:SyntasticLoclist.New(rawLoclist) let newObj._rawLoclist = llist let newObj._hasErrorsOrWarningsToDisplay = -1 + let newObj._name = '' + return newObj endfunction @@ -59,6 +61,14 @@ function! g:SyntasticLoclist.getLength() return len(self._rawLoclist) endfunction +function! g:SyntasticLoclist.getName() + return len(self._name) +endfunction + +function! g:SyntasticLoclist.setName(name) + let self._name = a:name +endfunction + function! g:SyntasticLoclist.hasErrorsOrWarningsToDisplay() if self._hasErrorsOrWarningsToDisplay >= 0 return self._hasErrorsOrWarningsToDisplay @@ -140,6 +150,17 @@ function! g:SyntasticLoclist.show() if num != winnr() wincmd p endif + + " try to find the loclist window and set w:quickfix_title + for buf in tabpagebuflist() + if buflisted(buf) && bufloaded(buf) && getbufvar(buf, '&buftype') ==# 'quickfix' + let win = bufwinnr(buf) + let title = getwinvar(win, 'quickfix_title', '') + if title ==# ':setloclist()' || strpart(title, 0, 16) ==# ':SyntasticCheck ' + call setwinvar(win, 'quickfix_title', ':SyntasticCheck ' . self._name) + endif + endif + endfor endif endfunction From 7c8898a5bbb206f88407f46da7deada8535d3697 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 7 Jun 2013 00:50:16 +0300 Subject: [PATCH 0042/1271] Add filetype to the status line of the location window. --- plugin/syntastic.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 4f7cfba8e..213df926f 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -179,7 +179,7 @@ function! s:CacheErrors(...) if !loclist.isEmpty() let newLoclist = newLoclist.extend(loclist) - call newLoclist.setName(checker.getName()) + call newLoclist.setName( checker.getName() . ' ('. checker.getFiletype() . ')' ) "only get errors from one checker at a time break From c50ba2b6aa0adb10fe790499895a533024b74499 Mon Sep 17 00:00:00 2001 From: Oren Held Date: Sun, 12 May 2013 16:51:38 +0300 Subject: [PATCH 0043/1271] sh: do not enforce POSIX validation on bash/zsh scripts The POSIX check warns about perfectly legal bash/zsh statements such as the 'local' keyword. It's archaic and irrelevant nowadays. --- syntax_checkers/sh/checkbashisms.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntax_checkers/sh/checkbashisms.vim b/syntax_checkers/sh/checkbashisms.vim index ed3645b0e..9fb1f7aec 100644 --- a/syntax_checkers/sh/checkbashisms.vim +++ b/syntax_checkers/sh/checkbashisms.vim @@ -20,7 +20,7 @@ endfunction function! SyntaxCheckers_sh_checkbashisms_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'checkbashisms', - \ 'args': '-fpx', + \ 'args': '-fx', \ 'filetype': 'sh', \ 'subchecker': 'checkbashisms'}) From fc34c2179be986a4a8ccf009b708a91f43a6773f Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 7 Jun 2013 11:50:54 +0300 Subject: [PATCH 0044/1271] Update errorformat for sass. Fixes #42. --- syntax_checkers/sass/sass.vim | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/syntax_checkers/sass/sass.vim b/syntax_checkers/sass/sass.vim index 15b852640..4b8d48637 100644 --- a/syntax_checkers/sass/sass.vim +++ b/syntax_checkers/sass/sass.vim @@ -46,16 +46,31 @@ function! SyntaxCheckers_sass_sass_GetLocList() \ 'subchecker': 'sass' }) let errorformat = - \ '%ESyntax %trror:%m,' . + \ '%ESyntax %trror: %m,' . + \ '%+C %.%#,' . + \ '%C on line %l of %f\, %.%#,' . \ '%C on line %l of %f,' . - \ '%Z%.%#,' . - \ '%Wwarning on line %l:,' . + \ '%-G %\+from line %.%#,' . + \ '%-G %\+Use --trace for backtrace.,' . + \ '%W%>DEPRECATION WARNING on line %l of %f:,' . + \ '%+C%> %.%#,' . + \ '%W%>WARNING: on line %l of %f:,' . + \ '%+C%> %.%#,' . + \ '%W%>WARNING on line %l of %f: %m,' . + \ '%+C%> %.%#,' . + \ '%W%>WARNING on line %l of %f:,' . \ '%Z%m,' . - \ 'Syntax %trror on line %l: %m' + \ '%W%>WARNING: %m,' . + \ '%C on line %l of %f\, %.%#,' . + \ '%C on line %l of %f,' . + \ '%-G %\+from line %.%#,' . + \ 'Syntax %trror on line %l: %m,' . + \ '%-G%.%#' return SyntasticMake({ \ 'makeprg': makeprg, - \ 'errorformat': errorformat }) + \ 'errorformat': errorformat, + \ 'postprocess': ['compressWhitespace'] }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ From 07149e418f58ec48254731cf9487fde0874ce85e Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 7 Jun 2013 19:27:48 +0300 Subject: [PATCH 0045/1271] Cosmetic change: checkpatch is a style checker. --- syntax_checkers/c/checkpatch.vim | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/syntax_checkers/c/checkpatch.vim b/syntax_checkers/c/checkpatch.vim index d87d57bd5..dc5e95de5 100644 --- a/syntax_checkers/c/checkpatch.vim +++ b/syntax_checkers/c/checkpatch.vim @@ -32,12 +32,14 @@ function! SyntaxCheckers_c_checkpatch_GetLocList() \ 'filetype': 'c', \ 'subchecker': 'checkpatch' }) - let errorformat = '%f:%l: %tARNING: %m,%f:%l: %tRROR: %m' + let errorformat = + \ '%f:%l: %tARNING: %m,' . + \ '%f:%l: %tRROR: %m' return SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, - \ 'defaults': {'bufnr': bufnr("")} }) + \ 'subtype': 'Style' }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ From 5ec25ccb1077abca7a3b4c6a22c756bf8c70c231 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 7 Jun 2013 20:56:39 +0300 Subject: [PATCH 0046/1271] Cleanup. --- syntax_checkers/coffee/coffee.vim | 2 +- syntax_checkers/cuda/nvcc.vim | 11 ++++++--- syntax_checkers/go/go.vim | 34 ++++++++++++++++++++------- syntax_checkers/nasm/nasm.vim | 7 +----- syntax_checkers/ocaml/camlp4o.vim | 14 +++++------ syntax_checkers/puppet/puppetlint.vim | 4 ++-- syntax_checkers/slim/slimrb.vim | 2 +- syntax_checkers/text/atdtool.vim | 2 +- 8 files changed, 47 insertions(+), 29 deletions(-) diff --git a/syntax_checkers/coffee/coffee.vim b/syntax_checkers/coffee/coffee.vim index c49d7c26e..846180b91 100644 --- a/syntax_checkers/coffee/coffee.vim +++ b/syntax_checkers/coffee/coffee.vim @@ -19,7 +19,7 @@ let g:loaded_syntastic_coffee_coffee_checker=1 function! SyntaxCheckers_coffee_coffee_IsAvailable() return executable("coffee") && - \ syntastic#util#versionIsAtLeast(syntastic#util#parseVersion('coffee --version 2>/dev/null'), [1,6,2]) + \ syntastic#util#versionIsAtLeast(syntastic#util#parseVersion('coffee --version 2>' . syntastic#util#DevNull()), [1,6,2]) endfunction function! SyntaxCheckers_coffee_coffee_GetLocList() diff --git a/syntax_checkers/cuda/nvcc.vim b/syntax_checkers/cuda/nvcc.vim index d570152cc..d5649d305 100644 --- a/syntax_checkers/cuda/nvcc.vim +++ b/syntax_checkers/cuda/nvcc.vim @@ -30,11 +30,13 @@ endfunction function! SyntaxCheckers_cuda_nvcc_GetLocList() if exists('g:syntastic_cuda_arch') - let arch_flag = '-arch='.g:syntastic_cuda_arch + let arch_flag = '-arch=' . g:syntastic_cuda_arch else let arch_flag = '' endif - let makeprg = 'nvcc '.arch_flag.' --cuda -O0 -I . -Xcompiler -fsyntax-only '.shellescape(expand('%')).' -o /dev/null' + let makeprg = + \ 'nvcc ' . arch_flag . ' --cuda -O0 -I . -Xcompiler -fsyntax-only ' . + \ shellescape(expand('%')) . ' ' . syntastic#c#GetNullDevice() let errorformat = \ '%*[^"]"%f"%*\D%l: %m,'. \ '"%f"%*\D%l: %m,'. @@ -53,7 +55,10 @@ function! SyntaxCheckers_cuda_nvcc_GetLocList() if expand('%') =~? '\%(.h\|.hpp\|.cuh\)$' if exists('g:syntastic_cuda_check_header') - let makeprg = 'echo > .syntastic_dummy.cu ; nvcc '.arch_flag.' --cuda -O0 -I . .syntastic_dummy.cu -Xcompiler -fsyntax-only -include '.shellescape(expand('%')).' -o /dev/null' + let makeprg = + \ 'echo > .syntastic_dummy.cu ; ' . + \ 'nvcc ' . arch_flag . ' --cuda -O0 -I . .syntastic_dummy.cu -Xcompiler -fsyntax-only -include ' . + \ shellescape(expand('%')) . ' ' . syntastic#c#GetNullDevice() else return [] endif diff --git a/syntax_checkers/go/go.vim b/syntax_checkers/go/go.vim index 2534bcb5f..8d023f307 100644 --- a/syntax_checkers/go/go.vim +++ b/syntax_checkers/go/go.vim @@ -25,10 +25,21 @@ 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. - let makeprg = 'gofmt -l % 1>/dev/null' - let errorformat = '%f:%l:%c: %m,%-G%.%#' - let errors = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat, 'defaults': {'type': 'e'} }) + let makeprg = syntastic#makeprg#build({ + \ 'exe': 'gofmt', + \ 'args': '-l', + \ 'tail': '1>' . syntastic#util#DevNull(), + \ 'filetype': 'go', + \ 'subchecker': 'go' }) + let errorformat = + \ '%f:%l:%c: %m,' . + \ '%-G%.%#' + + let errors = SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'defaults': {'type': 'e'} }) if !empty(errors) return errors endif @@ -36,22 +47,29 @@ function! SyntaxCheckers_go_go_GetLocList() " Test files, i.e. files with a name ending in `_test.go`, are not " compiled by `go build`, therefore `go test` must be called for those. if match(expand('%'), '_test.go$') == -1 - let makeprg = 'go build -o /dev/null' + let makeprg = 'go build ' . syntastic#c#GetNullDevice() else - let makeprg = 'go test -c -o /dev/null' + let makeprg = 'go test -c ' . syntastic#c#GetNullDevice() endif - let errorformat = '%f:%l:%c:%m,%f:%l%m,%-G#%.%#' + + let errorformat = + \ '%f:%l:%c:%m,' . + \ '%f:%l%m,' . + \ '%-G#%.%#' " The go compiler needs to either be run with an import path as an " argument or directly from the package directory. Since figuring out " the poper import path is fickle, just pushd/popd to the package. let popd = getcwd() let pushd = expand('%:p:h') - " + " pushd exec 'lcd ' . fnameescape(pushd) - let errors = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) + let errors = SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'defaults': {'type': 'e'} }) " popd exec 'lcd ' . fnameescape(popd) diff --git a/syntax_checkers/nasm/nasm.vim b/syntax_checkers/nasm/nasm.vim index 3bab07dc9..dcbdd4188 100644 --- a/syntax_checkers/nasm/nasm.vim +++ b/syntax_checkers/nasm/nasm.vim @@ -19,15 +19,10 @@ function! SyntaxCheckers_nasm_nasm_IsAvailable() endfunction function! SyntaxCheckers_nasm_nasm_GetLocList() - if has("win32") - let outfile="NUL" - else - let outfile="/dev/null" - endif let wd = shellescape(expand("%:p:h") . "/") let makeprg = syntastic#makeprg#build({ \ 'exe': 'nasm', - \ 'args': '-X gnu -f elf -I ' . wd . ' -o ' . outfile, + \ 'args': '-X gnu -f elf -I ' . wd . ' ' . syntastic#c#GetNullDevice() \ 'filetype': 'nasm', \ 'subchecker': 'nasm' }) diff --git a/syntax_checkers/ocaml/camlp4o.vim b/syntax_checkers/ocaml/camlp4o.vim index 69d7494c1..805aa0733 100644 --- a/syntax_checkers/ocaml/camlp4o.vim +++ b/syntax_checkers/ocaml/camlp4o.vim @@ -112,16 +112,16 @@ function s:GetOcamlcMakeprg() if g:syntastic_ocaml_use_janestreet_core let build_cmd = "ocamlc -I " let build_cmd .= expand(g:syntastic_ocaml_janestreet_core_dir) - let build_cmd .= " -c ".expand('%') + let build_cmd .= " -c " . expand('%') return build_cmd else - return "ocamlc -c ". expand('%') + return "ocamlc -c " . expand('%') endif endfunction function s:GetOcamlBuildMakeprg() - return "ocamlbuild -quiet -no-log -tag annot,". s:ocamlpp. " -no-links -no-hygiene -no-sanitize ". - \ shellescape(expand('%:r')).".cmi" + return "ocamlbuild -quiet -no-log -tag annot," . s:ocamlpp . " -no-links -no-hygiene -no-sanitize " . + \ shellescape(expand('%:r')) . ".cmi" endfunction function s:GetOtherMakeprg() @@ -134,11 +134,11 @@ function s:GetOtherMakeprg() if match(extension, 'mly') >= 0 && executable("menhir") " ocamlyacc output can't be redirected, so use menhir - let makeprg = "menhir --only-preprocess ".shellescape(expand('%')) . " >/dev/null" + let makeprg = "menhir --only-preprocess " . shellescape(expand('%')) . " >" . syntastic#util#DevNull() elseif match(extension,'mll') >= 0 && executable("ocamllex") - let makeprg = "ocamllex -q -o /dev/null ".shellescape(expand('%')) + let makeprg = "ocamllex -q " . syntastic#c#GetNullDevice() . " " . shellescape(expand('%')) else - let makeprg = "camlp4o -o /dev/null ".shellescape(expand('%')) + let makeprg = "camlp4o " . syntastic#c#GetNullDevice() . " " . shellescape(expand('%')) endif return makeprg diff --git a/syntax_checkers/puppet/puppetlint.vim b/syntax_checkers/puppet/puppetlint.vim index 32ccd9010..54f5b83b3 100644 --- a/syntax_checkers/puppet/puppetlint.vim +++ b/syntax_checkers/puppet/puppetlint.vim @@ -33,14 +33,14 @@ endif function! s:PuppetVersion() if !exists("s:puppet_version") - let s:puppet_version = syntastic#util#parseVersion("puppet --version 2>/dev/null") + let s:puppet_version = syntastic#util#parseVersion("puppet --version 2>" . syntastic#util#DevNull()) endif return s:puppet_version endfunction function! s:PuppetLintVersion() if !exists("s:puppet_lint_version") - let s:puppet_lint_version = syntastic#util#parseVersion("puppet-lint --version 2>/dev/null") + let s:puppet_lint_version = syntastic#util#parseVersion("puppet-lint --version 2>" . syntastic#util#DevNull()) endif return s:puppet_lint_version endfunction diff --git a/syntax_checkers/slim/slimrb.vim b/syntax_checkers/slim/slimrb.vim index 106a1b515..2644decf3 100644 --- a/syntax_checkers/slim/slimrb.vim +++ b/syntax_checkers/slim/slimrb.vim @@ -21,7 +21,7 @@ endfunction function! s:SlimrbVersion() if !exists('s:slimrb_version') - let s:slimrb_version = syntastic#util#parseVersion('slimrb --version 2>/dev/null') + let s:slimrb_version = syntastic#util#parseVersion('slimrb --version 2>' . syntastic#util#DevNull()) end return s:slimrb_version endfunction diff --git a/syntax_checkers/text/atdtool.vim b/syntax_checkers/text/atdtool.vim index 5cc99b873..bfccb7e65 100644 --- a/syntax_checkers/text/atdtool.vim +++ b/syntax_checkers/text/atdtool.vim @@ -31,7 +31,7 @@ endfunction function! SyntaxCheckers_text_atdtool_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'atdtool', - \ 'tail': '2>/dev/null', + \ 'tail': '2>' . syntastic#util#DevNull(), \ 'filetype': 'text', \ 'subchecker': 'atdtool' }) From 7e1362005b562a96b7dfcf024e90d90761957df0 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 7 Jun 2013 21:18:29 +0300 Subject: [PATCH 0047/1271] Merge branch master. --- autoload/syntastic/c.vim | 7 +++--- syntax_checkers/c/checkpatch.vim | 6 +++-- syntax_checkers/coffee/coffee.vim | 2 +- syntax_checkers/cuda/nvcc.vim | 11 ++++++--- syntax_checkers/d/dmd.vim | 2 +- syntax_checkers/go/go.vim | 34 ++++++++++++++++++++------- syntax_checkers/llvm/llvm.vim | 2 +- syntax_checkers/nasm/nasm.vim | 2 +- syntax_checkers/ocaml/camlp4o.vim | 14 +++++------ syntax_checkers/puppet/puppetlint.vim | 4 ++-- syntax_checkers/slim/slimrb.vim | 2 +- syntax_checkers/text/atdtool.vim | 2 +- 12 files changed, 56 insertions(+), 32 deletions(-) diff --git a/autoload/syntastic/c.vim b/autoload/syntastic/c.vim index ec0537d3e..9c2ad1695 100644 --- a/autoload/syntastic/c.vim +++ b/autoload/syntastic/c.vim @@ -10,10 +10,9 @@ set cpo&vim " convenience function to determine the 'null device' parameter " based on the current operating system -function! syntastic#c#NullOutput(ft) +function! syntastic#c#NullOutput() let known_os = has('win32') || has('unix') || has('mac') - let opt_o = ft ==# 'd' ? '-of' : '-o ' - return known_os ? opt_o . syntastic#util#DevNull() : '' + return known_os ? '-o ' . syntastic#util#DevNull() : '' endfunction " get the gcc include directory argument depending on the default @@ -136,7 +135,7 @@ function! syntastic#c#GetLocList(filetype, options) \ ' ' . get(a:options, 'makeprg_headers', '') . \ ' ' . g:syntastic_{ft}_compiler_options . \ ' ' . syntastic#c#GetIncludeDirs(ft) . - \ ' ' . syntastic#c#NullOutput(ft) . + \ ' ' . syntastic#c#NullOutput() . \ ' -c ' . shellescape(expand('%')) else return [] diff --git a/syntax_checkers/c/checkpatch.vim b/syntax_checkers/c/checkpatch.vim index d87d57bd5..dc5e95de5 100644 --- a/syntax_checkers/c/checkpatch.vim +++ b/syntax_checkers/c/checkpatch.vim @@ -32,12 +32,14 @@ function! SyntaxCheckers_c_checkpatch_GetLocList() \ 'filetype': 'c', \ 'subchecker': 'checkpatch' }) - let errorformat = '%f:%l: %tARNING: %m,%f:%l: %tRROR: %m' + let errorformat = + \ '%f:%l: %tARNING: %m,' . + \ '%f:%l: %tRROR: %m' return SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, - \ 'defaults': {'bufnr': bufnr("")} }) + \ 'subtype': 'Style' }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/syntax_checkers/coffee/coffee.vim b/syntax_checkers/coffee/coffee.vim index c49d7c26e..846180b91 100644 --- a/syntax_checkers/coffee/coffee.vim +++ b/syntax_checkers/coffee/coffee.vim @@ -19,7 +19,7 @@ let g:loaded_syntastic_coffee_coffee_checker=1 function! SyntaxCheckers_coffee_coffee_IsAvailable() return executable("coffee") && - \ syntastic#util#versionIsAtLeast(syntastic#util#parseVersion('coffee --version 2>/dev/null'), [1,6,2]) + \ syntastic#util#versionIsAtLeast(syntastic#util#parseVersion('coffee --version 2>' . syntastic#util#DevNull()), [1,6,2]) endfunction function! SyntaxCheckers_coffee_coffee_GetLocList() diff --git a/syntax_checkers/cuda/nvcc.vim b/syntax_checkers/cuda/nvcc.vim index d570152cc..ee210aca6 100644 --- a/syntax_checkers/cuda/nvcc.vim +++ b/syntax_checkers/cuda/nvcc.vim @@ -30,11 +30,13 @@ endfunction function! SyntaxCheckers_cuda_nvcc_GetLocList() if exists('g:syntastic_cuda_arch') - let arch_flag = '-arch='.g:syntastic_cuda_arch + let arch_flag = '-arch=' . g:syntastic_cuda_arch else let arch_flag = '' endif - let makeprg = 'nvcc '.arch_flag.' --cuda -O0 -I . -Xcompiler -fsyntax-only '.shellescape(expand('%')).' -o /dev/null' + let makeprg = + \ 'nvcc ' . arch_flag . ' --cuda -O0 -I . -Xcompiler -fsyntax-only ' . + \ shellescape(expand('%')) . ' ' . syntastic#c#NullOutput() let errorformat = \ '%*[^"]"%f"%*\D%l: %m,'. \ '"%f"%*\D%l: %m,'. @@ -53,7 +55,10 @@ function! SyntaxCheckers_cuda_nvcc_GetLocList() if expand('%') =~? '\%(.h\|.hpp\|.cuh\)$' if exists('g:syntastic_cuda_check_header') - let makeprg = 'echo > .syntastic_dummy.cu ; nvcc '.arch_flag.' --cuda -O0 -I . .syntastic_dummy.cu -Xcompiler -fsyntax-only -include '.shellescape(expand('%')).' -o /dev/null' + let makeprg = + \ 'echo > .syntastic_dummy.cu ; ' . + \ 'nvcc ' . arch_flag . ' --cuda -O0 -I . .syntastic_dummy.cu -Xcompiler -fsyntax-only -include ' . + \ shellescape(expand('%')) . ' ' . syntastic#c#NullOutput() else return [] endif diff --git a/syntax_checkers/d/dmd.vim b/syntax_checkers/d/dmd.vim index f69dbb1e8..17baaecab 100644 --- a/syntax_checkers/d/dmd.vim +++ b/syntax_checkers/d/dmd.vim @@ -44,7 +44,7 @@ function! SyntaxCheckers_d_dmd_GetLocList() \ 'errorformat': \ '%-G%f:%s:,%f(%l): %m,' . \ '%f:%l: %m', - \ 'makeprg_main': '-c ' . syntastic#c#NullOutput('d'), + \ 'makeprg_main': '-c -of' . syntastic#util#DevNull(), \ 'headers_pattern': '\.di$' }) endfunction diff --git a/syntax_checkers/go/go.vim b/syntax_checkers/go/go.vim index 2534bcb5f..fc07974f3 100644 --- a/syntax_checkers/go/go.vim +++ b/syntax_checkers/go/go.vim @@ -25,10 +25,21 @@ 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. - let makeprg = 'gofmt -l % 1>/dev/null' - let errorformat = '%f:%l:%c: %m,%-G%.%#' - let errors = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat, 'defaults': {'type': 'e'} }) + let makeprg = syntastic#makeprg#build({ + \ 'exe': 'gofmt', + \ 'args': '-l', + \ 'tail': '1>' . syntastic#util#DevNull(), + \ 'filetype': 'go', + \ 'subchecker': 'go' }) + let errorformat = + \ '%f:%l:%c: %m,' . + \ '%-G%.%#' + + let errors = SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'defaults': {'type': 'e'} }) if !empty(errors) return errors endif @@ -36,22 +47,29 @@ function! SyntaxCheckers_go_go_GetLocList() " Test files, i.e. files with a name ending in `_test.go`, are not " compiled by `go build`, therefore `go test` must be called for those. if match(expand('%'), '_test.go$') == -1 - let makeprg = 'go build -o /dev/null' + let makeprg = 'go build ' . syntastic#c#NullOutput() else - let makeprg = 'go test -c -o /dev/null' + let makeprg = 'go test -c ' . syntastic#c#NullOutput() endif - let errorformat = '%f:%l:%c:%m,%f:%l%m,%-G#%.%#' + + let errorformat = + \ '%f:%l:%c:%m,' . + \ '%f:%l%m,' . + \ '%-G#%.%#' " The go compiler needs to either be run with an import path as an " argument or directly from the package directory. Since figuring out " the poper import path is fickle, just pushd/popd to the package. let popd = getcwd() let pushd = expand('%:p:h') - " + " pushd exec 'lcd ' . fnameescape(pushd) - let errors = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) + let errors = SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'defaults': {'type': 'e'} }) " popd exec 'lcd ' . fnameescape(popd) diff --git a/syntax_checkers/llvm/llvm.vim b/syntax_checkers/llvm/llvm.vim index ea4fa04bf..61d16fc1d 100644 --- a/syntax_checkers/llvm/llvm.vim +++ b/syntax_checkers/llvm/llvm.vim @@ -21,7 +21,7 @@ endfunction function! SyntaxCheckers_llvm_llvm_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'llc', - \ 'args': syntastic#c#GetNullDevice(), + \ 'args': syntastic#c#NullOutput(), \ 'filetype': 'llvm', \ 'subchecker': 'llvm' }) diff --git a/syntax_checkers/nasm/nasm.vim b/syntax_checkers/nasm/nasm.vim index 2b508c243..8c425b555 100644 --- a/syntax_checkers/nasm/nasm.vim +++ b/syntax_checkers/nasm/nasm.vim @@ -22,7 +22,7 @@ function! SyntaxCheckers_nasm_nasm_GetLocList() let wd = shellescape(expand("%:p:h") . "/") let makeprg = syntastic#makeprg#build({ \ 'exe': 'nasm', - \ 'args': '-X gnu -f elf -I ' . wd . ' ' . syntastic#c#NullOutput('nasm'), + \ 'args': '-X gnu -f elf -I ' . wd . ' ' . syntastic#c#NullOutput(), \ 'filetype': 'nasm', \ 'subchecker': 'nasm' }) diff --git a/syntax_checkers/ocaml/camlp4o.vim b/syntax_checkers/ocaml/camlp4o.vim index 69d7494c1..b498134c5 100644 --- a/syntax_checkers/ocaml/camlp4o.vim +++ b/syntax_checkers/ocaml/camlp4o.vim @@ -112,16 +112,16 @@ function s:GetOcamlcMakeprg() if g:syntastic_ocaml_use_janestreet_core let build_cmd = "ocamlc -I " let build_cmd .= expand(g:syntastic_ocaml_janestreet_core_dir) - let build_cmd .= " -c ".expand('%') + let build_cmd .= " -c " . expand('%') return build_cmd else - return "ocamlc -c ". expand('%') + return "ocamlc -c " . expand('%') endif endfunction function s:GetOcamlBuildMakeprg() - return "ocamlbuild -quiet -no-log -tag annot,". s:ocamlpp. " -no-links -no-hygiene -no-sanitize ". - \ shellescape(expand('%:r')).".cmi" + return "ocamlbuild -quiet -no-log -tag annot," . s:ocamlpp . " -no-links -no-hygiene -no-sanitize " . + \ shellescape(expand('%:r')) . ".cmi" endfunction function s:GetOtherMakeprg() @@ -134,11 +134,11 @@ function s:GetOtherMakeprg() if match(extension, 'mly') >= 0 && executable("menhir") " ocamlyacc output can't be redirected, so use menhir - let makeprg = "menhir --only-preprocess ".shellescape(expand('%')) . " >/dev/null" + let makeprg = "menhir --only-preprocess " . shellescape(expand('%')) . " >" . syntastic#util#DevNull() elseif match(extension,'mll') >= 0 && executable("ocamllex") - let makeprg = "ocamllex -q -o /dev/null ".shellescape(expand('%')) + let makeprg = "ocamllex -q " . syntastic#c#NullOutput() . " " . shellescape(expand('%')) else - let makeprg = "camlp4o -o /dev/null ".shellescape(expand('%')) + let makeprg = "camlp4o " . syntastic#c#NullOutput() . " " . shellescape(expand('%')) endif return makeprg diff --git a/syntax_checkers/puppet/puppetlint.vim b/syntax_checkers/puppet/puppetlint.vim index 32ccd9010..54f5b83b3 100644 --- a/syntax_checkers/puppet/puppetlint.vim +++ b/syntax_checkers/puppet/puppetlint.vim @@ -33,14 +33,14 @@ endif function! s:PuppetVersion() if !exists("s:puppet_version") - let s:puppet_version = syntastic#util#parseVersion("puppet --version 2>/dev/null") + let s:puppet_version = syntastic#util#parseVersion("puppet --version 2>" . syntastic#util#DevNull()) endif return s:puppet_version endfunction function! s:PuppetLintVersion() if !exists("s:puppet_lint_version") - let s:puppet_lint_version = syntastic#util#parseVersion("puppet-lint --version 2>/dev/null") + let s:puppet_lint_version = syntastic#util#parseVersion("puppet-lint --version 2>" . syntastic#util#DevNull()) endif return s:puppet_lint_version endfunction diff --git a/syntax_checkers/slim/slimrb.vim b/syntax_checkers/slim/slimrb.vim index 106a1b515..2644decf3 100644 --- a/syntax_checkers/slim/slimrb.vim +++ b/syntax_checkers/slim/slimrb.vim @@ -21,7 +21,7 @@ endfunction function! s:SlimrbVersion() if !exists('s:slimrb_version') - let s:slimrb_version = syntastic#util#parseVersion('slimrb --version 2>/dev/null') + let s:slimrb_version = syntastic#util#parseVersion('slimrb --version 2>' . syntastic#util#DevNull()) end return s:slimrb_version endfunction diff --git a/syntax_checkers/text/atdtool.vim b/syntax_checkers/text/atdtool.vim index 5cc99b873..bfccb7e65 100644 --- a/syntax_checkers/text/atdtool.vim +++ b/syntax_checkers/text/atdtool.vim @@ -31,7 +31,7 @@ endfunction function! SyntaxCheckers_text_atdtool_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'atdtool', - \ 'tail': '2>/dev/null', + \ 'tail': '2>' . syntastic#util#DevNull(), \ 'filetype': 'text', \ 'subchecker': 'atdtool' }) From 4ce1a20efe8d7fed7f234c12aa190585f51ca3c5 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 7 Jun 2013 22:23:56 +0300 Subject: [PATCH 0048/1271] Bug fix: getwinvar() got its third argument only in Vim 7.3.831. --- plugin/syntastic/loclist.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/syntastic/loclist.vim b/plugin/syntastic/loclist.vim index dbeff6385..0b9356217 100644 --- a/plugin/syntastic/loclist.vim +++ b/plugin/syntastic/loclist.vim @@ -155,7 +155,7 @@ function! g:SyntasticLoclist.show() for buf in tabpagebuflist() if buflisted(buf) && bufloaded(buf) && getbufvar(buf, '&buftype') ==# 'quickfix' let win = bufwinnr(buf) - let title = getwinvar(win, 'quickfix_title', '') + let title = getwinvar(win, 'quickfix_title') if title ==# ':setloclist()' || strpart(title, 0, 16) ==# ':SyntasticCheck ' call setwinvar(win, 'quickfix_title', ':SyntasticCheck ' . self._name) endif From d7d581ff13a743983f63cf3e55a98d056df57c34 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Sat, 8 Jun 2013 11:09:39 +0300 Subject: [PATCH 0049/1271] Bug fix: proper escaping in config files. --- autoload/syntastic/c.vim | 259 ++++++++++++++++++------------------ autoload/syntastic/util.vim | 5 + 2 files changed, 135 insertions(+), 129 deletions(-) diff --git a/autoload/syntastic/c.vim b/autoload/syntastic/c.vim index 9c2ad1695..993982e68 100644 --- a/autoload/syntastic/c.vim +++ b/autoload/syntastic/c.vim @@ -15,41 +15,28 @@ function! syntastic#c#NullOutput() return known_os ? '-o ' . syntastic#util#DevNull() : '' endfunction -" get the gcc include directory argument depending on the default -" includes and the optional user-defined 'g:syntastic_c_include_dirs' -function! syntastic#c#GetIncludeDirs(filetype) - let include_dirs = [] - - if !exists('g:syntastic_'.a:filetype.'_no_default_include_dirs') || - \ !g:syntastic_{a:filetype}_no_default_include_dirs - let include_dirs = copy(s:default_includes) - endif - - if exists('g:syntastic_'.a:filetype.'_include_dirs') - call extend(include_dirs, g:syntastic_{a:filetype}_include_dirs) - endif - - return join(map(syntastic#util#unique(include_dirs), '"-I" . v:val'), ' ') -endfunction - " read additional compiler flags from the given configuration file " the file format and its parsing mechanism is inspired by clang_complete function! syntastic#c#ReadConfig(file) " search in the current file's directory upwards let config = findfile(a:file, '.;') - if config == '' || !filereadable(config) | return '' | endif + if config == '' || !filereadable(config) + return '' + endif " convert filename into absolute path - let filepath = substitute(fnamemodify(config, ':p:h'), '\', '/', 'g') + let filepath = fnamemodify(config, ':p:h') " try to read config file try - let lines = map(readfile(config), - \ 'substitute(v:val, ''\'', ''/'', ''g'')') - catch /E484/ + let lines = readfile(config) + catch /^Vim\%((\a\+)\)\=:E484/ return '' endtry + " filter out empty lines and comments + call filter(lines, 'v:val !~ ''\v^(\s*#|$)''') + let parameters = [] for line in lines let matches = matchlist(line, '\C^\s*-I\s*\(\S\+\)') @@ -58,67 +45,14 @@ function! syntastic#c#ReadConfig(file) if match(matches[1], '^\%(/\|\a:\)') != -1 call add(parameters, '-I' . matches[1]) else - call add(parameters, '-I' . filepath . '/' . matches[1]) + call add(parameters, '-I' . filepath . syntastic#util#Slash() . matches[1]) endif else call add(parameters, line) endif endfor - return join(parameters, ' ') -endfunction - -" search the first 100 lines for include statements that are -" given in the handlers dictionary -function! syntastic#c#SearchHeaders() - let includes = '' - let files = [] - let found = [] - let lines = filter(getline(1, 100), 'v:val =~# "^\s*#\s*include"') - - " search current buffer - for line in lines - let file = matchstr(line, '"\zs\S\+\ze"') - if file != '' - call add(files, file) - continue - endif - for handler in s:handlers - if line =~# handler["regex"] - let includes .= call(handler["func"], handler["args"]) - call add(found, handler["regex"]) - break - endif - endfor - endfor - - " search included headers - for hfile in files - if hfile != '' - let filename = expand('%:p:h') . (has('win32') ? - \ '\' : '/') . hfile - try - let lines = readfile(filename, '', 100) - catch /E484/ - continue - endtry - let lines = filter(lines, 'v:val =~# "^\s*#\s*include"') - for handler in s:handlers - if index(found, handler["regex"]) != -1 - continue - endif - for line in lines - if line =~# handler["regex"] - let includes .= call(handler["func"], handler["args"]) - call add(found, handler["regex"]) - break - endif - endfor - endfor - endif - endfor - - return includes + return join(map(parameters, 'shellescape(fnameescape(v:val))'), ' ') endfunction " GetLocList() for C-like compilers @@ -134,7 +68,7 @@ function! syntastic#c#GetLocList(filetype, options) \ g:syntastic_{ft}_compiler . \ ' ' . get(a:options, 'makeprg_headers', '') . \ ' ' . g:syntastic_{ft}_compiler_options . - \ ' ' . syntastic#c#GetIncludeDirs(ft) . + \ ' ' . s:GetIncludeDirs(ft) . \ ' ' . syntastic#c#NullOutput() . \ ' -c ' . shellescape(expand('%')) else @@ -145,7 +79,7 @@ function! syntastic#c#GetLocList(filetype, options) \ g:syntastic_{ft}_compiler . \ ' ' . get(a:options, 'makeprg_main', '') . \ ' ' . g:syntastic_{ft}_compiler_options . - \ ' ' . syntastic#c#GetIncludeDirs(ft) . + \ ' ' . s:GetIncludeDirs(ft) . \ ' ' . shellescape(expand('%')) endif @@ -156,11 +90,11 @@ function! syntastic#c#GetLocList(filetype, options) if ft ==# 'c' || ft ==# 'cpp' " refresh the include file search if desired if exists('g:syntastic_' . ft . '_auto_refresh_includes') && g:syntastic_{ft}_auto_refresh_includes - let makeprg .= ' ' . syntastic#c#SearchHeaders() + let makeprg .= ' ' . s:SearchHeaders() else " search for header includes if not cached already if !exists('b:syntastic_' . ft . '_includes') - let b:syntastic_{ft}_includes = syntastic#c#SearchHeaders() + let b:syntastic_{ft}_includes = s:SearchHeaders() endif let makeprg .= ' ' . b:syntastic_{ft}_includes endif @@ -192,31 +126,94 @@ function! s:Init() let s:handlers = [] let s:cflags = {} - call s:RegHandler('gtk', 'syntastic#c#CheckPKG', - \ ['gtk', 'gtk+-2.0', 'gtk+', 'glib-2.0', 'glib']) - call s:RegHandler('glib', 'syntastic#c#CheckPKG', - \ ['glib', 'glib-2.0', 'glib']) - call s:RegHandler('glade', 'syntastic#c#CheckPKG', - \ ['glade', 'libglade-2.0', 'libglade']) - call s:RegHandler('libsoup', 'syntastic#c#CheckPKG', - \ ['libsoup', 'libsoup-2.4', 'libsoup-2.2']) - call s:RegHandler('webkit', 'syntastic#c#CheckPKG', - \ ['webkit', 'webkit-1.0']) - call s:RegHandler('cairo', 'syntastic#c#CheckPKG', - \ ['cairo', 'cairo']) - call s:RegHandler('pango', 'syntastic#c#CheckPKG', - \ ['pango', 'pango']) - call s:RegHandler('libxml', 'syntastic#c#CheckPKG', - \ ['libxml', 'libxml-2.0', 'libxml']) - call s:RegHandler('freetype', 'syntastic#c#CheckPKG', - \ ['freetype', 'freetype2', 'freetype']) - call s:RegHandler('SDL', 'syntastic#c#CheckPKG', - \ ['sdl', 'sdl']) - call s:RegHandler('opengl', 'syntastic#c#CheckPKG', - \ ['opengl', 'gl']) - call s:RegHandler('ruby', 'syntastic#c#CheckRuby', []) + call s:RegHandler('cairo', 'syntastic#c#CheckPKG', ['cairo', 'cairo']) + call s:RegHandler('freetype', 'syntastic#c#CheckPKG', ['freetype', 'freetype2', 'freetype']) + call s:RegHandler('glade', 'syntastic#c#CheckPKG', ['glade', 'libglade-2.0', 'libglade']) + call s:RegHandler('glib', 'syntastic#c#CheckPKG', ['glib', 'glib-2.0', 'glib']) + call s:RegHandler('gtk', 'syntastic#c#CheckPKG', ['gtk', 'gtk+-2.0', 'gtk+', 'glib-2.0', 'glib']) + call s:RegHandler('libsoup', 'syntastic#c#CheckPKG', ['libsoup', 'libsoup-2.4', 'libsoup-2.2']) + call s:RegHandler('libxml', 'syntastic#c#CheckPKG', ['libxml', 'libxml-2.0', 'libxml']) + call s:RegHandler('pango', 'syntastic#c#CheckPKG', ['pango', 'pango']) + call s:RegHandler('SDL', 'syntastic#c#CheckPKG', ['sdl', 'sdl']) + call s:RegHandler('opengl', 'syntastic#c#CheckPKG', ['opengl', 'gl']) + call s:RegHandler('webkit', 'syntastic#c#CheckPKG', ['webkit', 'webkit-1.0']) + + call s:RegHandler('php\.h', 'syntastic#c#CheckPhp', []) call s:RegHandler('Python\.h', 'syntastic#c#CheckPython', []) - call s:RegHandler('php\.h', 'syntastic#c#CheckPhp', []) + call s:RegHandler('ruby', 'syntastic#c#CheckRuby', []) +endfunction + +" get the gcc include directory argument depending on the default +" includes and the optional user-defined 'g:syntastic_c_include_dirs' +function! s:GetIncludeDirs(filetype) + let include_dirs = [] + + if !exists('g:syntastic_'.a:filetype.'_no_default_include_dirs') || !g:syntastic_{a:filetype}_no_default_include_dirs + let include_dirs = copy(s:default_includes) + endif + + if exists('g:syntastic_'.a:filetype.'_include_dirs') + call extend(include_dirs, g:syntastic_{a:filetype}_include_dirs) + endif + + return join(map(syntastic#util#unique(include_dirs), 'shellescape(fnameescape("-I" . v:val))'), ' ') +endfunction + +" search the first 100 lines for include statements that are +" given in the handlers dictionary +function! s:SearchHeaders() + let includes = '' + let files = [] + let found = [] + let lines = filter(getline(1, 100), 'v:val =~# "^\s*#\s*include"') + + " search current buffer + for line in lines + let file = matchstr(line, '"\zs\S\+\ze"') + if file != '' + call add(files, file) + continue + endif + + for handler in s:handlers + if line =~# handler["regex"] + let includes .= call(handler["func"], handler["args"]) + call add(found, handler["regex"]) + break + endif + endfor + endfor + + " search included headers + for hfile in files + if hfile != '' + let filename = expand('%:p:h') . syntastic#util#Slash() . hfile + + try + let lines = readfile(filename, '', 100) + catch /^Vim\%((\a\+)\)\=:E484/ + continue + endtry + + let lines = filter(lines, 'v:val =~# "^\s*#\s*include"') + + for handler in s:handlers + if index(found, handler["regex"]) != -1 + continue + endif + + for line in lines + if line =~# handler["regex"] + let includes .= call(handler["func"], handler["args"]) + call add(found, handler["regex"]) + break + endif + endfor + endfor + endif + endfor + + return includes endfunction " try to find library with 'pkg-config' @@ -225,14 +222,14 @@ endfunction function! syntastic#c#CheckPKG(name, ...) if executable('pkg-config') if !has_key(s:cflags, a:name) - for i in range(a:0) - let l:cflags = system('pkg-config --cflags '.a:000[i]) + for pkg in a:000 + let pkg_flags = system('pkg-config --cflags ' . pkg) " since we cannot necessarily trust the pkg-config exit code " we have to check for an error output as well - if v:shell_error == 0 && l:cflags !~? 'not found' - let l:cflags = ' '.substitute(l:cflags, "\n", '', '') - let s:cflags[a:name] = l:cflags - return l:cflags + if v:shell_error == 0 && pkg_flags !~? 'not found' + let pkg_flags = ' ' . substitute(pkg_flags, "\n", '', '') + let s:cflags[a:name] = pkg_flags + return pkg_flags endif endfor else @@ -245,11 +242,11 @@ endfunction " try to find PHP includes with 'php-config' function! syntastic#c#CheckPhp() if executable('php-config') - if !exists('s:php_flags') - let s:php_flags = system('php-config --includes') - let s:php_flags = ' ' . substitute(s:php_flags, "\n", '', '') + if !has_key(s:cflags, 'php') + let s:cflags['php'] = system('php-config --includes') + let s:cflags['php'] = ' ' . substitute(s:cflags['php'], "\n", '', '') endif - return s:php_flags + return s:cflags['php'] endif return '' endfunction @@ -257,13 +254,12 @@ endfunction " try to find the ruby headers with 'rbconfig' function! syntastic#c#CheckRuby() if executable('ruby') - if !exists('s:ruby_flags') - let s:ruby_flags = system('ruby -r rbconfig -e ' - \ . '''puts Config::CONFIG["archdir"]''') - let s:ruby_flags = substitute(s:ruby_flags, "\n", '', '') - let s:ruby_flags = ' -I' . s:ruby_flags + if !has_key(s:cflags, 'ruby') + let s:cflags['ruby'] = system('ruby -r rbconfig -e ''puts Config::CONFIG["archdir"]''') + let s:cflags['ruby'] = substitute(s:cflags['ruby'], "\n", '', '') + let s:cflags['ruby'] = ' -I' . s:cflags['ruby'] endif - return s:ruby_flags + return s:cflags['ruby'] endif return '' endfunction @@ -271,13 +267,13 @@ endfunction " try to find the python headers with distutils function! syntastic#c#CheckPython() if executable('python') - if !exists('s:python_flags') - let s:python_flags = system('python -c ''from distutils import ' - \ . 'sysconfig; import sys; sys.stdout.write(sysconfig.get_python_inc())''') - let s:python_flags = substitute(s:python_flags, "\n", '', '') - let s:python_flags = ' -I' . s:python_flags + if !has_key(s:cflags, 'python') + let s:cflags['python'] = system('python -c ''from distutils import ' . + \ 'sysconfig; import sys; sys.stdout.write(sysconfig.get_python_inc())''') + let s:cflags['python'] = substitute(s:cflags['python'], "\n", '', '') + let s:cflags['python'] = ' -I' . s:cflags['python'] endif - return s:python_flags + return s:cflags['python'] endif return '' endfunction @@ -294,8 +290,13 @@ endfunction " }}}1 " default include directories -let s:default_includes = [ '.', '..', 'include', 'includes', - \ '../include', '../includes' ] +let s:default_includes = [ + \ '.', + \ '..', + \ 'include', + \ 'includes', + \ '..' . syntastic#util#Slash() . 'include', + \ '..' . syntastic#util#Slash() . 'includes' ] call s:Init() diff --git a/autoload/syntastic/util.vim b/autoload/syntastic/util.vim index 4e777b3db..b6f58d831 100644 --- a/autoload/syntastic/util.vim +++ b/autoload/syntastic/util.vim @@ -19,6 +19,11 @@ function! syntastic#util#DevNull() return '/dev/null' endfunction +" Get directory separator +function! syntastic#util#Slash() abort + return !exists("+shellslash") || &shellslash ? '/' : '\' +endfunction + "search the first 5 lines of the file for a magic number and return a map "containing the args and the executable " From 27abbceed5a1d199f58038080ef4370264ed1003 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Sat, 8 Jun 2013 11:33:18 +0300 Subject: [PATCH 0050/1271] Remove leading and trailing spaces when reading C config files. --- autoload/syntastic/c.vim | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/autoload/syntastic/c.vim b/autoload/syntastic/c.vim index 993982e68..10c9f2974 100644 --- a/autoload/syntastic/c.vim +++ b/autoload/syntastic/c.vim @@ -37,6 +37,10 @@ function! syntastic#c#ReadConfig(file) " filter out empty lines and comments call filter(lines, 'v:val !~ ''\v^(\s*#|$)''') + " remove leading and trailing spaces + call map(lines, 'substitute(v:val, ''^\s\+'', "", "")') + call map(lines, 'substitute(v:val, ''\s\+$'', "", "")') + let parameters = [] for line in lines let matches = matchlist(line, '\C^\s*-I\s*\(\S\+\)') From 7ca30a770106027f1a42cd8563cb3444ec74e686 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Sat, 8 Jun 2013 21:08:45 +0300 Subject: [PATCH 0051/1271] Bug fix: proper escaping in eruby. Fixes #29. --- syntax_checkers/eruby/ruby.vim | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/syntax_checkers/eruby/ruby.vim b/syntax_checkers/eruby/ruby.vim index aaf023ea5..2c2e40b22 100644 --- a/syntax_checkers/eruby/ruby.vim +++ b/syntax_checkers/eruby/ruby.vim @@ -24,15 +24,18 @@ function! SyntaxCheckers_eruby_ruby_IsAvailable() endfunction function! SyntaxCheckers_eruby_ruby_GetLocList() - let ruby_exec=expand(g:syntastic_ruby_exec) + let exe = expand(g:syntastic_ruby_exec) if !has('win32') - let ruby_exec='RUBYOPT= ' . ruby_exec + let exe = 'RUBYOPT= ' . exe endif - "gsub fixes issue #7 rails has it's own eruby syntax - let makeprg=ruby_exec . ' -rerb -e "puts ERB.new(File.read(''' . - \ (expand("%")) . - \ ''').gsub(''<\%='',''<\%''), nil, ''-'').src" \| ' . ruby_exec . ' -c' + let fname = fnameescape(expand('%')) + + "gsub fixes issue #7, rails has it's own eruby syntax + let makeprg = + \ exe . ' -rerb -e ' . + \ shellescape('puts ERB.new(File.read("' . fname . '").gsub(''<\%='',''<\%''), nil, ''-'').src') . + \ ' \| ' . exe . ' -c' let errorformat = \ '%-GSyntax OK,'. @@ -41,7 +44,10 @@ function! SyntaxCheckers_eruby_ruby_GetLocList() \ '%Z%p^,'. \ '%-C%.%#' - return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat}) + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'defaults': { 'bufnr': bufnr(""), 'vcol': 1 } }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ From 8afc40ff92e8c2d91c31f3a126a968942033396e Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Mon, 10 Jun 2013 23:14:59 +0300 Subject: [PATCH 0052/1271] Preserve order in checker lists. Fixes #684. Keep order from g:syntastic_[filetype]_checkers and s:defaultCheckers in getActiveCheckers(). Keep order in syntastic#util#unique(). --- autoload/syntastic/util.vim | 8 ++++++-- plugin/syntastic/registry.vim | 25 ++++++++++++++++++++----- 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/autoload/syntastic/util.vim b/autoload/syntastic/util.vim index 4e777b3db..71d3ae639 100644 --- a/autoload/syntastic/util.vim +++ b/autoload/syntastic/util.vim @@ -122,10 +122,14 @@ endfunction " Returns unique elements in a list function! syntastic#util#unique(list) let seen = {} + let uniques = [] for e in a:list - let seen[e] = 1 + if !has_key(seen, e) + let seen[e] = 1 + call add(uniques, e) + endif endfor - return copy(keys(seen)) + return uniques endfunction function! syntastic#util#debug(msg) diff --git a/plugin/syntastic/registry.vim b/plugin/syntastic/registry.vim index 9842809b8..01e0bce1e 100644 --- a/plugin/syntastic/registry.vim +++ b/plugin/syntastic/registry.vim @@ -64,7 +64,7 @@ endfunction function! g:SyntasticRegistry.getActiveCheckers(ftalias) let filetype = s:SyntasticRegistryNormaliseFiletype(a:ftalias) - let checkers = self.availableCheckersFor(filetype) + let checkers = self.availableCheckersFor(a:ftalias) if self._userHasFiletypeSettings(filetype) return self._filterCheckersByUserSettings(checkers, filetype) @@ -126,8 +126,7 @@ endfunction function! g:SyntasticRegistry._filterCheckersByDefaultSettings(checkers, filetype) if has_key(s:defaultCheckers, a:filetype) - let whitelist = s:defaultCheckers[a:filetype] - return filter(a:checkers, "index(whitelist, v:val.getName()) != -1") + return self._filterCheckersByName(a:checkers, s:defaultCheckers[a:filetype]) endif return a:checkers @@ -139,11 +138,27 @@ function! g:SyntasticRegistry._filterCheckersByUserSettings(checkers, filetype) else let whitelist = g:syntastic_{a:filetype}_checkers endif - return filter(a:checkers, "index(whitelist, v:val.getName()) != -1") + return self._filterCheckersByName(a:checkers, whitelist) +endfunction + +function! g:SyntasticRegistry._filterCheckersByName(checkers, list) + let checkers_by_name = {} + for c in a:checkers + let checkers_by_name[c.getName()] = c + endfor + + let filtered = [] + for name in a:list + if has_key(checkers_by_name, name) + call add(filtered, checkers_by_name[name]) + endif + endfor + + return filtered endfunction function! g:SyntasticRegistry._filterCheckersByAvailability(checkers) - return filter(a:checkers, "v:val.isAvailable()") + return filter(copy(a:checkers), "v:val.isAvailable()") endfunction function! g:SyntasticRegistry._loadCheckers(filetype) From 91c50d4f890a51fbf24c6326658cffb15b3f11f7 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Tue, 11 Jun 2013 21:36:44 +0300 Subject: [PATCH 0053/1271] Added option 'cwd' to SyntasticMake(). --- plugin/syntastic.vim | 10 ++++++++++ syntax_checkers/go/go.vim | 11 ++--------- syntax_checkers/go/govet.vim | 18 +++++++----------- syntax_checkers/haxe/haxe.vim | 15 ++++++++++++--- 4 files changed, 31 insertions(+), 23 deletions(-) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 213df926f..187a49126 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -315,6 +315,7 @@ endfunction " 'defaults' - a dict containing default values for the returned errors " 'subtype' - all errors will be assigned the given subtype " 'postprocess' - a list of functions to be applied to the error list +" 'cwd' - change directory to the given path before running the checker function! SyntasticMake(options) call syntastic#util#debug('SyntasticMake: called with options: '. string(a:options)) @@ -323,6 +324,7 @@ function! SyntasticMake(options) let old_shellpipe = &shellpipe let old_shell = &shell let old_errorformat = &l:errorformat + let old_cwd = getcwd() let old_lc_all = $LC_ALL if s:OSSupportsShellpipeHack() @@ -340,12 +342,20 @@ function! SyntasticMake(options) let &l:errorformat = a:options['errorformat'] endif + if has_key(a:options, 'cwd') + exec 'lcd ' . fnameescape(a:options['cwd']) + endif + let $LC_ALL = 'C' silent lmake! let $LC_ALL = old_lc_all let errors = getloclist(0) + if has_key(a:options, 'cwd') + exec 'lcd ' . fnameescape(old_cwd) + endif + call setloclist(0, old_loclist) let &l:makeprg = old_makeprg let &l:errorformat = old_errorformat diff --git a/syntax_checkers/go/go.vim b/syntax_checkers/go/go.vim index 8d023f307..e389012a5 100644 --- a/syntax_checkers/go/go.vim +++ b/syntax_checkers/go/go.vim @@ -59,21 +59,14 @@ function! SyntaxCheckers_go_go_GetLocList() " The go compiler needs to either be run with an import path as an " argument or directly from the package directory. Since figuring out - " the poper import path is fickle, just pushd/popd to the package. - let popd = getcwd() - let pushd = expand('%:p:h') - - " pushd - exec 'lcd ' . fnameescape(pushd) + " the proper import path is fickle, just cwd to the package. let errors = SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, + \ 'cwd': expand('%:p:h'), \ 'defaults': {'type': 'e'} }) - " popd - exec 'lcd ' . fnameescape(popd) - return errors endfunction diff --git a/syntax_checkers/go/govet.vim b/syntax_checkers/go/govet.vim index b4f00682e..4b1d7efb9 100644 --- a/syntax_checkers/go/govet.vim +++ b/syntax_checkers/go/govet.vim @@ -22,19 +22,15 @@ function! SyntaxCheckers_go_govet_GetLocList() let makeprg = 'go vet' let errorformat = '%Evet: %.%\+: %f:%l:%c: %m,%W%f:%l: %m,%-G%.%#' - " The go tool needs to either be run with an import path as an + " The go compiler needs to either be run with an import path as an " argument or directly from the package directory. Since figuring out - " the poper import path is fickle, just pushd/popd to the package. - let popd = getcwd() - let pushd = expand('%:p:h') - " - " pushd - exec 'lcd ' . fnameescape(pushd) + " the proper import path is fickle, just cwd to the package. - let errors = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat, 'defaults': {'type': 'w'} }) - - " popd - exec 'lcd ' . fnameescape(popd) + let errors = SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'cwd': expand('%:p:h'), + \ 'defaults': {'type': 'w'} }) return errors endfunction diff --git a/syntax_checkers/haxe/haxe.vim b/syntax_checkers/haxe/haxe.vim index 97095eec9..204eeae57 100644 --- a/syntax_checkers/haxe/haxe.vim +++ b/syntax_checkers/haxe/haxe.vim @@ -46,11 +46,20 @@ endfunction function! SyntaxCheckers_haxe_haxe_GetLocList() let [success, hxmldir, hxmlname] = s:FindInParent('*.hxml', expand('%:p:h'), '/') if success == 'ok' - let makeprg = 'cd ' . hxmldir . '; haxe ' . hxmlname + let makeprg = syntastic#makeprg#build({ + \ 'exe': 'haxe', + \ 'fname': shellescape(fnameescape(hxmlname)), + \ 'filetype': 'haxe', + \ 'subchecker': 'haxe' }) + let errorformat = '%E%f:%l: characters %c-%*[0-9] : %m' - return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) + + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'cwd': hxmldir }) else - return SyntasticMake({}) + return [] endif endfunction From 4ebd7f2a0e0b15507a28829d505d08e4681341ef Mon Sep 17 00:00:00 2001 From: Manic Chuang Date: Wed, 12 Jun 2013 12:08:42 +0800 Subject: [PATCH 0054/1271] Let eruby checker can handle UTF-8 --- syntax_checkers/eruby/ruby.vim | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/syntax_checkers/eruby/ruby.vim b/syntax_checkers/eruby/ruby.vim index 2c2e40b22..aec19cd04 100644 --- a/syntax_checkers/eruby/ruby.vim +++ b/syntax_checkers/eruby/ruby.vim @@ -25,6 +25,9 @@ endfunction function! SyntaxCheckers_eruby_ruby_GetLocList() let exe = expand(g:syntastic_ruby_exec) + let encoding_string = '' + if &encoding == 'utf-8' + let encoding_string = ', :encoding => "UTF-8"' if !has('win32') let exe = 'RUBYOPT= ' . exe endif @@ -34,7 +37,7 @@ function! SyntaxCheckers_eruby_ruby_GetLocList() "gsub fixes issue #7, rails has it's own eruby syntax let makeprg = \ exe . ' -rerb -e ' . - \ shellescape('puts ERB.new(File.read("' . fname . '").gsub(''<\%='',''<\%''), nil, ''-'').src') . + \ shellescape('puts ERB.new(File.read("' . fname . '"' . encoding_string . ').gsub(''<\%='',''<\%''), nil, ''-'').src') . \ ' \| ' . exe . ' -c' let errorformat = From 9b13ad5720a8ad94a00b4bdb770993b0a74eac0e Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Wed, 12 Jun 2013 08:00:27 +0300 Subject: [PATCH 0055/1271] eRuby: take into account &fileencoding. --- syntax_checkers/eruby/ruby.vim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/syntax_checkers/eruby/ruby.vim b/syntax_checkers/eruby/ruby.vim index aec19cd04..a25348575 100644 --- a/syntax_checkers/eruby/ruby.vim +++ b/syntax_checkers/eruby/ruby.vim @@ -25,15 +25,15 @@ endfunction function! SyntaxCheckers_eruby_ruby_GetLocList() let exe = expand(g:syntastic_ruby_exec) - let encoding_string = '' - if &encoding == 'utf-8' - let encoding_string = ', :encoding => "UTF-8"' if !has('win32') let exe = 'RUBYOPT= ' . exe endif let fname = fnameescape(expand('%')) + let enc = &fileencoding != '' ? &fileencoding : &encoding + let encoding_string = enc ==# 'utf-8' ? ', :encoding => "UTF-8"' : '' + "gsub fixes issue #7, rails has it's own eruby syntax let makeprg = \ exe . ' -rerb -e ' . From d4953a2e09acdab945b3f0abb6296d0e72850982 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Sat, 15 Jun 2013 07:36:20 +0300 Subject: [PATCH 0056/1271] Print a message if no active checkers are found. --- autoload/syntastic/util.vim | 10 +++++++++- plugin/syntastic.vim | 14 +++++++++++--- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/autoload/syntastic/util.vim b/autoload/syntastic/util.vim index 71d3ae639..f563c7e6f 100644 --- a/autoload/syntastic/util.vim +++ b/autoload/syntastic/util.vim @@ -138,13 +138,21 @@ function! syntastic#util#debug(msg) endif endfunction +function! syntastic#util#info(msg) + echomsg "syntastic: info: " . a:msg +endfunction + +function! syntastic#util#warn(msg) + echomsg "syntastic: warning: " . a:msg +endfunction + function! syntastic#util#deprecationWarn(msg) if index(s:deprecationNoticesIssued, a:msg) >= 0 return endif call add(s:deprecationNoticesIssued, a:msg) - echomsg "syntastic: warning: " . a:msg + call syntastic#util#warn(a:msg) endfunction let &cpo = s:save_cpo diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 187a49126..b6e2dba04 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -162,17 +162,17 @@ function! s:CacheErrors(...) let newLoclist = g:SyntasticLoclist.New([]) if !s:SkipFile() + let active_checkers = 0 for ft in s:CurrentFiletypes() if a:0 let checker = s:registry.getChecker(ft, a:1) - if !empty(checker) - let checkers = [checker] - endif + let checkers = !empty(checker) ? [checker] : [] else let checkers = s:registry.getActiveCheckers(ft) endif for checker in checkers + let active_checkers += 1 call syntastic#util#debug("CacheErrors: Invoking checker: " . checker.getName()) let loclist = checker.getLocList() @@ -186,6 +186,14 @@ function! s:CacheErrors(...) endif endfor endfor + + if !active_checkers + if a:0 + call syntastic#util#warn('checker ' . a:1 . ' is not active for filetype ' . &filetype) + else + call syntastic#util#info('no active checkers for filetype ' . &filetype) + endif + endif endif let b:syntastic_loclist = newLoclist From b5240f414674d04fe0ed9c8ba7614b90f5f2006b Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Sat, 15 Jun 2013 08:28:04 +0300 Subject: [PATCH 0057/1271] Debug message: shell return value. --- plugin/syntastic/checker.vim | 1 + 1 file changed, 1 insertion(+) diff --git a/plugin/syntastic/checker.vim b/plugin/syntastic/checker.vim index a5a54cba9..a3fe79356 100644 --- a/plugin/syntastic/checker.vim +++ b/plugin/syntastic/checker.vim @@ -37,6 +37,7 @@ endfunction function! g:SyntasticChecker.getLocList() let list = self._locListFunc() + call syntastic#util#debug('getLocList: checker ' . self._filetype . '/' . self._name . ' returned ' . v:shell_error) call self._populateHighlightRegexes(list) return g:SyntasticLoclist.New(list) endfunction From 324a48d46b6c972eb0db9e2fc73319c10d3f93d4 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Sun, 16 Jun 2013 06:40:28 +0300 Subject: [PATCH 0058/1271] Stop spamming the user about the active checkers. --- plugin/syntastic.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index b6e2dba04..ec2aa2bf8 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -191,7 +191,7 @@ function! s:CacheErrors(...) if a:0 call syntastic#util#warn('checker ' . a:1 . ' is not active for filetype ' . &filetype) else - call syntastic#util#info('no active checkers for filetype ' . &filetype) + call syntastic#util#debug('no active checkers for filetype ' . &filetype) endif endif endif From 9b7c407cee14fdff3560196c6b484d40cee3ca0a Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Mon, 17 Jun 2013 14:52:12 +0300 Subject: [PATCH 0059/1271] New checker: cobol/cobc (OpenCOBOL). --- README.markdown | 14 ++++----- syntax_checkers/cobol/cobc.vim | 52 ++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+), 7 deletions(-) create mode 100644 syntax_checkers/cobol/cobc.vim diff --git a/README.markdown b/README.markdown index fb8423ef6..01fbf498f 100644 --- a/README.markdown +++ b/README.markdown @@ -26,13 +26,13 @@ user is notified and is happy because they didn't have to compile their code or execute their script to find them. At the time of this writing, syntax checking plugins exist for Ada, -AppleScript, Bourne shell, C, C++, C#, CoffeeScript, Coco, Coq, CSS, -Cucumber, CUDA, D, Dart, DocBook, Elixir, Erlang, eRuby, Fortran, Gentoo -metadata, Go, Haml, Haskell, Haxe, HTML, Java, JavaScript, JSON, LESS, -LISP, LLVM intermediate language, Lua, MATLAB, NASM, Objective-C, -Objective-C++, OCaml, Perl, Perl POD, PHP, Puppet, Python, -reStructuredText, Ruby, Rust, SASS/SCSS, Scala, Slim, Tcl, TeX, Twig, -TypeScript, Vala, VHDL, xHtml, XML, XSLT, YAML, z80, Zope page +AppleScript, Bourne shell, C, C++, C#, COBOL, CoffeeScript, Coco, Coq, +CSS, Cucumber, CUDA, D, Dart, DocBook, Elixir, Erlang, eRuby, Fortran, +Gentoo metadata, Go, Haml, Haskell, Haxe, HTML, Java, JavaScript, +JSON, LESS, LISP, LLVM intermediate language, Lua, MATLAB, NASM, +Objective-C, Objective-C++, OCaml, Perl, Perl POD, PHP, Puppet, Python, +reStructuredText, Ruby, Rust, SASS/SCSS, Scala, Slim, Tcl, TeX, +Twig, TypeScript, Vala, VHDL, xHtml, XML, XSLT, YAML, z80, Zope page templates, zsh. ## Screenshot diff --git a/syntax_checkers/cobol/cobc.vim b/syntax_checkers/cobol/cobc.vim new file mode 100644 index 000000000..2a59ebd4e --- /dev/null +++ b/syntax_checkers/cobol/cobc.vim @@ -0,0 +1,52 @@ +"============================================================================ +"File: cobc.vim +"Description: Syntax checking plugin for syntastic.vim +"Maintainer: LCD 47 +"License: This program is free software. It comes without any warranty, +" to the extent permitted by applicable law. You can redistribute +" it and/or modify it under the terms of the Do What The Fuck You +" Want To Public License, Version 2, as published by Sam Hocevar. +" See http://sam.zoy.org/wtfpl/COPYING for more details. +" +"============================================================================ + + +if exists('g:loaded_syntastic_cobol_cobc_checker') + finish +endif +let g:loaded_syntastic_cobol_cobc_checker = 1 + +if !exists('g:syntastic_cobol_compiler') + let g:syntastic_cobol_compiler = 'cobc' +endif + +function! SyntaxCheckers_cobol_cobc_IsAvailable() + return executable(g:syntastic_cobol_compiler) +endfunction + +let s:save_cpo = &cpo +set cpo&vim + +if !exists('g:syntastic_cobol_compiler_options') + let g:syntastic_cobol_compiler_options = '' +endif + +if !exists('g:syntastic_cobol_config_file') + let g:syntastic_cobol_config_file = '.syntastic_cobol_config' +endif + +function! SyntaxCheckers_cobol_cobc_GetLocList() + return syntastic#c#GetLocList('cobol', { + \ 'errorformat': '%f:%l: %trror: %m', + \ 'makeprg_main': '-fsyntax-only', + \ 'headers_pattern': '^$' }) +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'cobol', + \ 'name': 'cobc'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: From 6dd8de7cdc934f04ca4ab4b69efb895766e2c6a2 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Tue, 18 Jun 2013 14:40:24 +0300 Subject: [PATCH 0060/1271] Split the puppet checker into puppet and puppetlint. --- syntax_checkers/puppet/puppet.vim | 52 +++++++++++++++ syntax_checkers/puppet/puppetlint.vim | 94 ++++----------------------- 2 files changed, 65 insertions(+), 81 deletions(-) create mode 100644 syntax_checkers/puppet/puppet.vim diff --git a/syntax_checkers/puppet/puppet.vim b/syntax_checkers/puppet/puppet.vim new file mode 100644 index 000000000..3958a8951 --- /dev/null +++ b/syntax_checkers/puppet/puppet.vim @@ -0,0 +1,52 @@ +"============================================================================ +"File: puppet.vim +"Description: Syntax checking plugin for syntastic.vim +"Maintainer: Eivind Uggedal +"License: This program is free software. It comes without any warranty, +" to the extent permitted by applicable law. You can redistribute +" it and/or modify it under the terms of the Do What The Fuck You +" Want To Public License, Version 2, as published by Sam Hocevar. +" See http://sam.zoy.org/wtfpl/COPYING for more details. +" +"============================================================================ + +if exists("g:loaded_syntastic_puppet_puppet_checker") + finish +endif +let g:loaded_syntastic_puppet_puppet_checker=1 + +function! SyntaxCheckers_puppet_puppet_IsAvailable() + return executable("puppet") +endfunction + +function! SyntaxCheckers_puppet_puppet_GetLocList() + + let ver = syntastic#util#parseVersion('puppet --version 2>' . syntastic#util#DevNull()) + + if syntastic#util#versionIsAtLeast(ver, [2,7,0]) + let args = 'parser validate --color=false' + else + let args = '--color=false --parseonly' + endif + + let makeprg = syntastic#makeprg#build({ + \ 'exe': 'puppet', + \ 'args': args, + \ 'filetype': 'puppet', + \ 'subchecker': 'puppet' }) + + let errorformat = + \ '%-Gerr: Try ''puppet help parser validate'' for usage,' . + \ '%-GError: Try ''puppet help parser validate'' for usage,' . + \ '%Eerr: Could not parse for environment %*[a-z]: %m at %f:%l,' . + \ '%EError: Could not parse for environment %*[a-z]: %m at %f:%l' + + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat }) + +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'puppet', + \ 'name': 'puppet'}) diff --git a/syntax_checkers/puppet/puppetlint.vim b/syntax_checkers/puppet/puppetlint.vim index 54f5b83b3..6ba828163 100644 --- a/syntax_checkers/puppet/puppetlint.vim +++ b/syntax_checkers/puppet/puppetlint.vim @@ -1,5 +1,5 @@ "============================================================================ -"File: puppet.vim +"File: puppetlint.vim "Description: Syntax checking plugin for syntastic.vim "Maintainer: Eivind Uggedal "License: This program is free software. It comes without any warranty, @@ -16,91 +16,23 @@ endif let g:loaded_syntastic_puppet_puppetlint_checker=1 function! SyntaxCheckers_puppet_puppetlint_IsAvailable() - return executable("puppet-lint") -endfunction - -if !exists("g:syntastic_puppet_validate_disable") - let g:syntastic_puppet_validate_disable = 0 -endif - -if !exists("g:syntastic_puppet_lint_disable") - let g:syntastic_puppet_lint_disable = 0 -endif - -if !executable("puppet-lint") - let g:syntastic_puppet_lint_disable = 1 -endif - -function! s:PuppetVersion() - if !exists("s:puppet_version") - let s:puppet_version = syntastic#util#parseVersion("puppet --version 2>" . syntastic#util#DevNull()) - endif - return s:puppet_version -endfunction - -function! s:PuppetLintVersion() - if !exists("s:puppet_lint_version") - let s:puppet_lint_version = syntastic#util#parseVersion("puppet-lint --version 2>" . syntastic#util#DevNull()) - endif - return s:puppet_lint_version -endfunction - -if !g:syntastic_puppet_lint_disable - if !syntastic#util#versionIsAtLeast(s:PuppetLintVersion(), [0,1,10]) - let g:syntastic_puppet_lint_disable = 1 - endif -end - -function! s:getPuppetLintErrors() - if !exists("g:syntastic_puppet_lint_arguments") - let g:syntastic_puppet_lint_arguments = '' - endif - - let makeprg = 'puppet-lint --log-format "\%{KIND} [\%{check}] \%{message} at \%{fullpath}:\%{linenumber}" '.g:syntastic_puppet_lint_arguments.' '.shellescape(expand('%')) - let errorformat = '%t%*[a-zA-Z] %m at %f:%l' - return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat, 'subtype': 'Style' }) -endfunction - -function! s:getPuppetMakeprg() - "If puppet is >= version 2.7 then use the new executable - if syntastic#util#versionIsAtLeast(s:PuppetVersion(), [2,7,0]) - let makeprg = 'puppet parser validate ' . - \ shellescape(expand('%')) . - \ ' --color=false' - else - let makeprg = 'puppet --color=false --parseonly '.shellescape(expand('%')) - endif - return makeprg -endfunction - -function! s:getPuppetEfm() - "some versions of puppet (e.g. 2.7.10) output the message below if there - "are any syntax errors - let errorformat = '%-Gerr: Try ''puppet help parser validate'' for usage,' - let errorformat .= 'err: Could not parse for environment %*[a-z]: %m at %f:%l' - - "Puppet 3.0.0 changes this from "err:" to "Error:" - "reset errorformat in that case - if syntastic#util#versionIsAtLeast(s:PuppetVersion(), [3,0,0]) - let errorformat = '%-GError: Try ''puppet help parser validate'' for usage,' - let errorformat .= 'Error: Could not parse for environment %*[a-z]: %m at %f:%l' - endif - - return errorformat + return executable("puppet-lint") && + \ syntastic#util#versionIsAtLeast(syntastic#util#parseVersion('puppet-lint --version 2>' . + \ syntastic#util#DevNull()), [0,1,10]) endfunction function! SyntaxCheckers_puppet_puppetlint_GetLocList() - let errors = [] + let makeprg = syntastic#makeprg#build({ + \ 'exe': 'puppet-lint', + \ 'post_args': '--log-format "\%{KIND} [\%{check}] \%{message} at \%{fullpath}:\%{linenumber}"', + \ 'filetype': 'puppet', + \ 'subchecker': 'puppetlint' }) - if !g:syntastic_puppet_validate_disable - let errors = errors + SyntasticMake({ 'makeprg': s:getPuppetMakeprg(), 'errorformat': s:getPuppetEfm() }) - endif - - if !g:syntastic_puppet_lint_disable - let errors = errors + s:getPuppetLintErrors() - endif + let errorformat = '%t%*[a-zA-Z] %m at %f:%l' - return errors + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ From 423da7852b3bfe2778aff5f5dd0ec7be497eff6d Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Tue, 18 Jun 2013 18:53:28 +0300 Subject: [PATCH 0061/1271] Registry defaults for puppet. --- plugin/syntastic/registry.vim | 1 + 1 file changed, 1 insertion(+) diff --git a/plugin/syntastic/registry.vim b/plugin/syntastic/registry.vim index 01e0bce1e..1fa5b66df 100644 --- a/plugin/syntastic/registry.vim +++ b/plugin/syntastic/registry.vim @@ -17,6 +17,7 @@ let s:defaultCheckers = { \ 'objcpp': ['gcc'], \ 'perl': ['perl', 'perlcritic'], \ 'php': ['php', 'phpcs', 'phpmd'], + \ 'puppet': ['puppet', 'puppetlint'], \ 'python': ['python', 'flake8', 'pylint'], \ 'ruby': ['mri'], \ 'sh': ['sh'], From bac4ba60c0ad14e7344cbe711ad81540cf626070 Mon Sep 17 00:00:00 2001 From: Grzegorz Smajdor Date: Tue, 18 Jun 2013 14:06:47 +0200 Subject: [PATCH 0062/1271] provide a syntax check for eruby file (cherry picked from commit e6ff3de83b9fee4f92dbc3042cf5fbcc48464f73) --- syntax_checkers/eruby/eruby.vim | 54 +++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 syntax_checkers/eruby/eruby.vim diff --git a/syntax_checkers/eruby/eruby.vim b/syntax_checkers/eruby/eruby.vim new file mode 100644 index 000000000..47c7a7856 --- /dev/null +++ b/syntax_checkers/eruby/eruby.vim @@ -0,0 +1,54 @@ +"============================================================================ +"File: eruby.vim +"Description: Syntax checking plugin for syntastic.vim +"Author: Martin Grenfell +"Modifier: Grzegorz Smajdor +"License: This program is free software. It comes without any warranty, +" to the extent permitted by applicable law. You can redistribute +" it and/or modify it under the terms of the Do What The Fuck You +" Want To Public License, Version 2, as published by Sam Hocevar. +" See http://sam.zoy.org/wtfpl/COPYING for more details. +"============================================================================ + +if exists("g:loaded_syntastic_eruby_ruby_checker") + finish +endif +let g:loaded_syntastic_eruby_ruby_checker=1 + +if !exists("g:syntastic_ruby_exec") + let g:syntastic_ruby_exec = "ruby" +endif + +function! SyntaxCheckers_eruby_ruby_IsAvailable() + return executable(expand(g:syntastic_ruby_exec)) +endfunction + +function! SyntaxCheckers_eruby_ruby_GetLocList() + let exe = expand(g:syntastic_ruby_exec) + if !has('win32') + let exe = 'RUBYOPT= ' . exe + endif + + let fname = fnameescape(expand('%')) + + let enc = &fileencoding != '' ? &fileencoding : &encoding + let encoding_string = enc ==# 'utf-8' ? ', :encoding => "UTF-8"' : '' + + let makeprg = 'erb -xT - ' . shellescape(fnameescape(fname)) . ' \| ruby -c' + + let errorformat = + \ '%-GSyntax OK,'. + \ '%E-:%l: syntax error\, %m,%Z%p^,'. + \ '%W-:%l: warning: %m,'. + \ '%Z%p^,'. + \ '%-C%.%#' + + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'defaults': { 'bufnr': bufnr(""), 'vcol': 1 } }) +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'eruby', + \ 'name': 'ruby'}) From 13ab22754e4b1ec5f4aa14912355a7d9b520e634 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Tue, 18 Jun 2013 19:47:05 +0300 Subject: [PATCH 0063/1271] Clean erb checker. --- syntax_checkers/eruby/eruby.vim | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/syntax_checkers/eruby/eruby.vim b/syntax_checkers/eruby/eruby.vim index 47c7a7856..8f9084b40 100644 --- a/syntax_checkers/eruby/eruby.vim +++ b/syntax_checkers/eruby/eruby.vim @@ -1,5 +1,5 @@ "============================================================================ -"File: eruby.vim +"File: erb.vim "Description: Syntax checking plugin for syntastic.vim "Author: Martin Grenfell "Modifier: Grzegorz Smajdor @@ -10,31 +10,32 @@ " See http://sam.zoy.org/wtfpl/COPYING for more details. "============================================================================ -if exists("g:loaded_syntastic_eruby_ruby_checker") +if exists("g:loaded_syntastic_eruby_erb_checker") finish endif -let g:loaded_syntastic_eruby_ruby_checker=1 +let g:loaded_syntastic_eruby_erb_checker=1 + +if !exists("g:syntastic_erb_exec") + let g:syntastic_erb_exec = "erb" +endif if !exists("g:syntastic_ruby_exec") let g:syntastic_ruby_exec = "ruby" endif -function! SyntaxCheckers_eruby_ruby_IsAvailable() - return executable(expand(g:syntastic_ruby_exec)) +function! SyntaxCheckers_eruby_erb_IsAvailable() + return executable(expand(g:syntastic_ruby_exec)) && executable(expand(g:syntastic_ruby_exec)) endfunction -function! SyntaxCheckers_eruby_ruby_GetLocList() - let exe = expand(g:syntastic_ruby_exec) - if !has('win32') - let exe = 'RUBYOPT= ' . exe - endif - - let fname = fnameescape(expand('%')) - +function! SyntaxCheckers_eruby_erb_GetLocList() let enc = &fileencoding != '' ? &fileencoding : &encoding - let encoding_string = enc ==# 'utf-8' ? ', :encoding => "UTF-8"' : '' - let makeprg = 'erb -xT - ' . shellescape(fnameescape(fname)) . ' \| ruby -c' + let makeprg = syntastic#makeprg#build({ + \ 'exe': g:syntastic_erb_exec, + \ 'args': '-x -T -' . (enc ==# 'utf-8' ? ' -U' : ''), + \ 'tail': '\| ' . g:syntastic_ruby_exec . ' -c', + \ 'filetype': 'eruby', + \ 'subchecker': 'erb' }) let errorformat = \ '%-GSyntax OK,'. @@ -51,4 +52,4 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'eruby', - \ 'name': 'ruby'}) + \ 'name': 'erb'}) From 9960e03628fc2f4bef2aaa322b6a329c6cbfeba5 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Tue, 18 Jun 2013 19:47:26 +0300 Subject: [PATCH 0064/1271] Rename eruby.vim -> erb.vim. --- syntax_checkers/eruby/{eruby.vim => erb.vim} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename syntax_checkers/eruby/{eruby.vim => erb.vim} (100%) diff --git a/syntax_checkers/eruby/eruby.vim b/syntax_checkers/eruby/erb.vim similarity index 100% rename from syntax_checkers/eruby/eruby.vim rename to syntax_checkers/eruby/erb.vim From db0bec7440ac86599a16b6f5bb873924ce16d201 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Wed, 19 Jun 2013 11:47:27 +0300 Subject: [PATCH 0065/1271] Give up trying to set an encoding for erb. --- syntax_checkers/eruby/erb.vim | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/syntax_checkers/eruby/erb.vim b/syntax_checkers/eruby/erb.vim index 8f9084b40..74e0e6c52 100644 --- a/syntax_checkers/eruby/erb.vim +++ b/syntax_checkers/eruby/erb.vim @@ -28,7 +28,9 @@ function! SyntaxCheckers_eruby_erb_IsAvailable() endfunction function! SyntaxCheckers_eruby_erb_GetLocList() - let enc = &fileencoding != '' ? &fileencoding : &encoding + " TODO: fix the encoding trainwreck + " let enc = &fileencoding != '' ? &fileencoding : &encoding + let enc = '' let makeprg = syntastic#makeprg#build({ \ 'exe': g:syntastic_erb_exec, From 1e4830313d746a0516f2a553a04fec58dbb47da6 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Wed, 19 Jun 2013 12:07:20 +0300 Subject: [PATCH 0066/1271] Puppetlint doesn't produce useful results without puppet. --- syntax_checkers/puppet/puppetlint.vim | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/syntax_checkers/puppet/puppetlint.vim b/syntax_checkers/puppet/puppetlint.vim index 6ba828163..322ab0297 100644 --- a/syntax_checkers/puppet/puppetlint.vim +++ b/syntax_checkers/puppet/puppetlint.vim @@ -16,7 +16,9 @@ endif let g:loaded_syntastic_puppet_puppetlint_checker=1 function! SyntaxCheckers_puppet_puppetlint_IsAvailable() - return executable("puppet-lint") && + return + \ executable("puppet") && + \ executable("puppet-lint") && \ syntastic#util#versionIsAtLeast(syntastic#util#parseVersion('puppet-lint --version 2>' . \ syntastic#util#DevNull()), [0,1,10]) endfunction From 9a4513f03ff8c22aa6a5c0fb4bcabe179a28c43a Mon Sep 17 00:00:00 2001 From: Ian Whitlock Date: Thu, 20 Jun 2013 16:08:34 -0300 Subject: [PATCH 0067/1271] Fixed typo in README --- README.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.markdown b/README.markdown index fb8423ef6..4663db1a9 100644 --- a/README.markdown +++ b/README.markdown @@ -111,7 +111,7 @@ e.g. Previously there was `g:syntastic_phpcs_conf`, now you must use `g:syntasti See `:help syntastic-checker-options` for more information. -__Q. I run a chacker and the location list is not updated...__ +__Q. I run a checker and the location list is not updated...__ A. By default, the location list is changed only when you run the `:Errors` command, in order to minimise conflicts with other plugins. If you want the location list to always be updated when you run the checkers, add this line to your vimrc: ```vim From acb15c8dc1eecfd9a0e0550a8c5577d0e8bedb61 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 21 Jun 2013 11:42:14 +0300 Subject: [PATCH 0068/1271] Use default includes only with the C-like checkers. --- autoload/syntastic/c.vim | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/autoload/syntastic/c.vim b/autoload/syntastic/c.vim index 10c9f2974..a0d2d53da 100644 --- a/autoload/syntastic/c.vim +++ b/autoload/syntastic/c.vim @@ -152,7 +152,9 @@ endfunction function! s:GetIncludeDirs(filetype) let include_dirs = [] - if !exists('g:syntastic_'.a:filetype.'_no_default_include_dirs') || !g:syntastic_{a:filetype}_no_default_include_dirs + if a:filetype =~# '\v^%(c|cpp|d|objc|objcpp)$' && + \ (!exists('g:syntastic_'.a:filetype.'_no_default_include_dirs') || + \ !g:syntastic_{a:filetype}_no_default_include_dirs) let include_dirs = copy(s:default_includes) endif From 40c71069b9bf2c6ae7c303eb146439d90e769601 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 21 Jun 2013 20:48:17 +0300 Subject: [PATCH 0069/1271] Make cursor echo handle include files. --- plugin/syntastic.vim | 3 +-- plugin/syntastic/cursor.vim | 5 +++-- plugin/syntastic/loclist.vim | 26 +++++++++++++------------- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index ec2aa2bf8..8fd41c299 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -100,8 +100,7 @@ endif function! s:BufWinEnterHook() if empty(&bt) let loclist = g:SyntasticLoclist.current() - call g:SyntasticAutoloclistNotifier.AutoToggle(loclist) - call g:SyntasticHighlightingNotifier.refresh(loclist) + call s:notifiers.refresh(loclist) endif endfunction diff --git a/plugin/syntastic/cursor.vim b/plugin/syntastic/cursor.vim index 11a2e559c..030240085 100644 --- a/plugin/syntastic/cursor.vim +++ b/plugin/syntastic/cursor.vim @@ -17,16 +17,17 @@ function! g:SyntasticCursorNotifier.New() endfunction function! g:SyntasticCursorNotifier.refresh(loclist) - autocmd! syntastic CursorMoved let enabled = exists('b:syntastic_echo_current_error') ? b:syntastic_echo_current_error : g:syntastic_echo_current_error if enabled && a:loclist.hasErrorsOrWarningsToDisplay() - let b:syntastic_messages = copy(a:loclist.messages()) + let b:syntastic_messages = copy(a:loclist.messages(bufnr(''))) let b:oldLine = -1 + autocmd! syntastic CursorMoved autocmd syntastic CursorMoved * call g:SyntasticRefreshCursor() endif endfunction function! g:SyntasticCursorNotifier.reset(loclist) + autocmd! syntastic CursorMoved unlet! b:syntastic_messages let b:oldLine = -1 endfunction diff --git a/plugin/syntastic/loclist.vim b/plugin/syntastic/loclist.vim index 0b9356217..d5cd6e394 100644 --- a/plugin/syntastic/loclist.vim +++ b/plugin/syntastic/loclist.vim @@ -92,26 +92,26 @@ function! g:SyntasticLoclist.warnings() endfunction " cache used by EchoCurrentError() -function! g:SyntasticLoclist.messages() +function! g:SyntasticLoclist.messages(buf) if !exists("self._cachedMessages") let self._cachedMessages = {} + let errors = self.errors() + (self._quietWarnings ? [] : self.warnings()) - for e in self.errors() - if !has_key(self._cachedMessages, e['lnum']) - let self._cachedMessages[e['lnum']] = e['text'] + for e in errors + let b = e['bufnr'] + let l = e['lnum'] + + if !has_key(self._cachedMessages, b) + let self._cachedMessages[b] = {} endif - endfor - if !self._quietWarnings - for e in self.warnings() - if !has_key(self._cachedMessages, e['lnum']) - let self._cachedMessages[e['lnum']] = e['text'] - endif - endfor - endif + if !has_key(self._cachedMessages[b], l) + let self._cachedMessages[b][l] = e['text'] + endif + endfor endif - return self._cachedMessages + return get(self._cachedMessages, a:buf, {}) endfunction "Filter the list and return new native loclist From 7fca0e9579a850194a1414976b57b6a50de05993 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Sat, 22 Jun 2013 08:03:03 +0300 Subject: [PATCH 0070/1271] Bug fix: add enabled/disabled guards to notifiers. Also handle the case when user disables notifiers after the first run. This doesn't work for signs though, since it causes an ugly flicker in the common case. --- plugin/syntastic/balloons.vim | 10 +++-- plugin/syntastic/cursor.vim | 7 +++- plugin/syntastic/highlighting.vim | 68 ++++++++++++++++--------------- plugin/syntastic/notifiers.vim | 6 ++- plugin/syntastic/signs.vim | 23 ++++++----- 5 files changed, 65 insertions(+), 49 deletions(-) diff --git a/plugin/syntastic/balloons.vim b/plugin/syntastic/balloons.vim index c98cb1700..f6e60418b 100644 --- a/plugin/syntastic/balloons.vim +++ b/plugin/syntastic/balloons.vim @@ -21,13 +21,15 @@ function! g:SyntasticBalloonsNotifier.New() endfunction function! g:SyntasticBalloonsNotifier.enabled() - return exists('b:syntastic_enable_balloons') ? b:syntastic_enable_balloons : g:syntastic_enable_balloons + return + \ has('balloon_eval') && + \ (exists('b:syntastic_enable_balloons') ? b:syntastic_enable_balloons : g:syntastic_enable_balloons) endfunction " Update the error balloons function! g:SyntasticBalloonsNotifier.refresh(loclist) let b:syntastic_balloons = {} - if a:loclist.hasErrorsOrWarningsToDisplay() + if self.enabled() && a:loclist.hasErrorsOrWarningsToDisplay() let buf = bufnr('') let issues = filter(a:loclist.filteredRaw(), 'v:val["bufnr"] == buf') if !empty(issues) @@ -45,7 +47,9 @@ endfunction " Reset the error balloons function! g:SyntasticBalloonsNotifier.reset(loclist) - set nobeval + if has('balloon_eval') + set nobeval + endif endfunction " Private functions {{{1 diff --git a/plugin/syntastic/cursor.vim b/plugin/syntastic/cursor.vim index 030240085..77f97dc5d 100644 --- a/plugin/syntastic/cursor.vim +++ b/plugin/syntastic/cursor.vim @@ -16,9 +16,12 @@ function! g:SyntasticCursorNotifier.New() return newObj endfunction +function! g:SyntasticCursorNotifier.enabled() + return exists('b:syntastic_echo_current_error') ? b:syntastic_echo_current_error : g:syntastic_echo_current_error +endfunction + function! g:SyntasticCursorNotifier.refresh(loclist) - let enabled = exists('b:syntastic_echo_current_error') ? b:syntastic_echo_current_error : g:syntastic_echo_current_error - if enabled && a:loclist.hasErrorsOrWarningsToDisplay() + if self.enabled() && a:loclist.hasErrorsOrWarningsToDisplay() let b:syntastic_messages = copy(a:loclist.messages(bufnr(''))) let b:oldLine = -1 autocmd! syntastic CursorMoved diff --git a/plugin/syntastic/highlighting.vim b/plugin/syntastic/highlighting.vim index 48bd4bb56..e04e6cc55 100644 --- a/plugin/syntastic/highlighting.vim +++ b/plugin/syntastic/highlighting.vim @@ -3,15 +3,13 @@ if exists("g:loaded_syntastic_notifier_highlighting") endif let g:loaded_syntastic_notifier_highlighting = 1 +" Highlighting requires getmatches introduced in 7.1.040 +let s:has_highlighting = v:version > 701 || (v:version == 701 && has('patch040')) + if !exists("g:syntastic_enable_highlighting") let g:syntastic_enable_highlighting = 1 endif -" Highlighting requires getmatches introduced in 7.1.040 -if v:version < 701 || (v:version == 701 && !has('patch040')) - let g:syntastic_enable_highlighting = 0 -endif - let g:SyntasticHighlightingNotifier = {} " Public methods {{{1 @@ -22,41 +20,47 @@ function! g:SyntasticHighlightingNotifier.New() endfunction function! g:SyntasticHighlightingNotifier.enabled() - return exists('b:syntastic_enable_highlighting') ? b:syntastic_enable_highlighting : g:syntastic_enable_highlighting + return + \ s:has_highlighting && + \ (exists('b:syntastic_enable_highlighting') ? b:syntastic_enable_highlighting : g:syntastic_enable_highlighting) endfunction " Sets error highlights in the cuirrent window function! g:SyntasticHighlightingNotifier.refresh(loclist) - call self.reset(a:loclist) - let buf = bufnr('') - let issues = filter(a:loclist.filteredRaw(), 'v:val["bufnr"] == buf') - for item in issues - let group = item['type'] == 'E' ? 'SyntasticError' : 'SyntasticWarning' - - " The function `Syntastic_{filetype}_{checker}_GetHighlightRegex` is - " used to override default highlighting. - if has_key(item, 'hl') - call matchadd(group, '\%' . item['lnum'] . 'l' . item['hl']) - elseif get(item, 'col') - let lastcol = col([item['lnum'], '$']) - let lcol = min([lastcol, item['col']]) - - " a bug in vim can sometimes cause there to be no 'vcol' key, - " so check for its existence - let coltype = has_key(item, 'vcol') && item['vcol'] ? 'v' : 'c' - - call matchadd(group, '\%' . item['lnum'] . 'l\%' . lcol . coltype) - endif - endfor + if self.enabled() + call self.reset(a:loclist) + let buf = bufnr('') + let issues = filter(a:loclist.filteredRaw(), 'v:val["bufnr"] == buf') + for item in issues + let group = item['type'] == 'E' ? 'SyntasticError' : 'SyntasticWarning' + + " The function `Syntastic_{filetype}_{checker}_GetHighlightRegex` is + " used to override default highlighting. + if has_key(item, 'hl') + call matchadd(group, '\%' . item['lnum'] . 'l' . item['hl']) + elseif get(item, 'col') + let lastcol = col([item['lnum'], '$']) + let lcol = min([lastcol, item['col']]) + + " a bug in vim can sometimes cause there to be no 'vcol' key, + " so check for its existence + let coltype = has_key(item, 'vcol') && item['vcol'] ? 'v' : 'c' + + call matchadd(group, '\%' . item['lnum'] . 'l\%' . lcol . coltype) + endif + endfor + endif endfunction " Remove all error highlights from the window function! g:SyntasticHighlightingNotifier.reset(loclist) - for match in getmatches() - if stridx(match['group'], 'Syntastic') == 0 - call matchdelete(match['id']) - endif - endfor + if s:has_highlighting + for match in getmatches() + if stridx(match['group'], 'Syntastic') == 0 + call matchdelete(match['id']) + endif + endfor + endif endfunction " vim: set sw=4 sts=4 et fdm=marker: diff --git a/plugin/syntastic/notifiers.vim b/plugin/syntastic/notifiers.vim index 1a7766aad..12f41445d 100644 --- a/plugin/syntastic/notifiers.vim +++ b/plugin/syntastic/notifiers.vim @@ -30,7 +30,11 @@ endfunction function! g:SyntasticNotifiers.reset(loclist) for type in self._enabled_types let class = substitute(type, '.*', 'Syntastic\u&Notifier', '') - if has_key(g:{class}, 'reset') && (!has_key(g:{class}, 'enabled') || self._notifier[type].enabled()) + + " reset notifiers regardless if they are enabled or not, since + " the user might have disabled them since the last refresh(); + " notifiers MUST be prepared to deal with reset() when disabled + if has_key(g:{class}, 'reset') call self._notifier[type].reset(a:loclist) endif endfor diff --git a/plugin/syntastic/signs.vim b/plugin/syntastic/signs.vim index ab3a3f369..9877269d1 100644 --- a/plugin/syntastic/signs.vim +++ b/plugin/syntastic/signs.vim @@ -23,10 +23,6 @@ if !exists("g:syntastic_style_warning_symbol") let g:syntastic_style_warning_symbol = 'S>' endif -if !has('signs') - let g:syntastic_enable_signs = 0 -endif - " start counting sign ids at 5000, start here to hopefully avoid conflicting " with any other code that places signs (not sure if this precaution is @@ -52,13 +48,16 @@ function! g:SyntasticSignsNotifier.New() endfunction function! g:SyntasticSignsNotifier.enabled() - return exists('b:syntastic_enable_signs') ? b:syntastic_enable_signs : g:syntastic_enable_signs + return + \ has('signs') && + \ exists('b:syntastic_enable_signs') ? b:syntastic_enable_signs : g:syntastic_enable_signs endfunction -" Update the error signs function! g:SyntasticSignsNotifier.refresh(loclist) let old_signs = copy(self._bufSignIds()) - call self._signErrors(a:loclist) + if self.enabled() + call self._signErrors(a:loclist) + endif call self._removeSigns(old_signs) let s:first_sign_id = s:next_sign_id endfunction @@ -125,10 +124,12 @@ endfunction " Remove the signs with the given ids from this buffer function! g:SyntasticSignsNotifier._removeSigns(ids) - for i in a:ids - exec "sign unplace " . i - call remove(self._bufSignIds(), index(self._bufSignIds(), i)) - endfor + if has('signs') + for i in a:ids + exec "sign unplace " . i + call remove(self._bufSignIds(), index(self._bufSignIds(), i)) + endfor + endif endfunction " Get all the ids of the SyntaxError signs in the buffer From cf2120474cf4b5bdf572adc4e9a59dc330a30493 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Sat, 22 Jun 2013 20:01:22 +0300 Subject: [PATCH 0071/1271] Optimisation: avoid placing duplicate signs. --- plugin/syntastic/signs.vim | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/plugin/syntastic/signs.vim b/plugin/syntastic/signs.vim index 9877269d1..067658b1e 100644 --- a/plugin/syntastic/signs.vim +++ b/plugin/syntastic/signs.vim @@ -103,21 +103,27 @@ function! g:SyntasticSignsNotifier._signErrors(loclist) let loclist = a:loclist if loclist.hasErrorsOrWarningsToDisplay() - " make sure the errors come after the warnings, so that errors mask - " the warnings on the same line, not the other way around + " errors some first, so that they are not masked by warnings let buf = bufnr('') - let issues = loclist.quietWarnings() ? [] : loclist.warnings() - call extend(issues, loclist.errors()) + let issues = copy(loclist.errors()) + if !loclist.quietWarnings() + call extend(issues, loclist.warnings()) + endif call filter(issues, 'v:val["bufnr"] == buf') + let seen = {} for i in issues - let sign_severity = i['type'] ==? 'W' ? 'Warning' : 'Error' - let sign_subtype = get(i, 'subtype', '') - let sign_type = 'Syntastic' . sign_subtype . sign_severity + if !has_key(seen, i['lnum']) + let seen[i['lnum']] = 1 + + let sign_severity = i['type'] ==? 'W' ? 'Warning' : 'Error' + let sign_subtype = get(i, 'subtype', '') + let sign_type = 'Syntastic' . sign_subtype . sign_severity - exec "sign place " . s:next_sign_id . " line=" . i['lnum'] . " name=" . sign_type . " buffer=" . i['bufnr'] - call add(self._bufSignIds(), s:next_sign_id) - let s:next_sign_id += 1 + exec "sign place " . s:next_sign_id . " line=" . i['lnum'] . " name=" . sign_type . " buffer=" . i['bufnr'] + call add(self._bufSignIds(), s:next_sign_id) + let s:next_sign_id += 1 + endif endfor endif endfunction From 233cef46fa417e86ab7309c8d7c5052ac5339d07 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Sat, 22 Jun 2013 20:17:02 +0300 Subject: [PATCH 0072/1271] Fix a few typos. --- CONTRIBUTING.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 025814f72..764ffffcd 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -2,7 +2,7 @@ When reporting a bug make sure you search the existing github issues for the same/similar issues. If you find one, feel free to add a `+1` comment with any -additonal information that may help us solve the issue. +additional information that may help us solve the issue. When creating a new issue be sure to state the following: @@ -28,8 +28,8 @@ Following the coding conventions/styles used in the syntastic core: * Use 4 space indents. * Don't use abbreviated keywords - e.g. use `endfunction`, not `endfun` (there's always room for more fun!). -* Dont use `l:` prefixes for variables unless actually required (i.e. almost never). -* Code for maintainabiliy. We would rather a function be a couple of lines longer and have (for example) some [explaining variables](http://www.refactoring.com/catalog/introduceExplainingVariable.html) to aid readability. +* Don't use `l:` prefixes for variables unless actually required (i.e. almost never). +* Code for maintainability. We would rather a function be a couple of lines longer and have (for example) some [explaining variables](http://www.refactoring.com/catalog/introduceExplainingVariable.html) to aid readability. # Syntax checker style notes From 096d2c3d9adcd6b285fd13f90a7c86af5bd0ca77 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Mon, 24 Jun 2013 11:46:27 +0300 Subject: [PATCH 0073/1271] New preprocess function "filterForeignErrors". Cleanup. --- autoload/syntastic/c.vim | 50 +++++++++++++----------------- autoload/syntastic/postprocess.vim | 5 +++ syntax_checkers/ada/gcc.vim | 6 ++-- syntax_checkers/c/gcc.vim | 6 ++-- syntax_checkers/cobol/cobc.vim | 3 +- syntax_checkers/cpp/gcc.vim | 6 ++-- syntax_checkers/d/dmd.vim | 4 +-- syntax_checkers/objc/gcc.vim | 6 ++-- syntax_checkers/objcpp/gcc.vim | 6 ++-- 9 files changed, 45 insertions(+), 47 deletions(-) diff --git a/autoload/syntastic/c.vim b/autoload/syntastic/c.vim index a0d2d53da..f5c0c0afd 100644 --- a/autoload/syntastic/c.vim +++ b/autoload/syntastic/c.vim @@ -62,31 +62,20 @@ endfunction " GetLocList() for C-like compilers function! syntastic#c#GetLocList(filetype, options) let ft = a:filetype - let errorformat = exists('g:syntastic_' . ft . '_errorformat') ? - \ g:syntastic_{ft}_errorformat : a:options['errorformat'] " determine whether to parse header files as well - if expand('%') =~? a:options['headers_pattern'] + if has_key(a:options, 'header_names') && expand('%') =~? a:options['header_names'] if exists('g:syntastic_' . ft . '_check_header') && g:syntastic_{ft}_check_header - let makeprg = - \ g:syntastic_{ft}_compiler . - \ ' ' . get(a:options, 'makeprg_headers', '') . - \ ' ' . g:syntastic_{ft}_compiler_options . - \ ' ' . s:GetIncludeDirs(ft) . - \ ' ' . syntastic#c#NullOutput() . - \ ' -c ' . shellescape(expand('%')) + let flags = get(a:options, 'header_flags', '') . ' -c ' . syntastic#c#NullOutput() else return [] endif else - let makeprg = - \ g:syntastic_{ft}_compiler . - \ ' ' . get(a:options, 'makeprg_main', '') . - \ ' ' . g:syntastic_{ft}_compiler_options . - \ ' ' . s:GetIncludeDirs(ft) . - \ ' ' . shellescape(expand('%')) + let flags = get(a:options, 'main_flags', '') endif + let flags .= ' ' . g:syntastic_{ft}_compiler_options . ' ' . s:GetIncludeDirs(ft) + " check if the user manually set some cflags if !exists('b:syntastic_' . ft . '_cflags') " check whether to search for include files at all @@ -94,33 +83,38 @@ function! syntastic#c#GetLocList(filetype, options) if ft ==# 'c' || ft ==# 'cpp' " refresh the include file search if desired if exists('g:syntastic_' . ft . '_auto_refresh_includes') && g:syntastic_{ft}_auto_refresh_includes - let makeprg .= ' ' . s:SearchHeaders() + let flags .= ' ' . s:SearchHeaders() else " search for header includes if not cached already if !exists('b:syntastic_' . ft . '_includes') let b:syntastic_{ft}_includes = s:SearchHeaders() endif - let makeprg .= ' ' . b:syntastic_{ft}_includes + let flags .= ' ' . b:syntastic_{ft}_includes endif endif endif else - " use the user-defined cflags - let makeprg .= ' ' . b:syntastic_{ft}_cflags + " user-defined cflags + let flags .= ' ' . b:syntastic_{ft}_cflags endif " add optional config file parameters - let makeprg .= ' ' . syntastic#c#ReadConfig(g:syntastic_{ft}_config_file) + let flags .= ' ' . syntastic#c#ReadConfig(g:syntastic_{ft}_config_file) - " process makeprg - let errors = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) + let makeprg = g:syntastic_{ft}_compiler . ' ' . flags . ' ' . shellescape(expand('%')) - " filter the processed errors if desired - if exists('g:syntastic_' . ft . '_remove_include_errors') && g:syntastic_{ft}_remove_include_errors - call filter(errors, 'get(v:val, "bufnr") == ' . bufnr('')) - endif + let errorformat = exists('g:syntastic_' . ft . '_errorformat') ? + \ g:syntastic_{ft}_errorformat : a:options['errorformat'] - return errors + let postprocess = + \ exists('g:syntastic_' . ft . '_remove_include_errors') && g:syntastic_{ft}_remove_include_errors ? + \ ['filterForeignErrors'] : [] + + " process makeprg + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'postprocess': postprocess }) endfunction " Private functions {{{1 diff --git a/autoload/syntastic/postprocess.vim b/autoload/syntastic/postprocess.vim index 188a28a42..a944463ec 100644 --- a/autoload/syntastic/postprocess.vim +++ b/autoload/syntastic/postprocess.vim @@ -53,6 +53,11 @@ function! syntastic#postprocess#cygwinRemoveCR(errors) return llist endfunction +" filter out errors referencing other files +function! syntastic#postprocess#filterForeignErrors(errors) + return filter(copy(a:errors), 'get(v:val, "bufnr") == ' . bufnr('')) +endfunction + let &cpo = s:save_cpo unlet s:save_cpo " vim: set et sts=4 sw=4: diff --git a/syntax_checkers/ada/gcc.vim b/syntax_checkers/ada/gcc.vim index 7a11f7c5c..f74a4b2c4 100644 --- a/syntax_checkers/ada/gcc.vim +++ b/syntax_checkers/ada/gcc.vim @@ -37,9 +37,9 @@ function! SyntaxCheckers_ada_gcc_GetLocList() \ '%-G%f:%s:,' . \ '%f:%l:%c: %m,' . \ '%f:%l: %m', - \ 'makeprg_main': '-c -x ada -fsyntax-only', - \ 'makeprg_headers': '-x ada', - \ 'headers_pattern': '\.ads$' }) + \ 'main_flags': '-c -x ada -fsyntax-only', + \ 'header_flags': '-x ada', + \ 'header_names': '\.ads$' }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/syntax_checkers/c/gcc.vim b/syntax_checkers/c/gcc.vim index 4dc1bfe71..42bb6b82f 100644 --- a/syntax_checkers/c/gcc.vim +++ b/syntax_checkers/c/gcc.vim @@ -49,9 +49,9 @@ function! SyntaxCheckers_c_gcc_GetLocList() \ '%f:%l: %trror: %m,' . \ '%f:%l: %tarning: %m,'. \ '%f:%l: %m', - \ 'makeprg_main': '-x c -fsyntax-only', - \ 'makeprg_headers': '-x c', - \ 'headers_pattern': '\.h$' }) + \ 'main_flags': '-x c -fsyntax-only', + \ 'header_flags': '-x c', + \ 'header_names': '\.h$' }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/syntax_checkers/cobol/cobc.vim b/syntax_checkers/cobol/cobc.vim index 2a59ebd4e..30306ce2c 100644 --- a/syntax_checkers/cobol/cobc.vim +++ b/syntax_checkers/cobol/cobc.vim @@ -38,8 +38,7 @@ endif function! SyntaxCheckers_cobol_cobc_GetLocList() return syntastic#c#GetLocList('cobol', { \ 'errorformat': '%f:%l: %trror: %m', - \ 'makeprg_main': '-fsyntax-only', - \ 'headers_pattern': '^$' }) + \ 'main_flags': '-fsyntax-only' }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/syntax_checkers/cpp/gcc.vim b/syntax_checkers/cpp/gcc.vim index c9b4f1b73..b4295b646 100644 --- a/syntax_checkers/cpp/gcc.vim +++ b/syntax_checkers/cpp/gcc.vim @@ -44,9 +44,9 @@ function! SyntaxCheckers_cpp_gcc_GetLocList() \ '%f:%l: %trror: %m,'. \ '%f:%l: %tarning: %m,'. \ '%f:%l: %m', - \ 'makeprg_main': '-x c++ -fsyntax-only', - \ 'makeprg_headers': '-x c++', - \ 'headers_pattern': '\.\(h\|hpp\|hh\)$' }) + \ 'main_flags': '-x c++ -fsyntax-only', + \ 'header_flags': '-x c++', + \ 'header_names': '\.\(h\|hpp\|hh\)$' }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/syntax_checkers/d/dmd.vim b/syntax_checkers/d/dmd.vim index 17baaecab..73c258a3f 100644 --- a/syntax_checkers/d/dmd.vim +++ b/syntax_checkers/d/dmd.vim @@ -44,8 +44,8 @@ function! SyntaxCheckers_d_dmd_GetLocList() \ 'errorformat': \ '%-G%f:%s:,%f(%l): %m,' . \ '%f:%l: %m', - \ 'makeprg_main': '-c -of' . syntastic#util#DevNull(), - \ 'headers_pattern': '\.di$' }) + \ 'main_flags': '-c -of' . syntastic#util#DevNull(), + \ 'header_names': '\.di$' }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/syntax_checkers/objc/gcc.vim b/syntax_checkers/objc/gcc.vim index e59d5c696..b913a6028 100644 --- a/syntax_checkers/objc/gcc.vim +++ b/syntax_checkers/objc/gcc.vim @@ -48,9 +48,9 @@ function! SyntaxCheckers_objc_gcc_GetLocList() \ '%f:%l: %trror: %m,' . \ '%f:%l: %tarning: %m,' . \ '%f:%l: %m', - \ 'makeprg_main': '-x objective-c -fsyntax-only', - \ 'makeprg_headers': '-x objective-c-header -lobjc', - \ 'headers_pattern': '\.h$' }) + \ 'main_flags': '-x objective-c -fsyntax-only', + \ 'header_flags': '-x objective-c-header -lobjc', + \ 'header_names': '\.h$' }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/syntax_checkers/objcpp/gcc.vim b/syntax_checkers/objcpp/gcc.vim index cab7efd4f..b5358b79c 100644 --- a/syntax_checkers/objcpp/gcc.vim +++ b/syntax_checkers/objcpp/gcc.vim @@ -48,9 +48,9 @@ function! SyntaxCheckers_objcpp_gcc_GetLocList() \ '%f:%l: %trror: %m,' . \ '%f:%l: %tarning: %m,' . \ '%f:%l: %m', - \ 'makeprg_main': '-x objective-c++ -fsyntax-only', - \ 'makeprg_headers': '-x objective-c++-header -lobjc', - \ 'headers_pattern': '\.h$' }) + \ 'main_flags': '-x objective-c++ -fsyntax-only', + \ 'header_flags': '-x objective-c++-header -lobjc', + \ 'header_names': '\.h$' }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ From 7d6f3cc9b3b7d2b703d7d14cc71a83a9f8f788dd Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Tue, 25 Jun 2013 09:59:07 +0300 Subject: [PATCH 0074/1271] More refactoring: add s:GetCheckerVar(). --- autoload/syntastic/c.vim | 37 ++++++++++++++++++++++------------ syntax_checkers/ada/gcc.vim | 6 +----- syntax_checkers/c/gcc.vim | 6 +----- syntax_checkers/cobol/cobc.vim | 6 +----- syntax_checkers/cpp/gcc.vim | 6 +----- syntax_checkers/d/dmd.vim | 6 +----- syntax_checkers/objc/gcc.vim | 6 +----- syntax_checkers/objcpp/gcc.vim | 6 +----- 8 files changed, 31 insertions(+), 48 deletions(-) diff --git a/autoload/syntastic/c.vim b/autoload/syntastic/c.vim index f5c0c0afd..a56d657fd 100644 --- a/autoload/syntastic/c.vim +++ b/autoload/syntastic/c.vim @@ -60,12 +60,13 @@ function! syntastic#c#ReadConfig(file) endfunction " GetLocList() for C-like compilers -function! syntastic#c#GetLocList(filetype, options) +function! syntastic#c#GetLocList(filetype, subchecker, options) let ft = a:filetype + let ck = a:subchecker " determine whether to parse header files as well if has_key(a:options, 'header_names') && expand('%') =~? a:options['header_names'] - if exists('g:syntastic_' . ft . '_check_header') && g:syntastic_{ft}_check_header + if s:GetCheckerVar('g', ft, ck, 'check_header', 0) let flags = get(a:options, 'header_flags', '') . ' -c ' . syntastic#c#NullOutput() else return [] @@ -74,15 +75,16 @@ function! syntastic#c#GetLocList(filetype, options) let flags = get(a:options, 'main_flags', '') endif - let flags .= ' ' . g:syntastic_{ft}_compiler_options . ' ' . s:GetIncludeDirs(ft) + let flags .= ' ' . s:GetCheckerVar('g', ft, ck, 'compiler_options', '') . ' ' . s:GetIncludeDirs(ft) " check if the user manually set some cflags - if !exists('b:syntastic_' . ft . '_cflags') + let b_cflags = s:GetCheckerVar('b', ft, ck, 'cflags', '') + if b_cflags == '' " check whether to search for include files at all - if !exists('g:syntastic_' . ft . '_no_include_search') || !g:syntastic_{ft}_no_include_search + if !s:GetCheckerVar('g', ft, ck, 'no_include_search', 0) if ft ==# 'c' || ft ==# 'cpp' " refresh the include file search if desired - if exists('g:syntastic_' . ft . '_auto_refresh_includes') && g:syntastic_{ft}_auto_refresh_includes + if s:GetCheckerVar('g', ft, ck, 'auto_refresh_includes', 0) let flags .= ' ' . s:SearchHeaders() else " search for header includes if not cached already @@ -95,20 +97,17 @@ function! syntastic#c#GetLocList(filetype, options) endif else " user-defined cflags - let flags .= ' ' . b:syntastic_{ft}_cflags + let flags .= ' ' . b_cflags endif " add optional config file parameters - let flags .= ' ' . syntastic#c#ReadConfig(g:syntastic_{ft}_config_file) + let flags .= ' ' . syntastic#c#ReadConfig(s:GetCheckerVar('g', ft, ck, 'config_file', '.syntastic_' . ft . '_config')) let makeprg = g:syntastic_{ft}_compiler . ' ' . flags . ' ' . shellescape(expand('%')) - let errorformat = exists('g:syntastic_' . ft . '_errorformat') ? - \ g:syntastic_{ft}_errorformat : a:options['errorformat'] + let errorformat = s:GetCheckerVar('g', ft, ck, 'errorformat', a:options['errorformat']) - let postprocess = - \ exists('g:syntastic_' . ft . '_remove_include_errors') && g:syntastic_{ft}_remove_include_errors ? - \ ['filterForeignErrors'] : [] + let postprocess = s:GetCheckerVar('g', ft, ck, 'remove_include_errors', 0) ? ['filterForeignErrors'] : [] " process makeprg return SyntasticMake({ @@ -141,6 +140,18 @@ function! s:Init() call s:RegHandler('ruby', 'syntastic#c#CheckRuby', []) endfunction +" +function! s:GetCheckerVar(scope, filetype, subchecker, name, default) + let prefix = a:scope . ':' . 'syntastic_' + if exists(prefix . a:filetype . '_' . a:subchecker . '_' . a:name) + return {a:scope}:syntastic_{a:filetype}_{a:subchecker}_{a:name} + elseif exists(prefix . a:filetype . '_' . a:name) + return {a:scope}:syntastic_{a:filetype}_{a:name} + else + return a:default + endif +endfunction + " get the gcc include directory argument depending on the default " includes and the optional user-defined 'g:syntastic_c_include_dirs' function! s:GetIncludeDirs(filetype) diff --git a/syntax_checkers/ada/gcc.vim b/syntax_checkers/ada/gcc.vim index f74a4b2c4..7562d6093 100644 --- a/syntax_checkers/ada/gcc.vim +++ b/syntax_checkers/ada/gcc.vim @@ -27,12 +27,8 @@ if !exists('g:syntastic_ada_compiler_options') let g:syntastic_ada_compiler_options = '' endif -if !exists('g:syntastic_ada_config_file') - let g:syntastic_ada_config_file = '.syntastic_ada_config' -endif - function! SyntaxCheckers_ada_gcc_GetLocList() - return syntastic#c#GetLocList('ada', { + return syntastic#c#GetLocList('ada', 'gcc', { \ 'errorformat': \ '%-G%f:%s:,' . \ '%f:%l:%c: %m,' . diff --git a/syntax_checkers/c/gcc.vim b/syntax_checkers/c/gcc.vim index 42bb6b82f..f0c577b55 100644 --- a/syntax_checkers/c/gcc.vim +++ b/syntax_checkers/c/gcc.vim @@ -31,12 +31,8 @@ if !exists('g:syntastic_c_compiler_options') let g:syntastic_c_compiler_options = '-std=gnu99' endif -if !exists('g:syntastic_c_config_file') - let g:syntastic_c_config_file = '.syntastic_c_config' -endif - function! SyntaxCheckers_c_gcc_GetLocList() - return syntastic#c#GetLocList('c', { + return syntastic#c#GetLocList('c', 'gcc', { \ 'errorformat': \ '%-G%f:%s:,' . \ '%-G%f:%l: %#error: %#(Each undeclared identifier is reported only%.%#,' . diff --git a/syntax_checkers/cobol/cobc.vim b/syntax_checkers/cobol/cobc.vim index 30306ce2c..9399d432a 100644 --- a/syntax_checkers/cobol/cobc.vim +++ b/syntax_checkers/cobol/cobc.vim @@ -31,12 +31,8 @@ if !exists('g:syntastic_cobol_compiler_options') let g:syntastic_cobol_compiler_options = '' endif -if !exists('g:syntastic_cobol_config_file') - let g:syntastic_cobol_config_file = '.syntastic_cobol_config' -endif - function! SyntaxCheckers_cobol_cobc_GetLocList() - return syntastic#c#GetLocList('cobol', { + return syntastic#c#GetLocList('cobol', 'cobc', { \ 'errorformat': '%f:%l: %trror: %m', \ 'main_flags': '-fsyntax-only' }) endfunction diff --git a/syntax_checkers/cpp/gcc.vim b/syntax_checkers/cpp/gcc.vim index b4295b646..643379276 100644 --- a/syntax_checkers/cpp/gcc.vim +++ b/syntax_checkers/cpp/gcc.vim @@ -30,12 +30,8 @@ if !exists('g:syntastic_cpp_compiler_options') let g:syntastic_cpp_compiler_options = '' endif -if !exists('g:syntastic_cpp_config_file') - let g:syntastic_cpp_config_file = '.syntastic_cpp_config' -endif - function! SyntaxCheckers_cpp_gcc_GetLocList() - return syntastic#c#GetLocList('cpp', { + return syntastic#c#GetLocList('cpp', 'gcc', { \ 'errorformat': \ '%-G%f:%s:,' . \ '%f:%l:%c: %trror: %m,' . diff --git a/syntax_checkers/d/dmd.vim b/syntax_checkers/d/dmd.vim index 73c258a3f..1544caf7e 100644 --- a/syntax_checkers/d/dmd.vim +++ b/syntax_checkers/d/dmd.vim @@ -35,12 +35,8 @@ if !exists('g:syntastic_d_compiler_options') let g:syntastic_d_compiler_options = '' endif -if !exists('g:syntastic_d_config_file') - let g:syntastic_d_config_file = '.syntastic_d_config' -endif - function! SyntaxCheckers_d_dmd_GetLocList() - return syntastic#c#GetLocList('d', { + return syntastic#c#GetLocList('d', 'dmd', { \ 'errorformat': \ '%-G%f:%s:,%f(%l): %m,' . \ '%f:%l: %m', diff --git a/syntax_checkers/objc/gcc.vim b/syntax_checkers/objc/gcc.vim index b913a6028..52965e5d5 100644 --- a/syntax_checkers/objc/gcc.vim +++ b/syntax_checkers/objc/gcc.vim @@ -30,12 +30,8 @@ if !exists('g:syntastic_objc_compiler_options') let g:syntastic_objc_compiler_options = '-std=gnu99' endif -if !exists('g:syntastic_objc_config_file') - let g:syntastic_objc_config_file = '.syntastic_objc_config' -endif - function! SyntaxCheckers_objc_gcc_GetLocList() - return syntastic#c#GetLocList('objc', { + return syntastic#c#GetLocList('objc', 'gcc', { \ 'errorformat': \ '%-G%f:%s:,' . \ '%-G%f:%l: %#error: %#(Each undeclared identifier is reported only%.%#,' . diff --git a/syntax_checkers/objcpp/gcc.vim b/syntax_checkers/objcpp/gcc.vim index b5358b79c..c05166c95 100644 --- a/syntax_checkers/objcpp/gcc.vim +++ b/syntax_checkers/objcpp/gcc.vim @@ -30,12 +30,8 @@ if !exists('g:syntastic_objcpp_compiler_options') let g:syntastic_objcpp_compiler_options = '-std=gnu99' endif -if !exists('g:syntastic_objcpp_config_file') - let g:syntastic_objcpp_config_file = '.syntastic_objcpp_config' -endif - function! SyntaxCheckers_objcpp_gcc_GetLocList() - return syntastic#c#GetLocList('objcpp', { + return syntastic#c#GetLocList('objcpp', 'gcc', { \ 'errorformat': \ '%-G%f:%s:,' . \ '%-G%f:%l: %#error: %#(Each undeclared identifier is reported only%.%#,' . From b215c544182175b3885e5ecb1cda57f24e7d8087 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Tue, 25 Jun 2013 21:12:23 +0300 Subject: [PATCH 0075/1271] Variable g:systastic_puppet_lint_arguments is deprecated. --- syntax_checkers/puppet/puppetlint.vim | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/syntax_checkers/puppet/puppetlint.vim b/syntax_checkers/puppet/puppetlint.vim index 322ab0297..eb0f552d4 100644 --- a/syntax_checkers/puppet/puppetlint.vim +++ b/syntax_checkers/puppet/puppetlint.vim @@ -15,6 +15,11 @@ if exists("g:loaded_syntastic_puppet_puppetlint_checker") endif let g:loaded_syntastic_puppet_puppetlint_checker=1 +if exists("g:systastic_puppet_lint_arguments") + let g:systastic_puppet_puppetlint_args = g:systastic_puppet_lint_arguments + call syntastic#util#deprecationWarn("variable g:systastic_puppet_lint_arguments is deprecated, please use g:systastic_puppet_puppetlint_args instead") +endif + function! SyntaxCheckers_puppet_puppetlint_IsAvailable() return \ executable("puppet") && From b8a785caaa35598b5d0f2eb086f179c20da9105a Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Wed, 26 Jun 2013 16:58:27 +0300 Subject: [PATCH 0076/1271] Change the gfortran checker to use syntastic#c#GetLocList(). --- syntax_checkers/fortran/gfortran.vim | 59 +++++++++++----------------- 1 file changed, 24 insertions(+), 35 deletions(-) diff --git a/syntax_checkers/fortran/gfortran.vim b/syntax_checkers/fortran/gfortran.vim index 0df45d3ab..002ad9c34 100644 --- a/syntax_checkers/fortran/gfortran.vim +++ b/syntax_checkers/fortran/gfortran.vim @@ -7,14 +7,6 @@ " 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. -"Note: This syntax checker uses gfortran with the option -fsyntax-only -" to check for errors and warnings. Additional flags may be -" supplied through both local and global variables, -" b:syntastic_fortran_flags, -" g:syntastic_fortran_flags. -" This is particularly useful when the source requires module files -" in order to compile (that is when it needs modules defined in -" separate files). " "============================================================================ @@ -23,41 +15,38 @@ if exists("g:loaded_syntastic_fortran_gfortran_checker") endif let g:loaded_syntastic_fortran_gfortran_checker=1 -if !exists('g:syntastic_fortran_flags') - let g:syntastic_fortran_flags = '' +if !exists('g:syntastic_fortran_compiler') + let g:syntastic_fortran_compiler = 'gfortran' endif function! SyntaxCheckers_fortran_gfortran_IsAvailable() - return executable('gfortran') + return executable(g:syntastic_fortran_compiler) endfunction -function! SyntaxCheckers_fortran_gfortran_GetLocList() - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'gfortran', - \ 'args': s:args(), - \ 'filetype': 'fortran', - \ 'subchecker': 'gfortran' }) - - let errorformat = - \ '%-C %#,'. - \ '%-C %#%.%#,'. - \ '%A%f:%l.%c:,'. - \ '%Z%m,'. - \ '%G%.%#' - - return SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat }) -endfunction +let s:save_cpo = &cpo +set cpo&vim + +if !exists('g:syntastic_fortran_compiler_options') + let g:syntastic_fortran_compiler_options = '' +endif -function s:args() - let rv = '-fsyntax-only ' . g:syntastic_fortran_flags - if exists('b:syntastic_fortran_flags') - let rv .= " " . b:syntastic_fortran_flags - endif - return rv +function! SyntaxCheckers_fortran_gfortran_GetLocList() + return syntastic#c#GetLocList('fortran', 'gfortran', { + \ 'errorformat': + \ '%-C %#,'. + \ '%-C %#%.%#,'. + \ '%A%f:%l.%c:,'. + \ '%Z%trror: %m,'. + \ '%Z%tarning: %m,'. + \ '%-G%.%#', + \ 'main_flags': '-fsyntax-only' }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'fortran', \ 'name': 'gfortran'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: From d1206033edab557a3c7aac468e31f49ad7ae7872 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 28 Jun 2013 08:43:16 +0300 Subject: [PATCH 0077/1271] Checkstyle is (surprise!) a style checker. --- syntax_checkers/java/checkstyle.vim | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/syntax_checkers/java/checkstyle.vim b/syntax_checkers/java/checkstyle.vim index a368df315..da32c65cb 100644 --- a/syntax_checkers/java/checkstyle.vim +++ b/syntax_checkers/java/checkstyle.vim @@ -43,12 +43,14 @@ function! SyntaxCheckers_java_checkstyle_GetLocList() \ 'filetype': 'java', \ 'subchecker': 'checkstyle' }) - " check style format - let errorformat = '%f:%l:%c:\ %m,%f:%l:\ %m' + let errorformat = + \ '%f:%l:%c:\ %m,' . + \ '%f:%l:\ %m' return SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, + \ 'subtype': 'Style', \ 'postprocess': ['cygwinRemoveCR'] }) endfunction From 6142b17d082b88c70dcaa3d50d7525dd97e5a95b Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 28 Jun 2013 20:25:17 +0300 Subject: [PATCH 0078/1271] More refactoring: add s:GetCflags(). --- autoload/syntastic/c.vim | 101 ++++++++++++++++++++++----------------- 1 file changed, 56 insertions(+), 45 deletions(-) diff --git a/autoload/syntastic/c.vim b/autoload/syntastic/c.vim index a56d657fd..9587a3387 100644 --- a/autoload/syntastic/c.vim +++ b/autoload/syntastic/c.vim @@ -61,53 +61,18 @@ endfunction " GetLocList() for C-like compilers function! syntastic#c#GetLocList(filetype, subchecker, options) - let ft = a:filetype - let ck = a:subchecker - - " determine whether to parse header files as well - if has_key(a:options, 'header_names') && expand('%') =~? a:options['header_names'] - if s:GetCheckerVar('g', ft, ck, 'check_header', 0) - let flags = get(a:options, 'header_flags', '') . ' -c ' . syntastic#c#NullOutput() - else - return [] - endif - else - let flags = get(a:options, 'main_flags', '') - endif - - let flags .= ' ' . s:GetCheckerVar('g', ft, ck, 'compiler_options', '') . ' ' . s:GetIncludeDirs(ft) - - " check if the user manually set some cflags - let b_cflags = s:GetCheckerVar('b', ft, ck, 'cflags', '') - if b_cflags == '' - " check whether to search for include files at all - if !s:GetCheckerVar('g', ft, ck, 'no_include_search', 0) - if ft ==# 'c' || ft ==# 'cpp' - " refresh the include file search if desired - if s:GetCheckerVar('g', ft, ck, 'auto_refresh_includes', 0) - let flags .= ' ' . s:SearchHeaders() - else - " search for header includes if not cached already - if !exists('b:syntastic_' . ft . '_includes') - let b:syntastic_{ft}_includes = s:SearchHeaders() - endif - let flags .= ' ' . b:syntastic_{ft}_includes - endif - endif - endif - else - " user-defined cflags - let flags .= ' ' . b_cflags - endif - - " add optional config file parameters - let flags .= ' ' . syntastic#c#ReadConfig(s:GetCheckerVar('g', ft, ck, 'config_file', '.syntastic_' . ft . '_config')) + try + let flags = s:GetCflags(a:filetype, a:subchecker, a:options) + catch /\m\C^syntastic_skip_checks$/ + return [] + endtry - let makeprg = g:syntastic_{ft}_compiler . ' ' . flags . ' ' . shellescape(expand('%')) + let makeprg = g:syntastic_{a:filetype}_compiler . ' ' . flags . ' ' . shellescape(expand('%')) - let errorformat = s:GetCheckerVar('g', ft, ck, 'errorformat', a:options['errorformat']) + let errorformat = s:GetCheckerVar('g', a:filetype, a:subchecker, 'errorformat', a:options['errorformat']) - let postprocess = s:GetCheckerVar('g', ft, ck, 'remove_include_errors', 0) ? ['filterForeignErrors'] : [] + let postprocess = s:GetCheckerVar('g', a:filetype, a:subchecker, 'remove_include_errors', 0) ? + \ ['filterForeignErrors'] : [] " process makeprg return SyntasticMake({ @@ -140,7 +105,7 @@ function! s:Init() call s:RegHandler('ruby', 'syntastic#c#CheckRuby', []) endfunction -" +" resolve checker-related user variables function! s:GetCheckerVar(scope, filetype, subchecker, name, default) let prefix = a:scope . ':' . 'syntastic_' if exists(prefix . a:filetype . '_' . a:subchecker . '_' . a:name) @@ -152,6 +117,52 @@ function! s:GetCheckerVar(scope, filetype, subchecker, name, default) endif endfunction +" resolve user CFLAGS +function! s:GetCflags(ft, ck, opts) + " determine whether to parse header files as well + if has_key(a:opts, 'header_names') && expand('%') =~? a:opts['header_names'] + if s:GetCheckerVar('g', a:ft, a:ck, 'check_header', 0) + let flags = get(a:opts, 'header_flags', '') . ' -c ' . syntastic#c#NullOutput() + else + " checking headers when check_header is unset: bail out + throw 'syntastic_skip_checks' + endif + else + let flags = get(a:opts, 'main_flags', '') + endif + + let flags .= ' ' . s:GetCheckerVar('g', a:ft, a:ck, 'compiler_options', '') . ' ' . s:GetIncludeDirs(a:ft) + + " check if the user manually set some cflags + let b_cflags = s:GetCheckerVar('b', a:ft, a:ck, 'cflags', '') + if b_cflags == '' + " check whether to search for include files at all + if !s:GetCheckerVar('g', a:ft, a:ck, 'no_include_search', 0) + if a:ft ==# 'c' || a:ft ==# 'cpp' + " refresh the include file search if desired + if s:GetCheckerVar('g', a:ft, a:ck, 'auto_refresh_includes', 0) + let flags .= ' ' . s:SearchHeaders() + else + " search for header includes if not cached already + if !exists('b:syntastic_' . a:ft . '_includes') + let b:syntastic_{a:ft}_includes = s:SearchHeaders() + endif + let flags .= ' ' . b:syntastic_{a:ft}_includes + endif + endif + endif + else + " user-defined cflags + let flags .= ' ' . b_cflags + endif + + " add optional config file parameters + let config_file = s:GetCheckerVar('g', a:ft, a:ck, 'config_file', '.syntastic_' . a:ft . '_config') + let flags .= ' ' . syntastic#c#ReadConfig(config_file) + + return flags +endfunction + " get the gcc include directory argument depending on the default " includes and the optional user-defined 'g:syntastic_c_include_dirs' function! s:GetIncludeDirs(filetype) From 4fce1cabe00509654b76fb8df2617b7db8182706 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 28 Jun 2013 21:24:38 +0300 Subject: [PATCH 0079/1271] Make checkstyle aware of message priorities. Known bug: this breaks if the name of the file being checked contain one of the characters <, >, ', ", &. --- autoload/syntastic/postprocess.vim | 16 ++++++++++++++++ syntax_checkers/java/checkstyle.vim | 14 ++++++++++---- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/autoload/syntastic/postprocess.vim b/autoload/syntastic/postprocess.vim index 188a28a42..53e52dfdc 100644 --- a/autoload/syntastic/postprocess.vim +++ b/autoload/syntastic/postprocess.vim @@ -53,6 +53,22 @@ function! syntastic#postprocess#cygwinRemoveCR(errors) return llist endfunction +" decode XML entities +function! syntastic#postprocess#decodeXMLEntities(errors) + let llist = [] + + for e in a:errors + let e['text'] = substitute(e['text'], '<', '<', 'g') + let e['text'] = substitute(e['text'], '>', '>', 'g') + let e['text'] = substitute(e['text'], '"', '"', 'g') + let e['text'] = substitute(e['text'], ''', "'", 'g') + let e['text'] = substitute(e['text'], '&', '\&', 'g') + call add(llist, e) + endfor + + return llist +endfunction + let &cpo = s:save_cpo unlet s:save_cpo " vim: set et sts=4 sw=4: diff --git a/syntax_checkers/java/checkstyle.vim b/syntax_checkers/java/checkstyle.vim index da32c65cb..bb136f1d7 100644 --- a/syntax_checkers/java/checkstyle.vim +++ b/syntax_checkers/java/checkstyle.vim @@ -38,20 +38,26 @@ 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, + \ ' com.puppycrawl.tools.checkstyle.Main -c ' . g:syntastic_java_checkstyle_conf_file . + \ ' -f xml', \ 'fname': fname, \ 'filetype': 'java', \ 'subchecker': 'checkstyle' }) let errorformat = - \ '%f:%l:%c:\ %m,' . - \ '%f:%l:\ %m' + \ '%P,' . + \ '%Q,' . + \ '%E,' . + \ '%E,' . + \ '%E,' . + \ '%E,' . + \ '%-G%.%#' return SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, \ 'subtype': 'Style', - \ 'postprocess': ['cygwinRemoveCR'] }) + \ 'postprocess': ['cygwinRemoveCR', 'decodeXMLEntities'] }) endfunction From 81bce15f787499988bcca08a32b3998b11629b23 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Sat, 29 Jun 2013 10:55:43 +0300 Subject: [PATCH 0080/1271] More encoding problems in the eruby/ruby checker. --- syntax_checkers/eruby/ruby.vim | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/syntax_checkers/eruby/ruby.vim b/syntax_checkers/eruby/ruby.vim index a25348575..d32dd6e69 100644 --- a/syntax_checkers/eruby/ruby.vim +++ b/syntax_checkers/eruby/ruby.vim @@ -32,12 +32,14 @@ function! SyntaxCheckers_eruby_ruby_GetLocList() let fname = fnameescape(expand('%')) let enc = &fileencoding != '' ? &fileencoding : &encoding - let encoding_string = enc ==# 'utf-8' ? ', :encoding => "UTF-8"' : '' + let encoding_string = enc ==? 'utf-8' ? 'UTF-8' : 'BINARY' "gsub fixes issue #7, rails has it's own eruby syntax let makeprg = \ exe . ' -rerb -e ' . - \ shellescape('puts ERB.new(File.read("' . fname . '"' . encoding_string . ').gsub(''<\%='',''<\%''), nil, ''-'').src') . + \ shellescape('puts ERB.new(File.read("' . fname . + \ '", :encoding => "' . encoding_string . + \ '").gsub(''<\%='',''<\%''), nil, ''-'').src') . \ ' \| ' . exe . ' -c' let errorformat = From 97bda4e370a1aec94bd87790c707c25020d8d333 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Sat, 29 Jun 2013 13:03:28 +0300 Subject: [PATCH 0081/1271] Bug fix: incomplete registering of cloned checkers. Scenario: - a C file is recognized as having filetype cpp - run :SyntasticInfo - run :setf c - run :SyntasticInfo again The only checker recognized will be oclint. The reason is, oclint is registered as a c checker when called from cpp initialization, and that prevents registering other c checkers when calling ':setf c'. Solution: always initialize all checkers for a filetype. --- syntax_checkers/cpp/oclint.vim | 4 ++-- syntax_checkers/cpp/ycm.vim | 4 ++-- syntax_checkers/css/phpcs.vim | 4 ++-- syntax_checkers/docbk/xmllint.vim | 4 ++-- syntax_checkers/gentoo_metadata/xmllint.vim | 4 ++-- syntax_checkers/objc/oclint.vim | 4 ++-- syntax_checkers/objc/ycm.vim | 2 +- syntax_checkers/objcpp/oclint.vim | 4 ++-- syntax_checkers/objcpp/ycm.vim | 2 +- syntax_checkers/perl/podchecker.vim | 4 ++-- syntax_checkers/scss/sass.vim | 4 ++-- syntax_checkers/xslt/xmllint.vim | 4 ++-- 12 files changed, 22 insertions(+), 22 deletions(-) diff --git a/syntax_checkers/cpp/oclint.vim b/syntax_checkers/cpp/oclint.vim index 1586d8350..867f15de7 100644 --- a/syntax_checkers/cpp/oclint.vim +++ b/syntax_checkers/cpp/oclint.vim @@ -21,8 +21,6 @@ if exists("g:loaded_syntastic_cpp_oclint_checker") endif let g:loaded_syntastic_cpp_oclint_checker = 1 -runtime syntax_checkers/c/oclint.vim - function! SyntaxCheckers_cpp_oclint_IsAvailable() return SyntaxCheckers_c_oclint_IsAvailable() endfunction @@ -34,3 +32,5 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'cpp', \ 'name': 'oclint'}) + +runtime! syntax_checkers/c/*.vim diff --git a/syntax_checkers/cpp/ycm.vim b/syntax_checkers/cpp/ycm.vim index f7c19e955..b0dbab580 100644 --- a/syntax_checkers/cpp/ycm.vim +++ b/syntax_checkers/cpp/ycm.vim @@ -15,8 +15,6 @@ if exists("g:loaded_syntastic_cpp_ycm_checker") endif let g:loaded_syntastic_cpp_ycm_checker = 1 -runtime syntax_checkers/c/ycm.vim - function! SyntaxCheckers_cpp_ycm_IsAvailable() return SyntaxCheckers_c_ycm_IsAvailable() endfunction @@ -32,3 +30,5 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'cpp', \ 'name': 'ycm'}) + +runtime! syntax_checkers/c/*.vim diff --git a/syntax_checkers/css/phpcs.vim b/syntax_checkers/css/phpcs.vim index aebedac56..ffcb7feeb 100644 --- a/syntax_checkers/css/phpcs.vim +++ b/syntax_checkers/css/phpcs.vim @@ -18,8 +18,6 @@ if exists("g:loaded_syntastic_css_phpcs_checker") endif let g:loaded_syntastic_css_phpcs_checker=1 -runtime syntax_checkers/php/phpcs.vim - function! SyntaxCheckers_css_phpcs_IsAvailable() return SyntaxCheckers_php_phpcs_IsAvailable() endfunction @@ -31,3 +29,5 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'css', \ 'name': 'phpcs'}) + +runtime! syntax_checkers/php/*.vim diff --git a/syntax_checkers/docbk/xmllint.vim b/syntax_checkers/docbk/xmllint.vim index f06123950..cc0e3e35c 100644 --- a/syntax_checkers/docbk/xmllint.vim +++ b/syntax_checkers/docbk/xmllint.vim @@ -15,8 +15,6 @@ if exists("g:loaded_syntastic_docbk_xmllint_checker") endif let g:loaded_syntastic_docbk_xmllint_checker=1 -runtime syntax_checkers/xml/xmllint.vim - function! SyntaxCheckers_docbk_xmllint_IsAvailable() return SyntaxCheckers_xml_xmllint_IsAvailable() endfunction @@ -28,3 +26,5 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'docbk', \ 'name': 'xmllint'}) + +runtime! syntax_checkers/xml/*.vim diff --git a/syntax_checkers/gentoo_metadata/xmllint.vim b/syntax_checkers/gentoo_metadata/xmllint.vim index 9b81c86fa..2e92707fe 100644 --- a/syntax_checkers/gentoo_metadata/xmllint.vim +++ b/syntax_checkers/gentoo_metadata/xmllint.vim @@ -25,8 +25,6 @@ if exists("g:loaded_syntastic_gentoo_metadata_xmllint_checker") endif let g:loaded_syntastic_gentoo_metadata_xmllint_checker=1 -runtime syntax_checkers/xml/xmllint.vim - function! SyntaxCheckers_gentoo_metadata_xmllint_IsAvailable() return SyntaxCheckers_xml_xmllint_IsAvailable() endfunction @@ -38,3 +36,5 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'gentoo_metadata', \ 'name': 'xmllint'}) + +runtime! syntax_checkers/xml/*.vim diff --git a/syntax_checkers/objc/oclint.vim b/syntax_checkers/objc/oclint.vim index 59a3996b0..0ebd6612b 100644 --- a/syntax_checkers/objc/oclint.vim +++ b/syntax_checkers/objc/oclint.vim @@ -21,8 +21,6 @@ if exists("g:loaded_syntastic_objc_oclint_checker") endif let g:loaded_syntastic_objc_oclint_checker = 1 -runtime syntax_checkers/c/oclint.vim - function! SyntaxCheckers_objc_oclint_IsAvailable() return SyntaxCheckers_c_oclint_IsAvailable() endfunction @@ -34,3 +32,5 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'objc', \ 'name': 'oclint'}) + +runtime! syntax_checkers/c/*.vim diff --git a/syntax_checkers/objc/ycm.vim b/syntax_checkers/objc/ycm.vim index a2250a3c5..40f53fb4b 100644 --- a/syntax_checkers/objc/ycm.vim +++ b/syntax_checkers/objc/ycm.vim @@ -15,7 +15,7 @@ if exists("g:loaded_syntastic_objc_ycm_checker") endif let g:loaded_syntastic_objc_ycm_checker = 1 -runtime syntax_checkers/c/ycm.vim +runtime! syntax_checkers/c/*.vim function! SyntaxCheckers_objc_ycm_IsAvailable() return SyntaxCheckers_c_ycm_IsAvailable() diff --git a/syntax_checkers/objcpp/oclint.vim b/syntax_checkers/objcpp/oclint.vim index 9a02abb76..a46fe0453 100644 --- a/syntax_checkers/objcpp/oclint.vim +++ b/syntax_checkers/objcpp/oclint.vim @@ -21,8 +21,6 @@ if exists("g:loaded_syntastic_objcpp_oclint_checker") endif let g:loaded_syntastic_objcpp_oclint_checker = 1 -runtime syntax_checkers/c/oclint.vim - function! SyntaxCheckers_objcpp_oclint_IsAvailable() return SyntaxCheckers_c_oclint_IsAvailable() endfunction @@ -34,3 +32,5 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'objcpp', \ 'name': 'oclint'}) + +runtime! syntax_checkers/c/*.vim diff --git a/syntax_checkers/objcpp/ycm.vim b/syntax_checkers/objcpp/ycm.vim index 14f73517d..c9a0e458e 100644 --- a/syntax_checkers/objcpp/ycm.vim +++ b/syntax_checkers/objcpp/ycm.vim @@ -15,7 +15,7 @@ if exists("g:loaded_syntastic_objcpp_ycm_checker") endif let g:loaded_syntastic_objcpp_ycm_checker = 1 -runtime syntax_checkers/c/ycm.vim +runtime! syntax_checkers/c/*.vim function! SyntaxCheckers_objcpp_ycm_IsAvailable() return SyntaxCheckers_c_ycm_IsAvailable() diff --git a/syntax_checkers/perl/podchecker.vim b/syntax_checkers/perl/podchecker.vim index b53555399..e6f80e662 100644 --- a/syntax_checkers/perl/podchecker.vim +++ b/syntax_checkers/perl/podchecker.vim @@ -15,8 +15,6 @@ if exists("g:loaded_syntastic_perl_podchecker_checker") endif let g:loaded_syntastic_perl_podchecker_checker=1 -runtime syntax_checkers/pod/podchecker.vim - function! SyntaxCheckers_perl_podchecker_IsAvailable() return SyntaxCheckers_pod_podchecker_IsAvailable() endfunction @@ -28,3 +26,5 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'perl', \ 'name': 'podchecker'}) + +runtime! syntax_checkers/pod/*.vim diff --git a/syntax_checkers/scss/sass.vim b/syntax_checkers/scss/sass.vim index 9ded9ed30..604bb41db 100644 --- a/syntax_checkers/scss/sass.vim +++ b/syntax_checkers/scss/sass.vim @@ -16,8 +16,6 @@ if exists("g:loaded_syntastic_scss_sass_checker") endif let g:loaded_syntastic_scss_sass_checker=1 -runtime syntax_checkers/sass/sass.vim - function! SyntaxCheckers_scss_sass_IsAvailable() return SyntaxCheckers_sass_sass_IsAvailable() endfunction @@ -29,3 +27,5 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'scss', \ 'name': 'sass'}) + +runtime! syntax_checkers/sass/*.vim diff --git a/syntax_checkers/xslt/xmllint.vim b/syntax_checkers/xslt/xmllint.vim index 6a819a3c5..db397ed84 100644 --- a/syntax_checkers/xslt/xmllint.vim +++ b/syntax_checkers/xslt/xmllint.vim @@ -15,8 +15,6 @@ if exists("g:loaded_syntastic_xslt_xmllint_checker") endif let g:loaded_syntastic_xslt_xmllint_checker=1 -runtime syntax_checkers/xml/xmllint.vim - function! SyntaxCheckers_xslt_xmllint_IsAvailable() return SyntaxCheckers_xml_xmllint_IsAvailable() endfunction @@ -28,3 +26,5 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'xslt', \ 'name': 'xmllint'}) + +runtime! syntax_checkers/xml/*.vim From c07066edd34e95c9ffad8df4f9267185b1867cda Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Sat, 29 Jun 2013 20:54:08 +0300 Subject: [PATCH 0082/1271] Typo. --- plugin/syntastic.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 8fd41c299..bd3cdf1e3 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -25,7 +25,7 @@ if !exists("g:syntastic_always_populate_loc_list") endif if !exists("g:syntastic_auto_jump") - let syntastic_auto_jump=0 + let g:syntastic_auto_jump = 0 endif if !exists("g:syntastic_quiet_warnings") From 2034c1ece21490b003fe367e741704a5c95477d7 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Mon, 1 Jul 2013 10:37:52 +0300 Subject: [PATCH 0083/1271] Make the haxe checker aware of vaxe. --- syntax_checkers/haxe/haxe.vim | 49 +++++++++++++++++------------------ 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/syntax_checkers/haxe/haxe.vim b/syntax_checkers/haxe/haxe.vim index 204eeae57..f1c8779a4 100644 --- a/syntax_checkers/haxe/haxe.vim +++ b/syntax_checkers/haxe/haxe.vim @@ -19,36 +19,35 @@ function! SyntaxCheckers_haxe_haxe_IsAvailable() return executable('haxe') endfunction -" s:FindInParent -" find the file argument and returns the path to it. -" Starting with the current working dir, it walks up the parent folders -" until it finds the file, or it hits the stop dir. -" If it doesn't find it, it returns "Nothing" -function! s:FindInParent(fln,flsrt,flstp) - let here = a:flsrt - while ( strlen( here) > 0 ) - let p = split(globpath(here, a:fln), '\n') - if len(p) > 0 - return ['ok', here, fnamemodify(p[0], ':p:t')] - endif - let fr = match(here, '/[^/]*$') - if fr == -1 - break - endif - let here = strpart(here, 0, fr) - if here == a:flstp +" start in directory a:where and walk up the parent folders until it +" finds a file matching a:what; return path to that file +function! s:FindInParent(what, where) + let here = fnamemodify(a:where, ':p') + + while !empty(here) + let p = split(globpath(here, a:what), '\n') + + if !empty(p) + return fnamemodify(p[0], ':p') + elseif here == '/' break endif + + " we use ':h:h' rather than ':h' since ':p' adds a trailing '/' + " if 'here' is a directory + let here = fnamemodify(here, ':p:h:h') endwhile - return ['fail', '', ''] + + return '' endfunction function! SyntaxCheckers_haxe_haxe_GetLocList() - let [success, hxmldir, hxmlname] = s:FindInParent('*.hxml', expand('%:p:h'), '/') - if success == 'ok' + let hxml = exists('b:vaxe_hxml') ? fnamemodify(b:vaxe_hxml, ':p') : s:FindInParent('*.hxml', expand('%:p:h')) + + if !empty(hxml) let makeprg = syntastic#makeprg#build({ \ 'exe': 'haxe', - \ 'fname': shellescape(fnameescape(hxmlname)), + \ 'fname': shellescape(fnameescape(fnamemodify(hxml, ':t'))), \ 'filetype': 'haxe', \ 'subchecker': 'haxe' }) @@ -57,10 +56,10 @@ function! SyntaxCheckers_haxe_haxe_GetLocList() return SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, - \ 'cwd': hxmldir }) - else - return [] + \ 'cwd': fnamemodify(hxml, ':h') }) endif + + return [] endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ From 8fadbb88da69c74eefcf8c8c4bd18132e31f60c4 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Mon, 1 Jul 2013 18:14:15 +0300 Subject: [PATCH 0084/1271] Make the haxe checker aware of g:vaxe_hxml. --- syntax_checkers/haxe/haxe.vim | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/syntax_checkers/haxe/haxe.vim b/syntax_checkers/haxe/haxe.vim index f1c8779a4..fd9262c46 100644 --- a/syntax_checkers/haxe/haxe.vim +++ b/syntax_checkers/haxe/haxe.vim @@ -42,7 +42,14 @@ function! s:FindInParent(what, where) endfunction function! SyntaxCheckers_haxe_haxe_GetLocList() - let hxml = exists('b:vaxe_hxml') ? fnamemodify(b:vaxe_hxml, ':p') : s:FindInParent('*.hxml', expand('%:p:h')) + if exists('b:vaxe_hxml') + let hxml = b:vaxe_hxml + elseif exists('g:vaxe_hxml') + let hxml = g:vaxe_hxml + else + let hxml = s:FindInParent('*.hxml', expand('%:p:h')) + endif + let hxml = fnamemodify(hxml, ':p') if !empty(hxml) let makeprg = syntastic#makeprg#build({ From 37e29ad2412d1a872caf6c56894dd371f73fd1d6 Mon Sep 17 00:00:00 2001 From: jvenant Date: Mon, 1 Jul 2013 18:23:56 +0200 Subject: [PATCH 0085/1271] Add 4 features to maven management : * Retrieve maven properties from help:effective-pom * Extract targets path from maven properties * Recursively search pom file in parents (using findfile) * Use a dictionary to cache classpath for each project pom --- syntax_checkers/java/javac.vim | 89 +++++++++++++++++++++++++++------- 1 file changed, 72 insertions(+), 17 deletions(-) diff --git a/syntax_checkers/java/javac.vim b/syntax_checkers/java/javac.vim index a14380257..f625edee5 100644 --- a/syntax_checkers/java/javac.vim +++ b/syntax_checkers/java/javac.vim @@ -15,6 +15,8 @@ if exists("g:loaded_syntastic_java_javac_checker") finish endif let g:loaded_syntastic_java_javac_checker=1 +let g:syntastic_java_javac_maven_pom_tags = ["build", "properties"] +let g:syntastic_java_javac_maven_pom_properties = {} " Global Options if !exists("g:syntastic_java_javac_executable") @@ -63,17 +65,12 @@ if !exists('g:syntastic_java_javac_config_file') let g:syntastic_java_javac_config_file = '.syntastic_javac_config' endif -" Internal variables, do not ovveride those -if !exists("g:syntastic_java_javac_maven_pom_cwd") - let g:syntastic_java_javac_maven_pom_cwd = '' -endif - if !exists("g:syntastic_java_javac_maven_pom_ftime") - let g:syntastic_java_javac_maven_pom_ftime = 0 + let g:syntastic_java_javac_maven_pom_ftime = {} endif if !exists("g:syntastic_java_javac_maven_pom_classpath") - let g:syntastic_java_javac_maven_pom_classpath = '' + let g:syntastic_java_javac_maven_pom_classpath = {} endif function! s:RemoveCarriageReturn(line) @@ -157,12 +154,49 @@ function! s:EditClasspath() execute winnr . 'wincmd w' endif endfunction + +function! s:GetMavenProperties() + let mvn_properties = {} + let pom = findfile("pom.xml", ".;") + if filereadable(pom) + if !has_key(g:syntastic_java_javac_maven_pom_properties, pom) + let mvn_cmd = g:syntastic_java_maven_executable . ' -f ' . pom + let mvn_is_managed_tag = 1 + let mvn_settings_output = split(system(mvn_cmd . ' help:effective-pom'), "\n") + let current_path = 'project' + for line in mvn_settings_output + let matches = matchlist(line, '^\s*<\([a-zA-Z0-9\-\.]\+\)>\s*$') + if mvn_is_managed_tag && !empty(matches) + let mvn_is_managed_tag = index(g:syntastic_java_javac_maven_pom_tags, matches[1]) >= 0 + let current_path .= '.' . matches[1] + else + let matches = matchlist(line, '^\s*\s*$') + if !empty(matches) + let mvn_is_managed_tag = index(g:syntastic_java_javac_maven_pom_tags, matches[1]) < 0 + let current_path = substitute(current_path, '\.' . matches[1] . "$", '', '') + else + let matches = matchlist(line, '^\s*<\([a-zA-Z0-9\-\.]\+\)>\(.\+\)\s*$') + if mvn_is_managed_tag && !empty(matches) + let mvn_properties[current_path . '.' . matches[1]] = matches[2] + endif + endif + endif + endfor + let g:syntastic_java_javac_maven_pom_properties[pom] = mvn_properties + endif + return g:syntastic_java_javac_maven_pom_properties[pom] + endif + return mvn_properties +endfunction + command! SyntasticJavacEditClasspath call s:EditClasspath() function! s:GetMavenClasspath() - if filereadable('pom.xml') - if g:syntastic_java_javac_maven_pom_ftime != getftime('pom.xml') || g:syntastic_java_javac_maven_pom_cwd != getcwd() - let mvn_classpath_output = split(system(g:syntastic_java_maven_executable . ' dependency:build-classpath'), "\n") + let pom = findfile("pom.xml", ".;") + if filereadable(pom) + if !has_key(g:syntastic_java_javac_maven_pom_ftime, pom) + let mvn_cmd = g:syntastic_java_maven_executable . ' -f ' . pom + let mvn_classpath_output = split(system(mvn_cmd . ' dependency:build-classpath'), "\n") let class_path_next = 0 for line in mvn_classpath_output @@ -175,14 +209,24 @@ function! s:GetMavenClasspath() endif endfor - let mvn_classpath = s:AddToClasspath(mvn_classpath, 'target/classes') - let mvn_classpath = s:AddToClasspath(mvn_classpath, 'target/test-classes') + let mvn_properties = s:GetMavenProperties() + + let output_dir = 'target/classes' + if has_key(mvn_properties, 'project.build.outputDirectory') + let output_dir = mvn_properties['project.build.outputDirectory'] + endif + let mvn_classpath = s:AddToClasspath(mvn_classpath, output_dir) + + let test_output_dir = 'target/test-classes' + if has_key(mvn_properties, 'project.build.testOutputDirectory') + let test_output_dir = mvn_properties['project.build.testOutputDirectory'] + endif + let mvn_classpath = s:AddToClasspath(mvn_classpath, test_output_dir) - let g:syntastic_java_javac_maven_pom_cwd = getcwd() - let g:syntastic_java_javac_maven_pom_ftime = getftime('pom.xml') - let g:syntastic_java_javac_maven_pom_classpath = mvn_classpath + let g:syntastic_java_javac_maven_pom_ftime[pom] = getftime(pom) + let g:syntastic_java_javac_maven_pom_classpath[pom] = mvn_classpath endif - return g:syntastic_java_javac_maven_pom_classpath + return g:syntastic_java_javac_maven_pom_classpath[pom] endif return '' endfunction @@ -192,13 +236,24 @@ function! SyntaxCheckers_java_javac_IsAvailable() endfunction function! s:MavenOutputDirectory() - if filereadable('pom.xml') + let pom = findfile("pom.xml", ".;") + if filereadable(pom) + let mvn_properties = s:GetMavenProperties() let output_dir = getcwd() + if has_key(mvn_properties, 'project.properties.build.dir') + let output_dir = mvn_properties['project.properties.build.dir'] + endif if match(expand( '%:p:h' ), "src.main.java") >= 0 let output_dir .= '/target/classes' + if has_key(mvn_properties, 'project.build.outputDirectory') + let output_dir = mvn_properties['project.build.outputDirectory'] + endif endif if match(expand( '%:p:h' ), "src.test.java") >= 0 let output_dir .= '/target/test-classes' + if has_key(mvn_properties, 'project.build.testOutputDirectory') + let output_dir = mvn_properties['project.testOutputDirectory.outputDirectory'] + endif endif if has('win32unix') From aae19e822f554149a5a3a750bc17ccddf90a38f0 Mon Sep 17 00:00:00 2001 From: jvenant Date: Mon, 1 Jul 2013 18:50:48 +0200 Subject: [PATCH 0086/1271] correct test directory property name --- syntax_checkers/java/javac.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntax_checkers/java/javac.vim b/syntax_checkers/java/javac.vim index f625edee5..ff486997e 100644 --- a/syntax_checkers/java/javac.vim +++ b/syntax_checkers/java/javac.vim @@ -252,7 +252,7 @@ function! s:MavenOutputDirectory() if match(expand( '%:p:h' ), "src.test.java") >= 0 let output_dir .= '/target/test-classes' if has_key(mvn_properties, 'project.build.testOutputDirectory') - let output_dir = mvn_properties['project.testOutputDirectory.outputDirectory'] + let output_dir = mvn_properties['project.build.testOutputDirectory'] endif endif From 269cb79f3263b94440f9a878c2961583145c0aaa Mon Sep 17 00:00:00 2001 From: jvenant Date: Mon, 1 Jul 2013 18:57:21 +0200 Subject: [PATCH 0087/1271] re-add pom timestamp management --- syntax_checkers/java/javac.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntax_checkers/java/javac.vim b/syntax_checkers/java/javac.vim index ff486997e..122a63682 100644 --- a/syntax_checkers/java/javac.vim +++ b/syntax_checkers/java/javac.vim @@ -194,7 +194,7 @@ command! SyntasticJavacEditClasspath call s:EditClasspath() function! s:GetMavenClasspath() let pom = findfile("pom.xml", ".;") if filereadable(pom) - if !has_key(g:syntastic_java_javac_maven_pom_ftime, pom) + if !has_key(g:syntastic_java_javac_maven_pom_ftime, pom) || g:syntastic_java_javac_maven_pom_ftime[pom] != getftime(pom) let mvn_cmd = g:syntastic_java_maven_executable . ' -f ' . pom let mvn_classpath_output = split(system(mvn_cmd . ' dependency:build-classpath'), "\n") let class_path_next = 0 From 5ac5d09c9af65213b03dc81ac8b790f27988a3f2 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Wed, 3 Jul 2013 21:36:14 +0300 Subject: [PATCH 0088/1271] Fix for Rails syntax. There is now little point in running this checker rather than the plain ruby one. --- syntax_checkers/eruby/erb.vim | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/syntax_checkers/eruby/erb.vim b/syntax_checkers/eruby/erb.vim index 74e0e6c52..812770231 100644 --- a/syntax_checkers/eruby/erb.vim +++ b/syntax_checkers/eruby/erb.vim @@ -28,16 +28,24 @@ function! SyntaxCheckers_eruby_erb_IsAvailable() endfunction function! SyntaxCheckers_eruby_erb_GetLocList() + let exe = expand(g:syntastic_ruby_exec) + if !has('win32') + let exe = 'RUBYOPT= ' . exe + endif + + let fname = fnameescape(expand('%')) + + let enc = &fileencoding != '' ? &fileencoding : &encoding + let encoding_string = enc ==? 'utf-8' ? 'UTF-8' : 'BINARY' + " TODO: fix the encoding trainwreck - " let enc = &fileencoding != '' ? &fileencoding : &encoding - let enc = '' - - let makeprg = syntastic#makeprg#build({ - \ 'exe': g:syntastic_erb_exec, - \ 'args': '-x -T -' . (enc ==# 'utf-8' ? ' -U' : ''), - \ 'tail': '\| ' . g:syntastic_ruby_exec . ' -c', - \ 'filetype': 'eruby', - \ 'subchecker': 'erb' }) + let makeprg = + \ exe . ' -e ' . + \ shellescape('puts File.read("' . fname . + \ '", :encoding => "' . encoding_string . + \ '").gsub(''<\%='',''<\%'')') . + \ ' \| ' . g:syntastic_erb_exec . ' -x -T -' . + \ ' \| ' . exe . ' -c' let errorformat = \ '%-GSyntax OK,'. From 17ec785af8c2f16c6000e5556886149a075a5913 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Thu, 4 Jul 2013 21:04:20 +0300 Subject: [PATCH 0089/1271] Make shell escaping less produce fewer useless quotes. Function inspired by tpope's vim-dispatch. --- autoload/syntastic/util.vim | 10 ++++++++++ plugin/syntastic/makeprg_builder.vim | 2 +- syntax_checkers/ada/gcc.vim | 4 ++-- syntax_checkers/c/gcc.vim | 4 ++-- syntax_checkers/cpp/gcc.vim | 4 ++-- syntax_checkers/cuda/nvcc.vim | 4 ++-- syntax_checkers/d/dmd.vim | 4 ++-- syntax_checkers/erlang/erlang.vim | 6 +++--- syntax_checkers/eruby/erb.vim | 2 +- syntax_checkers/eruby/ruby.vim | 2 +- syntax_checkers/haxe/haxe.vim | 2 +- syntax_checkers/html/tidy.vim | 6 +++--- syntax_checkers/html/validator.vim | 4 ++-- syntax_checkers/html/w3.vim | 2 +- syntax_checkers/javascript/closurecompiler.vim | 2 +- syntax_checkers/nasm/nasm.vim | 2 +- syntax_checkers/objc/gcc.vim | 4 ++-- syntax_checkers/objcpp/gcc.vim | 4 ++-- syntax_checkers/ocaml/camlp4o.vim | 8 ++++---- syntax_checkers/perl/perl.vim | 4 ++-- syntax_checkers/python/python.vim | 2 +- 21 files changed, 46 insertions(+), 36 deletions(-) diff --git a/autoload/syntastic/util.vim b/autoload/syntastic/util.vim index f563c7e6f..0a4d8cf1f 100644 --- a/autoload/syntastic/util.vim +++ b/autoload/syntastic/util.vim @@ -132,6 +132,16 @@ function! syntastic#util#unique(list) return uniques endfunction +" A less noisy shellescape() +function! syntastic#util#shescape(string) + return a:string =~ '\m^[A-Za-z0-9_/.-]\+$' ? a:string : shellescape(a:string) +endfunction + +" A less noisy shellescape(expand()) +function! syntastic#util#shexpand(string) + return syntastic#util#shescape(expand(a:string)) +endfunction + function! syntastic#util#debug(msg) if g:syntastic_debug echomsg "syntastic: debug: " . a:msg diff --git a/plugin/syntastic/makeprg_builder.vim b/plugin/syntastic/makeprg_builder.vim index 4271a4803..ef77efa9b 100644 --- a/plugin/syntastic/makeprg_builder.vim +++ b/plugin/syntastic/makeprg_builder.vim @@ -33,7 +33,7 @@ endfunction function! g:SyntasticMakeprgBuilder.fname() if empty(self._fname) - return shellescape(expand("%")) + return syntastic#util#shexpand('%') else return self._fname endif diff --git a/syntax_checkers/ada/gcc.vim b/syntax_checkers/ada/gcc.vim index 39001fd26..7050c3d5c 100644 --- a/syntax_checkers/ada/gcc.vim +++ b/syntax_checkers/ada/gcc.vim @@ -104,14 +104,14 @@ function! SyntaxCheckers_ada_gcc_GetLocList() " add optional user-defined compiler options let makeprg .= g:syntastic_ada_compiler_options - let makeprg .= ' ' . shellescape(expand('%')) . + let makeprg .= ' ' . syntastic#util#shexpand('%') . \ ' ' . syntastic#c#GetIncludeDirs('ada') " determine whether to parse header files as well if expand('%') =~? '\.ads$' if exists('g:syntastic_ada_check_header') let makeprg = g:syntastic_ada_compiler . - \ ' -c ' . shellescape(expand('%')) . + \ ' -c ' . syntastic#util#shexpand('%') . \ ' ' . g:syntastic_ada_compiler_options . \ ' ' . syntastic#c#GetIncludeDirs('ada') else diff --git a/syntax_checkers/c/gcc.vim b/syntax_checkers/c/gcc.vim index b8d72e177..d5c05f993 100644 --- a/syntax_checkers/c/gcc.vim +++ b/syntax_checkers/c/gcc.vim @@ -118,14 +118,14 @@ function! SyntaxCheckers_c_gcc_GetLocList() " add optional user-defined compiler options let makeprg .= g:syntastic_c_compiler_options - let makeprg .= ' ' . shellescape(expand('%')) . + let makeprg .= ' ' . syntastic#util#shexpand('%') . \ ' ' . syntastic#c#GetIncludeDirs('c') " determine whether to parse header files as well if expand('%') =~? '\.h$' if exists('g:syntastic_c_check_header') let makeprg = g:syntastic_c_compiler . - \ ' -c ' . shellescape(expand('%')) . + \ ' -c ' . syntastic#util#shexpand('%') . \ ' ' . g:syntastic_c_compiler_options . \ ' ' . syntastic#c#GetNullDevice() . \ ' ' . syntastic#c#GetIncludeDirs('c') diff --git a/syntax_checkers/cpp/gcc.vim b/syntax_checkers/cpp/gcc.vim index 44178f19f..40b2a1054 100644 --- a/syntax_checkers/cpp/gcc.vim +++ b/syntax_checkers/cpp/gcc.vim @@ -114,14 +114,14 @@ function! SyntaxCheckers_cpp_gcc_GetLocList() " add optional user-defined compiler options let makeprg .= g:syntastic_cpp_compiler_options - let makeprg .= ' ' . shellescape(expand('%')) . + let makeprg .= ' ' . syntastic#util#shexpand('%') . \ ' ' . syntastic#c#GetIncludeDirs('cpp') " determine whether to parse header files as well if expand('%') =~? '\.\(h\|hpp\|hh\)$' if exists('g:syntastic_cpp_check_header') let makeprg = g:syntastic_cpp_compiler . - \ ' -c ' . shellescape(expand('%')) . + \ ' -c ' . syntastic#util#shexpand('%') . \ ' ' . g:syntastic_cpp_compiler_options . \ ' ' . syntastic#c#GetNullDevice() . \ ' ' . syntastic#c#GetIncludeDirs('cpp') diff --git a/syntax_checkers/cuda/nvcc.vim b/syntax_checkers/cuda/nvcc.vim index d5649d305..7bc6c4bb8 100644 --- a/syntax_checkers/cuda/nvcc.vim +++ b/syntax_checkers/cuda/nvcc.vim @@ -36,7 +36,7 @@ function! SyntaxCheckers_cuda_nvcc_GetLocList() endif let makeprg = \ 'nvcc ' . arch_flag . ' --cuda -O0 -I . -Xcompiler -fsyntax-only ' . - \ shellescape(expand('%')) . ' ' . syntastic#c#GetNullDevice() + \ syntastic#util#shexpand('%') . ' ' . syntastic#c#GetNullDevice() let errorformat = \ '%*[^"]"%f"%*\D%l: %m,'. \ '"%f"%*\D%l: %m,'. @@ -58,7 +58,7 @@ function! SyntaxCheckers_cuda_nvcc_GetLocList() let makeprg = \ 'echo > .syntastic_dummy.cu ; ' . \ 'nvcc ' . arch_flag . ' --cuda -O0 -I . .syntastic_dummy.cu -Xcompiler -fsyntax-only -include ' . - \ shellescape(expand('%')) . ' ' . syntastic#c#GetNullDevice() + \ syntastic#util#shexpand('%') . ' ' . syntastic#c#GetNullDevice() else return [] endif diff --git a/syntax_checkers/d/dmd.vim b/syntax_checkers/d/dmd.vim index 0cb1de71f..17228e41a 100644 --- a/syntax_checkers/d/dmd.vim +++ b/syntax_checkers/d/dmd.vim @@ -112,14 +112,14 @@ function! SyntaxCheckers_d_dmd_GetLocList() " add optional user-defined compiler options let makeprg .= g:syntastic_d_compiler_options - let makeprg .= ' ' . shellescape(expand('%')) . + let makeprg .= ' ' . syntastic#util#shexpand('%') . \ ' ' . syntastic#c#GetIncludeDirs('d') " determine whether to parse header files as well if expand('%') =~? '\.di$' if exists('g:syntastic_d_check_header') let makeprg = g:syntastic_d_compiler . - \ ' -c ' . shellescape(expand('%')) . + \ ' -c ' . syntastic#util#shexpand('%') . \ ' -of' . syntastic#util#DevNull() . \ ' ' . g:syntastic_d_compiler_options . \ ' ' . syntastic#c#GetIncludeDirs('d') diff --git a/syntax_checkers/erlang/erlang.vim b/syntax_checkers/erlang/erlang.vim index 1a0b27872..967b759df 100644 --- a/syntax_checkers/erlang/erlang.vim +++ b/syntax_checkers/erlang/erlang.vim @@ -32,12 +32,12 @@ function! SyntaxCheckers_erlang_escript_GetLocList() let shebang = getbufline(bufnr('%'), 1)[0] if len(shebang) > 0 if match(shebang, 'escript') >= 0 - let makeprg = 'escript -s '.shellescape(expand('%:p')) + let makeprg = 'escript -s ' . syntastic#util#shexpand('%:p') else - let makeprg = 'escript ' . s:check_file . ' '. shellescape(expand('%:p')).' '.g:syntastic_erlc_include_path + let makeprg = 'escript ' . s:check_file . ' ' . syntastic#util#shexpand('%:p') . ' ' . g:syntastic_erlc_include_path endif else - let makeprg = 'escript ' . s:check_file . ' ' . shellescape(expand('%:p')).' '.g:syntastic_erlc_include_path + let makeprg = 'escript ' . s:check_file . ' ' . syntastic#util#shexpand('%:p') . ' '. g:syntastic_erlc_include_path endif let errorformat = \ '%f:%l:\ %tarning:\ %m,'. diff --git a/syntax_checkers/eruby/erb.vim b/syntax_checkers/eruby/erb.vim index 812770231..06ac79bbe 100644 --- a/syntax_checkers/eruby/erb.vim +++ b/syntax_checkers/eruby/erb.vim @@ -41,7 +41,7 @@ function! SyntaxCheckers_eruby_erb_GetLocList() " TODO: fix the encoding trainwreck let makeprg = \ exe . ' -e ' . - \ shellescape('puts File.read("' . fname . + \ syntastic#util#shescape('puts File.read("' . fname . \ '", :encoding => "' . encoding_string . \ '").gsub(''<\%='',''<\%'')') . \ ' \| ' . g:syntastic_erb_exec . ' -x -T -' . diff --git a/syntax_checkers/eruby/ruby.vim b/syntax_checkers/eruby/ruby.vim index d32dd6e69..e9503f7e6 100644 --- a/syntax_checkers/eruby/ruby.vim +++ b/syntax_checkers/eruby/ruby.vim @@ -37,7 +37,7 @@ function! SyntaxCheckers_eruby_ruby_GetLocList() "gsub fixes issue #7, rails has it's own eruby syntax let makeprg = \ exe . ' -rerb -e ' . - \ shellescape('puts ERB.new(File.read("' . fname . + \ syntastic#util#shescape('puts ERB.new(File.read("' . fname . \ '", :encoding => "' . encoding_string . \ '").gsub(''<\%='',''<\%''), nil, ''-'').src') . \ ' \| ' . exe . ' -c' diff --git a/syntax_checkers/haxe/haxe.vim b/syntax_checkers/haxe/haxe.vim index fd9262c46..cffd52771 100644 --- a/syntax_checkers/haxe/haxe.vim +++ b/syntax_checkers/haxe/haxe.vim @@ -54,7 +54,7 @@ function! SyntaxCheckers_haxe_haxe_GetLocList() if !empty(hxml) let makeprg = syntastic#makeprg#build({ \ 'exe': 'haxe', - \ 'fname': shellescape(fnameescape(fnamemodify(hxml, ':t'))), + \ 'fname': syntastic#util#shescape(fnameescape(fnamemodify(hxml, ':t'))), \ 'filetype': 'haxe', \ 'subchecker': 'haxe' }) diff --git a/syntax_checkers/html/tidy.vim b/syntax_checkers/html/tidy.vim index 0f528026b..45c06a79f 100644 --- a/syntax_checkers/html/tidy.vim +++ b/syntax_checkers/html/tidy.vim @@ -74,9 +74,9 @@ endfunction function s:Args() let args = s:TidyEncOptByFenc() . - \ ' --new-blocklevel-tags ' . shellescape('main, section, article, aside, hgroup, header, footer, nav, figure, figcaption') . - \ ' --new-inline-tags ' . shellescape('video, audio, source, embed, mark, progress, meter, time, ruby, rt, rp, canvas, command, details, datalist') . - \ ' --new-empty-tags ' . shellescape('wbr, keygen') . + \ ' --new-blocklevel-tags ' . syntastic#util#shescape('main, section, article, aside, hgroup, header, footer, nav, figure, figcaption') . + \ ' --new-inline-tags ' . syntastic#util#shescape('video, audio, source, embed, mark, progress, meter, time, ruby, rt, rp, canvas, command, details, datalist') . + \ ' --new-empty-tags ' . syntastic#util#shescape('wbr, keygen') . \ ' -e' return args endfunction diff --git a/syntax_checkers/html/validator.vim b/syntax_checkers/html/validator.vim index bf41edeea..7e24a17b0 100644 --- a/syntax_checkers/html/validator.vim +++ b/syntax_checkers/html/validator.vim @@ -45,7 +45,7 @@ if !exists('g:syntastic_html_validator_nsfilter') let g:syntastic_html_validator_nsfilter = '' endif -let s:decoder = 'awk -f ' . shellescape(expand(':p:h') . '/validator_decode.awk') +let s:decoder = 'awk -f ' . syntastic#util#shescape(expand(':p:h') . '/validator_decode.awk') function! SyntaxCheckers_html_validator_IsAvailable() return executable('curl') && executable('awk') @@ -55,7 +55,7 @@ function! SyntaxCheckers_html_validator_GetLocList() let makeprg = 'curl -s --compressed -F out=gnu -F asciiquotes=yes' . \ (!empty(g:syntastic_html_validator_parser) ? ' -F parser=' . g:syntastic_html_validator_parser : '') . \ (!empty(g:syntastic_html_validator_nsfilter) ? ' -F nsfilter=' . g:syntastic_html_validator_nsfilter : '') . - \ ' -F doc=@' . shellescape(expand('%')) . '\;type=text/html\;filename=' . shellescape(expand('%')) . ' ' . + \ ' -F doc=@' . syntastic#util#shexpand('%') . '\;type=text/html\;filename=' . syntastic#util#shexpand('%') . ' ' . \ g:syntastic_html_validator_api . ' \| ' . s:decoder let errorformat = \ '%E"%f":%l: %trror: %m,' . diff --git a/syntax_checkers/html/w3.vim b/syntax_checkers/html/w3.vim index 7bb0fcd03..c9bc86888 100644 --- a/syntax_checkers/html/w3.vim +++ b/syntax_checkers/html/w3.vim @@ -32,7 +32,7 @@ endfunction function! SyntaxCheckers_html_w3_GetLocList() let makeprg = 'curl -s -F output=json ' . - \ '-F uploaded_file=@' . shellescape(expand('%:p')) . '\;type=text/html ' . + \ '-F uploaded_file=@' . syntastic#util#shexpand('%:p') . '\;type=text/html ' . \ g:syntastic_html_w3_api let errorformat = \ '%A %\+{,' . diff --git a/syntax_checkers/javascript/closurecompiler.vim b/syntax_checkers/javascript/closurecompiler.vim index f15f60603..6c55f4f21 100644 --- a/syntax_checkers/javascript/closurecompiler.vim +++ b/syntax_checkers/javascript/closurecompiler.vim @@ -38,7 +38,7 @@ 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 - let file_list = shellescape(expand('%')) + let file_list = syntastic#util#shexpand('%') endif let makeprg = syntastic#makeprg#build({ diff --git a/syntax_checkers/nasm/nasm.vim b/syntax_checkers/nasm/nasm.vim index dcbdd4188..9c6195cf4 100644 --- a/syntax_checkers/nasm/nasm.vim +++ b/syntax_checkers/nasm/nasm.vim @@ -19,7 +19,7 @@ function! SyntaxCheckers_nasm_nasm_IsAvailable() endfunction function! SyntaxCheckers_nasm_nasm_GetLocList() - let wd = shellescape(expand("%:p:h") . "/") + let wd = syntastic#util#shescape(expand("%:p:h") . "/") let makeprg = syntastic#makeprg#build({ \ 'exe': 'nasm', \ 'args': '-X gnu -f elf -I ' . wd . ' ' . syntastic#c#GetNullDevice() diff --git a/syntax_checkers/objc/gcc.vim b/syntax_checkers/objc/gcc.vim index 0cd135867..e16822f36 100644 --- a/syntax_checkers/objc/gcc.vim +++ b/syntax_checkers/objc/gcc.vim @@ -119,7 +119,7 @@ function! SyntaxCheckers_objc_gcc_GetLocList() " add optional user-defined compiler options let makeprg .= g:syntastic_objc_compiler_options - let makeprg .= ' ' . shellescape(expand('%')) . + let makeprg .= ' ' . syntastic#util#shexpand('%') . \ ' ' . syntastic#c#GetIncludeDirs('objc') " determine whether to parse header files as well @@ -127,7 +127,7 @@ function! SyntaxCheckers_objc_gcc_GetLocList() if exists('g:syntastic_objc_check_header') let makeprg = g:syntastic_objc_compiler . \ ' -x objective-c-header ' . - \ ' -c ' . shellescape(expand('%')) . + \ ' -c ' . syntastic#util#shexpand('%') . \ ' ' . g:syntastic_objc_compiler_options . \ ' ' . syntastic#c#GetIncludeDirs('objc') else diff --git a/syntax_checkers/objcpp/gcc.vim b/syntax_checkers/objcpp/gcc.vim index 8d8a2ebd1..889a5973d 100644 --- a/syntax_checkers/objcpp/gcc.vim +++ b/syntax_checkers/objcpp/gcc.vim @@ -119,7 +119,7 @@ function! SyntaxCheckers_objcpp_gcc_GetLocList() " add optional user-defined compiler options let makeprg .= g:syntastic_objcpp_compiler_options - let makeprg .= ' ' . shellescape(expand('%')) . + let makeprg .= ' ' . syntastic#util#shexpand('%') . \ ' ' . syntastic#c#GetIncludeDirs('objcpp') " determine whether to parse header files as well @@ -127,7 +127,7 @@ function! SyntaxCheckers_objcpp_gcc_GetLocList() if exists('g:syntastic_objcpp_check_header') let makeprg = g:syntastic_objcpp_compiler . \ ' -x objective-c++-header ' . - \ ' -c ' . shellescape(expand('%')) . + \ ' -c ' . syntastic#util#shexpand('%') . \ ' ' . g:syntastic_objcpp_compiler_options . \ ' ' . syntastic#c#GetIncludeDirs('objcpp') else diff --git a/syntax_checkers/ocaml/camlp4o.vim b/syntax_checkers/ocaml/camlp4o.vim index 805aa0733..e2409ec1b 100644 --- a/syntax_checkers/ocaml/camlp4o.vim +++ b/syntax_checkers/ocaml/camlp4o.vim @@ -121,7 +121,7 @@ endfunction function s:GetOcamlBuildMakeprg() return "ocamlbuild -quiet -no-log -tag annot," . s:ocamlpp . " -no-links -no-hygiene -no-sanitize " . - \ shellescape(expand('%:r')) . ".cmi" + \ syntastic#util#shexpand('%:r') . ".cmi" endfunction function s:GetOtherMakeprg() @@ -134,11 +134,11 @@ function s:GetOtherMakeprg() if match(extension, 'mly') >= 0 && executable("menhir") " ocamlyacc output can't be redirected, so use menhir - let makeprg = "menhir --only-preprocess " . shellescape(expand('%')) . " >" . syntastic#util#DevNull() + let makeprg = "menhir --only-preprocess " . syntastic#util#shexpand('%') . " >" . syntastic#util#DevNull() elseif match(extension,'mll') >= 0 && executable("ocamllex") - let makeprg = "ocamllex -q " . syntastic#c#GetNullDevice() . " " . shellescape(expand('%')) + let makeprg = "ocamllex -q " . syntastic#c#GetNullDevice() . " " . syntastic#util#shexpand('%') else - let makeprg = "camlp4o " . syntastic#c#GetNullDevice() . " " . shellescape(expand('%')) + let makeprg = "camlp4o " . syntastic#c#GetNullDevice() . " " . syntastic#util#shexpand('%') endif return makeprg diff --git a/syntax_checkers/perl/perl.vim b/syntax_checkers/perl/perl.vim index 67316da30..d88437ddc 100644 --- a/syntax_checkers/perl/perl.vim +++ b/syntax_checkers/perl/perl.vim @@ -41,7 +41,7 @@ endfunction if !exists("g:syntastic_perl_efm_program") let g:syntastic_perl_efm_program = \ g:syntastic_perl_interpreter . ' ' . - \ shellescape(expand(':p:h') . '/efm_perl.pl') . + \ syntastic#util#shescape(expand(':p:h') . '/efm_perl.pl') . \ ' -c -w' endif @@ -50,7 +50,7 @@ function! SyntaxCheckers_perl_perl_GetLocList() if exists("g:syntastic_perl_lib_path") let makeprg .= ' -I' . g:syntastic_perl_lib_path endif - let makeprg .= ' ' . shellescape(expand('%')) . s:ExtraMakeprgArgs() + let makeprg .= ' ' . syntastic#util#shexpand('%') . s:ExtraMakeprgArgs() let errorformat = '%t:%f:%l:%m' diff --git a/syntax_checkers/python/python.vim b/syntax_checkers/python/python.vim index 7169a6f67..eff1696b4 100644 --- a/syntax_checkers/python/python.vim +++ b/syntax_checkers/python/python.vim @@ -22,7 +22,7 @@ function! SyntaxCheckers_python_python_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'python', \ 'args': '-c', - \ 'fname': shellescape("compile(open(" . fname . ").read(), " . fname . ", 'exec')"), + \ 'fname': syntastic#util#shescape("compile(open(" . fname . ").read(), " . fname . ", 'exec')"), \ 'filetype': 'python', \ 'subchecker': 'python' }) From d6507c941b98660f1257e026e9ad3b7b4297cbc4 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Thu, 4 Jul 2013 21:30:52 +0300 Subject: [PATCH 0090/1271] Merge branch 'master' into gcc_refactor --- autoload/syntastic/c.vim | 6 ++--- autoload/syntastic/util.vim | 10 +++++++ plugin/syntastic/makeprg_builder.vim | 2 +- syntax_checkers/cuda/nvcc.vim | 4 +-- syntax_checkers/erlang/erlang.vim | 6 ++--- syntax_checkers/eruby/erb.vim | 26 ++++++++++++------- syntax_checkers/eruby/ruby.vim | 2 +- syntax_checkers/haxe/haxe.vim | 2 +- syntax_checkers/html/tidy.vim | 6 ++--- syntax_checkers/html/validator.vim | 4 +-- syntax_checkers/html/w3.vim | 2 +- .../javascript/closurecompiler.vim | 2 +- syntax_checkers/nasm/nasm.vim | 2 +- syntax_checkers/ocaml/camlp4o.vim | 8 +++--- syntax_checkers/perl/perl.vim | 4 +-- syntax_checkers/python/python.vim | 2 +- 16 files changed, 53 insertions(+), 35 deletions(-) diff --git a/autoload/syntastic/c.vim b/autoload/syntastic/c.vim index 9587a3387..137b8996a 100644 --- a/autoload/syntastic/c.vim +++ b/autoload/syntastic/c.vim @@ -56,7 +56,7 @@ function! syntastic#c#ReadConfig(file) endif endfor - return join(map(parameters, 'shellescape(fnameescape(v:val))'), ' ') + return join(map(parameters, 'syntastic#util#shescape(fnameescape(v:val))'), ' ') endfunction " GetLocList() for C-like compilers @@ -67,7 +67,7 @@ function! syntastic#c#GetLocList(filetype, subchecker, options) return [] endtry - let makeprg = g:syntastic_{a:filetype}_compiler . ' ' . flags . ' ' . shellescape(expand('%')) + let makeprg = g:syntastic_{a:filetype}_compiler . ' ' . flags . ' ' . syntastic#util#shexpand('%') let errorformat = s:GetCheckerVar('g', a:filetype, a:subchecker, 'errorformat', a:options['errorformat']) @@ -178,7 +178,7 @@ function! s:GetIncludeDirs(filetype) call extend(include_dirs, g:syntastic_{a:filetype}_include_dirs) endif - return join(map(syntastic#util#unique(include_dirs), 'shellescape(fnameescape("-I" . v:val))'), ' ') + return join(map(syntastic#util#unique(include_dirs), 'syntastic#util#shescape(fnameescape("-I" . v:val))'), ' ') endfunction " search the first 100 lines for include statements that are diff --git a/autoload/syntastic/util.vim b/autoload/syntastic/util.vim index bfbdcfa47..cd6e67dc3 100644 --- a/autoload/syntastic/util.vim +++ b/autoload/syntastic/util.vim @@ -137,6 +137,16 @@ function! syntastic#util#unique(list) return uniques endfunction +" A less noisy shellescape() +function! syntastic#util#shescape(string) + return a:string =~ '\m^[A-Za-z0-9_/.-]\+$' ? a:string : shellescape(a:string) +endfunction + +" A less noisy shellescape(expand()) +function! syntastic#util#shexpand(string) + return syntastic#util#shescape(expand(a:string)) +endfunction + function! syntastic#util#debug(msg) if g:syntastic_debug echomsg "syntastic: debug: " . a:msg diff --git a/plugin/syntastic/makeprg_builder.vim b/plugin/syntastic/makeprg_builder.vim index 4271a4803..ef77efa9b 100644 --- a/plugin/syntastic/makeprg_builder.vim +++ b/plugin/syntastic/makeprg_builder.vim @@ -33,7 +33,7 @@ endfunction function! g:SyntasticMakeprgBuilder.fname() if empty(self._fname) - return shellescape(expand("%")) + return syntastic#util#shexpand('%') else return self._fname endif diff --git a/syntax_checkers/cuda/nvcc.vim b/syntax_checkers/cuda/nvcc.vim index ee210aca6..8303d2e05 100644 --- a/syntax_checkers/cuda/nvcc.vim +++ b/syntax_checkers/cuda/nvcc.vim @@ -36,7 +36,7 @@ function! SyntaxCheckers_cuda_nvcc_GetLocList() endif let makeprg = \ 'nvcc ' . arch_flag . ' --cuda -O0 -I . -Xcompiler -fsyntax-only ' . - \ shellescape(expand('%')) . ' ' . syntastic#c#NullOutput() + \ syntastic#util#shexpand('%') . ' ' . syntastic#c#NullOutput() let errorformat = \ '%*[^"]"%f"%*\D%l: %m,'. \ '"%f"%*\D%l: %m,'. @@ -58,7 +58,7 @@ function! SyntaxCheckers_cuda_nvcc_GetLocList() let makeprg = \ 'echo > .syntastic_dummy.cu ; ' . \ 'nvcc ' . arch_flag . ' --cuda -O0 -I . .syntastic_dummy.cu -Xcompiler -fsyntax-only -include ' . - \ shellescape(expand('%')) . ' ' . syntastic#c#NullOutput() + \ syntastic#util#shexpand('%') . ' ' . syntastic#c#NullOutput() else return [] endif diff --git a/syntax_checkers/erlang/erlang.vim b/syntax_checkers/erlang/erlang.vim index 1a0b27872..967b759df 100644 --- a/syntax_checkers/erlang/erlang.vim +++ b/syntax_checkers/erlang/erlang.vim @@ -32,12 +32,12 @@ function! SyntaxCheckers_erlang_escript_GetLocList() let shebang = getbufline(bufnr('%'), 1)[0] if len(shebang) > 0 if match(shebang, 'escript') >= 0 - let makeprg = 'escript -s '.shellescape(expand('%:p')) + let makeprg = 'escript -s ' . syntastic#util#shexpand('%:p') else - let makeprg = 'escript ' . s:check_file . ' '. shellescape(expand('%:p')).' '.g:syntastic_erlc_include_path + let makeprg = 'escript ' . s:check_file . ' ' . syntastic#util#shexpand('%:p') . ' ' . g:syntastic_erlc_include_path endif else - let makeprg = 'escript ' . s:check_file . ' ' . shellescape(expand('%:p')).' '.g:syntastic_erlc_include_path + let makeprg = 'escript ' . s:check_file . ' ' . syntastic#util#shexpand('%:p') . ' '. g:syntastic_erlc_include_path endif let errorformat = \ '%f:%l:\ %tarning:\ %m,'. diff --git a/syntax_checkers/eruby/erb.vim b/syntax_checkers/eruby/erb.vim index 74e0e6c52..06ac79bbe 100644 --- a/syntax_checkers/eruby/erb.vim +++ b/syntax_checkers/eruby/erb.vim @@ -28,16 +28,24 @@ function! SyntaxCheckers_eruby_erb_IsAvailable() endfunction function! SyntaxCheckers_eruby_erb_GetLocList() + let exe = expand(g:syntastic_ruby_exec) + if !has('win32') + let exe = 'RUBYOPT= ' . exe + endif + + let fname = fnameescape(expand('%')) + + let enc = &fileencoding != '' ? &fileencoding : &encoding + let encoding_string = enc ==? 'utf-8' ? 'UTF-8' : 'BINARY' + " TODO: fix the encoding trainwreck - " let enc = &fileencoding != '' ? &fileencoding : &encoding - let enc = '' - - let makeprg = syntastic#makeprg#build({ - \ 'exe': g:syntastic_erb_exec, - \ 'args': '-x -T -' . (enc ==# 'utf-8' ? ' -U' : ''), - \ 'tail': '\| ' . g:syntastic_ruby_exec . ' -c', - \ 'filetype': 'eruby', - \ 'subchecker': 'erb' }) + let makeprg = + \ exe . ' -e ' . + \ syntastic#util#shescape('puts File.read("' . fname . + \ '", :encoding => "' . encoding_string . + \ '").gsub(''<\%='',''<\%'')') . + \ ' \| ' . g:syntastic_erb_exec . ' -x -T -' . + \ ' \| ' . exe . ' -c' let errorformat = \ '%-GSyntax OK,'. diff --git a/syntax_checkers/eruby/ruby.vim b/syntax_checkers/eruby/ruby.vim index d32dd6e69..e9503f7e6 100644 --- a/syntax_checkers/eruby/ruby.vim +++ b/syntax_checkers/eruby/ruby.vim @@ -37,7 +37,7 @@ function! SyntaxCheckers_eruby_ruby_GetLocList() "gsub fixes issue #7, rails has it's own eruby syntax let makeprg = \ exe . ' -rerb -e ' . - \ shellescape('puts ERB.new(File.read("' . fname . + \ syntastic#util#shescape('puts ERB.new(File.read("' . fname . \ '", :encoding => "' . encoding_string . \ '").gsub(''<\%='',''<\%''), nil, ''-'').src') . \ ' \| ' . exe . ' -c' diff --git a/syntax_checkers/haxe/haxe.vim b/syntax_checkers/haxe/haxe.vim index fd9262c46..cffd52771 100644 --- a/syntax_checkers/haxe/haxe.vim +++ b/syntax_checkers/haxe/haxe.vim @@ -54,7 +54,7 @@ function! SyntaxCheckers_haxe_haxe_GetLocList() if !empty(hxml) let makeprg = syntastic#makeprg#build({ \ 'exe': 'haxe', - \ 'fname': shellescape(fnameescape(fnamemodify(hxml, ':t'))), + \ 'fname': syntastic#util#shescape(fnameescape(fnamemodify(hxml, ':t'))), \ 'filetype': 'haxe', \ 'subchecker': 'haxe' }) diff --git a/syntax_checkers/html/tidy.vim b/syntax_checkers/html/tidy.vim index 0f528026b..45c06a79f 100644 --- a/syntax_checkers/html/tidy.vim +++ b/syntax_checkers/html/tidy.vim @@ -74,9 +74,9 @@ endfunction function s:Args() let args = s:TidyEncOptByFenc() . - \ ' --new-blocklevel-tags ' . shellescape('main, section, article, aside, hgroup, header, footer, nav, figure, figcaption') . - \ ' --new-inline-tags ' . shellescape('video, audio, source, embed, mark, progress, meter, time, ruby, rt, rp, canvas, command, details, datalist') . - \ ' --new-empty-tags ' . shellescape('wbr, keygen') . + \ ' --new-blocklevel-tags ' . syntastic#util#shescape('main, section, article, aside, hgroup, header, footer, nav, figure, figcaption') . + \ ' --new-inline-tags ' . syntastic#util#shescape('video, audio, source, embed, mark, progress, meter, time, ruby, rt, rp, canvas, command, details, datalist') . + \ ' --new-empty-tags ' . syntastic#util#shescape('wbr, keygen') . \ ' -e' return args endfunction diff --git a/syntax_checkers/html/validator.vim b/syntax_checkers/html/validator.vim index bf41edeea..7e24a17b0 100644 --- a/syntax_checkers/html/validator.vim +++ b/syntax_checkers/html/validator.vim @@ -45,7 +45,7 @@ if !exists('g:syntastic_html_validator_nsfilter') let g:syntastic_html_validator_nsfilter = '' endif -let s:decoder = 'awk -f ' . shellescape(expand(':p:h') . '/validator_decode.awk') +let s:decoder = 'awk -f ' . syntastic#util#shescape(expand(':p:h') . '/validator_decode.awk') function! SyntaxCheckers_html_validator_IsAvailable() return executable('curl') && executable('awk') @@ -55,7 +55,7 @@ function! SyntaxCheckers_html_validator_GetLocList() let makeprg = 'curl -s --compressed -F out=gnu -F asciiquotes=yes' . \ (!empty(g:syntastic_html_validator_parser) ? ' -F parser=' . g:syntastic_html_validator_parser : '') . \ (!empty(g:syntastic_html_validator_nsfilter) ? ' -F nsfilter=' . g:syntastic_html_validator_nsfilter : '') . - \ ' -F doc=@' . shellescape(expand('%')) . '\;type=text/html\;filename=' . shellescape(expand('%')) . ' ' . + \ ' -F doc=@' . syntastic#util#shexpand('%') . '\;type=text/html\;filename=' . syntastic#util#shexpand('%') . ' ' . \ g:syntastic_html_validator_api . ' \| ' . s:decoder let errorformat = \ '%E"%f":%l: %trror: %m,' . diff --git a/syntax_checkers/html/w3.vim b/syntax_checkers/html/w3.vim index 7bb0fcd03..c9bc86888 100644 --- a/syntax_checkers/html/w3.vim +++ b/syntax_checkers/html/w3.vim @@ -32,7 +32,7 @@ endfunction function! SyntaxCheckers_html_w3_GetLocList() let makeprg = 'curl -s -F output=json ' . - \ '-F uploaded_file=@' . shellescape(expand('%:p')) . '\;type=text/html ' . + \ '-F uploaded_file=@' . syntastic#util#shexpand('%:p') . '\;type=text/html ' . \ g:syntastic_html_w3_api let errorformat = \ '%A %\+{,' . diff --git a/syntax_checkers/javascript/closurecompiler.vim b/syntax_checkers/javascript/closurecompiler.vim index f15f60603..6c55f4f21 100644 --- a/syntax_checkers/javascript/closurecompiler.vim +++ b/syntax_checkers/javascript/closurecompiler.vim @@ -38,7 +38,7 @@ 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 - let file_list = shellescape(expand('%')) + let file_list = syntastic#util#shexpand('%') endif let makeprg = syntastic#makeprg#build({ diff --git a/syntax_checkers/nasm/nasm.vim b/syntax_checkers/nasm/nasm.vim index 8c425b555..8476b5159 100644 --- a/syntax_checkers/nasm/nasm.vim +++ b/syntax_checkers/nasm/nasm.vim @@ -19,7 +19,7 @@ function! SyntaxCheckers_nasm_nasm_IsAvailable() endfunction function! SyntaxCheckers_nasm_nasm_GetLocList() - let wd = shellescape(expand("%:p:h") . "/") + let wd = syntastic#util#shescape(expand("%:p:h") . "/") let makeprg = syntastic#makeprg#build({ \ 'exe': 'nasm', \ 'args': '-X gnu -f elf -I ' . wd . ' ' . syntastic#c#NullOutput(), diff --git a/syntax_checkers/ocaml/camlp4o.vim b/syntax_checkers/ocaml/camlp4o.vim index b498134c5..352421251 100644 --- a/syntax_checkers/ocaml/camlp4o.vim +++ b/syntax_checkers/ocaml/camlp4o.vim @@ -121,7 +121,7 @@ endfunction function s:GetOcamlBuildMakeprg() return "ocamlbuild -quiet -no-log -tag annot," . s:ocamlpp . " -no-links -no-hygiene -no-sanitize " . - \ shellescape(expand('%:r')) . ".cmi" + \ syntastic#util#shexpand('%:r') . ".cmi" endfunction function s:GetOtherMakeprg() @@ -134,11 +134,11 @@ function s:GetOtherMakeprg() if match(extension, 'mly') >= 0 && executable("menhir") " ocamlyacc output can't be redirected, so use menhir - let makeprg = "menhir --only-preprocess " . shellescape(expand('%')) . " >" . syntastic#util#DevNull() + let makeprg = "menhir --only-preprocess " . syntastic#util#shexpand('%') . " >" . syntastic#util#DevNull() elseif match(extension,'mll') >= 0 && executable("ocamllex") - let makeprg = "ocamllex -q " . syntastic#c#NullOutput() . " " . shellescape(expand('%')) + let makeprg = "ocamllex -q " . syntastic#c#NullOutput() . " " . syntastic#util#shexpand('%') else - let makeprg = "camlp4o " . syntastic#c#NullOutput() . " " . shellescape(expand('%')) + let makeprg = "camlp4o " . syntastic#c#NullOutput() . " " . syntastic#util#shexpand('%') endif return makeprg diff --git a/syntax_checkers/perl/perl.vim b/syntax_checkers/perl/perl.vim index 67316da30..d88437ddc 100644 --- a/syntax_checkers/perl/perl.vim +++ b/syntax_checkers/perl/perl.vim @@ -41,7 +41,7 @@ endfunction if !exists("g:syntastic_perl_efm_program") let g:syntastic_perl_efm_program = \ g:syntastic_perl_interpreter . ' ' . - \ shellescape(expand(':p:h') . '/efm_perl.pl') . + \ syntastic#util#shescape(expand(':p:h') . '/efm_perl.pl') . \ ' -c -w' endif @@ -50,7 +50,7 @@ function! SyntaxCheckers_perl_perl_GetLocList() if exists("g:syntastic_perl_lib_path") let makeprg .= ' -I' . g:syntastic_perl_lib_path endif - let makeprg .= ' ' . shellescape(expand('%')) . s:ExtraMakeprgArgs() + let makeprg .= ' ' . syntastic#util#shexpand('%') . s:ExtraMakeprgArgs() let errorformat = '%t:%f:%l:%m' diff --git a/syntax_checkers/python/python.vim b/syntax_checkers/python/python.vim index 7169a6f67..eff1696b4 100644 --- a/syntax_checkers/python/python.vim +++ b/syntax_checkers/python/python.vim @@ -22,7 +22,7 @@ function! SyntaxCheckers_python_python_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'python', \ 'args': '-c', - \ 'fname': shellescape("compile(open(" . fname . ").read(), " . fname . ", 'exec')"), + \ 'fname': syntastic#util#shescape("compile(open(" . fname . ").read(), " . fname . ", 'exec')"), \ 'filetype': 'python', \ 'subchecker': 'python' }) From 6b09cb77fece7030ae64098d8398edf2e42a0552 Mon Sep 17 00:00:00 2001 From: Thomas Holmes Date: Fri, 5 Jul 2013 17:12:06 -0400 Subject: [PATCH 0091/1271] Refactor FindInParent from haxe.vim to be a util function --- autoload/syntastic/util.vim | 22 ++++++++++++++++++++++ syntax_checkers/haxe/haxe.vim | 24 +----------------------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/autoload/syntastic/util.vim b/autoload/syntastic/util.vim index 0a4d8cf1f..85ec7c01e 100644 --- a/autoload/syntastic/util.vim +++ b/autoload/syntastic/util.vim @@ -119,6 +119,28 @@ function! syntastic#util#bufIsActive(buffer) return 0 endfunction +" start in directory a:where and walk up the parent folders until it +" finds a file matching a:what; return path to that file +function! syntastic#util#findInParent(what, where) + let here = fnamemodify(a:where, ':p') + + while !empty(here) + let p = split(globpath(here, a:what), '\n') + + if !empty(p) + return fnamemodify(p[0], ':p') + elseif here == '/' + break + endif + + " we use ':h:h' rather than ':h' since ':p' adds a trailing '/' + " if 'here' is a directory + let here = fnamemodify(here, ':p:h:h') + endwhile + + return '' +endfunction + " Returns unique elements in a list function! syntastic#util#unique(list) let seen = {} diff --git a/syntax_checkers/haxe/haxe.vim b/syntax_checkers/haxe/haxe.vim index cffd52771..969a93692 100644 --- a/syntax_checkers/haxe/haxe.vim +++ b/syntax_checkers/haxe/haxe.vim @@ -19,35 +19,13 @@ function! SyntaxCheckers_haxe_haxe_IsAvailable() return executable('haxe') endfunction -" start in directory a:where and walk up the parent folders until it -" finds a file matching a:what; return path to that file -function! s:FindInParent(what, where) - let here = fnamemodify(a:where, ':p') - - while !empty(here) - let p = split(globpath(here, a:what), '\n') - - if !empty(p) - return fnamemodify(p[0], ':p') - elseif here == '/' - break - endif - - " we use ':h:h' rather than ':h' since ':p' adds a trailing '/' - " if 'here' is a directory - let here = fnamemodify(here, ':p:h:h') - endwhile - - return '' -endfunction - function! SyntaxCheckers_haxe_haxe_GetLocList() if exists('b:vaxe_hxml') let hxml = b:vaxe_hxml elseif exists('g:vaxe_hxml') let hxml = g:vaxe_hxml else - let hxml = s:FindInParent('*.hxml', expand('%:p:h')) + let hxml = syntastic#util#findInParent('*.hxml', expand('%:p:h')) endif let hxml = fnamemodify(hxml, ':p') From 835e177ab1b796d3a36a03c74bd924587c51b0d1 Mon Sep 17 00:00:00 2001 From: Thomas Holmes Date: Fri, 5 Jul 2013 17:13:20 -0400 Subject: [PATCH 0092/1271] Fix Elixir `mix` detection. Syntax checker now looks up thorugh its parents to find if it is part of a mix project. --- syntax_checkers/elixir/elixir.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntax_checkers/elixir/elixir.vim b/syntax_checkers/elixir/elixir.vim index 612ba8bf1..c38b52bcd 100644 --- a/syntax_checkers/elixir/elixir.vim +++ b/syntax_checkers/elixir/elixir.vim @@ -16,7 +16,7 @@ let g:loaded_syntastic_elixir_elixir_checker=1 let s:syntastic_elixir_compile_command = 'elixir' -if filereadable('mix.exs') +if filereadable(syntastic#util#findInParent('mix.exs', expand('%:p:h'))) let s:syntastic_elixir_compile_command = 'mix compile' endif From 46a247810d46dd210c5697682f681ec92fc8e643 Mon Sep 17 00:00:00 2001 From: Thomas Holmes Date: Fri, 5 Jul 2013 22:32:55 -0400 Subject: [PATCH 0093/1271] Mix needs the cwd to be set to the mix file. --- syntax_checkers/elixir/elixir.vim | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/syntax_checkers/elixir/elixir.vim b/syntax_checkers/elixir/elixir.vim index c38b52bcd..9cb9a7f58 100644 --- a/syntax_checkers/elixir/elixir.vim +++ b/syntax_checkers/elixir/elixir.vim @@ -16,10 +16,6 @@ let g:loaded_syntastic_elixir_elixir_checker=1 let s:syntastic_elixir_compile_command = 'elixir' -if filereadable(syntastic#util#findInParent('mix.exs', expand('%:p:h'))) - let s:syntastic_elixir_compile_command = 'mix compile' -endif - function! SyntaxCheckers_elixir_elixir_IsAvailable() if s:syntastic_elixir_compile_command == 'elixir' return executable('elixir') @@ -29,6 +25,18 @@ function! SyntaxCheckers_elixir_elixir_IsAvailable() endfunction function! SyntaxCheckers_elixir_elixir_GetLocList() + + let s:syntastic_elixir_compile_command = 'elixir' + + let mix_file = syntastic#util#findInParent('mix.exs', expand('%:p:h')) + + if filereadable(mix_file) + let s:syntastic_elixir_compile_command = 'mix compile' + let cwd = fnamemodify(mix_file, ':p:h') + else + let cwd = expand('%:p:h') + endif + let makeprg = syntastic#makeprg#build({ \ 'exe': s:syntastic_elixir_compile_command, \ 'filetype': 'elixir', @@ -38,7 +46,8 @@ function! SyntaxCheckers_elixir_elixir_GetLocList() return SyntasticMake({ \ 'makeprg': makeprg, - \ 'errorformat': errorformat }) + \ 'errorformat': errorformat, + \ 'cwd': cwd }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ From 1cf8981caf2cd59df3d49cf26cb7d2e96f37dac7 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Sat, 6 Jul 2013 09:08:07 +0300 Subject: [PATCH 0094/1271] Cleanup. --- syntax_checkers/elixir/elixir.vim | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/syntax_checkers/elixir/elixir.vim b/syntax_checkers/elixir/elixir.vim index 9cb9a7f58..521e94561 100644 --- a/syntax_checkers/elixir/elixir.vim +++ b/syntax_checkers/elixir/elixir.vim @@ -14,40 +14,30 @@ if exists("g:loaded_syntastic_elixir_elixir_checker") endif let g:loaded_syntastic_elixir_elixir_checker=1 -let s:syntastic_elixir_compile_command = 'elixir' - +" TODO: we should probably split this into separate checkers function! SyntaxCheckers_elixir_elixir_IsAvailable() - if s:syntastic_elixir_compile_command == 'elixir' - return executable('elixir') - else - return executable('mix') - endif + return executable('elixir') && executable('mix') endfunction function! SyntaxCheckers_elixir_elixir_GetLocList() - let s:syntastic_elixir_compile_command = 'elixir' - + let make_options = {} + let compile_command = 'elixir' let mix_file = syntastic#util#findInParent('mix.exs', expand('%:p:h')) if filereadable(mix_file) - let s:syntastic_elixir_compile_command = 'mix compile' - let cwd = fnamemodify(mix_file, ':p:h') - else - let cwd = expand('%:p:h') + let compile_command = 'mix compile' + let make_options['cwd'] = fnamemodify(mix_file, ':p:h') endif - let makeprg = syntastic#makeprg#build({ - \ 'exe': s:syntastic_elixir_compile_command, + let make_options['makeprg'] = syntastic#makeprg#build({ + \ 'exe': compile_command, \ 'filetype': 'elixir', \ 'subchecker': 'elixir' }) - let errorformat = '** %*[^\ ] %f:%l: %m' + let make_options['errorformat'] = '** %*[^\ ] %f:%l: %m' - return SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat, - \ 'cwd': cwd }) + return SyntasticMake(make_options) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ From 13165d1805ef826b5f883728b2d05f7953137548 Mon Sep 17 00:00:00 2001 From: Justin Donaldson Date: Sun, 7 Jul 2013 13:36:35 -0700 Subject: [PATCH 0095/1271] add hss syntax checker --- syntax_checkers/hss/hss.vim | 41 +++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 syntax_checkers/hss/hss.vim diff --git a/syntax_checkers/hss/hss.vim b/syntax_checkers/hss/hss.vim new file mode 100644 index 000000000..3bf9a6f05 --- /dev/null +++ b/syntax_checkers/hss/hss.vim @@ -0,0 +1,41 @@ + +"============================================================================ +"File: hss.vim +"Description: Syntax checking plugin for syntastic.vim +"Maintainer: Justin Donaldson (jdonaldson@gmail.com) +"License: This program is free software. It comes without any warranty, +" to the extent permitted by applicable law. You can redistribute +" it and/or modify it under the terms of the Do What The Fuck You +" Want To Public License, Version 2, as published by Sam Hocevar. +" See http://sam.zoy.org/wtfpl/COPYING for more details. +" +"============================================================================ + +if exists("g:loaded_syntastic_hss_hss_checker") + finish +endif +let g:loaded_syntastic_hss_hss_checker=1 + +function! SyntaxCheckers_hss_hss_IsAvailable() + return executable('hss') +endfunction + +function! SyntaxCheckers_hss_hss_GetLocList() + let makeprg = syntastic#makeprg#build({ + \ 'exe': 'hss', + \ 'fname': syntastic#util#shescape(expand('%')), + \ 'filetype': 'hss', + \ 'subchecker': 'hss' }) + + let errorformat = '%E%f:%l: %m' + + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'cwd': fnamemodify(expand('%'), ':h') }) + +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'hss', + \ 'name': 'hss'}) From eaee4bb828cb9abf474e8a7c3cac46c64152d21e Mon Sep 17 00:00:00 2001 From: Justin Donaldson Date: Sun, 7 Jul 2013 14:29:59 -0700 Subject: [PATCH 0096/1271] ignore output by default --- syntax_checkers/hss/hss.vim | 1 + 1 file changed, 1 insertion(+) diff --git a/syntax_checkers/hss/hss.vim b/syntax_checkers/hss/hss.vim index 3bf9a6f05..5e39477ac 100644 --- a/syntax_checkers/hss/hss.vim +++ b/syntax_checkers/hss/hss.vim @@ -23,6 +23,7 @@ endfunction function! SyntaxCheckers_hss_hss_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'hss', + \ 'args' : '-output /dev/null', \ 'fname': syntastic#util#shescape(expand('%')), \ 'filetype': 'hss', \ 'subchecker': 'hss' }) From bf87a8101e58140cb0656943babd4a363f6580db Mon Sep 17 00:00:00 2001 From: Justin Donaldson Date: Sun, 7 Jul 2013 14:36:22 -0700 Subject: [PATCH 0097/1271] redirect output to dev null for syntax checking --- syntax_checkers/hss/hss.vim | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/syntax_checkers/hss/hss.vim b/syntax_checkers/hss/hss.vim index 5e39477ac..badb2573c 100644 --- a/syntax_checkers/hss/hss.vim +++ b/syntax_checkers/hss/hss.vim @@ -20,10 +20,16 @@ function! SyntaxCheckers_hss_hss_IsAvailable() return executable('hss') endfunction +if has('win32') + let s:dev_null = 'NUL' +else + let s:dev_null = '/dev/null' +endif + function! SyntaxCheckers_hss_hss_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'hss', - \ 'args' : '-output /dev/null', + \ 'args' : '-output ' . s:dev_null, \ 'fname': syntastic#util#shescape(expand('%')), \ 'filetype': 'hss', \ 'subchecker': 'hss' }) From 96af073886badb813f02ff277fdc37528bf8f20c Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Mon, 8 Jul 2013 11:17:00 +0300 Subject: [PATCH 0098/1271] Cleanup. --- syntax_checkers/hss/hss.vim | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/syntax_checkers/hss/hss.vim b/syntax_checkers/hss/hss.vim index badb2573c..5d2cf0055 100644 --- a/syntax_checkers/hss/hss.vim +++ b/syntax_checkers/hss/hss.vim @@ -1,8 +1,7 @@ - "============================================================================ "File: hss.vim "Description: Syntax checking plugin for syntastic.vim -"Maintainer: Justin Donaldson (jdonaldson@gmail.com) +"Maintainer: Justin Donaldson (jdonaldson@gmail.com) "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 @@ -20,27 +19,18 @@ function! SyntaxCheckers_hss_hss_IsAvailable() return executable('hss') endfunction -if has('win32') - let s:dev_null = 'NUL' -else - let s:dev_null = '/dev/null' -endif - function! SyntaxCheckers_hss_hss_GetLocList() let makeprg = syntastic#makeprg#build({ - \ 'exe': 'hss', - \ 'args' : '-output ' . s:dev_null, - \ 'fname': syntastic#util#shescape(expand('%')), - \ 'filetype': 'hss', - \ 'subchecker': 'hss' }) + \ 'exe': 'hss', + \ 'args' : '-output ' . syntastic#util#DevNull(), + \ 'filetype': 'hss', + \ 'subchecker': 'hss' }) let errorformat = '%E%f:%l: %m' return SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat, - \ 'cwd': fnamemodify(expand('%'), ':h') }) - + \ 'makeprg': makeprg, + \ 'errorformat': errorformat }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ From 2f1315862e4f273c52d3b3466e9dfc7d9427b0be Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Mon, 8 Jul 2013 11:23:47 +0300 Subject: [PATCH 0099/1271] Added hss to the list of supported languages. --- README.markdown | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.markdown b/README.markdown index 4663db1a9..ded4c764f 100644 --- a/README.markdown +++ b/README.markdown @@ -27,12 +27,12 @@ execute their script to find them. At the time of this writing, syntax checking plugins exist for Ada, AppleScript, Bourne shell, C, C++, C#, CoffeeScript, Coco, Coq, CSS, -Cucumber, CUDA, D, Dart, DocBook, Elixir, Erlang, eRuby, Fortran, Gentoo -metadata, Go, Haml, Haskell, Haxe, HTML, Java, JavaScript, JSON, LESS, -LISP, LLVM intermediate language, Lua, MATLAB, NASM, Objective-C, -Objective-C++, OCaml, Perl, Perl POD, PHP, Puppet, Python, -reStructuredText, Ruby, Rust, SASS/SCSS, Scala, Slim, Tcl, TeX, Twig, -TypeScript, Vala, VHDL, xHtml, XML, XSLT, YAML, z80, Zope page +Cucumber, CUDA, D, Dart, DocBook, Elixir, Erlang, eRuby, Fortran, +Gentoo metadata, Go, Haml, Haskell, Haxe, hss, HTML, Java, JavaScript, +JSON, LESS, LISP, LLVM intermediate language, Lua, MATLAB, NASM, +Objective-C, Objective-C++, OCaml, Perl, Perl POD, PHP, Puppet, Python, +reStructuredText, Ruby, Rust, SASS/SCSS, Scala, Slim, Tcl, TeX, +Twig, TypeScript, Vala, VHDL, xHtml, XML, XSLT, YAML, z80, Zope page templates, zsh. ## Screenshot From 9e777641cfa47960da17a6d877ceaed160134dfc Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Tue, 9 Jul 2013 22:15:24 +0300 Subject: [PATCH 0100/1271] Minor fixes to the docs. Document g:syntastic_debug. --- README.markdown | 8 ++++---- doc/syntastic.txt | 12 ++++++++++-- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/README.markdown b/README.markdown index ded4c764f..d7492750e 100644 --- a/README.markdown +++ b/README.markdown @@ -28,7 +28,7 @@ execute their script to find them. At the time of this writing, syntax checking plugins exist for Ada, AppleScript, Bourne shell, C, C++, C#, CoffeeScript, Coco, Coq, CSS, Cucumber, CUDA, D, Dart, DocBook, Elixir, Erlang, eRuby, Fortran, -Gentoo metadata, Go, Haml, Haskell, Haxe, hss, HTML, Java, JavaScript, +Gentoo metadata, Go, Haml, Haskell, Haxe, HSS, HTML, Java, JavaScript, JSON, LESS, LISP, LLVM intermediate language, Lua, MATLAB, NASM, Objective-C, Objective-C++, OCaml, Perl, Perl POD, PHP, Puppet, Python, reStructuredText, Ruby, Rust, SASS/SCSS, Scala, Slim, Tcl, TeX, @@ -99,9 +99,9 @@ To get information or make suggestions check out the [google group](https://grou __Q. I installed syntastic but it isn't reporting any errors...__ -A. The most likely reason is that the syntax checker that it requires isn't installed. For example: python requires either `flake8`, `pyflakes` or `pylint` to be installed and in `$PATH`. To see which executable is required, just look in `syntax_checkers/.vim`. Note that aliases do not work; the actual executable must be available in your `$PATH`. Symbolic links are okay. +A. The most likely reason is that none of the syntax checkers that it requires is installed. For example: python requires either `flake8`, `pyflakes` or `pylint` to be installed and in `$PATH`. To see which executables are supported, just look in `syntax_checkers//*.vim`. Note that aliases do not work; the actual executable must be available in your `$PATH`. Symbolic links are okay. You can see syntastic's idea of available checkers by running `:SyntasticInfo`. -Another reason it could fail is that the error output for the syntax checker may have changed. In this case, make sure you have the latest version of the syntax checker installed. If it still fails then create an issue - or better yet, create a pull request. +Another reason it could fail is that either the command line options or the error output for a syntax checker may have changed. In this case, make sure you have the latest version of the syntax checker installed. If it still fails then create an issue - or better yet, create a pull request. __Q. Recently some of my syntax checker options have stopped working...__ @@ -122,7 +122,7 @@ __Q. How can I pass additional arguments to a checker?__ A. Almost all syntax checkers use the `syntastic#makeprg#build()` function. Those checkers that do can be configured using global variables. The general form of the global args variables are: ```vim -syntastic_[filetype]_[subchecker]_args +syntastic___args ``` So, If you wanted to pass "--my --args --here" to the ruby mri checker you would add this line to your vimrc: diff --git a/doc/syntastic.txt b/doc/syntastic.txt index a33b9325f..ec86def50 100644 --- a/doc/syntastic.txt +++ b/doc/syntastic.txt @@ -348,9 +348,17 @@ statusline: > If the buffer had 2 warnings, starting on line 5 then this would appear: > [Warn: 5 #2] < + *'syntastic_debug'* +Default: 0 +Set this to 1 to enable debugging: > + let g:syntastic_debug = 1 +< +Checkers will then add debugging messages to Vim's |message-history|. You can +examine these messages with |:mes|. + ============================================================================== -5. Checker Options *syntastic-checker-options* +5. Checker Options *syntastic-checker-options* ------------------------------------------------------------------------------ 5.1 Telling syntastic which checker to use. @@ -383,7 +391,7 @@ This is telling syntastic to run the 'php' checker first, and if no errors are found, run 'phpcs', and then 'phpmd'. ------------------------------------------------------------------------------ -5.2 Configuring specific checkers *syntastic-config-makeprg* +5.2 Configuring specific checkers *syntastic-config-makeprg* Most checkers use the 'syntastic#makeprg#build()' function and provide many options by default - in fact you can customise every part of the command From 81a6ece29110d672808010f19ba98e2feaccb4b7 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Wed, 10 Jul 2013 10:30:41 +0300 Subject: [PATCH 0101/1271] Fix a bug related to shell escaping. --- autoload/syntastic/util.vim | 2 +- syntax_checkers/eruby/erb.vim | 6 +++--- syntax_checkers/eruby/ruby.vim | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/autoload/syntastic/util.vim b/autoload/syntastic/util.vim index 85ec7c01e..db52d7f27 100644 --- a/autoload/syntastic/util.vim +++ b/autoload/syntastic/util.vim @@ -156,7 +156,7 @@ endfunction " A less noisy shellescape() function! syntastic#util#shescape(string) - return a:string =~ '\m^[A-Za-z0-9_/.-]\+$' ? a:string : shellescape(a:string) + return a:string =~ '\m^[A-Za-z0-9_/.-]\+$' ? a:string : shellescape(a:string, 1) endfunction " A less noisy shellescape(expand()) diff --git a/syntax_checkers/eruby/erb.vim b/syntax_checkers/eruby/erb.vim index 06ac79bbe..e37bba265 100644 --- a/syntax_checkers/eruby/erb.vim +++ b/syntax_checkers/eruby/erb.vim @@ -33,7 +33,7 @@ function! SyntaxCheckers_eruby_erb_GetLocList() let exe = 'RUBYOPT= ' . exe endif - let fname = fnameescape(expand('%')) + let fname = "'" . escape(expand('%'), "\\'") . "'" let enc = &fileencoding != '' ? &fileencoding : &encoding let encoding_string = enc ==? 'utf-8' ? 'UTF-8' : 'BINARY' @@ -41,8 +41,8 @@ function! SyntaxCheckers_eruby_erb_GetLocList() " TODO: fix the encoding trainwreck let makeprg = \ exe . ' -e ' . - \ syntastic#util#shescape('puts File.read("' . fname . - \ '", :encoding => "' . encoding_string . + \ syntastic#util#shescape('puts File.read(' . fname . + \ ', :encoding => "' . encoding_string . \ '").gsub(''<\%='',''<\%'')') . \ ' \| ' . g:syntastic_erb_exec . ' -x -T -' . \ ' \| ' . exe . ' -c' diff --git a/syntax_checkers/eruby/ruby.vim b/syntax_checkers/eruby/ruby.vim index e9503f7e6..6032bc220 100644 --- a/syntax_checkers/eruby/ruby.vim +++ b/syntax_checkers/eruby/ruby.vim @@ -29,7 +29,7 @@ function! SyntaxCheckers_eruby_ruby_GetLocList() let exe = 'RUBYOPT= ' . exe endif - let fname = fnameescape(expand('%')) + let fname = "'" . escape(expand('%'), "\\'") . "'" let enc = &fileencoding != '' ? &fileencoding : &encoding let encoding_string = enc ==? 'utf-8' ? 'UTF-8' : 'BINARY' @@ -37,8 +37,8 @@ function! SyntaxCheckers_eruby_ruby_GetLocList() "gsub fixes issue #7, rails has it's own eruby syntax let makeprg = \ exe . ' -rerb -e ' . - \ syntastic#util#shescape('puts ERB.new(File.read("' . fname . - \ '", :encoding => "' . encoding_string . + \ syntastic#util#shescape('puts ERB.new(File.read(' . fname . + \ ', :encoding => "' . encoding_string . \ '").gsub(''<\%='',''<\%''), nil, ''-'').src') . \ ' \| ' . exe . ' -c' From c8bb7304f44cf9e090b137ca44b9ebd8cef9cc6d Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Wed, 10 Jul 2013 11:20:54 +0300 Subject: [PATCH 0102/1271] More shell escaping bugs. --- autoload/syntastic/util.vim | 2 +- syntax_checkers/ocaml/camlp4o.vim | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/autoload/syntastic/util.vim b/autoload/syntastic/util.vim index db52d7f27..4b0d4624c 100644 --- a/autoload/syntastic/util.vim +++ b/autoload/syntastic/util.vim @@ -161,7 +161,7 @@ endfunction " A less noisy shellescape(expand()) function! syntastic#util#shexpand(string) - return syntastic#util#shescape(expand(a:string)) + return syntastic#util#shescape(escape(expand(a:string), '|')) endfunction function! syntastic#util#debug(msg) diff --git a/syntax_checkers/ocaml/camlp4o.vim b/syntax_checkers/ocaml/camlp4o.vim index e2409ec1b..ebec5cb75 100644 --- a/syntax_checkers/ocaml/camlp4o.vim +++ b/syntax_checkers/ocaml/camlp4o.vim @@ -112,10 +112,10 @@ function s:GetOcamlcMakeprg() if g:syntastic_ocaml_use_janestreet_core let build_cmd = "ocamlc -I " let build_cmd .= expand(g:syntastic_ocaml_janestreet_core_dir) - let build_cmd .= " -c " . expand('%') + let build_cmd .= " -c " . syntastic#util#shexpand('%') return build_cmd else - return "ocamlc -c " . expand('%') + return "ocamlc -c " . syntastic#util#shexpand('%') endif endfunction From 134a48e85c4167e736f26bd802c0d19950e49734 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Wed, 10 Jul 2013 14:29:24 +0300 Subject: [PATCH 0103/1271] Errorformat adjustments for podchecker. Deal with error messages like this: *** ERROR: =over on line 7 without closing =back at line EOF in file ... --- syntax_checkers/pod/podchecker.vim | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/syntax_checkers/pod/podchecker.vim b/syntax_checkers/pod/podchecker.vim index 4f2152018..86b6dc071 100644 --- a/syntax_checkers/pod/podchecker.vim +++ b/syntax_checkers/pod/podchecker.vim @@ -26,11 +26,22 @@ function! SyntaxCheckers_pod_podchecker_GetLocList() let errorformat = \ '%W%[%#]%[%#]%[%#] WARNING: %m at line %l in file %f,' . - \ '%E%[%#]%[%#]%[%#] ERROR: %m at line %l in file %f' + \ '%W%[%#]%[%#]%[%#] WARNING: %m at line EOF in file %f,' . + \ '%E%[%#]%[%#]%[%#] ERROR: %m at line %l in file %f,' . + \ '%E%[%#]%[%#]%[%#] ERROR: %m at line EOF in file %f' - return SyntasticMake({ + let loclist = SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat }) + + for n in range(len(loclist)) + let e = loclist[n] + if e['valid'] && e['lnum'] == 0 + let e['lnum'] = str2nr(matchstr(e['text'], '\m\ Date: Thu, 11 Jul 2013 09:31:19 +0300 Subject: [PATCH 0104/1271] Removed erb checker for eRuby. Rationale: ruby.vim is functionally identical, and faster. --- syntax_checkers/eruby/erb.vim | 65 ----------------------------------- 1 file changed, 65 deletions(-) delete mode 100644 syntax_checkers/eruby/erb.vim diff --git a/syntax_checkers/eruby/erb.vim b/syntax_checkers/eruby/erb.vim deleted file mode 100644 index e37bba265..000000000 --- a/syntax_checkers/eruby/erb.vim +++ /dev/null @@ -1,65 +0,0 @@ -"============================================================================ -"File: erb.vim -"Description: Syntax checking plugin for syntastic.vim -"Author: Martin Grenfell -"Modifier: Grzegorz Smajdor -"License: This program is free software. It comes without any warranty, -" to the extent permitted by applicable law. You can redistribute -" it and/or modify it under the terms of the Do What The Fuck You -" Want To Public License, Version 2, as published by Sam Hocevar. -" See http://sam.zoy.org/wtfpl/COPYING for more details. -"============================================================================ - -if exists("g:loaded_syntastic_eruby_erb_checker") - finish -endif -let g:loaded_syntastic_eruby_erb_checker=1 - -if !exists("g:syntastic_erb_exec") - let g:syntastic_erb_exec = "erb" -endif - -if !exists("g:syntastic_ruby_exec") - let g:syntastic_ruby_exec = "ruby" -endif - -function! SyntaxCheckers_eruby_erb_IsAvailable() - return executable(expand(g:syntastic_ruby_exec)) && executable(expand(g:syntastic_ruby_exec)) -endfunction - -function! SyntaxCheckers_eruby_erb_GetLocList() - let exe = expand(g:syntastic_ruby_exec) - if !has('win32') - let exe = 'RUBYOPT= ' . exe - endif - - let fname = "'" . escape(expand('%'), "\\'") . "'" - - let enc = &fileencoding != '' ? &fileencoding : &encoding - let encoding_string = enc ==? 'utf-8' ? 'UTF-8' : 'BINARY' - - " TODO: fix the encoding trainwreck - let makeprg = - \ exe . ' -e ' . - \ syntastic#util#shescape('puts File.read(' . fname . - \ ', :encoding => "' . encoding_string . - \ '").gsub(''<\%='',''<\%'')') . - \ ' \| ' . g:syntastic_erb_exec . ' -x -T -' . - \ ' \| ' . exe . ' -c' - - let errorformat = - \ '%-GSyntax OK,'. - \ '%E-:%l: syntax error\, %m,%Z%p^,'. - \ '%W-:%l: warning: %m,'. - \ '%Z%p^,'. - \ '%-C%.%#' - - return SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat, - \ 'defaults': { 'bufnr': bufnr(""), 'vcol': 1 } }) -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'eruby', - \ 'name': 'erb'}) From c400dedb20c14abf8ce95ad0bcad016215b77603 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Thu, 11 Jul 2013 10:04:26 +0300 Subject: [PATCH 0105/1271] New knob: g:syntastic_full_redraws. --- doc/syntastic.txt | 13 ++++++++++--- plugin/syntastic.vim | 10 +++++++--- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/doc/syntastic.txt b/doc/syntastic.txt index ec86def50..0c95ab7c4 100644 --- a/doc/syntastic.txt +++ b/doc/syntastic.txt @@ -187,8 +187,8 @@ syntax errors: > let g:syntastic_enable_signs=1 < - *'syntastic_error_symbol'* *'syntastic_style_error_symbol'* - *'syntastic_warning_symbol'* *'syntastic_style_warning_symbol'* + *'syntastic_error_symbol'* *'syntastic_style_error_symbol'* + *'syntastic_warning_symbol'* *'syntastic_style_warning_symbol'* Use this option to control what the syntastic |:sign| text contains. Several error symobls can be customized: syntastic_error_symbol - For syntax errors, defaults to '>>' @@ -209,7 +209,7 @@ when the mouse is hovered over erroneous lines: > < Note that vim must be compiled with |+balloon_eval|. - *'syntastic_enable_highlighting'* + *'syntastic_enable_highlighting'* Default: 1 Use this option to tell syntastic whether to use syntax highlighting to mark errors (where possible). Highlighting can be turned off with the following > @@ -348,6 +348,13 @@ statusline: > If the buffer had 2 warnings, starting on line 5 then this would appear: > [Warn: 5 #2] < + *'syntastic_full_redraws'* +Default: 0 in GUI Vim and MacVim, 1 otherwise +Controls whether syntastic calls |:redraw| or |:redraw!| for screen redraws. +Changing it can in principle make screen redraws smoother, but it can also +cause screen flicker, or ghost characters. Leaving it to the default should +be safe. + *'syntastic_debug'* Default: 0 Set this to 1 to enable debugging: > diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index bd3cdf1e3..cf6054d99 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -56,6 +56,10 @@ if !exists("g:syntastic_filetype_map") let g:syntastic_filetype_map = {} endif +if !exists("g:syntastic_full_redraws") + let g:syntastic_full_redraws = !( has('gui_running') || has('gui_macvim')) +endif + let s:registry = g:SyntasticRegistry.Instance() let s:notifiers = g:SyntasticNotifiers.Instance() let s:modemap = g:SyntasticModeMap.Instance() @@ -229,10 +233,10 @@ endfunction "However, on some versions of gvim using `redraw!` causes the screen to "flicker - so use redraw. function! s:Redraw() - if has('gui_running') || has('gui_macvim') - redraw - else + if g:syntastic_full_redraws redraw! + else + redraw endif endfunction From 06f97ef54c0137771d8636f1d73403dfad8de3c3 Mon Sep 17 00:00:00 2001 From: Shane da Silva Date: Thu, 11 Jul 2013 12:22:38 -0700 Subject: [PATCH 0106/1271] Fix errorformat for RuboCop checker The errorformat for the RuboCop checker was missing the capture group for the column number of the error/warning, which resulted in the location list attempting to jump to 'filename.rb:80', which would attempt to open a new file. The solution was to add the "%c" to capture the column number of the error. --- syntax_checkers/ruby/rubocop.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntax_checkers/ruby/rubocop.vim b/syntax_checkers/ruby/rubocop.vim index cf9b979cf..a1f70a262 100644 --- a/syntax_checkers/ruby/rubocop.vim +++ b/syntax_checkers/ruby/rubocop.vim @@ -29,7 +29,7 @@ function! SyntaxCheckers_ruby_rubocop_GetLocList() \ 'filetype': 'ruby', \ 'subchecker': 'rubocop' }) - let errorformat = '%f:%l:\ %t:\ %m' + let errorformat = '%f:%l:%c:\ %t:\ %m' let loclist = SyntasticMake({ \ 'makeprg': makeprg, From 5cabd29a232e55be0e8fabab77df96d46c4d2e7c Mon Sep 17 00:00:00 2001 From: Shane da Silva Date: Thu, 11 Jul 2013 12:27:30 -0700 Subject: [PATCH 0107/1271] Change --emacs flag to --format emacs for RuboCop The `--emacs` flag has been deprecated. Switch to specifying `--format emacs` so that this doesn't break when RuboCop 1.0 is released. --- syntax_checkers/ruby/rubocop.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntax_checkers/ruby/rubocop.vim b/syntax_checkers/ruby/rubocop.vim index cf9b979cf..cb771b1de 100644 --- a/syntax_checkers/ruby/rubocop.vim +++ b/syntax_checkers/ruby/rubocop.vim @@ -25,7 +25,7 @@ endfunction function! SyntaxCheckers_ruby_rubocop_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'rubocop', - \ 'args': '--emacs --silent', + \ 'args': '--format emacs --silent', \ 'filetype': 'ruby', \ 'subchecker': 'rubocop' }) From 0051553bc19cf47b329ba553017df69d59d122b1 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 12 Jul 2013 07:01:16 +0300 Subject: [PATCH 0108/1271] Version check for rubocop. Only rubocop versions 0.9.0 or later are supported. --- syntax_checkers/ruby/rubocop.vim | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/syntax_checkers/ruby/rubocop.vim b/syntax_checkers/ruby/rubocop.vim index 8f968fca0..b93d8d1ae 100644 --- a/syntax_checkers/ruby/rubocop.vim +++ b/syntax_checkers/ruby/rubocop.vim @@ -19,7 +19,9 @@ endif let g:loaded_syntastic_ruby_rubocop_checker=1 function! SyntaxCheckers_ruby_rubocop_IsAvailable() - return executable('rubocop') + return + \ executable('rubocop') && + \ syntastic#util#versionIsAtLeast(syntastic#util#parseVersion('rubocop --version'), [0,9,0]) endfunction function! SyntaxCheckers_ruby_rubocop_GetLocList() @@ -29,7 +31,7 @@ function! SyntaxCheckers_ruby_rubocop_GetLocList() \ 'filetype': 'ruby', \ 'subchecker': 'rubocop' }) - let errorformat = '%f:%l:%c:\ %t:\ %m' + let errorformat = '%f:%l:%c: %t: %m' let loclist = SyntasticMake({ \ 'makeprg': makeprg, From aa4c3b97e988d1556a3901605120bcbb23e01c31 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 12 Jul 2013 08:08:41 +0300 Subject: [PATCH 0109/1271] A first attempt at checking the exit code from the checkers. --- autoload/syntastic/util.vim | 9 +++++++++ plugin/syntastic.vim | 5 +++++ plugin/syntastic/checker.vim | 9 +++++++-- syntax_checkers/c/checkpatch.vim | 1 + syntax_checkers/c/sparse.vim | 3 ++- syntax_checkers/html/tidy.vim | 3 ++- syntax_checkers/html/w3.vim | 8 +++++++- syntax_checkers/nroff/mandoc.vim | 3 ++- syntax_checkers/perl/perlcritic.vim | 1 + syntax_checkers/pod/podchecker.vim | 3 ++- syntax_checkers/text/atdtool.vim | 1 + syntax_checkers/xhtml/tidy.vim | 3 ++- syntax_checkers/xml/xmllint.vim | 3 ++- 13 files changed, 43 insertions(+), 9 deletions(-) diff --git a/autoload/syntastic/util.vim b/autoload/syntastic/util.vim index 4b0d4624c..b569bc18c 100644 --- a/autoload/syntastic/util.vim +++ b/autoload/syntastic/util.vim @@ -175,7 +175,16 @@ function! syntastic#util#info(msg) endfunction function! syntastic#util#warn(msg) + echohl WarningMsg echomsg "syntastic: warning: " . a:msg + echohl None +endfunction + +function! syntastic#util#error(msg) + execute "normal \" + echohl ErrorMsg + echomsg "syntastic: error: " . a:msg + echohl None endfunction function! syntastic#util#deprecationWarn(msg) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index cf6054d99..d6fa8ddc1 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -327,6 +327,7 @@ endfunction " 'subtype' - all errors will be assigned the given subtype " 'postprocess' - a list of functions to be applied to the error list " 'cwd' - change directory to the given path before running the checker +" 'returns' - a list of valid exit codes for the checker function! SyntasticMake(options) call syntastic#util#debug('SyntasticMake: called with options: '. string(a:options)) @@ -377,6 +378,10 @@ function! SyntasticMake(options) call s:Redraw() endif + if has_key(a:options, 'returns') && index(a:options['returns'], v:shell_error) == -1 + throw 'Syntastic: checker error' + endif + if has_key(a:options, 'defaults') call SyntasticAddToErrors(errors, a:options['defaults']) endif diff --git a/plugin/syntastic/checker.vim b/plugin/syntastic/checker.vim index a3fe79356..3ab1d2123 100644 --- a/plugin/syntastic/checker.vim +++ b/plugin/syntastic/checker.vim @@ -36,8 +36,13 @@ function! g:SyntasticChecker.getName() endfunction function! g:SyntasticChecker.getLocList() - let list = self._locListFunc() - call syntastic#util#debug('getLocList: checker ' . self._filetype . '/' . self._name . ' returned ' . v:shell_error) + try + let list = self._locListFunc() + call syntastic#util#debug('getLocList: checker ' . self._filetype . '/' . self._name . ' returned ' . v:shell_error) + catch /\m\C^Syntastic: checker error$/ + let list = [] + call syntastic#util#error('checker ' . self._filetype . '/' . self._name . ' returned abnormal status ' . v:shell_error) + endtry call self._populateHighlightRegexes(list) return g:SyntasticLoclist.New(list) endfunction diff --git a/syntax_checkers/c/checkpatch.vim b/syntax_checkers/c/checkpatch.vim index dc5e95de5..0d579bfdc 100644 --- a/syntax_checkers/c/checkpatch.vim +++ b/syntax_checkers/c/checkpatch.vim @@ -39,6 +39,7 @@ function! SyntaxCheckers_c_checkpatch_GetLocList() return SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, + \ 'returns': [0], \ 'subtype': 'Style' }) endfunction diff --git a/syntax_checkers/c/sparse.vim b/syntax_checkers/c/sparse.vim index 4b3e6ee36..0307e324f 100644 --- a/syntax_checkers/c/sparse.vim +++ b/syntax_checkers/c/sparse.vim @@ -41,7 +41,8 @@ function! SyntaxCheckers_c_sparse_GetLocList() let loclist = SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, - \ 'defaults': {'bufnr': bufnr("")} }) + \ 'defaults': {'bufnr': bufnr("")}, + \ 'returns': [0] }) return loclist endfunction diff --git a/syntax_checkers/html/tidy.vim b/syntax_checkers/html/tidy.vim index 45c06a79f..b7d508f82 100644 --- a/syntax_checkers/html/tidy.vim +++ b/syntax_checkers/html/tidy.vim @@ -97,7 +97,8 @@ function! SyntaxCheckers_html_tidy_GetLocList() let loclist = SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, - \ 'defaults': {'bufnr': bufnr("")} }) + \ 'defaults': {'bufnr': bufnr("")}, + \ 'returns': [0, 1, 2] }) " filter out valid HTML5 from the errors for n in range(len(loclist)) diff --git a/syntax_checkers/html/w3.vim b/syntax_checkers/html/w3.vim index c9bc86888..01c413cc5 100644 --- a/syntax_checkers/html/w3.vim +++ b/syntax_checkers/html/w3.vim @@ -34,6 +34,7 @@ function! SyntaxCheckers_html_w3_GetLocList() let makeprg = 'curl -s -F output=json ' . \ '-F uploaded_file=@' . syntastic#util#shexpand('%:p') . '\;type=text/html ' . \ g:syntastic_html_w3_api + let errorformat = \ '%A %\+{,' . \ '%C %\+"lastLine": %l\,%\?,' . @@ -44,7 +45,12 @@ function! SyntaxCheckers_html_w3_GetLocList() \ '%C %\+"subtype": "%tarning"\,%\?,' . \ '%Z %\+}\,,' . \ '%-G%.%#' - let loclist = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat, 'defaults': {'bufnr': bufnr("")} }) + + let loclist = SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'defaults': {'bufnr': bufnr("")}, + \ 'returns': [0] }) for n in range(len(loclist)) let loclist[n]['text'] = substitute(loclist[n]['text'], '\\\([\"]\)', '\1', 'g') diff --git a/syntax_checkers/nroff/mandoc.vim b/syntax_checkers/nroff/mandoc.vim index 05e28775d..3333d24e6 100644 --- a/syntax_checkers/nroff/mandoc.vim +++ b/syntax_checkers/nroff/mandoc.vim @@ -31,7 +31,8 @@ function! SyntaxCheckers_nroff_mandoc_GetLocList() return SyntasticMake({ \ 'makeprg': makeprg, - \ 'errorformat': errorformat }) + \ 'errorformat': errorformat, + \ 'returns': [0, 2, 3, 4] }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/syntax_checkers/perl/perlcritic.vim b/syntax_checkers/perl/perlcritic.vim index 2bfa56c32..910ded2be 100644 --- a/syntax_checkers/perl/perlcritic.vim +++ b/syntax_checkers/perl/perlcritic.vim @@ -49,6 +49,7 @@ function! SyntaxCheckers_perl_perlcritic_GetLocList() let loclist = SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, + \ 'returns': [0, 2], \ 'subtype': 'Style' }) " change error types according to the prescribed threshold diff --git a/syntax_checkers/pod/podchecker.vim b/syntax_checkers/pod/podchecker.vim index 86b6dc071..c429a495c 100644 --- a/syntax_checkers/pod/podchecker.vim +++ b/syntax_checkers/pod/podchecker.vim @@ -32,7 +32,8 @@ function! SyntaxCheckers_pod_podchecker_GetLocList() let loclist = SyntasticMake({ \ 'makeprg': makeprg, - \ 'errorformat': errorformat }) + \ 'errorformat': errorformat, + \ 'returns': [0, 1, 2] }) for n in range(len(loclist)) let e = loclist[n] diff --git a/syntax_checkers/text/atdtool.vim b/syntax_checkers/text/atdtool.vim index bfccb7e65..9f5061b83 100644 --- a/syntax_checkers/text/atdtool.vim +++ b/syntax_checkers/text/atdtool.vim @@ -42,6 +42,7 @@ function! SyntaxCheckers_text_atdtool_GetLocList() let loclist = SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, + \ 'returns': [0], \ 'subtype': 'Style' }) for n in range(len(loclist)) diff --git a/syntax_checkers/xhtml/tidy.vim b/syntax_checkers/xhtml/tidy.vim index 72e4de936..e0c22fbbf 100644 --- a/syntax_checkers/xhtml/tidy.vim +++ b/syntax_checkers/xhtml/tidy.vim @@ -72,7 +72,8 @@ function! SyntaxCheckers_xhtml_tidy_GetLocList() let loclist = SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, - \ 'defaults': {'bufnr': bufnr("")} }) + \ 'defaults': {'bufnr': bufnr("")}, + \ 'returns': [0, 1, 2] }) for n in range(len(loclist)) if loclist[n]['valid'] && s:IgnoreError(loclist[n]['text']) == 1 diff --git a/syntax_checkers/xml/xmllint.vim b/syntax_checkers/xml/xmllint.vim index f0715a25c..5a6e1db70 100644 --- a/syntax_checkers/xml/xmllint.vim +++ b/syntax_checkers/xml/xmllint.vim @@ -43,7 +43,8 @@ function! SyntaxCheckers_xml_xmllint_GetLocList() return SyntasticMake({ \ 'makeprg': makeprg, - \ 'errorformat': errorformat }) + \ 'errorformat': errorformat, + \ 'returns': [0, 1, 2, 3, 4, 5] }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ From d8d9b1a2a15b37cbb03debb4acf6bae26e22ed38 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 12 Jul 2013 08:11:20 +0300 Subject: [PATCH 0110/1271] Cleanup. --- autoload/syntastic/c.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/autoload/syntastic/c.vim b/autoload/syntastic/c.vim index 137b8996a..ac54186f1 100644 --- a/autoload/syntastic/c.vim +++ b/autoload/syntastic/c.vim @@ -63,7 +63,7 @@ endfunction function! syntastic#c#GetLocList(filetype, subchecker, options) try let flags = s:GetCflags(a:filetype, a:subchecker, a:options) - catch /\m\C^syntastic_skip_checks$/ + catch /\m\C^Syntastic: skip checks$/ return [] endtry @@ -125,7 +125,7 @@ function! s:GetCflags(ft, ck, opts) let flags = get(a:opts, 'header_flags', '') . ' -c ' . syntastic#c#NullOutput() else " checking headers when check_header is unset: bail out - throw 'syntastic_skip_checks' + throw 'Syntastic: skip checks' endif else let flags = get(a:opts, 'main_flags', '') From 1acd3ff0fb3ac27cfd7a2ba5babef32bfa7d2c36 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Sun, 14 Jul 2013 19:13:18 +0300 Subject: [PATCH 0111/1271] Pylama: new checker for Python 2. Minor refactoring. --- syntax_checkers/python/flake8.vim | 16 ++------- syntax_checkers/python/pyflakes.vim | 28 ++++++++++------ syntax_checkers/python/pylama.vim | 50 +++++++++++++++++++++++++++++ 3 files changed, 71 insertions(+), 23 deletions(-) create mode 100644 syntax_checkers/python/pylama.vim diff --git a/syntax_checkers/python/flake8.vim b/syntax_checkers/python/flake8.vim index 703ba9a9d..796ba6bdb 100644 --- a/syntax_checkers/python/flake8.vim +++ b/syntax_checkers/python/flake8.vim @@ -15,19 +15,7 @@ function! SyntaxCheckers_python_flake8_IsAvailable() endfunction function! SyntaxCheckers_python_flake8_GetHighlightRegex(i) - if match(a:i['text'], 'is assigned to but never used') > -1 - \ || match(a:i['text'], 'imported but unused') > -1 - \ || match(a:i['text'], 'undefined name') > -1 - \ || match(a:i['text'], 'redefinition of') > -1 - \ || match(a:i['text'], 'referenced before assignment') > -1 - \ || match(a:i['text'], 'duplicate argument') > -1 - \ || match(a:i['text'], 'after other statements') > -1 - \ || match(a:i['text'], 'shadowed by loop variable') > -1 - - let term = split(a:i['text'], "'", 1)[1] - return '\V\<'.term.'\>' - endif - return '' + return SyntaxCheckers_python_pyflakes_GetHighlightRegex(a:i) endfunction function! SyntaxCheckers_python_flake8_GetLocList() @@ -52,3 +40,5 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'python', \ 'name': 'flake8'}) + +runtime! syntax_checkers/python/pyflakes.vim diff --git a/syntax_checkers/python/pyflakes.vim b/syntax_checkers/python/pyflakes.vim index 80351367d..f93047bf7 100644 --- a/syntax_checkers/python/pyflakes.vim +++ b/syntax_checkers/python/pyflakes.vim @@ -17,16 +17,24 @@ endfunction function! SyntaxCheckers_python_pyflakes_GetHighlightRegex(i) if match(a:i['text'], 'is assigned to but never used') > -1 - \ || match(a:i['text'], 'imported but unused') > -1 - \ || match(a:i['text'], 'undefined name') > -1 - \ || match(a:i['text'], 'redefinition of') > -1 - \ || match(a:i['text'], 'referenced before assignment') > -1 - \ || match(a:i['text'], 'duplicate argument') > -1 - \ || match(a:i['text'], 'after other statements') > -1 - \ || match(a:i['text'], 'shadowed by loop variable') > -1 - - let term = split(a:i['text'], "'", 1)[1] - return '\V\<'.term.'\>' + \ || match(a:i['text'], 'imported but unused') > -1 + \ || match(a:i['text'], 'undefined name') > -1 + \ || match(a:i['text'], 'redefinition of') > -1 + \ || match(a:i['text'], 'referenced before assignment') > -1 + \ || match(a:i['text'], 'duplicate argument') > -1 + \ || match(a:i['text'], 'after other statements') > -1 + \ || match(a:i['text'], 'shadowed by loop variable') > -1 + + " fun with Python's %r: try "..." first, then '...' + let terms = split(a:i['text'], '"', 1) + if len(terms) > 2 + return terms[1] + endif + + let terms = split(a:i['text'], "'", 1) + if len(terms) > 2 + return terms[1] + endif endif return '' endfunction diff --git a/syntax_checkers/python/pylama.vim b/syntax_checkers/python/pylama.vim new file mode 100644 index 000000000..eef14ba30 --- /dev/null +++ b/syntax_checkers/python/pylama.vim @@ -0,0 +1,50 @@ +"============================================================================ +"File: pylama.vim +"Description: Syntax checking plugin for syntastic.vim +"Maintainer: LCD 47 +"License: This program is free software. It comes without any warranty, +" to the extent permitted by applicable law. You can redistribute +" it and/or modify it under the terms of the Do What The Fuck You +" Want To Public License, Version 2, as published by Sam Hocevar. +" See http://sam.zoy.org/wtfpl/COPYING for more details. +" +"============================================================================ +if exists("g:loaded_syntastic_python_pylama_checker") + finish +endif +let g:loaded_syntastic_python_pylama_checker=1 + +function! SyntaxCheckers_python_pylama_IsAvailable() + return executable('pylama') +endfunction + +function! SyntaxCheckers_python_pylama_GetHighlightRegex(i) + return SyntaxCheckers_python_pyflakes_GetHighlightRegex(a:i) +endfunction + +function! SyntaxCheckers_python_pylama_GetLocList() + let makeprg = syntastic#makeprg#build({ + \ 'exe': 'pylama', + \ 'post_args': ' -f pep8', + \ 'filetype': 'python', + \ 'subchecker': 'pylama' }) + + let errorformat = '%A%f:%l:%c: %m' + + let loclist=SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'postprocess': ['sort'] }) + + for n in range(len(loclist)) + let loclist[n]['type'] = match(['R', 'C', 'W'], loclist[n]['text'][0]) >= 0 ? 'W' : 'E' + endfor + + return loclist +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'python', + \ 'name': 'pylama' }) + +runtime! syntax_checkers/python/pyflakes.vim From cdac0029dc5a1fd87ffa5fdd698cf477355e94f3 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Mon, 15 Jul 2013 11:24:41 +0300 Subject: [PATCH 0112/1271] Pylama: pep8, pep257, and mccabe are style checkers. --- syntax_checkers/python/pylama.vim | 3 +++ 1 file changed, 3 insertions(+) diff --git a/syntax_checkers/python/pylama.vim b/syntax_checkers/python/pylama.vim index eef14ba30..4d7d02ad2 100644 --- a/syntax_checkers/python/pylama.vim +++ b/syntax_checkers/python/pylama.vim @@ -38,6 +38,9 @@ function! SyntaxCheckers_python_pylama_GetLocList() for n in range(len(loclist)) let loclist[n]['type'] = match(['R', 'C', 'W'], loclist[n]['text'][0]) >= 0 ? 'W' : 'E' + if loclist[n]['text'] =~# '\v\[%(pep8|pep257|mccabe)\]$' + let loclist[n]['subtype'] = 'Style' + endif endfor return loclist From e512ebff0758ac25201b4f798a2f0298166db357 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Mon, 15 Jul 2013 18:37:37 +0300 Subject: [PATCH 0113/1271] Bug fix: g:syntastic_auto_jump should jump on checks, not on writes. --- plugin/syntastic.vim | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index d6fa8ddc1..b603149aa 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -129,7 +129,8 @@ function! s:UpdateErrors(auto_invoked, ...) return endif - if !a:auto_invoked || s:modemap.allowsAutoChecking(&filetype) + let run_checks = !a:auto_invoked || s:modemap.allowsAutoChecking(&filetype) + if run_checks if a:0 >= 1 call s:CacheErrors(a:1) else @@ -141,7 +142,7 @@ function! s:UpdateErrors(auto_invoked, ...) if g:syntastic_always_populate_loc_list || g:syntastic_auto_jump call setloclist(0, loclist.filteredRaw()) - if g:syntastic_auto_jump && loclist.hasErrorsOrWarningsToDisplay() + if run_checks && g:syntastic_auto_jump && loclist.hasErrorsOrWarningsToDisplay() silent! lrewind endif endif From 50c8ee82b6c0db150627bbe49bc814182405dd5d Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Tue, 16 Jul 2013 22:30:28 +0300 Subject: [PATCH 0114/1271] Typos in the puppetlint checker. --- syntax_checkers/puppet/puppetlint.vim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/syntax_checkers/puppet/puppetlint.vim b/syntax_checkers/puppet/puppetlint.vim index eb0f552d4..c65e601bf 100644 --- a/syntax_checkers/puppet/puppetlint.vim +++ b/syntax_checkers/puppet/puppetlint.vim @@ -15,9 +15,9 @@ if exists("g:loaded_syntastic_puppet_puppetlint_checker") endif let g:loaded_syntastic_puppet_puppetlint_checker=1 -if exists("g:systastic_puppet_lint_arguments") - let g:systastic_puppet_puppetlint_args = g:systastic_puppet_lint_arguments - call syntastic#util#deprecationWarn("variable g:systastic_puppet_lint_arguments is deprecated, please use g:systastic_puppet_puppetlint_args instead") +if exists("g:syntastic_puppet_lint_arguments") + let g:syntastic_puppet_puppetlint_args = g:syntastic_puppet_lint_arguments + call syntastic#util#deprecationWarn("variable g:syntastic_puppet_lint_arguments is deprecated, please use g:syntastic_puppet_puppetlint_args instead") endif function! SyntaxCheckers_puppet_puppetlint_IsAvailable() From 30fd6ba0401bdf87168d914b23152f2454f5c04d Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Wed, 17 Jul 2013 14:55:38 +0300 Subject: [PATCH 0115/1271] Rst2pseudoxml: minor adjustment of error levels. --- syntax_checkers/rst/rst2pseudoxml.vim | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/syntax_checkers/rst/rst2pseudoxml.vim b/syntax_checkers/rst/rst2pseudoxml.vim index dcdcf062e..454b4d859 100644 --- a/syntax_checkers/rst/rst2pseudoxml.vim +++ b/syntax_checkers/rst/rst2pseudoxml.vim @@ -31,15 +31,26 @@ function! SyntaxCheckers_rst_rst2pseudoxml_GetLocList() \ 'subchecker': 'rst2pseudoxml' }) let errorformat = - \ '%f:%l:\ (%tNFO/1)\ %m,'. - \ '%f:%l:\ (%tARNING/2)\ %m,'. - \ '%f:%l:\ (%tRROR/3)\ %m,'. - \ '%f:%l:\ (%tEVERE/4)\ %m,'. + \ '%f:%l: (%tNFO/1) %m,'. + \ '%f:%l: (%tARNING/2) %m,'. + \ '%f:%l: (%tRROR/3) %m,'. + \ '%f:%l: (%tEVERE/4) %m,'. \ '%-G%.%#' - return SyntasticMake({ + let loclist = SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat }) + + for n in range(len(loclist)) + if loclist[n]['type'] ==? 'S' + let loclist[n]['type'] = 'E' + elseif loclist[n]['type'] ==? 'I' + let loclist[n]['type'] = 'W' + let loclist[n]['subtype'] = 'Style' + endif + endfor + + return loclist endfunction function s:exe() From 7d0e3736267e10f07f4f50bc79d88928471b7f89 Mon Sep 17 00:00:00 2001 From: kongo2002 Date: Fri, 19 Jul 2013 01:01:33 +0200 Subject: [PATCH 0116/1271] scala: add fsc syntax checker --- syntax_checkers/scala/fsc.vim | 44 +++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 syntax_checkers/scala/fsc.vim diff --git a/syntax_checkers/scala/fsc.vim b/syntax_checkers/scala/fsc.vim new file mode 100644 index 000000000..3a2cd3260 --- /dev/null +++ b/syntax_checkers/scala/fsc.vim @@ -0,0 +1,44 @@ +"============================================================================ +"File: fsc.vim +"Description: Syntax checking plugin for syntastic.vim +"Maintainer: Gregor Uhlenheuer +"License: This program is free software. It comes without any warranty, +" to the extent permitted by applicable law. You can redistribute +" it and/or modify it under the terms of the Do What The Fuck You +" Want To Public License, Version 2, as published by Sam Hocevar. +" See http://sam.zoy.org/wtfpl/COPYING for more details. +" +"============================================================================ + +if exists('g:loaded_syntastic_scala_fsc_checker') + finish +endif +let g:loaded_syntastic_scala_fsc_checker = 1 + +function! SyntaxCheckers_scala_fsc_IsAvailable() + return executable('fsc') +endfunction + +if !exists('g:syntastic_scala_options') + let g:syntastic_scala_options = '' +endif + +function! SyntaxCheckers_scala_fsc_GetLocList() + " fsc has some serious problems with the + " working directory changing after being started + " that's why we better pass an absolute path + let file = expand('%:p') + + let args = '-Ystop-after:parser ' . g:syntastic_scala_options + let makeprg = 'fsc ' . args . ' ' . file + + let errorformat = '%f\:%l: %trror: %m' + + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat }) +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'scala', + \ 'name': 'fsc'}) From a0c2c8fe1e620dae752b7ae6233944bf1f25c048 Mon Sep 17 00:00:00 2001 From: kongo2002 Date: Fri, 19 Jul 2013 01:05:19 +0200 Subject: [PATCH 0117/1271] scala fsc: use util#shexpand() instead --- syntax_checkers/scala/fsc.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntax_checkers/scala/fsc.vim b/syntax_checkers/scala/fsc.vim index 3a2cd3260..02834aa5e 100644 --- a/syntax_checkers/scala/fsc.vim +++ b/syntax_checkers/scala/fsc.vim @@ -27,7 +27,7 @@ function! SyntaxCheckers_scala_fsc_GetLocList() " fsc has some serious problems with the " working directory changing after being started " that's why we better pass an absolute path - let file = expand('%:p') + let file = syntastic#util#shexpand('%:p') let args = '-Ystop-after:parser ' . g:syntastic_scala_options let makeprg = 'fsc ' . args . ' ' . file From bcd0db8d1877827b3992d33dd856c1064437cf4b Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Sat, 20 Jul 2013 09:45:40 +0300 Subject: [PATCH 0118/1271] Scala checkers: minor cleanup. --- syntax_checkers/scala/fsc.vim | 14 ++++++++------ syntax_checkers/scala/scalac.vim | 8 ++++---- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/syntax_checkers/scala/fsc.vim b/syntax_checkers/scala/fsc.vim index 02834aa5e..d0e95a7db 100644 --- a/syntax_checkers/scala/fsc.vim +++ b/syntax_checkers/scala/fsc.vim @@ -27,12 +27,14 @@ function! SyntaxCheckers_scala_fsc_GetLocList() " fsc has some serious problems with the " working directory changing after being started " that's why we better pass an absolute path - let file = syntastic#util#shexpand('%:p') - - let args = '-Ystop-after:parser ' . g:syntastic_scala_options - let makeprg = 'fsc ' . args . ' ' . file - - let errorformat = '%f\:%l: %trror: %m' + let makeprg = syntastic#makeprg#build({ + \ 'exe': 'fsc', + \ 'args': '-Ystop-after:parser ' . g:syntastic_scala_options, + \ 'fname': syntastic#util#shexpand('%:p'), + \ 'filetype': 'scala', + \ 'subchecker': 'fsc' }) + + let errorformat = '%f:%l: %trror: %m' return SyntasticMake({ \ 'makeprg': makeprg, diff --git a/syntax_checkers/scala/scalac.vim b/syntax_checkers/scala/scalac.vim index 9bd288ece..d6319c163 100644 --- a/syntax_checkers/scala/scalac.vim +++ b/syntax_checkers/scala/scalac.vim @@ -19,19 +19,19 @@ function! SyntaxCheckers_scala_scalac_IsAvailable() return executable("scalac") endfunction -if !exists("g:syntastic_scala_options") - let g:syntastic_scala_options = " " +if !exists('g:syntastic_scala_options') + let g:syntastic_scala_options = '' endif function! SyntaxCheckers_scala_scalac_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'scalac', - \ 'args': '-Ystop-after:parser '. g:syntastic_scala_options, + \ 'args': '-Ystop-after:parser ' . g:syntastic_scala_options, \ 'filetype': 'scala', \ 'subchecker': 'scalac' }) - let errorformat = '%f\:%l: %trror: %m' + let errorformat = '%f:%l: %trror: %m' return SyntasticMake({ \ 'makeprg': makeprg, From 5677b7419968c0913611c42d23b722dc4fc4e172 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Wed, 24 Jul 2013 23:01:57 +0300 Subject: [PATCH 0119/1271] More eRuby fun with encodings. Ruby 1.8 doesn't support encodings when opening files. --- syntax_checkers/eruby/ruby.vim | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/syntax_checkers/eruby/ruby.vim b/syntax_checkers/eruby/ruby.vim index 6032bc220..3a772351a 100644 --- a/syntax_checkers/eruby/ruby.vim +++ b/syntax_checkers/eruby/ruby.vim @@ -1,5 +1,5 @@ "============================================================================ -"File: eruby.vim +"File: ruby.vim "Description: Syntax checking plugin for syntastic.vim "Maintainer: Martin Grenfell "License: This program is free software. It comes without any warranty, @@ -31,15 +31,20 @@ function! SyntaxCheckers_eruby_ruby_GetLocList() let fname = "'" . escape(expand('%'), "\\'") . "'" - let enc = &fileencoding != '' ? &fileencoding : &encoding - let encoding_string = enc ==? 'utf-8' ? 'UTF-8' : 'BINARY' + " TODO: encodings became useful in ruby 1.9 :) + if syntastic#util#versionIsAtLeast(syntastic#util#parseVersion('ruby --version'), [1, 9]) + let enc = &fileencoding != '' ? &fileencoding : &encoding + let encoding_spec = ', :encoding => "' . (enc ==? 'utf-8' ? 'UTF-8' : 'BINARY') . '"' + else + let encoding_spec = '' + endif "gsub fixes issue #7, rails has it's own eruby syntax let makeprg = \ exe . ' -rerb -e ' . - \ syntastic#util#shescape('puts ERB.new(File.read(' . fname . - \ ', :encoding => "' . encoding_string . - \ '").gsub(''<\%='',''<\%''), nil, ''-'').src') . + \ syntastic#util#shescape('puts ERB.new(File.read(' . + \ fname . encoding_spec . + \ ').gsub(''<\%='',''<\%''), nil, ''-'').src') . \ ' \| ' . exe . ' -c' let errorformat = From 81f7b382bc765e1f5e9df3557785bc1f3bb56354 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Sun, 28 Jul 2013 21:59:23 +0300 Subject: [PATCH 0120/1271] Add more knobs to the html/tidy checker. --- syntax_checkers/html/tidy.vim | 68 ++++++++++++++++++++++++++++++++--- 1 file changed, 63 insertions(+), 5 deletions(-) diff --git a/syntax_checkers/html/tidy.vim b/syntax_checkers/html/tidy.vim index b7d508f82..27a976134 100644 --- a/syntax_checkers/html/tidy.vim +++ b/syntax_checkers/html/tidy.vim @@ -14,6 +14,12 @@ " " - g:syntastic_html_tidy_ignore_errors (list; default: []) " list of errors to ignore +" - g:syntastic_html_tidy_blocklevel_tags (list; default: []) +" list of additional blocklevel tags, to be added to "--new-blocklevel-tags" +" - g:syntastic_html_tidy_inline_tags (list; default: []) +" list of additional inline tags, to be added to "--new-inline-tags" +" - g:syntastic_html_tidy_empty_tags (list; default: []) +" list of additional empty tags, to be added to "--new-empty-tags" if exists("g:loaded_syntastic_html_tidy_checker") finish @@ -24,6 +30,18 @@ if !exists('g:syntastic_html_tidy_ignore_errors') let g:syntastic_html_tidy_ignore_errors = [] endif +if !exists('g:syntastic_html_tidy_blocklevel_tags') + let g:syntastic_html_tidy_blocklevel_tags = [] +endif + +if !exists('g:syntastic_html_tidy_inline_tags') + let g:syntastic_html_tidy_inline_tags = [] +endif + +if !exists('g:syntastic_html_tidy_empty_tags') + let g:syntastic_html_tidy_empty_tags = [] +endif + function! SyntaxCheckers_html_tidy_IsAvailable() return executable('tidy') endfunction @@ -47,7 +65,7 @@ function! s:TidyEncOptByFenc() return get(tidy_opts, &fileencoding, '-utf8') endfunction -let s:ignore_html_errors = [ +let s:ignore_errors = [ \ " lacks \"summary\" attribute", \ "not approved by W3C", \ "attribute \"placeholder\"", @@ -63,8 +81,44 @@ let s:ignore_html_errors = [ \ " attribute \"type\" has invalid value \"search\"" \ ] +let s:blocklevel_tags = [ + \ "main", + \ "section", + \ "article", + \ "aside", + \ "hgroup", + \ "header", + \ "footer", + \ "nav", + \ "figure", + \ "figcaption" + \ ] + +let s:inline_tags = [ + \ "video", + \ "audio", + \ "source", + \ "embed", + \ "mark", + \ "progress", + \ "meter", + \ "time", + \ "ruby", + \ "rt", + \ "rp", + \ "canvas", + \ "command", + \ "details", + \ "datalist" + \ ] + +let s:empty_tags = [ + \ "wbr", + \ "keygen" + \ ] + function! s:IgnoreError(text) - for i in s:ignore_html_errors + g:syntastic_html_tidy_ignore_errors + for i in s:ignore_errors + g:syntastic_html_tidy_ignore_errors if stridx(a:text, i) != -1 return 1 endif @@ -72,11 +126,15 @@ function! s:IgnoreError(text) return 0 endfunction +function! s:NewTags(name) + return syntastic#util#shescape(join( s:{a:name} + g:syntastic_html_tidy_{a:name}, ',' )) +endfunction + function s:Args() let args = s:TidyEncOptByFenc() . - \ ' --new-blocklevel-tags ' . syntastic#util#shescape('main, section, article, aside, hgroup, header, footer, nav, figure, figcaption') . - \ ' --new-inline-tags ' . syntastic#util#shescape('video, audio, source, embed, mark, progress, meter, time, ruby, rt, rp, canvas, command, details, datalist') . - \ ' --new-empty-tags ' . syntastic#util#shescape('wbr, keygen') . + \ ' --new-blocklevel-tags ' . s:NewTags('blocklevel_tags') . + \ ' --new-inline-tags ' . s:NewTags('inline_tags') . + \ ' --new-empty-tags ' . s:NewTags('empty_tags') . \ ' -e' return args endfunction From 0e9a837d70ee29cf4f7ec7ebb2c040272be3055a Mon Sep 17 00:00:00 2001 From: Nicolas Wu Date: Mon, 29 Jul 2013 12:52:22 +0100 Subject: [PATCH 0121/1271] Add hlint support --- syntax_checkers/haskell/hlint.vim | 40 +++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 syntax_checkers/haskell/hlint.vim diff --git a/syntax_checkers/haskell/hlint.vim b/syntax_checkers/haskell/hlint.vim new file mode 100644 index 000000000..b2e3b2bc4 --- /dev/null +++ b/syntax_checkers/haskell/hlint.vim @@ -0,0 +1,40 @@ +"============================================================================ +"File: hlint.vim +"Description: Syntax checking plugin for syntastic.vim +"Maintainer: Nicolas Wu +"License: BSD +"============================================================================ + +if exists("g:loaded_syntastic_haskell_hlint_checker") + finish +endif +let g:loaded_syntastic_haskell_hlint_checker=1 + +function! SyntaxCheckers_haskell_hlint_IsAvailable() + return executable('hlint') +endfunction + +function! SyntaxCheckers_haskell_hlint_GetLocList() + let errorformat = + \ '%E%f:%l:%c: %trror: %m,' . + \ '%W%f:%l:%c: %tarning: %m,' . + \ '%+CFound:,' . + \ '%+CWhy not:,' . + \ '%+C\ \ %m,' . + \ '%Z%m' + + let makeprg = syntastic#makeprg#build({ + \ 'exe': 'hlint', + \ 'filetype': 'haskell', + \ 'subchecker': 'hlint' }) + + let loclist = SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat }) + + return loclist +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'haskell', + \ 'name': 'hlint'}) From 0e36da7e28dc67f87ba98db4f125b32f63a8b42b Mon Sep 17 00:00:00 2001 From: Nicolas Wu Date: Mon, 29 Jul 2013 12:55:38 +0100 Subject: [PATCH 0122/1271] ghc-mod only does check phase --- syntax_checkers/haskell/ghc-mod.vim | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/syntax_checkers/haskell/ghc-mod.vim b/syntax_checkers/haskell/ghc-mod.vim index 9340c381e..c1828312c 100644 --- a/syntax_checkers/haskell/ghc-mod.vim +++ b/syntax_checkers/haskell/ghc-mod.vim @@ -35,20 +35,12 @@ function! SyntaxCheckers_haskell_ghc_mod_GetLocList() \ 'args': '--hlintOpt="--language=XmlSyntax"', \ 'filetype': 'haskell', \ 'subchecker': 'ghc_mod' }) - let loclist1 = SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat }) - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'ghc-mod lint', - \ 'args': '--hlintOpt="--language=XmlSyntax"', - \ 'filetype': 'haskell', - \ 'subchecker': 'ghc_mod' }) - let loclist2 = SyntasticMake({ + let loclist = SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat }) - return loclist1 + loclist2 + return loclist endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ From 94c4681238d3437ecf4fe1c1ec685a2ca85c9d47 Mon Sep 17 00:00:00 2001 From: Nicolas Wu Date: Mon, 29 Jul 2013 13:02:29 +0100 Subject: [PATCH 0123/1271] Remove hlint option from ghc-mod --- syntax_checkers/haskell/ghc-mod.vim | 1 - 1 file changed, 1 deletion(-) diff --git a/syntax_checkers/haskell/ghc-mod.vim b/syntax_checkers/haskell/ghc-mod.vim index c1828312c..f3677dc1d 100644 --- a/syntax_checkers/haskell/ghc-mod.vim +++ b/syntax_checkers/haskell/ghc-mod.vim @@ -32,7 +32,6 @@ function! SyntaxCheckers_haskell_ghc_mod_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'ghc-mod check', - \ 'args': '--hlintOpt="--language=XmlSyntax"', \ 'filetype': 'haskell', \ 'subchecker': 'ghc_mod' }) From 1a15aae1914ad5d3f01d241717aa12a9ae007d6e Mon Sep 17 00:00:00 2001 From: Nicolas Wu Date: Mon, 29 Jul 2013 16:06:09 +0100 Subject: [PATCH 0124/1271] Simplify errorformat --- syntax_checkers/haskell/hlint.vim | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/syntax_checkers/haskell/hlint.vim b/syntax_checkers/haskell/hlint.vim index b2e3b2bc4..ce896991c 100644 --- a/syntax_checkers/haskell/hlint.vim +++ b/syntax_checkers/haskell/hlint.vim @@ -16,12 +16,9 @@ endfunction function! SyntaxCheckers_haskell_hlint_GetLocList() let errorformat = - \ '%E%f:%l:%c: %trror: %m,' . - \ '%W%f:%l:%c: %tarning: %m,' . - \ '%+CFound:,' . - \ '%+CWhy not:,' . - \ '%+C\ \ %m,' . - \ '%Z%m' + \ '%E%f:%l:%c: Error: %m,' . + \ '%W%f:%l:%c: Warning: %m,' . + \ '%C%m' let makeprg = syntastic#makeprg#build({ \ 'exe': 'hlint', From 985f04782cc5b749e86fe276a63cbde8505a8c4a Mon Sep 17 00:00:00 2001 From: Nicolas Wu Date: Mon, 29 Jul 2013 16:14:36 +0100 Subject: [PATCH 0125/1271] Compress whitespace --- syntax_checkers/haskell/hlint.vim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/syntax_checkers/haskell/hlint.vim b/syntax_checkers/haskell/hlint.vim index ce896991c..c748b77c9 100644 --- a/syntax_checkers/haskell/hlint.vim +++ b/syntax_checkers/haskell/hlint.vim @@ -27,7 +27,8 @@ function! SyntaxCheckers_haskell_hlint_GetLocList() let loclist = SyntasticMake({ \ 'makeprg': makeprg, - \ 'errorformat': errorformat }) + \ 'errorformat': errorformat, + \ 'postprocess': ['compressWhitespace'] }) return loclist endfunction From d670c75cd7c82c0174472929f23ea269aaa69be0 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Mon, 29 Jul 2013 18:16:54 +0300 Subject: [PATCH 0126/1271] Add filetype maps for lhaskell and gentoo-metadata. Remove checker for gentoo-metadata, since this is now an alias. --- plugin/syntastic/registry.vim | 8 ++++- syntax_checkers/gentoo_metadata/xmllint.vim | 40 --------------------- 2 files changed, 7 insertions(+), 41 deletions(-) delete mode 100644 syntax_checkers/gentoo_metadata/xmllint.vim diff --git a/plugin/syntastic/registry.vim b/plugin/syntastic/registry.vim index 1fa5b66df..6f61d65f6 100644 --- a/plugin/syntastic/registry.vim +++ b/plugin/syntastic/registry.vim @@ -24,6 +24,11 @@ let s:defaultCheckers = { \ 'tex': ['lacheck'] \ } +let s:defaultFiletypeMap = { + \ 'gentoo-metadata': 'xml', + \ 'lhaskell': 'haskell' + \ } + let g:SyntasticRegistry = {} " TODO: Handling of filetype aliases: all public methods take aliases as @@ -199,7 +204,8 @@ endfunction "resolve filetype aliases, and replace - with _ otherwise we cant name "syntax checker functions legally for filetypes like "gentoo-metadata" function! s:SyntasticRegistryNormaliseFiletype(ftalias) - let ft = get(g:syntastic_filetype_map, a:ftalias, a:ftalias) + let ft = get(s:defaultFiletypeMap, a:ftalias, a:ftalias) + let ft = get(g:syntastic_filetype_map, ft, ft) let ft = substitute(ft, '-', '_', 'g') return ft endfunction diff --git a/syntax_checkers/gentoo_metadata/xmllint.vim b/syntax_checkers/gentoo_metadata/xmllint.vim deleted file mode 100644 index 2e92707fe..000000000 --- a/syntax_checkers/gentoo_metadata/xmllint.vim +++ /dev/null @@ -1,40 +0,0 @@ -"============================================================================ -"File: gentoo-metadata.vim -"Description: Syntax checking plugin for Gentoo's metadata.xml files -"Maintainer: James Rowe -"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. -" -"============================================================================ - -" The DTDs required to validate metadata.xml files are available in -" $PORTDIR/metadata/dtd, and these local files can be used to significantly -" speed up validation. You can create a catalog file with: -" -" xmlcatalog --create --add rewriteURI http://www.gentoo.org/dtd/ \ -" ${PORTDIR:-/usr/portage}/metadata/dtd/ /etc/xml/gentoo -" -" See xmlcatalog(1) and http://www.xmlsoft.org/catalog.html for more -" information. - -if exists("g:loaded_syntastic_gentoo_metadata_xmllint_checker") - finish -endif -let g:loaded_syntastic_gentoo_metadata_xmllint_checker=1 - -function! SyntaxCheckers_gentoo_metadata_xmllint_IsAvailable() - return SyntaxCheckers_xml_xmllint_IsAvailable() -endfunction - -function! SyntaxCheckers_gentoo_metadata_xmllint_GetLocList() - return SyntaxCheckers_xml_xmllint_GetLocList() -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'gentoo_metadata', - \ 'name': 'xmllint'}) - -runtime! syntax_checkers/xml/*.vim From 307e531b71e08a6d06768563c8f125864b541ef9 Mon Sep 17 00:00:00 2001 From: MasterLambaster Date: Mon, 29 Jul 2013 23:38:16 +0300 Subject: [PATCH 0127/1271] Ruby header file detection should work with all ruby versions * Config module generates warning in ruby >= 1.9 that generates error * Ruby >= 1.9 have different header file config name --- autoload/syntastic/c.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autoload/syntastic/c.vim b/autoload/syntastic/c.vim index aac6fc38d..fb8e21986 100644 --- a/autoload/syntastic/c.vim +++ b/autoload/syntastic/c.vim @@ -199,7 +199,7 @@ function! syntastic#c#CheckRuby() if executable('ruby') if !exists('s:ruby_flags') let s:ruby_flags = system('ruby -r rbconfig -e ' - \ . '''puts Config::CONFIG["archdir"]''') + \ . '''puts RbConfig::CONFIG["rubyhdrdir"] || RbConfig::CONFIG["archdir"]''') let s:ruby_flags = substitute(s:ruby_flags, "\n", '', '') let s:ruby_flags = ' -I' . s:ruby_flags endif From 0b6215597abfade274f2390692aa83d8aae8c1c0 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Tue, 30 Jul 2013 23:09:47 +0300 Subject: [PATCH 0128/1271] Add a SyntasticReset command. --- doc/syntastic.txt | 4 ++++ plugin/syntastic.vim | 1 + 2 files changed, 5 insertions(+) diff --git a/doc/syntastic.txt b/doc/syntastic.txt index 0c95ab7c4..4f3645eb0 100644 --- a/doc/syntastic.txt +++ b/doc/syntastic.txt @@ -153,6 +153,10 @@ current filetype is set to passive. See |'syntastic_mode_map'| for more info. Output info about what checkers are available and in use for the current filetype. +:SyntasticReset *:SyntasticReset* + +Resets the list of errors and turns off all error notifiers. + ============================================================================== 4. Global Options *syntastic-global-options* diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index b603149aa..514c6c183 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -78,6 +78,7 @@ command! SyntasticToggleMode call s:ToggleMode() command! -nargs=? -complete=custom,s:CompleteCheckerName SyntasticCheck call s:UpdateErrors(0, ) call s:Redraw() command! Errors call s:ShowLocList() command! SyntasticInfo call s:registry.echoInfoFor(s:CurrentFiletypes()) +command! SyntasticReset call s:ClearCache() | call s:notifiers.refresh(g:SyntasticLoclist.New([])) highlight link SyntasticError SpellBad highlight link SyntasticWarning SpellCap From b40986b892264615bc9ecb7c46b856b012f626e6 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Wed, 31 Jul 2013 16:32:36 +0300 Subject: [PATCH 0129/1271] Shell escaping is safer since commit a1e1108. --- syntax_checkers/eruby/ruby.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntax_checkers/eruby/ruby.vim b/syntax_checkers/eruby/ruby.vim index 3a772351a..ffde73500 100644 --- a/syntax_checkers/eruby/ruby.vim +++ b/syntax_checkers/eruby/ruby.vim @@ -44,7 +44,7 @@ function! SyntaxCheckers_eruby_ruby_GetLocList() \ exe . ' -rerb -e ' . \ syntastic#util#shescape('puts ERB.new(File.read(' . \ fname . encoding_spec . - \ ').gsub(''<\%='',''<\%''), nil, ''-'').src') . + \ ').gsub(''<%='',''<%''), nil, ''-'').src') . \ ' \| ' . exe . ' -c' let errorformat = From 8b3a346a58be0acc18320ada1a328e588fc704ea Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Thu, 1 Aug 2013 13:40:29 +0300 Subject: [PATCH 0130/1271] Replace lmake with equivalent system + lgetexpr. It's now possible to deal with \0 characters in checkers' output. Shell escaping is saner and safer. SyntasticMake() has a new option 'preprocess'. Checkers html/validator and eruby/ruby now use the new preprocess option. Auxilliary script validator_decode.awk is no longer needed. --- autoload/syntastic/util.vim | 2 +- plugin/syntastic.vim | 45 +++++++++++------ syntax_checkers/eruby/ruby.vim | 44 ++++++++-------- syntax_checkers/html/validator.vim | 20 +++++++- syntax_checkers/html/validator_decode.awk | 61 ----------------------- 5 files changed, 69 insertions(+), 103 deletions(-) delete mode 100644 syntax_checkers/html/validator_decode.awk diff --git a/autoload/syntastic/util.vim b/autoload/syntastic/util.vim index b569bc18c..ada2e4f4f 100644 --- a/autoload/syntastic/util.vim +++ b/autoload/syntastic/util.vim @@ -156,7 +156,7 @@ endfunction " A less noisy shellescape() function! syntastic#util#shescape(string) - return a:string =~ '\m^[A-Za-z0-9_/.-]\+$' ? a:string : shellescape(a:string, 1) + return a:string =~ '\m^[A-Za-z0-9_/.-]\+$' ? a:string : shellescape(a:string) endfunction " A less noisy shellescape(expand()) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 514c6c183..7bd942258 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -313,9 +313,18 @@ function! SyntasticStatuslineFlag() endif endfunction -"A wrapper for the :lmake command. Sets up the make environment according to -"the options given, runs make, resets the environment, returns the location -"list +"Sane readfile(): handle Mac files, and remove empty lines +function! s:ReadFile(filename) + let lines = readfile(a:filename) + let out = [] + for line in lines + call extend(out, split(line, "\r")) + endfor + return filter(out, '!empty(v:val)') +endfunction + +"Emulates the :lmake command. Sets up the make environment according to the +"options given, runs make, resets the environment, returns the location list " "a:options can contain the following keys: " 'makeprg' @@ -327,6 +336,7 @@ endfunction "a:options may also contain: " 'defaults' - a dict containing default values for the returned errors " 'subtype' - all errors will be assigned the given subtype +" 'preprocess' - a function to be applied to the error file before parsing errors " 'postprocess' - a list of functions to be applied to the error list " 'cwd' - change directory to the given path before running the checker " 'returns' - a list of valid exit codes for the checker @@ -334,26 +344,21 @@ function! SyntasticMake(options) call syntastic#util#debug('SyntasticMake: called with options: '. string(a:options)) let old_loclist = getloclist(0) - let old_makeprg = &l:makeprg - let old_shellpipe = &shellpipe let old_shell = &shell - let old_errorformat = &l:errorformat + let old_errorformat = &errorformat let old_cwd = getcwd() let old_lc_all = $LC_ALL + let shell_pipe = &shellpipe if s:OSSupportsShellpipeHack() "this is a hack to stop the screen needing to be ':redraw'n when "when :lmake is run. Otherwise the screen flickers annoyingly - let &shellpipe='&>' + let shell_pipe = '&>' let &shell = '/bin/bash' endif - if has_key(a:options, 'makeprg') - let &l:makeprg = a:options['makeprg'] - endif - if has_key(a:options, 'errorformat') - let &l:errorformat = a:options['errorformat'] + let &errorformat = a:options['errorformat'] endif if has_key(a:options, 'cwd') @@ -361,7 +366,17 @@ function! SyntasticMake(options) endif let $LC_ALL = 'C' - silent lmake! + + let err_file=tempname() + call system('(' . a:options['makeprg'] . ') ' . shell_pipe . ' ' . syntastic#util#shescape(err_file)) + let err_lines = s:ReadFile(err_file) + call delete(err_file) + + if has_key(a:options, 'preprocess') + let err_lines = call(a:options['preprocess'], [err_lines]) + endif + lgetexpr err_lines + let $LC_ALL = old_lc_all let errors = getloclist(0) @@ -371,9 +386,7 @@ function! SyntasticMake(options) endif call setloclist(0, old_loclist) - let &l:makeprg = old_makeprg - let &l:errorformat = old_errorformat - let &shellpipe=old_shellpipe + let &errorformat = old_errorformat let &shell=old_shell if s:IsRedrawRequiredAfterMake() diff --git a/syntax_checkers/eruby/ruby.vim b/syntax_checkers/eruby/ruby.vim index ffde73500..05f29eb98 100644 --- a/syntax_checkers/eruby/ruby.vim +++ b/syntax_checkers/eruby/ruby.vim @@ -15,37 +15,34 @@ if exists("g:loaded_syntastic_eruby_ruby_checker") endif let g:loaded_syntastic_eruby_ruby_checker=1 +if !exists("g:syntastic_erb_exec") + let g:syntastic_erb_exec = "erb" +endif + if !exists("g:syntastic_ruby_exec") let g:syntastic_ruby_exec = "ruby" endif function! SyntaxCheckers_eruby_ruby_IsAvailable() - return executable(expand(g:syntastic_ruby_exec)) + return executable(expand(g:syntastic_erb_exec)) && executable(expand(g:syntastic_ruby_exec)) endfunction -function! SyntaxCheckers_eruby_ruby_GetLocList() - let exe = expand(g:syntastic_ruby_exec) - if !has('win32') - let exe = 'RUBYOPT= ' . exe - endif - - let fname = "'" . escape(expand('%'), "\\'") . "'" - - " TODO: encodings became useful in ruby 1.9 :) - if syntastic#util#versionIsAtLeast(syntastic#util#parseVersion('ruby --version'), [1, 9]) - let enc = &fileencoding != '' ? &fileencoding : &encoding - let encoding_spec = ', :encoding => "' . (enc ==? 'utf-8' ? 'UTF-8' : 'BINARY') . '"' - else - let encoding_spec = '' - endif +function! SyntaxCheckers_eruby_ruby_Preprocess(errors) + let out = copy(a:errors) + for n in range(len(out)) + let out[n] = substitute(out[n], '\V<%=', '<%', 'g') + endfor + return out +endfunction - "gsub fixes issue #7, rails has it's own eruby syntax - let makeprg = - \ exe . ' -rerb -e ' . - \ syntastic#util#shescape('puts ERB.new(File.read(' . - \ fname . encoding_spec . - \ ').gsub(''<%='',''<%''), nil, ''-'').src') . - \ ' \| ' . exe . ' -c' +function! SyntaxCheckers_eruby_ruby_GetLocList() + " TODO: do something about the encoding + let makeprg = syntastic#makeprg#build({ + \ 'exe': expand(g:syntastic_erb_exec), + \ 'args': '-x -T -', + \ 'tail': ' | ' . expand(g:syntastic_ruby_exec) . ' -c', + \ 'filetype': 'eruby', + \ 'subchecker': 'ruby' }) let errorformat = \ '%-GSyntax OK,'. @@ -57,6 +54,7 @@ function! SyntaxCheckers_eruby_ruby_GetLocList() return SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, + \ 'preprocess': 'SyntaxCheckers_eruby_ruby_Preprocess', \ 'defaults': { 'bufnr': bufnr(""), 'vcol': 1 } }) endfunction diff --git a/syntax_checkers/html/validator.vim b/syntax_checkers/html/validator.vim index 7e24a17b0..e6abf275f 100644 --- a/syntax_checkers/html/validator.vim +++ b/syntax_checkers/html/validator.vim @@ -51,12 +51,25 @@ function! SyntaxCheckers_html_validator_IsAvailable() return executable('curl') && executable('awk') endfunction +function! SyntaxCheckers_html_validator_Preprocess(errors) + let out = copy(a:errors) + for n in range(len(out)) + let parts = matchlist(out[n], '\v^"([^"]+)"(.+)') + " URL decode, except leave alone any "+" + let parts[1] = substitute(parts[1], '\m%\(\x\x\)', '\=nr2char("0x".submatch(1))', 'g') + let parts[1] = substitute(parts[1], '\\"', '"', 'g') + let parts[1] = substitute(parts[1], '\\\\', '\\', 'g') + let out[n] = '"' . parts[1] . '"' . parts[2] + endfor + return out +endfunction + function! SyntaxCheckers_html_validator_GetLocList() let makeprg = 'curl -s --compressed -F out=gnu -F asciiquotes=yes' . \ (!empty(g:syntastic_html_validator_parser) ? ' -F parser=' . g:syntastic_html_validator_parser : '') . \ (!empty(g:syntastic_html_validator_nsfilter) ? ' -F nsfilter=' . g:syntastic_html_validator_nsfilter : '') . \ ' -F doc=@' . syntastic#util#shexpand('%') . '\;type=text/html\;filename=' . syntastic#util#shexpand('%') . ' ' . - \ g:syntastic_html_validator_api . ' \| ' . s:decoder + \ g:syntastic_html_validator_api let errorformat = \ '%E"%f":%l: %trror: %m,' . \ '%E"%f":%l-%\d%\+: %trror: %m,' . @@ -70,7 +83,10 @@ function! SyntaxCheckers_html_validator_GetLocList() \ '%W"%f":%l-%\d%\+: info %tarning: %m,' . \ '%W"%f":%l%\%.%c: info %tarning: %m,' . \ '%W"%f":%l%\%.%c-%\d%\+%\%.%\d%\+: info %tarning: %m' - return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat, 'defaults': {'bufnr': bufnr("")} }) + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'preprocess': 'SyntaxCheckers_html_validator_Preprocess' }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/syntax_checkers/html/validator_decode.awk b/syntax_checkers/html/validator_decode.awk deleted file mode 100644 index 71db80673..000000000 --- a/syntax_checkers/html/validator_decode.awk +++ /dev/null @@ -1,61 +0,0 @@ -#!/usr/bin/awk -f -#============================================================================ -#File: validator_decode.awk -#Description: Helper script for validator.vim -#Maintainer: LCD 47 -#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. -# -#============================================================================ - -BEGIN { - FS = OFS = "\"" - hextab ["0"] = 0; hextab ["8"] = 8; - hextab ["1"] = 1; hextab ["9"] = 9; - hextab ["2"] = 2; hextab ["A"] = hextab ["a"] = 10 - hextab ["3"] = 3; hextab ["B"] = hextab ["b"] = 11; - hextab ["4"] = 4; hextab ["C"] = hextab ["c"] = 12; - hextab ["5"] = 5; hextab ["D"] = hextab ["d"] = 13; - hextab ["6"] = 6; hextab ["E"] = hextab ["e"] = 14; - hextab ["7"] = 7; hextab ["F"] = hextab ["f"] = 15; -} - -function urldecode (url) { - decoded = "" - i = 1 - len = length (url) - while ( i <= len ) { - c = substr (url, i, 1) - if ( c == "%" ) { - if ( i + 2 <= len ) { - c1 = substr (url, i + 1, 1) - c2 = substr (url, i + 2, 1) - if ( hextab [c1] != "" && hextab [c2] != "" ) { - code = 0 + hextab [c1] * 16 + hextab [c2] + 0 - c = sprintf ("%c", code) - } - else - c = c c1 c2 - i += 2 - } - else if ( i + 1 <= len ) { - c = substr (url, i, 2) - i++ - } - } - else if ( c == "+" ) - c = " " - decoded = decoded c - i++ - } - return decoded -} - -{ - $2 = urldecode($2) - gsub ("\\\\\"", "\"", $2) - print -} From 260940040ff829b413ac3be39edd813cf0ee23e5 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Thu, 1 Aug 2013 13:50:50 +0300 Subject: [PATCH 0131/1271] Validator checker: check curl return status. --- syntax_checkers/html/validator.vim | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/syntax_checkers/html/validator.vim b/syntax_checkers/html/validator.vim index e6abf275f..04666354f 100644 --- a/syntax_checkers/html/validator.vim +++ b/syntax_checkers/html/validator.vim @@ -70,6 +70,7 @@ function! SyntaxCheckers_html_validator_GetLocList() \ (!empty(g:syntastic_html_validator_nsfilter) ? ' -F nsfilter=' . g:syntastic_html_validator_nsfilter : '') . \ ' -F doc=@' . syntastic#util#shexpand('%') . '\;type=text/html\;filename=' . syntastic#util#shexpand('%') . ' ' . \ g:syntastic_html_validator_api + let errorformat = \ '%E"%f":%l: %trror: %m,' . \ '%E"%f":%l-%\d%\+: %trror: %m,' . @@ -83,10 +84,12 @@ function! SyntaxCheckers_html_validator_GetLocList() \ '%W"%f":%l-%\d%\+: info %tarning: %m,' . \ '%W"%f":%l%\%.%c: info %tarning: %m,' . \ '%W"%f":%l%\%.%c-%\d%\+%\%.%\d%\+: info %tarning: %m' + return SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, - \ 'preprocess': 'SyntaxCheckers_html_validator_Preprocess' }) + \ 'preprocess': 'SyntaxCheckers_html_validator_Preprocess', + \ 'returns': [0] }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ From 731a9b9535d3576ba020fe01aa1bbfb90056739e Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Thu, 1 Aug 2013 17:26:51 +0300 Subject: [PATCH 0132/1271] Undo most of the changes to eruby/ruby. The new proprocess option is not useful here. --- syntax_checkers/eruby/ruby.vim | 44 ++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/syntax_checkers/eruby/ruby.vim b/syntax_checkers/eruby/ruby.vim index 05f29eb98..74e77a06f 100644 --- a/syntax_checkers/eruby/ruby.vim +++ b/syntax_checkers/eruby/ruby.vim @@ -15,34 +15,37 @@ if exists("g:loaded_syntastic_eruby_ruby_checker") endif let g:loaded_syntastic_eruby_ruby_checker=1 -if !exists("g:syntastic_erb_exec") - let g:syntastic_erb_exec = "erb" -endif - if !exists("g:syntastic_ruby_exec") let g:syntastic_ruby_exec = "ruby" endif function! SyntaxCheckers_eruby_ruby_IsAvailable() - return executable(expand(g:syntastic_erb_exec)) && executable(expand(g:syntastic_ruby_exec)) -endfunction - -function! SyntaxCheckers_eruby_ruby_Preprocess(errors) - let out = copy(a:errors) - for n in range(len(out)) - let out[n] = substitute(out[n], '\V<%=', '<%', 'g') - endfor - return out + return executable(expand(g:syntastic_ruby_exec)) endfunction function! SyntaxCheckers_eruby_ruby_GetLocList() - " TODO: do something about the encoding - let makeprg = syntastic#makeprg#build({ - \ 'exe': expand(g:syntastic_erb_exec), - \ 'args': '-x -T -', - \ 'tail': ' | ' . expand(g:syntastic_ruby_exec) . ' -c', - \ 'filetype': 'eruby', - \ 'subchecker': 'ruby' }) + let exe = expand(g:syntastic_ruby_exec) + if !has('win32') + let exe = 'RUBYOPT= ' . exe + endif + + let fname = "'" . escape(expand('%'), "\\'") . "'" + + " TODO: encodings became useful in ruby 1.9 :) + if syntastic#util#versionIsAtLeast(syntastic#util#parseVersion('ruby --version'), [1, 9]) + let enc = &fileencoding != '' ? &fileencoding : &encoding + let encoding_spec = ', :encoding => "' . (enc ==? 'utf-8' ? 'UTF-8' : 'BINARY') . '"' + else + let encoding_spec = '' + endif + + "gsub fixes issue #7, rails has it's own eruby syntax + let makeprg = + \ exe . ' -rerb -e ' . + \ syntastic#util#shescape('puts ERB.new(File.read(' . + \ fname . encoding_spec . + \ ').gsub(''<%='',''<%''), nil, ''-'').src') . + \ ' | ' . exe . ' -c' let errorformat = \ '%-GSyntax OK,'. @@ -54,7 +57,6 @@ function! SyntaxCheckers_eruby_ruby_GetLocList() return SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, - \ 'preprocess': 'SyntaxCheckers_eruby_ruby_Preprocess', \ 'defaults': { 'bufnr': bufnr(""), 'vcol': 1 } }) endfunction From 9d4d3db01124ef37aab8cc79b07010572c7bb4d5 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Thu, 1 Aug 2013 18:35:08 +0300 Subject: [PATCH 0133/1271] Fix checkstyle error levels. Closes #709. --- autoload/syntastic/postprocess.vim | 6 +----- autoload/syntastic/util.vim | 11 +++++++++++ syntax_checkers/java/checkstyle.vim | 15 ++++++++++++++- 3 files changed, 26 insertions(+), 6 deletions(-) diff --git a/autoload/syntastic/postprocess.vim b/autoload/syntastic/postprocess.vim index 53e52dfdc..e3ac70e61 100644 --- a/autoload/syntastic/postprocess.vim +++ b/autoload/syntastic/postprocess.vim @@ -58,11 +58,7 @@ function! syntastic#postprocess#decodeXMLEntities(errors) let llist = [] for e in a:errors - let e['text'] = substitute(e['text'], '<', '<', 'g') - let e['text'] = substitute(e['text'], '>', '>', 'g') - let e['text'] = substitute(e['text'], '"', '"', 'g') - let e['text'] = substitute(e['text'], ''', "'", 'g') - let e['text'] = substitute(e['text'], '&', '\&', 'g') + let e['text'] = syntastic#util#decodeXMLEntities(e['text']) call add(llist, e) endfor diff --git a/autoload/syntastic/util.vim b/autoload/syntastic/util.vim index ada2e4f4f..2082820b2 100644 --- a/autoload/syntastic/util.vim +++ b/autoload/syntastic/util.vim @@ -164,6 +164,17 @@ function! syntastic#util#shexpand(string) return syntastic#util#shescape(escape(expand(a:string), '|')) endfunction +" decode XML entities +function! syntastic#util#decodeXMLEntities(string) + let str = a:string + let str = substitute(str, '<', '<', 'g') + let str = substitute(str, '>', '>', 'g') + let str = substitute(str, '"', '"', 'g') + let str = substitute(str, ''', "'", 'g') + let str = substitute(str, '&', '\&', 'g') + return str +endfunction + function! syntastic#util#debug(msg) if g:syntastic_debug echomsg "syntastic: debug: " . a:msg diff --git a/syntax_checkers/java/checkstyle.vim b/syntax_checkers/java/checkstyle.vim index bb136f1d7..da5aa0194 100644 --- a/syntax_checkers/java/checkstyle.vim +++ b/syntax_checkers/java/checkstyle.vim @@ -27,9 +27,21 @@ function! SyntaxCheckers_java_checkstyle_IsAvailable() return executable('java') endfunction +function! SyntaxCheckers_java_checkstyle_Preprocess(errors) + let out = copy(a:errors) + for n in range(len(out)) + let parts = matchlist(out[n], '\(.*.*\)') + if len(parts) >= 4 + let parts[2] = syntastic#util#decodeXMLEntities(parts[2]) + let out[n] = join(parts[1:3], '') + endif + endfor + return out +endfunction + function! SyntaxCheckers_java_checkstyle_GetLocList() - let fname = fnameescape( expand('%:p:h') . '/' . expand('%:t') ) + let fname = syntastic#util#shescape( expand('%:p:h') . '/' . expand('%:t') ) if has('win32unix') let fname = substitute(system('cygpath -m ' . fname), '\%x00', '', 'g') @@ -57,6 +69,7 @@ function! SyntaxCheckers_java_checkstyle_GetLocList() \ 'makeprg': makeprg, \ 'errorformat': errorformat, \ 'subtype': 'Style', + \ 'preprocess': 'SyntaxCheckers_java_checkstyle_Preprocess', \ 'postprocess': ['cygwinRemoveCR', 'decodeXMLEntities'] }) endfunction From 8ed96eb157182ea5809a30ff293d9906745e701a Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 2 Aug 2013 11:06:48 +0300 Subject: [PATCH 0134/1271] Fix shell escaping. --- autoload/syntastic/util.vim | 2 +- plugin/syntastic.vim | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/autoload/syntastic/util.vim b/autoload/syntastic/util.vim index 2082820b2..4511aac8c 100644 --- a/autoload/syntastic/util.vim +++ b/autoload/syntastic/util.vim @@ -161,7 +161,7 @@ endfunction " A less noisy shellescape(expand()) function! syntastic#util#shexpand(string) - return syntastic#util#shescape(escape(expand(a:string), '|')) + return syntastic#util#shescape(expand(a:string)) endfunction " decode XML entities diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 7bd942258..8123877aa 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -368,7 +368,7 @@ function! SyntasticMake(options) let $LC_ALL = 'C' let err_file=tempname() - call system('(' . a:options['makeprg'] . ') ' . shell_pipe . ' ' . syntastic#util#shescape(err_file)) + call system(a:options['makeprg'] . ' ' . shell_pipe . ' ' . syntastic#util#shescape(err_file)) let err_lines = s:ReadFile(err_file) call delete(err_file) From de90281c182d03cc2ac5817526803e7c6a1f72d7 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 2 Aug 2013 13:10:14 +0300 Subject: [PATCH 0135/1271] Fix shellpipe expansion. --- plugin/syntastic.vim | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 8123877aa..ba85075f7 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -367,8 +367,15 @@ function! SyntasticMake(options) let $LC_ALL = 'C' - let err_file=tempname() - call system(a:options['makeprg'] . ' ' . shell_pipe . ' ' . syntastic#util#shescape(err_file)) + let err_file = tempname() + let err_file_escaped = &shellquote . syntastic#util#shescape(err_file) . &shellquote + let redirect = substitute(shell_pipe, '\m%\([%s]\)', '\=(submatch(1) == "%" ? "%%" : err_file_escaped)', 'g') + if redirect == shell_pipe + " no %s in &shellpipe + let redirect .= ' ' . err_file_escaped + endif + + call system(a:options['makeprg'] . ' ' . redirect) let err_lines = s:ReadFile(err_file) call delete(err_file) From dddd233200ef93e5ea41b6a2442020a0e5c72ec7 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 2 Aug 2013 17:00:53 +0300 Subject: [PATCH 0136/1271] Fix shellpipe expansion again. --- plugin/syntastic.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index ba85075f7..b8dc3c646 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -369,7 +369,7 @@ function! SyntasticMake(options) let err_file = tempname() let err_file_escaped = &shellquote . syntastic#util#shescape(err_file) . &shellquote - let redirect = substitute(shell_pipe, '\m%\([%s]\)', '\=(submatch(1) == "%" ? "%%" : err_file_escaped)', 'g') + let redirect = substitute(shell_pipe, '\m%\([%s]\)', '\=(submatch(1) == "%" ? "%" : err_file_escaped)', 'g') if redirect == shell_pipe " no %s in &shellpipe let redirect .= ' ' . err_file_escaped From 8d3d541f043608fe36940dd96ec7ea91cd798251 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Sat, 3 Aug 2013 08:29:22 +0300 Subject: [PATCH 0137/1271] Fix command output redirection. Cleanup. --- plugin/syntastic.vim | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index b8dc3c646..f1244314d 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -217,9 +217,9 @@ function! s:ShowLocList() call loclist.show() endfunction -"the script changes &shellpipe and &shell to stop the screen flicking when +"the script changes &shellredir and &shell to stop the screen flicking when "shelling out to syntax checkers. Not all OSs support the hacks though -function! s:OSSupportsShellpipeHack() +function! s:OSSupportsShellredirHack() return !s:running_windows && executable('/bin/bash') && (s:uname() !~ "FreeBSD") && (s:uname() !~ "OpenBSD") endfunction @@ -345,18 +345,22 @@ function! SyntasticMake(options) let old_loclist = getloclist(0) let old_shell = &shell + let old_shellredir = &shellredir let old_errorformat = &errorformat let old_cwd = getcwd() let old_lc_all = $LC_ALL - let shell_pipe = &shellpipe - if s:OSSupportsShellpipeHack() + let shell_redir = &shellredir + if s:OSSupportsShellredirHack() "this is a hack to stop the screen needing to be ':redraw'n when "when :lmake is run. Otherwise the screen flickers annoyingly - let shell_pipe = '&>' + let shell_redir = '&>' let &shell = '/bin/bash' endif + " disable redirection of stdout & stderr in system() + let shellredir = '' + if has_key(a:options, 'errorformat') let &errorformat = a:options['errorformat'] endif @@ -368,10 +372,10 @@ function! SyntasticMake(options) let $LC_ALL = 'C' let err_file = tempname() - let err_file_escaped = &shellquote . syntastic#util#shescape(err_file) . &shellquote - let redirect = substitute(shell_pipe, '\m%\([%s]\)', '\=(submatch(1) == "%" ? "%" : err_file_escaped)', 'g') - if redirect == shell_pipe - " no %s in &shellpipe + let err_file_escaped = syntastic#util#shescape(err_file) + let redirect = substitute(shell_redir, '\m%\([%s]\)', '\=(submatch(1) == "%" ? "%%" : err_file_escaped)', 'g') + if redirect == shell_redir + " no %s in &shellredir let redirect .= ' ' . err_file_escaped endif @@ -394,6 +398,7 @@ function! SyntasticMake(options) call setloclist(0, old_loclist) let &errorformat = old_errorformat + let &shellredir = old_shellredir let &shell=old_shell if s:IsRedrawRequiredAfterMake() From e30443b3b5638bb72e72cd83cff8b93715752c51 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Sat, 3 Aug 2013 18:50:06 +0300 Subject: [PATCH 0138/1271] Typo. --- plugin/syntastic.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index f1244314d..d8592a2fd 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -359,7 +359,7 @@ function! SyntasticMake(options) endif " disable redirection of stdout & stderr in system() - let shellredir = '' + let &shellredir = '' if has_key(a:options, 'errorformat') let &errorformat = a:options['errorformat'] From 66a8a71828e884cb483b98c2bfd190f45257fbec Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Sat, 3 Aug 2013 19:09:39 +0300 Subject: [PATCH 0139/1271] Give up trying to use readfile(). --- plugin/syntastic.vim | 32 +++----------------------------- 1 file changed, 3 insertions(+), 29 deletions(-) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index d8592a2fd..8bfded30d 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -313,16 +313,6 @@ function! SyntasticStatuslineFlag() endif endfunction -"Sane readfile(): handle Mac files, and remove empty lines -function! s:ReadFile(filename) - let lines = readfile(a:filename) - let out = [] - for line in lines - call extend(out, split(line, "\r")) - endfor - return filter(out, '!empty(v:val)') -endfunction - "Emulates the :lmake command. Sets up the make environment according to the "options given, runs make, resets the environment, returns the location list " @@ -350,17 +340,13 @@ function! SyntasticMake(options) let old_cwd = getcwd() let old_lc_all = $LC_ALL - let shell_redir = &shellredir if s:OSSupportsShellredirHack() "this is a hack to stop the screen needing to be ':redraw'n when "when :lmake is run. Otherwise the screen flickers annoyingly - let shell_redir = '&>' + let &shellredir = '&>' let &shell = '/bin/bash' endif - " disable redirection of stdout & stderr in system() - let &shellredir = '' - if has_key(a:options, 'errorformat') let &errorformat = a:options['errorformat'] endif @@ -370,26 +356,14 @@ function! SyntasticMake(options) endif let $LC_ALL = 'C' - - let err_file = tempname() - let err_file_escaped = syntastic#util#shescape(err_file) - let redirect = substitute(shell_redir, '\m%\([%s]\)', '\=(submatch(1) == "%" ? "%%" : err_file_escaped)', 'g') - if redirect == shell_redir - " no %s in &shellredir - let redirect .= ' ' . err_file_escaped - endif - - call system(a:options['makeprg'] . ' ' . redirect) - let err_lines = s:ReadFile(err_file) - call delete(err_file) + let err_lines = system(a:options['makeprg']) + let $LC_ALL = old_lc_all if has_key(a:options, 'preprocess') let err_lines = call(a:options['preprocess'], [err_lines]) endif lgetexpr err_lines - let $LC_ALL = old_lc_all - let errors = getloclist(0) if has_key(a:options, 'cwd') From d02d8f8441033ce5099959f97b7675bfb7edb2ff Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Mon, 5 Aug 2013 09:25:33 +0300 Subject: [PATCH 0140/1271] Add option "syntastic_aggregate_errors". --- doc/syntastic.txt | 11 ++++++++++- plugin/syntastic.vim | 23 ++++++++++++++++++++--- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/doc/syntastic.txt b/doc/syntastic.txt index 4f3645eb0..24fa57c24 100644 --- a/doc/syntastic.txt +++ b/doc/syntastic.txt @@ -177,6 +177,15 @@ variable to 0. > let g:syntastic_check_on_wq=0 < + *'syntastic_aggregate_errors'* +Default: 0 +When enabled, |:SyntasticCheck| runs all checkers that apply, then aggregates +errors found by all checkers and displays them. When disabled, +|:SyntasticCheck| runs each checker in turn, and stops to display the results +the first time a checker finds any errors. > + let g:syntastic_aggregate_errors=1 +< + *'syntastic_echo_current_error'* Default: 1 If enabled, syntastic will echo the error associated with the current line to @@ -295,7 +304,7 @@ The option should be set to something like: > "mode" can be mapped to one of two values - "active" or "passive". When set to active, syntastic does automatic checking whenever a buffer is saved or initially opened. When set to "passive" syntastic only checks when the user -calls :SyntasticCheck. +calls |:SyntasticCheck|. The exceptions to these rules are defined with "active_filetypes" and "passive_filetypes". In passive mode, automatic checks are still done diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 514c6c183..ec93a9f07 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -44,6 +44,10 @@ if !exists("g:syntastic_check_on_wq") let g:syntastic_check_on_wq = 1 endif +if !exists("g:syntastic_aggregate_errors") + let g:syntastic_aggregate_errors = 0 +endif + if !exists("g:syntastic_loc_list_height") let g:syntastic_loc_list_height = 10 endif @@ -176,6 +180,7 @@ function! s:CacheErrors(...) let checkers = s:registry.getActiveCheckers(ft) endif + let names = [] for checker in checkers let active_checkers += 1 call syntastic#util#debug("CacheErrors: Invoking checker: " . checker.getName()) @@ -184,14 +189,26 @@ function! s:CacheErrors(...) if !loclist.isEmpty() let newLoclist = newLoclist.extend(loclist) - call newLoclist.setName( checker.getName() . ' ('. checker.getFiletype() . ')' ) + call add(names, [checker.getName(), checker.getFiletype()]) - "only get errors from one checker at a time - break + if !(exists('b:syntastic_aggregate_errors') ? b:syntastic_aggregate_errors : g:syntastic_aggregate_errors) + break + endif endif endfor endfor + if !empty(names) + if len(syntastic#util#unique(map(copy(names), 'v:val[1]'))) == 1 + let name = join(map(names, 'v:val[0]'), ', ') + let type = names[0][1] + call newLoclist.setName( name . ' ('. type . ')' ) + else + " checkers from mixed types + call newLoclist.setName(join(map(names, 'v:val[1] . "/" . v:val[0]'), ', ')) + endif + endif + if !active_checkers if a:0 call syntastic#util#warn('checker ' . a:1 . ' is not active for filetype ' . &filetype) From 7dcd56cbe5786d3089f6c161d1def4156321acfb Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Mon, 5 Aug 2013 12:57:14 +0300 Subject: [PATCH 0141/1271] Bug fix: wrong variable scope. --- plugin/syntastic.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index ec93a9f07..117e5f775 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -172,6 +172,7 @@ function! s:CacheErrors(...) if !s:SkipFile() let active_checkers = 0 + let names = [] for ft in s:CurrentFiletypes() if a:0 let checker = s:registry.getChecker(ft, a:1) @@ -180,7 +181,6 @@ function! s:CacheErrors(...) let checkers = s:registry.getActiveCheckers(ft) endif - let names = [] for checker in checkers let active_checkers += 1 call syntastic#util#debug("CacheErrors: Invoking checker: " . checker.getName()) From 42960a6286d900ce2e3051da97ff5b70adff5d6e Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Mon, 5 Aug 2013 12:57:50 +0300 Subject: [PATCH 0142/1271] Bug fix: wrong variable scope. --- plugin/syntastic.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index f2b94db5d..d97c1666a 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -172,6 +172,7 @@ function! s:CacheErrors(...) if !s:SkipFile() let active_checkers = 0 + let names = [] for ft in s:CurrentFiletypes() if a:0 let checker = s:registry.getChecker(ft, a:1) @@ -180,7 +181,6 @@ function! s:CacheErrors(...) let checkers = s:registry.getActiveCheckers(ft) endif - let names = [] for checker in checkers let active_checkers += 1 call syntastic#util#debug("CacheErrors: Invoking checker: " . checker.getName()) From 7d7f58570fa9e8c651a66b003ba6d695e635cd30 Mon Sep 17 00:00:00 2001 From: Steven Foote Date: Mon, 5 Aug 2013 09:21:08 -0700 Subject: [PATCH 0143/1271] Add support for dustjs files Check dustjs files using swiffer (https://github.com/smfoote/Swiffer.js) --- syntax_checkers/dustjs/swiffer.vim | 38 ++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 syntax_checkers/dustjs/swiffer.vim diff --git a/syntax_checkers/dustjs/swiffer.vim b/syntax_checkers/dustjs/swiffer.vim new file mode 100644 index 000000000..d1212fdcc --- /dev/null +++ b/syntax_checkers/dustjs/swiffer.vim @@ -0,0 +1,38 @@ +"============================================================================ +"File: swiffer.vim +"Description: Dust.js syntax checker - using swiffer +"Maintainer: Steven Foote +"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. +"============================================================================ +" +" To enable Dust syntax checking, you must set the filetype of your Dust template files to `dustjs` +" The easiest way to do this is by installing the dustjs syntax highlighter at https://github.com/jimmyhchan/dustjs.vim + +if exists("g:loaded_syntastic_dust_checker") + finish +endif + +let g:loaded_syntastic_dust_checker = 1 + +function! SyntaxCheckers_dustjs_swiffer_IsAvailable() + return executable("swiffer") +endfunction + +function! SyntaxCheckers_dustjs_swiffer_GetLocList() + let makeprg = syntastic#makeprg#build({ + \ 'exe': 'swiffer', + \ 'args': '', + \ 'subchecker': '' }) + let errorformat = '%E%f \- Line %l\, Column %c: %m' + let loclist = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) + + return loclist + endfunction + +call SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'dustjs', + \ 'name': 'swiffer'}) From 66d2cc50ebf80edc166b666d9fde06b3a376523b Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Wed, 7 Aug 2013 12:01:45 +0300 Subject: [PATCH 0144/1271] Catch up with the latest pylint contortions. --- syntax_checkers/python/pylint.vim | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/syntax_checkers/python/pylint.vim b/syntax_checkers/python/pylint.vim index 923664d40..1cf768c09 100644 --- a/syntax_checkers/python/pylint.vim +++ b/syntax_checkers/python/pylint.vim @@ -14,15 +14,17 @@ function! SyntaxCheckers_python_pylint_IsAvailable() endfunction function! SyntaxCheckers_python_pylint_GetLocList() + let pylint_new = s:PylintNew() + let makeprg = syntastic#makeprg#build({ \ 'exe': 'pylint', - \ 'args': ' -f parseable -r n -i y', + \ 'args': (pylint_new ? '--msg-template="{path}:{line}: [{msg_id}] {msg}" -r n' : '-f parseable -r n -i y'), \ 'filetype': 'python', \ 'subchecker': 'pylint' }) let errorformat = - \ '%A%f:%l:%m,' . - \ '%A%f:(%l):%m,' . + \ '%A%f:%l: %m,' . + \ '%A%f:(%l): %m,' . \ '%-Z%p^%.%#,' . \ '%-G%.%#' @@ -32,12 +34,18 @@ function! SyntaxCheckers_python_pylint_GetLocList() \ 'postprocess': ['sort'] }) for n in range(len(loclist)) - let loclist[n]['type'] = match(['R', 'C', 'W'], loclist[n]['text'][2]) >= 0 ? 'W' : 'E' + let loclist[n]['type'] = match(['R', 'C', 'W'], loclist[n]['text'][1]) >= 0 ? 'W' : 'E' + let loclist[n]['vcol'] = 0 endfor return loclist endfunction +function s:PylintNew() + let pylint_version = filter(split(system('pylint --version'), '\m, \|\n'), 'v:val =~# "^pylint"')[0] + return syntastic#util#versionIsAtLeast(syntastic#util#parseVersion(pylint_version), [1]) +endfunction + call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'python', \ 'name': 'pylint' }) From fe1e2aa6e6a2a11b9bb5f9b9ea3693922c71955a Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Wed, 7 Aug 2013 20:41:50 +0300 Subject: [PATCH 0145/1271] Add verilator checker for verilog. --- README.markdown | 4 +-- syntax_checkers/verilog/verilator.vim | 42 +++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 syntax_checkers/verilog/verilator.vim diff --git a/README.markdown b/README.markdown index 7c43d3fc1..3227e5b06 100644 --- a/README.markdown +++ b/README.markdown @@ -32,8 +32,8 @@ Fortran, Gentoo metadata, Go, Haml, Haskell, Haxe, HSS, HTML, Java, JavaScript, JSON, LESS, LISP, LLVM intermediate language, Lua, MATLAB, NASM, Objective-C, Objective-C++, OCaml, Perl, Perl POD, PHP, Puppet, Python, reStructuredText, Ruby, Rust, SASS/SCSS, Scala, Slim, Tcl, TeX, -Twig, TypeScript, Vala, VHDL, xHtml, XML, XSLT, YAML, z80, Zope page -templates, zsh. +Twig, TypeScript, Vala, Verilog, VHDL, xHtml, XML, XSLT, YAML, z80, Zope +page templates, zsh. ## Screenshot diff --git a/syntax_checkers/verilog/verilator.vim b/syntax_checkers/verilog/verilator.vim new file mode 100644 index 000000000..0bad01b3f --- /dev/null +++ b/syntax_checkers/verilog/verilator.vim @@ -0,0 +1,42 @@ +"============================================================================ +"File: verilator.vim +"Description: Syntax checking plugin for syntastic.vim +"Maintainer: Kocha +"============================================================================ + +if exists("g:loaded_syntastic_verilog_verilator_checker") + finish +endif +let g:loaded_syntastic_verilog_verilator_checker = 1 + +if !exists('g:syntastic_verilog_compiler') + let g:syntastic_verilog_compiler = 'verilator' +endif + +let s:save_cpo = &cpo +set cpo&vim + +function! SyntaxCheckers_verilog_verilator_IsAvailable() + return executable(g:syntastic_verilog_compiler) +endfunction + +if !exists('g:syntastic_verilog_compiler_options') + let g:syntastic_verilog_compiler_options = '-Wall' +endif + +function! SyntaxCheckers_verilog_verilator_GetLocList() + return syntastic#c#GetLocList('verilog', 'verilator', { + \ 'errorformat': + \ '%%%trror-%\=%\w%#: %f:%l: %m,' . + \ '%%%tarning-%\=%\w%#: %f:%l: %m', + \ 'main_flags': '--lint-only' }) +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'verilog', + \ 'name': 'verilator'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: From 852303cb9073ca705373bdfba7eda3f3395ca22e Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Thu, 8 Aug 2013 10:30:57 +0300 Subject: [PATCH 0146/1271] Reset only the LC_MESSAGES part of locales. --- plugin/syntastic.vim | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 117e5f775..8ad08c230 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -356,6 +356,7 @@ function! SyntasticMake(options) let old_shell = &shell let old_errorformat = &l:errorformat let old_cwd = getcwd() + let old_lc_messages = $LC_MESSAGES let old_lc_all = $LC_ALL if s:OSSupportsShellpipeHack() @@ -377,9 +378,11 @@ function! SyntasticMake(options) exec 'lcd ' . fnameescape(a:options['cwd']) endif - let $LC_ALL = 'C' + let $LC_MESSAGES = 'C' + let $LC_ALL = '' silent lmake! let $LC_ALL = old_lc_all + let $LC_MESSAGES = old_lc_messages let errors = getloclist(0) From 1f3451f2261dc7dcce1a083275f101e2ef57a6f9 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 9 Aug 2013 15:33:18 +0300 Subject: [PATCH 0147/1271] Add debug logging for syntastic_aggregate_errors. --- plugin/syntastic.vim | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 8ad08c230..2e3bde78a 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -173,6 +173,12 @@ function! s:CacheErrors(...) if !s:SkipFile() let active_checkers = 0 let names = [] + + call syntastic#util#debug("CacheErrors: g:syntastic_aggregate_errors = " . g:syntastic_aggregate_errors) + if exists('b:syntastic_aggregate_errors') + call syntastic#util#debug("CacheErrors: b:syntastic_aggregate_errors = " . b:syntastic_aggregate_errors) + endif + for ft in s:CurrentFiletypes() if a:0 let checker = s:registry.getChecker(ft, a:1) From 9dbbe5e9a919e24dd9eecfeafd786d83d0a391be Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Sun, 11 Aug 2013 10:10:57 +0300 Subject: [PATCH 0148/1271] New checker asciidoc, for (surprise!) asciidoc files. --- README.markdown | 15 ++++----- syntax_checkers/asciidoc/asciidoc.vim | 47 +++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 8 deletions(-) create mode 100644 syntax_checkers/asciidoc/asciidoc.vim diff --git a/README.markdown b/README.markdown index d7492750e..30c96ccb9 100644 --- a/README.markdown +++ b/README.markdown @@ -26,14 +26,13 @@ user is notified and is happy because they didn't have to compile their code or execute their script to find them. At the time of this writing, syntax checking plugins exist for Ada, -AppleScript, Bourne shell, C, C++, C#, CoffeeScript, Coco, Coq, CSS, -Cucumber, CUDA, D, Dart, DocBook, Elixir, Erlang, eRuby, Fortran, -Gentoo metadata, Go, Haml, Haskell, Haxe, HSS, HTML, Java, JavaScript, -JSON, LESS, LISP, LLVM intermediate language, Lua, MATLAB, NASM, -Objective-C, Objective-C++, OCaml, Perl, Perl POD, PHP, Puppet, Python, -reStructuredText, Ruby, Rust, SASS/SCSS, Scala, Slim, Tcl, TeX, -Twig, TypeScript, Vala, VHDL, xHtml, XML, XSLT, YAML, z80, Zope page -templates, zsh. +AppleScript, AsciiDoc, Bourne shell, C, C++, C#, CoffeeScript, Coco, Coq, +CSS, Cucumber, CUDA, D, Dart, DocBook, Elixir, Erlang, eRuby, Fortran, +Gentoo metadata, Go, Haml, Haskell, Haxe, HSS, HTML, Java, JavaScript, JSON, +LESS, LISP, LLVM intermediate language, Lua, MATLAB, NASM, Objective-C, +Objective-C++, OCaml, Perl, Perl POD, PHP, Puppet, Python, reStructuredText, +Ruby, Rust, SASS/SCSS, Scala, Slim, Tcl, TeX, Twig, TypeScript, Vala, VHDL, +xHtml, XML, XSLT, YAML, z80, Zope page templates, zsh. ## Screenshot diff --git a/syntax_checkers/asciidoc/asciidoc.vim b/syntax_checkers/asciidoc/asciidoc.vim new file mode 100644 index 000000000..0f0f955f1 --- /dev/null +++ b/syntax_checkers/asciidoc/asciidoc.vim @@ -0,0 +1,47 @@ +"============================================================================ +"File: asciidoc.vim +"Description: Syntax checking plugin for syntastic.vim +"Maintainer: LCD 47 +"License: This program is free software. It comes without any warranty, +" to the extent permitted by applicable law. You can redistribute +" it and/or modify it under the terms of the Do What The Fuck You +" Want To Public License, Version 2, as published by Sam Hocevar. +" See http://sam.zoy.org/wtfpl/COPYING for more details. +" +"============================================================================ + +if exists("g:loaded_syntastic_asciidoc_asciidoc_checker") + finish +endif +let g:loaded_syntastic_asciidoc_asciidoc_checker = 1 + +function! SyntaxCheckers_asciidoc_asciidoc_IsAvailable() + return executable("asciidoc") +endfunction + +function! SyntaxCheckers_asciidoc_asciidoc_GetLocList() + let makeprg = syntastic#makeprg#build({ + \ 'exe': 'asciidoc', + \ 'args': syntastic#c#GetNullDevice(), + \ 'filetype': 'asciidoc', + \ 'subchecker': 'asciidoc' }) + + let errorformat = + \ '%Easciidoc: %tRROR: %f: line %l: %m,' . + \ '%Easciidoc: %tRROR: %f: %m,' . + \ '%Easciidoc: FAILED: %f: line %l: %m,' . + \ '%Easciidoc: FAILED: %f: %m,' . + \ '%Wasciidoc: %tARNING: %f: line %l: %m,' . + \ '%Wasciidoc: %tARNING: %f: %m,' . + \ '%Wasciidoc: DEPRECATED: %f: line %l: %m,' . + \ '%Wasciidoc: DEPRECATED: %f: %m' + + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'returns': [0, 1] }) +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'asciidoc', + \ 'name': 'asciidoc'}) From bc62c2c400b34c984306ab2e72e026d88793371d Mon Sep 17 00:00:00 2001 From: Asa Ayers Date: Sun, 11 Aug 2013 14:35:23 -0400 Subject: [PATCH 0149/1271] Coffeelint: Added new formats for upcoming v0.5.7 release. fixes #762 --- syntax_checkers/coffee/coffeelint.vim | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/syntax_checkers/coffee/coffeelint.vim b/syntax_checkers/coffee/coffeelint.vim index cae5c40c5..c33afdc91 100644 --- a/syntax_checkers/coffee/coffeelint.vim +++ b/syntax_checkers/coffee/coffeelint.vim @@ -25,7 +25,9 @@ function! SyntaxCheckers_coffee_coffeelint_GetLocList() \ 'filetype': 'coffee', \ 'subchecker': 'coffeelint' }) - let errorformat = '%f\,%l\,%trror\,%m' + let errorformat = '%f\,%l\,\,%trror\,%m,' . + \ '%f\,%l\,%\\d%\\+\,%trror\,%m,' . + \ '%f\,%l\,%trror\,%m' return SyntasticMake({ \ 'makeprg': makeprg, From 32ffad6e5922e647c4f3dbe38dfc13e124068f22 Mon Sep 17 00:00:00 2001 From: Asa Ayers Date: Sun, 11 Aug 2013 15:23:41 -0400 Subject: [PATCH 0150/1271] Coffeelint: Added return code checking. refs #762 --- syntax_checkers/coffee/coffeelint.vim | 1 + 1 file changed, 1 insertion(+) diff --git a/syntax_checkers/coffee/coffeelint.vim b/syntax_checkers/coffee/coffeelint.vim index c33afdc91..8e21b9a96 100644 --- a/syntax_checkers/coffee/coffeelint.vim +++ b/syntax_checkers/coffee/coffeelint.vim @@ -32,6 +32,7 @@ function! SyntaxCheckers_coffee_coffeelint_GetLocList() return SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, + \ 'returns': [0, 1], \ 'subtype': 'Style' }) endfunction From e39d1a0667a25d243ed3a6a279b37016e5363374 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Sun, 11 Aug 2013 22:48:40 +0300 Subject: [PATCH 0151/1271] Add handling for coffeelint warnings. Minor fix for errorformat. --- syntax_checkers/coffee/coffeelint.vim | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/syntax_checkers/coffee/coffeelint.vim b/syntax_checkers/coffee/coffeelint.vim index 8e21b9a96..4b59a8c23 100644 --- a/syntax_checkers/coffee/coffeelint.vim +++ b/syntax_checkers/coffee/coffeelint.vim @@ -25,15 +25,17 @@ function! SyntaxCheckers_coffee_coffeelint_GetLocList() \ 'filetype': 'coffee', \ 'subchecker': 'coffeelint' }) - let errorformat = '%f\,%l\,\,%trror\,%m,' . - \ '%f\,%l\,%\\d%\\+\,%trror\,%m,' . - \ '%f\,%l\,%trror\,%m' + let errorformat = + \ '%f\,%l\,%\d%\+\,%trror\,%m,' . + \ '%f\,%l\,%trror\,%m,' . + \ '%f\,%l\,%\d%\+\,%tarn\,%m,' . + \ '%f\,%l\,%tarn\,%m' return SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, - \ 'returns': [0, 1], - \ 'subtype': 'Style' }) + \ 'subtype': 'Style', + \ 'returns': [0, 1] }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ From fa20955321a50b46066d75bb32cadf7ae86732b5 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Mon, 12 Aug 2013 11:22:12 +0300 Subject: [PATCH 0152/1271] Pylint: ignore informational messages. --- syntax_checkers/python/pylint.vim | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/syntax_checkers/python/pylint.vim b/syntax_checkers/python/pylint.vim index 1cf768c09..477d93728 100644 --- a/syntax_checkers/python/pylint.vim +++ b/syntax_checkers/python/pylint.vim @@ -34,7 +34,14 @@ function! SyntaxCheckers_python_pylint_GetLocList() \ 'postprocess': ['sort'] }) for n in range(len(loclist)) - let loclist[n]['type'] = match(['R', 'C', 'W'], loclist[n]['text'][1]) >= 0 ? 'W' : 'E' + let type = loclist[n]['text'][1] + if type =~# '\m^[EF]' + let loclist[n]['type'] = 'E' + elseif type =~# '\m^[CRW]' + let loclist[n]['type'] = 'W' + else + let loclist[n]['valid'] = 0 + endif let loclist[n]['vcol'] = 0 endfor From cc4f50acfe263c821efd113c47fd3d2a4489c9ae Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Mon, 12 Aug 2013 17:50:36 +0300 Subject: [PATCH 0153/1271] Make csslint executable configurable. --- syntax_checkers/css/csslint.vim | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/syntax_checkers/css/csslint.vim b/syntax_checkers/css/csslint.vim index 6a2659d79..9093d982c 100644 --- a/syntax_checkers/css/csslint.vim +++ b/syntax_checkers/css/csslint.vim @@ -12,24 +12,28 @@ " Specify additional options to csslint with this option. e.g. to disable " warnings: " -" let g:syntastic_csslint_options = "--warnings=none" +" let g:syntastic_csslint_options = '--warnings=none' -if exists("g:loaded_syntastic_css_csslint_checker") +if exists('g:loaded_syntastic_css_csslint_checker') finish endif let g:loaded_syntastic_css_csslint_checker=1 +if !exists('g:syntastic_csslint_exec') + let g:syntastic_csslint_exec = 'csslint' +endif + if !exists('g:syntastic_csslint_options') - let g:syntastic_csslint_options = "" + let g:syntastic_csslint_options = '' endif function! SyntaxCheckers_css_csslint_IsAvailable() - return executable('csslint') + return executable(expand(g:syntastic_csslint_exec)) endfunction function! SyntaxCheckers_css_csslint_GetLocList() let makeprg = syntastic#makeprg#build({ - \ 'exe': 'csslint', + \ 'exe': expand(g:syntastic_csslint_exec), \ 'args': '--format=compact ' . g:syntastic_csslint_options, \ 'filetype': 'css', \ 'subchecker': 'csslint' }) From 41c2c3d68d8e8ce5c9e7b5c6e9133ef24f659773 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Mon, 12 Aug 2013 17:54:57 +0300 Subject: [PATCH 0154/1271] Make jshint executable configurable. --- syntax_checkers/javascript/jshint.vim | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/syntax_checkers/javascript/jshint.vim b/syntax_checkers/javascript/jshint.vim index e98e56289..caef9a7ef 100644 --- a/syntax_checkers/javascript/jshint.vim +++ b/syntax_checkers/javascript/jshint.vim @@ -9,23 +9,27 @@ " See http://sam.zoy.org/wtfpl/COPYING for more details. "============================================================================ -if exists("g:loaded_syntastic_javascript_jshint_checker") +if exists('g:loaded_syntastic_javascript_jshint_checker') finish endif let g:loaded_syntastic_javascript_jshint_checker=1 -if !exists("g:syntastic_javascript_jshint_conf") - let g:syntastic_javascript_jshint_conf = "" +if !exists('g:syntastic_jshint_exec') + let g:syntastic_jshint_exec = 'jshint' +endif + +if !exists('g:syntastic_javascript_jshint_conf') + let g:syntastic_javascript_jshint_conf = '' endif function! SyntaxCheckers_javascript_jshint_IsAvailable() - return executable('jshint') + return executable(expand(g:syntastic_jshint_exec)) endfunction function! SyntaxCheckers_javascript_jshint_GetLocList() let jshint_new = s:JshintNew() let makeprg = syntastic#makeprg#build({ - \ 'exe': 'jshint', + \ 'exe': expand(g:syntastic_jshint_exec), \ 'post_args': (jshint_new ? ' --verbose ' : '') . s:Args(), \ 'filetype': 'javascript', \ 'subchecker': 'jshint' }) @@ -41,7 +45,7 @@ function! SyntaxCheckers_javascript_jshint_GetLocList() endfunction function s:JshintNew() - return syntastic#util#versionIsAtLeast(syntastic#util#parseVersion('jshint --version'), [1, 1]) + return syntastic#util#versionIsAtLeast(syntastic#util#parseVersion(expand(g:syntastic_jshint_exec) . ' --version'), [1, 1]) endfunction function s:Args() From bad5fe67edb97c1a40eedbca24535d40b3ab778c Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Mon, 12 Aug 2013 17:58:25 +0300 Subject: [PATCH 0155/1271] Make expand special characters in g:syntastic_haml_interpreter. --- syntax_checkers/haml/haml.vim | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/syntax_checkers/haml/haml.vim b/syntax_checkers/haml/haml.vim index 77d0a8dc6..8371055fb 100644 --- a/syntax_checkers/haml/haml.vim +++ b/syntax_checkers/haml/haml.vim @@ -10,22 +10,22 @@ " "============================================================================ -if exists("g:loaded_syntastic_haml_haml_checker") +if exists('g:loaded_syntastic_haml_haml_checker') finish endif let g:loaded_syntastic_haml_haml_checker=1 -if !exists("g:syntastic_haml_interpreter") - let g:syntastic_haml_interpreter = "haml" +if !exists('g:syntastic_haml_interpreter') + let g:syntastic_haml_interpreter = 'haml' endif function! SyntaxCheckers_haml_haml_IsAvailable() - return executable(g:syntastic_haml_interpreter) + return executable(expand(g:syntastic_haml_interpreter)) endfunction function! SyntaxCheckers_haml_haml_GetLocList() let makeprg = syntastic#makeprg#build({ - \ 'exe': g:syntastic_haml_interpreter, + \ 'exe': expand(g:syntastic_haml_interpreter), \ 'args': '-c', \ 'filetype': 'haml', \ 'subchecker': 'haml' }) From 2ca6f8c047b7c636f20b40151cd5e9b4019fa9e2 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Mon, 12 Aug 2013 18:00:37 +0300 Subject: [PATCH 0156/1271] Minor bug fix in asciidoc checker. --- syntax_checkers/asciidoc/asciidoc.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntax_checkers/asciidoc/asciidoc.vim b/syntax_checkers/asciidoc/asciidoc.vim index 0f0f955f1..faa907cb4 100644 --- a/syntax_checkers/asciidoc/asciidoc.vim +++ b/syntax_checkers/asciidoc/asciidoc.vim @@ -22,7 +22,7 @@ endfunction function! SyntaxCheckers_asciidoc_asciidoc_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'asciidoc', - \ 'args': syntastic#c#GetNullDevice(), + \ 'args': syntastic#c#NullOutput(), \ 'filetype': 'asciidoc', \ 'subchecker': 'asciidoc' }) From c32e59fc367d305ff390bc49792d9fa053292257 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Mon, 12 Aug 2013 22:46:20 +0300 Subject: [PATCH 0157/1271] Haskell cleanup. Make the "compressWhitespace" filter kill \001 characters. Make the ghc-mod checker use the "compressWhitespace" filter. Minor formatting of the hlint checker. --- syntax_checkers/haskell/ghc-mod.vim | 21 ++++++++++----------- syntax_checkers/haskell/hlint.vim | 18 ++++++++---------- 2 files changed, 18 insertions(+), 21 deletions(-) diff --git a/syntax_checkers/haskell/ghc-mod.vim b/syntax_checkers/haskell/ghc-mod.vim index f3677dc1d..3dcc6e7e4 100644 --- a/syntax_checkers/haskell/ghc-mod.vim +++ b/syntax_checkers/haskell/ghc-mod.vim @@ -10,16 +10,21 @@ " "============================================================================ -if exists("g:loaded_syntastic_haskell_ghc_mod_checker") +if exists('g:loaded_syntastic_haskell_ghc_mod_checker') finish endif -let g:loaded_syntastic_haskell_ghc_mod_checker=1 +let g:loaded_syntastic_haskell_ghc_mod_checker = 1 function! SyntaxCheckers_haskell_ghc_mod_IsAvailable() return executable('ghc-mod') endfunction function! SyntaxCheckers_haskell_ghc_mod_GetLocList() + let makeprg = syntastic#makeprg#build({ + \ 'exe': 'ghc-mod check', + \ 'filetype': 'haskell', + \ 'subchecker': 'ghc_mod' }) + let errorformat = \ '%-G%\s%#,' . \ '%f:%l:%c:%trror: %m,' . @@ -30,16 +35,10 @@ function! SyntaxCheckers_haskell_ghc_mod_GetLocList() \ '%E%f:%l:%c:,' . \ '%Z%m' - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'ghc-mod check', - \ 'filetype': 'haskell', - \ 'subchecker': 'ghc_mod' }) - - let loclist = SyntasticMake({ + return SyntasticMake({ \ 'makeprg': makeprg, - \ 'errorformat': errorformat }) - - return loclist + \ 'errorformat': errorformat, + \ 'postprocess': ['compressWhitespace'] }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/syntax_checkers/haskell/hlint.vim b/syntax_checkers/haskell/hlint.vim index c748b77c9..f9f0fcd48 100644 --- a/syntax_checkers/haskell/hlint.vim +++ b/syntax_checkers/haskell/hlint.vim @@ -5,32 +5,30 @@ "License: BSD "============================================================================ -if exists("g:loaded_syntastic_haskell_hlint_checker") +if exists('g:loaded_syntastic_haskell_hlint_checker') finish endif -let g:loaded_syntastic_haskell_hlint_checker=1 +let g:loaded_syntastic_haskell_hlint_checker = 1 function! SyntaxCheckers_haskell_hlint_IsAvailable() return executable('hlint') endfunction function! SyntaxCheckers_haskell_hlint_GetLocList() - let errorformat = - \ '%E%f:%l:%c: Error: %m,' . - \ '%W%f:%l:%c: Warning: %m,' . - \ '%C%m' - let makeprg = syntastic#makeprg#build({ \ 'exe': 'hlint', \ 'filetype': 'haskell', \ 'subchecker': 'hlint' }) - let loclist = SyntasticMake({ + let errorformat = + \ '%E%f:%l:%c: Error: %m,' . + \ '%W%f:%l:%c: Warning: %m,' . + \ '%C%m' + + return SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, \ 'postprocess': ['compressWhitespace'] }) - - return loclist endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ From 4af22935c3338b54d946ff749ae7c8a6952f71aa Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Tue, 13 Aug 2013 09:01:04 +0300 Subject: [PATCH 0158/1271] Leftover from 7eda5de. How embarrasing. --- autoload/syntastic/postprocess.vim | 1 + 1 file changed, 1 insertion(+) diff --git a/autoload/syntastic/postprocess.vim b/autoload/syntastic/postprocess.vim index e3ac70e61..845b535ee 100644 --- a/autoload/syntastic/postprocess.vim +++ b/autoload/syntastic/postprocess.vim @@ -29,6 +29,7 @@ function syntastic#postprocess#compressWhitespace(errors) let llist = [] for e in a:errors + let e['text'] = substitute(e['text'], "\001", '', 'g') let e['text'] = substitute(e['text'], '\n', ' ', 'g') let e['text'] = substitute(e['text'], '\s\{2,}', ' ', 'g') call add(llist, e) From fac5ed7e145c3f47770e809c0a10d032caaae31d Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Tue, 13 Aug 2013 09:31:43 +0300 Subject: [PATCH 0159/1271] Reuse loclists when possible, to allow :lolder and :lnewer. This is not completely safe: if a loclist is created by something other than syntastic before the error window is displayed, syntastic will obliterate it. There is currently no way to tell if a loclist was created by syntastic or not. Undocumented variable g:syntastic_reuse_loc_lists can be used to disable reuse of loclists. --- plugin/syntastic.vim | 11 +++++++++-- plugin/syntastic/loclist.vim | 7 ++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 9c92e117b..02ca11a60 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -64,6 +64,12 @@ if !exists("g:syntastic_full_redraws") let g:syntastic_full_redraws = !( has('gui_running') || has('gui_macvim')) endif +" TODO: not documented +if !exists("g:syntastic_reuse_loc_lists") + " a relevant bug has been fixed in one of the pre-releases of Vim 7.4 + let g:syntastic_reuse_loc_lists = (v:version >= 704) +endif + let s:registry = g:SyntasticRegistry.Instance() let s:notifiers = g:SyntasticNotifiers.Instance() let s:modemap = g:SyntasticModeMap.Instance() @@ -145,8 +151,10 @@ function! s:UpdateErrors(auto_invoked, ...) let loclist = g:SyntasticLoclist.current() + let w:syntastic_loclist_set = 0 if g:syntastic_always_populate_loc_list || g:syntastic_auto_jump call setloclist(0, loclist.filteredRaw()) + let w:syntastic_loclist_set = 1 if run_checks && g:syntastic_auto_jump && loclist.hasErrorsOrWarningsToDisplay() silent! lrewind endif @@ -356,7 +364,6 @@ endfunction function! SyntasticMake(options) call syntastic#util#debug('SyntasticMake: called with options: '. string(a:options)) - let old_loclist = getloclist(0) let old_shell = &shell let old_shellredir = &shellredir let old_errorformat = &errorformat @@ -396,7 +403,7 @@ function! SyntasticMake(options) exec 'lcd ' . fnameescape(old_cwd) endif - call setloclist(0, old_loclist) + silent! lolder let &errorformat = old_errorformat let &shellredir = old_shellredir let &shell=old_shell diff --git a/plugin/syntastic/loclist.vim b/plugin/syntastic/loclist.vim index d5cd6e394..104470dc9 100644 --- a/plugin/syntastic/loclist.vim +++ b/plugin/syntastic/loclist.vim @@ -143,7 +143,12 @@ endfunction "display the cached errors for this buf in the location list function! g:SyntasticLoclist.show() - call setloclist(0, self.filteredRaw()) + if !exists('w:syntastic_loclist_set') + let w:syntastic_loclist_set = 0 + endif + call setloclist(0, self.filteredRaw(), g:syntastic_reuse_loc_lists && w:syntastic_loclist_set ? 'r' : ' ') + let w:syntastic_loclist_set = 1 + if self.hasErrorsOrWarningsToDisplay() let num = winnr() exec "lopen " . g:syntastic_loc_list_height From a404bbc03185447c8250e7f777402dfaa5d4e482 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Tue, 13 Aug 2013 17:48:37 +0300 Subject: [PATCH 0160/1271] Bug fix: allow loclist cleanup. --- plugin/syntastic.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 02ca11a60..fb788a3bf 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -397,7 +397,7 @@ function! SyntasticMake(options) endif lgetexpr err_lines - let errors = getloclist(0) + let errors = copy(getloclist(0)) if has_key(a:options, 'cwd') exec 'lcd ' . fnameescape(old_cwd) From 8f967625afd1563a4b4105754102d67c447423c6 Mon Sep 17 00:00:00 2001 From: Asa Ayers Date: Tue, 13 Aug 2013 15:52:14 -0400 Subject: [PATCH 0161/1271] Coffeelint: Fixed errorformat, last line is optional --- syntax_checkers/coffee/coffeelint.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/syntax_checkers/coffee/coffeelint.vim b/syntax_checkers/coffee/coffeelint.vim index 4b59a8c23..2099359cc 100644 --- a/syntax_checkers/coffee/coffeelint.vim +++ b/syntax_checkers/coffee/coffeelint.vim @@ -26,9 +26,9 @@ function! SyntaxCheckers_coffee_coffeelint_GetLocList() \ 'subchecker': 'coffeelint' }) let errorformat = - \ '%f\,%l\,%\d%\+\,%trror\,%m,' . + \ '%f\,%l\,%\d%#\,%trror\,%m,' . \ '%f\,%l\,%trror\,%m,' . - \ '%f\,%l\,%\d%\+\,%tarn\,%m,' . + \ '%f\,%l\,%\d%#\,%tarn\,%m,' . \ '%f\,%l\,%tarn\,%m' return SyntasticMake({ From cec592a8ceceedbcc095e86ddb975f84ab22525d Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Thu, 15 Aug 2013 12:23:04 +0300 Subject: [PATCH 0162/1271] Update errorformat for typescript/tsc. --- syntax_checkers/typescript/tsc.vim | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/syntax_checkers/typescript/tsc.vim b/syntax_checkers/typescript/tsc.vim index 784698224..a5587900f 100644 --- a/syntax_checkers/typescript/tsc.vim +++ b/syntax_checkers/typescript/tsc.vim @@ -1,6 +1,6 @@ "============================================================================ "File: typescript.vim -"Description: TypeScript syntax checker. For TypeScript v0.8.0 +"Description: TypeScript syntax checker "Maintainer: Bill Casarin "============================================================================ @@ -21,11 +21,17 @@ function! SyntaxCheckers_typescript_tsc_GetLocList() \ 'filetype': 'typescript', \ 'subchecker': 'tsc' }) - let errorformat = '%f %#(%l\,%c): %m' + let errorformat = + \ '%f %#(%l\,%c): error %m,' . + \ '%f %#(%l\,%c): %m,' . + \ '%Eerror %m,' . + \ '%C %m' return SyntasticMake({ \ 'makeprg': makeprg, - \ 'errorformat': errorformat }) + \ 'errorformat': errorformat, + \ 'defaults': {'bufnr': bufnr("")}, + \ 'postprocess': ['sort'] }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ From 3c516246cfc34cd7583dfae2ce1474a48e2aea76 Mon Sep 17 00:00:00 2001 From: Sebastien Badia Date: Thu, 15 Aug 2013 17:27:17 +0200 Subject: [PATCH 0163/1271] [issue-767] Remove backslash in puppet-lint log format (refs: #767) --- syntax_checkers/puppet/puppetlint.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntax_checkers/puppet/puppetlint.vim b/syntax_checkers/puppet/puppetlint.vim index c65e601bf..14afd8c64 100644 --- a/syntax_checkers/puppet/puppetlint.vim +++ b/syntax_checkers/puppet/puppetlint.vim @@ -31,7 +31,7 @@ endfunction function! SyntaxCheckers_puppet_puppetlint_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'puppet-lint', - \ 'post_args': '--log-format "\%{KIND} [\%{check}] \%{message} at \%{fullpath}:\%{linenumber}"', + \ 'post_args': '--log-format "%{KIND} [%{check}] %{message} at %{fullpath}:%{linenumber}"', \ 'filetype': 'puppet', \ 'subchecker': 'puppetlint' }) From e25b570f67ad43ea3a0a069e47fb6012a66f32a0 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Thu, 15 Aug 2013 20:30:06 +0300 Subject: [PATCH 0164/1271] Minor bug fix: setting checker names in CacheErrors(). --- plugin/syntastic.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index fb788a3bf..3af2204b8 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -214,8 +214,8 @@ function! s:CacheErrors(...) if !empty(names) if len(syntastic#util#unique(map(copy(names), 'v:val[1]'))) == 1 - let name = join(map(names, 'v:val[0]'), ', ') let type = names[0][1] + let name = join(map(names, 'v:val[0]'), ', ') call newLoclist.setName( name . ' ('. type . ')' ) else " checkers from mixed types From ddadc66b8d6b4c6f9bf9e41fb159d2c5a3dad75a Mon Sep 17 00:00:00 2001 From: Marc Bryan Date: Thu, 15 Aug 2013 11:41:49 -0600 Subject: [PATCH 0165/1271] Add pep257 Python syntax_checker --- syntax_checkers/python/pep257.vim | 39 +++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 syntax_checkers/python/pep257.vim diff --git a/syntax_checkers/python/pep257.vim b/syntax_checkers/python/pep257.vim new file mode 100644 index 000000000..52fbc1ea3 --- /dev/null +++ b/syntax_checkers/python/pep257.vim @@ -0,0 +1,39 @@ +"============================================================================ +"File: pep257.vim +"Description: Docstring style checking plugin for syntastic.vim +"============================================================================ +" +" For details about pep257 see: https://github.com/GreenSteam/pep257 + +if exists("g:loaded_syntastic_python_pep257_checker") + finish +endif +let g:loaded_syntastic_python_pep257_checker=1 + +function! SyntaxCheckers_python_pep257_IsAvailable() + return executable('pep257') +endfunction + +function! SyntaxCheckers_python_pep257_GetLocList() + let makeprg = syntastic#makeprg#build({ + \ 'exe': 'pep257', + \ 'filetype': 'python', + \ 'subchecker': 'pep257' }) + + let errorformat = '%f:%l:%c: %m' + + let loclist = SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'subtype': 'Style' }) + + for n in range(len(loclist)) + let loclist[n]['type'] = loclist[n]['text'] =~? '^W' ? 'W' : 'E' + endfor + + return loclist +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'python', + \ 'name': 'pep257'}) From aabfb2ab43320f68ae7372c80434670731ebeff2 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Thu, 15 Aug 2013 21:24:57 +0300 Subject: [PATCH 0166/1271] Fix setting title of the error window. Sadly this is slow. --- plugin/syntastic/loclist.vim | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/plugin/syntastic/loclist.vim b/plugin/syntastic/loclist.vim index 104470dc9..f1f34eb6c 100644 --- a/plugin/syntastic/loclist.vim +++ b/plugin/syntastic/loclist.vim @@ -157,11 +157,17 @@ function! g:SyntasticLoclist.show() endif " try to find the loclist window and set w:quickfix_title + let errors = getloclist(0) for buf in tabpagebuflist() if buflisted(buf) && bufloaded(buf) && getbufvar(buf, '&buftype') ==# 'quickfix' let win = bufwinnr(buf) let title = getwinvar(win, 'quickfix_title') - if title ==# ':setloclist()' || strpart(title, 0, 16) ==# ':SyntasticCheck ' + + " TODO: try to make sure we actually own this window; sadly, + " errors == getloclist(0) is the only somewhat safe way to + " achieve that + if strpart(title, 0, 16) ==# ':SyntasticCheck ' || + \ ( (title == '' || title ==# ':setloclist()') && errors == getloclist(0) ) call setwinvar(win, 'quickfix_title', ':SyntasticCheck ' . self._name) endif endif From 40a13557efc6c643a88af9564f51b035b3785db0 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Thu, 15 Aug 2013 21:41:50 +0300 Subject: [PATCH 0167/1271] More fiddling with typescript/tsc errorformat and args. --- syntax_checkers/typescript/tsc.vim | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/syntax_checkers/typescript/tsc.vim b/syntax_checkers/typescript/tsc.vim index a5587900f..c91833beb 100644 --- a/syntax_checkers/typescript/tsc.vim +++ b/syntax_checkers/typescript/tsc.vim @@ -17,13 +17,14 @@ endfunction function! SyntaxCheckers_typescript_tsc_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'tsc', + \ 'args': '--module commonjs', \ 'post_args': '--out ' . syntastic#util#DevNull(), \ 'filetype': 'typescript', \ 'subchecker': 'tsc' }) let errorformat = - \ '%f %#(%l\,%c): error %m,' . - \ '%f %#(%l\,%c): %m,' . + \ '%E%f %#(%l\,%c): error %m,' . + \ '%E%f %#(%l\,%c): %m,' . \ '%Eerror %m,' . \ '%C %m' From 6bc336f72471da04fec388cb339db0e9027da005 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Thu, 15 Aug 2013 23:00:48 +0300 Subject: [PATCH 0168/1271] Yet more typescript/tsc errorformat contortions. --- syntax_checkers/typescript/tsc.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntax_checkers/typescript/tsc.vim b/syntax_checkers/typescript/tsc.vim index c91833beb..768dc4e0c 100644 --- a/syntax_checkers/typescript/tsc.vim +++ b/syntax_checkers/typescript/tsc.vim @@ -26,7 +26,7 @@ function! SyntaxCheckers_typescript_tsc_GetLocList() \ '%E%f %#(%l\,%c): error %m,' . \ '%E%f %#(%l\,%c): %m,' . \ '%Eerror %m,' . - \ '%C %m' + \ '%C%\s%\+%m' return SyntasticMake({ \ 'makeprg': makeprg, From 60f3adb40563b3870ca21bbb2dc5b88c32b3d225 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 16 Aug 2013 01:31:22 +0300 Subject: [PATCH 0169/1271] Bug fix: split checker output into lines before preprocessing. --- plugin/syntastic.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 3af2204b8..20bf7ac37 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -388,7 +388,7 @@ function! SyntasticMake(options) let $LC_MESSAGES = 'C' let $LC_ALL = '' - let err_lines = system(a:options['makeprg']) + let err_lines = split(system(a:options['makeprg']), "\n", 1) let $LC_ALL = old_lc_all let $LC_MESSAGES = old_lc_messages From 9394c8546c20fc85d38abdd5cd70901e2023aa1a Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 16 Aug 2013 01:36:40 +0300 Subject: [PATCH 0170/1271] Cleanup the python/pep257 checker. --- syntax_checkers/python/pep257.vim | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/syntax_checkers/python/pep257.vim b/syntax_checkers/python/pep257.vim index 52fbc1ea3..9d2b64d91 100644 --- a/syntax_checkers/python/pep257.vim +++ b/syntax_checkers/python/pep257.vim @@ -8,27 +8,38 @@ if exists("g:loaded_syntastic_python_pep257_checker") finish endif -let g:loaded_syntastic_python_pep257_checker=1 +let g:loaded_syntastic_python_pep257_checker = 1 function! SyntaxCheckers_python_pep257_IsAvailable() return executable('pep257') endfunction +" sanity: kill empty lines here rather than munging errorformat +function! SyntaxCheckers_python_pep257_Preprocess(errors) + return filter(copy(a:errors), 'v:val != ""') +endfunction + function! SyntaxCheckers_python_pep257_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'pep257', \ 'filetype': 'python', \ 'subchecker': 'pep257' }) - let errorformat = '%f:%l:%c: %m' + let errorformat = + \ '%E%f:%l:%c%\%.%\%.%\d%\+:%\d%\+: %m,' . + \ '%E%f:%l:%c: %m,' . + \ '%+C %m' let loclist = SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, - \ 'subtype': 'Style' }) + \ 'subtype': 'Style', + \ 'preprocess': 'SyntaxCheckers_python_pep257_Preprocess', + \ 'postprocess': ['compressWhitespace'] }) + " pep257 outputs byte offsets rather than column numbers for n in range(len(loclist)) - let loclist[n]['type'] = loclist[n]['text'] =~? '^W' ? 'W' : 'E' + let loclist[n]['col'] = get(loclist[n], 'col', 0) + 1 endfor return loclist From dfc801646664f3e116ff3fd19f13036ead11a16a Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 16 Aug 2013 08:05:42 +0300 Subject: [PATCH 0171/1271] Cleanup errorformat for tex/chktex. --- syntax_checkers/tex/chktex.vim | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/syntax_checkers/tex/chktex.vim b/syntax_checkers/tex/chktex.vim index d7a55e0f0..43ae2f526 100644 --- a/syntax_checkers/tex/chktex.vim +++ b/syntax_checkers/tex/chktex.vim @@ -23,7 +23,7 @@ " - g:syntastic_tex_chktex_args (string; default: empty) " command line options to pass to chktex -if exists("g:loaded_syntastic_tex_chktex_checker") +if exists('g:loaded_syntastic_tex_chktex_checker') finish endif let g:loaded_syntastic_tex_chktex_checker = 1 @@ -33,7 +33,7 @@ if !exists('g:syntastic_tex_chktex_showmsgs') endif function! SyntaxCheckers_tex_chktex_IsAvailable() - return executable("chktex") + return executable('chktex') endfunction function! SyntaxCheckers_tex_chktex_GetLocList() @@ -44,10 +44,10 @@ function! SyntaxCheckers_tex_chktex_GetLocList() \ 'subchecker': 'chktex' }) let errorformat = - \ '%EError\ %\\d%\\+\ in\ %f\ line\ %l:\ %m,' . - \ '%WWarning\ %\\d%\\+\ in\ %f\ line\ %l:\ %m,' . - \ (g:syntastic_tex_chktex_showmsgs ? '%WMessage\ %\\d%\\+\ in\ %f\ line %l:\ %m,' : '') . - \ '%+Z%p^,' . + \ '%EError %n in %f line %l: %m,' . + \ '%WWarning %n in %f line %l: %m,' . + \ (g:syntastic_tex_chktex_showmsgs ? '%WMessage %n in %f line %l: %m,' : '') . + \ '%Z%p^,' . \ '%-G%.%#' return SyntasticMake({ From 37590de7c1e6957bef5db2884a9829ea27e85859 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 16 Aug 2013 08:07:54 +0300 Subject: [PATCH 0172/1271] Cleanup errorformat for tex/lacheck. --- syntax_checkers/tex/lacheck.vim | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/syntax_checkers/tex/lacheck.vim b/syntax_checkers/tex/lacheck.vim index 38510e856..d68a519a1 100644 --- a/syntax_checkers/tex/lacheck.vim +++ b/syntax_checkers/tex/lacheck.vim @@ -10,13 +10,13 @@ " "============================================================================ -if exists("g:loaded_syntastic_tex_lacheck_checker") +if exists('g:loaded_syntastic_tex_lacheck_checker') finish endif let g:loaded_syntastic_tex_lacheck_checker=1 function! SyntaxCheckers_tex_lacheck_IsAvailable() - return executable("lacheck") + return executable('lacheck') endfunction function! SyntaxCheckers_tex_lacheck_GetLocList() @@ -25,7 +25,9 @@ function! SyntaxCheckers_tex_lacheck_GetLocList() \ 'filetype': 'tex', \ 'subchecker': 'lacheck' }) - let errorformat = '%-G** %f:,%E"%f"\, line %l: %m' + let errorformat = + \ '%-G** %f:,' . + \ '%E"%f"\, line %l: %m' return SyntasticMake({ \ 'makeprg': makeprg, From bf860a5f3a1c2e6ad97d4dc0fc2f87716b710342 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 16 Aug 2013 09:14:52 +0300 Subject: [PATCH 0173/1271] Adjust for newer weirdness in the python/pylama checker. --- syntax_checkers/python/pylama.vim | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/syntax_checkers/python/pylama.vim b/syntax_checkers/python/pylama.vim index 4d7d02ad2..8c8e2ba0a 100644 --- a/syntax_checkers/python/pylama.vim +++ b/syntax_checkers/python/pylama.vim @@ -9,10 +9,10 @@ " See http://sam.zoy.org/wtfpl/COPYING for more details. " "============================================================================ -if exists("g:loaded_syntastic_python_pylama_checker") +if exists('g:loaded_syntastic_python_pylama_checker') finish endif -let g:loaded_syntastic_python_pylama_checker=1 +let g:loaded_syntastic_python_pylama_checker = 1 function! SyntaxCheckers_python_pylama_IsAvailable() return executable('pylama') @@ -25,20 +25,34 @@ endfunction function! SyntaxCheckers_python_pylama_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'pylama', - \ 'post_args': ' -f pep8', + \ 'post_args': '-f pep8', \ 'filetype': 'python', \ 'subchecker': 'pylama' }) - let errorformat = '%A%f:%l:%c: %m' + " TODO: "WARNING:pylama:..." messages are probably a logging bug + let errorformat = + \ '%-GWARNING:pylama:%.%#,' . + \ '%A%f:%l:%c: %m' - let loclist=SyntasticMake({ + let loclist = SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, \ 'postprocess': ['sort'] }) + " adjust for weirdness in each checker for n in range(len(loclist)) let loclist[n]['type'] = match(['R', 'C', 'W'], loclist[n]['text'][0]) >= 0 ? 'W' : 'E' - if loclist[n]['text'] =~# '\v\[%(pep8|pep257|mccabe)\]$' + if loclist[n]['text'] =~# '\v\[%(mccabe|pep257|pylint)\]$' + if has_key(loclist[n], 'col') + let loclist[n]['col'] += 1 + endif + endif + if loclist[n]['text'] =~# '\v\[pylint\]$' + if has_key(loclist[n], 'vcol') + let loclist[n]['vcol'] = 0 + endif + endif + if loclist[n]['text'] =~# '\v\[%(mccabe|pep257|pep8)\]$' let loclist[n]['subtype'] = 'Style' endif endfor From 22e3f0f953f6b5f229099d1859393c020b60b7a0 Mon Sep 17 00:00:00 2001 From: Florian Eitel Date: Tue, 6 Aug 2013 17:25:29 +0200 Subject: [PATCH 0174/1271] Add possibility to specify a rebar file as parameter in erlang_check_file.erl I want to use lib_dirs and sub_dirs from rebar file and run compile with this paths. So I search for the next rebar.config file and pass this in g:syntastic_erlc_include_path. see: https://github.com/scrooloose/syntastic/issues/685 --- syntax_checkers/erlang/erlang_check_file.erl | 27 ++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/syntax_checkers/erlang/erlang_check_file.erl b/syntax_checkers/erlang/erlang_check_file.erl index 54cc93667..2fadfd5ff 100755 --- a/syntax_checkers/erlang/erlang_check_file.erl +++ b/syntax_checkers/erlang/erlang_check_file.erl @@ -4,6 +4,33 @@ main([FileName]) -> LibDirs = filelib:wildcard("{lib,deps}/*/ebin"), compile(FileName, LibDirs); + +main([FileName | ["-rebar" | [Path | LibDirs]]]) -> + {ok, L} = file:consult(Path), + P = dict:from_list(L), + Root = filename:dirname(Path), + + Lib1 = case dict:find(lib_dirs, P) of + {ok, X} -> lists:map(fun(Sub) -> Root ++ "/" ++ Sub end, X); + _ -> [] + end, + + Lib2 = case dict:find(sub_dirs, P) of + {ok, Y} -> lists:foldl( + fun(Sub,Sofar) -> + Sofar ++ [ + Root ++ "/" ++ Sub, + Root ++ "/" ++ Sub ++ "/include", + Root ++ "/" ++ Sub ++ "/deps", + Root ++ "/" ++ Sub ++ "/lib" + ] end, [], Y); + _ -> [] + end, + + LibDirs1 = LibDirs ++ Lib1 ++ Lib2, + %io:format("~p~n", [LibDirs1]), + compile(FileName, LibDirs1); + main([FileName | LibDirs]) -> compile(FileName, LibDirs). From d73279d1d7fcfecec161b3c3732e614bb72af553 Mon Sep 17 00:00:00 2001 From: Tim Mower Date: Fri, 23 Aug 2013 11:33:21 +0100 Subject: [PATCH 0175/1271] Update with explanation of override behaviour Hope I'm clear enough here - I ran into an issue with the phpcs example where it specifies --report=csv by default, adding my options didnt include this default so I had to add my new argument and the default to the option. --- README.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.markdown b/README.markdown index 30c96ccb9..a540de1a5 100644 --- a/README.markdown +++ b/README.markdown @@ -106,7 +106,7 @@ __Q. Recently some of my syntax checker options have stopped working...__ A. The options are still there, they have just been renamed. Recently, almost all syntax checkers were refactored to use the new `syntastic#makeprg#build()` function. This made a lot of the old explicit options redundant - as they are now implied. The new implied options usually have slightly different names to the old options. -e.g. Previously there was `g:syntastic_phpcs_conf`, now you must use `g:syntastic_php_phpcs_args`. +e.g. Previously there was `g:syntastic_phpcs_conf`, now you must use `g:syntastic_php_phpcs_args`. This completely overrides the arguments of the checker, including any defaults, so you may need to look up the default arguments of the checker and add these in. See `:help syntastic-checker-options` for more information. From 7ff53abc7b9a8eb84b6ec92d4d67bc5f491de449 Mon Sep 17 00:00:00 2001 From: Nicolas Wu Date: Sat, 31 Aug 2013 17:29:31 +0100 Subject: [PATCH 0176/1271] Parse multi line warnings correctly --- syntax_checkers/haskell/hdevtools.vim | 1 + 1 file changed, 1 insertion(+) diff --git a/syntax_checkers/haskell/hdevtools.vim b/syntax_checkers/haskell/hdevtools.vim index 3f4b0b737..58b015f9a 100644 --- a/syntax_checkers/haskell/hdevtools.vim +++ b/syntax_checkers/haskell/hdevtools.vim @@ -28,6 +28,7 @@ function! SyntaxCheckers_haskell_hdevtools_GetLocList() let errorformat= '\%-Z\ %#,'. \ '%W%f:%l:%c:\ Warning:\ %m,'. + \ '%W%f:%l:%c:\ Warning:,'. \ '%E%f:%l:%c:\ %m,'. \ '%E%>%f:%l:%c:,'. \ '%+C\ \ %#%m,'. From f181c89fae5f25b51b5a1e807f1d46e403c6227c Mon Sep 17 00:00:00 2001 From: Jon Bernard Date: Wed, 11 Sep 2013 11:19:42 -0400 Subject: [PATCH 0177/1271] Correct expected return values for checkpatch checker checkpatch.pl will return 1 when warnings or errors are found, at least in the current -next tree. This commit makes the checkpatch checker work again. --- syntax_checkers/c/checkpatch.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntax_checkers/c/checkpatch.vim b/syntax_checkers/c/checkpatch.vim index 0d579bfdc..f16a7c142 100644 --- a/syntax_checkers/c/checkpatch.vim +++ b/syntax_checkers/c/checkpatch.vim @@ -39,7 +39,7 @@ function! SyntaxCheckers_c_checkpatch_GetLocList() return SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, - \ 'returns': [0], + \ 'returns': [0, 1], \ 'subtype': 'Style' }) endfunction From d94c66667c4620079c60147ffefebb2ad699be41 Mon Sep 17 00:00:00 2001 From: stwind Date: Thu, 12 Sep 2013 14:29:13 +0800 Subject: [PATCH 0178/1271] Erlang: support files under test/ folder --- syntax_checkers/erlang/erlang_check_file.erl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/syntax_checkers/erlang/erlang_check_file.erl b/syntax_checkers/erlang/erlang_check_file.erl index 54cc93667..73fb00573 100755 --- a/syntax_checkers/erlang/erlang_check_file.erl +++ b/syntax_checkers/erlang/erlang_check_file.erl @@ -30,5 +30,7 @@ get_root([], Path) -> Path; get_root(["src" | Tail], _Path) -> lists:reverse(Tail); +get_root(["test" | Tail], _Path) -> + lists:reverse(Tail); get_root([_ | Tail], Path) -> get_root(Tail, Path). From 80a843d35d47b1341215fba45559dc9ef3f75a80 Mon Sep 17 00:00:00 2001 From: Steven Foote Date: Thu, 19 Sep 2013 13:33:24 -0700 Subject: [PATCH 0179/1271] Follow syntastic convention and improve makeprg config --- syntax_checkers/dustjs/swiffer.vim | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/syntax_checkers/dustjs/swiffer.vim b/syntax_checkers/dustjs/swiffer.vim index d1212fdcc..addaa6f67 100644 --- a/syntax_checkers/dustjs/swiffer.vim +++ b/syntax_checkers/dustjs/swiffer.vim @@ -8,15 +8,12 @@ " Want To Public License, Version 2, as published by Sam Hocevar. " See http://sam.zoy.org/wtfpl/COPYING for more details. "============================================================================ -" -" To enable Dust syntax checking, you must set the filetype of your Dust template files to `dustjs` -" The easiest way to do this is by installing the dustjs syntax highlighter at https://github.com/jimmyhchan/dustjs.vim -if exists("g:loaded_syntastic_dust_checker") +if exists("g:loaded_syntastic_dustjs_swiffer_checker") finish endif -let g:loaded_syntastic_dust_checker = 1 +let g:loaded_syntastic_dustjs_swiffer_checker = 1 function! SyntaxCheckers_dustjs_swiffer_IsAvailable() return executable("swiffer") @@ -25,9 +22,9 @@ endfunction function! SyntaxCheckers_dustjs_swiffer_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'swiffer', - \ 'args': '', - \ 'subchecker': '' }) - let errorformat = '%E%f \- Line %l\, Column %c: %m' + \ 'subchecker': 'swiffer', + \ 'filetype': 'dustjs' }) + let errorformat = '%E%f - Line %l\, Column %c: %m' let loclist = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) return loclist From c3442c4d75dc2c5ed96a5d84ee20ddb85711b69b Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 20 Sep 2013 01:01:57 +0300 Subject: [PATCH 0180/1271] Make 'litcoffee' filetype an alias to 'coffee'. --- plugin/syntastic/registry.vim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugin/syntastic/registry.vim b/plugin/syntastic/registry.vim index 6f61d65f6..b1742c68f 100644 --- a/plugin/syntastic/registry.vim +++ b/plugin/syntastic/registry.vim @@ -26,7 +26,8 @@ let s:defaultCheckers = { let s:defaultFiletypeMap = { \ 'gentoo-metadata': 'xml', - \ 'lhaskell': 'haskell' + \ 'lhaskell': 'haskell', + \ 'litcoffee': 'coffee' \ } let g:SyntasticRegistry = {} From 73beaccb698df46c8cf454ae0a17d84828af5866 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 20 Sep 2013 01:04:35 +0300 Subject: [PATCH 0181/1271] Save and restore local errorformat. --- plugin/syntastic.vim | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 20bf7ac37..1921443ec 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -366,6 +366,7 @@ function! SyntasticMake(options) let old_shell = &shell let old_shellredir = &shellredir + let old_local_errorformat = &l:errorformat let old_errorformat = &errorformat let old_cwd = getcwd() let old_lc_messages = $LC_MESSAGES @@ -405,6 +406,7 @@ function! SyntasticMake(options) silent! lolder let &errorformat = old_errorformat + let &l:errorformat = old_local_errorformat let &shellredir = old_shellredir let &shell=old_shell From 7dfd26f581fc27b38c793d4c27aabcd6d60530a3 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 20 Sep 2013 01:16:36 +0300 Subject: [PATCH 0182/1271] Add safety guard for pylint. --- syntax_checkers/python/pylint.vim | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/syntax_checkers/python/pylint.vim b/syntax_checkers/python/pylint.vim index 477d93728..321bc1f32 100644 --- a/syntax_checkers/python/pylint.vim +++ b/syntax_checkers/python/pylint.vim @@ -49,8 +49,12 @@ function! SyntaxCheckers_python_pylint_GetLocList() endfunction function s:PylintNew() - let pylint_version = filter(split(system('pylint --version'), '\m, \|\n'), 'v:val =~# "^pylint"')[0] - return syntastic#util#versionIsAtLeast(syntastic#util#parseVersion(pylint_version), [1]) + try + let pylint_version = filter(split(system('pylint --version'), '\m, \|\n'), 'v:val =~# "^pylint"')[0] + return syntastic#util#versionIsAtLeast(syntastic#util#parseVersion(pylint_version), [1]) + catch /E684/ + return 0 + endtry endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ From 6e1f7519c7ed2f91852bc1f52fc70dab7fcf4e49 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 20 Sep 2013 01:27:28 +0300 Subject: [PATCH 0183/1271] Fix a minor bug in the javac checker. --- syntax_checkers/java/javac.vim | 1 + 1 file changed, 1 insertion(+) diff --git a/syntax_checkers/java/javac.vim b/syntax_checkers/java/javac.vim index 122a63682..2af89fe49 100644 --- a/syntax_checkers/java/javac.vim +++ b/syntax_checkers/java/javac.vim @@ -197,6 +197,7 @@ function! s:GetMavenClasspath() if !has_key(g:syntastic_java_javac_maven_pom_ftime, pom) || g:syntastic_java_javac_maven_pom_ftime[pom] != getftime(pom) let mvn_cmd = g:syntastic_java_maven_executable . ' -f ' . pom let mvn_classpath_output = split(system(mvn_cmd . ' dependency:build-classpath'), "\n") + let mvn_classpath = '' let class_path_next = 0 for line in mvn_classpath_output From 1dc0c96b1a1dd09b325b2c1cdaf2125c9b486a28 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 20 Sep 2013 01:37:28 +0300 Subject: [PATCH 0184/1271] Javac checker: do something sensible when we can't find maven. --- syntax_checkers/java/javac.vim | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/syntax_checkers/java/javac.vim b/syntax_checkers/java/javac.vim index 2af89fe49..bac150cad 100644 --- a/syntax_checkers/java/javac.vim +++ b/syntax_checkers/java/javac.vim @@ -17,6 +17,7 @@ endif let g:loaded_syntastic_java_javac_checker=1 let g:syntastic_java_javac_maven_pom_tags = ["build", "properties"] let g:syntastic_java_javac_maven_pom_properties = {} +let s:has_maven = 0 " Global Options if !exists("g:syntastic_java_javac_executable") @@ -158,7 +159,7 @@ endfunction function! s:GetMavenProperties() let mvn_properties = {} let pom = findfile("pom.xml", ".;") - if filereadable(pom) + if s:has_maven && filereadable(pom) if !has_key(g:syntastic_java_javac_maven_pom_properties, pom) let mvn_cmd = g:syntastic_java_maven_executable . ' -f ' . pom let mvn_is_managed_tag = 1 @@ -193,7 +194,7 @@ command! SyntasticJavacEditClasspath call s:EditClasspath() function! s:GetMavenClasspath() let pom = findfile("pom.xml", ".;") - if filereadable(pom) + if s:has_maven && filereadable(pom) if !has_key(g:syntastic_java_javac_maven_pom_ftime, pom) || g:syntastic_java_javac_maven_pom_ftime[pom] != getftime(pom) let mvn_cmd = g:syntastic_java_maven_executable . ' -f ' . pom let mvn_classpath_output = split(system(mvn_cmd . ' dependency:build-classpath'), "\n") @@ -233,12 +234,13 @@ function! s:GetMavenClasspath() endfunction function! SyntaxCheckers_java_javac_IsAvailable() + let s:has_maven = executable(g:syntastic_java_maven_executable) return executable(g:syntastic_java_javac_executable) endfunction function! s:MavenOutputDirectory() let pom = findfile("pom.xml", ".;") - if filereadable(pom) + if s:has_maven && filereadable(pom) let mvn_properties = s:GetMavenProperties() let output_dir = getcwd() if has_key(mvn_properties, 'project.properties.build.dir') @@ -262,6 +264,7 @@ function! s:MavenOutputDirectory() endif return output_dir endif + return '.' endfunction function! SyntaxCheckers_java_javac_GetLocList() @@ -303,13 +306,11 @@ function! SyntaxCheckers_java_javac_GetLocList() endif endfor - if g:syntastic_java_javac_autoload_maven_classpath + if s:has_maven && g:syntastic_java_javac_autoload_maven_classpath if !g:syntastic_java_javac_delete_output - let maven_output_dir = s:MavenOutputDirectory() - let javac_opts .= ' -d ' . maven_output_dir + let javac_opts .= ' -d ' . s:MavenOutputDirectory() endif - let maven_classpath = s:GetMavenClasspath() - let javac_classpath = s:AddToClasspath(javac_classpath,maven_classpath) + let javac_classpath = s:AddToClasspath(javac_classpath, s:GetMavenClasspath()) endif if javac_classpath != '' From 37964f7d8d30c2f8c3b0f92681436efb40a43bbb Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 20 Sep 2013 01:41:07 +0300 Subject: [PATCH 0185/1271] Add Dust to the list of supported languages. --- README.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.markdown b/README.markdown index a540de1a5..0308bb1fc 100644 --- a/README.markdown +++ b/README.markdown @@ -27,7 +27,7 @@ execute their script to find them. At the time of this writing, syntax checking plugins exist for Ada, AppleScript, AsciiDoc, Bourne shell, C, C++, C#, CoffeeScript, Coco, Coq, -CSS, Cucumber, CUDA, D, Dart, DocBook, Elixir, Erlang, eRuby, Fortran, +CSS, Cucumber, CUDA, D, Dart, DocBook, Dust, Elixir, Erlang, eRuby, Fortran, Gentoo metadata, Go, Haml, Haskell, Haxe, HSS, HTML, Java, JavaScript, JSON, LESS, LISP, LLVM intermediate language, Lua, MATLAB, NASM, Objective-C, Objective-C++, OCaml, Perl, Perl POD, PHP, Puppet, Python, reStructuredText, From c168fc137dcdfbf4d9684dabdc34cccd5249ab99 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 20 Sep 2013 01:45:58 +0300 Subject: [PATCH 0186/1271] Tune flake8 error levels. --- syntax_checkers/python/flake8.vim | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/syntax_checkers/python/flake8.vim b/syntax_checkers/python/flake8.vim index 796ba6bdb..83fa30dcd 100644 --- a/syntax_checkers/python/flake8.vim +++ b/syntax_checkers/python/flake8.vim @@ -25,11 +25,11 @@ function! SyntaxCheckers_python_flake8_GetLocList() \ 'subchecker': 'flake8' }) let errorformat = - \ '%E%f:%l: could not compile,%-Z%p^,'. - \ '%W%f:%l:%c: F%n %m,'. - \ '%W%f:%l:%c: C%n %m,'. - \ '%E%f:%l:%c: %t%n %m,'. - \ '%E%f:%l: %t%n %m,'. + \ '%E%f:%l: could not compile,%-Z%p^,' . + \ '%E%f:%l:%c: F%n %m,' . + \ '%W%f:%l:%c: C%n %m,' . + \ '%W%f:%l:%c: %.%n %m,' . + \ '%W%f:%l: %.%n %m,' . \ '%-G%.%#' return SyntasticMake({ From e3d0946d8294f3665258cf3e0bcb81ff1045a25e Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 20 Sep 2013 07:49:19 +0300 Subject: [PATCH 0187/1271] Cleaner error handling for pylint. --- syntax_checkers/python/pylint.vim | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/syntax_checkers/python/pylint.vim b/syntax_checkers/python/pylint.vim index 321bc1f32..186a7d74e 100644 --- a/syntax_checkers/python/pylint.vim +++ b/syntax_checkers/python/pylint.vim @@ -7,18 +7,19 @@ if exists("g:loaded_syntastic_python_pylint_checker") finish endif -let g:loaded_syntastic_python_pylint_checker=1 +let g:loaded_syntastic_python_pylint_checker = 1 + +let s:pylint_new = -1 function! SyntaxCheckers_python_pylint_IsAvailable() - return executable('pylint') + let s:pylint_new = executable('pylint') ? s:PylintNew() : -1 + return s:pylint_new >= 0 endfunction function! SyntaxCheckers_python_pylint_GetLocList() - let pylint_new = s:PylintNew() - let makeprg = syntastic#makeprg#build({ \ 'exe': 'pylint', - \ 'args': (pylint_new ? '--msg-template="{path}:{line}: [{msg_id}] {msg}" -r n' : '-f parseable -r n -i y'), + \ 'args': (s:pylint_new ? '--msg-template="{path}:{line}: [{msg_id}] {msg}" -r n' : '-f parseable -r n -i y'), \ 'filetype': 'python', \ 'subchecker': 'pylint' }) @@ -51,10 +52,12 @@ endfunction function s:PylintNew() try let pylint_version = filter(split(system('pylint --version'), '\m, \|\n'), 'v:val =~# "^pylint"')[0] - return syntastic#util#versionIsAtLeast(syntastic#util#parseVersion(pylint_version), [1]) + let ret = syntastic#util#versionIsAtLeast(syntastic#util#parseVersion(pylint_version), [1]) catch /E684/ - return 0 + call syntastic#util#error("checker python/pylint: can't parse version string (abnormal termination?)") + let ret = -1 endtry + return ret endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ From 40f5939d4305cf83c32e7e65d8abc8f01d820bea Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Mon, 23 Sep 2013 23:14:46 +0300 Subject: [PATCH 0188/1271] Safer version check for pylint. --- syntax_checkers/python/pylint.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntax_checkers/python/pylint.vim b/syntax_checkers/python/pylint.vim index 186a7d74e..70196bd81 100644 --- a/syntax_checkers/python/pylint.vim +++ b/syntax_checkers/python/pylint.vim @@ -51,7 +51,7 @@ endfunction function s:PylintNew() try - let pylint_version = filter(split(system('pylint --version'), '\m, \|\n'), 'v:val =~# "^pylint"')[0] + let pylint_version = filter(split(system('pylint --version'), '\m, \=\|\n'), 'v:val =~# "^pylint "')[0] let ret = syntastic#util#versionIsAtLeast(syntastic#util#parseVersion(pylint_version), [1]) catch /E684/ call syntastic#util#error("checker python/pylint: can't parse version string (abnormal termination?)") From 63b54a7edbd2b6e623fbb3af528e0ec90c64221a Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Mon, 23 Sep 2013 23:29:10 +0300 Subject: [PATCH 0189/1271] Pylint checker again: calling syntastic#util#parseVersion() is wrong. --- syntax_checkers/python/pylint.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntax_checkers/python/pylint.vim b/syntax_checkers/python/pylint.vim index 70196bd81..f3eb56b12 100644 --- a/syntax_checkers/python/pylint.vim +++ b/syntax_checkers/python/pylint.vim @@ -52,7 +52,7 @@ endfunction function s:PylintNew() try let pylint_version = filter(split(system('pylint --version'), '\m, \=\|\n'), 'v:val =~# "^pylint "')[0] - let ret = syntastic#util#versionIsAtLeast(syntastic#util#parseVersion(pylint_version), [1]) + let ret = syntastic#util#versionIsAtLeast(split(matchstr( pylint_version, '\v^\D*\zs\d+(\.\d+)+\ze' ), '\.'), [1]) catch /E684/ call syntastic#util#error("checker python/pylint: can't parse version string (abnormal termination?)") let ret = -1 From 5c8d50efbf7ba7ce64222a23d261740252f1e75c Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Tue, 24 Sep 2013 08:39:07 +0300 Subject: [PATCH 0190/1271] Cleanup parsing versions. --- autoload/syntastic/util.vim | 9 +++++++-- syntax_checkers/coffee/coffee.vim | 2 +- syntax_checkers/eruby/ruby.vim | 2 +- syntax_checkers/javascript/jshint.vim | 2 +- syntax_checkers/puppet/puppet.vim | 2 +- syntax_checkers/puppet/puppetlint.vim | 2 +- syntax_checkers/python/pylint.vim | 2 +- syntax_checkers/ruby/rubocop.vim | 2 +- syntax_checkers/slim/slimrb.vim | 2 +- 9 files changed, 15 insertions(+), 10 deletions(-) diff --git a/autoload/syntastic/util.vim b/autoload/syntastic/util.vim index 3ccf7d095..3e27d0939 100644 --- a/autoload/syntastic/util.vim +++ b/autoload/syntastic/util.vim @@ -48,10 +48,15 @@ function! syntastic#util#parseShebang() return {'exe': '', 'args': []} endfunction +" Parse a version string. Return an array of version components. +function! syntastic#util#parseVersion(version) + return split(matchstr( a:version, '\v^\D*\zs\d+(\.\d+)+\ze' ), '\.') +endfunction + " Run 'command' in a shell and parse output as a version string. " Returns an array of version components. -function! syntastic#util#parseVersion(command) - return split(matchstr( system(a:command), '\v^\D*\zs\d+(\.\d+)+\ze' ), '\.') +function! syntastic#util#getVersion(command) + return syntastic#util#parseVersion(system(a:command)) endfunction " Verify that the 'installed' version is at least the 'required' version. diff --git a/syntax_checkers/coffee/coffee.vim b/syntax_checkers/coffee/coffee.vim index 846180b91..67054df8f 100644 --- a/syntax_checkers/coffee/coffee.vim +++ b/syntax_checkers/coffee/coffee.vim @@ -19,7 +19,7 @@ let g:loaded_syntastic_coffee_coffee_checker=1 function! SyntaxCheckers_coffee_coffee_IsAvailable() return executable("coffee") && - \ syntastic#util#versionIsAtLeast(syntastic#util#parseVersion('coffee --version 2>' . syntastic#util#DevNull()), [1,6,2]) + \ syntastic#util#versionIsAtLeast(syntastic#util#getVersion('coffee --version 2>' . syntastic#util#DevNull()), [1,6,2]) endfunction function! SyntaxCheckers_coffee_coffee_GetLocList() diff --git a/syntax_checkers/eruby/ruby.vim b/syntax_checkers/eruby/ruby.vim index 74e77a06f..dc496955e 100644 --- a/syntax_checkers/eruby/ruby.vim +++ b/syntax_checkers/eruby/ruby.vim @@ -32,7 +32,7 @@ function! SyntaxCheckers_eruby_ruby_GetLocList() let fname = "'" . escape(expand('%'), "\\'") . "'" " TODO: encodings became useful in ruby 1.9 :) - if syntastic#util#versionIsAtLeast(syntastic#util#parseVersion('ruby --version'), [1, 9]) + if syntastic#util#versionIsAtLeast(syntastic#util#getVersion('ruby --version'), [1, 9]) let enc = &fileencoding != '' ? &fileencoding : &encoding let encoding_spec = ', :encoding => "' . (enc ==? 'utf-8' ? 'UTF-8' : 'BINARY') . '"' else diff --git a/syntax_checkers/javascript/jshint.vim b/syntax_checkers/javascript/jshint.vim index caef9a7ef..6e0a47f9b 100644 --- a/syntax_checkers/javascript/jshint.vim +++ b/syntax_checkers/javascript/jshint.vim @@ -45,7 +45,7 @@ function! SyntaxCheckers_javascript_jshint_GetLocList() endfunction function s:JshintNew() - return syntastic#util#versionIsAtLeast(syntastic#util#parseVersion(expand(g:syntastic_jshint_exec) . ' --version'), [1, 1]) + return syntastic#util#versionIsAtLeast(syntastic#util#getVersion(expand(g:syntastic_jshint_exec) . ' --version'), [1, 1]) endfunction function s:Args() diff --git a/syntax_checkers/puppet/puppet.vim b/syntax_checkers/puppet/puppet.vim index 3958a8951..5889c78f0 100644 --- a/syntax_checkers/puppet/puppet.vim +++ b/syntax_checkers/puppet/puppet.vim @@ -21,7 +21,7 @@ endfunction function! SyntaxCheckers_puppet_puppet_GetLocList() - let ver = syntastic#util#parseVersion('puppet --version 2>' . syntastic#util#DevNull()) + let ver = syntastic#util#getVersion('puppet --version 2>' . syntastic#util#DevNull()) if syntastic#util#versionIsAtLeast(ver, [2,7,0]) let args = 'parser validate --color=false' diff --git a/syntax_checkers/puppet/puppetlint.vim b/syntax_checkers/puppet/puppetlint.vim index 14afd8c64..b59059e21 100644 --- a/syntax_checkers/puppet/puppetlint.vim +++ b/syntax_checkers/puppet/puppetlint.vim @@ -24,7 +24,7 @@ function! SyntaxCheckers_puppet_puppetlint_IsAvailable() return \ executable("puppet") && \ executable("puppet-lint") && - \ syntastic#util#versionIsAtLeast(syntastic#util#parseVersion('puppet-lint --version 2>' . + \ syntastic#util#versionIsAtLeast(syntastic#util#getVersion('puppet-lint --version 2>' . \ syntastic#util#DevNull()), [0,1,10]) endfunction diff --git a/syntax_checkers/python/pylint.vim b/syntax_checkers/python/pylint.vim index f3eb56b12..70196bd81 100644 --- a/syntax_checkers/python/pylint.vim +++ b/syntax_checkers/python/pylint.vim @@ -52,7 +52,7 @@ endfunction function s:PylintNew() try let pylint_version = filter(split(system('pylint --version'), '\m, \=\|\n'), 'v:val =~# "^pylint "')[0] - let ret = syntastic#util#versionIsAtLeast(split(matchstr( pylint_version, '\v^\D*\zs\d+(\.\d+)+\ze' ), '\.'), [1]) + let ret = syntastic#util#versionIsAtLeast(syntastic#util#parseVersion(pylint_version), [1]) catch /E684/ call syntastic#util#error("checker python/pylint: can't parse version string (abnormal termination?)") let ret = -1 diff --git a/syntax_checkers/ruby/rubocop.vim b/syntax_checkers/ruby/rubocop.vim index b93d8d1ae..22e6131bd 100644 --- a/syntax_checkers/ruby/rubocop.vim +++ b/syntax_checkers/ruby/rubocop.vim @@ -21,7 +21,7 @@ let g:loaded_syntastic_ruby_rubocop_checker=1 function! SyntaxCheckers_ruby_rubocop_IsAvailable() return \ executable('rubocop') && - \ syntastic#util#versionIsAtLeast(syntastic#util#parseVersion('rubocop --version'), [0,9,0]) + \ syntastic#util#versionIsAtLeast(syntastic#util#getVersion('rubocop --version'), [0,9,0]) endfunction function! SyntaxCheckers_ruby_rubocop_GetLocList() diff --git a/syntax_checkers/slim/slimrb.vim b/syntax_checkers/slim/slimrb.vim index 2644decf3..0ddc4c9dd 100644 --- a/syntax_checkers/slim/slimrb.vim +++ b/syntax_checkers/slim/slimrb.vim @@ -21,7 +21,7 @@ endfunction function! s:SlimrbVersion() if !exists('s:slimrb_version') - let s:slimrb_version = syntastic#util#parseVersion('slimrb --version 2>' . syntastic#util#DevNull()) + let s:slimrb_version = syntastic#util#getVersion('slimrb --version 2>' . syntastic#util#DevNull()) end return s:slimrb_version endfunction From 4742f19c4ab00ab30f65b522997ae5f799c8af85 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Tue, 24 Sep 2013 21:41:59 +0300 Subject: [PATCH 0191/1271] Sanity check for shell redirections (shell=fish won't work). --- plugin/syntastic.vim | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 1921443ec..50c80ebac 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -20,6 +20,15 @@ runtime! plugin/syntastic/*.vim let s:running_windows = has("win16") || has("win32") +if !s:running_windows && executable('uname') + try + let s:uname = system('uname') + catch /^Vim\%((\a\+)\)\=:E484/ + call syntastic#util#error("your shell " . &shell . " doesn't use traditional UNIX syntax for redirections") + finish + endtry +endif + if !exists("g:syntastic_always_populate_loc_list") let g:syntastic_always_populate_loc_list = 0 endif From 310920696149e9cae5d736254fd4e62350073b70 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Tue, 24 Sep 2013 21:43:12 +0300 Subject: [PATCH 0192/1271] Minor cleanup. --- syntax_checkers/python/pylint.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntax_checkers/python/pylint.vim b/syntax_checkers/python/pylint.vim index 70196bd81..9cb994823 100644 --- a/syntax_checkers/python/pylint.vim +++ b/syntax_checkers/python/pylint.vim @@ -53,7 +53,7 @@ function s:PylintNew() try let pylint_version = filter(split(system('pylint --version'), '\m, \=\|\n'), 'v:val =~# "^pylint "')[0] let ret = syntastic#util#versionIsAtLeast(syntastic#util#parseVersion(pylint_version), [1]) - catch /E684/ + catch /^Vim\%((\a\+)\)\=:E684/ call syntastic#util#error("checker python/pylint: can't parse version string (abnormal termination?)") let ret = -1 endtry From 583afad62161c5b3d7af3c22c2fdf0759b71ada3 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Wed, 25 Sep 2013 13:08:50 +0300 Subject: [PATCH 0193/1271] Fix pylint version parsing on Windows. --- syntax_checkers/python/pylint.vim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/syntax_checkers/python/pylint.vim b/syntax_checkers/python/pylint.vim index 9cb994823..7b2f36282 100644 --- a/syntax_checkers/python/pylint.vim +++ b/syntax_checkers/python/pylint.vim @@ -51,7 +51,8 @@ endfunction function s:PylintNew() try - let pylint_version = filter(split(system('pylint --version'), '\m, \=\|\n'), 'v:val =~# "^pylint "')[0] + " On Windows the version is shown as "pylint-script.py 1.0.0" + let pylint_version = filter(split(system('pylint --version'), '\m, \=\|\n'), 'v:val =~# ''\m^pylint\(-script\.py\)\= ''')[0] let ret = syntastic#util#versionIsAtLeast(syntastic#util#parseVersion(pylint_version), [1]) catch /^Vim\%((\a\+)\)\=:E684/ call syntastic#util#error("checker python/pylint: can't parse version string (abnormal termination?)") From 7399e85e41dc7f5eace25b706c6486cd7709fa75 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Thu, 26 Sep 2013 08:34:05 +0300 Subject: [PATCH 0194/1271] Make the nagelfar checker use the standard args mechanism. --- syntax_checkers/tcl/nagelfar.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntax_checkers/tcl/nagelfar.vim b/syntax_checkers/tcl/nagelfar.vim index b93b17b93..c908f73f3 100644 --- a/syntax_checkers/tcl/nagelfar.vim +++ b/syntax_checkers/tcl/nagelfar.vim @@ -23,7 +23,7 @@ endfunction function! SyntaxCheckers_tcl_nagelfar_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'nagelfar', - \ 'args': '-H ' . g:syntastic_tcl_nagelfar_conf, + \ 'args': '-H', \ 'filetype': 'tcl', \ 'subchecker': 'nagelfar' }) From 31f21c53468b93ebb991bef35bfb41fc72d43794 Mon Sep 17 00:00:00 2001 From: Kamil Kisiel Date: Thu, 26 Sep 2013 15:53:11 -0700 Subject: [PATCH 0195/1271] Support multi-line error messages in the go checker. --- syntax_checkers/go/go.vim | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/syntax_checkers/go/go.vim b/syntax_checkers/go/go.vim index 427e3e0b2..a1b9e513d 100644 --- a/syntax_checkers/go/go.vim +++ b/syntax_checkers/go/go.vim @@ -53,9 +53,10 @@ function! SyntaxCheckers_go_go_GetLocList() endif let errorformat = - \ '%f:%l:%c:%m,' . - \ '%f:%l%m,' . - \ '%-G#%.%#' + \ '%E%f:%l:%c:%m,' . + \ '%E%f:%l%m,' . + \ '%-G#%.%#,' . + \ '%Z%m' " The go compiler needs to either be run with an import path as an " argument or directly from the package directory. Since figuring out From ba96320c853ec8add80913d5f415512916d67872 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 27 Sep 2013 10:35:46 +0300 Subject: [PATCH 0196/1271] Minor cleanup. --- plugin/syntastic.vim | 2 +- syntax_checkers/javascript/jslint.vim | 4 +++- syntax_checkers/less/lessc.vim | 2 +- syntax_checkers/slim/slimrb.vim | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 50c80ebac..ffd5e0ff9 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -156,7 +156,7 @@ function! s:UpdateErrors(auto_invoked, ...) else call s:CacheErrors() endif - end + endif let loclist = g:SyntasticLoclist.current() diff --git a/syntax_checkers/javascript/jslint.vim b/syntax_checkers/javascript/jslint.vim index ab6469d4f..ece856e55 100644 --- a/syntax_checkers/javascript/jslint.vim +++ b/syntax_checkers/javascript/jslint.vim @@ -25,7 +25,9 @@ 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 + if len(unexpected) < 1i + return '' + endif return '\V'.split(unexpected, "'")[1] endfunction diff --git a/syntax_checkers/less/lessc.vim b/syntax_checkers/less/lessc.vim index 001be3512..05f825276 100644 --- a/syntax_checkers/less/lessc.vim +++ b/syntax_checkers/less/lessc.vim @@ -34,7 +34,7 @@ if g:syntastic_less_use_less_lint let s:check_file = 'node ' . expand(':p:h') . '/less-lint.js' else let s:check_file = 'lessc' -end +endif function! SyntaxCheckers_less_lessc_IsAvailable() return executable('lessc') diff --git a/syntax_checkers/slim/slimrb.vim b/syntax_checkers/slim/slimrb.vim index 0ddc4c9dd..bda8be011 100644 --- a/syntax_checkers/slim/slimrb.vim +++ b/syntax_checkers/slim/slimrb.vim @@ -22,7 +22,7 @@ endfunction function! s:SlimrbVersion() if !exists('s:slimrb_version') let s:slimrb_version = syntastic#util#getVersion('slimrb --version 2>' . syntastic#util#DevNull()) - end + endif return s:slimrb_version endfunction From e6aebda607bc4ef866243cfbd1e232233c10f2cd Mon Sep 17 00:00:00 2001 From: Kamil Kisiel Date: Fri, 27 Sep 2013 08:59:01 -0700 Subject: [PATCH 0197/1271] Update go.vim errorformat to remove extra spaces. --- syntax_checkers/go/go.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/syntax_checkers/go/go.vim b/syntax_checkers/go/go.vim index a1b9e513d..5d5ae17c0 100644 --- a/syntax_checkers/go/go.vim +++ b/syntax_checkers/go/go.vim @@ -55,8 +55,8 @@ function! SyntaxCheckers_go_go_GetLocList() let errorformat = \ '%E%f:%l:%c:%m,' . \ '%E%f:%l%m,' . - \ '%-G#%.%#,' . - \ '%Z%m' + \ '%C%\s%\+%m,' . + \ '%-G#%.%#' " The go compiler needs to either be run with an import path as an " argument or directly from the package directory. Since figuring out From 1f4f1ebb88edfe0d72ddb468390ba6343ef72a87 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 27 Sep 2013 20:55:56 +0300 Subject: [PATCH 0198/1271] Minor errorformat fix for the go checker. --- syntax_checkers/go/go.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntax_checkers/go/go.vim b/syntax_checkers/go/go.vim index 5d5ae17c0..aa0427e39 100644 --- a/syntax_checkers/go/go.vim +++ b/syntax_checkers/go/go.vim @@ -54,7 +54,7 @@ function! SyntaxCheckers_go_go_GetLocList() let errorformat = \ '%E%f:%l:%c:%m,' . - \ '%E%f:%l%m,' . + \ '%E%f:%l:%m,' . \ '%C%\s%\+%m,' . \ '%-G#%.%#' From a7b6e5239b6f853ae59229d4a75a1a8f2c317831 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Sun, 29 Sep 2013 17:29:21 +0300 Subject: [PATCH 0199/1271] Rework of the perl checker. Helper script efm_perl.pl is no longer needed, error formatting is now done in a preprocess function. g:syntastic_perl_interpreter is now a list. If set to a string, the value is still used for backward compatibility, but a deprecation warning is issued. There is also a buffer-scoped b:syntastic_perl_interpreter. Warnings are are now checked only if no errors are found. --- syntax_checkers/perl/efm_perl.pl | 186 ------------------------------- syntax_checkers/perl/perl.vim | 88 +++++++++------ 2 files changed, 56 insertions(+), 218 deletions(-) delete mode 100644 syntax_checkers/perl/efm_perl.pl diff --git a/syntax_checkers/perl/efm_perl.pl b/syntax_checkers/perl/efm_perl.pl deleted file mode 100644 index 2e74bcb09..000000000 --- a/syntax_checkers/perl/efm_perl.pl +++ /dev/null @@ -1,186 +0,0 @@ -#!/usr/bin/env perl -# vimparse.pl - Reformats the error messages of the Perl interpreter for use -# with the quickfix mode of Vim -# -# Copyright (c) 2001 by Jörg Ziefle -# Copyright (c) 2012 Eric Harmon -# You may use and distribute this software under the same terms as Perl itself. -# -# Usage: put one of the two configurations below in your ~/.vimrc (without the -# description and '# ') and enjoy (be sure to adjust the paths to vimparse.pl -# before): -# -# Program is run interactively with 'perl -w': -# -# set makeprg=$HOME/bin/vimparse.pl\ %\ $* -# set errorformat=%t:%f:%l:%m -# -# Program is only compiled with 'perl -wc': -# -# set makeprg=$HOME/bin/vimparse.pl\ -c\ %\ $* -# set errorformat=%t:%f:%l:%m -# -# Usage: -# vimparse.pl [-c] [-w] [-f ] [programargs] -# -# -c compile only, don't run (perl -wc) -# -w output warnings as warnings instead of errors (slightly slower) -# -f write errors to -# -# Example usages: -# * From the command line: -# vimparse.pl program.pl -# -# vimparse.pl -c -w -f errorfile program.pl -# Then run vim -q errorfile to edit the errors with Vim. -# This uses the custom errorformat: %t:%f:%l:%m. -# -# * From Vim: -# Edit in Vim (and save, if you don't have autowrite on), then -# type ':mak' or ':mak args' (args being the program arguments) -# to error check. -# -# Version history: -# 0.3 (05/31/2012): -# * Added support for the seperate display of warnings -# * Switched output format to %t:%f:%l:%m to support error levels -# 0.2 (04/12/2001): -# * First public version (sent to Bram) -# * -c command line option for compiling only -# * grammatical fix: 'There was 1 error.' -# * bug fix for multiple arguments -# * more error checks -# * documentation (top of file, &usage) -# * minor code clean ups -# 0.1 (02/02/2001): -# * Initial version -# * Basic functionality -# -# Todo: -# * test on more systems -# * use portable way to determine the location of perl ('use Config') -# * include option that shows perldiag messages for each error -# * allow to pass in program by STDIN -# * more intuitive behaviour if no error is found (show message) -# -# Tested under SunOS 5.7 with Perl 5.6.0. Let me know if it's not working for -# you. -use warnings; -use strict; -use Getopt::Std; -use File::Temp qw( tempfile ); - -use vars qw/$opt_I $opt_c $opt_w $opt_f $opt_h/; # needed for Getopt in combination with use strict 'vars' - -use constant VERSION => 0.2; - -getopts('cwf:hI:'); - -&usage if $opt_h; # not necessarily needed, but good for further extension - -if (defined $opt_f) { - - open FILE, "> $opt_f" or do { - warn "Couldn't open $opt_f: $!. Using STDOUT instead.\n"; - undef $opt_f; - }; - -}; - -my $handle = (defined $opt_f ? \*FILE : \*STDOUT); - -(my $file = shift) or &usage; # display usage if no filename is supplied -my $args = (@ARGV ? ' ' . join ' ', @ARGV : ''); - -if ($file eq '-') { # make STDIN seek-able, so it can be read twice - my $fh = tempfile(); - print {$fh} ; - open \*STDIN, '<&', $fh or die "open: $!"; - seek \*STDIN, 0, 0 or die "seek: $!"; -} - -my $libs = join ' ', map {"-I$_"} split ',', $opt_I || ''; -my @error_lines = `$^X $libs @{[defined $opt_c ? '-c ' : '' ]} @{[defined $opt_w ? '-X ' : '-Mwarnings ']} "$file$args" 2>&1`; - -my @lines = map { "E:$_" } @error_lines; - -my @warn_lines; -if(defined($opt_w)) { - if ($file eq '-') { - seek \*STDIN, 0, 0 or die "seek: $!"; - } - @warn_lines = `$^X $libs @{[defined $opt_c ? '-c ' : '' ]} -Mwarnings "$file$args" 2>&1`; -} - -# Any new errors must be warnings -foreach my $line (@warn_lines) { - if(!grep { $_ eq $line } @error_lines) { - push(@lines, "W:$line"); - } -} - -my $errors = 0; -foreach my $line (@lines) { - - chomp($line); - my ($file, $lineno, $message, $rest, $severity); - - if ($line =~ /^([EW]):(.*)\sat\s(.*)\sline\s(\d+)(.*)$/) { - ($severity, $message, $file, $lineno, $rest) = ($1, $2, $3, $4, $5); - $errors++; - $message .= $rest if ($rest =~ s/^,//); - print $handle "$severity:$file:$lineno:$message\n"; - - } else { next }; - -} - -if (defined $opt_f) { - - my $msg; - if ($errors == 1) { - - $msg = "There was 1 error.\n"; - - } else { - - $msg = "There were $errors errors.\n"; - - }; - - print STDOUT $msg; - close FILE; - unlink $opt_f unless $errors; - -}; - -sub usage { - - (local $0 = $0) =~ s/^.*\/([^\/]+)$/$1/; # remove path from name of program - print<] [programargs] - - -c compile only, don't run (executes 'perl -c') - -w output warnings as warnings instead of errors (slightly slower) - -f write errors to - -I specify \@INC/#include directory - -Examples: - * At the command line: - $0 program.pl - Displays output on STDOUT. - - $0 -c -w -f errorfile program.pl - Then run 'vim -q errorfile' to edit the errors with Vim. - This uses the custom errorformat: %t:%f:%l:%m. - - * In Vim: - Edit in Vim (and save, if you don't have autowrite on), then - type ':mak' or ':mak args' (args being the program arguments) - to error check. -EOT - - exit 0; - -}; diff --git a/syntax_checkers/perl/perl.vim b/syntax_checkers/perl/perl.vim index d88437ddc..4868dccc5 100644 --- a/syntax_checkers/perl/perl.vim +++ b/syntax_checkers/perl/perl.vim @@ -11,59 +11,83 @@ " "============================================================================ " -" In order to add some custom lib directories that should be added to the -" perl command line you can add those as a comma-separated list to the variable -" g:syntastic_perl_lib_path. +" Checker options: " -" let g:syntastic_perl_lib_path = './lib,./lib/auto' +" - g:syntastic_perl_interpreter (string; default: 'perl') +" The perl interpreter to use. " -" To use your own perl error output munger script, use the -" g:syntastic_perl_efm_program option. Any command line parameters should be -" included in the variable declaration. The program should expect a single -" parameter; the fully qualified filename of the file to be checked. -" -" let g:syntastic_perl_efm_program = "foo.pl -o -m -g" +" - g:syntastic_perl_lib_path (list; default: []) +" List of include directories to be added to the perl command line. Example: " +" let g:syntastic_perl_lib_path = [ './lib', './lib/auto' ] -if exists("g:loaded_syntastic_perl_perl_checker") +if exists('g:loaded_syntastic_perl_perl_checker') finish endif let g:loaded_syntastic_perl_perl_checker=1 -if !exists("g:syntastic_perl_interpreter") - let g:syntastic_perl_interpreter = "perl" +if !exists('g:syntastic_perl_interpreter') + let g:syntastic_perl_interpreter = 'perl' +endif + +if !exists('g:syntastic_perl_lib_path') + let g:syntastic_perl_lib_path = [] endif function! SyntaxCheckers_perl_perl_IsAvailable() return executable(g:syntastic_perl_interpreter) endfunction -if !exists("g:syntastic_perl_efm_program") - let g:syntastic_perl_efm_program = - \ g:syntastic_perl_interpreter . ' ' . - \ syntastic#util#shescape(expand(':p:h') . '/efm_perl.pl') . - \ ' -c -w' -endif - -function! SyntaxCheckers_perl_perl_GetLocList() - let makeprg = exists("b:syntastic_perl_efm_program") ? b:syntastic_perl_efm_program : g:syntastic_perl_efm_program - if exists("g:syntastic_perl_lib_path") - let makeprg .= ' -I' . g:syntastic_perl_lib_path - endif - let makeprg .= ' ' . syntastic#util#shexpand('%') . s:ExtraMakeprgArgs() +function! SyntaxCheckers_perl_perl_Preprocess(errors) + let out = [] - let errorformat = '%t:%f:%l:%m' + for e in a:errors + let parts = matchlist(e, '\v^(.*)\sat\s(.*)\sline\s(\d+)(.*)$') + if !empty(parts) + call add(out, parts[2] . ':' . parts[3] . ':' . parts[1] . parts[4]) + endif + endfor - return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) + return syntastic#util#unique(out) endfunction -function! s:ExtraMakeprgArgs() +function! SyntaxCheckers_perl_perl_GetLocList() + if type(g:syntastic_perl_lib_path) == type('') + call syntastic#util#deprecationWarn('variable g:syntastic_perl_lib_path should be a list') + let includes = split(g:syntastic_perl_lib_path, ',') + else + let includes = exists('b:syntastic_perl_lib_path') ? b:syntastic_perl_lib_path : g:syntastic_perl_lib_path + endif let shebang = syntastic#util#parseShebang() - if index(shebang['args'], '-T') != -1 - return ' -Tc' + let extra = join(map(includes, '"-I" . v:val')) . (index(shebang['args'], '-T') >= 0 ? ' -T' : '') + let errorformat = '%f:%l:%m' + + let makeprg = syntastic#makeprg#build({ + \ 'exe': g:syntastic_perl_interpreter, + \ 'args': '-c -X ' . extra, + \ 'filetype': 'perl', + \ 'subchecker': 'perl' }) + + let errors = SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'preprocess': 'SyntaxCheckers_perl_perl_Preprocess', + \ 'defaults': {'type': 'E'} }) + if !empty(errors) + return errors endif - return '' + let makeprg = syntastic#makeprg#build({ + \ 'exe': g:syntastic_perl_interpreter, + \ 'args': '-c -Mwarnings ' . extra, + \ 'filetype': 'perl', + \ 'subchecker': 'perl' }) + + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'preprocess': 'SyntaxCheckers_perl_perl_Preprocess', + \ 'defaults': {'type': 'W'} }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ From d0dba36ea435e5f1b5ab1e1f1150526a23bf851b Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Sun, 29 Sep 2013 22:13:36 +0300 Subject: [PATCH 0200/1271] Perl checker: deal with the "-t" taint checking. --- syntax_checkers/perl/perl.vim | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/syntax_checkers/perl/perl.vim b/syntax_checkers/perl/perl.vim index 4868dccc5..705ec92f2 100644 --- a/syntax_checkers/perl/perl.vim +++ b/syntax_checkers/perl/perl.vim @@ -59,7 +59,9 @@ function! SyntaxCheckers_perl_perl_GetLocList() let includes = exists('b:syntastic_perl_lib_path') ? b:syntastic_perl_lib_path : g:syntastic_perl_lib_path endif let shebang = syntastic#util#parseShebang() - let extra = join(map(includes, '"-I" . v:val')) . (index(shebang['args'], '-T') >= 0 ? ' -T' : '') + let extra = join(map(includes, '"-I" . v:val')) . + \ (index(shebang['args'], '-T') >= 0 ? ' -T' : '') . + \ (index(shebang['args'], '-t') >= 0 ? ' -t' : '') let errorformat = '%f:%l:%m' let makeprg = syntastic#makeprg#build({ From 2ebe3c364af6bcb4a0db77f9a8d8c0e0c1407441 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Mon, 30 Sep 2013 14:52:01 +0300 Subject: [PATCH 0201/1271] Erlang checker cleanup. --- syntax_checkers/erlang/erlang.vim | 45 ++++++++++++++++++------------- 1 file changed, 27 insertions(+), 18 deletions(-) diff --git a/syntax_checkers/erlang/erlang.vim b/syntax_checkers/erlang/erlang.vim index 967b759df..9c409a594 100644 --- a/syntax_checkers/erlang/erlang.vim +++ b/syntax_checkers/erlang/erlang.vim @@ -10,40 +10,49 @@ " "============================================================================ -if exists("g:loaded_syntastic_erlang_erlang_checker") +if exists('g:loaded_syntastic_erlang_erlang_checker') finish endif -let g:loaded_syntastic_erlang_erlang_checker=1 +let g:loaded_syntastic_erlang_erlang_checker = 1 -let s:check_file = expand(':p:h') . '/erlang_check_file.erl' -if !exists("g:syntastic_erlc_include_path") - let g:syntastic_erlc_include_path="" +if !exists('g:syntastic_erlc_include_path') + let g:syntastic_erlc_include_path = '' endif +let s:check_file = expand(':p:h') . '/erlang_check_file.erl' + function! SyntaxCheckers_erlang_escript_IsAvailable() return executable('escript') endfunction function! SyntaxCheckers_erlang_escript_GetLocList() - let extension = expand('%:e') - if match(extension, 'hrl') >= 0 + if expand('%:e') ==# 'hrl' return [] endif - let shebang = getbufline(bufnr('%'), 1)[0] - if len(shebang) > 0 - if match(shebang, 'escript') >= 0 - let makeprg = 'escript -s ' . syntastic#util#shexpand('%:p') - else - let makeprg = 'escript ' . s:check_file . ' ' . syntastic#util#shexpand('%:p') . ' ' . g:syntastic_erlc_include_path - endif + + let shebang = syntastic#util#parseShebang() + if shebang['exe'] ==# 'escript' + let args = '-s' + let post_args = '' else - let makeprg = 'escript ' . s:check_file . ' ' . syntastic#util#shexpand('%:p') . ' '. g:syntastic_erlc_include_path + let args = s:check_file + let post_args = g:syntastic_erlc_include_path endif + let makeprg = syntastic#makeprg#build({ + \ 'exe': 'escript', + \ 'args': args, + \ 'fname': syntastic#util#shexpand('%:p'), + \ 'post_args': post_args, + \ 'filetype': 'erlang', + \ 'subchecker': 'escript' }) + let errorformat = - \ '%f:%l:\ %tarning:\ %m,'. - \ '%E%f:%l:\ %m' + \ '%W%f:%l: warning: %m,'. + \ '%E%f:%l: %m' - return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ From cac85990d8e2b98b3f44d3b5ea541304b4faee90 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Mon, 30 Sep 2013 14:52:36 +0300 Subject: [PATCH 0202/1271] Rename erlang.vim --> escript.vim. --- syntax_checkers/erlang/{erlang.vim => escript.vim} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename syntax_checkers/erlang/{erlang.vim => escript.vim} (100%) diff --git a/syntax_checkers/erlang/erlang.vim b/syntax_checkers/erlang/escript.vim similarity index 100% rename from syntax_checkers/erlang/erlang.vim rename to syntax_checkers/erlang/escript.vim From b60c407fb8d4ac304e1e7d118c393be12381cdd2 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Tue, 1 Oct 2013 19:53:11 +0300 Subject: [PATCH 0203/1271] Add a pointer to the wiki page for more docs. --- doc/syntastic.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/syntastic.txt b/doc/syntastic.txt index 24fa57c24..34de017b3 100644 --- a/doc/syntastic.txt +++ b/doc/syntastic.txt @@ -446,8 +446,8 @@ The general form of the override options is: > For checkers that do not use the 'syntastic#makeprg#build()' function you will have to look at the source code of the checker in question. If there are -specific options that can be set, these are usually documented at the top of -the script. +specific options that can be set, these are usually documented in the wiki: +https://github.com/scrooloose/syntastic/wiki/Syntaxcheckers ============================================================================== 6. About *syntastic-about* From 98ada2d61008cc7bb69cd0a074527e4ed5c83433 Mon Sep 17 00:00:00 2001 From: Jeremy Mack Date: Wed, 2 Oct 2013 22:56:26 -0400 Subject: [PATCH 0204/1271] Handlebars support --- syntax_checkers/handlebars/handlebars.vim | 40 +++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 syntax_checkers/handlebars/handlebars.vim diff --git a/syntax_checkers/handlebars/handlebars.vim b/syntax_checkers/handlebars/handlebars.vim new file mode 100644 index 000000000..a15cd06c1 --- /dev/null +++ b/syntax_checkers/handlebars/handlebars.vim @@ -0,0 +1,40 @@ +"============================================================================ +"File: handlebars.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:loaded_syntastic_handlebars_handlebars_checker") + finish +endif +let g:loaded_syntastic_handlebars_handlebars_checker=1 + +function! SyntaxCheckers_handlebars_handlebars_IsAvailable() + return executable('handlebars') +endfunction + +function! SyntaxCheckers_handlebars_handlebars_GetLocList() + let makeprg = syntastic#makeprg#build({ + \ 'exe': 'handlebars', + \ 'filetype': 'handlebars', + \ 'subchecker': 'handlebars' }) + + let errorformat = + \ 'Error: %m on line %l:,'. + \ '%-Z%p^,' . + \ "Error: %m,". + \ '%-Z%p^,' . + \ '%-G' + + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat }) +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'handlebars', + \ 'name': 'handlebars'}) From 2043ffdc981d5a6d956c847e47dc745b533f16b9 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Thu, 3 Oct 2013 10:16:30 +0300 Subject: [PATCH 0205/1271] Add Handlebars to the list of supported languages. --- README.markdown | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.markdown b/README.markdown index 1c2766f35..bca40f7ee 100644 --- a/README.markdown +++ b/README.markdown @@ -26,10 +26,10 @@ user is notified and is happy because they didn't have to compile their code or execute their script to find them. At the time of this writing, syntax checking plugins exist for Ada, -AppleScript, AsciiDoc, Bourne shell, C, C++, C#, CoffeeScript, Coco, Coq, -CSS, Cucumber, CUDA, D, Dart, DocBook, Dust, Elixir, Erlang, eRuby, Fortran, -Gentoo metadata, Go, Haml, Haskell, Haxe, HSS, HTML, Java, JavaScript, JSON, -LESS, LISP, LLVM intermediate language, Lua, MATLAB, NASM, Objective-C, +AppleScript, AsciiDoc, Bourne shell, C, C++, C#, CoffeeScript, Coco, Coq, CSS, +Cucumber, CUDA, D, Dart, DocBook, Dust, Elixir, Erlang, eRuby, Fortran, Gentoo +metadata, Go, Haml, Haskell, Haxe, Handlebars, HSS, HTML, Java, JavaScript, +JSON, LESS, LISP, LLVM intermediate language, Lua, MATLAB, NASM, Objective-C, Objective-C++, OCaml, Perl, Perl POD, PHP, Puppet, Python, reStructuredText, Ruby, Rust, SASS/SCSS, Scala, Slim, Tcl, TeX, Twig, TypeScript, Vala, Verilog, VHDL, xHtml, XML, XSLT, YAML, z80, Zope page templates, zsh. From ca0318db694a96aa5100e4fb371258358bae2929 Mon Sep 17 00:00:00 2001 From: Jeremy Mack Date: Thu, 3 Oct 2013 10:02:12 -0400 Subject: [PATCH 0206/1271] Fix wiki link --- README.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.markdown b/README.markdown index bca40f7ee..682c8ea06 100644 --- a/README.markdown +++ b/README.markdown @@ -162,7 +162,7 @@ If you use these commands a lot then you may want to add shortcut mappings to yo __Q. A syntax checker is giving me unwanted/strange style tips?__ -A. Some filetypes (e.g. php) have style checkers as well as syntax checkers. You can usually configure the options that are passed to the style checkers, or just disable them. Take a look at the [wiki](https://github.com/scrooloose/syntastic/wiki/Syntaxcheckers) to see what options are available. +A. Some filetypes (e.g. php) have style checkers as well as syntax checkers. You can usually configure the options that are passed to the style checkers, or just disable them. Take a look at the [wiki](https://github.com/scrooloose/syntastic/wiki/Syntax-Checkers) to see what options are available. __Q. The error window is closed automatically when I :quit the current buffer but not when I :bdelete it?__ From 099d935f82c2f4f5b8968686124076bdbf078263 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Tue, 8 Oct 2013 18:24:14 +0300 Subject: [PATCH 0207/1271] Deal with more pylint versioning creativity. --- syntax_checkers/python/pylint.vim | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/syntax_checkers/python/pylint.vim b/syntax_checkers/python/pylint.vim index 7b2f36282..016f8e014 100644 --- a/syntax_checkers/python/pylint.vim +++ b/syntax_checkers/python/pylint.vim @@ -51,8 +51,10 @@ endfunction function s:PylintNew() try - " On Windows the version is shown as "pylint-script.py 1.0.0" - let pylint_version = filter(split(system('pylint --version'), '\m, \=\|\n'), 'v:val =~# ''\m^pylint\(-script\.py\)\= ''')[0] + " On Windows the version is shown as "pylint-script.py 1.0.0". + " On Gentoo Linux it's "pylint-python2.7 0.28.0". Oh, joy. :) + let pylint_version = filter(split(system('pylint --version'), '\m, \=\|\n'), 'v:val =~# ''\m^pylint\>''')[0] + let pylint_version = substitute(pylint_version, '\v^\S+\s+', '', '') let ret = syntastic#util#versionIsAtLeast(syntastic#util#parseVersion(pylint_version), [1]) catch /^Vim\%((\a\+)\)\=:E684/ call syntastic#util#error("checker python/pylint: can't parse version string (abnormal termination?)") From 4c609b0fa980361756e443b688b1d16fbd09f72e Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Thu, 10 Oct 2013 19:26:44 +0300 Subject: [PATCH 0208/1271] The html/validator checker chokes on empty lines in curl output. --- syntax_checkers/html/validator.vim | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/syntax_checkers/html/validator.vim b/syntax_checkers/html/validator.vim index 04666354f..745fa74b2 100644 --- a/syntax_checkers/html/validator.vim +++ b/syntax_checkers/html/validator.vim @@ -52,24 +52,26 @@ function! SyntaxCheckers_html_validator_IsAvailable() endfunction function! SyntaxCheckers_html_validator_Preprocess(errors) - let out = copy(a:errors) - for n in range(len(out)) - let parts = matchlist(out[n], '\v^"([^"]+)"(.+)') - " URL decode, except leave alone any "+" - let parts[1] = substitute(parts[1], '\m%\(\x\x\)', '\=nr2char("0x".submatch(1))', 'g') - let parts[1] = substitute(parts[1], '\\"', '"', 'g') - let parts[1] = substitute(parts[1], '\\\\', '\\', 'g') - let out[n] = '"' . parts[1] . '"' . parts[2] + let out = [] + for e in a:errors + let parts = matchlist(e, '\v^"([^"]+)"(.+)') + if len(parts) >= 3 + " URL decode, except leave alone any "+" + let parts[1] = substitute(parts[1], '\m%\(\x\x\)', '\=nr2char("0x".submatch(1))', 'g') + let parts[1] = substitute(parts[1], '\\"', '"', 'g') + let parts[1] = substitute(parts[1], '\\\\', '\\', 'g') + call add(out, '"' . parts[1] . '"' . parts[2]) + endif endfor return out endfunction function! SyntaxCheckers_html_validator_GetLocList() + let fname = syntastic#util#shexpand('%') let makeprg = 'curl -s --compressed -F out=gnu -F asciiquotes=yes' . \ (!empty(g:syntastic_html_validator_parser) ? ' -F parser=' . g:syntastic_html_validator_parser : '') . \ (!empty(g:syntastic_html_validator_nsfilter) ? ' -F nsfilter=' . g:syntastic_html_validator_nsfilter : '') . - \ ' -F doc=@' . syntastic#util#shexpand('%') . '\;type=text/html\;filename=' . syntastic#util#shexpand('%') . ' ' . - \ g:syntastic_html_validator_api + \ ' -F doc=@' . fname . '\;type=text/html\;filename=' . fname . ' ' . g:syntastic_html_validator_api let errorformat = \ '%E"%f":%l: %trror: %m,' . From 63cca964c2008db025eb4e0c66ae1e19841e949e Mon Sep 17 00:00:00 2001 From: "Ireton, Doug" Date: Wed, 16 Oct 2013 22:17:26 -0700 Subject: [PATCH 0209/1271] Add foodcritic syntax checker for Chef files Requires a ftdetect plugin to set filetype to chef or ruby.chef, e.g. vim-chef (https://github.com/dougireton/vim-chef) --- syntax_checkers/chef/foodcritic.vim | 35 +++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 syntax_checkers/chef/foodcritic.vim diff --git a/syntax_checkers/chef/foodcritic.vim b/syntax_checkers/chef/foodcritic.vim new file mode 100644 index 000000000..83901270d --- /dev/null +++ b/syntax_checkers/chef/foodcritic.vim @@ -0,0 +1,35 @@ +"============================================================================ +"File: foodcritic.vim +"Description: Syntax checking plugin for syntastic.vim +"Maintainer: Doug Ireton +"License: This program is free software. It comes without any warranty, +" to the extent permitted by applicable law. You can redistribute +" it and/or modify it under the terms of the Do What The Fuck You +" Want To Public License, Version 2, as published by Sam Hocevar. +" See http://sam.zoy.org/wtfpl/COPYING for more details. +" +"============================================================================ + +if exists("g:loaded_syntastic_chef_foodcritic_checker") + finish +endif +let g:loaded_syntastic_chef_foodcritic_checker=1 + +function! SyntaxCheckers_chef_foodcritic_IsAvailable() + return executable('foodcritic') +endfunction + +function! SyntaxCheckers_chef_foodcritic_GetLocList() + let makeprg = syntastic#makeprg#build({ + \ 'exe': 'foodcritic', + \ 'args': '' }) + + " FC023: Prefer conditional attributes: ./recipes/config.rb:49 + let errorformat = 'FC%n: %m: %f:%l' + + return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'chef', + \ 'name': 'foodcritic'}) From 7c7714026d0644786fabbfd59d623e6f1405fce8 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Thu, 17 Oct 2013 14:23:03 +0300 Subject: [PATCH 0210/1271] Minor help re-wording. --- doc/syntastic.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/syntastic.txt b/doc/syntastic.txt index 34de017b3..86cb68a9b 100644 --- a/doc/syntastic.txt +++ b/doc/syntastic.txt @@ -365,8 +365,8 @@ If the buffer had 2 warnings, starting on line 5 then this would appear: > Default: 0 in GUI Vim and MacVim, 1 otherwise Controls whether syntastic calls |:redraw| or |:redraw!| for screen redraws. Changing it can in principle make screen redraws smoother, but it can also -cause screen flicker, or ghost characters. Leaving it to the default should -be safe. +cause screen to flicker, or cause ghost characters. Leaving it to the default +should be safe. *'syntastic_debug'* Default: 0 From ae7e5bf19c1d848a3a331a940d3c934bacd8d7f6 Mon Sep 17 00:00:00 2001 From: "Ireton, Doug" Date: Thu, 17 Oct 2013 06:22:44 -0700 Subject: [PATCH 0211/1271] Add filetype and subchecker args to foodcritic makeprg --- syntax_checkers/chef/foodcritic.vim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/syntax_checkers/chef/foodcritic.vim b/syntax_checkers/chef/foodcritic.vim index 83901270d..0808137bf 100644 --- a/syntax_checkers/chef/foodcritic.vim +++ b/syntax_checkers/chef/foodcritic.vim @@ -22,7 +22,8 @@ endfunction function! SyntaxCheckers_chef_foodcritic_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'foodcritic', - \ 'args': '' }) + \ 'filetype': 'chef', + \ 'subchecker': 'foodcritic' }) " FC023: Prefer conditional attributes: ./recipes/config.rb:49 let errorformat = 'FC%n: %m: %f:%l' From 0137263e09a078fe2c5155512305a63e57e0c645 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Thu, 17 Oct 2013 19:57:31 +0300 Subject: [PATCH 0212/1271] Added Chef to the list of supported languages. --- README.markdown | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/README.markdown b/README.markdown index 682c8ea06..c88cdfd97 100644 --- a/README.markdown +++ b/README.markdown @@ -26,13 +26,14 @@ user is notified and is happy because they didn't have to compile their code or execute their script to find them. At the time of this writing, syntax checking plugins exist for Ada, -AppleScript, AsciiDoc, Bourne shell, C, C++, C#, CoffeeScript, Coco, Coq, CSS, -Cucumber, CUDA, D, Dart, DocBook, Dust, Elixir, Erlang, eRuby, Fortran, Gentoo -metadata, Go, Haml, Haskell, Haxe, Handlebars, HSS, HTML, Java, JavaScript, -JSON, LESS, LISP, LLVM intermediate language, Lua, MATLAB, NASM, Objective-C, -Objective-C++, OCaml, Perl, Perl POD, PHP, Puppet, Python, reStructuredText, -Ruby, Rust, SASS/SCSS, Scala, Slim, Tcl, TeX, Twig, TypeScript, Vala, Verilog, -VHDL, xHtml, XML, XSLT, YAML, z80, Zope page templates, zsh. +AppleScript, AsciiDoc, Bourne shell, C, C++, C#, Chef, CoffeeScript, Coco, +Coq, CSS, Cucumber, CUDA, D, Dart, DocBook, Dust, Elixir, Erlang, eRuby, +Fortran, Gentoo metadata, Go, Haml, Haskell, Haxe, Handlebars, HSS, HTML, +Java, JavaScript, JSON, LESS, LISP, LLVM intermediate language, Lua, MATLAB, +NASM, Objective-C, Objective-C++, OCaml, Perl, Perl POD, PHP, Puppet, Python, +reStructuredText, Ruby, Rust, SASS/SCSS, Scala, Slim, Tcl, TeX, Twig, +TypeScript, Vala, Verilog, VHDL, xHtml, XML, XSLT, YAML, z80, Zope page +templates, zsh. ## Screenshot From 6c4a58a7274c4bbe780aa2c078e9a7bf6f6356fa Mon Sep 17 00:00:00 2001 From: Yorick Peterse Date: Mon, 21 Oct 2013 23:53:31 +0200 Subject: [PATCH 0213/1271] Added a syntax checker for ruby-lint. ruby-lint is a linter for Ruby, see https://github.com/YorickPeterse/ruby-lint for more information. --- syntax_checkers/ruby/rubylint.vim | 41 +++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 syntax_checkers/ruby/rubylint.vim diff --git a/syntax_checkers/ruby/rubylint.vim b/syntax_checkers/ruby/rubylint.vim new file mode 100644 index 000000000..0ee89f551 --- /dev/null +++ b/syntax_checkers/ruby/rubylint.vim @@ -0,0 +1,41 @@ +"============================================================================ +"File: rubylint.vim +"Description: Checks Ruby source code using ruby-lint +"Maintainer: Yorick Peterse +"License: This program is free software. It comes without any warranty, +" to the extent permitted by applicable law. You can redistribute +" it and/or modify it under the terms of the Do What The Fuck You +" Want To Public License, Version 2, as published by Sam Hocevar. +" See http://sam.zoy.org/wtfpl/COPYING for more details. +" +"============================================================================ + +if exists("g:loaded_syntastic_ruby_rubylint_checker") + finish +endif + +let g:loaded_syntastic_ruby_rubylint_checker = 1 + +function! SyntaxCheckers_ruby_rubylint_IsAvailable() + return executable("ruby-lint") +endfunction + +function! SyntaxCheckers_ruby_rubylint_GetLocList() + let makeprg = syntastic#makeprg#build({ + \ 'exe': 'ruby-lint', + \ 'args': 'analyze --presenter=syntastic', + \ 'filetype': 'ruby', + \ 'subchecker': 'rubylint'}) + + let errorformat = '%f:%t:%l:%c: %m' + + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat }) +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'ruby', + \ 'name': 'rubylint' }) + +" vim: set ts=4 sts=4 sw=4: From 99dabda2f187a07086fa05152fc4463b14adf00f Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Wed, 23 Oct 2013 12:59:23 +0300 Subject: [PATCH 0214/1271] Fix unwanted filter() and map() side effects. Minor cleanup. --- autoload/syntastic/c.vim | 2 +- plugin/syntastic/modemap.vim | 4 ++-- syntax_checkers/c/make.vim | 9 ++++----- syntax_checkers/dustjs/swiffer.vim | 18 ++++++++++-------- syntax_checkers/perl/perl.vim | 4 ++-- syntax_checkers/ruby/rubylint.vim | 2 +- syntax_checkers/sh/checkbashisms.vim | 4 ++-- syntax_checkers/sh/sh.vim | 6 +++--- 8 files changed, 25 insertions(+), 24 deletions(-) diff --git a/autoload/syntastic/c.vim b/autoload/syntastic/c.vim index 0784a23b9..5da45c82b 100644 --- a/autoload/syntastic/c.vim +++ b/autoload/syntastic/c.vim @@ -217,7 +217,7 @@ function! s:SearchHeaders() continue endtry - let lines = filter(lines, 'v:val =~# "^\s*#\s*include"') + call filter(lines, 'v:val =~# "^\s*#\s*include"') for handler in s:handlers if index(found, handler["regex"]) != -1 diff --git a/plugin/syntastic/modemap.vim b/plugin/syntastic/modemap.vim index 2a838883b..0d039dfc3 100644 --- a/plugin/syntastic/modemap.vim +++ b/plugin/syntastic/modemap.vim @@ -57,11 +57,11 @@ function! g:SyntasticModeMap._initModeMapFromGlobalOpts() endfunction function! g:SyntasticModeMap._isOneFiletypeActive(filetypes) - return !empty(filter(a:filetypes, 'index(self._activeFiletypes, v:val) != -1')) + return !empty(filter(copy(a:filetypes), 'index(self._activeFiletypes, v:val) != -1')) endfunction function! g:SyntasticModeMap._noFiletypesArePassive(filetypes) - return empty(filter(a:filetypes, 'index(self._passiveFiletypes, v:val) != -1')) + return empty(filter(copy(a:filetypes), 'index(self._passiveFiletypes, v:val) != -1')) endfunction " vim: set sw=4 sts=4 et fdm=marker: diff --git a/syntax_checkers/c/make.vim b/syntax_checkers/c/make.vim index a0ccbf616..5fb2a848d 100644 --- a/syntax_checkers/c/make.vim +++ b/syntax_checkers/c/make.vim @@ -44,14 +44,13 @@ function! SyntaxCheckers_c_make_GetLocList() endif " process makeprg - let errors = SyntasticMake({ 'makeprg': makeprg, + let errors = SyntasticMake({ + \ 'makeprg': makeprg, \ 'errorformat': errorformat }) " filter the processed errors if desired - if exists('g:syntastic_c_remove_include_errors') && - \ g:syntastic_c_remove_include_errors != 0 - return filter(errors, - \ 'has_key(v:val, "bufnr") && v:val["bufnr"]=='.bufnr('')) + if exists('g:syntastic_c_remove_include_errors') && g:syntastic_c_remove_include_errors != 0 + return filter(errors, 'has_key(v:val, "bufnr") && v:val["bufnr"] == ' . bufnr('')) else return errors endif diff --git a/syntax_checkers/dustjs/swiffer.vim b/syntax_checkers/dustjs/swiffer.vim index addaa6f67..466a4999f 100644 --- a/syntax_checkers/dustjs/swiffer.vim +++ b/syntax_checkers/dustjs/swiffer.vim @@ -16,18 +16,20 @@ endif let g:loaded_syntastic_dustjs_swiffer_checker = 1 function! SyntaxCheckers_dustjs_swiffer_IsAvailable() - return executable("swiffer") + return executable('swiffer') endfunction function! SyntaxCheckers_dustjs_swiffer_GetLocList() - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'swiffer', - \ 'subchecker': 'swiffer', - \ 'filetype': 'dustjs' }) - let errorformat = '%E%f - Line %l\, Column %c: %m' - let loclist = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) + let makeprg = syntastic#makeprg#build({ + \ 'exe': 'swiffer', + \ 'subchecker': 'swiffer', + \ 'filetype': 'dustjs' }) - return loclist + let errorformat = '%E%f - Line %l\, Column %c: %m' + + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat }) endfunction call SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/syntax_checkers/perl/perl.vim b/syntax_checkers/perl/perl.vim index 705ec92f2..029f4354a 100644 --- a/syntax_checkers/perl/perl.vim +++ b/syntax_checkers/perl/perl.vim @@ -56,13 +56,13 @@ function! SyntaxCheckers_perl_perl_GetLocList() call syntastic#util#deprecationWarn('variable g:syntastic_perl_lib_path should be a list') let includes = split(g:syntastic_perl_lib_path, ',') else - let includes = exists('b:syntastic_perl_lib_path') ? b:syntastic_perl_lib_path : g:syntastic_perl_lib_path + let includes = copy(exists('b:syntastic_perl_lib_path') ? b:syntastic_perl_lib_path : g:syntastic_perl_lib_path) endif let shebang = syntastic#util#parseShebang() let extra = join(map(includes, '"-I" . v:val')) . \ (index(shebang['args'], '-T') >= 0 ? ' -T' : '') . \ (index(shebang['args'], '-t') >= 0 ? ' -t' : '') - let errorformat = '%f:%l:%m' + let errorformat = '%f:%l:%m' let makeprg = syntastic#makeprg#build({ \ 'exe': g:syntastic_perl_interpreter, diff --git a/syntax_checkers/ruby/rubylint.vim b/syntax_checkers/ruby/rubylint.vim index 0ee89f551..5b914f43e 100644 --- a/syntax_checkers/ruby/rubylint.vim +++ b/syntax_checkers/ruby/rubylint.vim @@ -25,7 +25,7 @@ function! SyntaxCheckers_ruby_rubylint_GetLocList() \ 'exe': 'ruby-lint', \ 'args': 'analyze --presenter=syntastic', \ 'filetype': 'ruby', - \ 'subchecker': 'rubylint'}) + \ 'subchecker': 'rubylint' }) let errorformat = '%f:%t:%l:%c: %m' diff --git a/syntax_checkers/sh/checkbashisms.vim b/syntax_checkers/sh/checkbashisms.vim index 9fb1f7aec..d99a05ea7 100644 --- a/syntax_checkers/sh/checkbashisms.vim +++ b/syntax_checkers/sh/checkbashisms.vim @@ -36,10 +36,10 @@ function! SyntaxCheckers_sh_checkbashisms_GetLocList() return SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, - \ 'subtype': 'Style'}) + \ 'subtype': 'Style' }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'sh', - \ 'name': 'checkbashisms'}) + \ 'name': 'checkbashisms' }) diff --git a/syntax_checkers/sh/sh.vim b/syntax_checkers/sh/sh.vim index 8c44960b8..f1fb0686f 100644 --- a/syntax_checkers/sh/sh.vim +++ b/syntax_checkers/sh/sh.vim @@ -69,15 +69,15 @@ function! SyntaxCheckers_sh_sh_GetLocList() \ 'exe': s:GetShell(), \ 'args': '-n', \ 'filetype': 'sh', - \ 'subchecker': 'sh'}) + \ 'subchecker': 'sh' }) let errorformat = '%f: line %l: %m' return SyntasticMake({ \ 'makeprg': makeprg, - \ 'errorformat': errorformat}) + \ 'errorformat': errorformat }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'sh', - \ 'name': 'sh'}) + \ 'name': 'sh' }) From 41c2e68f33754faa86bb0962da1cd59668e13c9f Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 25 Oct 2013 15:08:41 +0300 Subject: [PATCH 0215/1271] Remove leftovers from the latest validator refactor. --- syntax_checkers/html/validator.vim | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/syntax_checkers/html/validator.vim b/syntax_checkers/html/validator.vim index 745fa74b2..fd45d3e6c 100644 --- a/syntax_checkers/html/validator.vim +++ b/syntax_checkers/html/validator.vim @@ -45,10 +45,8 @@ if !exists('g:syntastic_html_validator_nsfilter') let g:syntastic_html_validator_nsfilter = '' endif -let s:decoder = 'awk -f ' . syntastic#util#shescape(expand(':p:h') . '/validator_decode.awk') - function! SyntaxCheckers_html_validator_IsAvailable() - return executable('curl') && executable('awk') + return executable('curl') endfunction function! SyntaxCheckers_html_validator_Preprocess(errors) From 569faa6016130979ae9ed4f63e39da0253ff64b5 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 25 Oct 2013 15:46:16 +0300 Subject: [PATCH 0216/1271] Try to avoid fun with magic / nomagic by qualifying regexps. --- autoload/syntastic/c.vim | 12 +++++----- autoload/syntastic/postprocess.vim | 2 +- autoload/syntastic/util.vim | 16 +++++++------- plugin/syntastic.vim | 20 ++++++++--------- plugin/syntastic/modemap.vim | 2 +- plugin/syntastic/notifiers.vim | 6 ++--- plugin/syntastic/registry.vim | 2 +- syntax_checkers/css/prettycss.vim | 2 +- syntax_checkers/html/validator.vim | 4 ++-- syntax_checkers/html/w3.vim | 2 +- syntax_checkers/java/checkstyle.vim | 4 ++-- syntax_checkers/java/javac.vim | 10 ++++----- syntax_checkers/javascript/jslint.vim | 2 +- syntax_checkers/lua/luac.vim | 4 ++-- syntax_checkers/php/php.vim | 2 +- syntax_checkers/php/phpmd.vim | 32 +++++++++++++-------------- syntax_checkers/text/atdtool.vim | 2 +- syntax_checkers/vala/valac.vim | 4 ++-- 18 files changed, 64 insertions(+), 64 deletions(-) diff --git a/autoload/syntastic/c.vim b/autoload/syntastic/c.vim index 5da45c82b..e502a53cb 100644 --- a/autoload/syntastic/c.vim +++ b/autoload/syntastic/c.vim @@ -38,15 +38,15 @@ function! syntastic#c#ReadConfig(file) call filter(lines, 'v:val !~ ''\v^(\s*#|$)''') " remove leading and trailing spaces - call map(lines, 'substitute(v:val, ''^\s\+'', "", "")') - call map(lines, 'substitute(v:val, ''\s\+$'', "", "")') + call map(lines, 'substitute(v:val, ''\m^\s\+'', "", "")') + call map(lines, 'substitute(v:val, ''\m\s\+$'', "", "")') let parameters = [] for line in lines - let matches = matchlist(line, '\C^\s*-I\s*\(\S\+\)') + let matches = matchlist(line, '\m\C^\s*-I\s*\(\S\+\)') if matches != [] && matches[1] != '' " this one looks like an absolute path - if match(matches[1], '^\%(/\|\a:\)') != -1 + if match(matches[1], '\m^\%(/\|\a:\)') != -1 call add(parameters, '-I' . matches[1]) else call add(parameters, '-I' . filepath . syntastic#util#Slash() . matches[1]) @@ -187,11 +187,11 @@ function! s:SearchHeaders() let includes = '' let files = [] let found = [] - let lines = filter(getline(1, 100), 'v:val =~# "^\s*#\s*include"') + let lines = filter(getline(1, 100), 'v:val =~# ''\m^\s*#\s*include''') " search current buffer for line in lines - let file = matchstr(line, '"\zs\S\+\ze"') + let file = matchstr(line, '\m"\zs\S\+\ze"') if file != '' call add(files, file) continue diff --git a/autoload/syntastic/postprocess.vim b/autoload/syntastic/postprocess.vim index 65e98573a..e1f62e8a0 100644 --- a/autoload/syntastic/postprocess.vim +++ b/autoload/syntastic/postprocess.vim @@ -31,7 +31,7 @@ function syntastic#postprocess#compressWhitespace(errors) for e in a:errors let e['text'] = substitute(e['text'], "\001", '', 'g') let e['text'] = substitute(e['text'], '\n', ' ', 'g') - let e['text'] = substitute(e['text'], '\s\{2,}', ' ', 'g') + let e['text'] = substitute(e['text'], '\m\s\{2,}', ' ', 'g') call add(llist, e) endfor diff --git a/autoload/syntastic/util.vim b/autoload/syntastic/util.vim index 3e27d0939..736be0c33 100644 --- a/autoload/syntastic/util.vim +++ b/autoload/syntastic/util.vim @@ -39,8 +39,8 @@ function! syntastic#util#parseShebang() let line = getline(lnum) if line =~ '^#!' - let exe = matchstr(line, '^#!\s*\zs[^ \t]*') - let args = split(matchstr(line, '^#!\s*[^ \t]*\zs.*')) + let exe = matchstr(line, '\m^#!\s*\zs[^ \t]*') + let args = split(matchstr(line, '\m^#!\s*[^ \t]*\zs.*')) return {'exe': exe, 'args': args} endif endfor @@ -50,7 +50,7 @@ endfunction " Parse a version string. Return an array of version components. function! syntastic#util#parseVersion(version) - return split(matchstr( a:version, '\v^\D*\zs\d+(\.\d+)+\ze' ), '\.') + return split(matchstr( a:version, '\v^\D*\zs\d+(\.\d+)+\ze' ), '\m\.') endfunction " Run 'command' in a shell and parse output as a version string. @@ -177,11 +177,11 @@ endfunction " decode XML entities function! syntastic#util#decodeXMLEntities(string) let str = a:string - let str = substitute(str, '<', '<', 'g') - let str = substitute(str, '>', '>', 'g') - let str = substitute(str, '"', '"', 'g') - let str = substitute(str, ''', "'", 'g') - let str = substitute(str, '&', '\&', 'g') + let str = substitute(str, '\m<', '<', 'g') + let str = substitute(str, '\m>', '>', 'g') + let str = substitute(str, '\m"', '"', 'g') + let str = substitute(str, '\m'', "'", 'g') + let str = substitute(str, '\m&', '\&', 'g') return str endfunction diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index ffd5e0ff9..ac4f6d7a5 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -179,7 +179,7 @@ function! s:ClearCache() endfunction function! s:CurrentFiletypes() - return split(&filetype, '\.') + return split(&filetype, '\m\.') endfunction "detect and cache all syntax errors in this buffer @@ -324,28 +324,28 @@ function! SyntasticStatuslineFlag() let output = g:syntastic_stl_format "hide stuff wrapped in %E(...) unless there are errors - let output = substitute(output, '\C%E{\([^}]*\)}', num_errors ? '\1' : '' , 'g') + let output = substitute(output, '\m\C%E{\([^}]*\)}', num_errors ? '\1' : '' , 'g') "hide stuff wrapped in %W(...) unless there are warnings - let output = substitute(output, '\C%W{\([^}]*\)}', num_warnings ? '\1' : '' , 'g') + let output = substitute(output, '\m\C%W{\([^}]*\)}', num_warnings ? '\1' : '' , 'g') "hide stuff wrapped in %B(...) unless there are both errors and warnings - let output = substitute(output, '\C%B{\([^}]*\)}', (num_warnings && num_errors) ? '\1' : '' , 'g') + let output = substitute(output, '\m\C%B{\([^}]*\)}', (num_warnings && num_errors) ? '\1' : '' , 'g') "sub in the total errors/warnings/both - let output = substitute(output, '\C%w', num_warnings, 'g') - let output = substitute(output, '\C%e', num_errors, 'g') - let output = substitute(output, '\C%t', num_issues, 'g') + let output = substitute(output, '\m\C%w', num_warnings, 'g') + let output = substitute(output, '\m\C%e', num_errors, 'g') + let output = substitute(output, '\m\C%t', num_issues, 'g') "first error/warning line num - let output = substitute(output, '\C%F', num_issues ? issues[0]['lnum'] : '', 'g') + let output = substitute(output, '\m\C%F', num_issues ? issues[0]['lnum'] : '', 'g') "first error line num - let output = substitute(output, '\C%fe', num_errors ? errors[0]['lnum'] : '', 'g') + let output = substitute(output, '\m\C%fe', num_errors ? errors[0]['lnum'] : '', 'g') "first warning line num - let output = substitute(output, '\C%fw', num_warnings ? warnings[0]['lnum'] : '', 'g') + let output = substitute(output, '\m\C%fw', num_warnings ? warnings[0]['lnum'] : '', 'g') return output else diff --git a/plugin/syntastic/modemap.vim b/plugin/syntastic/modemap.vim index 0d039dfc3..b16e177b1 100644 --- a/plugin/syntastic/modemap.vim +++ b/plugin/syntastic/modemap.vim @@ -17,7 +17,7 @@ function! g:SyntasticModeMap.Instance() endfunction function! g:SyntasticModeMap.allowsAutoChecking(filetype) - let fts = split(a:filetype, '\.') + let fts = split(a:filetype, '\m\.') if self.isPassive() return self._isOneFiletypeActive(fts) diff --git a/plugin/syntastic/notifiers.vim b/plugin/syntastic/notifiers.vim index 12f41445d..645aa6690 100644 --- a/plugin/syntastic/notifiers.vim +++ b/plugin/syntastic/notifiers.vim @@ -20,7 +20,7 @@ endfunction function! g:SyntasticNotifiers.refresh(loclist) for type in self._enabled_types - let class = substitute(type, '.*', 'Syntastic\u&Notifier', '') + let class = substitute(type, '\m.*', 'Syntastic\u&Notifier', '') if !has_key(g:{class}, 'enabled') || self._notifier[type].enabled() call self._notifier[type].refresh(a:loclist) endif @@ -29,7 +29,7 @@ endfunction function! g:SyntasticNotifiers.reset(loclist) for type in self._enabled_types - let class = substitute(type, '.*', 'Syntastic\u&Notifier', '') + let class = substitute(type, '\m.*', 'Syntastic\u&Notifier', '') " reset notifiers regardless if they are enabled or not, since " the user might have disabled them since the last refresh(); @@ -45,7 +45,7 @@ endfunction function! g:SyntasticNotifiers._initNotifiers() let self._notifier = {} for type in s:notifier_types - let class = substitute(type, '.*', 'Syntastic\u&Notifier', '') + let class = substitute(type, '\m.*', 'Syntastic\u&Notifier', '') let self._notifier[type] = g:{class}.New() endfor diff --git a/plugin/syntastic/registry.vim b/plugin/syntastic/registry.vim index b1742c68f..1019ab223 100644 --- a/plugin/syntastic/registry.vim +++ b/plugin/syntastic/registry.vim @@ -207,7 +207,7 @@ endfunction function! s:SyntasticRegistryNormaliseFiletype(ftalias) let ft = get(s:defaultFiletypeMap, a:ftalias, a:ftalias) let ft = get(g:syntastic_filetype_map, ft, ft) - let ft = substitute(ft, '-', '_', 'g') + let ft = substitute(ft, '\m-', '_', 'g') return ft endfunction diff --git a/syntax_checkers/css/prettycss.vim b/syntax_checkers/css/prettycss.vim index c3cd9de1a..efc549a71 100644 --- a/syntax_checkers/css/prettycss.vim +++ b/syntax_checkers/css/prettycss.vim @@ -25,7 +25,7 @@ function! SyntaxCheckers_css_prettycss_IsAvailable() endfunction function! SyntaxCheckers_css_prettycss_GetHighlightRegex(item) - let term = matchstr(a:item["text"], ' (\zs[^)]\+\ze)$') + let term = matchstr(a:item["text"], '\m (\zs[^)]\+\ze)$') if term != '' let term = '\V' . term endif diff --git a/syntax_checkers/html/validator.vim b/syntax_checkers/html/validator.vim index fd45d3e6c..d26f7c0e9 100644 --- a/syntax_checkers/html/validator.vim +++ b/syntax_checkers/html/validator.vim @@ -56,8 +56,8 @@ function! SyntaxCheckers_html_validator_Preprocess(errors) if len(parts) >= 3 " URL decode, except leave alone any "+" let parts[1] = substitute(parts[1], '\m%\(\x\x\)', '\=nr2char("0x".submatch(1))', 'g') - let parts[1] = substitute(parts[1], '\\"', '"', 'g') - let parts[1] = substitute(parts[1], '\\\\', '\\', 'g') + let parts[1] = substitute(parts[1], '\m\\"', '"', 'g') + let parts[1] = substitute(parts[1], '\m\\\\', '\\', 'g') call add(out, '"' . parts[1] . '"' . parts[2]) endif endfor diff --git a/syntax_checkers/html/w3.vim b/syntax_checkers/html/w3.vim index 01c413cc5..94aa650cf 100644 --- a/syntax_checkers/html/w3.vim +++ b/syntax_checkers/html/w3.vim @@ -53,7 +53,7 @@ function! SyntaxCheckers_html_w3_GetLocList() \ 'returns': [0] }) for n in range(len(loclist)) - let loclist[n]['text'] = substitute(loclist[n]['text'], '\\\([\"]\)', '\1', 'g') + let loclist[n]['text'] = substitute(loclist[n]['text'], '\m\\\([\"]\)', '\1', 'g') endfor return loclist diff --git a/syntax_checkers/java/checkstyle.vim b/syntax_checkers/java/checkstyle.vim index da5aa0194..058d44f95 100644 --- a/syntax_checkers/java/checkstyle.vim +++ b/syntax_checkers/java/checkstyle.vim @@ -30,7 +30,7 @@ endfunction function! SyntaxCheckers_java_checkstyle_Preprocess(errors) let out = copy(a:errors) for n in range(len(out)) - let parts = matchlist(out[n], '\(.*.*\)') + let parts = matchlist(out[n], '\m\(.*.*\)') if len(parts) >= 4 let parts[2] = syntastic#util#decodeXMLEntities(parts[2]) let out[n] = join(parts[1:3], '') @@ -44,7 +44,7 @@ function! SyntaxCheckers_java_checkstyle_GetLocList() let fname = syntastic#util#shescape( expand('%:p:h') . '/' . expand('%:t') ) if has('win32unix') - let fname = substitute(system('cygpath -m ' . fname), '\%x00', '', 'g') + let fname = substitute(system('cygpath -m ' . fname), '\m\%x00', '', 'g') endif let makeprg = syntastic#makeprg#build({ diff --git a/syntax_checkers/java/javac.vim b/syntax_checkers/java/javac.vim index bac150cad..e9b140309 100644 --- a/syntax_checkers/java/javac.vim +++ b/syntax_checkers/java/javac.vim @@ -41,7 +41,7 @@ if !exists("g:syntastic_java_javac_delete_output") endif function! s:CygwinPath(path) - return substitute(system("cygpath -m ".a:path), '\%x00', '', 'g') + return substitute(system("cygpath -m ".a:path), '\m\%x00', '', 'g') endfunction if !exists("g:syntastic_java_javac_temp_dir") @@ -166,17 +166,17 @@ function! s:GetMavenProperties() let mvn_settings_output = split(system(mvn_cmd . ' help:effective-pom'), "\n") let current_path = 'project' for line in mvn_settings_output - let matches = matchlist(line, '^\s*<\([a-zA-Z0-9\-\.]\+\)>\s*$') + let matches = matchlist(line, '\m^\s*<\([a-zA-Z0-9\-\.]\+\)>\s*$') if mvn_is_managed_tag && !empty(matches) let mvn_is_managed_tag = index(g:syntastic_java_javac_maven_pom_tags, matches[1]) >= 0 let current_path .= '.' . matches[1] else - let matches = matchlist(line, '^\s*\s*$') + let matches = matchlist(line, '\m^\s*\s*$') if !empty(matches) let mvn_is_managed_tag = index(g:syntastic_java_javac_maven_pom_tags, matches[1]) < 0 - let current_path = substitute(current_path, '\.' . matches[1] . "$", '', '') + let current_path = substitute(current_path, '\m\.' . matches[1] . "$", '', '') else - let matches = matchlist(line, '^\s*<\([a-zA-Z0-9\-\.]\+\)>\(.\+\)\s*$') + let matches = matchlist(line, '\m^\s*<\([a-zA-Z0-9\-\.]\+\)>\(.\+\)\s*$') if mvn_is_managed_tag && !empty(matches) let mvn_properties[current_path . '.' . matches[1]] = matches[2] endif diff --git a/syntax_checkers/javascript/jslint.vim b/syntax_checkers/javascript/jslint.vim index ece856e55..384b4b852 100644 --- a/syntax_checkers/javascript/jslint.vim +++ b/syntax_checkers/javascript/jslint.vim @@ -24,7 +24,7 @@ function! SyntaxCheckers_javascript_jslint_IsAvailable() endfunction function! SyntaxCheckers_javascript_jslint_HighlightTerm(error) - let unexpected = matchstr(a:error['text'], 'Expected.*and instead saw \'\zs.*\ze\'') + let unexpected = matchstr(a:error['text'], '\mExpected.*and instead saw \'\zs.*\ze\'') if len(unexpected) < 1i return '' endif diff --git a/syntax_checkers/lua/luac.vim b/syntax_checkers/lua/luac.vim index c26e520a4..ad4e8baab 100644 --- a/syntax_checkers/lua/luac.vim +++ b/syntax_checkers/lua/luac.vim @@ -20,7 +20,7 @@ function! SyntaxCheckers_lua_luac_IsAvailable() endfunction function! SyntaxCheckers_lua_luac_GetHighlightRegex(pos) - let near = matchstr(a:pos['text'], "near '[^']\\+'") + let near = matchstr(a:pos['text'], "\\mnear '[^']\\+'") let result = '' if len(near) > 0 let near = split(near, "'")[1] @@ -32,7 +32,7 @@ function! SyntaxCheckers_lua_luac_GetHighlightRegex(pos) else let result = '\V'.near endif - let open = matchstr(a:pos['text'], "(to close '[^']\\+' at line [0-9]\\+)") + let open = matchstr(a:pos['text'], "\\m(to close '[^']\\+' at line [0-9]\\+)") if len(open) > 0 let oline = split(open, "'")[1:2] let line = 0+strpart(oline[1], 9) diff --git a/syntax_checkers/php/php.vim b/syntax_checkers/php/php.vim index a6abffb12..3c2f42372 100644 --- a/syntax_checkers/php/php.vim +++ b/syntax_checkers/php/php.vim @@ -20,7 +20,7 @@ function! SyntaxCheckers_php_php_IsAvailable() endfunction function! SyntaxCheckers_php_php_GetHighlightRegex(item) - let unexpected = matchstr(a:item['text'], "unexpected '[^']\\+'") + let unexpected = matchstr(a:item['text'], "\\munexpected '[^']\\+'") if len(unexpected) < 1 return '' endif diff --git a/syntax_checkers/php/phpmd.vim b/syntax_checkers/php/phpmd.vim index c21362f9f..99c3be6b5 100644 --- a/syntax_checkers/php/phpmd.vim +++ b/syntax_checkers/php/phpmd.vim @@ -23,37 +23,37 @@ function! SyntaxCheckers_php_phpmd_IsAvailable() endfunction function! SyntaxCheckers_php_phpmd_GetHighlightRegex(item) - let term = matchstr(a:item['text'], '\C^The \S\+ \w\+\(()\)\= \(has\|is not\|utilizes\)') + let term = matchstr(a:item['text'], '\m\C^The \S\+ \w\+\(()\)\= \(has\|is not\|utilizes\)') if term != '' - return '\V'.substitute(term, '\C^The \S\+ \(\w\+\)\(()\)\= .*', '\1', '') + return '\V'.substitute(term, '\m\C^The \S\+ \(\w\+\)\(()\)\= .*', '\1', '') endif - let term = matchstr(a:item['text'], '\C^Avoid \(variables with short\|excessively long variable\) names like \S\+\.') + let term = matchstr(a:item['text'], '\m\C^Avoid \(variables with short\|excessively long variable\) names like \S\+\.') if term != '' - return '\V'.substitute(term, '\C^Avoid \(variables with short\|excessively long variable\) names like \(\S\+\)\..*', '\2', '') + return '\V'.substitute(term, '\m\C^Avoid \(variables with short\|excessively long variable\) names like \(\S\+\)\..*', '\2', '') endif - let term = matchstr(a:item['text'], '\C^Avoid using short method names like \S\+::\S\+()\.') + let term = matchstr(a:item['text'], '\m\C^Avoid using short method names like \S\+::\S\+()\.') if term != '' - return '\V'.substitute(term, '\C^Avoid using short method names like \S\+::\(\S\+\)()\..*', '\1', '') + return '\V'.substitute(term, '\m\C^Avoid using short method names like \S\+::\(\S\+\)()\..*', '\1', '') endif - let term = matchstr(a:item['text'], '\C^\S\+ accesses the super-global variable ') + let term = matchstr(a:item['text'], '\m\C^\S\+ accesses the super-global variable ') if term != '' - return '\V'.substitute(term, '\C accesses the super-global variable .*$', '', '') + return '\V'.substitute(term, '\m\C accesses the super-global variable .*$', '', '') endif - let term = matchstr(a:item['text'], '\C^Constant \S\+ should be defined in uppercase') + let term = matchstr(a:item['text'], '\m\C^Constant \S\+ should be defined in uppercase') if term != '' - return '\V'.substitute(term, '\C^Constant \(\S\+\) should be defined in uppercase', '\1', '') + return '\V'.substitute(term, '\m\C^Constant \(\S\+\) should be defined in uppercase', '\1', '') endif - let term = matchstr(a:item['text'], "\\C^The '\\S\\+()' method which returns ") + let term = matchstr(a:item['text'], "\\m\\C^The '\\S\\+()' method which returns ") if term != '' - return '\V'.substitute(term, "\\C^The '\\(\\S\\+\\()' method which returns.*", '\1', '') + return '\V'.substitute(term, "\\m\\C^The '\\(\\S\\+\\()' method which returns.*", '\1', '') endif - let term = matchstr(a:item['text'], '\C variable \S\+ should begin with ') + let term = matchstr(a:item['text'], '\m\C variable \S\+ should begin with ') if term != '' - return '\V'.substitute(term, '\C.* variable \(\S\+\) should begin with .*', '\1', '') + return '\V'.substitute(term, '\m\C.* variable \(\S\+\) should begin with .*', '\1', '') endif - let term = matchstr(a:item['text'], "\\C^Avoid unused \\(private fields\\|local variables\\|private methods\\|parameters\\) such as '\\S\\+'") + let term = matchstr(a:item['text'], "\\m\\C^Avoid unused \\(private fields\\|local variables\\|private methods\\|parameters\\) such as '\\S\\+'") if term != '' - return '\V'.substitute(term, "\\C^Avoid unused \\(private fields\\|local variables\\|private methods\\|parameters\\) such as '\\(\\S\\+\\)'.*", '\2', '') + return '\V'.substitute(term, "\\m\\C^Avoid unused \\(private fields\\|local variables\\|private methods\\|parameters\\) such as '\\(\\S\\+\\)'.*", '\2', '') endif return '' endfunction diff --git a/syntax_checkers/text/atdtool.vim b/syntax_checkers/text/atdtool.vim index 9f5061b83..6aeab0626 100644 --- a/syntax_checkers/text/atdtool.vim +++ b/syntax_checkers/text/atdtool.vim @@ -46,7 +46,7 @@ function! SyntaxCheckers_text_atdtool_GetLocList() \ 'subtype': 'Style' }) for n in range(len(loclist)) - let loclist[n]['text'] = substitute(loclist[n]['text'], '\n\s\+', ' | ', 'g') + let loclist[n]['text'] = substitute(loclist[n]['text'], '\m\n\s\+', ' | ', 'g') endfor return loclist diff --git a/syntax_checkers/vala/valac.vim b/syntax_checkers/vala/valac.vim index 09b6c28b7..7ffc02602 100644 --- a/syntax_checkers/vala/valac.vim +++ b/syntax_checkers/vala/valac.vim @@ -32,8 +32,8 @@ function! SyntaxCheckers_vala_valac_IsAvailable() endfunction 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' + let strlength = strlen(matchstr(a:pos['text'], '\m\^\+$')) + return '\%>' . (a:pos.col-1) . 'c.*\%<' . (a:pos.col+strlength+1) . 'c' endfunction function! s:GetValaModules() From dd3793bb22f469421ebf26fd3abf1a152712ee0b Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 25 Oct 2013 15:56:09 +0300 Subject: [PATCH 0217/1271] More magic / nomagic fun. --- autoload/syntastic/c.vim | 2 +- syntax_checkers/c/gcc.vim | 2 +- syntax_checkers/cpp/gcc.vim | 2 +- syntax_checkers/cuda/nvcc.vim | 2 +- syntax_checkers/d/dmd.vim | 2 +- syntax_checkers/objc/gcc.vim | 2 +- syntax_checkers/objcpp/gcc.vim | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/autoload/syntastic/c.vim b/autoload/syntastic/c.vim index e502a53cb..a1c5c7efa 100644 --- a/autoload/syntastic/c.vim +++ b/autoload/syntastic/c.vim @@ -217,7 +217,7 @@ function! s:SearchHeaders() continue endtry - call filter(lines, 'v:val =~# "^\s*#\s*include"') + call filter(lines, 'v:val =~# ''\m^\s*#\s*include''') for handler in s:handlers if index(found, handler["regex"]) != -1 diff --git a/syntax_checkers/c/gcc.vim b/syntax_checkers/c/gcc.vim index f0c577b55..4e6a26b68 100644 --- a/syntax_checkers/c/gcc.vim +++ b/syntax_checkers/c/gcc.vim @@ -47,7 +47,7 @@ function! SyntaxCheckers_c_gcc_GetLocList() \ '%f:%l: %m', \ 'main_flags': '-x c -fsyntax-only', \ 'header_flags': '-x c', - \ 'header_names': '\.h$' }) + \ 'header_names': '\m\.h$' }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/syntax_checkers/cpp/gcc.vim b/syntax_checkers/cpp/gcc.vim index 643379276..de1fa6575 100644 --- a/syntax_checkers/cpp/gcc.vim +++ b/syntax_checkers/cpp/gcc.vim @@ -42,7 +42,7 @@ function! SyntaxCheckers_cpp_gcc_GetLocList() \ '%f:%l: %m', \ 'main_flags': '-x c++ -fsyntax-only', \ 'header_flags': '-x c++', - \ 'header_names': '\.\(h\|hpp\|hh\)$' }) + \ 'header_names': '\m\.\(h\|hpp\|hh\)$' }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/syntax_checkers/cuda/nvcc.vim b/syntax_checkers/cuda/nvcc.vim index 8303d2e05..8f99b0dcf 100644 --- a/syntax_checkers/cuda/nvcc.vim +++ b/syntax_checkers/cuda/nvcc.vim @@ -53,7 +53,7 @@ function! SyntaxCheckers_cuda_nvcc_GetLocList() \ '%DMaking %*\a in %f,'. \ '%f|%l| %m' - if expand('%') =~? '\%(.h\|.hpp\|.cuh\)$' + if expand('%') =~? '\m\%(.h\|.hpp\|.cuh\)$' if exists('g:syntastic_cuda_check_header') let makeprg = \ 'echo > .syntastic_dummy.cu ; ' . diff --git a/syntax_checkers/d/dmd.vim b/syntax_checkers/d/dmd.vim index 1544caf7e..894ec6d73 100644 --- a/syntax_checkers/d/dmd.vim +++ b/syntax_checkers/d/dmd.vim @@ -41,7 +41,7 @@ function! SyntaxCheckers_d_dmd_GetLocList() \ '%-G%f:%s:,%f(%l): %m,' . \ '%f:%l: %m', \ 'main_flags': '-c -of' . syntastic#util#DevNull(), - \ 'header_names': '\.di$' }) + \ 'header_names': '\m\.di$' }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/syntax_checkers/objc/gcc.vim b/syntax_checkers/objc/gcc.vim index 52965e5d5..320290f52 100644 --- a/syntax_checkers/objc/gcc.vim +++ b/syntax_checkers/objc/gcc.vim @@ -46,7 +46,7 @@ function! SyntaxCheckers_objc_gcc_GetLocList() \ '%f:%l: %m', \ 'main_flags': '-x objective-c -fsyntax-only', \ 'header_flags': '-x objective-c-header -lobjc', - \ 'header_names': '\.h$' }) + \ 'header_names': '\m\.h$' }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/syntax_checkers/objcpp/gcc.vim b/syntax_checkers/objcpp/gcc.vim index c05166c95..93ff21940 100644 --- a/syntax_checkers/objcpp/gcc.vim +++ b/syntax_checkers/objcpp/gcc.vim @@ -46,7 +46,7 @@ function! SyntaxCheckers_objcpp_gcc_GetLocList() \ '%f:%l: %m', \ 'main_flags': '-x objective-c++ -fsyntax-only', \ 'header_flags': '-x objective-c++-header -lobjc', - \ 'header_names': '\.h$' }) + \ 'header_names': '\m\.h$' }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ From 4b691c6e0345053591e56b8c2aa2ecb695a4c99a Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 25 Oct 2013 16:30:00 +0300 Subject: [PATCH 0218/1271] Fix handlebars errorformat. --- syntax_checkers/handlebars/handlebars.vim | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/syntax_checkers/handlebars/handlebars.vim b/syntax_checkers/handlebars/handlebars.vim index a15cd06c1..0003c3209 100644 --- a/syntax_checkers/handlebars/handlebars.vim +++ b/syntax_checkers/handlebars/handlebars.vim @@ -24,15 +24,15 @@ function! SyntaxCheckers_handlebars_handlebars_GetLocList() \ 'subchecker': 'handlebars' }) let errorformat = - \ 'Error: %m on line %l:,'. - \ '%-Z%p^,' . - \ "Error: %m,". - \ '%-Z%p^,' . - \ '%-G' + \ '%EError: %m on line %l:,'. + \ "%EError: %m,". + \ '%Z%p^,' . + \ '%-G%.%#' return SyntasticMake({ \ 'makeprg': makeprg, - \ 'errorformat': errorformat }) + \ 'errorformat': errorformat, + \ 'defaults': {'bufnr': bufnr("")} }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ From 87fa704f4039152d4cb99b71de029848bde355eb Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Mon, 28 Oct 2013 08:20:21 +0200 Subject: [PATCH 0219/1271] Make g:syntastic_filetype_map apply to composite filetypes. Normally composite types are handled by splitting them into simple components, and applying the corresponding (simple) checkers. This behaviour can now be disabled, by mapping composite types to a simple ones. --- doc/syntastic.txt | 45 ++++++++++++++++++++++++++++++++------------ plugin/syntastic.vim | 2 +- 2 files changed, 34 insertions(+), 13 deletions(-) diff --git a/doc/syntastic.txt b/doc/syntastic.txt index 86cb68a9b..2537e6112 100644 --- a/doc/syntastic.txt +++ b/doc/syntastic.txt @@ -19,16 +19,18 @@ ============================================================================== CONTENTS *syntastic-contents* - 1.Intro...................................|syntastic-intro| - 2.Functionality provided..................|syntastic-functionality| - 2.1.The statusline flag...............|syntastic-statusline-flag| - 2.2.Error signs.......................|syntastic-error-signs| - 2.3.Error window......................|syntastic-error-window| - 3.Commands................................|syntastic-commands| - 4.Global Options..........................|syntastic-global-options| - 5.Checker Options.........................|syntastic-checker-options| - 6.About...................................|syntastic-about| - 7.License.................................|syntastic-license| + 1.Intro........................................|syntastic-intro| + 2.Functionality provided.......................|syntastic-functionality| + 2.1.The statusline flag....................|syntastic-statusline-flag| + 2.2.Error signs............................|syntastic-error-signs| + 2.3.Error window...........................|syntastic-error-window| + 3.Commands.....................................|syntastic-commands| + 4.Global Options...............................|syntastic-global-options| + 5.Checker Options..............................|syntastic-checker-options| + 6.Notes........................................|syntastic-notes| + 6.1.Handling of composite filetypes........|syntastic-composite| + 7.About........................................|syntastic-about| + 8.License......................................|syntastic-license| ============================================================================== @@ -286,6 +288,11 @@ non-standard filetypes: > \ 'gentoo-metadata': 'xml' } < +Composite filetypes can also be mapped to simple types, which disables the +default behaviour of running both checkers against the input file: > + let g:syntastic_filetype_map = { 'handlebars.html': 'handlebars' } +< + *'syntastic_mode_map'* Default: { "mode": "active", "active_filetypes": [], @@ -450,7 +457,21 @@ specific options that can be set, these are usually documented in the wiki: https://github.com/scrooloose/syntastic/wiki/Syntaxcheckers ============================================================================== -6. About *syntastic-about* +6. Notes *syntastic-notes* + +------------------------------------------------------------------------------ +6.1. Handling of composite filetypes *syntastic-composite* + +Some Vim plugins use composite filetypes, such as 'django.python' or +'handlebars.html'. Normally, syntastic deals with this situation by splitting +the filetype in its simple components, and calling all checkers that apply. +If this behaviour is not desirable, you can disable it by mapping the +composite filetypes to a simple ones using |syntastic_filetype_map|, e.g.: > + let g:syntastic_filetype_map = { 'handlebars.html': 'handlebars' } +< + +============================================================================== +7. About *syntastic-about* The core maintainers of syntastic are: Martin Grenfell (github: scrooloose) @@ -460,7 +481,7 @@ Find the latest version of syntastic here: http://github.com/scrooloose/syntastic ============================================================================== -7. License *syntastic-license* +8. License *syntastic-license* Syntastic is released under the wtfpl. See http://sam.zoy.org/wtfpl/COPYING. diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index ac4f6d7a5..adca392a4 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -179,7 +179,7 @@ function! s:ClearCache() endfunction function! s:CurrentFiletypes() - return split(&filetype, '\m\.') + return split( get(g:syntastic_filetype_map, &filetype, &filetype), '\m\.' ) endfunction "detect and cache all syntax errors in this buffer From 327976d9daa83f50febd73ffe2e571413d3eab85 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Mon, 28 Oct 2013 08:51:29 +0200 Subject: [PATCH 0220/1271] Handlebars checker: send normal output to /dev/null. --- syntax_checkers/handlebars/handlebars.vim | 1 + 1 file changed, 1 insertion(+) diff --git a/syntax_checkers/handlebars/handlebars.vim b/syntax_checkers/handlebars/handlebars.vim index 0003c3209..e55ba43f1 100644 --- a/syntax_checkers/handlebars/handlebars.vim +++ b/syntax_checkers/handlebars/handlebars.vim @@ -20,6 +20,7 @@ endfunction function! SyntaxCheckers_handlebars_handlebars_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'handlebars', + \ 'args': '-f ' . syntastic#util#DevNull(), \ 'filetype': 'handlebars', \ 'subchecker': 'handlebars' }) From d19a6d4e302a94eb18eb1d617959c7e1b0dcf486 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Mon, 28 Oct 2013 12:31:16 +0200 Subject: [PATCH 0221/1271] Coco checker: typo. --- syntax_checkers/co/coco.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntax_checkers/co/coco.vim b/syntax_checkers/co/coco.vim index a3186108c..eea98bb89 100644 --- a/syntax_checkers/co/coco.vim +++ b/syntax_checkers/co/coco.vim @@ -19,7 +19,7 @@ if !executable("coco") finish endif -function! SyntaxCheckers_co_coco_GetLocList() +function! SyntaxCheckers_co_coco_IsAvailable() return executable('coco') endfunction From 5f30f7776da55281924bfb35165d9ac6f0aadcbe Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Mon, 28 Oct 2013 20:29:10 +0200 Subject: [PATCH 0222/1271] Update version string. --- plugin/syntastic.vim | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index adca392a4..472ef4b87 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -1,8 +1,7 @@ "============================================================================ "File: syntastic.vim "Description: Vim plugin for on the fly syntax checking. -"Version: 3.0.0 -"Released On: 13 April, 2013 +"Version: 3.2.0-pre "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 From 024b61697aff12643b10a2d2a265dfe6234369fb Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Mon, 28 Oct 2013 21:53:10 +0200 Subject: [PATCH 0223/1271] Make syntastic re-read g:syntastic_mode_map at every check. --- plugin/syntastic.vim | 3 ++- plugin/syntastic/modemap.vim | 42 +++++++++++++++++++++--------------- 2 files changed, 27 insertions(+), 18 deletions(-) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 472ef4b87..db4056895 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -95,7 +95,7 @@ endfunction command! SyntasticToggleMode call s:ToggleMode() command! -nargs=? -complete=custom,s:CompleteCheckerName SyntasticCheck call s:UpdateErrors(0, ) call s:Redraw() command! Errors call s:ShowLocList() -command! SyntasticInfo call s:registry.echoInfoFor(s:CurrentFiletypes()) +command! SyntasticInfo call s:modemap.echoMode() | call s:registry.echoInfoFor(s:CurrentFiletypes()) command! SyntasticReset call s:ClearCache() | call s:notifiers.refresh(g:SyntasticLoclist.New([])) highlight link SyntasticError SpellBad @@ -148,6 +148,7 @@ function! s:UpdateErrors(auto_invoked, ...) return endif + call s:modemap.synch() let run_checks = !a:auto_invoked || s:modemap.allowsAutoChecking(&filetype) if run_checks if a:0 >= 1 diff --git a/plugin/syntastic/modemap.vim b/plugin/syntastic/modemap.vim index b16e177b1..0c772c775 100644 --- a/plugin/syntastic/modemap.vim +++ b/plugin/syntastic/modemap.vim @@ -10,12 +10,24 @@ let g:SyntasticModeMap = {} function! g:SyntasticModeMap.Instance() if !exists('s:SyntasticModeMapInstance') let s:SyntasticModeMapInstance = copy(self) - call s:SyntasticModeMapInstance._initModeMapFromGlobalOpts() + call s:SyntasticModeMapInstance.synch() endif return s:SyntasticModeMapInstance endfunction +function! g:SyntasticModeMap.synch() + if exists('g:syntastic_mode_map') + let self._mode = get(g:syntastic_mode_map, 'mode', 'active') + let self._activeFiletypes = get(g:syntastic_mode_map, 'active_filetypes', []) + let self._passiveFiletypes = get(g:syntastic_mode_map, 'passive_filetypes', []) + else + let self._mode = 'active' + let self._activeFiletypes = [] + let self._passiveFiletypes = [] + endif +endfunction + function! g:SyntasticModeMap.allowsAutoChecking(filetype) let fts = split(a:filetype, '\m\.') @@ -27,15 +39,23 @@ function! g:SyntasticModeMap.allowsAutoChecking(filetype) endfunction function! g:SyntasticModeMap.isPassive() - return self._mode == "passive" + return self._mode == 'passive' endfunction function! g:SyntasticModeMap.toggleMode() - if self._mode == "active" - let self._mode = "passive" + call self.synch() + + if self._mode == 'active' + let self._mode = 'passive' else - let self._mode = "active" + let self._mode = 'active' endif + + "XXX Changing a global variable. Tsk, tsk... + if !exists('g:syntastic_mode_map') + let g:syntastic_mode_map = {} + endif + let g:syntastic_mode_map['mode'] = self._mode endfunction function! g:SyntasticModeMap.echoMode() @@ -44,18 +64,6 @@ endfunction " Private methods {{{1 -function! g:SyntasticModeMap._initModeMapFromGlobalOpts() - let self._mode = "active" - let self._activeFiletypes = [] - let self._passiveFiletypes = [] - - if exists("g:syntastic_mode_map") - let self._mode = get(g:syntastic_mode_map, 'mode', self._mode) - let self._activeFiletypes = get(g:syntastic_mode_map, 'active_filetypes', self._activeFiletypes) - let self._passiveFiletypes = get(g:syntastic_mode_map, 'passive_filetypes', self._passiveFiletypes) - endif -endfunction - function! g:SyntasticModeMap._isOneFiletypeActive(filetypes) return !empty(filter(copy(a:filetypes), 'index(self._activeFiletypes, v:val) != -1')) endfunction From 983fadef209f3b0191b440e1b2c4c1e6d55637da Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Tue, 29 Oct 2013 00:50:30 +0200 Subject: [PATCH 0224/1271] Add a note about python-mode to the docs. --- doc/syntastic.txt | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/doc/syntastic.txt b/doc/syntastic.txt index 2537e6112..40913b4d2 100644 --- a/doc/syntastic.txt +++ b/doc/syntastic.txt @@ -29,6 +29,7 @@ CONTENTS *syntastic-contents* 5.Checker Options..............................|syntastic-checker-options| 6.Notes........................................|syntastic-notes| 6.1.Handling of composite filetypes........|syntastic-composite| + 6.2.Interaction with python-mode...........|syntastic-pymode| 7.About........................................|syntastic-about| 8.License......................................|syntastic-license| @@ -454,7 +455,8 @@ The general form of the override options is: > For checkers that do not use the 'syntastic#makeprg#build()' function you will have to look at the source code of the checker in question. If there are specific options that can be set, these are usually documented in the wiki: -https://github.com/scrooloose/syntastic/wiki/Syntaxcheckers + + https://github.com/scrooloose/syntastic/wiki/Syntaxcheckers ============================================================================== 6. Notes *syntastic-notes* @@ -470,14 +472,28 @@ composite filetypes to a simple ones using |syntastic_filetype_map|, e.g.: > let g:syntastic_filetype_map = { 'handlebars.html': 'handlebars' } < +------------------------------------------------------------------------------ +6.2 Interaction with python-mode *syntastic-pymode* + +Syntastic can be used along with the 'python-mode' Vim plugin (see +https://github.com/klen/python-mode). However, they both run syntax checks by +default when you save buffers to disk, and this is probably not what you want. +To avoid both plugins opening error windows, you can either set passive mode +for python in syntastic (see |syntastic_mode_map|), or disable lint checks in +python-mode, by setting |pymode_lint_write| to 0. E.g.: > + let g:pymode_lint_write = 0 +< + ============================================================================== 7. About *syntastic-about* The core maintainers of syntastic are: Martin Grenfell (github: scrooloose) Gregor Uhlenheuer (github: kongo2002) + LCD 047 (github: lcd047) Find the latest version of syntastic here: + http://github.com/scrooloose/syntastic ============================================================================== From 5bb7b6048cdde1ee8a437043e4790f54eb3748e1 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Tue, 29 Oct 2013 01:15:44 +0200 Subject: [PATCH 0225/1271] Check for a minimal set of Vim features at startup. --- plugin/syntastic.vim | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index db4056895..fa9a77e75 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -19,6 +19,13 @@ runtime! plugin/syntastic/*.vim let s:running_windows = has("win16") || has("win32") +for feature in ['autocmd', 'eval', 'modify_fname', 'quickfix', 'user_commands'] + if !has(feature) + call syntastic#util#error("need Vim compiled with feature " . feature) + finish + endif +endfor + if !s:running_windows && executable('uname') try let s:uname = system('uname') From 8adb029ddaf175253e7459abc3e2ab1e23b59c26 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Tue, 29 Oct 2013 09:09:34 +0200 Subject: [PATCH 0226/1271] Workaround for a Vim crash. Older versions of Vim can crash if redraw is called while a popup is visible. This commit adds a variable g:syntastic_delayed_redraws that instructs syntastic to move redraws to a CursorHold / CursorHoldI handler if redraw is called while pumvisible() is true. --- autoload/syntastic/util.vim | 52 ++++++++++++++++++++++++++++++++++++- plugin/syntastic.vim | 38 ++++++++++++--------------- 2 files changed, 68 insertions(+), 22 deletions(-) diff --git a/autoload/syntastic/util.vim b/autoload/syntastic/util.vim index 736be0c33..32514ed61 100644 --- a/autoload/syntastic/util.vim +++ b/autoload/syntastic/util.vim @@ -11,6 +11,19 @@ if !exists("g:syntastic_debug") endif let s:deprecationNoticesIssued = [] +let s:redraw_delayed = 0 +let s:redraw_full = 0 + +if g:syntastic_delayed_redraws + " updatetime is 4000 ms by default + if &updatetime == 4000 + let &updatetime = 500 + endif + + augroup syntastic + autocmd CursorHold,CursorHoldI * call syntastic#util#redrawHandler() + augroup END +endif function! syntastic#util#DevNull() if has('win32') @@ -102,7 +115,7 @@ function! syntastic#util#wideMsg(msg) let msg = substitute(msg, "\n", "", "g") set noruler noshowcmd - redraw + call syntastic#util#redraw(0) echo msg @@ -185,6 +198,43 @@ function! syntastic#util#decodeXMLEntities(string) return str endfunction +"Redraw in a way that doesnt make the screen flicker or leave anomalies behind. +" +"Some terminal versions of vim require `redraw!` - otherwise there can be +"random anomalies left behind. +" +"However, on some versions of gvim using `redraw!` causes the screen to +"flicker - so use redraw. +" +"XXX On older Vim versions calling redraw while a popup is visible can make +"Vim segfault, so move redraws to a CursorHold / CursorHoldI handler. +function! syntastic#util#redraw(full) + if !g:syntastic_delayed_redraws || !pumvisible() + if a:full + redraw! + else + redraw + endif + let s:redraw_delayed = 0 + let s:redraw_full = 0 + else + let s:redraw_delayed = 1 + let s:redraw_full = s:redraw_full || a:full + endif +endfunction + +function! syntastic#util#redrawHandler() + if s:redraw_delayed && !pumvisible() + if s:redraw_full + redraw! + else + redraw + endif + let s:redraw_delayed = 0 + let s:redraw_full = 0 + endif +endfunction + function! syntastic#util#debug(msg) if g:syntastic_debug echomsg "syntastic: debug: " . a:msg diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index fa9a77e75..ae462b81c 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -76,7 +76,7 @@ if !exists("g:syntastic_filetype_map") endif if !exists("g:syntastic_full_redraws") - let g:syntastic_full_redraws = !( has('gui_running') || has('gui_macvim')) + let g:syntastic_full_redraws = !(has('gui_running') || has('gui_macvim')) endif " TODO: not documented @@ -85,6 +85,12 @@ if !exists("g:syntastic_reuse_loc_lists") let g:syntastic_reuse_loc_lists = (v:version >= 704) endif +" XXX: Older Vim versions can crash if redraw is called while a popup is visible. +" This variable enables a workaround, by delaying redraws to an idle moment. +if !exists("g:syntastic_delayed_redraws") + let g:syntastic_delayed_redraws = 0 +endif + let s:registry = g:SyntasticRegistry.Instance() let s:notifiers = g:SyntasticNotifiers.Instance() let s:modemap = g:SyntasticModeMap.Instance() @@ -100,10 +106,16 @@ function! s:CompleteCheckerName(argLead, cmdLine, cursorPos) endfunction command! SyntasticToggleMode call s:ToggleMode() -command! -nargs=? -complete=custom,s:CompleteCheckerName SyntasticCheck call s:UpdateErrors(0, ) call s:Redraw() +command! -nargs=? -complete=custom,s:CompleteCheckerName SyntasticCheck + \ call s:UpdateErrors(0, ) + \ call syntastic#util#redraw(g:syntastic_full_redraws) command! Errors call s:ShowLocList() -command! SyntasticInfo call s:modemap.echoMode() | call s:registry.echoInfoFor(s:CurrentFiletypes()) -command! SyntasticReset call s:ClearCache() | call s:notifiers.refresh(g:SyntasticLoclist.New([])) +command! SyntasticInfo + \ call s:modemap.echoMode() | + \ call s:registry.echoInfoFor(s:CurrentFiletypes()) +command! SyntasticReset + \ call s:ClearCache() | + \ call s:notifiers.refresh(g:SyntasticLoclist.New([])) highlight link SyntasticError SpellBad highlight link SyntasticWarning SpellCap @@ -143,7 +155,6 @@ function! s:BufEnterHook() endif endfunction - function! s:QuitPreHook() let b:syntastic_skip_checks = !g:syntastic_check_on_wq call g:SyntasticLoclistHide() @@ -274,21 +285,6 @@ function! s:IsRedrawRequiredAfterMake() return !s:running_windows && (s:uname() =~ "FreeBSD" || s:uname() =~ "OpenBSD") endfunction -"Redraw in a way that doesnt make the screen flicker or leave anomalies behind. -" -"Some terminal versions of vim require `redraw!` - otherwise there can be -"random anomalies left behind. -" -"However, on some versions of gvim using `redraw!` causes the screen to -"flicker - so use redraw. -function! s:Redraw() - if g:syntastic_full_redraws - redraw! - else - redraw - endif -endfunction - function! s:IgnoreFile(filename) let fname = fnamemodify(a:filename, ':p') for p in g:syntastic_ignore_files @@ -427,7 +423,7 @@ function! SyntasticMake(options) let &shell=old_shell if s:IsRedrawRequiredAfterMake() - call s:Redraw() + call syntastic#util#redraw(g:syntastic_full_redraws) endif if has_key(a:options, 'returns') && index(a:options['returns'], v:shell_error) == -1 From 0b8061333460d71f023d33a8dd92aa725727ba36 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Tue, 29 Oct 2013 09:37:13 +0200 Subject: [PATCH 0227/1271] Add a note to the manual about the fish shell. --- doc/syntastic.txt | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/doc/syntastic.txt b/doc/syntastic.txt index 40913b4d2..7047a9dde 100644 --- a/doc/syntastic.txt +++ b/doc/syntastic.txt @@ -30,6 +30,7 @@ CONTENTS *syntastic-contents* 6.Notes........................................|syntastic-notes| 6.1.Handling of composite filetypes........|syntastic-composite| 6.2.Interaction with python-mode...........|syntastic-pymode| + 6.3.Interaction with the fish shell........|syntastic-fish| 7.About........................................|syntastic-about| 8.License......................................|syntastic-license| @@ -484,6 +485,18 @@ python-mode, by setting |pymode_lint_write| to 0. E.g.: > let g:pymode_lint_write = 0 < +------------------------------------------------------------------------------ +6.3 Interaction with the fish shell *syntastic-fish* + +At the time of this writing the 'fish' shell (see http://fishshell.com/) +doesn't support the standard UNIX syntax for file redirections, and thus it +can't be used together with syntastic. You don't need to change your login +shell to address this problem, but you do have to point Vim's 'shell' to a more +traditional shell, such as 'zsh', 'bash', 'ksh', or even the original Bourne +'sh': > + set shell = 'bash' +< + ============================================================================== 7. About *syntastic-about* From 74ed44bcdd9d094a674ac15d67e2ec5a67233466 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Tue, 29 Oct 2013 17:51:15 +0200 Subject: [PATCH 0228/1271] Document g:syntastic_delayed_redraws. Minor cleanup. --- autoload/syntastic/util.vim | 43 +++++++++++++++++++------------------ doc/syntastic.txt | 9 +++++++- 2 files changed, 30 insertions(+), 22 deletions(-) diff --git a/autoload/syntastic/util.vim b/autoload/syntastic/util.vim index 32514ed61..425df2d7b 100644 --- a/autoload/syntastic/util.vim +++ b/autoload/syntastic/util.vim @@ -15,7 +15,9 @@ let s:redraw_delayed = 0 let s:redraw_full = 0 if g:syntastic_delayed_redraws - " updatetime is 4000 ms by default + " CursorHold / CursorHoldI events are triggered if user doesn't press a + " key for &updatetime ms. We change it only if current value is the default + " value, that is 4000 ms. if &updatetime == 4000 let &updatetime = 500 endif @@ -198,23 +200,11 @@ function! syntastic#util#decodeXMLEntities(string) return str endfunction -"Redraw in a way that doesnt make the screen flicker or leave anomalies behind. -" -"Some terminal versions of vim require `redraw!` - otherwise there can be -"random anomalies left behind. -" -"However, on some versions of gvim using `redraw!` causes the screen to -"flicker - so use redraw. -" -"XXX On older Vim versions calling redraw while a popup is visible can make -"Vim segfault, so move redraws to a CursorHold / CursorHoldI handler. +" On older Vim versions calling redraw while a popup is visible can make +" Vim segfault, so move redraws to a CursorHold / CursorHoldI handler. function! syntastic#util#redraw(full) if !g:syntastic_delayed_redraws || !pumvisible() - if a:full - redraw! - else - redraw - endif + call s:Redraw(a:full) let s:redraw_delayed = 0 let s:redraw_full = 0 else @@ -225,11 +215,7 @@ endfunction function! syntastic#util#redrawHandler() if s:redraw_delayed && !pumvisible() - if s:redraw_full - redraw! - else - redraw - endif + call s:Redraw(s:redraw_full) let s:redraw_delayed = 0 let s:redraw_full = 0 endif @@ -267,6 +253,21 @@ function! syntastic#util#deprecationWarn(msg) call syntastic#util#warn(a:msg) endfunction +"Redraw in a way that doesnt make the screen flicker or leave anomalies behind. +" +"Some terminal versions of vim require `redraw!` - otherwise there can be +"random anomalies left behind. +" +"However, on some versions of gvim using `redraw!` causes the screen to +"flicker - so use redraw. +function! s:Redraw(full) + if a:full + redraw! + else + redraw + endif +endfunction + let &cpo = s:save_cpo unlet s:save_cpo " vim: set et sts=4 sw=4: diff --git a/doc/syntastic.txt b/doc/syntastic.txt index 40913b4d2..b3293b20f 100644 --- a/doc/syntastic.txt +++ b/doc/syntastic.txt @@ -373,9 +373,16 @@ If the buffer had 2 warnings, starting on line 5 then this would appear: > Default: 0 in GUI Vim and MacVim, 1 otherwise Controls whether syntastic calls |:redraw| or |:redraw!| for screen redraws. Changing it can in principle make screen redraws smoother, but it can also -cause screen to flicker, or cause ghost characters. Leaving it to the default +cause screen to flicker, or cause ghost characters. Leaving it to the default should be safe. + *'syntastic_delayed_redraws'* +Default: 0 +On older Vims, calling redraw when a popup menu is visible can cause Vim to +segfault. If your version of Vim is affected, the solution is of course to +upgrade Vim. If upgrading is not immediately feasible however, setting this +variable to 1 might help, by delaying redraws until they are safe. + *'syntastic_debug'* Default: 0 Set this to 1 to enable debugging: > From 46d0c72b9c6ebe8601e0dffe73cee87b9913b996 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Tue, 29 Oct 2013 20:24:07 +0200 Subject: [PATCH 0229/1271] New checker for sh: shellcheck. See the project's page for details: https://github.com/koalaman/shellcheck . --- syntax_checkers/sh/shellcheck.vim | 48 +++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 syntax_checkers/sh/shellcheck.vim diff --git a/syntax_checkers/sh/shellcheck.vim b/syntax_checkers/sh/shellcheck.vim new file mode 100644 index 000000000..6e73bb92a --- /dev/null +++ b/syntax_checkers/sh/shellcheck.vim @@ -0,0 +1,48 @@ +"============================================================================ +"File: shellcheck.vim +"Description: Shell script syntax/style checking plugin for syntastic.vim +"============================================================================ + +if exists("g:loaded_syntastic_sh_shellcheck_checker") + finish +endif +let g:loaded_syntastic_sh_shellcheck_checker = 1 + +function! SyntaxCheckers_sh_shellcheck_IsAvailable() + return executable('jsoncheck') +endfunction + +function! SyntaxCheckers_sh_shellcheck_Preprocess(json) + " A hat tip to Mark Weber for this trick + " http://stackoverflow.com/a/19105763 + let errors = eval(join(a:json, '')) + + call filter(errors, 'v:val["level"] =~? ''\v^(error|warning|style)$''') + return map(errors, 'v:val["level"][0] . ":" . v:val["line"] . ":" . v:val["column"] . ":" . v:val["message"]') +endfunction + +function! SyntaxCheckers_sh_shellcheck_GetLocList() + let makeprg = 'jsoncheck <' . syntastic#util#shexpand('%') + + let errorformat = '%t:%l:%v:%m' + + let loclist = SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'preprocess': 'SyntaxCheckers_sh_shellcheck_Preprocess', + \ 'defaults': {'bufnr': bufnr("")}, + \ 'returns': [0] }) + + for e in loclist + if e['type'] ==? 's' + let e['type'] = 'w' + let e['subtype'] = 'Style' + endif + endfor + + return loclist +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'sh', + \ 'name': 'shellcheck' }) From e01b494971e735b3f12672e741336ead46e40d7b Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Wed, 30 Oct 2013 07:21:46 +0200 Subject: [PATCH 0230/1271] Moved initialization of g:syntastic_delayed_redraws to util.vim. --- autoload/syntastic/util.vim | 4 ++++ plugin/syntastic.vim | 6 ------ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/autoload/syntastic/util.vim b/autoload/syntastic/util.vim index 425df2d7b..10c01303c 100644 --- a/autoload/syntastic/util.vim +++ b/autoload/syntastic/util.vim @@ -10,6 +10,10 @@ if !exists("g:syntastic_debug") let g:syntastic_debug = 0 endif +if !exists("g:syntastic_delayed_redraws") + let g:syntastic_delayed_redraws = 0 +endif + let s:deprecationNoticesIssued = [] let s:redraw_delayed = 0 let s:redraw_full = 0 diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index ae462b81c..a9d2c00c7 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -85,12 +85,6 @@ if !exists("g:syntastic_reuse_loc_lists") let g:syntastic_reuse_loc_lists = (v:version >= 704) endif -" XXX: Older Vim versions can crash if redraw is called while a popup is visible. -" This variable enables a workaround, by delaying redraws to an idle moment. -if !exists("g:syntastic_delayed_redraws") - let g:syntastic_delayed_redraws = 0 -endif - let s:registry = g:SyntasticRegistry.Instance() let s:notifiers = g:SyntasticNotifiers.Instance() let s:modemap = g:SyntasticModeMap.Instance() From c98e778444bdf48a2e633dcf613fcd826d499099 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 1 Nov 2013 11:51:04 +0200 Subject: [PATCH 0231/1271] Cleanup. --- autoload/syntastic/postprocess.vim | 2 +- plugin/syntastic.vim | 4 ++-- plugin/syntastic/loclist.vim | 2 +- plugin/syntastic/makeprg_builder.vim | 2 +- plugin/syntastic/registry.vim | 2 +- plugin/syntastic/signs.vim | 4 ++-- syntax_checkers/c/checkpatch.vim | 2 +- syntax_checkers/c/make.vim | 2 +- syntax_checkers/html/tidy.vim | 2 +- syntax_checkers/javascript/jshint.vim | 4 ++-- syntax_checkers/javascript/jsl.vim | 2 +- syntax_checkers/ocaml/camlp4o.vim | 8 ++++---- syntax_checkers/python/pylint.vim | 2 +- syntax_checkers/rst/rst2pseudoxml.vim | 2 +- syntax_checkers/ruby/jruby.vim | 4 ++-- 15 files changed, 22 insertions(+), 22 deletions(-) diff --git a/autoload/syntastic/postprocess.vim b/autoload/syntastic/postprocess.vim index e1f62e8a0..607dda905 100644 --- a/autoload/syntastic/postprocess.vim +++ b/autoload/syntastic/postprocess.vim @@ -25,7 +25,7 @@ function! syntastic#postprocess#sort(errors) return sort(a:errors, 's:compareErrorItems') endfunction -function syntastic#postprocess#compressWhitespace(errors) +function! syntastic#postprocess#compressWhitespace(errors) let llist = [] for e in a:errors diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index a9d2c00c7..b964fea88 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -390,7 +390,7 @@ function! SyntasticMake(options) endif if has_key(a:options, 'cwd') - exec 'lcd ' . fnameescape(a:options['cwd']) + execute 'lcd ' . fnameescape(a:options['cwd']) endif let $LC_MESSAGES = 'C' @@ -407,7 +407,7 @@ function! SyntasticMake(options) let errors = copy(getloclist(0)) if has_key(a:options, 'cwd') - exec 'lcd ' . fnameescape(old_cwd) + execute 'lcd ' . fnameescape(old_cwd) endif silent! lolder diff --git a/plugin/syntastic/loclist.vim b/plugin/syntastic/loclist.vim index f1f34eb6c..b74e18b97 100644 --- a/plugin/syntastic/loclist.vim +++ b/plugin/syntastic/loclist.vim @@ -151,7 +151,7 @@ function! g:SyntasticLoclist.show() if self.hasErrorsOrWarningsToDisplay() let num = winnr() - exec "lopen " . g:syntastic_loc_list_height + execute "lopen " . g:syntastic_loc_list_height if num != winnr() wincmd p endif diff --git a/plugin/syntastic/makeprg_builder.vim b/plugin/syntastic/makeprg_builder.vim index ef77efa9b..1430dc5f0 100644 --- a/plugin/syntastic/makeprg_builder.vim +++ b/plugin/syntastic/makeprg_builder.vim @@ -49,7 +49,7 @@ endfunction " Private methods {{{1 -function g:SyntasticMakeprgBuilder._getOpt(name) +function! g:SyntasticMakeprgBuilder._getOpt(name) if self._optExists(a:name) return {self._optName(a:name)} endif diff --git a/plugin/syntastic/registry.vim b/plugin/syntastic/registry.vim index 1019ab223..e15695c23 100644 --- a/plugin/syntastic/registry.vim +++ b/plugin/syntastic/registry.vim @@ -173,7 +173,7 @@ function! g:SyntasticRegistry._loadCheckers(filetype) return endif - exec "runtime! syntax_checkers/" . a:filetype . "/*.vim" + execute "runtime! syntax_checkers/" . a:filetype . "/*.vim" if !has_key(self._checkerMap, a:filetype) let self._checkerMap[a:filetype] = [] diff --git a/plugin/syntastic/signs.vim b/plugin/syntastic/signs.vim index 067658b1e..db9a612d6 100644 --- a/plugin/syntastic/signs.vim +++ b/plugin/syntastic/signs.vim @@ -120,7 +120,7 @@ function! g:SyntasticSignsNotifier._signErrors(loclist) let sign_subtype = get(i, 'subtype', '') let sign_type = 'Syntastic' . sign_subtype . sign_severity - exec "sign place " . s:next_sign_id . " line=" . i['lnum'] . " name=" . sign_type . " buffer=" . i['bufnr'] + execute "sign place " . s:next_sign_id . " line=" . i['lnum'] . " name=" . sign_type . " buffer=" . i['bufnr'] call add(self._bufSignIds(), s:next_sign_id) let s:next_sign_id += 1 endif @@ -132,7 +132,7 @@ endfunction function! g:SyntasticSignsNotifier._removeSigns(ids) if has('signs') for i in a:ids - exec "sign unplace " . i + execute "sign unplace " . i call remove(self._bufSignIds(), index(self._bufSignIds(), i)) endfor endif diff --git a/syntax_checkers/c/checkpatch.vim b/syntax_checkers/c/checkpatch.vim index f16a7c142..3e077bdf8 100644 --- a/syntax_checkers/c/checkpatch.vim +++ b/syntax_checkers/c/checkpatch.vim @@ -20,7 +20,7 @@ elseif executable("./scripts/checkpatch.pl") let g:syntastic_c_checker_checkpatch_location = './scripts/checkpatch.pl' endif -function SyntaxCheckers_c_checkpatch_IsAvailable() +function! SyntaxCheckers_c_checkpatch_IsAvailable() return exists("g:syntastic_c_checker_checkpatch_location") endfunction diff --git a/syntax_checkers/c/make.vim b/syntax_checkers/c/make.vim index 5fb2a848d..6620f84fe 100644 --- a/syntax_checkers/c/make.vim +++ b/syntax_checkers/c/make.vim @@ -15,7 +15,7 @@ if exists('g:loaded_syntastic_c_make_checker') endif let g:loaded_syntastic_c_make_checker = 1 -function SyntaxCheckers_c_make_IsAvailable() +function! SyntaxCheckers_c_make_IsAvailable() return executable('make') endfunction diff --git a/syntax_checkers/html/tidy.vim b/syntax_checkers/html/tidy.vim index 27a976134..14f79f7bb 100644 --- a/syntax_checkers/html/tidy.vim +++ b/syntax_checkers/html/tidy.vim @@ -130,7 +130,7 @@ function! s:NewTags(name) return syntastic#util#shescape(join( s:{a:name} + g:syntastic_html_tidy_{a:name}, ',' )) endfunction -function s:Args() +function! s:Args() let args = s:TidyEncOptByFenc() . \ ' --new-blocklevel-tags ' . s:NewTags('blocklevel_tags') . \ ' --new-inline-tags ' . s:NewTags('inline_tags') . diff --git a/syntax_checkers/javascript/jshint.vim b/syntax_checkers/javascript/jshint.vim index 6e0a47f9b..b4c576ea5 100644 --- a/syntax_checkers/javascript/jshint.vim +++ b/syntax_checkers/javascript/jshint.vim @@ -44,11 +44,11 @@ function! SyntaxCheckers_javascript_jshint_GetLocList() \ 'defaults': {'bufnr': bufnr('')} }) endfunction -function s:JshintNew() +function! s:JshintNew() return syntastic#util#versionIsAtLeast(syntastic#util#getVersion(expand(g:syntastic_jshint_exec) . ' --version'), [1, 1]) endfunction -function s:Args() +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 diff --git a/syntax_checkers/javascript/jsl.vim b/syntax_checkers/javascript/jsl.vim index bef1b89aa..63f5e4419 100644 --- a/syntax_checkers/javascript/jsl.vim +++ b/syntax_checkers/javascript/jsl.vim @@ -17,7 +17,7 @@ if !exists("g:syntastic_javascript_jsl_conf") let g:syntastic_javascript_jsl_conf = "" endif -function s:ConfFlag() +function! s:ConfFlag() if !empty(g:syntastic_javascript_jsl_conf) return "-conf " . g:syntastic_javascript_jsl_conf endif diff --git a/syntax_checkers/ocaml/camlp4o.vim b/syntax_checkers/ocaml/camlp4o.vim index 66f21d81a..aa876719b 100644 --- a/syntax_checkers/ocaml/camlp4o.vim +++ b/syntax_checkers/ocaml/camlp4o.vim @@ -96,7 +96,7 @@ function! SyntaxCheckers_ocaml_camlp4o_GetLocList() return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) endfunction -function s:GetMakeprg() +function! s:GetMakeprg() if g:syntastic_ocaml_use_ocamlc return s:GetOcamlcMakeprg() endif @@ -108,7 +108,7 @@ function s:GetMakeprg() return s:GetOtherMakeprg() endfunction -function s:GetOcamlcMakeprg() +function! s:GetOcamlcMakeprg() if g:syntastic_ocaml_use_janestreet_core let build_cmd = "ocamlc -I " let build_cmd .= expand(g:syntastic_ocaml_janestreet_core_dir) @@ -119,12 +119,12 @@ function s:GetOcamlcMakeprg() endif endfunction -function s:GetOcamlBuildMakeprg() +function! s:GetOcamlBuildMakeprg() return "ocamlbuild -quiet -no-log -tag annot," . s:ocamlpp . " -no-links -no-hygiene -no-sanitize " . \ syntastic#util#shexpand('%:r') . ".cmi" endfunction -function s:GetOtherMakeprg() +function! s:GetOtherMakeprg() "TODO: give this function a better name? " "TODO: should use throw/catch instead of returning an empty makeprg diff --git a/syntax_checkers/python/pylint.vim b/syntax_checkers/python/pylint.vim index 016f8e014..07d9defd0 100644 --- a/syntax_checkers/python/pylint.vim +++ b/syntax_checkers/python/pylint.vim @@ -49,7 +49,7 @@ function! SyntaxCheckers_python_pylint_GetLocList() return loclist endfunction -function s:PylintNew() +function! s:PylintNew() try " On Windows the version is shown as "pylint-script.py 1.0.0". " On Gentoo Linux it's "pylint-python2.7 0.28.0". Oh, joy. :) diff --git a/syntax_checkers/rst/rst2pseudoxml.vim b/syntax_checkers/rst/rst2pseudoxml.vim index 454b4d859..429cee343 100644 --- a/syntax_checkers/rst/rst2pseudoxml.vim +++ b/syntax_checkers/rst/rst2pseudoxml.vim @@ -53,7 +53,7 @@ function! SyntaxCheckers_rst_rst2pseudoxml_GetLocList() return loclist endfunction -function s:exe() +function! s:exe() return executable("rst2pseudoxml.py") ? "rst2pseudoxml.py" : "rst2pseudoxml" endfunction diff --git a/syntax_checkers/ruby/jruby.vim b/syntax_checkers/ruby/jruby.vim index bef2b5f5e..bfd60c3ad 100644 --- a/syntax_checkers/ruby/jruby.vim +++ b/syntax_checkers/ruby/jruby.vim @@ -39,11 +39,11 @@ function! SyntaxCheckers_ruby_jruby_GetLocList() \ 'errorformat': errorformat }) endfunction -function s:args() +function! s:args() return has('win32') ? '-W1 -T1 -c' : '-W1 -c' endfunction -function s:exe() +function! s:exe() return has('win32') ? 'jruby' : 'RUBYOPT= jruby' endfunction From e8abc8fde3a4d0d026ace1467ed490baaf25cb5c Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 1 Nov 2013 16:51:50 +0200 Subject: [PATCH 0232/1271] Reword the message given by SyntasticInfo. --- plugin/syntastic/registry.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugin/syntastic/registry.vim b/plugin/syntastic/registry.vim index e15695c23..e17884772 100644 --- a/plugin/syntastic/registry.vim +++ b/plugin/syntastic/registry.vim @@ -116,8 +116,8 @@ function! g:SyntasticRegistry.echoInfoFor(ftalias_list) call extend(active, self.getActiveCheckers(ftalias)) endfor - echomsg "Available checkers: " . join(syntastic#util#unique(map(available, "v:val.getName()"))) - echomsg "Currently active checker(s): " . join(syntastic#util#unique(map(active, "v:val.getName()"))) + echomsg "Available checker(s): " . join(syntastic#util#unique(map(available, "v:val.getName()"))) + echomsg "Currently enabled checker(s): " . join(syntastic#util#unique(map(active, "v:val.getName()"))) endfunction " Private methods {{{1 From 18b5211f26ef5225ca5e5066c55f2337e5cc0555 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Sat, 2 Nov 2013 10:39:06 +0200 Subject: [PATCH 0233/1271] New option g:syntastic_id_checkers. Default: 1. There is also a local version b:syntastic_id_checkers. --- doc/syntastic.txt | 10 ++++++++++ plugin/syntastic.vim | 16 +++++++++++++++- plugin/syntastic/loclist.vim | 6 ++++++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/doc/syntastic.txt b/doc/syntastic.txt index 4fd0c0565..4067228ab 100644 --- a/doc/syntastic.txt +++ b/doc/syntastic.txt @@ -190,6 +190,16 @@ the first time a checker finds any errors. > let g:syntastic_aggregate_errors=1 < + *'syntastic_id_checkers'* +Default: 1 +When results from multiple checkers are aggregated in a single error list +(that is either when |syntastic_aggregate_errors| is enabled, or when checking +a file with a composite filetype), it might not be immediately obvious which +checker has produced a given error message. This variable instructs syntastic +to label error messages with the names of the checkers that created them. > + let g:syntastic_id_checkers=0 +< + *'syntastic_echo_current_error'* Default: 1 If enabled, syntastic will echo the error associated with the current line to diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index b964fea88..e2a18811a 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -63,6 +63,10 @@ if !exists("g:syntastic_aggregate_errors") let g:syntastic_aggregate_errors = 0 endif +if !exists("g:syntastic_id_checkers") + let g:syntastic_id_checkers = 1 +endif + if !exists("g:syntastic_loc_list_height") let g:syntastic_loc_list_height = 10 endif @@ -208,6 +212,11 @@ function! s:CacheErrors(...) call syntastic#util#debug("CacheErrors: b:syntastic_aggregate_errors = " . b:syntastic_aggregate_errors) endif + let aggregate_errors = + \ exists('b:syntastic_aggregate_errors') ? b:syntastic_aggregate_errors : g:syntastic_aggregate_errors + let decorate_errors = (aggregate_errors || len(s:CurrentFiletypes()) > 1) && + \ (exists('b:syntastic_id_checkers') ? b:syntastic_id_checkers : g:syntastic_id_checkers) + for ft in s:CurrentFiletypes() if a:0 let checker = s:registry.getChecker(ft, a:1) @@ -223,10 +232,15 @@ function! s:CacheErrors(...) let loclist = checker.getLocList() if !loclist.isEmpty() + if decorate_errors + call loclist.decorate(checker.getName(), checker.getFiletype()) + endif + let newLoclist = newLoclist.extend(loclist) + call add(names, [checker.getName(), checker.getFiletype()]) - if !(exists('b:syntastic_aggregate_errors') ? b:syntastic_aggregate_errors : g:syntastic_aggregate_errors) + if !aggregate_errors break endif endif diff --git a/plugin/syntastic/loclist.vim b/plugin/syntastic/loclist.vim index b74e18b97..f03a9b200 100644 --- a/plugin/syntastic/loclist.vim +++ b/plugin/syntastic/loclist.vim @@ -69,6 +69,12 @@ function! g:SyntasticLoclist.setName(name) let self._name = a:name endfunction +function! g:SyntasticLoclist.decorate(name, filetype) + for e in self._rawLoclist + let e['text'] .= ' [' . a:filetype . '/' . a:name . ']' + endfor +endfunction + function! g:SyntasticLoclist.hasErrorsOrWarningsToDisplay() if self._hasErrorsOrWarningsToDisplay >= 0 return self._hasErrorsOrWarningsToDisplay From 903d84a3ce5add3d61e0ce3686c608fdc6eec867 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Mon, 28 Oct 2013 13:53:33 +0200 Subject: [PATCH 0234/1271] Registry cleanup, stage 1. Make SyntaxCheckers_*_GetLocList() dictionary functions. Pass a reference to the current checker to syntastic#makeprg#build(). Add an optional 'redirect' argument to CreateAndRegisterChecker(). Change the sh checker to use the new dictionary functions. Add a new registry method getLocListRaw() (needed for the sh checker). --- autoload/syntastic/makeprg.vim | 5 ++--- plugin/syntastic/checker.vim | 11 ++++++++++- plugin/syntastic/makeprg_builder.vim | 13 ++++++++++--- syntax_checkers/ada/gcc.vim | 2 +- syntax_checkers/applescript/osacompile.vim | 5 ++--- syntax_checkers/asciidoc/asciidoc.vim | 5 ++--- syntax_checkers/c/checkpatch.vim | 5 ++--- syntax_checkers/c/gcc.vim | 2 +- syntax_checkers/c/make.vim | 2 +- syntax_checkers/c/oclint.vim | 5 ++--- syntax_checkers/c/sparse.vim | 5 ++--- syntax_checkers/c/splint.vim | 5 ++--- syntax_checkers/c/ycm.vim | 2 +- syntax_checkers/chef/foodcritic.vim | 5 ++--- syntax_checkers/co/coco.vim | 5 ++--- syntax_checkers/cobol/cobc.vim | 2 +- syntax_checkers/coffee/coffee.vim | 5 ++--- syntax_checkers/coffee/coffeelint.vim | 5 ++--- syntax_checkers/coq/coqtop.vim | 5 ++--- syntax_checkers/cpp/cpplint.vim | 5 ++--- syntax_checkers/cpp/gcc.vim | 2 +- syntax_checkers/cpp/oclint.vim | 13 +++---------- syntax_checkers/cpp/ycm.vim | 13 +++---------- syntax_checkers/cs/mcs.vim | 5 ++--- syntax_checkers/css/csslint.vim | 5 ++--- syntax_checkers/css/phpcs.vim | 13 +++---------- syntax_checkers/css/prettycss.vim | 5 ++--- syntax_checkers/cucumber/cucumber.vim | 5 ++--- syntax_checkers/cuda/nvcc.vim | 2 +- syntax_checkers/d/dmd.vim | 2 +- syntax_checkers/dart/dart_analyzer.vim | 5 ++--- syntax_checkers/docbk/xmllint.vim | 13 +++---------- syntax_checkers/dustjs/swiffer.vim | 5 ++--- syntax_checkers/elixir/elixir.vim | 5 ++--- syntax_checkers/erlang/escript.vim | 5 ++--- syntax_checkers/eruby/ruby.vim | 2 +- syntax_checkers/fortran/gfortran.vim | 2 +- syntax_checkers/go/go.vim | 5 ++--- syntax_checkers/go/gofmt.vim | 5 ++--- syntax_checkers/go/golint.vim | 5 ++--- syntax_checkers/go/govet.vim | 2 +- syntax_checkers/haml/haml.vim | 5 ++--- syntax_checkers/handlebars/handlebars.vim | 5 ++--- syntax_checkers/haskell/ghc-mod.vim | 5 ++--- syntax_checkers/haskell/hdevtools.vim | 5 ++--- syntax_checkers/haskell/hlint.vim | 5 ++--- syntax_checkers/haxe/haxe.vim | 5 ++--- syntax_checkers/hss/hss.vim | 5 ++--- syntax_checkers/html/tidy.vim | 5 ++--- syntax_checkers/html/validator.vim | 2 +- syntax_checkers/html/w3.vim | 2 +- syntax_checkers/java/checkstyle.vim | 5 ++--- syntax_checkers/java/javac.vim | 5 ++--- syntax_checkers/javascript/closurecompiler.vim | 5 ++--- syntax_checkers/javascript/gjslint.vim | 5 ++--- syntax_checkers/javascript/jshint.vim | 5 ++--- syntax_checkers/javascript/jsl.vim | 5 ++--- syntax_checkers/javascript/jslint.vim | 5 ++--- syntax_checkers/json/jsonlint.vim | 5 ++--- syntax_checkers/json/jsonval.vim | 5 ++--- syntax_checkers/less/lessc.vim | 5 ++--- syntax_checkers/lisp/clisp.vim | 5 ++--- syntax_checkers/llvm/llvm.vim | 5 ++--- syntax_checkers/lua/luac.vim | 5 ++--- syntax_checkers/matlab/mlint.vim | 5 ++--- syntax_checkers/nasm/nasm.vim | 5 ++--- syntax_checkers/nroff/mandoc.vim | 5 ++--- syntax_checkers/objc/gcc.vim | 2 +- syntax_checkers/objc/oclint.vim | 13 +++---------- syntax_checkers/objc/ycm.vim | 11 ++--------- syntax_checkers/objcpp/gcc.vim | 2 +- syntax_checkers/objcpp/oclint.vim | 13 +++---------- syntax_checkers/objcpp/ycm.vim | 13 +++---------- syntax_checkers/ocaml/camlp4o.vim | 2 +- syntax_checkers/perl/perl.vim | 8 +++----- syntax_checkers/perl/perlcritic.vim | 5 ++--- syntax_checkers/perl/podchecker.vim | 13 +++---------- syntax_checkers/php/php.vim | 5 ++--- syntax_checkers/php/phpcs.vim | 5 ++--- syntax_checkers/php/phpmd.vim | 5 ++--- syntax_checkers/pod/podchecker.vim | 5 ++--- syntax_checkers/puppet/puppet.vim | 5 ++--- syntax_checkers/puppet/puppetlint.vim | 5 ++--- syntax_checkers/python/flake8.vim | 5 ++--- syntax_checkers/python/pep257.vim | 5 ++--- syntax_checkers/python/pep8.vim | 5 ++--- syntax_checkers/python/py3kwarn.vim | 5 ++--- syntax_checkers/python/pyflakes.vim | 5 ++--- syntax_checkers/python/pylama.vim | 5 ++--- syntax_checkers/python/pylint.vim | 5 ++--- syntax_checkers/python/python.vim | 5 ++--- syntax_checkers/rst/rst2pseudoxml.vim | 5 ++--- syntax_checkers/ruby/jruby.vim | 5 ++--- syntax_checkers/ruby/macruby.vim | 5 ++--- syntax_checkers/ruby/mri.vim | 5 ++--- syntax_checkers/ruby/rubocop.vim | 5 ++--- syntax_checkers/ruby/rubylint.vim | 5 ++--- syntax_checkers/rust/rustc.vim | 5 ++--- syntax_checkers/sass/sass.vim | 5 ++--- syntax_checkers/scala/fsc.vim | 5 ++--- syntax_checkers/scala/scalac.vim | 5 ++--- syntax_checkers/scss/sass.vim | 13 +++---------- syntax_checkers/sh/checkbashisms.vim | 5 ++--- syntax_checkers/sh/sh.vim | 8 +++----- syntax_checkers/slim/slimrb.vim | 5 ++--- syntax_checkers/tcl/nagelfar.vim | 5 ++--- syntax_checkers/tex/chktex.vim | 5 ++--- syntax_checkers/tex/lacheck.vim | 5 ++--- syntax_checkers/text/atdtool.vim | 5 ++--- syntax_checkers/twig/twiglint.vim | 5 ++--- syntax_checkers/typescript/tsc.vim | 5 ++--- syntax_checkers/vala/valac.vim | 5 ++--- syntax_checkers/verilog/verilator.vim | 2 +- syntax_checkers/vhdl/ghdl.vim | 5 ++--- syntax_checkers/xhtml/tidy.vim | 5 ++--- syntax_checkers/xml/xmllint.vim | 5 ++--- syntax_checkers/xslt/xmllint.vim | 13 +++---------- syntax_checkers/yaml/jsyaml.vim | 5 ++--- syntax_checkers/z80/z80syntaxchecker.vim | 5 ++--- syntax_checkers/zpt/zptlint.vim | 5 ++--- syntax_checkers/zsh/zsh.vim | 5 ++--- 121 files changed, 253 insertions(+), 407 deletions(-) diff --git a/autoload/syntastic/makeprg.vim b/autoload/syntastic/makeprg.vim index 4d7a0331f..f80258dbb 100644 --- a/autoload/syntastic/makeprg.vim +++ b/autoload/syntastic/makeprg.vim @@ -38,13 +38,12 @@ let g:loaded_syntastic_makeprg_autoload = 1 " function! syntastic#makeprg#build(opts) let builder = g:SyntasticMakeprgBuilder.New( + \ get(a:opts, 'checker', {}), \ get(a:opts, 'exe', ''), \ get(a:opts, 'args', ''), \ get(a:opts, 'fname', ''), \ get(a:opts, 'post_args', ''), - \ get(a:opts, 'tail', ''), - \ get(a:opts, 'filetype', ''), - \ get(a:opts, 'subchecker', '') ) + \ get(a:opts, 'tail', '') ) return builder.makeprg() endfunction diff --git a/plugin/syntastic/checker.vim b/plugin/syntastic/checker.vim index 3ab1d2123..e867af475 100644 --- a/plugin/syntastic/checker.vim +++ b/plugin/syntastic/checker.vim @@ -13,8 +13,13 @@ function! g:SyntasticChecker.New(args) let newObj._filetype = a:args['filetype'] let newObj._name = a:args['name'] + if has_key(a:args, 'redirect') + let [filetype, name] = split(a:args['redirect'], '/') + let prefix = 'SyntaxCheckers_' . filetype . '_' . name . '_' + else + let prefix = 'SyntaxCheckers_' . newObj._filetype . '_' . newObj._name . '_' + endif - let prefix = 'SyntaxCheckers_' . newObj._filetype . '_' . newObj._name . '_' let newObj._locListFunc = function(prefix . 'GetLocList') let newObj._isAvailableFunc = function(prefix . 'IsAvailable') @@ -47,6 +52,10 @@ function! g:SyntasticChecker.getLocList() return g:SyntasticLoclist.New(list) endfunction +function! g:SyntasticChecker.getLocListRaw() + return self._locListFunc() +endfunction + function! g:SyntasticChecker.getHighlightRegexFor(error) if empty(self._highlightRegexFunc) return [] diff --git a/plugin/syntastic/makeprg_builder.vim b/plugin/syntastic/makeprg_builder.vim index 1430dc5f0..295fe198f 100644 --- a/plugin/syntastic/makeprg_builder.vim +++ b/plugin/syntastic/makeprg_builder.vim @@ -7,15 +7,22 @@ let g:SyntasticMakeprgBuilder = {} " Public methods {{{1 -function! g:SyntasticMakeprgBuilder.New(exe, args, fname, post_args, tail, filetype, subchecker) +function! g:SyntasticMakeprgBuilder.New(checker, exe, args, fname, post_args, tail) let newObj = copy(self) let newObj._exe = a:exe let newObj._args = a:args let newObj._fname = a:fname let newObj._post_args = a:post_args let newObj._tail = a:tail - let newObj._filetype = empty(a:filetype) ? &filetype : a:filetype - let newObj._subchecker = a:subchecker + + if has_key(a:checker, 'getName') + let newObj._filetype = a:checker.getFiletype() + let newObj._subchecker = a:checker.getName() + else + let newObj._filetype = &filetype + let newObj._subchecker = '' + endif + return newObj endfunction diff --git a/syntax_checkers/ada/gcc.vim b/syntax_checkers/ada/gcc.vim index 7562d6093..8eabc04c1 100644 --- a/syntax_checkers/ada/gcc.vim +++ b/syntax_checkers/ada/gcc.vim @@ -27,7 +27,7 @@ if !exists('g:syntastic_ada_compiler_options') let g:syntastic_ada_compiler_options = '' endif -function! SyntaxCheckers_ada_gcc_GetLocList() +function! SyntaxCheckers_ada_gcc_GetLocList() dict return syntastic#c#GetLocList('ada', 'gcc', { \ 'errorformat': \ '%-G%f:%s:,' . diff --git a/syntax_checkers/applescript/osacompile.vim b/syntax_checkers/applescript/osacompile.vim index 7567eb081..4273e4e77 100644 --- a/syntax_checkers/applescript/osacompile.vim +++ b/syntax_checkers/applescript/osacompile.vim @@ -34,12 +34,11 @@ function! SyntaxCheckers_applescript_osacompile_IsAvailable() return executable('osacompile') endfunction -function! SyntaxCheckers_applescript_osacompile_GetLocList() +function! SyntaxCheckers_applescript_osacompile_GetLocList() dict let makeprg = syntastic#makeprg#build({ \ 'exe': 'osacompile', \ 'args': '-o ' . tempname() . '.scpt ', - \ 'filetype': 'applescript', - \ 'subchecker': 'osacompile' }) + \ 'checker': self }) let errorformat = '%f:%l:%m' return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) diff --git a/syntax_checkers/asciidoc/asciidoc.vim b/syntax_checkers/asciidoc/asciidoc.vim index faa907cb4..d9e40d326 100644 --- a/syntax_checkers/asciidoc/asciidoc.vim +++ b/syntax_checkers/asciidoc/asciidoc.vim @@ -19,12 +19,11 @@ function! SyntaxCheckers_asciidoc_asciidoc_IsAvailable() return executable("asciidoc") endfunction -function! SyntaxCheckers_asciidoc_asciidoc_GetLocList() +function! SyntaxCheckers_asciidoc_asciidoc_GetLocList() dict let makeprg = syntastic#makeprg#build({ \ 'exe': 'asciidoc', \ 'args': syntastic#c#NullOutput(), - \ 'filetype': 'asciidoc', - \ 'subchecker': 'asciidoc' }) + \ 'checker': self }) let errorformat = \ '%Easciidoc: %tRROR: %f: line %l: %m,' . diff --git a/syntax_checkers/c/checkpatch.vim b/syntax_checkers/c/checkpatch.vim index 3e077bdf8..cea54d670 100644 --- a/syntax_checkers/c/checkpatch.vim +++ b/syntax_checkers/c/checkpatch.vim @@ -25,12 +25,11 @@ function! SyntaxCheckers_c_checkpatch_IsAvailable() endfunction -function! SyntaxCheckers_c_checkpatch_GetLocList() +function! SyntaxCheckers_c_checkpatch_GetLocList() dict let makeprg = syntastic#makeprg#build({ \ 'exe': g:syntastic_c_checker_checkpatch_location, \ 'args': '--no-summary --no-tree --terse --file', - \ 'filetype': 'c', - \ 'subchecker': 'checkpatch' }) + \ 'checker': self }) let errorformat = \ '%f:%l: %tARNING: %m,' . diff --git a/syntax_checkers/c/gcc.vim b/syntax_checkers/c/gcc.vim index 4e6a26b68..0a73ab0c1 100644 --- a/syntax_checkers/c/gcc.vim +++ b/syntax_checkers/c/gcc.vim @@ -31,7 +31,7 @@ if !exists('g:syntastic_c_compiler_options') let g:syntastic_c_compiler_options = '-std=gnu99' endif -function! SyntaxCheckers_c_gcc_GetLocList() +function! SyntaxCheckers_c_gcc_GetLocList() dict return syntastic#c#GetLocList('c', 'gcc', { \ 'errorformat': \ '%-G%f:%s:,' . diff --git a/syntax_checkers/c/make.vim b/syntax_checkers/c/make.vim index 6620f84fe..e0da876c7 100644 --- a/syntax_checkers/c/make.vim +++ b/syntax_checkers/c/make.vim @@ -22,7 +22,7 @@ endfunction let s:save_cpo = &cpo set cpo&vim -function! SyntaxCheckers_c_make_GetLocList() +function! SyntaxCheckers_c_make_GetLocList() dict let makeprg = 'make -sk' diff --git a/syntax_checkers/c/oclint.vim b/syntax_checkers/c/oclint.vim index e366a7abf..b498b2c94 100644 --- a/syntax_checkers/c/oclint.vim +++ b/syntax_checkers/c/oclint.vim @@ -29,13 +29,12 @@ if !exists('g:syntastic_oclint_config_file') let g:syntastic_oclint_config_file = '.syntastic_oclint_config' endif -function! SyntaxCheckers_c_oclint_GetLocList() +function! SyntaxCheckers_c_oclint_GetLocList() dict let makeprg = syntastic#makeprg#build({ \ 'exe': 'oclint', \ 'args': '-text', \ 'post_args': '-- -c ' . syntastic#c#ReadConfig(g:syntastic_oclint_config_file), - \ 'filetype': 'c', - \ 'subchecker': 'oclint' }) + \ 'checker': self }) let errorformat = \ '%E%f:%l:%c: %m P1 ,' . diff --git a/syntax_checkers/c/sparse.vim b/syntax_checkers/c/sparse.vim index 0307e324f..21938f473 100644 --- a/syntax_checkers/c/sparse.vim +++ b/syntax_checkers/c/sparse.vim @@ -29,12 +29,11 @@ if !exists('g:syntastic_sparse_config_file') let g:syntastic_sparse_config_file = '.syntastic_sparse_config' endif -function! SyntaxCheckers_c_sparse_GetLocList() +function! SyntaxCheckers_c_sparse_GetLocList() dict let makeprg = syntastic#makeprg#build({ \ 'exe': 'sparse', \ 'args': '-ftabstop=' . &ts . ' ' . syntastic#c#ReadConfig(g:syntastic_sparse_config_file), - \ 'filetype': 'c', - \ 'subchecker': 'sparse' }) + \ 'checker': self }) let errorformat = '%f:%l:%v: %trror: %m,%f:%l:%v: %tarning: %m,' diff --git a/syntax_checkers/c/splint.vim b/syntax_checkers/c/splint.vim index 6b2a1c1bc..960e1370c 100644 --- a/syntax_checkers/c/splint.vim +++ b/syntax_checkers/c/splint.vim @@ -29,12 +29,11 @@ if !exists('g:syntastic_splint_config_file') let g:syntastic_splint_config_file = '.syntastic_splint_config' endif -function! SyntaxCheckers_c_splint_GetLocList() +function! SyntaxCheckers_c_splint_GetLocList() dict let makeprg = syntastic#makeprg#build({ \ 'exe': 'splint', \ 'post_args': '-showfunc -hints +quiet ' . syntastic#c#ReadConfig(g:syntastic_splint_config_file), - \ 'filetype': 'c', - \ 'subchecker': 'splint' }) + \ 'checker': self }) let errorformat = \ '%-G%f:%l:%v: %[%#]%[%#]%[%#] Internal Bug %.%#,' . diff --git a/syntax_checkers/c/ycm.vim b/syntax_checkers/c/ycm.vim index 5cce6fc56..002ede56c 100644 --- a/syntax_checkers/c/ycm.vim +++ b/syntax_checkers/c/ycm.vim @@ -23,7 +23,7 @@ if !exists('g:loaded_youcompleteme') finish endif -function! SyntaxCheckers_c_ycm_GetLocList() +function! SyntaxCheckers_c_ycm_GetLocList() dict return youcompleteme#CurrentFileDiagnostics() endfunction diff --git a/syntax_checkers/chef/foodcritic.vim b/syntax_checkers/chef/foodcritic.vim index 0808137bf..a016ef89c 100644 --- a/syntax_checkers/chef/foodcritic.vim +++ b/syntax_checkers/chef/foodcritic.vim @@ -19,11 +19,10 @@ function! SyntaxCheckers_chef_foodcritic_IsAvailable() return executable('foodcritic') endfunction -function! SyntaxCheckers_chef_foodcritic_GetLocList() +function! SyntaxCheckers_chef_foodcritic_GetLocList() dict let makeprg = syntastic#makeprg#build({ \ 'exe': 'foodcritic', - \ 'filetype': 'chef', - \ 'subchecker': 'foodcritic' }) + \ 'checker': self }) " FC023: Prefer conditional attributes: ./recipes/config.rb:49 let errorformat = 'FC%n: %m: %f:%l' diff --git a/syntax_checkers/co/coco.vim b/syntax_checkers/co/coco.vim index eea98bb89..7ed07c682 100644 --- a/syntax_checkers/co/coco.vim +++ b/syntax_checkers/co/coco.vim @@ -23,12 +23,11 @@ function! SyntaxCheckers_co_coco_IsAvailable() return executable('coco') endfunction -function! SyntaxCheckers_co_coco_GetLocList() +function! SyntaxCheckers_co_coco_GetLocList() dict let makeprg = syntastic#makeprg#build({ \ 'exe': 'coco', \ 'args': '-c -o /tmp', - \ 'filetype': 'co', - \ 'subchecker': 'coco' }) + \ 'checker': self }) let errorformat = \ '%EFailed at: %f,' . diff --git a/syntax_checkers/cobol/cobc.vim b/syntax_checkers/cobol/cobc.vim index 9399d432a..edaa4ec8a 100644 --- a/syntax_checkers/cobol/cobc.vim +++ b/syntax_checkers/cobol/cobc.vim @@ -31,7 +31,7 @@ if !exists('g:syntastic_cobol_compiler_options') let g:syntastic_cobol_compiler_options = '' endif -function! SyntaxCheckers_cobol_cobc_GetLocList() +function! SyntaxCheckers_cobol_cobc_GetLocList() dict return syntastic#c#GetLocList('cobol', 'cobc', { \ 'errorformat': '%f:%l: %trror: %m', \ 'main_flags': '-fsyntax-only' }) diff --git a/syntax_checkers/coffee/coffee.vim b/syntax_checkers/coffee/coffee.vim index 67054df8f..c72d62ed1 100644 --- a/syntax_checkers/coffee/coffee.vim +++ b/syntax_checkers/coffee/coffee.vim @@ -22,12 +22,11 @@ function! SyntaxCheckers_coffee_coffee_IsAvailable() \ syntastic#util#versionIsAtLeast(syntastic#util#getVersion('coffee --version 2>' . syntastic#util#DevNull()), [1,6,2]) endfunction -function! SyntaxCheckers_coffee_coffee_GetLocList() +function! SyntaxCheckers_coffee_coffee_GetLocList() dict let makeprg = syntastic#makeprg#build({ \ 'exe': 'coffee', \ 'args': '-cp', - \ 'filetype': 'coffee', - \ 'subchecker': 'coffee' }) + \ 'checker': self }) let errorformat = \ '%E%f:%l:%c: %trror: %m,' . diff --git a/syntax_checkers/coffee/coffeelint.vim b/syntax_checkers/coffee/coffeelint.vim index 2099359cc..a7bdeae5c 100644 --- a/syntax_checkers/coffee/coffeelint.vim +++ b/syntax_checkers/coffee/coffeelint.vim @@ -18,12 +18,11 @@ function! SyntaxCheckers_coffee_coffeelint_IsAvailable() return executable('coffeelint') endfunction -function! SyntaxCheckers_coffee_coffeelint_GetLocList() +function! SyntaxCheckers_coffee_coffeelint_GetLocList() dict let makeprg = syntastic#makeprg#build({ \ 'exe': 'coffeelint', \ 'args': '--csv', - \ 'filetype': 'coffee', - \ 'subchecker': 'coffeelint' }) + \ 'checker': self }) let errorformat = \ '%f\,%l\,%\d%#\,%trror\,%m,' . diff --git a/syntax_checkers/coq/coqtop.vim b/syntax_checkers/coq/coqtop.vim index f1efa4d88..b58a7ac92 100644 --- a/syntax_checkers/coq/coqtop.vim +++ b/syntax_checkers/coq/coqtop.vim @@ -19,12 +19,11 @@ function! SyntaxCheckers_coq_coqtop_IsAvailable() return executable('coqtop') endfunction -function! SyntaxCheckers_coq_coqtop_GetLocList() +function! SyntaxCheckers_coq_coqtop_GetLocList() dict let makeprg = syntastic#makeprg#build({ \ 'exe': 'coqtop', \ 'args': '-noglob -batch -load-vernac-source', - \ 'filetype': 'coq', - \ 'subchecker': 'coqtop' }) + \ 'checker': self }) let errorformat = \ '%AFile \"%f\"\, line %l\, characters %c\-%.%#\:,'. diff --git a/syntax_checkers/cpp/cpplint.vim b/syntax_checkers/cpp/cpplint.vim index 35e77ccc5..7bcb2f9af 100644 --- a/syntax_checkers/cpp/cpplint.vim +++ b/syntax_checkers/cpp/cpplint.vim @@ -39,11 +39,10 @@ function! SyntaxCheckers_cpp_cpplint_IsAvailable() return executable('cpplint.py') endfunction -function! SyntaxCheckers_cpp_cpplint_GetLocList() +function! SyntaxCheckers_cpp_cpplint_GetLocList() dict let makeprg = syntastic#makeprg#build({ \ 'exe': 'cpplint.py', - \ 'filetype': 'cpp', - \ 'subchecker': 'cpplint' }) + \ 'checker': self }) let errorformat = '%A%f:%l: %m [%t],%-G%.%#' diff --git a/syntax_checkers/cpp/gcc.vim b/syntax_checkers/cpp/gcc.vim index de1fa6575..c5cc59ff4 100644 --- a/syntax_checkers/cpp/gcc.vim +++ b/syntax_checkers/cpp/gcc.vim @@ -30,7 +30,7 @@ if !exists('g:syntastic_cpp_compiler_options') let g:syntastic_cpp_compiler_options = '' endif -function! SyntaxCheckers_cpp_gcc_GetLocList() +function! SyntaxCheckers_cpp_gcc_GetLocList() dict return syntastic#c#GetLocList('cpp', 'gcc', { \ 'errorformat': \ '%-G%f:%s:,' . diff --git a/syntax_checkers/cpp/oclint.vim b/syntax_checkers/cpp/oclint.vim index 867f15de7..70d64b68c 100644 --- a/syntax_checkers/cpp/oclint.vim +++ b/syntax_checkers/cpp/oclint.vim @@ -21,16 +21,9 @@ if exists("g:loaded_syntastic_cpp_oclint_checker") endif let g:loaded_syntastic_cpp_oclint_checker = 1 -function! SyntaxCheckers_cpp_oclint_IsAvailable() - return SyntaxCheckers_c_oclint_IsAvailable() -endfunction - -function! SyntaxCheckers_cpp_oclint_GetLocList() - return SyntaxCheckers_c_oclint_GetLocList() -endfunction +runtime! syntax_checkers/c/*.vim call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'cpp', - \ 'name': 'oclint'}) - -runtime! syntax_checkers/c/*.vim + \ 'name': 'oclint', + \ 'redirect': 'c/oclint'}) diff --git a/syntax_checkers/cpp/ycm.vim b/syntax_checkers/cpp/ycm.vim index b0dbab580..df39a5205 100644 --- a/syntax_checkers/cpp/ycm.vim +++ b/syntax_checkers/cpp/ycm.vim @@ -15,20 +15,13 @@ if exists("g:loaded_syntastic_cpp_ycm_checker") endif let g:loaded_syntastic_cpp_ycm_checker = 1 -function! SyntaxCheckers_cpp_ycm_IsAvailable() - return SyntaxCheckers_c_ycm_IsAvailable() -endfunction +runtime! syntax_checkers/c/*.vim if !exists('g:loaded_youcompleteme') finish endif -function! SyntaxCheckers_cpp_ycm_GetLocList() - return SyntaxCheckers_c_ycm_GetLocList() -endfunction - call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'cpp', - \ 'name': 'ycm'}) - -runtime! syntax_checkers/c/*.vim + \ 'name': 'ycm', + \ 'redirect': 'c/ycm'}) diff --git a/syntax_checkers/cs/mcs.vim b/syntax_checkers/cs/mcs.vim index b3c96a958..818a460e9 100644 --- a/syntax_checkers/cs/mcs.vim +++ b/syntax_checkers/cs/mcs.vim @@ -19,12 +19,11 @@ function! SyntaxCheckers_cs_mcs_IsAvailable() return executable('mcs') endfunction -function! SyntaxCheckers_cs_mcs_GetLocList() +function! SyntaxCheckers_cs_mcs_GetLocList() dict let makeprg = syntastic#makeprg#build({ \ 'exe': 'mcs', \ 'args': '--parse', - \ 'filetype': 'cs', - \ 'subchecker': 'mcs' }) + \ 'checker': self }) let errorformat = '%f(%l\,%c): %trror %m' diff --git a/syntax_checkers/css/csslint.vim b/syntax_checkers/css/csslint.vim index 9093d982c..f047d1727 100644 --- a/syntax_checkers/css/csslint.vim +++ b/syntax_checkers/css/csslint.vim @@ -31,12 +31,11 @@ function! SyntaxCheckers_css_csslint_IsAvailable() return executable(expand(g:syntastic_csslint_exec)) endfunction -function! SyntaxCheckers_css_csslint_GetLocList() +function! SyntaxCheckers_css_csslint_GetLocList() dict let makeprg = syntastic#makeprg#build({ \ 'exe': expand(g:syntastic_csslint_exec), \ 'args': '--format=compact ' . g:syntastic_csslint_options, - \ 'filetype': 'css', - \ 'subchecker': 'csslint' }) + \ 'checker': self }) " Print CSS Lint's error/warning messages from compact format. Ignores blank lines. let errorformat = diff --git a/syntax_checkers/css/phpcs.vim b/syntax_checkers/css/phpcs.vim index ffcb7feeb..8dc34a2c4 100644 --- a/syntax_checkers/css/phpcs.vim +++ b/syntax_checkers/css/phpcs.vim @@ -18,16 +18,9 @@ if exists("g:loaded_syntastic_css_phpcs_checker") endif let g:loaded_syntastic_css_phpcs_checker=1 -function! SyntaxCheckers_css_phpcs_IsAvailable() - return SyntaxCheckers_php_phpcs_IsAvailable() -endfunction - -function! SyntaxCheckers_css_phpcs_GetLocList() - return SyntaxCheckers_php_phpcs_GetLocList() -endfunction +runtime! syntax_checkers/php/*.vim call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'css', - \ 'name': 'phpcs'}) - -runtime! syntax_checkers/php/*.vim + \ 'name': 'phpcs', + \ 'redirect': 'php/phpcs'}) diff --git a/syntax_checkers/css/prettycss.vim b/syntax_checkers/css/prettycss.vim index efc549a71..30b9392cd 100644 --- a/syntax_checkers/css/prettycss.vim +++ b/syntax_checkers/css/prettycss.vim @@ -32,11 +32,10 @@ function! SyntaxCheckers_css_prettycss_GetHighlightRegex(item) return term endfunction -function! SyntaxCheckers_css_prettycss_GetLocList() +function! SyntaxCheckers_css_prettycss_GetLocList() dict let makeprg = syntastic#makeprg#build({ \ 'exe': 'prettycss', - \ 'filetype': 'css', - \ 'subchecker': 'prettycss' }) + \ 'checker': self }) " Print CSS Lint's error/warning messages from compact format. Ignores blank lines. let errorformat = diff --git a/syntax_checkers/cucumber/cucumber.vim b/syntax_checkers/cucumber/cucumber.vim index 4458c78f6..187f61263 100644 --- a/syntax_checkers/cucumber/cucumber.vim +++ b/syntax_checkers/cucumber/cucumber.vim @@ -19,12 +19,11 @@ function! SyntaxCheckers_cucumber_cucumber_IsAvailable() return executable('cucumber') endfunction -function! SyntaxCheckers_cucumber_cucumber_GetLocList() +function! SyntaxCheckers_cucumber_cucumber_GetLocList() dict let makeprg = syntastic#makeprg#build({ \ 'exe': 'cucumber', \ 'args': '--dry-run --quiet --strict --format pretty', - \ 'filetype': 'cucumber', - \ 'subchecker': 'cucumber' }) + \ 'checker': self }) let errorformat = \ '%f:%l:%c:%m,' . diff --git a/syntax_checkers/cuda/nvcc.vim b/syntax_checkers/cuda/nvcc.vim index 8f99b0dcf..ad92fc7b9 100644 --- a/syntax_checkers/cuda/nvcc.vim +++ b/syntax_checkers/cuda/nvcc.vim @@ -28,7 +28,7 @@ function! SyntaxCheckers_cuda_nvcc_IsAvailable() return executable('nvcc') endfunction -function! SyntaxCheckers_cuda_nvcc_GetLocList() +function! SyntaxCheckers_cuda_nvcc_GetLocList() dict if exists('g:syntastic_cuda_arch') let arch_flag = '-arch=' . g:syntastic_cuda_arch else diff --git a/syntax_checkers/d/dmd.vim b/syntax_checkers/d/dmd.vim index 894ec6d73..267f8a29e 100644 --- a/syntax_checkers/d/dmd.vim +++ b/syntax_checkers/d/dmd.vim @@ -35,7 +35,7 @@ if !exists('g:syntastic_d_compiler_options') let g:syntastic_d_compiler_options = '' endif -function! SyntaxCheckers_d_dmd_GetLocList() +function! SyntaxCheckers_d_dmd_GetLocList() dict return syntastic#c#GetLocList('d', 'dmd', { \ 'errorformat': \ '%-G%f:%s:,%f(%l): %m,' . diff --git a/syntax_checkers/dart/dart_analyzer.vim b/syntax_checkers/dart/dart_analyzer.vim index a0835c41c..00420e9e3 100644 --- a/syntax_checkers/dart/dart_analyzer.vim +++ b/syntax_checkers/dart/dart_analyzer.vim @@ -28,14 +28,13 @@ function! SyntaxCheckers_dart_dart_analyzer_GetHighlightRegex(error) return '\%>'.lcol.'c\%<'.rcol.'c' endfunction -function! SyntaxCheckers_dart_dart_analyzer_GetLocList() +function! SyntaxCheckers_dart_dart_analyzer_GetLocList() dict let args = !empty(g:syntastic_dart_analyzer_conf) ? ' ' . g:syntastic_dart_analyzer_conf : '' let makeprg = syntastic#makeprg#build({ \ 'exe': 'dart_analyzer', \ 'args': '--error_format machine', \ 'post_args': args, - \ 'filetype': 'dart', - \ 'subchecker': 'dart_analyzer' }) + \ 'checker': self }) " Machine readable format looks like: " SEVERITY|TYPE|ERROR_CODE|file:FILENAME|LINE_NUMBER|COLUMN|LENGTH|MESSAGE diff --git a/syntax_checkers/docbk/xmllint.vim b/syntax_checkers/docbk/xmllint.vim index cc0e3e35c..78d801a71 100644 --- a/syntax_checkers/docbk/xmllint.vim +++ b/syntax_checkers/docbk/xmllint.vim @@ -15,16 +15,9 @@ if exists("g:loaded_syntastic_docbk_xmllint_checker") endif let g:loaded_syntastic_docbk_xmllint_checker=1 -function! SyntaxCheckers_docbk_xmllint_IsAvailable() - return SyntaxCheckers_xml_xmllint_IsAvailable() -endfunction - -function! SyntaxCheckers_docbk_xmllint_GetLocList() - return SyntaxCheckers_xml_xmllint_GetLocList() -endfunction +runtime! syntax_checkers/xml/*.vim call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'docbk', - \ 'name': 'xmllint'}) - -runtime! syntax_checkers/xml/*.vim + \ 'name': 'xmllint', + \ 'redirect': 'xml/xmllint'}) diff --git a/syntax_checkers/dustjs/swiffer.vim b/syntax_checkers/dustjs/swiffer.vim index 466a4999f..eebd0beba 100644 --- a/syntax_checkers/dustjs/swiffer.vim +++ b/syntax_checkers/dustjs/swiffer.vim @@ -19,11 +19,10 @@ function! SyntaxCheckers_dustjs_swiffer_IsAvailable() return executable('swiffer') endfunction -function! SyntaxCheckers_dustjs_swiffer_GetLocList() +function! SyntaxCheckers_dustjs_swiffer_GetLocList() dict let makeprg = syntastic#makeprg#build({ \ 'exe': 'swiffer', - \ 'subchecker': 'swiffer', - \ 'filetype': 'dustjs' }) + \ 'checker': self }) let errorformat = '%E%f - Line %l\, Column %c: %m' diff --git a/syntax_checkers/elixir/elixir.vim b/syntax_checkers/elixir/elixir.vim index 521e94561..be7e1241d 100644 --- a/syntax_checkers/elixir/elixir.vim +++ b/syntax_checkers/elixir/elixir.vim @@ -19,7 +19,7 @@ function! SyntaxCheckers_elixir_elixir_IsAvailable() return executable('elixir') && executable('mix') endfunction -function! SyntaxCheckers_elixir_elixir_GetLocList() +function! SyntaxCheckers_elixir_elixir_GetLocList() dict let make_options = {} let compile_command = 'elixir' @@ -32,8 +32,7 @@ function! SyntaxCheckers_elixir_elixir_GetLocList() let make_options['makeprg'] = syntastic#makeprg#build({ \ 'exe': compile_command, - \ 'filetype': 'elixir', - \ 'subchecker': 'elixir' }) + \ 'checker': self }) let make_options['errorformat'] = '** %*[^\ ] %f:%l: %m' diff --git a/syntax_checkers/erlang/escript.vim b/syntax_checkers/erlang/escript.vim index 9c409a594..20f6f71aa 100644 --- a/syntax_checkers/erlang/escript.vim +++ b/syntax_checkers/erlang/escript.vim @@ -25,7 +25,7 @@ function! SyntaxCheckers_erlang_escript_IsAvailable() return executable('escript') endfunction -function! SyntaxCheckers_erlang_escript_GetLocList() +function! SyntaxCheckers_erlang_escript_GetLocList() dict if expand('%:e') ==# 'hrl' return [] endif @@ -43,8 +43,7 @@ function! SyntaxCheckers_erlang_escript_GetLocList() \ 'args': args, \ 'fname': syntastic#util#shexpand('%:p'), \ 'post_args': post_args, - \ 'filetype': 'erlang', - \ 'subchecker': 'escript' }) + \ 'checker': self }) let errorformat = \ '%W%f:%l: warning: %m,'. diff --git a/syntax_checkers/eruby/ruby.vim b/syntax_checkers/eruby/ruby.vim index dc496955e..8df5db8eb 100644 --- a/syntax_checkers/eruby/ruby.vim +++ b/syntax_checkers/eruby/ruby.vim @@ -23,7 +23,7 @@ function! SyntaxCheckers_eruby_ruby_IsAvailable() return executable(expand(g:syntastic_ruby_exec)) endfunction -function! SyntaxCheckers_eruby_ruby_GetLocList() +function! SyntaxCheckers_eruby_ruby_GetLocList() dict let exe = expand(g:syntastic_ruby_exec) if !has('win32') let exe = 'RUBYOPT= ' . exe diff --git a/syntax_checkers/fortran/gfortran.vim b/syntax_checkers/fortran/gfortran.vim index 002ad9c34..f75277796 100644 --- a/syntax_checkers/fortran/gfortran.vim +++ b/syntax_checkers/fortran/gfortran.vim @@ -30,7 +30,7 @@ if !exists('g:syntastic_fortran_compiler_options') let g:syntastic_fortran_compiler_options = '' endif -function! SyntaxCheckers_fortran_gfortran_GetLocList() +function! SyntaxCheckers_fortran_gfortran_GetLocList() dict return syntastic#c#GetLocList('fortran', 'gfortran', { \ 'errorformat': \ '%-C %#,'. diff --git a/syntax_checkers/go/go.vim b/syntax_checkers/go/go.vim index aa0427e39..e4f8f3f7c 100644 --- a/syntax_checkers/go/go.vim +++ b/syntax_checkers/go/go.vim @@ -21,7 +21,7 @@ function! SyntaxCheckers_go_go_IsAvailable() return executable('go') endfunction -function! SyntaxCheckers_go_go_GetLocList() +function! SyntaxCheckers_go_go_GetLocList() dict " 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. @@ -29,8 +29,7 @@ function! SyntaxCheckers_go_go_GetLocList() \ 'exe': 'gofmt', \ 'args': '-l', \ 'tail': '1>' . syntastic#util#DevNull(), - \ 'filetype': 'go', - \ 'subchecker': 'go' }) + \ 'checker': self }) let errorformat = \ '%f:%l:%c: %m,' . diff --git a/syntax_checkers/go/gofmt.vim b/syntax_checkers/go/gofmt.vim index b150916fd..4ad6e94a9 100644 --- a/syntax_checkers/go/gofmt.vim +++ b/syntax_checkers/go/gofmt.vim @@ -21,13 +21,12 @@ function! SyntaxCheckers_go_gofmt_IsAvailable() return executable('gofmt') endfunction -function! SyntaxCheckers_go_gofmt_GetLocList() +function! SyntaxCheckers_go_gofmt_GetLocList() dict let makeprg = syntastic#makeprg#build({ \ 'exe': 'gofmt', \ 'args': '-l', \ 'tail': '1>' . syntastic#util#DevNull(), - \ 'filetype': 'go', - \ 'subchecker': 'gofmt' }) + \ 'checker': self }) let errorformat = '%f:%l:%c: %m,%-G%.%#' diff --git a/syntax_checkers/go/golint.vim b/syntax_checkers/go/golint.vim index 954a7c2a6..98ec7bc2f 100644 --- a/syntax_checkers/go/golint.vim +++ b/syntax_checkers/go/golint.vim @@ -18,11 +18,10 @@ function! SyntaxCheckers_go_golint_IsAvailable() return executable('golint') endfunction -function! SyntaxCheckers_go_golint_GetLocList() +function! SyntaxCheckers_go_golint_GetLocList() dict let makeprg = syntastic#makeprg#build({ \ 'exe': 'golint', - \ 'filetype': 'go', - \ 'subchecker': 'golint' }) + \ 'checker': self }) let errorformat = '%f:%l:%c: %m,%-G%.%#' diff --git a/syntax_checkers/go/govet.vim b/syntax_checkers/go/govet.vim index 4b1d7efb9..901dcf582 100644 --- a/syntax_checkers/go/govet.vim +++ b/syntax_checkers/go/govet.vim @@ -18,7 +18,7 @@ function! SyntaxCheckers_go_govet_IsAvailable() return executable('go') endfunction -function! SyntaxCheckers_go_govet_GetLocList() +function! SyntaxCheckers_go_govet_GetLocList() dict let makeprg = 'go vet' let errorformat = '%Evet: %.%\+: %f:%l:%c: %m,%W%f:%l: %m,%-G%.%#' diff --git a/syntax_checkers/haml/haml.vim b/syntax_checkers/haml/haml.vim index 8371055fb..93adc502c 100644 --- a/syntax_checkers/haml/haml.vim +++ b/syntax_checkers/haml/haml.vim @@ -23,12 +23,11 @@ function! SyntaxCheckers_haml_haml_IsAvailable() return executable(expand(g:syntastic_haml_interpreter)) endfunction -function! SyntaxCheckers_haml_haml_GetLocList() +function! SyntaxCheckers_haml_haml_GetLocList() dict let makeprg = syntastic#makeprg#build({ \ 'exe': expand(g:syntastic_haml_interpreter), \ 'args': '-c', - \ 'filetype': 'haml', - \ 'subchecker': 'haml' }) + \ 'checker': self }) let errorformat = \ 'Haml error on line %l: %m,' . diff --git a/syntax_checkers/handlebars/handlebars.vim b/syntax_checkers/handlebars/handlebars.vim index e55ba43f1..1e8a40ba3 100644 --- a/syntax_checkers/handlebars/handlebars.vim +++ b/syntax_checkers/handlebars/handlebars.vim @@ -17,12 +17,11 @@ function! SyntaxCheckers_handlebars_handlebars_IsAvailable() return executable('handlebars') endfunction -function! SyntaxCheckers_handlebars_handlebars_GetLocList() +function! SyntaxCheckers_handlebars_handlebars_GetLocList() dict let makeprg = syntastic#makeprg#build({ \ 'exe': 'handlebars', \ 'args': '-f ' . syntastic#util#DevNull(), - \ 'filetype': 'handlebars', - \ 'subchecker': 'handlebars' }) + \ 'checker': self }) let errorformat = \ '%EError: %m on line %l:,'. diff --git a/syntax_checkers/haskell/ghc-mod.vim b/syntax_checkers/haskell/ghc-mod.vim index 3dcc6e7e4..4a8689a45 100644 --- a/syntax_checkers/haskell/ghc-mod.vim +++ b/syntax_checkers/haskell/ghc-mod.vim @@ -19,11 +19,10 @@ function! SyntaxCheckers_haskell_ghc_mod_IsAvailable() return executable('ghc-mod') endfunction -function! SyntaxCheckers_haskell_ghc_mod_GetLocList() +function! SyntaxCheckers_haskell_ghc_mod_GetLocList() dict let makeprg = syntastic#makeprg#build({ \ 'exe': 'ghc-mod check', - \ 'filetype': 'haskell', - \ 'subchecker': 'ghc_mod' }) + \ 'checker': self }) let errorformat = \ '%-G%\s%#,' . diff --git a/syntax_checkers/haskell/hdevtools.vim b/syntax_checkers/haskell/hdevtools.vim index 58b015f9a..c7fb45cb9 100644 --- a/syntax_checkers/haskell/hdevtools.vim +++ b/syntax_checkers/haskell/hdevtools.vim @@ -19,12 +19,11 @@ function! SyntaxCheckers_haskell_hdevtools_IsAvailable() return executable('hdevtools') endfunction -function! SyntaxCheckers_haskell_hdevtools_GetLocList() +function! SyntaxCheckers_haskell_hdevtools_GetLocList() dict let makeprg = syntastic#makeprg#build({ \ 'exe': 'hdevtools check', \ 'args': get(g:, 'hdevtools_options', ''), - \ 'filetype': 'haskell', - \ 'subchecker': 'hdevtools' }) + \ 'checker': self }) let errorformat= '\%-Z\ %#,'. \ '%W%f:%l:%c:\ Warning:\ %m,'. diff --git a/syntax_checkers/haskell/hlint.vim b/syntax_checkers/haskell/hlint.vim index f9f0fcd48..da94b1ef9 100644 --- a/syntax_checkers/haskell/hlint.vim +++ b/syntax_checkers/haskell/hlint.vim @@ -14,11 +14,10 @@ function! SyntaxCheckers_haskell_hlint_IsAvailable() return executable('hlint') endfunction -function! SyntaxCheckers_haskell_hlint_GetLocList() +function! SyntaxCheckers_haskell_hlint_GetLocList() dict let makeprg = syntastic#makeprg#build({ \ 'exe': 'hlint', - \ 'filetype': 'haskell', - \ 'subchecker': 'hlint' }) + \ 'checker': self }) let errorformat = \ '%E%f:%l:%c: Error: %m,' . diff --git a/syntax_checkers/haxe/haxe.vim b/syntax_checkers/haxe/haxe.vim index 969a93692..532bc10bb 100644 --- a/syntax_checkers/haxe/haxe.vim +++ b/syntax_checkers/haxe/haxe.vim @@ -19,7 +19,7 @@ function! SyntaxCheckers_haxe_haxe_IsAvailable() return executable('haxe') endfunction -function! SyntaxCheckers_haxe_haxe_GetLocList() +function! SyntaxCheckers_haxe_haxe_GetLocList() dict if exists('b:vaxe_hxml') let hxml = b:vaxe_hxml elseif exists('g:vaxe_hxml') @@ -33,8 +33,7 @@ function! SyntaxCheckers_haxe_haxe_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'haxe', \ 'fname': syntastic#util#shescape(fnameescape(fnamemodify(hxml, ':t'))), - \ 'filetype': 'haxe', - \ 'subchecker': 'haxe' }) + \ 'checker': self }) let errorformat = '%E%f:%l: characters %c-%*[0-9] : %m' diff --git a/syntax_checkers/hss/hss.vim b/syntax_checkers/hss/hss.vim index 5d2cf0055..62c53e128 100644 --- a/syntax_checkers/hss/hss.vim +++ b/syntax_checkers/hss/hss.vim @@ -19,12 +19,11 @@ function! SyntaxCheckers_hss_hss_IsAvailable() return executable('hss') endfunction -function! SyntaxCheckers_hss_hss_GetLocList() +function! SyntaxCheckers_hss_hss_GetLocList() dict let makeprg = syntastic#makeprg#build({ \ 'exe': 'hss', \ 'args' : '-output ' . syntastic#util#DevNull(), - \ 'filetype': 'hss', - \ 'subchecker': 'hss' }) + \ 'checker': self }) let errorformat = '%E%f:%l: %m' diff --git a/syntax_checkers/html/tidy.vim b/syntax_checkers/html/tidy.vim index 14f79f7bb..eb978694f 100644 --- a/syntax_checkers/html/tidy.vim +++ b/syntax_checkers/html/tidy.vim @@ -139,13 +139,12 @@ function! s:Args() return args endfunction -function! SyntaxCheckers_html_tidy_GetLocList() +function! SyntaxCheckers_html_tidy_GetLocList() dict let makeprg = syntastic#makeprg#build({ \ 'exe': 'tidy', \ 'args': s:Args(), \ 'tail': '2>&1', - \ 'filetype': 'html', - \ 'subchecker': 'tidy' }) + \ 'checker': self }) let errorformat = \ '%Wline %l column %v - Warning: %m,' . diff --git a/syntax_checkers/html/validator.vim b/syntax_checkers/html/validator.vim index d26f7c0e9..9883e0d4a 100644 --- a/syntax_checkers/html/validator.vim +++ b/syntax_checkers/html/validator.vim @@ -64,7 +64,7 @@ function! SyntaxCheckers_html_validator_Preprocess(errors) return out endfunction -function! SyntaxCheckers_html_validator_GetLocList() +function! SyntaxCheckers_html_validator_GetLocList() dict let fname = syntastic#util#shexpand('%') let makeprg = 'curl -s --compressed -F out=gnu -F asciiquotes=yes' . \ (!empty(g:syntastic_html_validator_parser) ? ' -F parser=' . g:syntastic_html_validator_parser : '') . diff --git a/syntax_checkers/html/w3.vim b/syntax_checkers/html/w3.vim index 94aa650cf..e1ebcfe1c 100644 --- a/syntax_checkers/html/w3.vim +++ b/syntax_checkers/html/w3.vim @@ -30,7 +30,7 @@ function! SyntaxCheckers_html_w3_IsAvailable() return executable('curl') endfunction -function! SyntaxCheckers_html_w3_GetLocList() +function! SyntaxCheckers_html_w3_GetLocList() dict let makeprg = 'curl -s -F output=json ' . \ '-F uploaded_file=@' . syntastic#util#shexpand('%:p') . '\;type=text/html ' . \ g:syntastic_html_w3_api diff --git a/syntax_checkers/java/checkstyle.vim b/syntax_checkers/java/checkstyle.vim index 058d44f95..b70db1fd4 100644 --- a/syntax_checkers/java/checkstyle.vim +++ b/syntax_checkers/java/checkstyle.vim @@ -39,7 +39,7 @@ function! SyntaxCheckers_java_checkstyle_Preprocess(errors) return out endfunction -function! SyntaxCheckers_java_checkstyle_GetLocList() +function! SyntaxCheckers_java_checkstyle_GetLocList() dict let fname = syntastic#util#shescape( expand('%:p:h') . '/' . expand('%:t') ) @@ -53,8 +53,7 @@ function! SyntaxCheckers_java_checkstyle_GetLocList() \ ' com.puppycrawl.tools.checkstyle.Main -c ' . g:syntastic_java_checkstyle_conf_file . \ ' -f xml', \ 'fname': fname, - \ 'filetype': 'java', - \ 'subchecker': 'checkstyle' }) + \ 'checker': self }) let errorformat = \ '%P,' . diff --git a/syntax_checkers/java/javac.vim b/syntax_checkers/java/javac.vim index e9b140309..784a17ceb 100644 --- a/syntax_checkers/java/javac.vim +++ b/syntax_checkers/java/javac.vim @@ -267,7 +267,7 @@ function! s:MavenOutputDirectory() return '.' endfunction -function! SyntaxCheckers_java_javac_GetLocList() +function! SyntaxCheckers_java_javac_GetLocList() dict let javac_opts = g:syntastic_java_javac_options @@ -335,8 +335,7 @@ function! SyntaxCheckers_java_javac_GetLocList() \ 'args': javac_opts, \ 'fname': fname, \ 'tail': '2>&1', - \ 'filetype': 'java', - \ 'subchecker': 'javac' }) + \ 'checker': self }) " unashamedly stolen from *errorformat-javac* (quickfix.txt) and modified to include error types let errorformat = diff --git a/syntax_checkers/javascript/closurecompiler.vim b/syntax_checkers/javascript/closurecompiler.vim index 6c55f4f21..36c758f42 100644 --- a/syntax_checkers/javascript/closurecompiler.vim +++ b/syntax_checkers/javascript/closurecompiler.vim @@ -34,7 +34,7 @@ function! SyntaxCheckers_javascript_closurecompiler_IsAvailable() return exists("g:syntastic_javascript_closure_compiler_path") endfunction -function! SyntaxCheckers_javascript_closurecompiler_GetLocList() +function! SyntaxCheckers_javascript_closurecompiler_GetLocList() dict if exists("g:syntastic_javascript_closure_compiler_file_list") let file_list = join(readfile(g:syntastic_javascript_closure_compiler_file_list), ' ') else @@ -45,8 +45,7 @@ function! SyntaxCheckers_javascript_closurecompiler_GetLocList() \ 'exe': 'java -jar ' . g:syntastic_javascript_closure_compiler_path, \ 'args': g:syntastic_javascript_closure_compiler_options . ' --js' , \ 'fname': file_list, - \ 'filetype': 'javascript', - \ 'subchecker': 'closurecompiler' }) + \ 'checker': self }) let errorformat = \ '%-GOK,'. diff --git a/syntax_checkers/javascript/gjslint.vim b/syntax_checkers/javascript/gjslint.vim index 039d0eed0..72e9ac511 100644 --- a/syntax_checkers/javascript/gjslint.vim +++ b/syntax_checkers/javascript/gjslint.vim @@ -21,12 +21,11 @@ function! SyntaxCheckers_javascript_gjslint_IsAvailable() return executable('gjslint') endfunction -function! SyntaxCheckers_javascript_gjslint_GetLocList() +function! SyntaxCheckers_javascript_gjslint_GetLocList() dict let makeprg = syntastic#makeprg#build({ \ 'exe': 'gjslint', \ 'args': g:syntastic_javascript_gjslint_conf . " --nosummary --unix_mode --nodebug_indentation --nobeep", - \ 'filetype': 'javascript', - \ 'subchecker': 'gjslint' }) + \ 'checker': self }) let errorformat = \ "%f:%l:(New Error -%\\?\%n) %m," . diff --git a/syntax_checkers/javascript/jshint.vim b/syntax_checkers/javascript/jshint.vim index b4c576ea5..528c27292 100644 --- a/syntax_checkers/javascript/jshint.vim +++ b/syntax_checkers/javascript/jshint.vim @@ -26,13 +26,12 @@ function! SyntaxCheckers_javascript_jshint_IsAvailable() return executable(expand(g:syntastic_jshint_exec)) endfunction -function! SyntaxCheckers_javascript_jshint_GetLocList() +function! SyntaxCheckers_javascript_jshint_GetLocList() dict let jshint_new = s:JshintNew() let makeprg = syntastic#makeprg#build({ \ 'exe': expand(g:syntastic_jshint_exec), \ 'post_args': (jshint_new ? ' --verbose ' : '') . s:Args(), - \ 'filetype': 'javascript', - \ 'subchecker': 'jshint' }) + \ 'checker': self }) let errorformat = jshint_new ? \ '%f: line %l\, col %c\, %m \(%t%*\d\)' : diff --git a/syntax_checkers/javascript/jsl.vim b/syntax_checkers/javascript/jsl.vim index 63f5e4419..2da8e70b3 100644 --- a/syntax_checkers/javascript/jsl.vim +++ b/syntax_checkers/javascript/jsl.vim @@ -29,12 +29,11 @@ function! SyntaxCheckers_javascript_jsl_IsAvailable() return executable('jsl') endfunction -function! SyntaxCheckers_javascript_jsl_GetLocList() +function! SyntaxCheckers_javascript_jsl_GetLocList() dict let makeprg = syntastic#makeprg#build({ \ 'exe': 'jsl', \ 'args': s:ConfFlag() . " -nologo -nofilelisting -nosummary -nocontext -process", - \ 'filetype': 'javascript', - \ 'subchecker': 'jsl' }) + \ 'checker': self }) let errorformat = \ '%W%f(%l): lint warning: %m,'. diff --git a/syntax_checkers/javascript/jslint.vim b/syntax_checkers/javascript/jslint.vim index 384b4b852..a3ef9a507 100644 --- a/syntax_checkers/javascript/jslint.vim +++ b/syntax_checkers/javascript/jslint.vim @@ -31,12 +31,11 @@ function! SyntaxCheckers_javascript_jslint_HighlightTerm(error) return '\V'.split(unexpected, "'")[1] endfunction -function! SyntaxCheckers_javascript_jslint_GetLocList() +function! SyntaxCheckers_javascript_jslint_GetLocList() dict let makeprg = syntastic#makeprg#build({ \ 'exe': 'jslint', \ 'args': g:syntastic_javascript_jslint_conf, - \ 'filetype': 'javascript', - \ 'subchecker': 'jslint' }) + \ 'checker': self }) let errorformat = \ '%E %##%n %m,'. diff --git a/syntax_checkers/json/jsonlint.vim b/syntax_checkers/json/jsonlint.vim index 7c6b34d53..1b65c9e88 100644 --- a/syntax_checkers/json/jsonlint.vim +++ b/syntax_checkers/json/jsonlint.vim @@ -18,12 +18,11 @@ function! SyntaxCheckers_json_jsonlint_IsAvailable() return executable('jsonlint') endfunction -function! SyntaxCheckers_json_jsonlint_GetLocList() +function! SyntaxCheckers_json_jsonlint_GetLocList() dict let makeprg = syntastic#makeprg#build({ \ 'exe': 'jsonlint', \ 'post_args': '--compact', - \ 'filetype': 'json', - \ 'subchecker': 'jsonlint' }) + \ 'checker': self }) let errorformat = \ '%ELine %l:%c,'. diff --git a/syntax_checkers/json/jsonval.vim b/syntax_checkers/json/jsonval.vim index 4359e86c5..283649caf 100644 --- a/syntax_checkers/json/jsonval.vim +++ b/syntax_checkers/json/jsonval.vim @@ -18,12 +18,11 @@ function! SyntaxCheckers_json_jsonval_IsAvailable() return executable('jsonval') endfunction -function! SyntaxCheckers_json_jsonval_GetLocList() +function! SyntaxCheckers_json_jsonval_GetLocList() dict " based on https://gist.github.com/1196345 let makeprg = syntastic#makeprg#build({ \ 'exe': 'jsonval', - \ 'filetype': 'json', - \ 'subchecker': 'jsonval' }) + \ 'checker': self }) let errorformat = \ '%E%f:\ %m\ at\ line\ %l,' . diff --git a/syntax_checkers/less/lessc.vim b/syntax_checkers/less/lessc.vim index 05f825276..73c85d6d4 100644 --- a/syntax_checkers/less/lessc.vim +++ b/syntax_checkers/less/lessc.vim @@ -40,13 +40,12 @@ function! SyntaxCheckers_less_lessc_IsAvailable() return executable('lessc') endfunction -function! SyntaxCheckers_less_lessc_GetLocList() +function! SyntaxCheckers_less_lessc_GetLocList() dict let makeprg = syntastic#makeprg#build({ \ 'exe': s:check_file, \ 'args': g:syntastic_less_options, \ 'tail': syntastic#util#DevNull(), - \ 'filetype': 'less', - \ 'subchecker': 'lessc' }) + \ 'checker': self }) let errorformat = '%m in %f:%l:%c' diff --git a/syntax_checkers/lisp/clisp.vim b/syntax_checkers/lisp/clisp.vim index caf094f18..ec9c2ce09 100644 --- a/syntax_checkers/lisp/clisp.vim +++ b/syntax_checkers/lisp/clisp.vim @@ -18,13 +18,12 @@ function! SyntaxCheckers_lisp_clisp_IsAvailable() return executable("clisp") endfunction -function! SyntaxCheckers_lisp_clisp_GetLocList() +function! SyntaxCheckers_lisp_clisp_GetLocList() dict let makeprg = syntastic#makeprg#build({ \ 'exe': 'clisp', \ 'args': '-q -c', \ 'tail': '-o /tmp/clisp-vim-compiled-file', - \ 'filetype': 'lisp', - \ 'subchecker': 'clisp' }) + \ 'checker': self }) let errorformat = \ '%-G;%.%#,' . diff --git a/syntax_checkers/llvm/llvm.vim b/syntax_checkers/llvm/llvm.vim index 61d16fc1d..fe52df148 100644 --- a/syntax_checkers/llvm/llvm.vim +++ b/syntax_checkers/llvm/llvm.vim @@ -18,12 +18,11 @@ function! SyntaxCheckers_llvm_llvm_IsAvailable() return executable("llc") endfunction -function! SyntaxCheckers_llvm_llvm_GetLocList() +function! SyntaxCheckers_llvm_llvm_GetLocList() dict let makeprg = syntastic#makeprg#build({ \ 'exe': 'llc', \ 'args': syntastic#c#NullOutput(), - \ 'filetype': 'llvm', - \ 'subchecker': 'llvm' }) + \ 'checker': self }) let errorformat = 'llc: %f:%l:%c: %trror: %m' diff --git a/syntax_checkers/lua/luac.vim b/syntax_checkers/lua/luac.vim index ad4e8baab..7ef19eed1 100644 --- a/syntax_checkers/lua/luac.vim +++ b/syntax_checkers/lua/luac.vim @@ -43,12 +43,11 @@ function! SyntaxCheckers_lua_luac_GetHighlightRegex(pos) endfunction -function! SyntaxCheckers_lua_luac_GetLocList() +function! SyntaxCheckers_lua_luac_GetLocList() dict let makeprg = syntastic#makeprg#build({ \ 'exe': 'luac', \ 'args': '-p', - \ 'filetype': 'lua', - \ 'subchecker': 'luac' }) + \ 'checker': self }) let errorformat = 'luac: %#%f:%l: %m' diff --git a/syntax_checkers/matlab/mlint.vim b/syntax_checkers/matlab/mlint.vim index 380d22c89..82cb681e8 100644 --- a/syntax_checkers/matlab/mlint.vim +++ b/syntax_checkers/matlab/mlint.vim @@ -19,12 +19,11 @@ function! SyntaxCheckers_matlab_mlint_IsAvailable() return executable("mlint") endfunction -function! SyntaxCheckers_matlab_mlint_GetLocList() +function! SyntaxCheckers_matlab_mlint_GetLocList() dict let makeprg = syntastic#makeprg#build({ \ 'exe': 'mlint', \ 'args': '-id $*', - \ 'filetype': 'matlab', - \ 'subchecker': 'mlint' }) + \ 'checker': self }) let errorformat = \ 'L %l (C %c): %*[a-zA-Z0-9]: %m,'. diff --git a/syntax_checkers/nasm/nasm.vim b/syntax_checkers/nasm/nasm.vim index 8476b5159..b986f5348 100644 --- a/syntax_checkers/nasm/nasm.vim +++ b/syntax_checkers/nasm/nasm.vim @@ -18,13 +18,12 @@ function! SyntaxCheckers_nasm_nasm_IsAvailable() return executable("nasm") endfunction -function! SyntaxCheckers_nasm_nasm_GetLocList() +function! SyntaxCheckers_nasm_nasm_GetLocList() dict let wd = syntastic#util#shescape(expand("%:p:h") . "/") let makeprg = syntastic#makeprg#build({ \ 'exe': 'nasm', \ 'args': '-X gnu -f elf -I ' . wd . ' ' . syntastic#c#NullOutput(), - \ 'filetype': 'nasm', - \ 'subchecker': 'nasm' }) + \ 'checker': self }) let errorformat = '%f:%l: %t%*[^:]: %m' diff --git a/syntax_checkers/nroff/mandoc.vim b/syntax_checkers/nroff/mandoc.vim index 3333d24e6..d09c36262 100644 --- a/syntax_checkers/nroff/mandoc.vim +++ b/syntax_checkers/nroff/mandoc.vim @@ -18,12 +18,11 @@ function! SyntaxCheckers_nroff_mandoc_IsAvailable() return executable("mandoc") endfunction -function! SyntaxCheckers_nroff_mandoc_GetLocList() +function! SyntaxCheckers_nroff_mandoc_GetLocList() dict let makeprg = syntastic#makeprg#build({ \ 'exe': 'mandoc', \ 'args': '-Tlint', - \ 'filetype': 'nroff', - \ 'subchecker': 'mandoc' }) + \ 'checker': self }) let errorformat = \ '%E%f:%l:%c: %tRROR: %m,' . diff --git a/syntax_checkers/objc/gcc.vim b/syntax_checkers/objc/gcc.vim index 320290f52..48b3d564c 100644 --- a/syntax_checkers/objc/gcc.vim +++ b/syntax_checkers/objc/gcc.vim @@ -30,7 +30,7 @@ if !exists('g:syntastic_objc_compiler_options') let g:syntastic_objc_compiler_options = '-std=gnu99' endif -function! SyntaxCheckers_objc_gcc_GetLocList() +function! SyntaxCheckers_objc_gcc_GetLocList() dict return syntastic#c#GetLocList('objc', 'gcc', { \ 'errorformat': \ '%-G%f:%s:,' . diff --git a/syntax_checkers/objc/oclint.vim b/syntax_checkers/objc/oclint.vim index 0ebd6612b..d3108eb6c 100644 --- a/syntax_checkers/objc/oclint.vim +++ b/syntax_checkers/objc/oclint.vim @@ -21,16 +21,9 @@ if exists("g:loaded_syntastic_objc_oclint_checker") endif let g:loaded_syntastic_objc_oclint_checker = 1 -function! SyntaxCheckers_objc_oclint_IsAvailable() - return SyntaxCheckers_c_oclint_IsAvailable() -endfunction - -function! SyntaxCheckers_objc_oclint_GetLocList() - return SyntaxCheckers_c_oclint_GetLocList() -endfunction +runtime! syntax_checkers/c/*.vim call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'objc', - \ 'name': 'oclint'}) - -runtime! syntax_checkers/c/*.vim + \ 'name': 'oclint', + \ 'redirect': 'c/oclint'}) diff --git a/syntax_checkers/objc/ycm.vim b/syntax_checkers/objc/ycm.vim index 40f53fb4b..8157b38df 100644 --- a/syntax_checkers/objc/ycm.vim +++ b/syntax_checkers/objc/ycm.vim @@ -17,18 +17,11 @@ let g:loaded_syntastic_objc_ycm_checker = 1 runtime! syntax_checkers/c/*.vim -function! SyntaxCheckers_objc_ycm_IsAvailable() - return SyntaxCheckers_c_ycm_IsAvailable() -endfunction - if !exists('g:loaded_youcompleteme') finish endif -function! SyntaxCheckers_objc_ycm_GetLocList() - return SyntaxCheckers_c_ycm_GetLocList() -endfunction - call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'objc', - \ 'name': 'ycm'}) + \ 'name': 'ycm', + \ 'redirect': 'c/ycm'}) diff --git a/syntax_checkers/objcpp/gcc.vim b/syntax_checkers/objcpp/gcc.vim index 93ff21940..480dbebb0 100644 --- a/syntax_checkers/objcpp/gcc.vim +++ b/syntax_checkers/objcpp/gcc.vim @@ -30,7 +30,7 @@ if !exists('g:syntastic_objcpp_compiler_options') let g:syntastic_objcpp_compiler_options = '-std=gnu99' endif -function! SyntaxCheckers_objcpp_gcc_GetLocList() +function! SyntaxCheckers_objcpp_gcc_GetLocList() dict return syntastic#c#GetLocList('objcpp', 'gcc', { \ 'errorformat': \ '%-G%f:%s:,' . diff --git a/syntax_checkers/objcpp/oclint.vim b/syntax_checkers/objcpp/oclint.vim index a46fe0453..59eb7cc78 100644 --- a/syntax_checkers/objcpp/oclint.vim +++ b/syntax_checkers/objcpp/oclint.vim @@ -21,16 +21,9 @@ if exists("g:loaded_syntastic_objcpp_oclint_checker") endif let g:loaded_syntastic_objcpp_oclint_checker = 1 -function! SyntaxCheckers_objcpp_oclint_IsAvailable() - return SyntaxCheckers_c_oclint_IsAvailable() -endfunction - -function! SyntaxCheckers_objcpp_oclint_GetLocList() - return SyntaxCheckers_c_oclint_GetLocList() -endfunction +runtime! syntax_checkers/c/*.vim call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'objcpp', - \ 'name': 'oclint'}) - -runtime! syntax_checkers/c/*.vim + \ 'name': 'oclint', + \ 'redirect': 'c/oclint'}) diff --git a/syntax_checkers/objcpp/ycm.vim b/syntax_checkers/objcpp/ycm.vim index c9a0e458e..3bad05ebe 100644 --- a/syntax_checkers/objcpp/ycm.vim +++ b/syntax_checkers/objcpp/ycm.vim @@ -15,20 +15,13 @@ if exists("g:loaded_syntastic_objcpp_ycm_checker") endif let g:loaded_syntastic_objcpp_ycm_checker = 1 -runtime! syntax_checkers/c/*.vim - -function! SyntaxCheckers_objcpp_ycm_IsAvailable() - return SyntaxCheckers_c_ycm_IsAvailable() -endfunction - if !exists('g:loaded_youcompleteme') finish endif -function! SyntaxCheckers_objcpp_ycm_GetLocList() - return SyntaxCheckers_c_ycm_GetLocList() -endfunction +runtime! syntax_checkers/c/*.vim call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'objcpp', - \ 'name': 'ycm'}) + \ 'name': 'ycm', + \ 'redirect': 'c/ycm'}) diff --git a/syntax_checkers/ocaml/camlp4o.vim b/syntax_checkers/ocaml/camlp4o.vim index aa876719b..a2731cba0 100644 --- a/syntax_checkers/ocaml/camlp4o.vim +++ b/syntax_checkers/ocaml/camlp4o.vim @@ -76,7 +76,7 @@ if !exists('g:syntastic_ocaml_use_ocamlbuild') || !executable("ocamlbuild") let g:syntastic_ocaml_use_ocamlbuild = 0 endif -function! SyntaxCheckers_ocaml_camlp4o_GetLocList() +function! SyntaxCheckers_ocaml_camlp4o_GetLocList() dict let makeprg = s:GetMakeprg() if makeprg == "" return [] diff --git a/syntax_checkers/perl/perl.vim b/syntax_checkers/perl/perl.vim index 029f4354a..855ef34e2 100644 --- a/syntax_checkers/perl/perl.vim +++ b/syntax_checkers/perl/perl.vim @@ -51,7 +51,7 @@ function! SyntaxCheckers_perl_perl_Preprocess(errors) return syntastic#util#unique(out) endfunction -function! SyntaxCheckers_perl_perl_GetLocList() +function! SyntaxCheckers_perl_perl_GetLocList() dict if type(g:syntastic_perl_lib_path) == type('') call syntastic#util#deprecationWarn('variable g:syntastic_perl_lib_path should be a list') let includes = split(g:syntastic_perl_lib_path, ',') @@ -67,8 +67,7 @@ function! SyntaxCheckers_perl_perl_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': g:syntastic_perl_interpreter, \ 'args': '-c -X ' . extra, - \ 'filetype': 'perl', - \ 'subchecker': 'perl' }) + \ 'checker': self }) let errors = SyntasticMake({ \ 'makeprg': makeprg, @@ -82,8 +81,7 @@ function! SyntaxCheckers_perl_perl_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': g:syntastic_perl_interpreter, \ 'args': '-c -Mwarnings ' . extra, - \ 'filetype': 'perl', - \ 'subchecker': 'perl' }) + \ 'checker': self }) return SyntasticMake({ \ 'makeprg': makeprg, diff --git a/syntax_checkers/perl/perlcritic.vim b/syntax_checkers/perl/perlcritic.vim index 910ded2be..f64d44be6 100644 --- a/syntax_checkers/perl/perlcritic.vim +++ b/syntax_checkers/perl/perlcritic.vim @@ -37,12 +37,11 @@ function! SyntaxCheckers_perl_perlcritic_IsAvailable() return executable('perlcritic') endfunction -function! SyntaxCheckers_perl_perlcritic_GetLocList() +function! SyntaxCheckers_perl_perlcritic_GetLocList() dict let makeprg = syntastic#makeprg#build({ \ 'exe': 'perlcritic', \ 'post_args': '--quiet --nocolor --verbose "\%s:\%f:\%l:\%c:(\%s) \%m (\%e)\n"', - \ 'filetype': 'perl', - \ 'subchecker': 'perlcritic' }) + \ 'checker': self }) let errorformat = '%t:%f:%l:%c:%m' diff --git a/syntax_checkers/perl/podchecker.vim b/syntax_checkers/perl/podchecker.vim index e6f80e662..bf7cf8809 100644 --- a/syntax_checkers/perl/podchecker.vim +++ b/syntax_checkers/perl/podchecker.vim @@ -15,16 +15,9 @@ if exists("g:loaded_syntastic_perl_podchecker_checker") endif let g:loaded_syntastic_perl_podchecker_checker=1 -function! SyntaxCheckers_perl_podchecker_IsAvailable() - return SyntaxCheckers_pod_podchecker_IsAvailable() -endfunction - -function! SyntaxCheckers_perl_podchecker_GetLocList() - return SyntaxCheckers_pod_podchecker_GetLocList() -endfunction +runtime! syntax_checkers/pod/*.vim call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'perl', - \ 'name': 'podchecker'}) - -runtime! syntax_checkers/pod/*.vim + \ 'name': 'podchecker', + \ 'redirect': 'pod/podchecker'}) diff --git a/syntax_checkers/php/php.vim b/syntax_checkers/php/php.vim index 3c2f42372..a0fb65d9e 100644 --- a/syntax_checkers/php/php.vim +++ b/syntax_checkers/php/php.vim @@ -27,12 +27,11 @@ function! SyntaxCheckers_php_php_GetHighlightRegex(item) return '\V'.split(unexpected, "'")[1] endfunction -function! SyntaxCheckers_php_php_GetLocList() +function! SyntaxCheckers_php_php_GetLocList() dict let makeprg = syntastic#makeprg#build({ \ 'exe': 'php', \ 'args': '-l -d error_reporting=E_ALL -d display_errors=1 -d log_errors=0 -d xdebug.cli_color=0', - \ 'filetype': 'php', - \ 'subchecker': 'php' }) + \ 'checker': self }) let errorformat = \ '%-GNo syntax errors detected in%.%#,'. diff --git a/syntax_checkers/php/phpcs.vim b/syntax_checkers/php/phpcs.vim index f6646c666..2abdbf250 100644 --- a/syntax_checkers/php/phpcs.vim +++ b/syntax_checkers/php/phpcs.vim @@ -22,12 +22,11 @@ function! SyntaxCheckers_php_phpcs_IsAvailable() return executable('phpcs') endfunction -function! SyntaxCheckers_php_phpcs_GetLocList() +function! SyntaxCheckers_php_phpcs_GetLocList() dict let makeprg = syntastic#makeprg#build({ \ 'exe': 'phpcs', \ 'args': '--report=csv', - \ 'filetype': 'php', - \ 'subchecker': 'phpcs' }) + \ 'checker': self }) let errorformat = \ '%-GFile\,Line\,Column\,Type\,Message\,Source\,Severity,'. diff --git a/syntax_checkers/php/phpmd.vim b/syntax_checkers/php/phpmd.vim index 99c3be6b5..2dbcb563b 100644 --- a/syntax_checkers/php/phpmd.vim +++ b/syntax_checkers/php/phpmd.vim @@ -58,12 +58,11 @@ function! SyntaxCheckers_php_phpmd_GetHighlightRegex(item) return '' endfunction -function! SyntaxCheckers_php_phpmd_GetLocList() +function! SyntaxCheckers_php_phpmd_GetLocList() dict let makeprg = syntastic#makeprg#build({ \ 'exe': 'phpmd', \ 'post_args': 'text codesize,design,unusedcode,naming', - \ 'filetype': 'php', - \ 'subchecker': 'phpmd' }) + \ 'checker': self }) let errorformat = '%E%f:%l%\s%#%m' diff --git a/syntax_checkers/pod/podchecker.vim b/syntax_checkers/pod/podchecker.vim index c429a495c..66e6ddf86 100644 --- a/syntax_checkers/pod/podchecker.vim +++ b/syntax_checkers/pod/podchecker.vim @@ -18,11 +18,10 @@ function! SyntaxCheckers_pod_podchecker_IsAvailable() return executable("podchecker") endfunction -function! SyntaxCheckers_pod_podchecker_GetLocList() +function! SyntaxCheckers_pod_podchecker_GetLocList() dict let makeprg = syntastic#makeprg#build({ \ 'exe': 'podchecker', - \ 'filetype': 'pod', - \ 'subchecker': 'podchecker' }) + \ 'checker': self }) let errorformat = \ '%W%[%#]%[%#]%[%#] WARNING: %m at line %l in file %f,' . diff --git a/syntax_checkers/puppet/puppet.vim b/syntax_checkers/puppet/puppet.vim index 5889c78f0..f9019c098 100644 --- a/syntax_checkers/puppet/puppet.vim +++ b/syntax_checkers/puppet/puppet.vim @@ -19,7 +19,7 @@ function! SyntaxCheckers_puppet_puppet_IsAvailable() return executable("puppet") endfunction -function! SyntaxCheckers_puppet_puppet_GetLocList() +function! SyntaxCheckers_puppet_puppet_GetLocList() dict let ver = syntastic#util#getVersion('puppet --version 2>' . syntastic#util#DevNull()) @@ -32,8 +32,7 @@ function! SyntaxCheckers_puppet_puppet_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'puppet', \ 'args': args, - \ 'filetype': 'puppet', - \ 'subchecker': 'puppet' }) + \ 'checker': self }) let errorformat = \ '%-Gerr: Try ''puppet help parser validate'' for usage,' . diff --git a/syntax_checkers/puppet/puppetlint.vim b/syntax_checkers/puppet/puppetlint.vim index b59059e21..b1db347a5 100644 --- a/syntax_checkers/puppet/puppetlint.vim +++ b/syntax_checkers/puppet/puppetlint.vim @@ -28,12 +28,11 @@ function! SyntaxCheckers_puppet_puppetlint_IsAvailable() \ syntastic#util#DevNull()), [0,1,10]) endfunction -function! SyntaxCheckers_puppet_puppetlint_GetLocList() +function! SyntaxCheckers_puppet_puppetlint_GetLocList() dict let makeprg = syntastic#makeprg#build({ \ 'exe': 'puppet-lint', \ 'post_args': '--log-format "%{KIND} [%{check}] %{message} at %{fullpath}:%{linenumber}"', - \ 'filetype': 'puppet', - \ 'subchecker': 'puppetlint' }) + \ 'checker': self }) let errorformat = '%t%*[a-zA-Z] %m at %f:%l' diff --git a/syntax_checkers/python/flake8.vim b/syntax_checkers/python/flake8.vim index 83fa30dcd..484e8fc43 100644 --- a/syntax_checkers/python/flake8.vim +++ b/syntax_checkers/python/flake8.vim @@ -18,11 +18,10 @@ function! SyntaxCheckers_python_flake8_GetHighlightRegex(i) return SyntaxCheckers_python_pyflakes_GetHighlightRegex(a:i) endfunction -function! SyntaxCheckers_python_flake8_GetLocList() +function! SyntaxCheckers_python_flake8_GetLocList() dict let makeprg = syntastic#makeprg#build({ \ 'exe': 'flake8', - \ 'filetype': 'python', - \ 'subchecker': 'flake8' }) + \ 'checker': self }) let errorformat = \ '%E%f:%l: could not compile,%-Z%p^,' . diff --git a/syntax_checkers/python/pep257.vim b/syntax_checkers/python/pep257.vim index 9d2b64d91..9b4b4912c 100644 --- a/syntax_checkers/python/pep257.vim +++ b/syntax_checkers/python/pep257.vim @@ -19,11 +19,10 @@ function! SyntaxCheckers_python_pep257_Preprocess(errors) return filter(copy(a:errors), 'v:val != ""') endfunction -function! SyntaxCheckers_python_pep257_GetLocList() +function! SyntaxCheckers_python_pep257_GetLocList() dict let makeprg = syntastic#makeprg#build({ \ 'exe': 'pep257', - \ 'filetype': 'python', - \ 'subchecker': 'pep257' }) + \ 'checker': self }) let errorformat = \ '%E%f:%l:%c%\%.%\%.%\d%\+:%\d%\+: %m,' . diff --git a/syntax_checkers/python/pep8.vim b/syntax_checkers/python/pep8.vim index 71837187d..b2b0f9863 100644 --- a/syntax_checkers/python/pep8.vim +++ b/syntax_checkers/python/pep8.vim @@ -21,11 +21,10 @@ function! SyntaxCheckers_python_pep8_IsAvailable() return executable('pep8') endfunction -function! SyntaxCheckers_python_pep8_GetLocList() +function! SyntaxCheckers_python_pep8_GetLocList() dict let makeprg = syntastic#makeprg#build({ \ 'exe': 'pep8', - \ 'filetype': 'python', - \ 'subchecker': 'pep8' }) + \ 'checker': self }) let errorformat = '%f:%l:%c: %m' diff --git a/syntax_checkers/python/py3kwarn.vim b/syntax_checkers/python/py3kwarn.vim index 44d036551..a97eac0b9 100644 --- a/syntax_checkers/python/py3kwarn.vim +++ b/syntax_checkers/python/py3kwarn.vim @@ -13,11 +13,10 @@ function! SyntaxCheckers_python_py3kwarn_IsAvailable() return executable('py3kwarn') endfunction -function! SyntaxCheckers_python_py3kwarn_GetLocList() +function! SyntaxCheckers_python_py3kwarn_GetLocList() dict let makeprg = syntastic#makeprg#build({ \ 'exe': 'py3kwarn', - \ 'filetype': 'python', - \ 'subchecker': 'py3kwarn' }) + \ 'checker': self }) let errorformat = '%W%f:%l:%c: %m' diff --git a/syntax_checkers/python/pyflakes.vim b/syntax_checkers/python/pyflakes.vim index f93047bf7..f572c1bdc 100644 --- a/syntax_checkers/python/pyflakes.vim +++ b/syntax_checkers/python/pyflakes.vim @@ -39,11 +39,10 @@ function! SyntaxCheckers_python_pyflakes_GetHighlightRegex(i) return '' endfunction -function! SyntaxCheckers_python_pyflakes_GetLocList() +function! SyntaxCheckers_python_pyflakes_GetLocList() dict let makeprg = syntastic#makeprg#build({ \ 'exe': 'pyflakes', - \ 'filetype': 'python', - \ 'subchecker': 'pyflakes' }) + \ 'checker': self }) let errorformat = \ '%E%f:%l: could not compile,'. diff --git a/syntax_checkers/python/pylama.vim b/syntax_checkers/python/pylama.vim index 8c8e2ba0a..cb290e277 100644 --- a/syntax_checkers/python/pylama.vim +++ b/syntax_checkers/python/pylama.vim @@ -22,12 +22,11 @@ function! SyntaxCheckers_python_pylama_GetHighlightRegex(i) return SyntaxCheckers_python_pyflakes_GetHighlightRegex(a:i) endfunction -function! SyntaxCheckers_python_pylama_GetLocList() +function! SyntaxCheckers_python_pylama_GetLocList() dict let makeprg = syntastic#makeprg#build({ \ 'exe': 'pylama', \ 'post_args': '-f pep8', - \ 'filetype': 'python', - \ 'subchecker': 'pylama' }) + \ 'checker': self }) " TODO: "WARNING:pylama:..." messages are probably a logging bug let errorformat = diff --git a/syntax_checkers/python/pylint.vim b/syntax_checkers/python/pylint.vim index 07d9defd0..cdbdccccb 100644 --- a/syntax_checkers/python/pylint.vim +++ b/syntax_checkers/python/pylint.vim @@ -16,12 +16,11 @@ function! SyntaxCheckers_python_pylint_IsAvailable() return s:pylint_new >= 0 endfunction -function! SyntaxCheckers_python_pylint_GetLocList() +function! SyntaxCheckers_python_pylint_GetLocList() dict let makeprg = syntastic#makeprg#build({ \ 'exe': 'pylint', \ 'args': (s:pylint_new ? '--msg-template="{path}:{line}: [{msg_id}] {msg}" -r n' : '-f parseable -r n -i y'), - \ 'filetype': 'python', - \ 'subchecker': 'pylint' }) + \ 'checker': self }) let errorformat = \ '%A%f:%l: %m,' . diff --git a/syntax_checkers/python/python.vim b/syntax_checkers/python/python.vim index eff1696b4..94bce00ef 100644 --- a/syntax_checkers/python/python.vim +++ b/syntax_checkers/python/python.vim @@ -16,15 +16,14 @@ function! SyntaxCheckers_python_python_IsAvailable() return executable('python') endfunction -function! SyntaxCheckers_python_python_GetLocList() +function! SyntaxCheckers_python_python_GetLocList() dict let fname = "'" . escape(expand('%'), "\\'") . "'" let makeprg = syntastic#makeprg#build({ \ 'exe': 'python', \ 'args': '-c', \ 'fname': syntastic#util#shescape("compile(open(" . fname . ").read(), " . fname . ", 'exec')"), - \ 'filetype': 'python', - \ 'subchecker': 'python' }) + \ 'checker': self }) let errorformat = \ '%E File "%f"\, line %l,' . diff --git a/syntax_checkers/rst/rst2pseudoxml.vim b/syntax_checkers/rst/rst2pseudoxml.vim index 429cee343..a11cd602a 100644 --- a/syntax_checkers/rst/rst2pseudoxml.vim +++ b/syntax_checkers/rst/rst2pseudoxml.vim @@ -22,13 +22,12 @@ function! SyntaxCheckers_rst_rst2pseudoxml_IsAvailable() return executable("rst2pseudoxml.py") || executable("rst2pseudoxml") endfunction -function! SyntaxCheckers_rst_rst2pseudoxml_GetLocList() +function! SyntaxCheckers_rst_rst2pseudoxml_GetLocList() dict let makeprg = syntastic#makeprg#build({ \ 'exe': s:exe(), \ 'args': '--report=2 --exit-status=1', \ 'tail': syntastic#util#DevNull(), - \ 'filetype': 'rst', - \ 'subchecker': 'rst2pseudoxml' }) + \ 'checker': self }) let errorformat = \ '%f:%l: (%tNFO/1) %m,'. diff --git a/syntax_checkers/ruby/jruby.vim b/syntax_checkers/ruby/jruby.vim index bfd60c3ad..624d7d9c7 100644 --- a/syntax_checkers/ruby/jruby.vim +++ b/syntax_checkers/ruby/jruby.vim @@ -18,12 +18,11 @@ function! SyntaxCheckers_ruby_jruby_IsAvailable() return executable('jruby') endfunction -function! SyntaxCheckers_ruby_jruby_GetLocList() +function! SyntaxCheckers_ruby_jruby_GetLocList() dict let makeprg = syntastic#makeprg#build({ \ 'exe': s:exe(), \ 'args': s:args(), - \ 'filetype': 'ruby', - \ 'subchecker': 'jruby' }) + \ 'checker': self }) let errorformat = \ '%-GSyntax OK for %f,'. diff --git a/syntax_checkers/ruby/macruby.vim b/syntax_checkers/ruby/macruby.vim index 9226e41eb..ebbd6e2c9 100644 --- a/syntax_checkers/ruby/macruby.vim +++ b/syntax_checkers/ruby/macruby.vim @@ -17,12 +17,11 @@ function! SyntaxCheckers_ruby_macruby_IsAvailable() return executable('macruby') endfunction -function! SyntaxCheckers_ruby_macruby_GetLocList() +function! SyntaxCheckers_ruby_macruby_GetLocList() dict let makeprg = syntastic#makeprg#build({ \ 'exe': 'RUBYOPT= macruby', \ 'args': '-W1 -c', - \ 'filetype': 'ruby', - \ 'subchecker': 'macruby' }) + \ 'checker': self }) let errorformat = \ '%-GSyntax OK,'. diff --git a/syntax_checkers/ruby/mri.vim b/syntax_checkers/ruby/mri.vim index 27a46a481..5a2f6d2f2 100644 --- a/syntax_checkers/ruby/mri.vim +++ b/syntax_checkers/ruby/mri.vim @@ -32,7 +32,7 @@ function! SyntaxCheckers_ruby_mri_GetHighlightRegex(i) return '' endfunction -function! SyntaxCheckers_ruby_mri_GetLocList() +function! SyntaxCheckers_ruby_mri_GetLocList() dict let exe = expand(g:syntastic_ruby_exec) if !has('win32') let exe = 'RUBYOPT= ' . exe @@ -41,8 +41,7 @@ function! SyntaxCheckers_ruby_mri_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': exe, \ 'args': '-w -T1 -c', - \ 'filetype': 'ruby', - \ 'subchecker': 'mri' }) + \ 'checker': self }) "this is a hack to filter out a repeated useless warning in rspec files "containing lines like diff --git a/syntax_checkers/ruby/rubocop.vim b/syntax_checkers/ruby/rubocop.vim index 22e6131bd..13c162252 100644 --- a/syntax_checkers/ruby/rubocop.vim +++ b/syntax_checkers/ruby/rubocop.vim @@ -24,12 +24,11 @@ function! SyntaxCheckers_ruby_rubocop_IsAvailable() \ syntastic#util#versionIsAtLeast(syntastic#util#getVersion('rubocop --version'), [0,9,0]) endfunction -function! SyntaxCheckers_ruby_rubocop_GetLocList() +function! SyntaxCheckers_ruby_rubocop_GetLocList() dict let makeprg = syntastic#makeprg#build({ \ 'exe': 'rubocop', \ 'args': '--format emacs --silent', - \ 'filetype': 'ruby', - \ 'subchecker': 'rubocop' }) + \ 'checker': self }) let errorformat = '%f:%l:%c: %t: %m' diff --git a/syntax_checkers/ruby/rubylint.vim b/syntax_checkers/ruby/rubylint.vim index 5b914f43e..62ceb305e 100644 --- a/syntax_checkers/ruby/rubylint.vim +++ b/syntax_checkers/ruby/rubylint.vim @@ -20,12 +20,11 @@ function! SyntaxCheckers_ruby_rubylint_IsAvailable() return executable("ruby-lint") endfunction -function! SyntaxCheckers_ruby_rubylint_GetLocList() +function! SyntaxCheckers_ruby_rubylint_GetLocList() dict let makeprg = syntastic#makeprg#build({ \ 'exe': 'ruby-lint', \ 'args': 'analyze --presenter=syntastic', - \ 'filetype': 'ruby', - \ 'subchecker': 'rubylint' }) + \ 'checker': self }) let errorformat = '%f:%t:%l:%c: %m' diff --git a/syntax_checkers/rust/rustc.vim b/syntax_checkers/rust/rustc.vim index e88b4cf98..526e94156 100644 --- a/syntax_checkers/rust/rustc.vim +++ b/syntax_checkers/rust/rustc.vim @@ -19,12 +19,11 @@ function! SyntaxCheckers_rust_rustc_IsAvailable() return executable("rustc") endfunction -function! SyntaxCheckers_rust_rustc_GetLocList() +function! SyntaxCheckers_rust_rustc_GetLocList() dict let makeprg = syntastic#makeprg#build({ \ 'exe': 'rustc', \ 'args': '--parse-only', - \ 'filetype': 'rust', - \ 'subchecker': 'rustc' }) + \ 'checker': self }) let errorformat = \ '%E%f:%l:%c: \\d%#:\\d%# %.%\{-}error:%.%\{-} %m,' . diff --git a/syntax_checkers/sass/sass.vim b/syntax_checkers/sass/sass.vim index 4b8d48637..7c844124b 100644 --- a/syntax_checkers/sass/sass.vim +++ b/syntax_checkers/sass/sass.vim @@ -34,7 +34,7 @@ if executable("compass") let s:imports = "--compass" endif -function! SyntaxCheckers_sass_sass_GetLocList() +function! SyntaxCheckers_sass_sass_GetLocList() dict if !g:syntastic_sass_check_partials && expand('%:t')[0] == '_' return [] endif @@ -42,8 +42,7 @@ function! SyntaxCheckers_sass_sass_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': 'sass', \ 'args': '--cache-location ' . s:sass_cache_location . ' ' . s:imports . ' --check', - \ 'filetype': 'sass', - \ 'subchecker': 'sass' }) + \ 'checker': self }) let errorformat = \ '%ESyntax %trror: %m,' . diff --git a/syntax_checkers/scala/fsc.vim b/syntax_checkers/scala/fsc.vim index d0e95a7db..30600739d 100644 --- a/syntax_checkers/scala/fsc.vim +++ b/syntax_checkers/scala/fsc.vim @@ -23,7 +23,7 @@ if !exists('g:syntastic_scala_options') let g:syntastic_scala_options = '' endif -function! SyntaxCheckers_scala_fsc_GetLocList() +function! SyntaxCheckers_scala_fsc_GetLocList() dict " fsc has some serious problems with the " working directory changing after being started " that's why we better pass an absolute path @@ -31,8 +31,7 @@ function! SyntaxCheckers_scala_fsc_GetLocList() \ 'exe': 'fsc', \ 'args': '-Ystop-after:parser ' . g:syntastic_scala_options, \ 'fname': syntastic#util#shexpand('%:p'), - \ 'filetype': 'scala', - \ 'subchecker': 'fsc' }) + \ 'checker': self }) let errorformat = '%f:%l: %trror: %m' diff --git a/syntax_checkers/scala/scalac.vim b/syntax_checkers/scala/scalac.vim index d6319c163..6be0e55be 100644 --- a/syntax_checkers/scala/scalac.vim +++ b/syntax_checkers/scala/scalac.vim @@ -24,12 +24,11 @@ if !exists('g:syntastic_scala_options') endif -function! SyntaxCheckers_scala_scalac_GetLocList() +function! SyntaxCheckers_scala_scalac_GetLocList() dict let makeprg = syntastic#makeprg#build({ \ 'exe': 'scalac', \ 'args': '-Ystop-after:parser ' . g:syntastic_scala_options, - \ 'filetype': 'scala', - \ 'subchecker': 'scalac' }) + \ 'checker': self }) let errorformat = '%f:%l: %trror: %m' diff --git a/syntax_checkers/scss/sass.vim b/syntax_checkers/scss/sass.vim index 604bb41db..1fa54b7d7 100644 --- a/syntax_checkers/scss/sass.vim +++ b/syntax_checkers/scss/sass.vim @@ -16,16 +16,9 @@ if exists("g:loaded_syntastic_scss_sass_checker") endif let g:loaded_syntastic_scss_sass_checker=1 -function! SyntaxCheckers_scss_sass_IsAvailable() - return SyntaxCheckers_sass_sass_IsAvailable() -endfunction - -function! SyntaxCheckers_scss_sass_GetLocList() - return SyntaxCheckers_sass_sass_GetLocList() -endfunction +runtime! syntax_checkers/sass/*.vim call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'scss', - \ 'name': 'sass'}) - -runtime! syntax_checkers/sass/*.vim + \ 'name': 'sass', + \ 'redirect': 'sass/sass'}) diff --git a/syntax_checkers/sh/checkbashisms.vim b/syntax_checkers/sh/checkbashisms.vim index d99a05ea7..2e300011a 100644 --- a/syntax_checkers/sh/checkbashisms.vim +++ b/syntax_checkers/sh/checkbashisms.vim @@ -17,12 +17,11 @@ function! SyntaxCheckers_sh_checkbashisms_IsAvailable() endfunction -function! SyntaxCheckers_sh_checkbashisms_GetLocList() +function! SyntaxCheckers_sh_checkbashisms_GetLocList() dict let makeprg = syntastic#makeprg#build({ \ 'exe': 'checkbashisms', \ 'args': '-fx', - \ 'filetype': 'sh', - \ 'subchecker': 'checkbashisms'}) + \ 'checker': self}) let errorformat = \ '%-Gscript %f is already a bash script; skipping,' . diff --git a/syntax_checkers/sh/sh.vim b/syntax_checkers/sh/sh.vim index f1fb0686f..0d109a701 100644 --- a/syntax_checkers/sh/sh.vim +++ b/syntax_checkers/sh/sh.vim @@ -39,14 +39,13 @@ endfunction function! s:ForwardToZshChecker() let registry = g:SyntasticRegistry.Instance() if registry.checkable('zsh') - return SyntaxCheckers_zsh_zsh_GetLocList() + return registry.getChecker('zsh', 'zsh').getLocListRaw() else return [] endif endfunction - function! s:IsShellValid() return len(s:GetShell()) > 0 && executable(s:GetShell()) endfunction @@ -56,7 +55,7 @@ function! SyntaxCheckers_sh_sh_IsAvailable() return s:IsShellValid() endfunction -function! SyntaxCheckers_sh_sh_GetLocList() +function! SyntaxCheckers_sh_sh_GetLocList() dict if s:GetShell() == 'zsh' return s:ForwardToZshChecker() endif @@ -68,8 +67,7 @@ function! SyntaxCheckers_sh_sh_GetLocList() let makeprg = syntastic#makeprg#build({ \ 'exe': s:GetShell(), \ 'args': '-n', - \ 'filetype': 'sh', - \ 'subchecker': 'sh' }) + \ 'checker': self }) let errorformat = '%f: line %l: %m' diff --git a/syntax_checkers/slim/slimrb.vim b/syntax_checkers/slim/slimrb.vim index bda8be011..8205e80c9 100644 --- a/syntax_checkers/slim/slimrb.vim +++ b/syntax_checkers/slim/slimrb.vim @@ -26,12 +26,11 @@ function! s:SlimrbVersion() return s:slimrb_version endfunction -function! SyntaxCheckers_slim_slimrb_GetLocList() +function! SyntaxCheckers_slim_slimrb_GetLocList() dict let makeprg = syntastic#makeprg#build({ \ 'exe': 'slimrb', \ 'args': '-c', - \ 'filetype': 'slim', - \ 'subchecker': 'slimrb' }) + \ 'checker': self }) if syntastic#util#versionIsAtLeast(s:SlimrbVersion(), [1,3,1]) let errorformat = diff --git a/syntax_checkers/tcl/nagelfar.vim b/syntax_checkers/tcl/nagelfar.vim index c908f73f3..da48e25fb 100644 --- a/syntax_checkers/tcl/nagelfar.vim +++ b/syntax_checkers/tcl/nagelfar.vim @@ -20,12 +20,11 @@ function! SyntaxCheckers_tcl_nagelfar_IsAvailable() return executable('nagelfar') endfunction -function! SyntaxCheckers_tcl_nagelfar_GetLocList() +function! SyntaxCheckers_tcl_nagelfar_GetLocList() dict let makeprg = syntastic#makeprg#build({ \ 'exe': 'nagelfar', \ 'args': '-H', - \ 'filetype': 'tcl', - \ 'subchecker': 'nagelfar' }) + \ 'checker': self }) let errorformat = \ '%I%f: %l: N %m,'. diff --git a/syntax_checkers/tex/chktex.vim b/syntax_checkers/tex/chktex.vim index 43ae2f526..046edc908 100644 --- a/syntax_checkers/tex/chktex.vim +++ b/syntax_checkers/tex/chktex.vim @@ -36,12 +36,11 @@ function! SyntaxCheckers_tex_chktex_IsAvailable() return executable('chktex') endfunction -function! SyntaxCheckers_tex_chktex_GetLocList() +function! SyntaxCheckers_tex_chktex_GetLocList() dict let makeprg = syntastic#makeprg#build({ \ 'exe': 'chktex', \ 'post_args': '-q -v1', - \ 'filetype': 'tex', - \ 'subchecker': 'chktex' }) + \ 'checker': self }) let errorformat = \ '%EError %n in %f line %l: %m,' . diff --git a/syntax_checkers/tex/lacheck.vim b/syntax_checkers/tex/lacheck.vim index d68a519a1..c4bcf8e62 100644 --- a/syntax_checkers/tex/lacheck.vim +++ b/syntax_checkers/tex/lacheck.vim @@ -19,11 +19,10 @@ function! SyntaxCheckers_tex_lacheck_IsAvailable() return executable('lacheck') endfunction -function! SyntaxCheckers_tex_lacheck_GetLocList() +function! SyntaxCheckers_tex_lacheck_GetLocList() dict let makeprg = syntastic#makeprg#build({ \ 'exe': 'lacheck', - \ 'filetype': 'tex', - \ 'subchecker': 'lacheck' }) + \ 'checker': self }) let errorformat = \ '%-G** %f:,' . diff --git a/syntax_checkers/text/atdtool.vim b/syntax_checkers/text/atdtool.vim index 6aeab0626..cfce9c57c 100644 --- a/syntax_checkers/text/atdtool.vim +++ b/syntax_checkers/text/atdtool.vim @@ -28,12 +28,11 @@ function! SyntaxCheckers_text_atdtool_GetHighlightRegex(item) return term endfunction -function! SyntaxCheckers_text_atdtool_GetLocList() +function! SyntaxCheckers_text_atdtool_GetLocList() dict let makeprg = syntastic#makeprg#build({ \ 'exe': 'atdtool', \ 'tail': '2>' . syntastic#util#DevNull(), - \ 'filetype': 'text', - \ 'subchecker': 'atdtool' }) + \ 'checker': self }) let errorformat = \ '%W%f:%l:%c: %m,'. diff --git a/syntax_checkers/twig/twiglint.vim b/syntax_checkers/twig/twiglint.vim index 7cbba5f48..5be896f2e 100644 --- a/syntax_checkers/twig/twiglint.vim +++ b/syntax_checkers/twig/twiglint.vim @@ -24,12 +24,11 @@ function! SyntaxCheckers_twig_twiglint_IsAvailable() return executable('twig-lint') endfunction -function! SyntaxCheckers_twig_twiglint_GetLocList() +function! SyntaxCheckers_twig_twiglint_GetLocList() dict let makeprg = syntastic#makeprg#build({ \ 'exe': 'twig-lint', \ 'args': 'lint --format=csv', - \ 'filetype': 'twig', - \ 'subchecker': 'twiglint' }) + \ 'checker': self }) let errorformat = '"%f"\,%l\,%m' diff --git a/syntax_checkers/typescript/tsc.vim b/syntax_checkers/typescript/tsc.vim index 768dc4e0c..9abf44b01 100644 --- a/syntax_checkers/typescript/tsc.vim +++ b/syntax_checkers/typescript/tsc.vim @@ -14,13 +14,12 @@ function! SyntaxCheckers_typescript_tsc_IsAvailable() endfunction -function! SyntaxCheckers_typescript_tsc_GetLocList() +function! SyntaxCheckers_typescript_tsc_GetLocList() dict let makeprg = syntastic#makeprg#build({ \ 'exe': 'tsc', \ 'args': '--module commonjs', \ 'post_args': '--out ' . syntastic#util#DevNull(), - \ 'filetype': 'typescript', - \ 'subchecker': 'tsc' }) + \ 'checker': self }) let errorformat = \ '%E%f %#(%l\,%c): error %m,' . diff --git a/syntax_checkers/vala/valac.vim b/syntax_checkers/vala/valac.vim index 7ffc02602..736719526 100644 --- a/syntax_checkers/vala/valac.vim +++ b/syntax_checkers/vala/valac.vim @@ -52,13 +52,12 @@ function! s:GetValaModules() return split(strpart(modules_str, 12), '\s\+') endfunction -function! SyntaxCheckers_vala_valac_GetLocList() +function! SyntaxCheckers_vala_valac_GetLocList() dict let vala_pkg_args = join(map(s:GetValaModules(), '"--pkg ".v:val'), ' ') let makeprg = syntastic#makeprg#build({ \ 'exe': 'valac', \ 'args': '-C ' . vala_pkg_args, - \ 'filetype': 'vala', - \ 'subchecker': 'valac' }) + \ 'checker': self }) let errorformat = \ '%A%f:%l.%c-%\d%\+.%\d%\+: %t%[a-z]%\+: %m,'. \ '%C%m,'. diff --git a/syntax_checkers/verilog/verilator.vim b/syntax_checkers/verilog/verilator.vim index 0bad01b3f..1b1d630fc 100644 --- a/syntax_checkers/verilog/verilator.vim +++ b/syntax_checkers/verilog/verilator.vim @@ -24,7 +24,7 @@ if !exists('g:syntastic_verilog_compiler_options') let g:syntastic_verilog_compiler_options = '-Wall' endif -function! SyntaxCheckers_verilog_verilator_GetLocList() +function! SyntaxCheckers_verilog_verilator_GetLocList() dict return syntastic#c#GetLocList('verilog', 'verilator', { \ 'errorformat': \ '%%%trror-%\=%\w%#: %f:%l: %m,' . diff --git a/syntax_checkers/vhdl/ghdl.vim b/syntax_checkers/vhdl/ghdl.vim index 7158cd78f..2dccac453 100644 --- a/syntax_checkers/vhdl/ghdl.vim +++ b/syntax_checkers/vhdl/ghdl.vim @@ -18,12 +18,11 @@ function! SyntaxCheckers_vhdl_ghdl_IsAvailable() return executable("ghdl") endfunction -function! SyntaxCheckers_vhdl_ghdl_GetLocList() +function! SyntaxCheckers_vhdl_ghdl_GetLocList() dict let makeprg = syntastic#makeprg#build({ \ 'exe': 'ghdl', \ 'args': '-s', - \ 'filetype': 'vhdl', - \ 'subchecker': 'ghdl' }) + \ 'checker': self }) let errorformat = '%f:%l:%c: %m' diff --git a/syntax_checkers/xhtml/tidy.vim b/syntax_checkers/xhtml/tidy.vim index e0c22fbbf..2c949c372 100644 --- a/syntax_checkers/xhtml/tidy.vim +++ b/syntax_checkers/xhtml/tidy.vim @@ -56,13 +56,12 @@ function! s:IgnoreError(text) return 0 endfunction -function! SyntaxCheckers_xhtml_tidy_GetLocList() +function! SyntaxCheckers_xhtml_tidy_GetLocList() dict let encopt = s:TidyEncOptByFenc() let makeprg = syntastic#makeprg#build({ \ 'exe': 'tidy', \ 'args': encopt . ' -xml -e', - \ 'filetype': 'xhtml', - \ 'subchecker': 'tidy' }) + \ 'checker': self }) let errorformat= \ '%Wline %l column %v - Warning: %m,' . diff --git a/syntax_checkers/xml/xmllint.vim b/syntax_checkers/xml/xmllint.vim index 5a6e1db70..869fab05f 100644 --- a/syntax_checkers/xml/xmllint.vim +++ b/syntax_checkers/xml/xmllint.vim @@ -23,12 +23,11 @@ function! SyntaxCheckers_xml_xmllint_IsAvailable() return executable('xmllint') endfunction -function! SyntaxCheckers_xml_xmllint_GetLocList() +function! SyntaxCheckers_xml_xmllint_GetLocList() dict let makeprg = syntastic#makeprg#build({ \ 'exe': 'xmllint', \ 'args': '--xinclude --noout --postvalid', - \ 'filetype': 'xml', - \ 'subchecker': 'xmllint' }) + \ 'checker': self }) let errorformat= \ '%E%f:%l: error : %m,' . diff --git a/syntax_checkers/xslt/xmllint.vim b/syntax_checkers/xslt/xmllint.vim index db397ed84..7e6afbe66 100644 --- a/syntax_checkers/xslt/xmllint.vim +++ b/syntax_checkers/xslt/xmllint.vim @@ -15,16 +15,9 @@ if exists("g:loaded_syntastic_xslt_xmllint_checker") endif let g:loaded_syntastic_xslt_xmllint_checker=1 -function! SyntaxCheckers_xslt_xmllint_IsAvailable() - return SyntaxCheckers_xml_xmllint_IsAvailable() -endfunction - -function! SyntaxCheckers_xslt_xmllint_GetLocList() - return SyntaxCheckers_xml_xmllint_GetLocList() -endfunction +runtime! syntax_checkers/xml/*.vim call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'xslt', - \ 'name': 'xmllint'}) - -runtime! syntax_checkers/xml/*.vim + \ 'name': 'xmllint', + \ 'redirect': 'xml/xmllint'}) diff --git a/syntax_checkers/yaml/jsyaml.vim b/syntax_checkers/yaml/jsyaml.vim index 9ffdc658e..d70327ced 100644 --- a/syntax_checkers/yaml/jsyaml.vim +++ b/syntax_checkers/yaml/jsyaml.vim @@ -22,12 +22,11 @@ function! SyntaxCheckers_yaml_jsyaml_IsAvailable() return executable("js-yaml") endfunction -function! SyntaxCheckers_yaml_jsyaml_GetLocList() +function! SyntaxCheckers_yaml_jsyaml_GetLocList() dict let makeprg = syntastic#makeprg#build({ \ 'exe': 'js-yaml', \ 'args': '--compact', - \ 'filetype': 'yaml', - \ 'subchecker': 'jsyaml' }) + \ 'checker': self }) let errorformat='Error on line %l\, col %c:%m,%-G%.%#' diff --git a/syntax_checkers/z80/z80syntaxchecker.vim b/syntax_checkers/z80/z80syntaxchecker.vim index b68acf130..3913643e3 100644 --- a/syntax_checkers/z80/z80syntaxchecker.vim +++ b/syntax_checkers/z80/z80syntaxchecker.vim @@ -23,11 +23,10 @@ function! SyntaxCheckers_z80_z80syntaxchecker_IsAvailable() return executable("z80_syntax_checker.py") endfunction -function! SyntaxCheckers_z80_z80syntaxchecker_GetLocList() +function! SyntaxCheckers_z80_z80syntaxchecker_GetLocList() dict let makeprg = syntastic#makeprg#build({ \ 'exe': 'z80_syntax_checker.py', - \ 'filetype': 'z80', - \ 'subchecker': 'z80syntaxchecker' }) + \ 'checker': self }) let errorformat = '%f:%l %m' diff --git a/syntax_checkers/zpt/zptlint.vim b/syntax_checkers/zpt/zptlint.vim index ae6ab8a31..accda1777 100644 --- a/syntax_checkers/zpt/zptlint.vim +++ b/syntax_checkers/zpt/zptlint.vim @@ -28,11 +28,10 @@ function! SyntaxCheckers_zpt_zptlint_IsAvailable() return executable("zptlint") endfunction -function! SyntaxCheckers_zpt_zptlint_GetLocList() +function! SyntaxCheckers_zpt_zptlint_GetLocList() dict let makeprg = syntastic#makeprg#build({ \ 'exe': 'zptlint', - \ 'filetype': 'zpt', - \ 'subchecker': 'zptlint' }) + \ 'checker': self }) let errorformat= \ '%-P*** Error in: %f,'. diff --git a/syntax_checkers/zsh/zsh.vim b/syntax_checkers/zsh/zsh.vim index 5e339a9c6..da830894c 100644 --- a/syntax_checkers/zsh/zsh.vim +++ b/syntax_checkers/zsh/zsh.vim @@ -19,12 +19,11 @@ function! SyntaxCheckers_zsh_zsh_IsAvailable() return executable("zsh") endfunction -function! SyntaxCheckers_zsh_zsh_GetLocList() +function! SyntaxCheckers_zsh_zsh_GetLocList() dict let makeprg = syntastic#makeprg#build({ \ 'exe': 'zsh', \ 'args': '-n', - \ 'filetype': 'zsh', - \ 'subchecker': 'zsh' }) + \ 'checker': self }) let errorformat = '%f:%l: %m' From 0e76cb9703811860d4c4ed249463b9a78b935246 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Mon, 28 Oct 2013 17:30:25 +0200 Subject: [PATCH 0235/1271] Registry cleanup, stage 2. (1) Checkers now have an _exec attribute, and an accessor getExec(). (2) CreateAndRegisterChecker() initializes _exec from an optional argument 'exec'. If this argument is missing, 'name' is used instead. (3) Functions SyntaxCheckers_*_IsAvailable() are now dictionary functions. (4) Functions SyntaxCheckers_*_IsAvailable() are now optional. When they are missing, they are assumed to return executable(expand(self.getExec())). (5) Argument 'exe' of function syntastic#makeprg#build() is now optional. If this argument is missing, expand(self.getExec()) is used to set checker executables. --- autoload/syntastic/c.vim | 2 +- doc/syntastic.txt | 11 +++++----- plugin/syntastic/checker.vim | 21 ++++++++++++++++++- plugin/syntastic/makeprg_builder.vim | 2 +- syntax_checkers/ada/gcc.vim | 4 ++-- syntax_checkers/applescript/osacompile.vim | 5 ----- syntax_checkers/asciidoc/asciidoc.vim | 5 ----- syntax_checkers/c/checkpatch.vim | 6 +++--- syntax_checkers/c/gcc.vim | 4 ++-- syntax_checkers/c/make.vim | 7 +------ syntax_checkers/c/oclint.vim | 5 ----- syntax_checkers/c/sparse.vim | 5 ----- syntax_checkers/c/splint.vim | 5 ----- syntax_checkers/c/ycm.vim | 2 +- syntax_checkers/chef/foodcritic.vim | 8 +------ syntax_checkers/co/coco.vim | 5 ----- syntax_checkers/cobol/cobc.vim | 4 ++-- syntax_checkers/coffee/coffee.vim | 8 +++---- syntax_checkers/coffee/coffeelint.vim | 5 ----- syntax_checkers/coq/coqtop.vim | 5 ----- syntax_checkers/cpp/cpplint.vim | 11 +++------- syntax_checkers/cpp/gcc.vim | 4 ++-- syntax_checkers/cs/mcs.vim | 5 ----- syntax_checkers/css/csslint.vim | 9 -------- syntax_checkers/css/prettycss.vim | 8 +------ syntax_checkers/cucumber/cucumber.vim | 5 ----- syntax_checkers/cuda/nvcc.vim | 10 ++++----- syntax_checkers/d/dmd.vim | 4 ++-- syntax_checkers/dart/dart_analyzer.vim | 8 +------ syntax_checkers/dustjs/swiffer.vim | 6 ++---- syntax_checkers/elixir/elixir.vim | 2 +- syntax_checkers/erlang/escript.vim | 5 ----- syntax_checkers/eruby/ruby.vim | 2 +- syntax_checkers/fortran/gfortran.vim | 4 ++-- syntax_checkers/go/go.vim | 4 ++-- syntax_checkers/go/gofmt.vim | 5 ----- syntax_checkers/go/golint.vim | 8 +------ syntax_checkers/go/govet.vim | 2 +- syntax_checkers/haml/haml.vim | 2 +- syntax_checkers/handlebars/handlebars.vim | 5 ----- syntax_checkers/haskell/ghc-mod.vim | 9 +++----- syntax_checkers/haskell/hdevtools.vim | 6 +----- syntax_checkers/haskell/hlint.vim | 8 +------ syntax_checkers/haxe/haxe.vim | 5 ----- syntax_checkers/hss/hss.vim | 5 ----- syntax_checkers/html/tidy.vim | 5 ----- syntax_checkers/html/validator.vim | 2 +- syntax_checkers/html/w3.vim | 2 +- syntax_checkers/java/checkstyle.vim | 8 ++----- syntax_checkers/java/javac.vim | 11 +++++----- .../javascript/closurecompiler.vim | 7 ++++--- syntax_checkers/javascript/gjslint.vim | 5 ----- syntax_checkers/javascript/jshint.vim | 2 +- syntax_checkers/javascript/jsl.vim | 16 ++------------ syntax_checkers/javascript/jslint.vim | 5 ----- syntax_checkers/json/jsonlint.vim | 5 ----- syntax_checkers/json/jsonval.vim | 8 +------ syntax_checkers/less/lessc.vim | 4 ++-- syntax_checkers/lisp/clisp.vim | 7 +------ syntax_checkers/llvm/llvm.vim | 8 ++----- syntax_checkers/lua/luac.vim | 7 ------- syntax_checkers/matlab/mlint.vim | 5 ----- syntax_checkers/nasm/nasm.vim | 9 +++----- syntax_checkers/nroff/mandoc.vim | 5 ----- syntax_checkers/objc/gcc.vim | 4 ++-- syntax_checkers/objcpp/gcc.vim | 4 ++-- syntax_checkers/ocaml/camlp4o.vim | 5 ++--- syntax_checkers/perl/perl.vim | 9 ++++---- syntax_checkers/perl/perlcritic.vim | 5 ----- syntax_checkers/php/php.vim | 5 ----- syntax_checkers/php/phpcs.vim | 5 ----- syntax_checkers/php/phpmd.vim | 5 ----- syntax_checkers/pod/podchecker.vim | 8 +------ syntax_checkers/puppet/puppet.vim | 9 +------- syntax_checkers/puppet/puppetlint.vim | 5 +++-- syntax_checkers/python/flake8.vim | 8 ++----- syntax_checkers/python/pep257.vim | 4 ---- syntax_checkers/python/pep8.vim | 4 ---- syntax_checkers/python/py3kwarn.vim | 4 ---- syntax_checkers/python/pyflakes.vim | 4 ---- syntax_checkers/python/pylama.vim | 8 ++----- syntax_checkers/python/pylint.vim | 9 ++++---- syntax_checkers/python/python.vim | 4 ---- syntax_checkers/rst/rst2pseudoxml.vim | 4 ++-- syntax_checkers/ruby/jruby.vim | 4 ---- syntax_checkers/ruby/macruby.vim | 4 ---- syntax_checkers/ruby/mri.vim | 7 ++----- syntax_checkers/ruby/rubocop.vim | 8 +++---- syntax_checkers/ruby/rubylint.vim | 8 ++----- syntax_checkers/rust/rustc.vim | 5 ----- syntax_checkers/sass/sass.vim | 5 ----- syntax_checkers/scala/fsc.vim | 5 ----- syntax_checkers/scala/scalac.vim | 6 ------ syntax_checkers/sh/checkbashisms.vim | 7 ------- syntax_checkers/sh/sh.vim | 2 +- syntax_checkers/sh/shellcheck.vim | 9 +++----- syntax_checkers/slim/slimrb.vim | 5 ----- syntax_checkers/tcl/nagelfar.vim | 5 ----- syntax_checkers/tex/chktex.vim | 5 ----- syntax_checkers/tex/lacheck.vim | 8 +------ syntax_checkers/text/atdtool.vim | 5 ----- syntax_checkers/twig/twiglint.vim | 8 ++----- syntax_checkers/typescript/tsc.vim | 6 ------ syntax_checkers/vala/valac.vim | 6 +----- syntax_checkers/verilog/verilator.vim | 4 ++-- syntax_checkers/vhdl/ghdl.vim | 5 ----- syntax_checkers/xhtml/tidy.vim | 5 ----- syntax_checkers/xml/xmllint.vim | 5 ----- syntax_checkers/yaml/jsyaml.vim | 8 ++----- syntax_checkers/z80/z80syntaxchecker.vim | 21 ++++++++----------- syntax_checkers/zpt/zptlint.vim | 18 ++++++---------- syntax_checkers/zsh/zsh.vim | 5 ----- 112 files changed, 159 insertions(+), 525 deletions(-) diff --git a/autoload/syntastic/c.vim b/autoload/syntastic/c.vim index a1c5c7efa..bab36862f 100644 --- a/autoload/syntastic/c.vim +++ b/autoload/syntastic/c.vim @@ -67,7 +67,7 @@ function! syntastic#c#GetLocList(filetype, subchecker, options) return [] endtry - let makeprg = g:syntastic_{a:filetype}_compiler . ' ' . flags . ' ' . syntastic#util#shexpand('%') + let makeprg = expand(g:syntastic_{a:filetype}_compiler) . ' ' . flags . ' ' . syntastic#util#shexpand('%') let errorformat = s:GetCheckerVar('g', a:filetype, a:subchecker, 'errorformat', a:options['errorformat']) diff --git a/doc/syntastic.txt b/doc/syntastic.txt index 4067228ab..e97dc70cd 100644 --- a/doc/syntastic.txt +++ b/doc/syntastic.txt @@ -449,14 +449,13 @@ Checkers that use 'syntastic#makeprg#build()' look like this: > \ 'args': '-a -b -c', \ 'post_args': '--more --args', \ 'tail': '> /tmp/output', - \ 'filetype': 'ruby', - \ 'subchecker': 'mri' }) + \ 'checker': self }) < -The 'filetype' and 'subchecker' parameters are mandatory. All of the other -parameters above are optional (well, you probably need at least 'exe'), and -can be overriden by setting global variables - even parameters not specified -in the call to syntastic#makeprg#build(). +The 'checker' argument is mandatory. All other arguments above are optional, +and can be overriden by setting global variables - even parameters not +specified in the call to syntastic#makeprg#build(). If 'exe' is the same as +the name of the checker, it may be omitted. E.g. To override the checker exe above, you could do this: > let g:syntastic_ruby_mri_exe="another_ruby_checker_exe.rb" diff --git a/plugin/syntastic/checker.vim b/plugin/syntastic/checker.vim index e867af475..88d1d53f4 100644 --- a/plugin/syntastic/checker.vim +++ b/plugin/syntastic/checker.vim @@ -12,6 +12,7 @@ function! g:SyntasticChecker.New(args) let newObj._filetype = a:args['filetype'] let newObj._name = a:args['name'] + let newObj._exec = get(a:args, 'exec', newObj._name) if has_key(a:args, 'redirect') let [filetype, name] = split(a:args['redirect'], '/') @@ -21,7 +22,12 @@ function! g:SyntasticChecker.New(args) endif let newObj._locListFunc = function(prefix . 'GetLocList') - let newObj._isAvailableFunc = function(prefix . 'IsAvailable') + + if exists('*' . prefix . 'IsAvailable') + let newObj._isAvailableFunc = function(prefix . 'IsAvailable') + else + let newObj._isAvailableFunc = function('SyntasticCheckerIsAvailableDefault') + endif if exists('*' . prefix . 'GetHighlightRegex') let newObj._highlightRegexFunc = function(prefix. 'GetHighlightRegex') @@ -40,6 +46,14 @@ function! g:SyntasticChecker.getName() return self._name endfunction +function! g:SyntasticChecker.getExec() + if exists('g:syntastic_' . self._filetype . '_' . self._name . '_exec') + return expand(g:syntastic_{self._filetype}_{self._name}_exec) + endif + + return self._exec +endfunction + function! g:SyntasticChecker.getLocList() try let list = self._locListFunc() @@ -85,4 +99,9 @@ function! g:SyntasticChecker._populateHighlightRegexes(list) return list endfunction +" Non-method functions +function! SyntasticCheckerIsAvailableDefault() dict + return executable(self.getExec()) +endfunction + " vim: set sw=4 sts=4 et fdm=marker: diff --git a/plugin/syntastic/makeprg_builder.vim b/plugin/syntastic/makeprg_builder.vim index 295fe198f..2b11037b7 100644 --- a/plugin/syntastic/makeprg_builder.vim +++ b/plugin/syntastic/makeprg_builder.vim @@ -9,7 +9,7 @@ let g:SyntasticMakeprgBuilder = {} function! g:SyntasticMakeprgBuilder.New(checker, exe, args, fname, post_args, tail) let newObj = copy(self) - let newObj._exe = a:exe + let newObj._exe = (a:exe == '' && has_key(a:checker, 'getExec')) ? a:checker.getExec() : a:exe let newObj._args = a:args let newObj._fname = a:fname let newObj._post_args = a:post_args diff --git a/syntax_checkers/ada/gcc.vim b/syntax_checkers/ada/gcc.vim index 8eabc04c1..faefa90a0 100644 --- a/syntax_checkers/ada/gcc.vim +++ b/syntax_checkers/ada/gcc.vim @@ -16,8 +16,8 @@ if !exists('g:syntastic_ada_compiler') let g:syntastic_ada_compiler = 'gcc' endif -function! SyntaxCheckers_ada_gcc_IsAvailable() - return executable(g:syntastic_ada_compiler) +function! SyntaxCheckers_ada_gcc_IsAvailable() dict + return executable(expand(g:syntastic_ada_compiler)) endfunction let s:save_cpo = &cpo diff --git a/syntax_checkers/applescript/osacompile.vim b/syntax_checkers/applescript/osacompile.vim index 4273e4e77..0119133ae 100644 --- a/syntax_checkers/applescript/osacompile.vim +++ b/syntax_checkers/applescript/osacompile.vim @@ -30,13 +30,8 @@ if exists("g:loaded_syntastic_applescript_osacompile_checker") endif let g:loaded_syntastic_applescript_osacompile_checker=1 -function! SyntaxCheckers_applescript_osacompile_IsAvailable() - return executable('osacompile') -endfunction - function! SyntaxCheckers_applescript_osacompile_GetLocList() dict let makeprg = syntastic#makeprg#build({ - \ 'exe': 'osacompile', \ 'args': '-o ' . tempname() . '.scpt ', \ 'checker': self }) let errorformat = '%f:%l:%m' diff --git a/syntax_checkers/asciidoc/asciidoc.vim b/syntax_checkers/asciidoc/asciidoc.vim index d9e40d326..adc7b127e 100644 --- a/syntax_checkers/asciidoc/asciidoc.vim +++ b/syntax_checkers/asciidoc/asciidoc.vim @@ -15,13 +15,8 @@ if exists("g:loaded_syntastic_asciidoc_asciidoc_checker") endif let g:loaded_syntastic_asciidoc_asciidoc_checker = 1 -function! SyntaxCheckers_asciidoc_asciidoc_IsAvailable() - return executable("asciidoc") -endfunction - function! SyntaxCheckers_asciidoc_asciidoc_GetLocList() dict let makeprg = syntastic#makeprg#build({ - \ 'exe': 'asciidoc', \ 'args': syntastic#c#NullOutput(), \ 'checker': self }) diff --git a/syntax_checkers/c/checkpatch.vim b/syntax_checkers/c/checkpatch.vim index cea54d670..6434b39e4 100644 --- a/syntax_checkers/c/checkpatch.vim +++ b/syntax_checkers/c/checkpatch.vim @@ -20,11 +20,10 @@ elseif executable("./scripts/checkpatch.pl") let g:syntastic_c_checker_checkpatch_location = './scripts/checkpatch.pl' endif -function! SyntaxCheckers_c_checkpatch_IsAvailable() +function! SyntaxCheckers_c_checkpatch_IsAvailable() dict return exists("g:syntastic_c_checker_checkpatch_location") endfunction - function! SyntaxCheckers_c_checkpatch_GetLocList() dict let makeprg = syntastic#makeprg#build({ \ 'exe': g:syntastic_c_checker_checkpatch_location, @@ -44,4 +43,5 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'c', - \ 'name': 'checkpatch'}) + \ 'name': 'checkpatch', + \ 'exec': 'checkpatch.pl'}) diff --git a/syntax_checkers/c/gcc.vim b/syntax_checkers/c/gcc.vim index 0a73ab0c1..0c15142b2 100644 --- a/syntax_checkers/c/gcc.vim +++ b/syntax_checkers/c/gcc.vim @@ -20,8 +20,8 @@ if !exists('g:syntastic_c_compiler') let g:syntastic_c_compiler = 'gcc' endif -function! SyntaxCheckers_c_gcc_IsAvailable() - return executable(g:syntastic_c_compiler) +function! SyntaxCheckers_c_gcc_IsAvailable() dict + return executable(expand(g:syntastic_c_compiler)) endfunction let s:save_cpo = &cpo diff --git a/syntax_checkers/c/make.vim b/syntax_checkers/c/make.vim index e0da876c7..bc3a8d55e 100644 --- a/syntax_checkers/c/make.vim +++ b/syntax_checkers/c/make.vim @@ -15,16 +15,11 @@ if exists('g:loaded_syntastic_c_make_checker') endif let g:loaded_syntastic_c_make_checker = 1 -function! SyntaxCheckers_c_make_IsAvailable() - return executable('make') -endfunction - let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_c_make_GetLocList() dict - - let makeprg = 'make -sk' + let makeprg = expand(self.getExec()) . ' -sk' let errorformat = \ '%-G%f:%s:,' . diff --git a/syntax_checkers/c/oclint.vim b/syntax_checkers/c/oclint.vim index b498b2c94..9c1d708e2 100644 --- a/syntax_checkers/c/oclint.vim +++ b/syntax_checkers/c/oclint.vim @@ -21,17 +21,12 @@ if exists("g:loaded_syntastic_c_oclint_checker") endif let g:loaded_syntastic_c_oclint_checker = 1 -function! SyntaxCheckers_c_oclint_IsAvailable() - return executable("oclint") -endfunction - if !exists('g:syntastic_oclint_config_file') let g:syntastic_oclint_config_file = '.syntastic_oclint_config' endif function! SyntaxCheckers_c_oclint_GetLocList() dict let makeprg = syntastic#makeprg#build({ - \ 'exe': 'oclint', \ 'args': '-text', \ 'post_args': '-- -c ' . syntastic#c#ReadConfig(g:syntastic_oclint_config_file), \ 'checker': self }) diff --git a/syntax_checkers/c/sparse.vim b/syntax_checkers/c/sparse.vim index 21938f473..9c9491e5c 100644 --- a/syntax_checkers/c/sparse.vim +++ b/syntax_checkers/c/sparse.vim @@ -21,17 +21,12 @@ if exists("g:loaded_syntastic_c_sparse_checker") endif let g:loaded_syntastic_c_sparse_checker = 1 -function! SyntaxCheckers_c_sparse_IsAvailable() - return executable("sparse") -endfunction - if !exists('g:syntastic_sparse_config_file') let g:syntastic_sparse_config_file = '.syntastic_sparse_config' endif function! SyntaxCheckers_c_sparse_GetLocList() dict let makeprg = syntastic#makeprg#build({ - \ 'exe': 'sparse', \ 'args': '-ftabstop=' . &ts . ' ' . syntastic#c#ReadConfig(g:syntastic_sparse_config_file), \ 'checker': self }) diff --git a/syntax_checkers/c/splint.vim b/syntax_checkers/c/splint.vim index 960e1370c..590555b0d 100644 --- a/syntax_checkers/c/splint.vim +++ b/syntax_checkers/c/splint.vim @@ -21,17 +21,12 @@ if exists("g:loaded_syntastic_c_splint_checker") endif let g:loaded_syntastic_c_splint_checker = 1 -function! SyntaxCheckers_c_splint_IsAvailable() - return executable("splint") -endfunction - if !exists('g:syntastic_splint_config_file') let g:syntastic_splint_config_file = '.syntastic_splint_config' endif function! SyntaxCheckers_c_splint_GetLocList() dict let makeprg = syntastic#makeprg#build({ - \ 'exe': 'splint', \ 'post_args': '-showfunc -hints +quiet ' . syntastic#c#ReadConfig(g:syntastic_splint_config_file), \ 'checker': self }) diff --git a/syntax_checkers/c/ycm.vim b/syntax_checkers/c/ycm.vim index 002ede56c..d410aba6c 100644 --- a/syntax_checkers/c/ycm.vim +++ b/syntax_checkers/c/ycm.vim @@ -15,7 +15,7 @@ if exists("g:loaded_syntastic_c_ycm_checker") endif let g:loaded_syntastic_c_ycm_checker = 1 -function! SyntaxCheckers_c_ycm_IsAvailable() +function! SyntaxCheckers_c_ycm_IsAvailable() dict return exists('g:loaded_youcompleteme') endfunction diff --git a/syntax_checkers/chef/foodcritic.vim b/syntax_checkers/chef/foodcritic.vim index a016ef89c..42d1cda70 100644 --- a/syntax_checkers/chef/foodcritic.vim +++ b/syntax_checkers/chef/foodcritic.vim @@ -15,14 +15,8 @@ if exists("g:loaded_syntastic_chef_foodcritic_checker") endif let g:loaded_syntastic_chef_foodcritic_checker=1 -function! SyntaxCheckers_chef_foodcritic_IsAvailable() - return executable('foodcritic') -endfunction - function! SyntaxCheckers_chef_foodcritic_GetLocList() dict - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'foodcritic', - \ 'checker': self }) + let makeprg = syntastic#makeprg#build({ 'checker': self }) " FC023: Prefer conditional attributes: ./recipes/config.rb:49 let errorformat = 'FC%n: %m: %f:%l' diff --git a/syntax_checkers/co/coco.vim b/syntax_checkers/co/coco.vim index 7ed07c682..f22e4e56e 100644 --- a/syntax_checkers/co/coco.vim +++ b/syntax_checkers/co/coco.vim @@ -19,13 +19,8 @@ if !executable("coco") finish endif -function! SyntaxCheckers_co_coco_IsAvailable() - return executable('coco') -endfunction - function! SyntaxCheckers_co_coco_GetLocList() dict let makeprg = syntastic#makeprg#build({ - \ 'exe': 'coco', \ 'args': '-c -o /tmp', \ 'checker': self }) diff --git a/syntax_checkers/cobol/cobc.vim b/syntax_checkers/cobol/cobc.vim index edaa4ec8a..41fa1aa42 100644 --- a/syntax_checkers/cobol/cobc.vim +++ b/syntax_checkers/cobol/cobc.vim @@ -20,8 +20,8 @@ if !exists('g:syntastic_cobol_compiler') let g:syntastic_cobol_compiler = 'cobc' endif -function! SyntaxCheckers_cobol_cobc_IsAvailable() - return executable(g:syntastic_cobol_compiler) +function! SyntaxCheckers_cobol_cobc_IsAvailable() dict + return executable(expand(g:syntastic_cobol_compiler)) endfunction let s:save_cpo = &cpo diff --git a/syntax_checkers/coffee/coffee.vim b/syntax_checkers/coffee/coffee.vim index c72d62ed1..44435e233 100644 --- a/syntax_checkers/coffee/coffee.vim +++ b/syntax_checkers/coffee/coffee.vim @@ -17,14 +17,14 @@ if exists("g:loaded_syntastic_coffee_coffee_checker") endif let g:loaded_syntastic_coffee_coffee_checker=1 -function! SyntaxCheckers_coffee_coffee_IsAvailable() - return executable("coffee") && - \ syntastic#util#versionIsAtLeast(syntastic#util#getVersion('coffee --version 2>' . syntastic#util#DevNull()), [1,6,2]) +function! SyntaxCheckers_coffee_coffee_IsAvailable() dict + let exe = self.getExec() + return executable(exe) && + \ syntastic#util#versionIsAtLeast(syntastic#util#getVersion(exe . ' --version 2>' . syntastic#util#DevNull()), [1,6,2]) endfunction function! SyntaxCheckers_coffee_coffee_GetLocList() dict let makeprg = syntastic#makeprg#build({ - \ 'exe': 'coffee', \ 'args': '-cp', \ 'checker': self }) diff --git a/syntax_checkers/coffee/coffeelint.vim b/syntax_checkers/coffee/coffeelint.vim index a7bdeae5c..1fbf5943a 100644 --- a/syntax_checkers/coffee/coffeelint.vim +++ b/syntax_checkers/coffee/coffeelint.vim @@ -14,13 +14,8 @@ if exists("g:loaded_syntastic_coffee_coffeelint_checker") endif let g:loaded_syntastic_coffee_coffeelint_checker=1 -function! SyntaxCheckers_coffee_coffeelint_IsAvailable() - return executable('coffeelint') -endfunction - function! SyntaxCheckers_coffee_coffeelint_GetLocList() dict let makeprg = syntastic#makeprg#build({ - \ 'exe': 'coffeelint', \ 'args': '--csv', \ 'checker': self }) diff --git a/syntax_checkers/coq/coqtop.vim b/syntax_checkers/coq/coqtop.vim index b58a7ac92..5a1f2bd3e 100644 --- a/syntax_checkers/coq/coqtop.vim +++ b/syntax_checkers/coq/coqtop.vim @@ -15,13 +15,8 @@ if exists("g:loaded_syntastic_coq_coqtop_checker") endif let g:loaded_syntastic_coq_coqtop_checker=1 -function! SyntaxCheckers_coq_coqtop_IsAvailable() - return executable('coqtop') -endfunction - function! SyntaxCheckers_coq_coqtop_GetLocList() dict let makeprg = syntastic#makeprg#build({ - \ 'exe': 'coqtop', \ 'args': '-noglob -batch -load-vernac-source', \ 'checker': self }) diff --git a/syntax_checkers/cpp/cpplint.vim b/syntax_checkers/cpp/cpplint.vim index 7bcb2f9af..a3c01d93e 100644 --- a/syntax_checkers/cpp/cpplint.vim +++ b/syntax_checkers/cpp/cpplint.vim @@ -35,14 +35,8 @@ if ! exists('g:syntastic_cpp_cpplint_args') let g:syntastic_cpp_cpplint_args = '--verbose=3' endif -function! SyntaxCheckers_cpp_cpplint_IsAvailable() - return executable('cpplint.py') -endfunction - function! SyntaxCheckers_cpp_cpplint_GetLocList() dict - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'cpplint.py', - \ 'checker': self }) + let makeprg = syntastic#makeprg#build({ 'checker': self }) let errorformat = '%A%f:%l: %m [%t],%-G%.%#' @@ -61,4 +55,5 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'cpp', - \ 'name': 'cpplint'}) + \ 'name': 'cpplint', + \ 'exec': 'cpplint.py'}) diff --git a/syntax_checkers/cpp/gcc.vim b/syntax_checkers/cpp/gcc.vim index c5cc59ff4..7b6e085bd 100644 --- a/syntax_checkers/cpp/gcc.vim +++ b/syntax_checkers/cpp/gcc.vim @@ -19,8 +19,8 @@ if !exists('g:syntastic_cpp_compiler') let g:syntastic_cpp_compiler = 'g++' endif -function! SyntaxCheckers_cpp_gcc_IsAvailable() - return executable(g:syntastic_cpp_compiler) +function! SyntaxCheckers_cpp_gcc_IsAvailable() dict + return executable(expand(g:syntastic_cpp_compiler)) endfunction let s:save_cpo = &cpo diff --git a/syntax_checkers/cs/mcs.vim b/syntax_checkers/cs/mcs.vim index 818a460e9..79129e1cd 100644 --- a/syntax_checkers/cs/mcs.vim +++ b/syntax_checkers/cs/mcs.vim @@ -15,13 +15,8 @@ if exists("g:loaded_syntastic_cs_mcs_checker") endif let g:loaded_syntastic_cs_mcs_checker=1 -function! SyntaxCheckers_cs_mcs_IsAvailable() - return executable('mcs') -endfunction - function! SyntaxCheckers_cs_mcs_GetLocList() dict let makeprg = syntastic#makeprg#build({ - \ 'exe': 'mcs', \ 'args': '--parse', \ 'checker': self }) diff --git a/syntax_checkers/css/csslint.vim b/syntax_checkers/css/csslint.vim index f047d1727..8ef976823 100644 --- a/syntax_checkers/css/csslint.vim +++ b/syntax_checkers/css/csslint.vim @@ -19,21 +19,12 @@ if exists('g:loaded_syntastic_css_csslint_checker') endif let g:loaded_syntastic_css_csslint_checker=1 -if !exists('g:syntastic_csslint_exec') - let g:syntastic_csslint_exec = 'csslint' -endif - if !exists('g:syntastic_csslint_options') let g:syntastic_csslint_options = '' endif -function! SyntaxCheckers_css_csslint_IsAvailable() - return executable(expand(g:syntastic_csslint_exec)) -endfunction - function! SyntaxCheckers_css_csslint_GetLocList() dict let makeprg = syntastic#makeprg#build({ - \ 'exe': expand(g:syntastic_csslint_exec), \ 'args': '--format=compact ' . g:syntastic_csslint_options, \ 'checker': self }) diff --git a/syntax_checkers/css/prettycss.vim b/syntax_checkers/css/prettycss.vim index 30b9392cd..c1e410177 100644 --- a/syntax_checkers/css/prettycss.vim +++ b/syntax_checkers/css/prettycss.vim @@ -20,10 +20,6 @@ if exists("g:loaded_syntastic_css_prettycss_checker") endif let g:loaded_syntastic_css_prettycss_checker=1 -function! SyntaxCheckers_css_prettycss_IsAvailable() - return executable('prettycss') -endfunction - function! SyntaxCheckers_css_prettycss_GetHighlightRegex(item) let term = matchstr(a:item["text"], '\m (\zs[^)]\+\ze)$') if term != '' @@ -33,9 +29,7 @@ function! SyntaxCheckers_css_prettycss_GetHighlightRegex(item) endfunction function! SyntaxCheckers_css_prettycss_GetLocList() dict - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'prettycss', - \ 'checker': self }) + let makeprg = syntastic#makeprg#build({ 'checker': self }) " Print CSS Lint's error/warning messages from compact format. Ignores blank lines. let errorformat = diff --git a/syntax_checkers/cucumber/cucumber.vim b/syntax_checkers/cucumber/cucumber.vim index 187f61263..c499b3155 100644 --- a/syntax_checkers/cucumber/cucumber.vim +++ b/syntax_checkers/cucumber/cucumber.vim @@ -15,13 +15,8 @@ if exists("g:loaded_syntastic_cucumber_cucumber_checker") endif let g:loaded_syntastic_cucumber_cucumber_checker=1 -function! SyntaxCheckers_cucumber_cucumber_IsAvailable() - return executable('cucumber') -endfunction - function! SyntaxCheckers_cucumber_cucumber_GetLocList() dict let makeprg = syntastic#makeprg#build({ - \ 'exe': 'cucumber', \ 'args': '--dry-run --quiet --strict --format pretty', \ 'checker': self }) diff --git a/syntax_checkers/cuda/nvcc.vim b/syntax_checkers/cuda/nvcc.vim index ad92fc7b9..08658e2fa 100644 --- a/syntax_checkers/cuda/nvcc.vim +++ b/syntax_checkers/cuda/nvcc.vim @@ -24,10 +24,6 @@ if exists("g:loaded_syntastic_cuda_nvcc_checker") endif let g:loaded_syntastic_cuda_nvcc_checker=1 -function! SyntaxCheckers_cuda_nvcc_IsAvailable() - return executable('nvcc') -endfunction - function! SyntaxCheckers_cuda_nvcc_GetLocList() dict if exists('g:syntastic_cuda_arch') let arch_flag = '-arch=' . g:syntastic_cuda_arch @@ -35,8 +31,9 @@ function! SyntaxCheckers_cuda_nvcc_GetLocList() dict let arch_flag = '' endif let makeprg = - \ 'nvcc ' . arch_flag . ' --cuda -O0 -I . -Xcompiler -fsyntax-only ' . + \ self.getExec() . ' ' . arch_flag . ' --cuda -O0 -I . -Xcompiler -fsyntax-only ' . \ syntastic#util#shexpand('%') . ' ' . syntastic#c#NullOutput() + let errorformat = \ '%*[^"]"%f"%*\D%l: %m,'. \ '"%f"%*\D%l: %m,'. @@ -57,7 +54,8 @@ function! SyntaxCheckers_cuda_nvcc_GetLocList() dict if exists('g:syntastic_cuda_check_header') let makeprg = \ 'echo > .syntastic_dummy.cu ; ' . - \ 'nvcc ' . arch_flag . ' --cuda -O0 -I . .syntastic_dummy.cu -Xcompiler -fsyntax-only -include ' . + \ self.getExec() . ' ' . arch_flag . + \ ' --cuda -O0 -I . .syntastic_dummy.cu -Xcompiler -fsyntax-only -include ' . \ syntastic#util#shexpand('%') . ' ' . syntastic#c#NullOutput() else return [] diff --git a/syntax_checkers/d/dmd.vim b/syntax_checkers/d/dmd.vim index 267f8a29e..0c1df604b 100644 --- a/syntax_checkers/d/dmd.vim +++ b/syntax_checkers/d/dmd.vim @@ -24,8 +24,8 @@ if !exists('g:syntastic_d_compiler') let g:syntastic_d_compiler = 'dmd' endif -function! SyntaxCheckers_d_dmd_IsAvailable() - return executable(g:syntastic_d_compiler) +function! SyntaxCheckers_d_dmd_IsAvailable() dict + return executable(expand(g:syntastic_d_compiler)) endfunction let s:save_cpo = &cpo diff --git a/syntax_checkers/dart/dart_analyzer.vim b/syntax_checkers/dart/dart_analyzer.vim index 00420e9e3..8b6897648 100644 --- a/syntax_checkers/dart/dart_analyzer.vim +++ b/syntax_checkers/dart/dart_analyzer.vim @@ -17,10 +17,6 @@ if !exists("g:syntastic_dart_analyzer_conf") let g:syntastic_dart_analyzer_conf = '' endif -function! SyntaxCheckers_dart_dart_analyzer_IsAvailable() - return executable("dart_analyzer") -endfunction - function! SyntaxCheckers_dart_dart_analyzer_GetHighlightRegex(error) let lcol = a:error['col'] - 1 let rcol = a:error['nr'] + lcol + 1 @@ -29,11 +25,9 @@ function! SyntaxCheckers_dart_dart_analyzer_GetHighlightRegex(error) endfunction function! SyntaxCheckers_dart_dart_analyzer_GetLocList() dict - let args = !empty(g:syntastic_dart_analyzer_conf) ? ' ' . g:syntastic_dart_analyzer_conf : '' let makeprg = syntastic#makeprg#build({ - \ 'exe': 'dart_analyzer', \ 'args': '--error_format machine', - \ 'post_args': args, + \ 'post_args': g:syntastic_dart_analyzer_conf, \ 'checker': self }) " Machine readable format looks like: diff --git a/syntax_checkers/dustjs/swiffer.vim b/syntax_checkers/dustjs/swiffer.vim index eebd0beba..b53f9f5fe 100644 --- a/syntax_checkers/dustjs/swiffer.vim +++ b/syntax_checkers/dustjs/swiffer.vim @@ -15,14 +15,12 @@ endif let g:loaded_syntastic_dustjs_swiffer_checker = 1 -function! SyntaxCheckers_dustjs_swiffer_IsAvailable() +function! SyntaxCheckers_dustjs_swiffer_IsAvailable() dict return executable('swiffer') endfunction function! SyntaxCheckers_dustjs_swiffer_GetLocList() dict - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'swiffer', - \ 'checker': self }) + let makeprg = syntastic#makeprg#build({ 'checker': self }) let errorformat = '%E%f - Line %l\, Column %c: %m' diff --git a/syntax_checkers/elixir/elixir.vim b/syntax_checkers/elixir/elixir.vim index be7e1241d..e2660351c 100644 --- a/syntax_checkers/elixir/elixir.vim +++ b/syntax_checkers/elixir/elixir.vim @@ -15,7 +15,7 @@ endif let g:loaded_syntastic_elixir_elixir_checker=1 " TODO: we should probably split this into separate checkers -function! SyntaxCheckers_elixir_elixir_IsAvailable() +function! SyntaxCheckers_elixir_elixir_IsAvailable() dict return executable('elixir') && executable('mix') endfunction diff --git a/syntax_checkers/erlang/escript.vim b/syntax_checkers/erlang/escript.vim index 20f6f71aa..bd9014a6d 100644 --- a/syntax_checkers/erlang/escript.vim +++ b/syntax_checkers/erlang/escript.vim @@ -21,10 +21,6 @@ endif let s:check_file = expand(':p:h') . '/erlang_check_file.erl' -function! SyntaxCheckers_erlang_escript_IsAvailable() - return executable('escript') -endfunction - function! SyntaxCheckers_erlang_escript_GetLocList() dict if expand('%:e') ==# 'hrl' return [] @@ -39,7 +35,6 @@ function! SyntaxCheckers_erlang_escript_GetLocList() dict let post_args = g:syntastic_erlc_include_path endif let makeprg = syntastic#makeprg#build({ - \ 'exe': 'escript', \ 'args': args, \ 'fname': syntastic#util#shexpand('%:p'), \ 'post_args': post_args, diff --git a/syntax_checkers/eruby/ruby.vim b/syntax_checkers/eruby/ruby.vim index 8df5db8eb..b7a7baeda 100644 --- a/syntax_checkers/eruby/ruby.vim +++ b/syntax_checkers/eruby/ruby.vim @@ -19,7 +19,7 @@ if !exists("g:syntastic_ruby_exec") let g:syntastic_ruby_exec = "ruby" endif -function! SyntaxCheckers_eruby_ruby_IsAvailable() +function! SyntaxCheckers_eruby_ruby_IsAvailable() dict return executable(expand(g:syntastic_ruby_exec)) endfunction diff --git a/syntax_checkers/fortran/gfortran.vim b/syntax_checkers/fortran/gfortran.vim index f75277796..1d3f0a9f0 100644 --- a/syntax_checkers/fortran/gfortran.vim +++ b/syntax_checkers/fortran/gfortran.vim @@ -19,8 +19,8 @@ if !exists('g:syntastic_fortran_compiler') let g:syntastic_fortran_compiler = 'gfortran' endif -function! SyntaxCheckers_fortran_gfortran_IsAvailable() - return executable(g:syntastic_fortran_compiler) +function! SyntaxCheckers_fortran_gfortran_IsAvailable() dict + return executable(expand(g:syntastic_fortran_compiler)) endfunction let s:save_cpo = &cpo diff --git a/syntax_checkers/go/go.vim b/syntax_checkers/go/go.vim index e4f8f3f7c..752c53693 100644 --- a/syntax_checkers/go/go.vim +++ b/syntax_checkers/go/go.vim @@ -17,8 +17,8 @@ if exists("g:loaded_syntastic_go_go_checker") endif let g:loaded_syntastic_go_go_checker=1 -function! SyntaxCheckers_go_go_IsAvailable() - return executable('go') +function! SyntaxCheckers_go_go_IsAvailable() dict + return executable('go') && executable('gofmt') endfunction function! SyntaxCheckers_go_go_GetLocList() dict diff --git a/syntax_checkers/go/gofmt.vim b/syntax_checkers/go/gofmt.vim index 4ad6e94a9..a9db2259c 100644 --- a/syntax_checkers/go/gofmt.vim +++ b/syntax_checkers/go/gofmt.vim @@ -17,13 +17,8 @@ if exists("g:loaded_syntastic_go_gofmt_checker") endif let g:loaded_syntastic_go_gofmt_checker=1 -function! SyntaxCheckers_go_gofmt_IsAvailable() - return executable('gofmt') -endfunction - function! SyntaxCheckers_go_gofmt_GetLocList() dict let makeprg = syntastic#makeprg#build({ - \ 'exe': 'gofmt', \ 'args': '-l', \ 'tail': '1>' . syntastic#util#DevNull(), \ 'checker': self }) diff --git a/syntax_checkers/go/golint.vim b/syntax_checkers/go/golint.vim index 98ec7bc2f..72c7c6a68 100644 --- a/syntax_checkers/go/golint.vim +++ b/syntax_checkers/go/golint.vim @@ -14,14 +14,8 @@ if exists("g:loaded_syntastic_go_golint_checker") endif let g:loaded_syntastic_go_golint_checker=1 -function! SyntaxCheckers_go_golint_IsAvailable() - return executable('golint') -endfunction - function! SyntaxCheckers_go_golint_GetLocList() dict - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'golint', - \ 'checker': self }) + let makeprg = syntastic#makeprg#build({ 'checker': self }) let errorformat = '%f:%l:%c: %m,%-G%.%#' diff --git a/syntax_checkers/go/govet.vim b/syntax_checkers/go/govet.vim index 901dcf582..3ba0aa588 100644 --- a/syntax_checkers/go/govet.vim +++ b/syntax_checkers/go/govet.vim @@ -14,7 +14,7 @@ if exists("g:loaded_syntastic_go_govet_checker") endif let g:loaded_syntastic_go_govet_checker=1 -function! SyntaxCheckers_go_govet_IsAvailable() +function! SyntaxCheckers_go_govet_IsAvailable() dict return executable('go') endfunction diff --git a/syntax_checkers/haml/haml.vim b/syntax_checkers/haml/haml.vim index 93adc502c..d2dcf166e 100644 --- a/syntax_checkers/haml/haml.vim +++ b/syntax_checkers/haml/haml.vim @@ -19,7 +19,7 @@ if !exists('g:syntastic_haml_interpreter') let g:syntastic_haml_interpreter = 'haml' endif -function! SyntaxCheckers_haml_haml_IsAvailable() +function! SyntaxCheckers_haml_haml_IsAvailable() dict return executable(expand(g:syntastic_haml_interpreter)) endfunction diff --git a/syntax_checkers/handlebars/handlebars.vim b/syntax_checkers/handlebars/handlebars.vim index 1e8a40ba3..07fd6dfa0 100644 --- a/syntax_checkers/handlebars/handlebars.vim +++ b/syntax_checkers/handlebars/handlebars.vim @@ -13,13 +13,8 @@ if exists("g:loaded_syntastic_handlebars_handlebars_checker") endif let g:loaded_syntastic_handlebars_handlebars_checker=1 -function! SyntaxCheckers_handlebars_handlebars_IsAvailable() - return executable('handlebars') -endfunction - function! SyntaxCheckers_handlebars_handlebars_GetLocList() dict let makeprg = syntastic#makeprg#build({ - \ 'exe': 'handlebars', \ 'args': '-f ' . syntastic#util#DevNull(), \ 'checker': self }) diff --git a/syntax_checkers/haskell/ghc-mod.vim b/syntax_checkers/haskell/ghc-mod.vim index 4a8689a45..0c3d01408 100644 --- a/syntax_checkers/haskell/ghc-mod.vim +++ b/syntax_checkers/haskell/ghc-mod.vim @@ -15,13 +15,9 @@ if exists('g:loaded_syntastic_haskell_ghc_mod_checker') endif let g:loaded_syntastic_haskell_ghc_mod_checker = 1 -function! SyntaxCheckers_haskell_ghc_mod_IsAvailable() - return executable('ghc-mod') -endfunction - function! SyntaxCheckers_haskell_ghc_mod_GetLocList() dict let makeprg = syntastic#makeprg#build({ - \ 'exe': 'ghc-mod check', + \ 'exe': self.getExec() . ' check', \ 'checker': self }) let errorformat = @@ -42,4 +38,5 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'haskell', - \ 'name': 'ghc_mod'}) + \ 'name': 'ghc_mod', + \ 'exec': 'ghc-mod'}) diff --git a/syntax_checkers/haskell/hdevtools.vim b/syntax_checkers/haskell/hdevtools.vim index c7fb45cb9..f7be91380 100644 --- a/syntax_checkers/haskell/hdevtools.vim +++ b/syntax_checkers/haskell/hdevtools.vim @@ -15,13 +15,9 @@ if exists("g:loaded_syntastic_haskell_hdevtools_checker") endif let g:loaded_syntastic_haskell_hdevtools_checker=1 -function! SyntaxCheckers_haskell_hdevtools_IsAvailable() - return executable('hdevtools') -endfunction - function! SyntaxCheckers_haskell_hdevtools_GetLocList() dict let makeprg = syntastic#makeprg#build({ - \ 'exe': 'hdevtools check', + \ 'exe': self.getExec() . ' check', \ 'args': get(g:, 'hdevtools_options', ''), \ 'checker': self }) diff --git a/syntax_checkers/haskell/hlint.vim b/syntax_checkers/haskell/hlint.vim index da94b1ef9..fb8f0a470 100644 --- a/syntax_checkers/haskell/hlint.vim +++ b/syntax_checkers/haskell/hlint.vim @@ -10,14 +10,8 @@ if exists('g:loaded_syntastic_haskell_hlint_checker') endif let g:loaded_syntastic_haskell_hlint_checker = 1 -function! SyntaxCheckers_haskell_hlint_IsAvailable() - return executable('hlint') -endfunction - function! SyntaxCheckers_haskell_hlint_GetLocList() dict - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'hlint', - \ 'checker': self }) + let makeprg = syntastic#makeprg#build({ 'checker': self }) let errorformat = \ '%E%f:%l:%c: Error: %m,' . diff --git a/syntax_checkers/haxe/haxe.vim b/syntax_checkers/haxe/haxe.vim index 532bc10bb..f3d0a813b 100644 --- a/syntax_checkers/haxe/haxe.vim +++ b/syntax_checkers/haxe/haxe.vim @@ -15,10 +15,6 @@ if exists("g:loaded_syntastic_haxe_haxe_checker") endif let g:loaded_syntastic_haxe_haxe_checker=1 -function! SyntaxCheckers_haxe_haxe_IsAvailable() - return executable('haxe') -endfunction - function! SyntaxCheckers_haxe_haxe_GetLocList() dict if exists('b:vaxe_hxml') let hxml = b:vaxe_hxml @@ -31,7 +27,6 @@ function! SyntaxCheckers_haxe_haxe_GetLocList() dict if !empty(hxml) let makeprg = syntastic#makeprg#build({ - \ 'exe': 'haxe', \ 'fname': syntastic#util#shescape(fnameescape(fnamemodify(hxml, ':t'))), \ 'checker': self }) diff --git a/syntax_checkers/hss/hss.vim b/syntax_checkers/hss/hss.vim index 62c53e128..bb9f22974 100644 --- a/syntax_checkers/hss/hss.vim +++ b/syntax_checkers/hss/hss.vim @@ -15,13 +15,8 @@ if exists("g:loaded_syntastic_hss_hss_checker") endif let g:loaded_syntastic_hss_hss_checker=1 -function! SyntaxCheckers_hss_hss_IsAvailable() - return executable('hss') -endfunction - function! SyntaxCheckers_hss_hss_GetLocList() dict let makeprg = syntastic#makeprg#build({ - \ 'exe': 'hss', \ 'args' : '-output ' . syntastic#util#DevNull(), \ 'checker': self }) diff --git a/syntax_checkers/html/tidy.vim b/syntax_checkers/html/tidy.vim index eb978694f..670252a72 100644 --- a/syntax_checkers/html/tidy.vim +++ b/syntax_checkers/html/tidy.vim @@ -42,10 +42,6 @@ if !exists('g:syntastic_html_tidy_empty_tags') let g:syntastic_html_tidy_empty_tags = [] endif -function! SyntaxCheckers_html_tidy_IsAvailable() - return executable('tidy') -endfunction - " TODO: join this with xhtml.vim for DRY's sake? function! s:TidyEncOptByFenc() let tidy_opts = { @@ -141,7 +137,6 @@ endfunction function! SyntaxCheckers_html_tidy_GetLocList() dict let makeprg = syntastic#makeprg#build({ - \ 'exe': 'tidy', \ 'args': s:Args(), \ 'tail': '2>&1', \ 'checker': self }) diff --git a/syntax_checkers/html/validator.vim b/syntax_checkers/html/validator.vim index 9883e0d4a..8b0c28b79 100644 --- a/syntax_checkers/html/validator.vim +++ b/syntax_checkers/html/validator.vim @@ -45,7 +45,7 @@ if !exists('g:syntastic_html_validator_nsfilter') let g:syntastic_html_validator_nsfilter = '' endif -function! SyntaxCheckers_html_validator_IsAvailable() +function! SyntaxCheckers_html_validator_IsAvailable() dict return executable('curl') endfunction diff --git a/syntax_checkers/html/w3.vim b/syntax_checkers/html/w3.vim index e1ebcfe1c..cde707684 100644 --- a/syntax_checkers/html/w3.vim +++ b/syntax_checkers/html/w3.vim @@ -26,7 +26,7 @@ if !exists('g:syntastic_html_w3_api') let g:syntastic_html_w3_api = 'http://validator.w3.org/check' endif -function! SyntaxCheckers_html_w3_IsAvailable() +function! SyntaxCheckers_html_w3_IsAvailable() dict return executable('curl') endfunction diff --git a/syntax_checkers/java/checkstyle.vim b/syntax_checkers/java/checkstyle.vim index b70db1fd4..c7a4c0268 100644 --- a/syntax_checkers/java/checkstyle.vim +++ b/syntax_checkers/java/checkstyle.vim @@ -23,10 +23,6 @@ if !exists("g:syntastic_java_checkstyle_conf_file") let g:syntastic_java_checkstyle_conf_file = 'sun_checks.xml' endif -function! SyntaxCheckers_java_checkstyle_IsAvailable() - return executable('java') -endfunction - function! SyntaxCheckers_java_checkstyle_Preprocess(errors) let out = copy(a:errors) for n in range(len(out)) @@ -48,7 +44,6 @@ function! SyntaxCheckers_java_checkstyle_GetLocList() dict endif 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 . \ ' -f xml', @@ -75,4 +70,5 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'java', - \ 'name': 'checkstyle'}) + \ 'name': 'checkstyle', + \ 'exec': 'java'}) diff --git a/syntax_checkers/java/javac.vim b/syntax_checkers/java/javac.vim index 784a17ceb..abf282fb6 100644 --- a/syntax_checkers/java/javac.vim +++ b/syntax_checkers/java/javac.vim @@ -161,7 +161,7 @@ function! s:GetMavenProperties() let pom = findfile("pom.xml", ".;") if s:has_maven && filereadable(pom) if !has_key(g:syntastic_java_javac_maven_pom_properties, pom) - let mvn_cmd = g:syntastic_java_maven_executable . ' -f ' . pom + let mvn_cmd = expand(g:syntastic_java_maven_executable) . ' -f ' . pom let mvn_is_managed_tag = 1 let mvn_settings_output = split(system(mvn_cmd . ' help:effective-pom'), "\n") let current_path = 'project' @@ -196,7 +196,7 @@ function! s:GetMavenClasspath() let pom = findfile("pom.xml", ".;") if s:has_maven && filereadable(pom) if !has_key(g:syntastic_java_javac_maven_pom_ftime, pom) || g:syntastic_java_javac_maven_pom_ftime[pom] != getftime(pom) - let mvn_cmd = g:syntastic_java_maven_executable . ' -f ' . pom + let mvn_cmd = expand(g:syntastic_java_maven_executable) . ' -f ' . pom let mvn_classpath_output = split(system(mvn_cmd . ' dependency:build-classpath'), "\n") let mvn_classpath = '' let class_path_next = 0 @@ -233,9 +233,9 @@ function! s:GetMavenClasspath() return '' endfunction -function! SyntaxCheckers_java_javac_IsAvailable() - let s:has_maven = executable(g:syntastic_java_maven_executable) - return executable(g:syntastic_java_javac_executable) +function! SyntaxCheckers_java_javac_IsAvailable() dict + let s:has_maven = executable(expand(g:syntastic_java_maven_executable)) + return executable(expand(g:syntastic_java_javac_executable)) endfunction function! s:MavenOutputDirectory() @@ -331,7 +331,6 @@ function! SyntaxCheckers_java_javac_GetLocList() dict endif let makeprg = syntastic#makeprg#build({ - \ 'exe': g:syntastic_java_javac_executable, \ 'args': javac_opts, \ 'fname': fname, \ 'tail': '2>&1', diff --git a/syntax_checkers/javascript/closurecompiler.vim b/syntax_checkers/javascript/closurecompiler.vim index 36c758f42..b39bf63b4 100644 --- a/syntax_checkers/javascript/closurecompiler.vim +++ b/syntax_checkers/javascript/closurecompiler.vim @@ -30,8 +30,8 @@ if !exists("g:syntastic_javascript_closure_compiler_options") let g:syntastic_javascript_closure_compiler_options = "" endif -function! SyntaxCheckers_javascript_closurecompiler_IsAvailable() - return exists("g:syntastic_javascript_closure_compiler_path") +function! SyntaxCheckers_javascript_closurecompiler_IsAvailable() dict + return executable("java") && exists("g:syntastic_javascript_closure_compiler_path") endfunction function! SyntaxCheckers_javascript_closurecompiler_GetLocList() dict @@ -61,5 +61,6 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'javascript', - \ 'name': 'closurecompiler'}) + \ 'name': 'closurecompiler', + \ 'exec': 'java'}) diff --git a/syntax_checkers/javascript/gjslint.vim b/syntax_checkers/javascript/gjslint.vim index 72e9ac511..0bfd2bf1f 100644 --- a/syntax_checkers/javascript/gjslint.vim +++ b/syntax_checkers/javascript/gjslint.vim @@ -17,13 +17,8 @@ if !exists("g:syntastic_javascript_gjslint_conf") let g:syntastic_javascript_gjslint_conf = "" endif -function! SyntaxCheckers_javascript_gjslint_IsAvailable() - return executable('gjslint') -endfunction - function! SyntaxCheckers_javascript_gjslint_GetLocList() dict let makeprg = syntastic#makeprg#build({ - \ 'exe': 'gjslint', \ 'args': g:syntastic_javascript_gjslint_conf . " --nosummary --unix_mode --nodebug_indentation --nobeep", \ 'checker': self }) diff --git a/syntax_checkers/javascript/jshint.vim b/syntax_checkers/javascript/jshint.vim index 528c27292..fd778c588 100644 --- a/syntax_checkers/javascript/jshint.vim +++ b/syntax_checkers/javascript/jshint.vim @@ -22,7 +22,7 @@ if !exists('g:syntastic_javascript_jshint_conf') let g:syntastic_javascript_jshint_conf = '' endif -function! SyntaxCheckers_javascript_jshint_IsAvailable() +function! SyntaxCheckers_javascript_jshint_IsAvailable() dict return executable(expand(g:syntastic_jshint_exec)) endfunction diff --git a/syntax_checkers/javascript/jsl.vim b/syntax_checkers/javascript/jsl.vim index 2da8e70b3..65931c0b3 100644 --- a/syntax_checkers/javascript/jsl.vim +++ b/syntax_checkers/javascript/jsl.vim @@ -17,22 +17,10 @@ if !exists("g:syntastic_javascript_jsl_conf") let g:syntastic_javascript_jsl_conf = "" endif -function! s:ConfFlag() - if !empty(g:syntastic_javascript_jsl_conf) - return "-conf " . g:syntastic_javascript_jsl_conf - endif - - return "" -endfunction - -function! SyntaxCheckers_javascript_jsl_IsAvailable() - return executable('jsl') -endfunction - function! SyntaxCheckers_javascript_jsl_GetLocList() dict let makeprg = syntastic#makeprg#build({ - \ 'exe': 'jsl', - \ 'args': s:ConfFlag() . " -nologo -nofilelisting -nosummary -nocontext -process", + \ 'args': (!empty(g:syntastic_javascript_jsl_conf) ? "-conf " . g:syntastic_javascript_jsl_conf : "") . + \ " -nologo -nofilelisting -nosummary -nocontext -process", \ 'checker': self }) let errorformat = diff --git a/syntax_checkers/javascript/jslint.vim b/syntax_checkers/javascript/jslint.vim index a3ef9a507..774291bd3 100644 --- a/syntax_checkers/javascript/jslint.vim +++ b/syntax_checkers/javascript/jslint.vim @@ -19,10 +19,6 @@ 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_jslint_IsAvailable() - return executable('jslint') -endfunction - function! SyntaxCheckers_javascript_jslint_HighlightTerm(error) let unexpected = matchstr(a:error['text'], '\mExpected.*and instead saw \'\zs.*\ze\'') if len(unexpected) < 1i @@ -33,7 +29,6 @@ endfunction function! SyntaxCheckers_javascript_jslint_GetLocList() dict let makeprg = syntastic#makeprg#build({ - \ 'exe': 'jslint', \ 'args': g:syntastic_javascript_jslint_conf, \ 'checker': self }) diff --git a/syntax_checkers/json/jsonlint.vim b/syntax_checkers/json/jsonlint.vim index 1b65c9e88..f6b4f6724 100644 --- a/syntax_checkers/json/jsonlint.vim +++ b/syntax_checkers/json/jsonlint.vim @@ -14,13 +14,8 @@ if exists("g:loaded_syntastic_json_jsonlint_checker") endif let g:loaded_syntastic_json_jsonlint_checker=1 -function! SyntaxCheckers_json_jsonlint_IsAvailable() - return executable('jsonlint') -endfunction - function! SyntaxCheckers_json_jsonlint_GetLocList() dict let makeprg = syntastic#makeprg#build({ - \ 'exe': 'jsonlint', \ 'post_args': '--compact', \ 'checker': self }) diff --git a/syntax_checkers/json/jsonval.vim b/syntax_checkers/json/jsonval.vim index 283649caf..afa5029ac 100644 --- a/syntax_checkers/json/jsonval.vim +++ b/syntax_checkers/json/jsonval.vim @@ -14,15 +14,9 @@ if exists("g:loaded_syntastic_json_jsonval_checker") endif let g:loaded_syntastic_json_jsonval_checker=1 -function! SyntaxCheckers_json_jsonval_IsAvailable() - return executable('jsonval') -endfunction - function! SyntaxCheckers_json_jsonval_GetLocList() dict " based on https://gist.github.com/1196345 - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'jsonval', - \ 'checker': self }) + let makeprg = syntastic#makeprg#build({ 'checker': self }) let errorformat = \ '%E%f:\ %m\ at\ line\ %l,' . diff --git a/syntax_checkers/less/lessc.vim b/syntax_checkers/less/lessc.vim index 73c85d6d4..8358d0780 100644 --- a/syntax_checkers/less/lessc.vim +++ b/syntax_checkers/less/lessc.vim @@ -36,8 +36,8 @@ else let s:check_file = 'lessc' endif -function! SyntaxCheckers_less_lessc_IsAvailable() - return executable('lessc') +function! SyntaxCheckers_less_lessc_IsAvailable() dict + return g:syntastic_less_use_less_lint ? executable('node') : executable('lessc') endfunction function! SyntaxCheckers_less_lessc_GetLocList() dict diff --git a/syntax_checkers/lisp/clisp.vim b/syntax_checkers/lisp/clisp.vim index ec9c2ce09..63855685c 100644 --- a/syntax_checkers/lisp/clisp.vim +++ b/syntax_checkers/lisp/clisp.vim @@ -14,15 +14,10 @@ if exists("g:loaded_syntastic_lisp_clisp_checker") endif let g:loaded_syntastic_lisp_clisp_checker=1 -function! SyntaxCheckers_lisp_clisp_IsAvailable() - return executable("clisp") -endfunction - function! SyntaxCheckers_lisp_clisp_GetLocList() dict let makeprg = syntastic#makeprg#build({ - \ 'exe': 'clisp', \ 'args': '-q -c', - \ 'tail': '-o /tmp/clisp-vim-compiled-file', + \ 'tail': syntastic#c#NullOutput(), \ 'checker': self }) let errorformat = diff --git a/syntax_checkers/llvm/llvm.vim b/syntax_checkers/llvm/llvm.vim index fe52df148..d84bf4379 100644 --- a/syntax_checkers/llvm/llvm.vim +++ b/syntax_checkers/llvm/llvm.vim @@ -14,13 +14,8 @@ if exists("g:loaded_syntastic_llvm_llvm_checker") endif let g:loaded_syntastic_llvm_llvm_checker=1 -function! SyntaxCheckers_llvm_llvm_IsAvailable() - return executable("llc") -endfunction - function! SyntaxCheckers_llvm_llvm_GetLocList() dict let makeprg = syntastic#makeprg#build({ - \ 'exe': 'llc', \ 'args': syntastic#c#NullOutput(), \ 'checker': self }) @@ -33,5 +28,6 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'llvm', - \ 'name': 'llvm'}) + \ 'name': 'llvm', + \ 'exec': 'llc'}) diff --git a/syntax_checkers/lua/luac.vim b/syntax_checkers/lua/luac.vim index 7ef19eed1..28741a6f9 100644 --- a/syntax_checkers/lua/luac.vim +++ b/syntax_checkers/lua/luac.vim @@ -15,10 +15,6 @@ if exists("g:loaded_syntastic_lua_luac_checker") endif let g:loaded_syntastic_lua_luac_checker=1 -function! SyntaxCheckers_lua_luac_IsAvailable() - return executable('luac') -endfunction - function! SyntaxCheckers_lua_luac_GetHighlightRegex(pos) let near = matchstr(a:pos['text'], "\\mnear '[^']\\+'") let result = '' @@ -42,10 +38,8 @@ function! SyntaxCheckers_lua_luac_GetHighlightRegex(pos) return result endfunction - function! SyntaxCheckers_lua_luac_GetLocList() dict let makeprg = syntastic#makeprg#build({ - \ 'exe': 'luac', \ 'args': '-p', \ 'checker': self }) @@ -55,7 +49,6 @@ function! SyntaxCheckers_lua_luac_GetLocList() dict \ 'makeprg': makeprg, \ 'errorformat': errorformat, \ 'defaults': { 'bufnr': bufnr(''), 'type': 'E' } }) - endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/syntax_checkers/matlab/mlint.vim b/syntax_checkers/matlab/mlint.vim index 82cb681e8..74aca1661 100644 --- a/syntax_checkers/matlab/mlint.vim +++ b/syntax_checkers/matlab/mlint.vim @@ -15,13 +15,8 @@ if exists("g:loaded_syntastic_matlab_mlint_checker") endif let g:loaded_syntastic_matlab_mlint_checker=1 -function! SyntaxCheckers_matlab_mlint_IsAvailable() - return executable("mlint") -endfunction - function! SyntaxCheckers_matlab_mlint_GetLocList() dict let makeprg = syntastic#makeprg#build({ - \ 'exe': 'mlint', \ 'args': '-id $*', \ 'checker': self }) diff --git a/syntax_checkers/nasm/nasm.vim b/syntax_checkers/nasm/nasm.vim index b986f5348..4ff244235 100644 --- a/syntax_checkers/nasm/nasm.vim +++ b/syntax_checkers/nasm/nasm.vim @@ -14,15 +14,12 @@ if exists("g:loaded_syntastic_nasm_nasm_checker") endif let g:loaded_syntastic_nasm_nasm_checker=1 -function! SyntaxCheckers_nasm_nasm_IsAvailable() - return executable("nasm") -endfunction - function! SyntaxCheckers_nasm_nasm_GetLocList() dict let wd = syntastic#util#shescape(expand("%:p:h") . "/") let makeprg = syntastic#makeprg#build({ - \ 'exe': 'nasm', - \ 'args': '-X gnu -f elf -I ' . wd . ' ' . syntastic#c#NullOutput(), + \ 'args': '-X gnu -f elf' . + \ ' -I ' . syntastic#util#shescape(expand("%:p:h") . "/") . + \ ' ' . syntastic#c#NullOutput(), \ 'checker': self }) let errorformat = '%f:%l: %t%*[^:]: %m' diff --git a/syntax_checkers/nroff/mandoc.vim b/syntax_checkers/nroff/mandoc.vim index d09c36262..eeafe8fb3 100644 --- a/syntax_checkers/nroff/mandoc.vim +++ b/syntax_checkers/nroff/mandoc.vim @@ -14,13 +14,8 @@ if exists("g:loaded_syntastic_nroff_mandoc_checker") endif let g:loaded_syntastic_nroff_mandoc_checker=1 -function! SyntaxCheckers_nroff_mandoc_IsAvailable() - return executable("mandoc") -endfunction - function! SyntaxCheckers_nroff_mandoc_GetLocList() dict let makeprg = syntastic#makeprg#build({ - \ 'exe': 'mandoc', \ 'args': '-Tlint', \ 'checker': self }) diff --git a/syntax_checkers/objc/gcc.vim b/syntax_checkers/objc/gcc.vim index 48b3d564c..d9f9e8057 100644 --- a/syntax_checkers/objc/gcc.vim +++ b/syntax_checkers/objc/gcc.vim @@ -19,8 +19,8 @@ if !exists('g:syntastic_objc_compiler') let g:syntastic_objc_compiler = 'gcc' endif -function! SyntaxCheckers_objc_gcc_IsAvailable() - return executable(g:syntastic_objc_compiler) +function! SyntaxCheckers_objc_gcc_IsAvailable() dict + return executable(expand(g:syntastic_objc_compiler)) endfunction let s:save_cpo = &cpo diff --git a/syntax_checkers/objcpp/gcc.vim b/syntax_checkers/objcpp/gcc.vim index 480dbebb0..968db1566 100644 --- a/syntax_checkers/objcpp/gcc.vim +++ b/syntax_checkers/objcpp/gcc.vim @@ -19,8 +19,8 @@ if !exists('g:syntastic_objcpp_compiler') let g:syntastic_objcpp_compiler = 'gcc' endif -function! SyntaxCheckers_objcpp_gcc_IsAvailable() - return executable(g:syntastic_objcpp_compiler) +function! SyntaxCheckers_objcpp_gcc_IsAvailable() dict + return executable(expand(g:syntastic_objcpp_compiler)) endfunction let s:save_cpo = &cpo diff --git a/syntax_checkers/ocaml/camlp4o.vim b/syntax_checkers/ocaml/camlp4o.vim index a2731cba0..d437b3b38 100644 --- a/syntax_checkers/ocaml/camlp4o.vim +++ b/syntax_checkers/ocaml/camlp4o.vim @@ -53,14 +53,13 @@ if exists("g:loaded_syntastic_ocaml_camlp4o_checker") endif let g:loaded_syntastic_ocaml_camlp4o_checker=1 -if exists('g:syntastic_ocaml_camlp4r') && - \ g:syntastic_ocaml_camlp4r != 0 +if exists('g:syntastic_ocaml_camlp4r') && g:syntastic_ocaml_camlp4r != 0 let s:ocamlpp="camlp4r" else let s:ocamlpp="camlp4o" endif -function! SyntaxCheckers_ocaml_camlp4o_IsAvailable() +function! SyntaxCheckers_ocaml_camlp4o_IsAvailable() dict return executable(s:ocamlpp) endfunction diff --git a/syntax_checkers/perl/perl.vim b/syntax_checkers/perl/perl.vim index 855ef34e2..61d9e076b 100644 --- a/syntax_checkers/perl/perl.vim +++ b/syntax_checkers/perl/perl.vim @@ -34,8 +34,8 @@ if !exists('g:syntastic_perl_lib_path') let g:syntastic_perl_lib_path = [] endif -function! SyntaxCheckers_perl_perl_IsAvailable() - return executable(g:syntastic_perl_interpreter) +function! SyntaxCheckers_perl_perl_IsAvailable() dict + return executable(expand(g:syntastic_perl_interpreter)) endfunction function! SyntaxCheckers_perl_perl_Preprocess(errors) @@ -52,6 +52,7 @@ function! SyntaxCheckers_perl_perl_Preprocess(errors) endfunction function! SyntaxCheckers_perl_perl_GetLocList() dict + let exe = expand(g:syntastic_perl_interpreter) if type(g:syntastic_perl_lib_path) == type('') call syntastic#util#deprecationWarn('variable g:syntastic_perl_lib_path should be a list') let includes = split(g:syntastic_perl_lib_path, ',') @@ -65,7 +66,7 @@ function! SyntaxCheckers_perl_perl_GetLocList() dict let errorformat = '%f:%l:%m' let makeprg = syntastic#makeprg#build({ - \ 'exe': g:syntastic_perl_interpreter, + \ 'exe': exe, \ 'args': '-c -X ' . extra, \ 'checker': self }) @@ -79,7 +80,7 @@ function! SyntaxCheckers_perl_perl_GetLocList() dict endif let makeprg = syntastic#makeprg#build({ - \ 'exe': g:syntastic_perl_interpreter, + \ 'exe': exe, \ 'args': '-c -Mwarnings ' . extra, \ 'checker': self }) diff --git a/syntax_checkers/perl/perlcritic.vim b/syntax_checkers/perl/perlcritic.vim index f64d44be6..5bdc2f315 100644 --- a/syntax_checkers/perl/perlcritic.vim +++ b/syntax_checkers/perl/perlcritic.vim @@ -33,13 +33,8 @@ if !exists('g:syntastic_perl_perlcritic_thres') let g:syntastic_perl_perlcritic_thres = 5 endif -function! SyntaxCheckers_perl_perlcritic_IsAvailable() - return executable('perlcritic') -endfunction - function! SyntaxCheckers_perl_perlcritic_GetLocList() dict let makeprg = syntastic#makeprg#build({ - \ 'exe': 'perlcritic', \ 'post_args': '--quiet --nocolor --verbose "\%s:\%f:\%l:\%c:(\%s) \%m (\%e)\n"', \ 'checker': self }) diff --git a/syntax_checkers/php/php.vim b/syntax_checkers/php/php.vim index a0fb65d9e..8110cc1dd 100644 --- a/syntax_checkers/php/php.vim +++ b/syntax_checkers/php/php.vim @@ -15,10 +15,6 @@ if exists("g:loaded_syntastic_php_php_checker") endif let g:loaded_syntastic_php_php_checker=1 -function! SyntaxCheckers_php_php_IsAvailable() - return executable("php") -endfunction - function! SyntaxCheckers_php_php_GetHighlightRegex(item) let unexpected = matchstr(a:item['text'], "\\munexpected '[^']\\+'") if len(unexpected) < 1 @@ -29,7 +25,6 @@ endfunction function! SyntaxCheckers_php_php_GetLocList() dict let makeprg = syntastic#makeprg#build({ - \ 'exe': 'php', \ 'args': '-l -d error_reporting=E_ALL -d display_errors=1 -d log_errors=0 -d xdebug.cli_color=0', \ 'checker': self }) diff --git a/syntax_checkers/php/phpcs.vim b/syntax_checkers/php/phpcs.vim index 2abdbf250..eb6560a6c 100644 --- a/syntax_checkers/php/phpcs.vim +++ b/syntax_checkers/php/phpcs.vim @@ -18,13 +18,8 @@ if exists("g:loaded_syntastic_php_phpcs_checker") endif let g:loaded_syntastic_php_phpcs_checker=1 -function! SyntaxCheckers_php_phpcs_IsAvailable() - return executable('phpcs') -endfunction - function! SyntaxCheckers_php_phpcs_GetLocList() dict let makeprg = syntastic#makeprg#build({ - \ 'exe': 'phpcs', \ 'args': '--report=csv', \ 'checker': self }) diff --git a/syntax_checkers/php/phpmd.vim b/syntax_checkers/php/phpmd.vim index 2dbcb563b..7a9c7a085 100644 --- a/syntax_checkers/php/phpmd.vim +++ b/syntax_checkers/php/phpmd.vim @@ -18,10 +18,6 @@ if exists("g:loaded_syntastic_php_phpmd_checker") endif let g:loaded_syntastic_php_phpmd_checker=1 -function! SyntaxCheckers_php_phpmd_IsAvailable() - return executable('phpmd') -endfunction - function! SyntaxCheckers_php_phpmd_GetHighlightRegex(item) let term = matchstr(a:item['text'], '\m\C^The \S\+ \w\+\(()\)\= \(has\|is not\|utilizes\)') if term != '' @@ -60,7 +56,6 @@ endfunction function! SyntaxCheckers_php_phpmd_GetLocList() dict let makeprg = syntastic#makeprg#build({ - \ 'exe': 'phpmd', \ 'post_args': 'text codesize,design,unusedcode,naming', \ 'checker': self }) diff --git a/syntax_checkers/pod/podchecker.vim b/syntax_checkers/pod/podchecker.vim index 66e6ddf86..d7e30c713 100644 --- a/syntax_checkers/pod/podchecker.vim +++ b/syntax_checkers/pod/podchecker.vim @@ -14,14 +14,8 @@ if exists("g:loaded_syntastic_pod_podchecker_checker") endif let g:loaded_syntastic_pod_podchecker_checker=1 -function! SyntaxCheckers_pod_podchecker_IsAvailable() - return executable("podchecker") -endfunction - function! SyntaxCheckers_pod_podchecker_GetLocList() dict - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'podchecker', - \ 'checker': self }) + let makeprg = syntastic#makeprg#build({ 'checker': self }) let errorformat = \ '%W%[%#]%[%#]%[%#] WARNING: %m at line %l in file %f,' . diff --git a/syntax_checkers/puppet/puppet.vim b/syntax_checkers/puppet/puppet.vim index f9019c098..cbb342ffd 100644 --- a/syntax_checkers/puppet/puppet.vim +++ b/syntax_checkers/puppet/puppet.vim @@ -15,13 +15,8 @@ if exists("g:loaded_syntastic_puppet_puppet_checker") endif let g:loaded_syntastic_puppet_puppet_checker=1 -function! SyntaxCheckers_puppet_puppet_IsAvailable() - return executable("puppet") -endfunction - function! SyntaxCheckers_puppet_puppet_GetLocList() dict - - let ver = syntastic#util#getVersion('puppet --version 2>' . syntastic#util#DevNull()) + let ver = syntastic#util#getVersion(self.getExec() . ' --version 2>' . syntastic#util#DevNull()) if syntastic#util#versionIsAtLeast(ver, [2,7,0]) let args = 'parser validate --color=false' @@ -30,7 +25,6 @@ function! SyntaxCheckers_puppet_puppet_GetLocList() dict endif let makeprg = syntastic#makeprg#build({ - \ 'exe': 'puppet', \ 'args': args, \ 'checker': self }) @@ -43,7 +37,6 @@ function! SyntaxCheckers_puppet_puppet_GetLocList() dict return SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat }) - endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/syntax_checkers/puppet/puppetlint.vim b/syntax_checkers/puppet/puppetlint.vim index b1db347a5..8cb6b5972 100644 --- a/syntax_checkers/puppet/puppetlint.vim +++ b/syntax_checkers/puppet/puppetlint.vim @@ -20,7 +20,7 @@ if exists("g:syntastic_puppet_lint_arguments") call syntastic#util#deprecationWarn("variable g:syntastic_puppet_lint_arguments is deprecated, please use g:syntastic_puppet_puppetlint_args instead") endif -function! SyntaxCheckers_puppet_puppetlint_IsAvailable() +function! SyntaxCheckers_puppet_puppetlint_IsAvailable() dict return \ executable("puppet") && \ executable("puppet-lint") && @@ -43,4 +43,5 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'puppet', - \ 'name': 'puppetlint'}) + \ 'name': 'puppetlint', + \ 'exec': 'puppet-lint'}) diff --git a/syntax_checkers/python/flake8.vim b/syntax_checkers/python/flake8.vim index 484e8fc43..a993b5662 100644 --- a/syntax_checkers/python/flake8.vim +++ b/syntax_checkers/python/flake8.vim @@ -10,10 +10,6 @@ if exists("g:loaded_syntastic_python_flake8_checker") endif let g:loaded_syntastic_python_flake8_checker=1 -function! SyntaxCheckers_python_flake8_IsAvailable() - return executable('flake8') -endfunction - function! SyntaxCheckers_python_flake8_GetHighlightRegex(i) return SyntaxCheckers_python_pyflakes_GetHighlightRegex(a:i) endfunction @@ -36,8 +32,8 @@ function! SyntaxCheckers_python_flake8_GetLocList() dict \ 'errorformat': errorformat }) endfunction +runtime! syntax_checkers/python/pyflakes.vim + call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'python', \ 'name': 'flake8'}) - -runtime! syntax_checkers/python/pyflakes.vim diff --git a/syntax_checkers/python/pep257.vim b/syntax_checkers/python/pep257.vim index 9b4b4912c..27a2dbca3 100644 --- a/syntax_checkers/python/pep257.vim +++ b/syntax_checkers/python/pep257.vim @@ -10,10 +10,6 @@ if exists("g:loaded_syntastic_python_pep257_checker") endif let g:loaded_syntastic_python_pep257_checker = 1 -function! SyntaxCheckers_python_pep257_IsAvailable() - return executable('pep257') -endfunction - " sanity: kill empty lines here rather than munging errorformat function! SyntaxCheckers_python_pep257_Preprocess(errors) return filter(copy(a:errors), 'v:val != ""') diff --git a/syntax_checkers/python/pep8.vim b/syntax_checkers/python/pep8.vim index b2b0f9863..b022ff645 100644 --- a/syntax_checkers/python/pep8.vim +++ b/syntax_checkers/python/pep8.vim @@ -17,10 +17,6 @@ if exists("g:loaded_syntastic_python_pep8_checker") endif let g:loaded_syntastic_python_pep8_checker=1 -function! SyntaxCheckers_python_pep8_IsAvailable() - return executable('pep8') -endfunction - function! SyntaxCheckers_python_pep8_GetLocList() dict let makeprg = syntastic#makeprg#build({ \ 'exe': 'pep8', diff --git a/syntax_checkers/python/py3kwarn.vim b/syntax_checkers/python/py3kwarn.vim index a97eac0b9..ece238aa4 100644 --- a/syntax_checkers/python/py3kwarn.vim +++ b/syntax_checkers/python/py3kwarn.vim @@ -9,10 +9,6 @@ if exists("g:loaded_syntastic_python_py3kwarn_checker") endif let g:loaded_syntastic_python_py3kwarn_checker=1 -function! SyntaxCheckers_python_py3kwarn_IsAvailable() - return executable('py3kwarn') -endfunction - function! SyntaxCheckers_python_py3kwarn_GetLocList() dict let makeprg = syntastic#makeprg#build({ \ 'exe': 'py3kwarn', diff --git a/syntax_checkers/python/pyflakes.vim b/syntax_checkers/python/pyflakes.vim index f572c1bdc..1773d1857 100644 --- a/syntax_checkers/python/pyflakes.vim +++ b/syntax_checkers/python/pyflakes.vim @@ -11,10 +11,6 @@ if exists("g:loaded_syntastic_python_pyflakes_checker") endif let g:loaded_syntastic_python_pyflakes_checker=1 -function! SyntaxCheckers_python_pyflakes_IsAvailable() - return executable('pyflakes') -endfunction - function! SyntaxCheckers_python_pyflakes_GetHighlightRegex(i) if match(a:i['text'], 'is assigned to but never used') > -1 \ || match(a:i['text'], 'imported but unused') > -1 diff --git a/syntax_checkers/python/pylama.vim b/syntax_checkers/python/pylama.vim index cb290e277..b49a4f2c6 100644 --- a/syntax_checkers/python/pylama.vim +++ b/syntax_checkers/python/pylama.vim @@ -14,10 +14,6 @@ if exists('g:loaded_syntastic_python_pylama_checker') endif let g:loaded_syntastic_python_pylama_checker = 1 -function! SyntaxCheckers_python_pylama_IsAvailable() - return executable('pylama') -endfunction - function! SyntaxCheckers_python_pylama_GetHighlightRegex(i) return SyntaxCheckers_python_pyflakes_GetHighlightRegex(a:i) endfunction @@ -59,8 +55,8 @@ function! SyntaxCheckers_python_pylama_GetLocList() dict return loclist endfunction +runtime! syntax_checkers/python/pyflakes.vim + call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'python', \ 'name': 'pylama' }) - -runtime! syntax_checkers/python/pyflakes.vim diff --git a/syntax_checkers/python/pylint.vim b/syntax_checkers/python/pylint.vim index cdbdccccb..a60c88d44 100644 --- a/syntax_checkers/python/pylint.vim +++ b/syntax_checkers/python/pylint.vim @@ -11,8 +11,9 @@ let g:loaded_syntastic_python_pylint_checker = 1 let s:pylint_new = -1 -function! SyntaxCheckers_python_pylint_IsAvailable() - let s:pylint_new = executable('pylint') ? s:PylintNew() : -1 +function! SyntaxCheckers_python_pylint_IsAvailable() dict + let exe = self.getExec() + let s:pylint_new = executable(exe) ? s:PylintNew(exe) : -1 return s:pylint_new >= 0 endfunction @@ -48,11 +49,11 @@ function! SyntaxCheckers_python_pylint_GetLocList() dict return loclist endfunction -function! s:PylintNew() +function! s:PylintNew(exe) try " On Windows the version is shown as "pylint-script.py 1.0.0". " On Gentoo Linux it's "pylint-python2.7 0.28.0". Oh, joy. :) - let pylint_version = filter(split(system('pylint --version'), '\m, \=\|\n'), 'v:val =~# ''\m^pylint\>''')[0] + let pylint_version = filter(split(system(a:exe . ' --version'), '\m, \=\|\n'), 'v:val =~# ''\m^pylint\>''')[0] let pylint_version = substitute(pylint_version, '\v^\S+\s+', '', '') let ret = syntastic#util#versionIsAtLeast(syntastic#util#parseVersion(pylint_version), [1]) catch /^Vim\%((\a\+)\)\=:E684/ diff --git a/syntax_checkers/python/python.vim b/syntax_checkers/python/python.vim index 94bce00ef..a891879c8 100644 --- a/syntax_checkers/python/python.vim +++ b/syntax_checkers/python/python.vim @@ -12,10 +12,6 @@ if exists("g:loaded_syntastic_python_python_checker") endif let g:loaded_syntastic_python_python_checker=1 -function! SyntaxCheckers_python_python_IsAvailable() - return executable('python') -endfunction - function! SyntaxCheckers_python_python_GetLocList() dict let fname = "'" . escape(expand('%'), "\\'") . "'" diff --git a/syntax_checkers/rst/rst2pseudoxml.vim b/syntax_checkers/rst/rst2pseudoxml.vim index a11cd602a..183778ba2 100644 --- a/syntax_checkers/rst/rst2pseudoxml.vim +++ b/syntax_checkers/rst/rst2pseudoxml.vim @@ -18,8 +18,8 @@ if exists("g:loaded_syntastic_rst_rst2pseudoxml_checker") endif let g:loaded_syntastic_rst_rst2pseudoxml_checker=1 -function! SyntaxCheckers_rst_rst2pseudoxml_IsAvailable() - return executable("rst2pseudoxml.py") || executable("rst2pseudoxml") +function! SyntaxCheckers_rst_rst2pseudoxml_IsAvailable() dict + return executable(s:exe()) endfunction function! SyntaxCheckers_rst_rst2pseudoxml_GetLocList() dict diff --git a/syntax_checkers/ruby/jruby.vim b/syntax_checkers/ruby/jruby.vim index 624d7d9c7..ba8059c37 100644 --- a/syntax_checkers/ruby/jruby.vim +++ b/syntax_checkers/ruby/jruby.vim @@ -14,10 +14,6 @@ if exists("g:loaded_syntastic_ruby_jruby_checker") endif let g:loaded_syntastic_ruby_jruby_checker=1 -function! SyntaxCheckers_ruby_jruby_IsAvailable() - return executable('jruby') -endfunction - function! SyntaxCheckers_ruby_jruby_GetLocList() dict let makeprg = syntastic#makeprg#build({ \ 'exe': s:exe(), diff --git a/syntax_checkers/ruby/macruby.vim b/syntax_checkers/ruby/macruby.vim index ebbd6e2c9..0d3a422a0 100644 --- a/syntax_checkers/ruby/macruby.vim +++ b/syntax_checkers/ruby/macruby.vim @@ -13,10 +13,6 @@ if exists("g:loaded_syntastic_ruby_macruby_checker") endif let g:loaded_syntastic_ruby_macruby_checker=1 -function! SyntaxCheckers_ruby_macruby_IsAvailable() - return executable('macruby') -endfunction - function! SyntaxCheckers_ruby_macruby_GetLocList() dict let makeprg = syntastic#makeprg#build({ \ 'exe': 'RUBYOPT= macruby', diff --git a/syntax_checkers/ruby/mri.vim b/syntax_checkers/ruby/mri.vim index 5a2f6d2f2..0a04d6784 100644 --- a/syntax_checkers/ruby/mri.vim +++ b/syntax_checkers/ruby/mri.vim @@ -19,10 +19,6 @@ if !exists("g:syntastic_ruby_exec") let g:syntastic_ruby_exec = "ruby" endif -function! SyntaxCheckers_ruby_mri_IsAvailable() - return executable(expand(g:syntastic_ruby_exec)) -endfunction - function! SyntaxCheckers_ruby_mri_GetHighlightRegex(i) if match(a:i['text'], 'assigned but unused variable') > -1 let term = split(a:i['text'], ' - ')[1] @@ -73,4 +69,5 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'ruby', - \ 'name': 'mri'}) + \ 'name': 'mri', + \ 'exec': 'ruby'}) diff --git a/syntax_checkers/ruby/rubocop.vim b/syntax_checkers/ruby/rubocop.vim index 13c162252..029b1358e 100644 --- a/syntax_checkers/ruby/rubocop.vim +++ b/syntax_checkers/ruby/rubocop.vim @@ -18,15 +18,15 @@ if exists("g:loaded_syntastic_ruby_rubocop_checker") endif let g:loaded_syntastic_ruby_rubocop_checker=1 -function! SyntaxCheckers_ruby_rubocop_IsAvailable() +function! SyntaxCheckers_ruby_rubocop_IsAvailable() dict + let exe = self.getExec() return - \ executable('rubocop') && - \ syntastic#util#versionIsAtLeast(syntastic#util#getVersion('rubocop --version'), [0,9,0]) + \ executable(exe) && + \ syntastic#util#versionIsAtLeast(syntastic#util#getVersion(exe . ' --version'), [0,9,0]) endfunction function! SyntaxCheckers_ruby_rubocop_GetLocList() dict let makeprg = syntastic#makeprg#build({ - \ 'exe': 'rubocop', \ 'args': '--format emacs --silent', \ 'checker': self }) diff --git a/syntax_checkers/ruby/rubylint.vim b/syntax_checkers/ruby/rubylint.vim index 62ceb305e..60bf7477b 100644 --- a/syntax_checkers/ruby/rubylint.vim +++ b/syntax_checkers/ruby/rubylint.vim @@ -16,13 +16,8 @@ endif let g:loaded_syntastic_ruby_rubylint_checker = 1 -function! SyntaxCheckers_ruby_rubylint_IsAvailable() - return executable("ruby-lint") -endfunction - function! SyntaxCheckers_ruby_rubylint_GetLocList() dict let makeprg = syntastic#makeprg#build({ - \ 'exe': 'ruby-lint', \ 'args': 'analyze --presenter=syntastic', \ 'checker': self }) @@ -35,6 +30,7 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'ruby', - \ 'name': 'rubylint' }) + \ 'name': 'rubylint', + \ 'exec': 'ruby-lint'}) " vim: set ts=4 sts=4 sw=4: diff --git a/syntax_checkers/rust/rustc.vim b/syntax_checkers/rust/rustc.vim index 526e94156..ed0d559e1 100644 --- a/syntax_checkers/rust/rustc.vim +++ b/syntax_checkers/rust/rustc.vim @@ -15,13 +15,8 @@ if exists("g:loaded_syntastic_rust_rustc_checker") endif let g:loaded_syntastic_rust_rustc_checker=1 -function! SyntaxCheckers_rust_rustc_IsAvailable() - return executable("rustc") -endfunction - function! SyntaxCheckers_rust_rustc_GetLocList() dict let makeprg = syntastic#makeprg#build({ - \ 'exe': 'rustc', \ 'args': '--parse-only', \ 'checker': self }) diff --git a/syntax_checkers/sass/sass.vim b/syntax_checkers/sass/sass.vim index 7c844124b..c685f2ae1 100644 --- a/syntax_checkers/sass/sass.vim +++ b/syntax_checkers/sass/sass.vim @@ -15,10 +15,6 @@ if exists("g:loaded_syntastic_sass_sass_checker") endif let g:loaded_syntastic_sass_sass_checker=1 -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 let s:sass_cache_location = tempname() @@ -40,7 +36,6 @@ function! SyntaxCheckers_sass_sass_GetLocList() dict endif let makeprg = syntastic#makeprg#build({ - \ 'exe': 'sass', \ 'args': '--cache-location ' . s:sass_cache_location . ' ' . s:imports . ' --check', \ 'checker': self }) diff --git a/syntax_checkers/scala/fsc.vim b/syntax_checkers/scala/fsc.vim index 30600739d..d13b205fb 100644 --- a/syntax_checkers/scala/fsc.vim +++ b/syntax_checkers/scala/fsc.vim @@ -15,10 +15,6 @@ if exists('g:loaded_syntastic_scala_fsc_checker') endif let g:loaded_syntastic_scala_fsc_checker = 1 -function! SyntaxCheckers_scala_fsc_IsAvailable() - return executable('fsc') -endfunction - if !exists('g:syntastic_scala_options') let g:syntastic_scala_options = '' endif @@ -28,7 +24,6 @@ function! SyntaxCheckers_scala_fsc_GetLocList() dict " working directory changing after being started " that's why we better pass an absolute path let makeprg = syntastic#makeprg#build({ - \ 'exe': 'fsc', \ 'args': '-Ystop-after:parser ' . g:syntastic_scala_options, \ 'fname': syntastic#util#shexpand('%:p'), \ 'checker': self }) diff --git a/syntax_checkers/scala/scalac.vim b/syntax_checkers/scala/scalac.vim index 6be0e55be..753abd765 100644 --- a/syntax_checkers/scala/scalac.vim +++ b/syntax_checkers/scala/scalac.vim @@ -15,18 +15,12 @@ if exists("g:loaded_syntastic_scala_scalac_checker") endif let g:loaded_syntastic_scala_scalac_checker=1 -function! SyntaxCheckers_scala_scalac_IsAvailable() - return executable("scalac") -endfunction - if !exists('g:syntastic_scala_options') let g:syntastic_scala_options = '' endif - function! SyntaxCheckers_scala_scalac_GetLocList() dict let makeprg = syntastic#makeprg#build({ - \ 'exe': 'scalac', \ 'args': '-Ystop-after:parser ' . g:syntastic_scala_options, \ 'checker': self }) diff --git a/syntax_checkers/sh/checkbashisms.vim b/syntax_checkers/sh/checkbashisms.vim index 2e300011a..ead049b8e 100644 --- a/syntax_checkers/sh/checkbashisms.vim +++ b/syntax_checkers/sh/checkbashisms.vim @@ -11,15 +11,8 @@ if exists("g:loaded_syntastic_sh_checkbashisms_checker") endif let g:loaded_syntastic_sh_checkbashisms_checker=1 - -function! SyntaxCheckers_sh_checkbashisms_IsAvailable() - return executable('checkbashisms') -endfunction - - function! SyntaxCheckers_sh_checkbashisms_GetLocList() dict let makeprg = syntastic#makeprg#build({ - \ 'exe': 'checkbashisms', \ 'args': '-fx', \ 'checker': self}) diff --git a/syntax_checkers/sh/sh.vim b/syntax_checkers/sh/sh.vim index 0d109a701..349534533 100644 --- a/syntax_checkers/sh/sh.vim +++ b/syntax_checkers/sh/sh.vim @@ -51,7 +51,7 @@ function! s:IsShellValid() endfunction -function! SyntaxCheckers_sh_sh_IsAvailable() +function! SyntaxCheckers_sh_sh_IsAvailable() dict return s:IsShellValid() endfunction diff --git a/syntax_checkers/sh/shellcheck.vim b/syntax_checkers/sh/shellcheck.vim index 6e73bb92a..4c65029fe 100644 --- a/syntax_checkers/sh/shellcheck.vim +++ b/syntax_checkers/sh/shellcheck.vim @@ -8,10 +8,6 @@ if exists("g:loaded_syntastic_sh_shellcheck_checker") endif let g:loaded_syntastic_sh_shellcheck_checker = 1 -function! SyntaxCheckers_sh_shellcheck_IsAvailable() - return executable('jsoncheck') -endfunction - function! SyntaxCheckers_sh_shellcheck_Preprocess(json) " A hat tip to Mark Weber for this trick " http://stackoverflow.com/a/19105763 @@ -22,7 +18,7 @@ function! SyntaxCheckers_sh_shellcheck_Preprocess(json) endfunction function! SyntaxCheckers_sh_shellcheck_GetLocList() - let makeprg = 'jsoncheck <' . syntastic#util#shexpand('%') + let makeprg = expand(self.getExec()) . ' < ' . syntastic#util#shexpand('%') let errorformat = '%t:%l:%v:%m' @@ -45,4 +41,5 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'sh', - \ 'name': 'shellcheck' }) + \ 'name': 'shellcheck', + \ 'exec': 'jsoncheck' }) diff --git a/syntax_checkers/slim/slimrb.vim b/syntax_checkers/slim/slimrb.vim index 8205e80c9..26291f628 100644 --- a/syntax_checkers/slim/slimrb.vim +++ b/syntax_checkers/slim/slimrb.vim @@ -15,10 +15,6 @@ if exists("g:loaded_syntastic_slim_slimrb_checker") endif let g:loaded_syntastic_slim_slimrb_checker=1 -function! SyntaxCheckers_slim_slimrb_IsAvailable() - return executable("slimrb") -endfunction - function! s:SlimrbVersion() if !exists('s:slimrb_version') let s:slimrb_version = syntastic#util#getVersion('slimrb --version 2>' . syntastic#util#DevNull()) @@ -28,7 +24,6 @@ endfunction function! SyntaxCheckers_slim_slimrb_GetLocList() dict let makeprg = syntastic#makeprg#build({ - \ 'exe': 'slimrb', \ 'args': '-c', \ 'checker': self }) diff --git a/syntax_checkers/tcl/nagelfar.vim b/syntax_checkers/tcl/nagelfar.vim index da48e25fb..4bbd164cd 100644 --- a/syntax_checkers/tcl/nagelfar.vim +++ b/syntax_checkers/tcl/nagelfar.vim @@ -16,13 +16,8 @@ if exists("g:loaded_syntastic_tcl_nagelfar_checker") endif let g:loaded_syntastic_tcl_nagelfar_checker=1 -function! SyntaxCheckers_tcl_nagelfar_IsAvailable() - return executable('nagelfar') -endfunction - function! SyntaxCheckers_tcl_nagelfar_GetLocList() dict let makeprg = syntastic#makeprg#build({ - \ 'exe': 'nagelfar', \ 'args': '-H', \ 'checker': self }) diff --git a/syntax_checkers/tex/chktex.vim b/syntax_checkers/tex/chktex.vim index 046edc908..ff61cad7a 100644 --- a/syntax_checkers/tex/chktex.vim +++ b/syntax_checkers/tex/chktex.vim @@ -32,13 +32,8 @@ if !exists('g:syntastic_tex_chktex_showmsgs') let g:syntastic_tex_chktex_showmsgs = 1 endif -function! SyntaxCheckers_tex_chktex_IsAvailable() - return executable('chktex') -endfunction - function! SyntaxCheckers_tex_chktex_GetLocList() dict let makeprg = syntastic#makeprg#build({ - \ 'exe': 'chktex', \ 'post_args': '-q -v1', \ 'checker': self }) diff --git a/syntax_checkers/tex/lacheck.vim b/syntax_checkers/tex/lacheck.vim index c4bcf8e62..38b395c2a 100644 --- a/syntax_checkers/tex/lacheck.vim +++ b/syntax_checkers/tex/lacheck.vim @@ -15,14 +15,8 @@ if exists('g:loaded_syntastic_tex_lacheck_checker') endif let g:loaded_syntastic_tex_lacheck_checker=1 -function! SyntaxCheckers_tex_lacheck_IsAvailable() - return executable('lacheck') -endfunction - function! SyntaxCheckers_tex_lacheck_GetLocList() dict - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'lacheck', - \ 'checker': self }) + let makeprg = syntastic#makeprg#build({ 'checker': self }) let errorformat = \ '%-G** %f:,' . diff --git a/syntax_checkers/text/atdtool.vim b/syntax_checkers/text/atdtool.vim index cfce9c57c..b2b025a5e 100644 --- a/syntax_checkers/text/atdtool.vim +++ b/syntax_checkers/text/atdtool.vim @@ -15,10 +15,6 @@ if exists("g:loaded_syntastic_text_atdtool_checker") endif let g:loaded_syntastic_text_atdtool_checker = 1 -function! SyntaxCheckers_text_atdtool_IsAvailable() - return executable('atdtool') -endfunction - function! SyntaxCheckers_text_atdtool_GetHighlightRegex(item) let term = matchstr(a:item['text'], '\m "\zs[^"]\+\ze"\($\| | suggestions:\)') if term != '' @@ -30,7 +26,6 @@ endfunction function! SyntaxCheckers_text_atdtool_GetLocList() dict let makeprg = syntastic#makeprg#build({ - \ 'exe': 'atdtool', \ 'tail': '2>' . syntastic#util#DevNull(), \ 'checker': self }) diff --git a/syntax_checkers/twig/twiglint.vim b/syntax_checkers/twig/twiglint.vim index 5be896f2e..5574f17fc 100644 --- a/syntax_checkers/twig/twiglint.vim +++ b/syntax_checkers/twig/twiglint.vim @@ -20,13 +20,8 @@ function! SyntaxCheckers_twig_twiglint_GetHighlightRegex(item) return '\V' endfunction -function! SyntaxCheckers_twig_twiglint_IsAvailable() - return executable('twig-lint') -endfunction - function! SyntaxCheckers_twig_twiglint_GetLocList() dict let makeprg = syntastic#makeprg#build({ - \ 'exe': 'twig-lint', \ 'args': 'lint --format=csv', \ 'checker': self }) @@ -39,4 +34,5 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'twig', - \ 'name': 'twiglint'}) + \ 'name': 'twiglint', + \ 'exec': 'twig-lint'}) diff --git a/syntax_checkers/typescript/tsc.vim b/syntax_checkers/typescript/tsc.vim index 9abf44b01..10b812017 100644 --- a/syntax_checkers/typescript/tsc.vim +++ b/syntax_checkers/typescript/tsc.vim @@ -9,14 +9,8 @@ if exists("g:loaded_syntastic_typescript_tsc_checker") endif let g:loaded_syntastic_typescript_tsc_checker=1 -function! SyntaxCheckers_typescript_tsc_IsAvailable() - return executable("tsc") -endfunction - - function! SyntaxCheckers_typescript_tsc_GetLocList() dict let makeprg = syntastic#makeprg#build({ - \ 'exe': 'tsc', \ 'args': '--module commonjs', \ 'post_args': '--out ' . syntastic#util#DevNull(), \ 'checker': self }) diff --git a/syntax_checkers/vala/valac.vim b/syntax_checkers/vala/valac.vim index 736719526..06b2d1156 100644 --- a/syntax_checkers/vala/valac.vim +++ b/syntax_checkers/vala/valac.vim @@ -27,10 +27,6 @@ if exists("g:loaded_syntastic_vala_valac_checker") endif let g:loaded_syntastic_vala_valac_checker = 1 -function! SyntaxCheckers_vala_valac_IsAvailable() - return executable('valac') -endfunction - function! SyntaxCheckers_vala_valac_GetHighlightRegex(pos) let strlength = strlen(matchstr(a:pos['text'], '\m\^\+$')) return '\%>' . (a:pos.col-1) . 'c.*\%<' . (a:pos.col+strlength+1) . 'c' @@ -55,9 +51,9 @@ endfunction function! SyntaxCheckers_vala_valac_GetLocList() dict let vala_pkg_args = join(map(s:GetValaModules(), '"--pkg ".v:val'), ' ') let makeprg = syntastic#makeprg#build({ - \ 'exe': 'valac', \ 'args': '-C ' . vala_pkg_args, \ 'checker': self }) + let errorformat = \ '%A%f:%l.%c-%\d%\+.%\d%\+: %t%[a-z]%\+: %m,'. \ '%C%m,'. diff --git a/syntax_checkers/verilog/verilator.vim b/syntax_checkers/verilog/verilator.vim index 1b1d630fc..14d2d3dd9 100644 --- a/syntax_checkers/verilog/verilator.vim +++ b/syntax_checkers/verilog/verilator.vim @@ -16,8 +16,8 @@ endif let s:save_cpo = &cpo set cpo&vim -function! SyntaxCheckers_verilog_verilator_IsAvailable() - return executable(g:syntastic_verilog_compiler) +function! SyntaxCheckers_verilog_verilator_IsAvailable() dict + return executable(expand(g:syntastic_verilog_compiler)) endfunction if !exists('g:syntastic_verilog_compiler_options') diff --git a/syntax_checkers/vhdl/ghdl.vim b/syntax_checkers/vhdl/ghdl.vim index 2dccac453..34cb5fd19 100644 --- a/syntax_checkers/vhdl/ghdl.vim +++ b/syntax_checkers/vhdl/ghdl.vim @@ -14,13 +14,8 @@ if exists("g:loaded_syntastic_vhdl_ghdl_checker") endif let g:loaded_syntastic_vhdl_ghdl_checker = 1 -function! SyntaxCheckers_vhdl_ghdl_IsAvailable() - return executable("ghdl") -endfunction - function! SyntaxCheckers_vhdl_ghdl_GetLocList() dict let makeprg = syntastic#makeprg#build({ - \ 'exe': 'ghdl', \ 'args': '-s', \ 'checker': self }) diff --git a/syntax_checkers/xhtml/tidy.vim b/syntax_checkers/xhtml/tidy.vim index 2c949c372..ea0873a8e 100644 --- a/syntax_checkers/xhtml/tidy.vim +++ b/syntax_checkers/xhtml/tidy.vim @@ -24,10 +24,6 @@ if !exists('g:syntastic_xhtml_tidy_ignore_errors') let g:syntastic_xhtml_tidy_ignore_errors = [] endif -function! SyntaxCheckers_xhtml_tidy_IsAvailable() - return executable("tidy") -endfunction - " TODO: join this with html.vim DRY's sake? function! s:TidyEncOptByFenc() let tidy_opts = { @@ -59,7 +55,6 @@ endfunction function! SyntaxCheckers_xhtml_tidy_GetLocList() dict let encopt = s:TidyEncOptByFenc() let makeprg = syntastic#makeprg#build({ - \ 'exe': 'tidy', \ 'args': encopt . ' -xml -e', \ 'checker': self }) diff --git a/syntax_checkers/xml/xmllint.vim b/syntax_checkers/xml/xmllint.vim index 869fab05f..5e8b7d8f2 100644 --- a/syntax_checkers/xml/xmllint.vim +++ b/syntax_checkers/xml/xmllint.vim @@ -19,13 +19,8 @@ let g:loaded_syntastic_xml_xmllint_checker=1 " and allow you to validate XML data without network access, see xmlcatalog(1) " and http://www.xmlsoft.org/catalog.html for more information. -function! SyntaxCheckers_xml_xmllint_IsAvailable() - return executable('xmllint') -endfunction - function! SyntaxCheckers_xml_xmllint_GetLocList() dict let makeprg = syntastic#makeprg#build({ - \ 'exe': 'xmllint', \ 'args': '--xinclude --noout --postvalid', \ 'checker': self }) diff --git a/syntax_checkers/yaml/jsyaml.vim b/syntax_checkers/yaml/jsyaml.vim index d70327ced..b8734142a 100644 --- a/syntax_checkers/yaml/jsyaml.vim +++ b/syntax_checkers/yaml/jsyaml.vim @@ -18,13 +18,8 @@ if exists("g:loaded_syntastic_yaml_jsyaml_checker") endif let g:loaded_syntastic_yaml_jsyaml_checker=1 -function! SyntaxCheckers_yaml_jsyaml_IsAvailable() - return executable("js-yaml") -endfunction - function! SyntaxCheckers_yaml_jsyaml_GetLocList() dict let makeprg = syntastic#makeprg#build({ - \ 'exe': 'js-yaml', \ 'args': '--compact', \ 'checker': self }) @@ -38,4 +33,5 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'yaml', - \ 'name': 'jsyaml'}) + \ 'name': 'jsyaml', + \ 'exec': 'js-yaml'}) diff --git a/syntax_checkers/z80/z80syntaxchecker.vim b/syntax_checkers/z80/z80syntaxchecker.vim index 3913643e3..a265b004e 100644 --- a/syntax_checkers/z80/z80syntaxchecker.vim +++ b/syntax_checkers/z80/z80syntaxchecker.vim @@ -9,24 +9,20 @@ " See http://sam.zoy.org/wtfpl/COPYING for more details. " "============================================================================ +" +" 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 exists("g:loaded_syntastic_z80_z80syntaxchecker_checker") finish endif let g:loaded_syntastic_z80_z80syntaxchecker_checker=1 -"bail if the user doesnt have z80_syntax_checker.py installed -"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 -function! SyntaxCheckers_z80_z80syntaxchecker_IsAvailable() - return executable("z80_syntax_checker.py") -endfunction - function! SyntaxCheckers_z80_z80syntaxchecker_GetLocList() dict - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'z80_syntax_checker.py', - \ 'checker': self }) + let makeprg = syntastic#makeprg#build({ 'checker': self }) let errorformat = '%f:%l %m' @@ -37,4 +33,5 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'z80', - \ 'name': 'z80syntaxchecker'}) + \ 'name': 'z80syntaxchecker', + \ 'exec': 'z80_syntax_checker.py'}) diff --git a/syntax_checkers/zpt/zptlint.vim b/syntax_checkers/zpt/zptlint.vim index accda1777..1b3491fa4 100644 --- a/syntax_checkers/zpt/zptlint.vim +++ b/syntax_checkers/zpt/zptlint.vim @@ -9,12 +9,7 @@ " See http://sam.zoy.org/wtfpl/COPYING for more details. " "============================================================================ - -if exists("g:loaded_syntastic_zpt_zptlint_checker") - finish -endif -let g:loaded_syntastic_zpt_zptlint_checker=1 - +" " In order for this plugin to be useful, you will need to set up the " zpt filetype in your vimrc " @@ -24,14 +19,13 @@ let g:loaded_syntastic_zpt_zptlint_checker=1 " Then install the zptlint program, found on pypi: " http://pypi.python.org/pypi/zptlint -function! SyntaxCheckers_zpt_zptlint_IsAvailable() - return executable("zptlint") -endfunction +if exists("g:loaded_syntastic_zpt_zptlint_checker") + finish +endif +let g:loaded_syntastic_zpt_zptlint_checker=1 function! SyntaxCheckers_zpt_zptlint_GetLocList() dict - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'zptlint', - \ 'checker': self }) + let makeprg = syntastic#makeprg#build({ 'checker': self }) let errorformat= \ '%-P*** Error in: %f,'. diff --git a/syntax_checkers/zsh/zsh.vim b/syntax_checkers/zsh/zsh.vim index da830894c..34ef792a1 100644 --- a/syntax_checkers/zsh/zsh.vim +++ b/syntax_checkers/zsh/zsh.vim @@ -15,13 +15,8 @@ if exists("g:loaded_syntastic_zsh_zsh_checker") endif let g:loaded_syntastic_zsh_zsh_checker=1 -function! SyntaxCheckers_zsh_zsh_IsAvailable() - return executable("zsh") -endfunction - function! SyntaxCheckers_zsh_zsh_GetLocList() dict let makeprg = syntastic#makeprg#build({ - \ 'exe': 'zsh', \ 'args': '-n', \ 'checker': self }) From c7d80182bfe1752f80f520cff6c859ecff8bd0de Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 1 Nov 2013 11:51:47 +0200 Subject: [PATCH 0236/1271] Registry cleanup, stage 3. Make syntastic#makeprg#build() a dictionary function. Remove the mandatory checker argument to syntastic#makeprg#build(). --- autoload/syntastic/makeprg.vim | 49 ------------------- plugin/syntastic/checker.vim | 17 +++++++ syntax_checkers/applescript/osacompile.vim | 5 +- syntax_checkers/asciidoc/asciidoc.vim | 4 +- syntax_checkers/c/checkpatch.vim | 5 +- syntax_checkers/c/oclint.vim | 5 +- syntax_checkers/c/sparse.vim | 5 +- syntax_checkers/c/splint.vim | 5 +- syntax_checkers/chef/foodcritic.vim | 2 +- syntax_checkers/co/coco.vim | 4 +- syntax_checkers/coffee/coffee.vim | 4 +- syntax_checkers/coffee/coffeelint.vim | 4 +- syntax_checkers/coq/coqtop.vim | 4 +- syntax_checkers/cpp/cpplint.vim | 2 +- syntax_checkers/cs/mcs.vim | 4 +- syntax_checkers/css/csslint.vim | 4 +- syntax_checkers/css/prettycss.vim | 2 +- syntax_checkers/cucumber/cucumber.vim | 4 +- syntax_checkers/dart/dart_analyzer.vim | 5 +- syntax_checkers/dustjs/swiffer.vim | 2 +- syntax_checkers/elixir/elixir.vim | 4 +- syntax_checkers/erlang/escript.vim | 5 +- syntax_checkers/go/go.vim | 5 +- syntax_checkers/go/gofmt.vim | 5 +- syntax_checkers/go/golint.vim | 2 +- syntax_checkers/haml/haml.vim | 5 +- syntax_checkers/handlebars/handlebars.vim | 4 +- syntax_checkers/haskell/ghc-mod.vim | 4 +- syntax_checkers/haskell/hdevtools.vim | 5 +- syntax_checkers/haskell/hlint.vim | 2 +- syntax_checkers/haxe/haxe.vim | 5 +- syntax_checkers/hss/hss.vim | 4 +- syntax_checkers/html/tidy.vim | 5 +- syntax_checkers/java/checkstyle.vim | 5 +- syntax_checkers/java/javac.vim | 5 +- .../javascript/closurecompiler.vim | 5 +- syntax_checkers/javascript/gjslint.vim | 5 +- syntax_checkers/javascript/jshint.vim | 5 +- syntax_checkers/javascript/jsl.vim | 5 +- syntax_checkers/javascript/jslint.vim | 4 +- syntax_checkers/json/jsonlint.vim | 4 +- syntax_checkers/json/jsonval.vim | 2 +- syntax_checkers/less/lessc.vim | 5 +- syntax_checkers/lisp/clisp.vim | 5 +- syntax_checkers/llvm/llvm.vim | 4 +- syntax_checkers/lua/luac.vim | 4 +- syntax_checkers/matlab/mlint.vim | 4 +- syntax_checkers/nasm/nasm.vim | 5 +- syntax_checkers/nroff/mandoc.vim | 4 +- syntax_checkers/perl/perl.vim | 10 ++-- syntax_checkers/perl/perlcritic.vim | 5 +- syntax_checkers/php/php.vim | 5 +- syntax_checkers/php/phpcs.vim | 4 +- syntax_checkers/php/phpmd.vim | 4 +- syntax_checkers/pod/podchecker.vim | 2 +- syntax_checkers/puppet/puppet.vim | 4 +- syntax_checkers/puppet/puppetlint.vim | 5 +- syntax_checkers/python/flake8.vim | 4 +- syntax_checkers/python/pep257.vim | 4 +- syntax_checkers/python/pep8.vim | 4 +- syntax_checkers/python/py3kwarn.vim | 4 +- syntax_checkers/python/pyflakes.vim | 4 +- syntax_checkers/python/pylama.vim | 5 +- syntax_checkers/python/pylint.vim | 6 +-- syntax_checkers/python/python.vim | 6 +-- syntax_checkers/rst/rst2pseudoxml.vim | 5 +- syntax_checkers/ruby/jruby.vim | 5 +- syntax_checkers/ruby/macruby.vim | 7 ++- syntax_checkers/ruby/mri.vim | 5 +- syntax_checkers/ruby/rubocop.vim | 4 +- syntax_checkers/ruby/rubylint.vim | 4 +- syntax_checkers/rust/rustc.vim | 4 +- syntax_checkers/sass/sass.vim | 5 +- syntax_checkers/scala/fsc.vim | 5 +- syntax_checkers/scala/scalac.vim | 5 +- syntax_checkers/sh/checkbashisms.vim | 4 +- syntax_checkers/sh/sh.vim | 5 +- syntax_checkers/slim/slimrb.vim | 4 +- syntax_checkers/tcl/nagelfar.vim | 4 +- syntax_checkers/tex/chktex.vim | 4 +- syntax_checkers/tex/lacheck.vim | 2 +- syntax_checkers/text/atdtool.vim | 4 +- syntax_checkers/twig/twiglint.vim | 4 +- syntax_checkers/typescript/tsc.vim | 5 +- syntax_checkers/vala/valac.vim | 4 +- syntax_checkers/vhdl/ghdl.vim | 4 +- syntax_checkers/xhtml/tidy.vim | 4 +- syntax_checkers/xml/xmllint.vim | 4 +- syntax_checkers/yaml/jsyaml.vim | 4 +- syntax_checkers/z80/z80syntaxchecker.vim | 2 +- syntax_checkers/zpt/zptlint.vim | 2 +- syntax_checkers/zsh/zsh.vim | 4 +- 92 files changed, 146 insertions(+), 305 deletions(-) delete mode 100644 autoload/syntastic/makeprg.vim diff --git a/autoload/syntastic/makeprg.vim b/autoload/syntastic/makeprg.vim deleted file mode 100644 index f80258dbb..000000000 --- a/autoload/syntastic/makeprg.vim +++ /dev/null @@ -1,49 +0,0 @@ -if exists("g:loaded_syntastic_makeprg_autoload") - finish -endif -let g:loaded_syntastic_makeprg_autoload = 1 - -"Returns a makeprg of the form -" -"[exe] [args] [filename] [post_args] [tail] -" -"A (made up) example: -" ruby -a -b -c test_file.rb --more --args > /tmp/output -" -"To generate this you would call: -" -" let makeprg = syntastic#makeprg#build({ -" \ 'exe': 'ruby', -" \ 'args': '-a -b -c', -" \ 'post_args': '--more --args', -" \ 'tail': '> /tmp/output', -" \ 'filetype': 'ruby', -" \ 'subchecker': 'mri' }) -" -"Note that the current filename is added by default - but can be overridden by -"passing in an 'fname' arg. -" -"Arguments 'filetype' and 'subchecker' are mandatory, handling of composite -"types and user-defined variables breaks if you omit them. -" -"All other options can be overriden by the user with global variables - even -"when not specified by the checker in syntastic#makeprg#build(). -" -"E.g. They could override the checker exe with -" -" let g:syntastic_ruby_mri_exe="another_ruby_checker_exe.rb" -" -"The general form of the override option is: -" syntastic_[filetype]_[subchecker]_[option-name] -" -function! syntastic#makeprg#build(opts) - let builder = g:SyntasticMakeprgBuilder.New( - \ get(a:opts, 'checker', {}), - \ get(a:opts, 'exe', ''), - \ get(a:opts, 'args', ''), - \ get(a:opts, 'fname', ''), - \ get(a:opts, 'post_args', ''), - \ get(a:opts, 'tail', '') ) - - return builder.makeprg() -endfunction diff --git a/plugin/syntastic/checker.vim b/plugin/syntastic/checker.vim index 88d1d53f4..c0f20c1d2 100644 --- a/plugin/syntastic/checker.vim +++ b/plugin/syntastic/checker.vim @@ -13,6 +13,7 @@ function! g:SyntasticChecker.New(args) let newObj._filetype = a:args['filetype'] let newObj._name = a:args['name'] let newObj._exec = get(a:args, 'exec', newObj._name) + let newObj._makeprgFunc = function('SyntasticCheckerMakeprgBuild') if has_key(a:args, 'redirect') let [filetype, name] = split(a:args['redirect'], '/') @@ -78,6 +79,10 @@ function! g:SyntasticChecker.getHighlightRegexFor(error) return self._highlightRegexFunc(error) endfunction +function! g:SyntasticChecker.makeprgBuild(opts) + return self._makeprgFunc(a:opts) +endfunction + function! g:SyntasticChecker.isAvailable() return self._isAvailableFunc() endfunction @@ -104,4 +109,16 @@ function! SyntasticCheckerIsAvailableDefault() dict return executable(self.getExec()) endfunction +function! SyntasticCheckerMakeprgBuild(opts) dict + let builder = g:SyntasticMakeprgBuilder.New( + \ get(a:opts, 'checker', self), + \ get(a:opts, 'exe', ''), + \ get(a:opts, 'args', ''), + \ get(a:opts, 'fname', ''), + \ get(a:opts, 'post_args', ''), + \ get(a:opts, 'tail', '') ) + + return builder.makeprg() +endfunction + " vim: set sw=4 sts=4 et fdm=marker: diff --git a/syntax_checkers/applescript/osacompile.vim b/syntax_checkers/applescript/osacompile.vim index 0119133ae..bf10d7221 100644 --- a/syntax_checkers/applescript/osacompile.vim +++ b/syntax_checkers/applescript/osacompile.vim @@ -31,11 +31,8 @@ endif let g:loaded_syntastic_applescript_osacompile_checker=1 function! SyntaxCheckers_applescript_osacompile_GetLocList() dict - let makeprg = syntastic#makeprg#build({ - \ 'args': '-o ' . tempname() . '.scpt ', - \ 'checker': self }) + let makeprg = self.makeprgBuild({ 'args': '-o ' . tempname() . '.scpt' }) let errorformat = '%f:%l:%m' - return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) endfunction diff --git a/syntax_checkers/asciidoc/asciidoc.vim b/syntax_checkers/asciidoc/asciidoc.vim index adc7b127e..41bd6c282 100644 --- a/syntax_checkers/asciidoc/asciidoc.vim +++ b/syntax_checkers/asciidoc/asciidoc.vim @@ -16,9 +16,7 @@ endif let g:loaded_syntastic_asciidoc_asciidoc_checker = 1 function! SyntaxCheckers_asciidoc_asciidoc_GetLocList() dict - let makeprg = syntastic#makeprg#build({ - \ 'args': syntastic#c#NullOutput(), - \ 'checker': self }) + let makeprg = self.makeprgBuild({ 'args': syntastic#c#NullOutput() }) let errorformat = \ '%Easciidoc: %tRROR: %f: line %l: %m,' . diff --git a/syntax_checkers/c/checkpatch.vim b/syntax_checkers/c/checkpatch.vim index 6434b39e4..f9a137ca7 100644 --- a/syntax_checkers/c/checkpatch.vim +++ b/syntax_checkers/c/checkpatch.vim @@ -25,10 +25,9 @@ function! SyntaxCheckers_c_checkpatch_IsAvailable() dict endfunction function! SyntaxCheckers_c_checkpatch_GetLocList() dict - let makeprg = syntastic#makeprg#build({ + let makeprg = self.makeprgBuild({ \ 'exe': g:syntastic_c_checker_checkpatch_location, - \ 'args': '--no-summary --no-tree --terse --file', - \ 'checker': self }) + \ 'args': '--no-summary --no-tree --terse --file' }) let errorformat = \ '%f:%l: %tARNING: %m,' . diff --git a/syntax_checkers/c/oclint.vim b/syntax_checkers/c/oclint.vim index 9c1d708e2..83a4747af 100644 --- a/syntax_checkers/c/oclint.vim +++ b/syntax_checkers/c/oclint.vim @@ -26,10 +26,9 @@ if !exists('g:syntastic_oclint_config_file') endif function! SyntaxCheckers_c_oclint_GetLocList() dict - let makeprg = syntastic#makeprg#build({ + let makeprg = self.makeprgBuild({ \ 'args': '-text', - \ 'post_args': '-- -c ' . syntastic#c#ReadConfig(g:syntastic_oclint_config_file), - \ 'checker': self }) + \ 'post_args': '-- -c ' . syntastic#c#ReadConfig(g:syntastic_oclint_config_file) }) let errorformat = \ '%E%f:%l:%c: %m P1 ,' . diff --git a/syntax_checkers/c/sparse.vim b/syntax_checkers/c/sparse.vim index 9c9491e5c..11d5dfbb5 100644 --- a/syntax_checkers/c/sparse.vim +++ b/syntax_checkers/c/sparse.vim @@ -26,9 +26,8 @@ if !exists('g:syntastic_sparse_config_file') endif function! SyntaxCheckers_c_sparse_GetLocList() dict - let makeprg = syntastic#makeprg#build({ - \ 'args': '-ftabstop=' . &ts . ' ' . syntastic#c#ReadConfig(g:syntastic_sparse_config_file), - \ 'checker': self }) + let makeprg = self.makeprgBuild({ + \ 'args': '-ftabstop=' . &ts . ' ' . syntastic#c#ReadConfig(g:syntastic_sparse_config_file) }) let errorformat = '%f:%l:%v: %trror: %m,%f:%l:%v: %tarning: %m,' diff --git a/syntax_checkers/c/splint.vim b/syntax_checkers/c/splint.vim index 590555b0d..4b55e5e5e 100644 --- a/syntax_checkers/c/splint.vim +++ b/syntax_checkers/c/splint.vim @@ -26,9 +26,8 @@ if !exists('g:syntastic_splint_config_file') endif function! SyntaxCheckers_c_splint_GetLocList() dict - let makeprg = syntastic#makeprg#build({ - \ 'post_args': '-showfunc -hints +quiet ' . syntastic#c#ReadConfig(g:syntastic_splint_config_file), - \ 'checker': self }) + let makeprg = self.makeprgBuild({ + \ 'post_args': '-showfunc -hints +quiet ' . syntastic#c#ReadConfig(g:syntastic_splint_config_file) }) let errorformat = \ '%-G%f:%l:%v: %[%#]%[%#]%[%#] Internal Bug %.%#,' . diff --git a/syntax_checkers/chef/foodcritic.vim b/syntax_checkers/chef/foodcritic.vim index 42d1cda70..8fec3236e 100644 --- a/syntax_checkers/chef/foodcritic.vim +++ b/syntax_checkers/chef/foodcritic.vim @@ -16,7 +16,7 @@ endif let g:loaded_syntastic_chef_foodcritic_checker=1 function! SyntaxCheckers_chef_foodcritic_GetLocList() dict - let makeprg = syntastic#makeprg#build({ 'checker': self }) + let makeprg = self.makeprgBuild({}) " FC023: Prefer conditional attributes: ./recipes/config.rb:49 let errorformat = 'FC%n: %m: %f:%l' diff --git a/syntax_checkers/co/coco.vim b/syntax_checkers/co/coco.vim index f22e4e56e..95977be14 100644 --- a/syntax_checkers/co/coco.vim +++ b/syntax_checkers/co/coco.vim @@ -20,9 +20,7 @@ if !executable("coco") endif function! SyntaxCheckers_co_coco_GetLocList() dict - let makeprg = syntastic#makeprg#build({ - \ 'args': '-c -o /tmp', - \ 'checker': self }) + let makeprg = self.makeprgBuild({ 'args': '-c -o /tmp' }) let errorformat = \ '%EFailed at: %f,' . diff --git a/syntax_checkers/coffee/coffee.vim b/syntax_checkers/coffee/coffee.vim index 44435e233..b1ae906ee 100644 --- a/syntax_checkers/coffee/coffee.vim +++ b/syntax_checkers/coffee/coffee.vim @@ -24,9 +24,7 @@ function! SyntaxCheckers_coffee_coffee_IsAvailable() dict endfunction function! SyntaxCheckers_coffee_coffee_GetLocList() dict - let makeprg = syntastic#makeprg#build({ - \ 'args': '-cp', - \ 'checker': self }) + let makeprg = self.makeprgBuild({ 'args': '-cp' }) let errorformat = \ '%E%f:%l:%c: %trror: %m,' . diff --git a/syntax_checkers/coffee/coffeelint.vim b/syntax_checkers/coffee/coffeelint.vim index 1fbf5943a..40eb189ec 100644 --- a/syntax_checkers/coffee/coffeelint.vim +++ b/syntax_checkers/coffee/coffeelint.vim @@ -15,9 +15,7 @@ endif let g:loaded_syntastic_coffee_coffeelint_checker=1 function! SyntaxCheckers_coffee_coffeelint_GetLocList() dict - let makeprg = syntastic#makeprg#build({ - \ 'args': '--csv', - \ 'checker': self }) + let makeprg = self.makeprgBuild({ 'args': '--csv' }) let errorformat = \ '%f\,%l\,%\d%#\,%trror\,%m,' . diff --git a/syntax_checkers/coq/coqtop.vim b/syntax_checkers/coq/coqtop.vim index 5a1f2bd3e..cb3597ffe 100644 --- a/syntax_checkers/coq/coqtop.vim +++ b/syntax_checkers/coq/coqtop.vim @@ -16,9 +16,7 @@ endif let g:loaded_syntastic_coq_coqtop_checker=1 function! SyntaxCheckers_coq_coqtop_GetLocList() dict - let makeprg = syntastic#makeprg#build({ - \ 'args': '-noglob -batch -load-vernac-source', - \ 'checker': self }) + let makeprg = self.makeprgBuild({ 'args': '-noglob -batch -load-vernac-source' }) let errorformat = \ '%AFile \"%f\"\, line %l\, characters %c\-%.%#\:,'. diff --git a/syntax_checkers/cpp/cpplint.vim b/syntax_checkers/cpp/cpplint.vim index a3c01d93e..bb8efa972 100644 --- a/syntax_checkers/cpp/cpplint.vim +++ b/syntax_checkers/cpp/cpplint.vim @@ -36,7 +36,7 @@ if ! exists('g:syntastic_cpp_cpplint_args') endif function! SyntaxCheckers_cpp_cpplint_GetLocList() dict - let makeprg = syntastic#makeprg#build({ 'checker': self }) + let makeprg = self.makeprgBuild({}) let errorformat = '%A%f:%l: %m [%t],%-G%.%#' diff --git a/syntax_checkers/cs/mcs.vim b/syntax_checkers/cs/mcs.vim index 79129e1cd..50947c2dc 100644 --- a/syntax_checkers/cs/mcs.vim +++ b/syntax_checkers/cs/mcs.vim @@ -16,9 +16,7 @@ endif let g:loaded_syntastic_cs_mcs_checker=1 function! SyntaxCheckers_cs_mcs_GetLocList() dict - let makeprg = syntastic#makeprg#build({ - \ 'args': '--parse', - \ 'checker': self }) + let makeprg = self.makeprgBuild({ 'args': '--parse' }) let errorformat = '%f(%l\,%c): %trror %m' diff --git a/syntax_checkers/css/csslint.vim b/syntax_checkers/css/csslint.vim index 8ef976823..401001e25 100644 --- a/syntax_checkers/css/csslint.vim +++ b/syntax_checkers/css/csslint.vim @@ -24,9 +24,7 @@ if !exists('g:syntastic_csslint_options') endif function! SyntaxCheckers_css_csslint_GetLocList() dict - let makeprg = syntastic#makeprg#build({ - \ 'args': '--format=compact ' . g:syntastic_csslint_options, - \ 'checker': self }) + let makeprg = self.makeprgBuild({ 'args': '--format=compact ' . g:syntastic_csslint_options }) " Print CSS Lint's error/warning messages from compact format. Ignores blank lines. let errorformat = diff --git a/syntax_checkers/css/prettycss.vim b/syntax_checkers/css/prettycss.vim index c1e410177..90f69ed61 100644 --- a/syntax_checkers/css/prettycss.vim +++ b/syntax_checkers/css/prettycss.vim @@ -29,7 +29,7 @@ function! SyntaxCheckers_css_prettycss_GetHighlightRegex(item) endfunction function! SyntaxCheckers_css_prettycss_GetLocList() dict - let makeprg = syntastic#makeprg#build({ 'checker': self }) + let makeprg = self.makeprgBuild({}) " Print CSS Lint's error/warning messages from compact format. Ignores blank lines. let errorformat = diff --git a/syntax_checkers/cucumber/cucumber.vim b/syntax_checkers/cucumber/cucumber.vim index c499b3155..cc40e0cfe 100644 --- a/syntax_checkers/cucumber/cucumber.vim +++ b/syntax_checkers/cucumber/cucumber.vim @@ -16,9 +16,7 @@ endif let g:loaded_syntastic_cucumber_cucumber_checker=1 function! SyntaxCheckers_cucumber_cucumber_GetLocList() dict - let makeprg = syntastic#makeprg#build({ - \ 'args': '--dry-run --quiet --strict --format pretty', - \ 'checker': self }) + let makeprg = self.makeprgBuild({ 'args': '--dry-run --quiet --strict --format pretty' }) let errorformat = \ '%f:%l:%c:%m,' . diff --git a/syntax_checkers/dart/dart_analyzer.vim b/syntax_checkers/dart/dart_analyzer.vim index 8b6897648..c12f35754 100644 --- a/syntax_checkers/dart/dart_analyzer.vim +++ b/syntax_checkers/dart/dart_analyzer.vim @@ -25,10 +25,9 @@ function! SyntaxCheckers_dart_dart_analyzer_GetHighlightRegex(error) endfunction function! SyntaxCheckers_dart_dart_analyzer_GetLocList() dict - let makeprg = syntastic#makeprg#build({ + let makeprg = self.makeprgBuild({ \ 'args': '--error_format machine', - \ 'post_args': g:syntastic_dart_analyzer_conf, - \ 'checker': self }) + \ 'post_args': g:syntastic_dart_analyzer_conf }) " Machine readable format looks like: " SEVERITY|TYPE|ERROR_CODE|file:FILENAME|LINE_NUMBER|COLUMN|LENGTH|MESSAGE diff --git a/syntax_checkers/dustjs/swiffer.vim b/syntax_checkers/dustjs/swiffer.vim index b53f9f5fe..27cec0e0f 100644 --- a/syntax_checkers/dustjs/swiffer.vim +++ b/syntax_checkers/dustjs/swiffer.vim @@ -20,7 +20,7 @@ function! SyntaxCheckers_dustjs_swiffer_IsAvailable() dict endfunction function! SyntaxCheckers_dustjs_swiffer_GetLocList() dict - let makeprg = syntastic#makeprg#build({ 'checker': self }) + let makeprg = self.makeprgBuild({}) let errorformat = '%E%f - Line %l\, Column %c: %m' diff --git a/syntax_checkers/elixir/elixir.vim b/syntax_checkers/elixir/elixir.vim index e2660351c..f4746a648 100644 --- a/syntax_checkers/elixir/elixir.vim +++ b/syntax_checkers/elixir/elixir.vim @@ -30,9 +30,7 @@ function! SyntaxCheckers_elixir_elixir_GetLocList() dict let make_options['cwd'] = fnamemodify(mix_file, ':p:h') endif - let make_options['makeprg'] = syntastic#makeprg#build({ - \ 'exe': compile_command, - \ 'checker': self }) + let make_options['makeprg'] = self.makeprgBuild({ 'exe': compile_command }) let make_options['errorformat'] = '** %*[^\ ] %f:%l: %m' diff --git a/syntax_checkers/erlang/escript.vim b/syntax_checkers/erlang/escript.vim index bd9014a6d..ba6d0b169 100644 --- a/syntax_checkers/erlang/escript.vim +++ b/syntax_checkers/erlang/escript.vim @@ -34,11 +34,10 @@ function! SyntaxCheckers_erlang_escript_GetLocList() dict let args = s:check_file let post_args = g:syntastic_erlc_include_path endif - let makeprg = syntastic#makeprg#build({ + let makeprg = self.makeprgBuild({ \ 'args': args, \ 'fname': syntastic#util#shexpand('%:p'), - \ 'post_args': post_args, - \ 'checker': self }) + \ 'post_args': post_args }) let errorformat = \ '%W%f:%l: warning: %m,'. diff --git a/syntax_checkers/go/go.vim b/syntax_checkers/go/go.vim index 752c53693..4875d1c43 100644 --- a/syntax_checkers/go/go.vim +++ b/syntax_checkers/go/go.vim @@ -25,11 +25,10 @@ function! SyntaxCheckers_go_go_GetLocList() dict " 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. - let makeprg = syntastic#makeprg#build({ + let makeprg = self.makeprgBuild({ \ 'exe': 'gofmt', \ 'args': '-l', - \ 'tail': '1>' . syntastic#util#DevNull(), - \ 'checker': self }) + \ 'tail': '> ' . syntastic#util#DevNull() }) let errorformat = \ '%f:%l:%c: %m,' . diff --git a/syntax_checkers/go/gofmt.vim b/syntax_checkers/go/gofmt.vim index a9db2259c..bf85e2f25 100644 --- a/syntax_checkers/go/gofmt.vim +++ b/syntax_checkers/go/gofmt.vim @@ -18,10 +18,9 @@ endif let g:loaded_syntastic_go_gofmt_checker=1 function! SyntaxCheckers_go_gofmt_GetLocList() dict - let makeprg = syntastic#makeprg#build({ + let makeprg = self.makeprgBuild({ \ 'args': '-l', - \ 'tail': '1>' . syntastic#util#DevNull(), - \ 'checker': self }) + \ 'tail': '> ' . syntastic#util#DevNull() }) let errorformat = '%f:%l:%c: %m,%-G%.%#' diff --git a/syntax_checkers/go/golint.vim b/syntax_checkers/go/golint.vim index 72c7c6a68..852357bc8 100644 --- a/syntax_checkers/go/golint.vim +++ b/syntax_checkers/go/golint.vim @@ -15,7 +15,7 @@ endif let g:loaded_syntastic_go_golint_checker=1 function! SyntaxCheckers_go_golint_GetLocList() dict - let makeprg = syntastic#makeprg#build({ 'checker': self }) + let makeprg = self.makeprgBuild({}) let errorformat = '%f:%l:%c: %m,%-G%.%#' diff --git a/syntax_checkers/haml/haml.vim b/syntax_checkers/haml/haml.vim index d2dcf166e..750f0657d 100644 --- a/syntax_checkers/haml/haml.vim +++ b/syntax_checkers/haml/haml.vim @@ -24,10 +24,9 @@ function! SyntaxCheckers_haml_haml_IsAvailable() dict endfunction function! SyntaxCheckers_haml_haml_GetLocList() dict - let makeprg = syntastic#makeprg#build({ + let makeprg = self.makeprgBuild({ \ 'exe': expand(g:syntastic_haml_interpreter), - \ 'args': '-c', - \ 'checker': self }) + \ 'args': '-c' }) let errorformat = \ 'Haml error on line %l: %m,' . diff --git a/syntax_checkers/handlebars/handlebars.vim b/syntax_checkers/handlebars/handlebars.vim index 07fd6dfa0..d6f37307b 100644 --- a/syntax_checkers/handlebars/handlebars.vim +++ b/syntax_checkers/handlebars/handlebars.vim @@ -14,9 +14,7 @@ endif let g:loaded_syntastic_handlebars_handlebars_checker=1 function! SyntaxCheckers_handlebars_handlebars_GetLocList() dict - let makeprg = syntastic#makeprg#build({ - \ 'args': '-f ' . syntastic#util#DevNull(), - \ 'checker': self }) + let makeprg = self.makeprgBuild({ 'args': '-f ' . syntastic#util#DevNull() }) let errorformat = \ '%EError: %m on line %l:,'. diff --git a/syntax_checkers/haskell/ghc-mod.vim b/syntax_checkers/haskell/ghc-mod.vim index 0c3d01408..29a3182f1 100644 --- a/syntax_checkers/haskell/ghc-mod.vim +++ b/syntax_checkers/haskell/ghc-mod.vim @@ -16,9 +16,7 @@ endif let g:loaded_syntastic_haskell_ghc_mod_checker = 1 function! SyntaxCheckers_haskell_ghc_mod_GetLocList() dict - let makeprg = syntastic#makeprg#build({ - \ 'exe': self.getExec() . ' check', - \ 'checker': self }) + let makeprg = self.makeprgBuild({ 'exe': self.getExec() . ' check' }) let errorformat = \ '%-G%\s%#,' . diff --git a/syntax_checkers/haskell/hdevtools.vim b/syntax_checkers/haskell/hdevtools.vim index f7be91380..4987a7a2d 100644 --- a/syntax_checkers/haskell/hdevtools.vim +++ b/syntax_checkers/haskell/hdevtools.vim @@ -16,10 +16,9 @@ endif let g:loaded_syntastic_haskell_hdevtools_checker=1 function! SyntaxCheckers_haskell_hdevtools_GetLocList() dict - let makeprg = syntastic#makeprg#build({ + let makeprg = self.makeprgBuild({ \ 'exe': self.getExec() . ' check', - \ 'args': get(g:, 'hdevtools_options', ''), - \ 'checker': self }) + \ 'args': get(g:, 'hdevtools_options', '') }) let errorformat= '\%-Z\ %#,'. \ '%W%f:%l:%c:\ Warning:\ %m,'. diff --git a/syntax_checkers/haskell/hlint.vim b/syntax_checkers/haskell/hlint.vim index fb8f0a470..2fd2ef88a 100644 --- a/syntax_checkers/haskell/hlint.vim +++ b/syntax_checkers/haskell/hlint.vim @@ -11,7 +11,7 @@ endif let g:loaded_syntastic_haskell_hlint_checker = 1 function! SyntaxCheckers_haskell_hlint_GetLocList() dict - let makeprg = syntastic#makeprg#build({ 'checker': self }) + let makeprg = self.makeprgBuild({}) let errorformat = \ '%E%f:%l:%c: Error: %m,' . diff --git a/syntax_checkers/haxe/haxe.vim b/syntax_checkers/haxe/haxe.vim index f3d0a813b..c6b9c3e6a 100644 --- a/syntax_checkers/haxe/haxe.vim +++ b/syntax_checkers/haxe/haxe.vim @@ -26,9 +26,8 @@ function! SyntaxCheckers_haxe_haxe_GetLocList() dict let hxml = fnamemodify(hxml, ':p') if !empty(hxml) - let makeprg = syntastic#makeprg#build({ - \ 'fname': syntastic#util#shescape(fnameescape(fnamemodify(hxml, ':t'))), - \ 'checker': self }) + let makeprg = self.makeprgBuild({ + \ 'fname': syntastic#util#shescape(fnameescape(fnamemodify(hxml, ':t'))) }) let errorformat = '%E%f:%l: characters %c-%*[0-9] : %m' diff --git a/syntax_checkers/hss/hss.vim b/syntax_checkers/hss/hss.vim index bb9f22974..34fa332a7 100644 --- a/syntax_checkers/hss/hss.vim +++ b/syntax_checkers/hss/hss.vim @@ -16,9 +16,7 @@ endif let g:loaded_syntastic_hss_hss_checker=1 function! SyntaxCheckers_hss_hss_GetLocList() dict - let makeprg = syntastic#makeprg#build({ - \ 'args' : '-output ' . syntastic#util#DevNull(), - \ 'checker': self }) + let makeprg = self.makeprgBuild({ 'args' : '-output ' . syntastic#util#DevNull() }) let errorformat = '%E%f:%l: %m' diff --git a/syntax_checkers/html/tidy.vim b/syntax_checkers/html/tidy.vim index 670252a72..747b4c37a 100644 --- a/syntax_checkers/html/tidy.vim +++ b/syntax_checkers/html/tidy.vim @@ -136,10 +136,9 @@ function! s:Args() endfunction function! SyntaxCheckers_html_tidy_GetLocList() dict - let makeprg = syntastic#makeprg#build({ + let makeprg = self.makeprgBuild({ \ 'args': s:Args(), - \ 'tail': '2>&1', - \ 'checker': self }) + \ 'tail': '2>&1' }) let errorformat = \ '%Wline %l column %v - Warning: %m,' . diff --git a/syntax_checkers/java/checkstyle.vim b/syntax_checkers/java/checkstyle.vim index c7a4c0268..541d31587 100644 --- a/syntax_checkers/java/checkstyle.vim +++ b/syntax_checkers/java/checkstyle.vim @@ -43,12 +43,11 @@ function! SyntaxCheckers_java_checkstyle_GetLocList() dict let fname = substitute(system('cygpath -m ' . fname), '\m\%x00', '', 'g') endif - let makeprg = syntastic#makeprg#build({ + let makeprg = self.makeprgBuild({ \ 'args': '-cp ' . g:syntastic_java_checkstyle_classpath . \ ' com.puppycrawl.tools.checkstyle.Main -c ' . g:syntastic_java_checkstyle_conf_file . \ ' -f xml', - \ 'fname': fname, - \ 'checker': self }) + \ 'fname': fname }) let errorformat = \ '%P,' . diff --git a/syntax_checkers/java/javac.vim b/syntax_checkers/java/javac.vim index abf282fb6..5fdae9ddb 100644 --- a/syntax_checkers/java/javac.vim +++ b/syntax_checkers/java/javac.vim @@ -330,11 +330,10 @@ function! SyntaxCheckers_java_javac_GetLocList() dict let fname = s:CygwinPath(fname) endif - let makeprg = syntastic#makeprg#build({ + let makeprg = self.makeprgBuild({ \ 'args': javac_opts, \ 'fname': fname, - \ 'tail': '2>&1', - \ 'checker': self }) + \ 'tail': '2>&1' }) " unashamedly stolen from *errorformat-javac* (quickfix.txt) and modified to include error types let errorformat = diff --git a/syntax_checkers/javascript/closurecompiler.vim b/syntax_checkers/javascript/closurecompiler.vim index b39bf63b4..fcc0e620f 100644 --- a/syntax_checkers/javascript/closurecompiler.vim +++ b/syntax_checkers/javascript/closurecompiler.vim @@ -41,11 +41,10 @@ function! SyntaxCheckers_javascript_closurecompiler_GetLocList() dict let file_list = syntastic#util#shexpand('%') endif - let makeprg = syntastic#makeprg#build({ + let makeprg = self.makeprgBuild({ \ 'exe': 'java -jar ' . g:syntastic_javascript_closure_compiler_path, \ 'args': g:syntastic_javascript_closure_compiler_options . ' --js' , - \ 'fname': file_list, - \ 'checker': self }) + \ 'fname': file_list }) let errorformat = \ '%-GOK,'. diff --git a/syntax_checkers/javascript/gjslint.vim b/syntax_checkers/javascript/gjslint.vim index 0bfd2bf1f..b1c7ee619 100644 --- a/syntax_checkers/javascript/gjslint.vim +++ b/syntax_checkers/javascript/gjslint.vim @@ -18,9 +18,8 @@ if !exists("g:syntastic_javascript_gjslint_conf") endif function! SyntaxCheckers_javascript_gjslint_GetLocList() dict - let makeprg = syntastic#makeprg#build({ - \ 'args': g:syntastic_javascript_gjslint_conf . " --nosummary --unix_mode --nodebug_indentation --nobeep", - \ 'checker': self }) + let makeprg = self.makeprgBuild({ + \ 'args': g:syntastic_javascript_gjslint_conf . " --nosummary --unix_mode --nodebug_indentation --nobeep" }) let errorformat = \ "%f:%l:(New Error -%\\?\%n) %m," . diff --git a/syntax_checkers/javascript/jshint.vim b/syntax_checkers/javascript/jshint.vim index fd778c588..b92733425 100644 --- a/syntax_checkers/javascript/jshint.vim +++ b/syntax_checkers/javascript/jshint.vim @@ -28,10 +28,9 @@ endfunction function! SyntaxCheckers_javascript_jshint_GetLocList() dict let jshint_new = s:JshintNew() - let makeprg = syntastic#makeprg#build({ + let makeprg = self.makeprgBuild({ \ 'exe': expand(g:syntastic_jshint_exec), - \ 'post_args': (jshint_new ? ' --verbose ' : '') . s:Args(), - \ 'checker': self }) + \ 'post_args': (jshint_new ? ' --verbose ' : '') . s:Args() }) let errorformat = jshint_new ? \ '%f: line %l\, col %c\, %m \(%t%*\d\)' : diff --git a/syntax_checkers/javascript/jsl.vim b/syntax_checkers/javascript/jsl.vim index 65931c0b3..dc90ad915 100644 --- a/syntax_checkers/javascript/jsl.vim +++ b/syntax_checkers/javascript/jsl.vim @@ -18,10 +18,9 @@ if !exists("g:syntastic_javascript_jsl_conf") endif function! SyntaxCheckers_javascript_jsl_GetLocList() dict - let makeprg = syntastic#makeprg#build({ + let makeprg = self.makeprgBuild({ \ 'args': (!empty(g:syntastic_javascript_jsl_conf) ? "-conf " . g:syntastic_javascript_jsl_conf : "") . - \ " -nologo -nofilelisting -nosummary -nocontext -process", - \ 'checker': self }) + \ " -nologo -nofilelisting -nosummary -nocontext -process" }) let errorformat = \ '%W%f(%l): lint warning: %m,'. diff --git a/syntax_checkers/javascript/jslint.vim b/syntax_checkers/javascript/jslint.vim index 774291bd3..c1f631bea 100644 --- a/syntax_checkers/javascript/jslint.vim +++ b/syntax_checkers/javascript/jslint.vim @@ -28,9 +28,7 @@ function! SyntaxCheckers_javascript_jslint_HighlightTerm(error) endfunction function! SyntaxCheckers_javascript_jslint_GetLocList() dict - let makeprg = syntastic#makeprg#build({ - \ 'args': g:syntastic_javascript_jslint_conf, - \ 'checker': self }) + let makeprg = self.makeprgBuild({ 'args': g:syntastic_javascript_jslint_conf }) let errorformat = \ '%E %##%n %m,'. diff --git a/syntax_checkers/json/jsonlint.vim b/syntax_checkers/json/jsonlint.vim index f6b4f6724..cd0d3dfc1 100644 --- a/syntax_checkers/json/jsonlint.vim +++ b/syntax_checkers/json/jsonlint.vim @@ -15,9 +15,7 @@ endif let g:loaded_syntastic_json_jsonlint_checker=1 function! SyntaxCheckers_json_jsonlint_GetLocList() dict - let makeprg = syntastic#makeprg#build({ - \ 'post_args': '--compact', - \ 'checker': self }) + let makeprg = self.makeprgBuild({ 'post_args': '--compact' }) let errorformat = \ '%ELine %l:%c,'. diff --git a/syntax_checkers/json/jsonval.vim b/syntax_checkers/json/jsonval.vim index afa5029ac..924a363e9 100644 --- a/syntax_checkers/json/jsonval.vim +++ b/syntax_checkers/json/jsonval.vim @@ -16,7 +16,7 @@ let g:loaded_syntastic_json_jsonval_checker=1 function! SyntaxCheckers_json_jsonval_GetLocList() dict " based on https://gist.github.com/1196345 - let makeprg = syntastic#makeprg#build({ 'checker': self }) + let makeprg = self.makeprgBuild({}) let errorformat = \ '%E%f:\ %m\ at\ line\ %l,' . diff --git a/syntax_checkers/less/lessc.vim b/syntax_checkers/less/lessc.vim index 8358d0780..e1cf123e1 100644 --- a/syntax_checkers/less/lessc.vim +++ b/syntax_checkers/less/lessc.vim @@ -41,11 +41,10 @@ function! SyntaxCheckers_less_lessc_IsAvailable() dict endfunction function! SyntaxCheckers_less_lessc_GetLocList() dict - let makeprg = syntastic#makeprg#build({ + let makeprg = self.makeprgBuild({ \ 'exe': s:check_file, \ 'args': g:syntastic_less_options, - \ 'tail': syntastic#util#DevNull(), - \ 'checker': self }) + \ 'tail': syntastic#util#DevNull() }) let errorformat = '%m in %f:%l:%c' diff --git a/syntax_checkers/lisp/clisp.vim b/syntax_checkers/lisp/clisp.vim index 63855685c..6bef1e97b 100644 --- a/syntax_checkers/lisp/clisp.vim +++ b/syntax_checkers/lisp/clisp.vim @@ -15,10 +15,9 @@ endif let g:loaded_syntastic_lisp_clisp_checker=1 function! SyntaxCheckers_lisp_clisp_GetLocList() dict - let makeprg = syntastic#makeprg#build({ + let makeprg = self.makeprgBuild({ \ 'args': '-q -c', - \ 'tail': syntastic#c#NullOutput(), - \ 'checker': self }) + \ 'tail': syntastic#c#NullOutput() }) let errorformat = \ '%-G;%.%#,' . diff --git a/syntax_checkers/llvm/llvm.vim b/syntax_checkers/llvm/llvm.vim index d84bf4379..cd5a5b457 100644 --- a/syntax_checkers/llvm/llvm.vim +++ b/syntax_checkers/llvm/llvm.vim @@ -15,9 +15,7 @@ endif let g:loaded_syntastic_llvm_llvm_checker=1 function! SyntaxCheckers_llvm_llvm_GetLocList() dict - let makeprg = syntastic#makeprg#build({ - \ 'args': syntastic#c#NullOutput(), - \ 'checker': self }) + let makeprg = self.makeprgBuild({ 'args': syntastic#c#NullOutput() }) let errorformat = 'llc: %f:%l:%c: %trror: %m' diff --git a/syntax_checkers/lua/luac.vim b/syntax_checkers/lua/luac.vim index 28741a6f9..10c4d1b78 100644 --- a/syntax_checkers/lua/luac.vim +++ b/syntax_checkers/lua/luac.vim @@ -39,9 +39,7 @@ function! SyntaxCheckers_lua_luac_GetHighlightRegex(pos) endfunction function! SyntaxCheckers_lua_luac_GetLocList() dict - let makeprg = syntastic#makeprg#build({ - \ 'args': '-p', - \ 'checker': self }) + let makeprg = self.makeprgBuild({ 'args': '-p' }) let errorformat = 'luac: %#%f:%l: %m' diff --git a/syntax_checkers/matlab/mlint.vim b/syntax_checkers/matlab/mlint.vim index 74aca1661..5b1f4545e 100644 --- a/syntax_checkers/matlab/mlint.vim +++ b/syntax_checkers/matlab/mlint.vim @@ -16,9 +16,7 @@ endif let g:loaded_syntastic_matlab_mlint_checker=1 function! SyntaxCheckers_matlab_mlint_GetLocList() dict - let makeprg = syntastic#makeprg#build({ - \ 'args': '-id $*', - \ 'checker': self }) + let makeprg = self.makeprgBuild({ 'args': '-id $*' }) let errorformat = \ 'L %l (C %c): %*[a-zA-Z0-9]: %m,'. diff --git a/syntax_checkers/nasm/nasm.vim b/syntax_checkers/nasm/nasm.vim index 4ff244235..6ad0f1bb3 100644 --- a/syntax_checkers/nasm/nasm.vim +++ b/syntax_checkers/nasm/nasm.vim @@ -16,11 +16,10 @@ let g:loaded_syntastic_nasm_nasm_checker=1 function! SyntaxCheckers_nasm_nasm_GetLocList() dict let wd = syntastic#util#shescape(expand("%:p:h") . "/") - let makeprg = syntastic#makeprg#build({ + let makeprg = self.makeprgBuild({ \ 'args': '-X gnu -f elf' . \ ' -I ' . syntastic#util#shescape(expand("%:p:h") . "/") . - \ ' ' . syntastic#c#NullOutput(), - \ 'checker': self }) + \ ' ' . syntastic#c#NullOutput() }) let errorformat = '%f:%l: %t%*[^:]: %m' diff --git a/syntax_checkers/nroff/mandoc.vim b/syntax_checkers/nroff/mandoc.vim index eeafe8fb3..4c8105cc4 100644 --- a/syntax_checkers/nroff/mandoc.vim +++ b/syntax_checkers/nroff/mandoc.vim @@ -15,9 +15,7 @@ endif let g:loaded_syntastic_nroff_mandoc_checker=1 function! SyntaxCheckers_nroff_mandoc_GetLocList() dict - let makeprg = syntastic#makeprg#build({ - \ 'args': '-Tlint', - \ 'checker': self }) + let makeprg = self.makeprgBuild({ 'args': '-Tlint' }) let errorformat = \ '%E%f:%l:%c: %tRROR: %m,' . diff --git a/syntax_checkers/perl/perl.vim b/syntax_checkers/perl/perl.vim index 61d9e076b..53980d070 100644 --- a/syntax_checkers/perl/perl.vim +++ b/syntax_checkers/perl/perl.vim @@ -65,10 +65,9 @@ function! SyntaxCheckers_perl_perl_GetLocList() dict \ (index(shebang['args'], '-t') >= 0 ? ' -t' : '') let errorformat = '%f:%l:%m' - let makeprg = syntastic#makeprg#build({ + let makeprg = self.makeprgBuild({ \ 'exe': exe, - \ 'args': '-c -X ' . extra, - \ 'checker': self }) + \ 'args': '-c -X ' . extra }) let errors = SyntasticMake({ \ 'makeprg': makeprg, @@ -79,10 +78,9 @@ function! SyntaxCheckers_perl_perl_GetLocList() dict return errors endif - let makeprg = syntastic#makeprg#build({ + let makeprg = self.makeprgBuild({ \ 'exe': exe, - \ 'args': '-c -Mwarnings ' . extra, - \ 'checker': self }) + \ 'args': '-c -Mwarnings ' . extra }) return SyntasticMake({ \ 'makeprg': makeprg, diff --git a/syntax_checkers/perl/perlcritic.vim b/syntax_checkers/perl/perlcritic.vim index 5bdc2f315..119b66a28 100644 --- a/syntax_checkers/perl/perlcritic.vim +++ b/syntax_checkers/perl/perlcritic.vim @@ -34,9 +34,8 @@ if !exists('g:syntastic_perl_perlcritic_thres') endif function! SyntaxCheckers_perl_perlcritic_GetLocList() dict - let makeprg = syntastic#makeprg#build({ - \ 'post_args': '--quiet --nocolor --verbose "\%s:\%f:\%l:\%c:(\%s) \%m (\%e)\n"', - \ 'checker': self }) + let makeprg = self.makeprgBuild({ + \ 'post_args': '--quiet --nocolor --verbose "\%s:\%f:\%l:\%c:(\%s) \%m (\%e)\n"' }) let errorformat = '%t:%f:%l:%c:%m' diff --git a/syntax_checkers/php/php.vim b/syntax_checkers/php/php.vim index 8110cc1dd..4d0091290 100644 --- a/syntax_checkers/php/php.vim +++ b/syntax_checkers/php/php.vim @@ -24,9 +24,8 @@ function! SyntaxCheckers_php_php_GetHighlightRegex(item) endfunction function! SyntaxCheckers_php_php_GetLocList() dict - let makeprg = syntastic#makeprg#build({ - \ 'args': '-l -d error_reporting=E_ALL -d display_errors=1 -d log_errors=0 -d xdebug.cli_color=0', - \ 'checker': self }) + let makeprg = self.makeprgBuild({ + \ 'args': '-l -d error_reporting=E_ALL -d display_errors=1 -d log_errors=0 -d xdebug.cli_color=0' }) let errorformat = \ '%-GNo syntax errors detected in%.%#,'. diff --git a/syntax_checkers/php/phpcs.vim b/syntax_checkers/php/phpcs.vim index eb6560a6c..c69f32acd 100644 --- a/syntax_checkers/php/phpcs.vim +++ b/syntax_checkers/php/phpcs.vim @@ -19,9 +19,7 @@ endif let g:loaded_syntastic_php_phpcs_checker=1 function! SyntaxCheckers_php_phpcs_GetLocList() dict - let makeprg = syntastic#makeprg#build({ - \ 'args': '--report=csv', - \ 'checker': self }) + let makeprg = self.makeprgBuild({ 'args': '--report=csv' }) let errorformat = \ '%-GFile\,Line\,Column\,Type\,Message\,Source\,Severity,'. diff --git a/syntax_checkers/php/phpmd.vim b/syntax_checkers/php/phpmd.vim index 7a9c7a085..290e5fc66 100644 --- a/syntax_checkers/php/phpmd.vim +++ b/syntax_checkers/php/phpmd.vim @@ -55,9 +55,7 @@ function! SyntaxCheckers_php_phpmd_GetHighlightRegex(item) endfunction function! SyntaxCheckers_php_phpmd_GetLocList() dict - let makeprg = syntastic#makeprg#build({ - \ 'post_args': 'text codesize,design,unusedcode,naming', - \ 'checker': self }) + let makeprg = self.makeprgBuild({ 'post_args': 'text codesize,design,unusedcode,naming' }) let errorformat = '%E%f:%l%\s%#%m' diff --git a/syntax_checkers/pod/podchecker.vim b/syntax_checkers/pod/podchecker.vim index d7e30c713..ee0f6d2f0 100644 --- a/syntax_checkers/pod/podchecker.vim +++ b/syntax_checkers/pod/podchecker.vim @@ -15,7 +15,7 @@ endif let g:loaded_syntastic_pod_podchecker_checker=1 function! SyntaxCheckers_pod_podchecker_GetLocList() dict - let makeprg = syntastic#makeprg#build({ 'checker': self }) + let makeprg = self.makeprgBuild({}) let errorformat = \ '%W%[%#]%[%#]%[%#] WARNING: %m at line %l in file %f,' . diff --git a/syntax_checkers/puppet/puppet.vim b/syntax_checkers/puppet/puppet.vim index cbb342ffd..541a3242c 100644 --- a/syntax_checkers/puppet/puppet.vim +++ b/syntax_checkers/puppet/puppet.vim @@ -24,9 +24,7 @@ function! SyntaxCheckers_puppet_puppet_GetLocList() dict let args = '--color=false --parseonly' endif - let makeprg = syntastic#makeprg#build({ - \ 'args': args, - \ 'checker': self }) + let makeprg = self.makeprgBuild({ 'args': args }) let errorformat = \ '%-Gerr: Try ''puppet help parser validate'' for usage,' . diff --git a/syntax_checkers/puppet/puppetlint.vim b/syntax_checkers/puppet/puppetlint.vim index 8cb6b5972..b68e9b50d 100644 --- a/syntax_checkers/puppet/puppetlint.vim +++ b/syntax_checkers/puppet/puppetlint.vim @@ -29,10 +29,9 @@ function! SyntaxCheckers_puppet_puppetlint_IsAvailable() dict endfunction function! SyntaxCheckers_puppet_puppetlint_GetLocList() dict - let makeprg = syntastic#makeprg#build({ + let makeprg = self.makeprgBuild({ \ 'exe': 'puppet-lint', - \ 'post_args': '--log-format "%{KIND} [%{check}] %{message} at %{fullpath}:%{linenumber}"', - \ 'checker': self }) + \ 'post_args': '--log-format "%{KIND} [%{check}] %{message} at %{fullpath}:%{linenumber}"' }) let errorformat = '%t%*[a-zA-Z] %m at %f:%l' diff --git a/syntax_checkers/python/flake8.vim b/syntax_checkers/python/flake8.vim index a993b5662..fa2e17801 100644 --- a/syntax_checkers/python/flake8.vim +++ b/syntax_checkers/python/flake8.vim @@ -15,9 +15,7 @@ function! SyntaxCheckers_python_flake8_GetHighlightRegex(i) endfunction function! SyntaxCheckers_python_flake8_GetLocList() dict - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'flake8', - \ 'checker': self }) + let makeprg = self.makeprgBuild({}) let errorformat = \ '%E%f:%l: could not compile,%-Z%p^,' . diff --git a/syntax_checkers/python/pep257.vim b/syntax_checkers/python/pep257.vim index 27a2dbca3..8a0c359f4 100644 --- a/syntax_checkers/python/pep257.vim +++ b/syntax_checkers/python/pep257.vim @@ -16,9 +16,7 @@ function! SyntaxCheckers_python_pep257_Preprocess(errors) endfunction function! SyntaxCheckers_python_pep257_GetLocList() dict - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'pep257', - \ 'checker': self }) + let makeprg = self.makeprgBuild({}) let errorformat = \ '%E%f:%l:%c%\%.%\%.%\d%\+:%\d%\+: %m,' . diff --git a/syntax_checkers/python/pep8.vim b/syntax_checkers/python/pep8.vim index b022ff645..85cd656e9 100644 --- a/syntax_checkers/python/pep8.vim +++ b/syntax_checkers/python/pep8.vim @@ -18,9 +18,7 @@ endif let g:loaded_syntastic_python_pep8_checker=1 function! SyntaxCheckers_python_pep8_GetLocList() dict - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'pep8', - \ 'checker': self }) + let makeprg = self.makeprgBuild({}) let errorformat = '%f:%l:%c: %m' diff --git a/syntax_checkers/python/py3kwarn.vim b/syntax_checkers/python/py3kwarn.vim index ece238aa4..7a2d4ed18 100644 --- a/syntax_checkers/python/py3kwarn.vim +++ b/syntax_checkers/python/py3kwarn.vim @@ -10,9 +10,7 @@ endif let g:loaded_syntastic_python_py3kwarn_checker=1 function! SyntaxCheckers_python_py3kwarn_GetLocList() dict - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'py3kwarn', - \ 'checker': self }) + let makeprg = self.makeprgBuild({}) let errorformat = '%W%f:%l:%c: %m' diff --git a/syntax_checkers/python/pyflakes.vim b/syntax_checkers/python/pyflakes.vim index 1773d1857..e2c9680c7 100644 --- a/syntax_checkers/python/pyflakes.vim +++ b/syntax_checkers/python/pyflakes.vim @@ -36,9 +36,7 @@ function! SyntaxCheckers_python_pyflakes_GetHighlightRegex(i) endfunction function! SyntaxCheckers_python_pyflakes_GetLocList() dict - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'pyflakes', - \ 'checker': self }) + let makeprg = self.makeprgBuild({}) let errorformat = \ '%E%f:%l: could not compile,'. diff --git a/syntax_checkers/python/pylama.vim b/syntax_checkers/python/pylama.vim index b49a4f2c6..fa753f691 100644 --- a/syntax_checkers/python/pylama.vim +++ b/syntax_checkers/python/pylama.vim @@ -19,10 +19,7 @@ function! SyntaxCheckers_python_pylama_GetHighlightRegex(i) endfunction function! SyntaxCheckers_python_pylama_GetLocList() dict - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'pylama', - \ 'post_args': '-f pep8', - \ 'checker': self }) + let makeprg = self.makeprgBuild({ 'post_args': '-f pep8' }) " TODO: "WARNING:pylama:..." messages are probably a logging bug let errorformat = diff --git a/syntax_checkers/python/pylint.vim b/syntax_checkers/python/pylint.vim index a60c88d44..9e2199d9a 100644 --- a/syntax_checkers/python/pylint.vim +++ b/syntax_checkers/python/pylint.vim @@ -18,10 +18,8 @@ function! SyntaxCheckers_python_pylint_IsAvailable() dict endfunction function! SyntaxCheckers_python_pylint_GetLocList() dict - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'pylint', - \ 'args': (s:pylint_new ? '--msg-template="{path}:{line}: [{msg_id}] {msg}" -r n' : '-f parseable -r n -i y'), - \ 'checker': self }) + let makeprg = self.makeprgBuild({ + \ 'args': (s:pylint_new ? '--msg-template="{path}:{line}: [{msg_id}] {msg}" -r n' : '-f parseable -r n -i y') }) let errorformat = \ '%A%f:%l: %m,' . diff --git a/syntax_checkers/python/python.vim b/syntax_checkers/python/python.vim index a891879c8..0038b50e1 100644 --- a/syntax_checkers/python/python.vim +++ b/syntax_checkers/python/python.vim @@ -15,11 +15,9 @@ let g:loaded_syntastic_python_python_checker=1 function! SyntaxCheckers_python_python_GetLocList() dict let fname = "'" . escape(expand('%'), "\\'") . "'" - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'python', + let makeprg = self.makeprgBuild({ \ 'args': '-c', - \ 'fname': syntastic#util#shescape("compile(open(" . fname . ").read(), " . fname . ", 'exec')"), - \ 'checker': self }) + \ 'fname': syntastic#util#shescape("compile(open(" . fname . ").read(), " . fname . ", 'exec')") }) let errorformat = \ '%E File "%f"\, line %l,' . diff --git a/syntax_checkers/rst/rst2pseudoxml.vim b/syntax_checkers/rst/rst2pseudoxml.vim index 183778ba2..0b79c6fc6 100644 --- a/syntax_checkers/rst/rst2pseudoxml.vim +++ b/syntax_checkers/rst/rst2pseudoxml.vim @@ -23,11 +23,10 @@ function! SyntaxCheckers_rst_rst2pseudoxml_IsAvailable() dict endfunction function! SyntaxCheckers_rst_rst2pseudoxml_GetLocList() dict - let makeprg = syntastic#makeprg#build({ + let makeprg = self.makeprgBuild({ \ 'exe': s:exe(), \ 'args': '--report=2 --exit-status=1', - \ 'tail': syntastic#util#DevNull(), - \ 'checker': self }) + \ 'tail': syntastic#util#DevNull() }) let errorformat = \ '%f:%l: (%tNFO/1) %m,'. diff --git a/syntax_checkers/ruby/jruby.vim b/syntax_checkers/ruby/jruby.vim index ba8059c37..9ef9c9fde 100644 --- a/syntax_checkers/ruby/jruby.vim +++ b/syntax_checkers/ruby/jruby.vim @@ -15,10 +15,9 @@ endif let g:loaded_syntastic_ruby_jruby_checker=1 function! SyntaxCheckers_ruby_jruby_GetLocList() dict - let makeprg = syntastic#makeprg#build({ + let makeprg = self.makeprgBuild({ \ 'exe': s:exe(), - \ 'args': s:args(), - \ 'checker': self }) + \ 'args': s:args() }) let errorformat = \ '%-GSyntax OK for %f,'. diff --git a/syntax_checkers/ruby/macruby.vim b/syntax_checkers/ruby/macruby.vim index 0d3a422a0..e99f68760 100644 --- a/syntax_checkers/ruby/macruby.vim +++ b/syntax_checkers/ruby/macruby.vim @@ -14,10 +14,9 @@ endif let g:loaded_syntastic_ruby_macruby_checker=1 function! SyntaxCheckers_ruby_macruby_GetLocList() dict - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'RUBYOPT= macruby', - \ 'args': '-W1 -c', - \ 'checker': self }) + let makeprg = self.makeprgBuild({ + \ 'exe': 'RUBYOPT= ' . expand(self.getExec()), + \ 'args': '-W1 -c' }) let errorformat = \ '%-GSyntax OK,'. diff --git a/syntax_checkers/ruby/mri.vim b/syntax_checkers/ruby/mri.vim index 0a04d6784..d7bd6730f 100644 --- a/syntax_checkers/ruby/mri.vim +++ b/syntax_checkers/ruby/mri.vim @@ -34,10 +34,9 @@ function! SyntaxCheckers_ruby_mri_GetLocList() dict let exe = 'RUBYOPT= ' . exe endif - let makeprg = syntastic#makeprg#build({ + let makeprg = self.makeprgBuild({ \ 'exe': exe, - \ 'args': '-w -T1 -c', - \ 'checker': self }) + \ 'args': '-w -T1 -c' }) "this is a hack to filter out a repeated useless warning in rspec files "containing lines like diff --git a/syntax_checkers/ruby/rubocop.vim b/syntax_checkers/ruby/rubocop.vim index 029b1358e..2deda0ebc 100644 --- a/syntax_checkers/ruby/rubocop.vim +++ b/syntax_checkers/ruby/rubocop.vim @@ -26,9 +26,7 @@ function! SyntaxCheckers_ruby_rubocop_IsAvailable() dict endfunction function! SyntaxCheckers_ruby_rubocop_GetLocList() dict - let makeprg = syntastic#makeprg#build({ - \ 'args': '--format emacs --silent', - \ 'checker': self }) + let makeprg = self.makeprgBuild({ 'args': '--format emacs --silent' }) let errorformat = '%f:%l:%c: %t: %m' diff --git a/syntax_checkers/ruby/rubylint.vim b/syntax_checkers/ruby/rubylint.vim index 60bf7477b..4cf1f865b 100644 --- a/syntax_checkers/ruby/rubylint.vim +++ b/syntax_checkers/ruby/rubylint.vim @@ -17,9 +17,7 @@ endif let g:loaded_syntastic_ruby_rubylint_checker = 1 function! SyntaxCheckers_ruby_rubylint_GetLocList() dict - let makeprg = syntastic#makeprg#build({ - \ 'args': 'analyze --presenter=syntastic', - \ 'checker': self }) + let makeprg = self.makeprgBuild({ 'args': 'analyze --presenter=syntastic' }) let errorformat = '%f:%t:%l:%c: %m' diff --git a/syntax_checkers/rust/rustc.vim b/syntax_checkers/rust/rustc.vim index ed0d559e1..de4de5379 100644 --- a/syntax_checkers/rust/rustc.vim +++ b/syntax_checkers/rust/rustc.vim @@ -16,9 +16,7 @@ endif let g:loaded_syntastic_rust_rustc_checker=1 function! SyntaxCheckers_rust_rustc_GetLocList() dict - let makeprg = syntastic#makeprg#build({ - \ 'args': '--parse-only', - \ 'checker': self }) + let makeprg = self.makeprgBuild({ 'args': '--parse-only' }) let errorformat = \ '%E%f:%l:%c: \\d%#:\\d%# %.%\{-}error:%.%\{-} %m,' . diff --git a/syntax_checkers/sass/sass.vim b/syntax_checkers/sass/sass.vim index c685f2ae1..5edfebe7d 100644 --- a/syntax_checkers/sass/sass.vim +++ b/syntax_checkers/sass/sass.vim @@ -35,9 +35,8 @@ function! SyntaxCheckers_sass_sass_GetLocList() dict return [] endif - let makeprg = syntastic#makeprg#build({ - \ 'args': '--cache-location ' . s:sass_cache_location . ' ' . s:imports . ' --check', - \ 'checker': self }) + let makeprg = self.makeprgBuild({ + \ 'args': '--cache-location ' . s:sass_cache_location . ' ' . s:imports . ' --check' }) let errorformat = \ '%ESyntax %trror: %m,' . diff --git a/syntax_checkers/scala/fsc.vim b/syntax_checkers/scala/fsc.vim index d13b205fb..d00e9c21e 100644 --- a/syntax_checkers/scala/fsc.vim +++ b/syntax_checkers/scala/fsc.vim @@ -23,10 +23,9 @@ function! SyntaxCheckers_scala_fsc_GetLocList() dict " fsc has some serious problems with the " working directory changing after being started " that's why we better pass an absolute path - let makeprg = syntastic#makeprg#build({ + let makeprg = self.makeprgBuild({ \ 'args': '-Ystop-after:parser ' . g:syntastic_scala_options, - \ 'fname': syntastic#util#shexpand('%:p'), - \ 'checker': self }) + \ 'fname': syntastic#util#shexpand('%:p') }) let errorformat = '%f:%l: %trror: %m' diff --git a/syntax_checkers/scala/scalac.vim b/syntax_checkers/scala/scalac.vim index 753abd765..67a4073ea 100644 --- a/syntax_checkers/scala/scalac.vim +++ b/syntax_checkers/scala/scalac.vim @@ -20,9 +20,8 @@ if !exists('g:syntastic_scala_options') endif function! SyntaxCheckers_scala_scalac_GetLocList() dict - let makeprg = syntastic#makeprg#build({ - \ 'args': '-Ystop-after:parser ' . g:syntastic_scala_options, - \ 'checker': self }) + let makeprg = self.makeprgBuild({ + \ 'args': '-Ystop-after:parser ' . g:syntastic_scala_options }) let errorformat = '%f:%l: %trror: %m' diff --git a/syntax_checkers/sh/checkbashisms.vim b/syntax_checkers/sh/checkbashisms.vim index ead049b8e..6f8b10538 100644 --- a/syntax_checkers/sh/checkbashisms.vim +++ b/syntax_checkers/sh/checkbashisms.vim @@ -12,9 +12,7 @@ endif let g:loaded_syntastic_sh_checkbashisms_checker=1 function! SyntaxCheckers_sh_checkbashisms_GetLocList() dict - let makeprg = syntastic#makeprg#build({ - \ 'args': '-fx', - \ 'checker': self}) + let makeprg = self.makeprgBuild({ 'args': '-fx' }) let errorformat = \ '%-Gscript %f is already a bash script; skipping,' . diff --git a/syntax_checkers/sh/sh.vim b/syntax_checkers/sh/sh.vim index 349534533..1ba8fe0e3 100644 --- a/syntax_checkers/sh/sh.vim +++ b/syntax_checkers/sh/sh.vim @@ -64,10 +64,9 @@ function! SyntaxCheckers_sh_sh_GetLocList() dict return [] endif - let makeprg = syntastic#makeprg#build({ + let makeprg = self.makeprgBuild({ \ 'exe': s:GetShell(), - \ 'args': '-n', - \ 'checker': self }) + \ 'args': '-n' }) let errorformat = '%f: line %l: %m' diff --git a/syntax_checkers/slim/slimrb.vim b/syntax_checkers/slim/slimrb.vim index 26291f628..90f5b9f2e 100644 --- a/syntax_checkers/slim/slimrb.vim +++ b/syntax_checkers/slim/slimrb.vim @@ -23,9 +23,7 @@ function! s:SlimrbVersion() endfunction function! SyntaxCheckers_slim_slimrb_GetLocList() dict - let makeprg = syntastic#makeprg#build({ - \ 'args': '-c', - \ 'checker': self }) + let makeprg = self.makeprgBuild({ 'args': '-c' }) if syntastic#util#versionIsAtLeast(s:SlimrbVersion(), [1,3,1]) let errorformat = diff --git a/syntax_checkers/tcl/nagelfar.vim b/syntax_checkers/tcl/nagelfar.vim index 4bbd164cd..b17f8a671 100644 --- a/syntax_checkers/tcl/nagelfar.vim +++ b/syntax_checkers/tcl/nagelfar.vim @@ -17,9 +17,7 @@ endif let g:loaded_syntastic_tcl_nagelfar_checker=1 function! SyntaxCheckers_tcl_nagelfar_GetLocList() dict - let makeprg = syntastic#makeprg#build({ - \ 'args': '-H', - \ 'checker': self }) + let makeprg = self.makeprgBuild({ 'args': '-H' }) let errorformat = \ '%I%f: %l: N %m,'. diff --git a/syntax_checkers/tex/chktex.vim b/syntax_checkers/tex/chktex.vim index ff61cad7a..5263807cf 100644 --- a/syntax_checkers/tex/chktex.vim +++ b/syntax_checkers/tex/chktex.vim @@ -33,9 +33,7 @@ if !exists('g:syntastic_tex_chktex_showmsgs') endif function! SyntaxCheckers_tex_chktex_GetLocList() dict - let makeprg = syntastic#makeprg#build({ - \ 'post_args': '-q -v1', - \ 'checker': self }) + let makeprg = self.makeprgBuild({ 'post_args': '-q -v1' }) let errorformat = \ '%EError %n in %f line %l: %m,' . diff --git a/syntax_checkers/tex/lacheck.vim b/syntax_checkers/tex/lacheck.vim index 38b395c2a..ec1e4bedf 100644 --- a/syntax_checkers/tex/lacheck.vim +++ b/syntax_checkers/tex/lacheck.vim @@ -16,7 +16,7 @@ endif let g:loaded_syntastic_tex_lacheck_checker=1 function! SyntaxCheckers_tex_lacheck_GetLocList() dict - let makeprg = syntastic#makeprg#build({ 'checker': self }) + let makeprg = self.makeprgBuild({}) let errorformat = \ '%-G** %f:,' . diff --git a/syntax_checkers/text/atdtool.vim b/syntax_checkers/text/atdtool.vim index b2b025a5e..2f76f921d 100644 --- a/syntax_checkers/text/atdtool.vim +++ b/syntax_checkers/text/atdtool.vim @@ -25,9 +25,7 @@ function! SyntaxCheckers_text_atdtool_GetHighlightRegex(item) endfunction function! SyntaxCheckers_text_atdtool_GetLocList() dict - let makeprg = syntastic#makeprg#build({ - \ 'tail': '2>' . syntastic#util#DevNull(), - \ 'checker': self }) + let makeprg = self.makeprgBuild({ 'tail': '2> ' . syntastic#util#DevNull() }) let errorformat = \ '%W%f:%l:%c: %m,'. diff --git a/syntax_checkers/twig/twiglint.vim b/syntax_checkers/twig/twiglint.vim index 5574f17fc..90b76fc44 100644 --- a/syntax_checkers/twig/twiglint.vim +++ b/syntax_checkers/twig/twiglint.vim @@ -21,9 +21,7 @@ function! SyntaxCheckers_twig_twiglint_GetHighlightRegex(item) endfunction function! SyntaxCheckers_twig_twiglint_GetLocList() dict - let makeprg = syntastic#makeprg#build({ - \ 'args': 'lint --format=csv', - \ 'checker': self }) + let makeprg = self.makeprgBuild({ 'args': 'lint --format=csv' }) let errorformat = '"%f"\,%l\,%m' diff --git a/syntax_checkers/typescript/tsc.vim b/syntax_checkers/typescript/tsc.vim index 10b812017..0953acb36 100644 --- a/syntax_checkers/typescript/tsc.vim +++ b/syntax_checkers/typescript/tsc.vim @@ -10,10 +10,9 @@ endif let g:loaded_syntastic_typescript_tsc_checker=1 function! SyntaxCheckers_typescript_tsc_GetLocList() dict - let makeprg = syntastic#makeprg#build({ + let makeprg = self.makeprgBuild({ \ 'args': '--module commonjs', - \ 'post_args': '--out ' . syntastic#util#DevNull(), - \ 'checker': self }) + \ 'post_args': '--out ' . syntastic#util#DevNull() }) let errorformat = \ '%E%f %#(%l\,%c): error %m,' . diff --git a/syntax_checkers/vala/valac.vim b/syntax_checkers/vala/valac.vim index 06b2d1156..5d33dab49 100644 --- a/syntax_checkers/vala/valac.vim +++ b/syntax_checkers/vala/valac.vim @@ -50,9 +50,7 @@ endfunction function! SyntaxCheckers_vala_valac_GetLocList() dict let vala_pkg_args = join(map(s:GetValaModules(), '"--pkg ".v:val'), ' ') - let makeprg = syntastic#makeprg#build({ - \ 'args': '-C ' . vala_pkg_args, - \ 'checker': self }) + let makeprg = self.makeprgBuild({ 'args': '-C ' . vala_pkg_args }) let errorformat = \ '%A%f:%l.%c-%\d%\+.%\d%\+: %t%[a-z]%\+: %m,'. diff --git a/syntax_checkers/vhdl/ghdl.vim b/syntax_checkers/vhdl/ghdl.vim index 34cb5fd19..915d3b4f3 100644 --- a/syntax_checkers/vhdl/ghdl.vim +++ b/syntax_checkers/vhdl/ghdl.vim @@ -15,9 +15,7 @@ endif let g:loaded_syntastic_vhdl_ghdl_checker = 1 function! SyntaxCheckers_vhdl_ghdl_GetLocList() dict - let makeprg = syntastic#makeprg#build({ - \ 'args': '-s', - \ 'checker': self }) + let makeprg = self.makeprgBuild({ 'args': '-s' }) let errorformat = '%f:%l:%c: %m' diff --git a/syntax_checkers/xhtml/tidy.vim b/syntax_checkers/xhtml/tidy.vim index ea0873a8e..5ea0936c6 100644 --- a/syntax_checkers/xhtml/tidy.vim +++ b/syntax_checkers/xhtml/tidy.vim @@ -54,9 +54,7 @@ endfunction function! SyntaxCheckers_xhtml_tidy_GetLocList() dict let encopt = s:TidyEncOptByFenc() - let makeprg = syntastic#makeprg#build({ - \ 'args': encopt . ' -xml -e', - \ 'checker': self }) + let makeprg = self.makeprgBuild({ 'args': encopt . ' -xml -e' }) let errorformat= \ '%Wline %l column %v - Warning: %m,' . diff --git a/syntax_checkers/xml/xmllint.vim b/syntax_checkers/xml/xmllint.vim index 5e8b7d8f2..99dbf251e 100644 --- a/syntax_checkers/xml/xmllint.vim +++ b/syntax_checkers/xml/xmllint.vim @@ -20,9 +20,7 @@ let g:loaded_syntastic_xml_xmllint_checker=1 " and http://www.xmlsoft.org/catalog.html for more information. function! SyntaxCheckers_xml_xmllint_GetLocList() dict - let makeprg = syntastic#makeprg#build({ - \ 'args': '--xinclude --noout --postvalid', - \ 'checker': self }) + let makeprg = self.makeprgBuild({ 'args': '--xinclude --noout --postvalid' }) let errorformat= \ '%E%f:%l: error : %m,' . diff --git a/syntax_checkers/yaml/jsyaml.vim b/syntax_checkers/yaml/jsyaml.vim index b8734142a..ac4657e7f 100644 --- a/syntax_checkers/yaml/jsyaml.vim +++ b/syntax_checkers/yaml/jsyaml.vim @@ -19,9 +19,7 @@ endif let g:loaded_syntastic_yaml_jsyaml_checker=1 function! SyntaxCheckers_yaml_jsyaml_GetLocList() dict - let makeprg = syntastic#makeprg#build({ - \ 'args': '--compact', - \ 'checker': self }) + let makeprg = self.makeprgBuild({ 'args': '--compact' }) let errorformat='Error on line %l\, col %c:%m,%-G%.%#' diff --git a/syntax_checkers/z80/z80syntaxchecker.vim b/syntax_checkers/z80/z80syntaxchecker.vim index a265b004e..a0c3c6ea4 100644 --- a/syntax_checkers/z80/z80syntaxchecker.vim +++ b/syntax_checkers/z80/z80syntaxchecker.vim @@ -22,7 +22,7 @@ endif let g:loaded_syntastic_z80_z80syntaxchecker_checker=1 function! SyntaxCheckers_z80_z80syntaxchecker_GetLocList() dict - let makeprg = syntastic#makeprg#build({ 'checker': self }) + let makeprg = self.makeprgBuild({}) let errorformat = '%f:%l %m' diff --git a/syntax_checkers/zpt/zptlint.vim b/syntax_checkers/zpt/zptlint.vim index 1b3491fa4..16b85e0cc 100644 --- a/syntax_checkers/zpt/zptlint.vim +++ b/syntax_checkers/zpt/zptlint.vim @@ -25,7 +25,7 @@ endif let g:loaded_syntastic_zpt_zptlint_checker=1 function! SyntaxCheckers_zpt_zptlint_GetLocList() dict - let makeprg = syntastic#makeprg#build({ 'checker': self }) + let makeprg = self.makeprgBuild({}) let errorformat= \ '%-P*** Error in: %f,'. diff --git a/syntax_checkers/zsh/zsh.vim b/syntax_checkers/zsh/zsh.vim index 34ef792a1..09b5ee653 100644 --- a/syntax_checkers/zsh/zsh.vim +++ b/syntax_checkers/zsh/zsh.vim @@ -16,9 +16,7 @@ endif let g:loaded_syntastic_zsh_zsh_checker=1 function! SyntaxCheckers_zsh_zsh_GetLocList() dict - let makeprg = syntastic#makeprg#build({ - \ 'args': '-n', - \ 'checker': self }) + let makeprg = self.makeprgBuild({ 'args': '-n' }) let errorformat = '%f:%l: %m' From d69932d33a872b2a0589a639eda448ba420f831a Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 1 Nov 2013 16:46:57 +0200 Subject: [PATCH 0237/1271] Update for shellcheck. --- syntax_checkers/sh/shellcheck.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntax_checkers/sh/shellcheck.vim b/syntax_checkers/sh/shellcheck.vim index 4c65029fe..dd9730e0f 100644 --- a/syntax_checkers/sh/shellcheck.vim +++ b/syntax_checkers/sh/shellcheck.vim @@ -17,7 +17,7 @@ function! SyntaxCheckers_sh_shellcheck_Preprocess(json) return map(errors, 'v:val["level"][0] . ":" . v:val["line"] . ":" . v:val["column"] . ":" . v:val["message"]') endfunction -function! SyntaxCheckers_sh_shellcheck_GetLocList() +function! SyntaxCheckers_sh_shellcheck_GetLocList() dict let makeprg = expand(self.getExec()) . ' < ' . syntastic#util#shexpand('%') let errorformat = '%t:%l:%v:%m' From 5c510f8ec1746690f7ca46300289ade3bef26e25 Mon Sep 17 00:00:00 2001 From: Shane da Silva Date: Tue, 24 Sep 2013 22:51:56 -0700 Subject: [PATCH 0238/1271] Add scss-lint checker for SCSS files Add checker for linting and syntax checking SCSS files with `scss-lint` (https://github.com/causes/scss-lint/). --- syntax_checkers/scss/scss_lint.vim | 44 ++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 syntax_checkers/scss/scss_lint.vim diff --git a/syntax_checkers/scss/scss_lint.vim b/syntax_checkers/scss/scss_lint.vim new file mode 100644 index 000000000..05aa04bf6 --- /dev/null +++ b/syntax_checkers/scss/scss_lint.vim @@ -0,0 +1,44 @@ +"============================================================================ +"File: scss_lint.vim +"Description: SCSS style and syntax checker plugin for Syntastic +"Maintainer: Shane da Silva +"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. +"============================================================================ +" +" Since scss-lint also checks your SCSS file syntax, you can replace the Sass +" syntax checker using: +" +" let g:syntastic_scss_checkers = ['scss_lint'] + +if exists("g:loaded_syntastic_scss_scss_lint_checker") + finish +endif +let g:loaded_syntastic_scss_scss_lint_checker=1 + +function! SyntaxCheckers_scss_scss_lint_IsAvailable() + return executable('scss-lint') +endfunction + +function! SyntaxCheckers_scss_scss_lint_GetLocList() + let makeprg = syntastic#makeprg#build({ + \ 'exe': 'scss-lint', + \ 'filetype': 'scss', + \ 'subchecker': 'scss_lint' }) + + let errorformat = '%f:%l\ [%t]\ %m' + + let loclist = SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'subtype': 'Style'}) + + return loclist +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'scss', + \ 'name': 'scss_lint'}) From 9be2a1bb3d36e7ce14ffc15290c28982304babe1 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Mon, 4 Nov 2013 19:55:31 +0200 Subject: [PATCH 0239/1271] Cleanup. --- syntax_checkers/scss/scss_lint.vim | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/syntax_checkers/scss/scss_lint.vim b/syntax_checkers/scss/scss_lint.vim index 05aa04bf6..2fc39a8fd 100644 --- a/syntax_checkers/scss/scss_lint.vim +++ b/syntax_checkers/scss/scss_lint.vim @@ -8,11 +8,6 @@ " Want To Public License, Version 2, as published by Sam Hocevar. " See http://sam.zoy.org/wtfpl/COPYING for more details. "============================================================================ -" -" Since scss-lint also checks your SCSS file syntax, you can replace the Sass -" syntax checker using: -" -" let g:syntastic_scss_checkers = ['scss_lint'] if exists("g:loaded_syntastic_scss_scss_lint_checker") finish @@ -29,7 +24,7 @@ function! SyntaxCheckers_scss_scss_lint_GetLocList() \ 'filetype': 'scss', \ 'subchecker': 'scss_lint' }) - let errorformat = '%f:%l\ [%t]\ %m' + let errorformat = '%f:%l [%t] %m' let loclist = SyntasticMake({ \ 'makeprg': makeprg, From 007ff6a4245bd567a3a4fba66047ce973c67a81a Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Mon, 4 Nov 2013 20:00:35 +0200 Subject: [PATCH 0240/1271] Update scss_lint to the new registry framework. --- syntax_checkers/scss/scss_lint.vim | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/syntax_checkers/scss/scss_lint.vim b/syntax_checkers/scss/scss_lint.vim index 2fc39a8fd..49e1a72f9 100644 --- a/syntax_checkers/scss/scss_lint.vim +++ b/syntax_checkers/scss/scss_lint.vim @@ -14,26 +14,16 @@ if exists("g:loaded_syntastic_scss_scss_lint_checker") endif let g:loaded_syntastic_scss_scss_lint_checker=1 -function! SyntaxCheckers_scss_scss_lint_IsAvailable() - return executable('scss-lint') -endfunction - function! SyntaxCheckers_scss_scss_lint_GetLocList() - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'scss-lint', - \ 'filetype': 'scss', - \ 'subchecker': 'scss_lint' }) - + let makeprg = syntastic#makeprg#build({}) let errorformat = '%f:%l [%t] %m' - - let loclist = SyntasticMake({ + return SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, \ 'subtype': 'Style'}) - - return loclist endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'scss', - \ 'name': 'scss_lint'}) + \ 'name': 'scss_lint', + \ 'exec': 'scss-lint' }) From c0eb4a49b607a3d5cdd13fce5e7bb4d6e5fa293e Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Mon, 4 Nov 2013 23:00:51 +0200 Subject: [PATCH 0241/1271] Cleanup. --- syntax_checkers/c/make.vim | 2 +- syntax_checkers/cpp/cpplint.vim | 10 +++------- syntax_checkers/css/prettycss.vim | 4 ++-- syntax_checkers/html/tidy.vim | 6 +++--- syntax_checkers/html/w3.vim | 4 ++-- syntax_checkers/perl/perlcritic.vim | 4 ++-- syntax_checkers/pod/podchecker.vim | 3 +-- syntax_checkers/python/pep257.vim | 4 ++-- syntax_checkers/python/pep8.vim | 4 ++-- syntax_checkers/python/pylama.vim | 20 ++++++++++---------- syntax_checkers/python/pylint.vim | 12 ++++++------ syntax_checkers/rst/rst2pseudoxml.vim | 12 ++++++------ syntax_checkers/ruby/macruby.vim | 2 +- syntax_checkers/ruby/rubocop.vim | 10 +++++----- syntax_checkers/sh/shellcheck.vim | 2 +- syntax_checkers/text/atdtool.vim | 4 ++-- syntax_checkers/xhtml/tidy.vim | 6 +++--- 17 files changed, 52 insertions(+), 57 deletions(-) diff --git a/syntax_checkers/c/make.vim b/syntax_checkers/c/make.vim index bc3a8d55e..56e283e4e 100644 --- a/syntax_checkers/c/make.vim +++ b/syntax_checkers/c/make.vim @@ -19,7 +19,7 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_c_make_GetLocList() dict - let makeprg = expand(self.getExec()) . ' -sk' + let makeprg = self.getExec() . ' -sk' let errorformat = \ '%-G%f:%s:,' . diff --git a/syntax_checkers/cpp/cpplint.vim b/syntax_checkers/cpp/cpplint.vim index bb8efa972..32bda206a 100644 --- a/syntax_checkers/cpp/cpplint.vim +++ b/syntax_checkers/cpp/cpplint.vim @@ -31,12 +31,8 @@ if !exists('g:syntastic_cpp_cpplint_thres') let g:syntastic_cpp_cpplint_thres = 5 endif -if ! exists('g:syntastic_cpp_cpplint_args') - let g:syntastic_cpp_cpplint_args = '--verbose=3' -endif - function! SyntaxCheckers_cpp_cpplint_GetLocList() dict - let makeprg = self.makeprgBuild({}) + let makeprg = self.makeprgBuild({ 'args': '--verbose=3' }) let errorformat = '%A%f:%l: %m [%t],%-G%.%#' @@ -46,8 +42,8 @@ function! SyntaxCheckers_cpp_cpplint_GetLocList() dict \ 'subtype': 'Style' }) " change error types according to the prescribed threshold - for n in range(len(loclist)) - let loclist[n]['type'] = loclist[n]['type'] < g:syntastic_cpp_cpplint_thres ? 'W' : 'E' + for e in loclist + let e['type'] = e['type'] < g:syntastic_cpp_cpplint_thres ? 'W' : 'E' endfor return loclist diff --git a/syntax_checkers/css/prettycss.vim b/syntax_checkers/css/prettycss.vim index 90f69ed61..570d4f3b0 100644 --- a/syntax_checkers/css/prettycss.vim +++ b/syntax_checkers/css/prettycss.vim @@ -43,8 +43,8 @@ function! SyntaxCheckers_css_prettycss_GetLocList() dict \ 'defaults': {'bufnr': bufnr("")}, \ 'postprocess': ['sort'] }) - for n in range(len(loclist)) - let loclist[n]["text"] .= ')' + for n in loclist + let e["text"] .= ')' endfor return loclist diff --git a/syntax_checkers/html/tidy.vim b/syntax_checkers/html/tidy.vim index 747b4c37a..d88a448eb 100644 --- a/syntax_checkers/html/tidy.vim +++ b/syntax_checkers/html/tidy.vim @@ -152,9 +152,9 @@ function! SyntaxCheckers_html_tidy_GetLocList() dict \ 'returns': [0, 1, 2] }) " filter out valid HTML5 from the errors - for n in range(len(loclist)) - if loclist[n]['valid'] && s:IgnoreError(loclist[n]['text']) == 1 - let loclist[n]['valid'] = 0 + for n in loclist + if e['valid'] && s:IgnoreError(e['text']) == 1 + let e['valid'] = 0 endif endfor diff --git a/syntax_checkers/html/w3.vim b/syntax_checkers/html/w3.vim index cde707684..ee478da1b 100644 --- a/syntax_checkers/html/w3.vim +++ b/syntax_checkers/html/w3.vim @@ -52,8 +52,8 @@ function! SyntaxCheckers_html_w3_GetLocList() dict \ 'defaults': {'bufnr': bufnr("")}, \ 'returns': [0] }) - for n in range(len(loclist)) - let loclist[n]['text'] = substitute(loclist[n]['text'], '\m\\\([\"]\)', '\1', 'g') + for n in loclist + let e['text'] = substitute(e['text'], '\m\\\([\"]\)', '\1', 'g') endfor return loclist diff --git a/syntax_checkers/perl/perlcritic.vim b/syntax_checkers/perl/perlcritic.vim index 119b66a28..dda412be4 100644 --- a/syntax_checkers/perl/perlcritic.vim +++ b/syntax_checkers/perl/perlcritic.vim @@ -46,8 +46,8 @@ function! SyntaxCheckers_perl_perlcritic_GetLocList() dict \ 'subtype': 'Style' }) " change error types according to the prescribed threshold - for n in range(len(loclist)) - let loclist[n]['type'] = loclist[n]['type'] < g:syntastic_perl_perlcritic_thres ? 'W' : 'E' + for e in loclist + let e['type'] = e['type'] < g:syntastic_perl_perlcritic_thres ? 'W' : 'E' endfor return loclist diff --git a/syntax_checkers/pod/podchecker.vim b/syntax_checkers/pod/podchecker.vim index ee0f6d2f0..c51533e11 100644 --- a/syntax_checkers/pod/podchecker.vim +++ b/syntax_checkers/pod/podchecker.vim @@ -28,8 +28,7 @@ function! SyntaxCheckers_pod_podchecker_GetLocList() dict \ 'errorformat': errorformat, \ 'returns': [0, 1, 2] }) - for n in range(len(loclist)) - let e = loclist[n] + for e in loclist if e['valid'] && e['lnum'] == 0 let e['lnum'] = str2nr(matchstr(e['text'], '\m\= 0 ? 'W' : 'E' - if loclist[n]['text'] =~# '\v\[%(mccabe|pep257|pylint)\]$' - if has_key(loclist[n], 'col') - let loclist[n]['col'] += 1 + for n in loclist + let e['type'] = match(['R', 'C', 'W'], e['text'][0]) >= 0 ? 'W' : 'E' + if e['text'] =~# '\v\[%(mccabe|pep257|pylint)\]$' + if has_key(e, 'col') + let e['col'] += 1 endif endif - if loclist[n]['text'] =~# '\v\[pylint\]$' - if has_key(loclist[n], 'vcol') - let loclist[n]['vcol'] = 0 + if e['text'] =~# '\v\[pylint\]$' + if has_key(e, 'vcol') + let e['vcol'] = 0 endif endif - if loclist[n]['text'] =~# '\v\[%(mccabe|pep257|pep8)\]$' - let loclist[n]['subtype'] = 'Style' + if e['text'] =~# '\v\[%(mccabe|pep257|pep8)\]$' + let e['subtype'] = 'Style' endif endfor diff --git a/syntax_checkers/python/pylint.vim b/syntax_checkers/python/pylint.vim index 9e2199d9a..c201cbd39 100644 --- a/syntax_checkers/python/pylint.vim +++ b/syntax_checkers/python/pylint.vim @@ -32,16 +32,16 @@ function! SyntaxCheckers_python_pylint_GetLocList() dict \ 'errorformat': errorformat, \ 'postprocess': ['sort'] }) - for n in range(len(loclist)) - let type = loclist[n]['text'][1] + for n in loclist + let type = e['text'][1] if type =~# '\m^[EF]' - let loclist[n]['type'] = 'E' + let e['type'] = 'E' elseif type =~# '\m^[CRW]' - let loclist[n]['type'] = 'W' + let e['type'] = 'W' else - let loclist[n]['valid'] = 0 + let e['valid'] = 0 endif - let loclist[n]['vcol'] = 0 + let e['vcol'] = 0 endfor return loclist diff --git a/syntax_checkers/rst/rst2pseudoxml.vim b/syntax_checkers/rst/rst2pseudoxml.vim index 0b79c6fc6..4686cfd55 100644 --- a/syntax_checkers/rst/rst2pseudoxml.vim +++ b/syntax_checkers/rst/rst2pseudoxml.vim @@ -39,12 +39,12 @@ function! SyntaxCheckers_rst_rst2pseudoxml_GetLocList() dict \ 'makeprg': makeprg, \ 'errorformat': errorformat }) - for n in range(len(loclist)) - if loclist[n]['type'] ==? 'S' - let loclist[n]['type'] = 'E' - elseif loclist[n]['type'] ==? 'I' - let loclist[n]['type'] = 'W' - let loclist[n]['subtype'] = 'Style' + for n in loclist + if e['type'] ==? 'S' + let e['type'] = 'E' + elseif e['type'] ==? 'I' + let e['type'] = 'W' + let e['subtype'] = 'Style' endif endfor diff --git a/syntax_checkers/ruby/macruby.vim b/syntax_checkers/ruby/macruby.vim index e99f68760..ebfcd18f9 100644 --- a/syntax_checkers/ruby/macruby.vim +++ b/syntax_checkers/ruby/macruby.vim @@ -15,7 +15,7 @@ let g:loaded_syntastic_ruby_macruby_checker=1 function! SyntaxCheckers_ruby_macruby_GetLocList() dict let makeprg = self.makeprgBuild({ - \ 'exe': 'RUBYOPT= ' . expand(self.getExec()), + \ 'exe': 'RUBYOPT= ' . self.getExec(), \ 'args': '-W1 -c' }) let errorformat = diff --git a/syntax_checkers/ruby/rubocop.vim b/syntax_checkers/ruby/rubocop.vim index 2deda0ebc..03e16a9af 100644 --- a/syntax_checkers/ruby/rubocop.vim +++ b/syntax_checkers/ruby/rubocop.vim @@ -36,11 +36,11 @@ function! SyntaxCheckers_ruby_rubocop_GetLocList() dict \ 'subtype': 'Style'}) " convert rubocop severities to error types recognized by syntastic - for n in range(len(loclist)) - if loclist[n]['type'] == 'F' - let loclist[n]['type'] = 'E' - elseif loclist[n]['type'] != 'W' && loclist[n]['type'] != 'E' - let loclist[n]['type'] = 'W' + for e in loclist + if e['type'] == 'F' + let e['type'] = 'E' + elseif e['type'] != 'W' && e['type'] != 'E' + let e['type'] = 'W' endif endfor diff --git a/syntax_checkers/sh/shellcheck.vim b/syntax_checkers/sh/shellcheck.vim index dd9730e0f..c05d426d0 100644 --- a/syntax_checkers/sh/shellcheck.vim +++ b/syntax_checkers/sh/shellcheck.vim @@ -18,7 +18,7 @@ function! SyntaxCheckers_sh_shellcheck_Preprocess(json) endfunction function! SyntaxCheckers_sh_shellcheck_GetLocList() dict - let makeprg = expand(self.getExec()) . ' < ' . syntastic#util#shexpand('%') + let makeprg = self.getExec() . ' < ' . syntastic#util#shexpand('%') let errorformat = '%t:%l:%v:%m' diff --git a/syntax_checkers/text/atdtool.vim b/syntax_checkers/text/atdtool.vim index 2f76f921d..63d27e0f0 100644 --- a/syntax_checkers/text/atdtool.vim +++ b/syntax_checkers/text/atdtool.vim @@ -37,8 +37,8 @@ function! SyntaxCheckers_text_atdtool_GetLocList() dict \ 'returns': [0], \ 'subtype': 'Style' }) - for n in range(len(loclist)) - let loclist[n]['text'] = substitute(loclist[n]['text'], '\m\n\s\+', ' | ', 'g') + for n in loclist + let e['text'] = substitute(e['text'], '\m\n\s\+', ' | ', 'g') endfor return loclist diff --git a/syntax_checkers/xhtml/tidy.vim b/syntax_checkers/xhtml/tidy.vim index 5ea0936c6..c8392d901 100644 --- a/syntax_checkers/xhtml/tidy.vim +++ b/syntax_checkers/xhtml/tidy.vim @@ -67,9 +67,9 @@ function! SyntaxCheckers_xhtml_tidy_GetLocList() dict \ 'defaults': {'bufnr': bufnr("")}, \ 'returns': [0, 1, 2] }) - for n in range(len(loclist)) - if loclist[n]['valid'] && s:IgnoreError(loclist[n]['text']) == 1 - let loclist[n]['valid'] = 0 + for e in loclist + if e['valid'] && s:IgnoreError(e['text']) == 1 + let e['valid'] = 0 endif endfor From 440debd4bed1298501b41f6928f868368d50f1d9 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Tue, 5 Nov 2013 20:28:19 +0200 Subject: [PATCH 0242/1271] Safety checks for ghc-mod. --- syntax_checkers/haskell/ghc-mod.vim | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/syntax_checkers/haskell/ghc-mod.vim b/syntax_checkers/haskell/ghc-mod.vim index 3dcc6e7e4..db6913419 100644 --- a/syntax_checkers/haskell/ghc-mod.vim +++ b/syntax_checkers/haskell/ghc-mod.vim @@ -15,13 +15,18 @@ if exists('g:loaded_syntastic_haskell_ghc_mod_checker') endif let g:loaded_syntastic_haskell_ghc_mod_checker = 1 +let s:ghc_mod_new = -1 + function! SyntaxCheckers_haskell_ghc_mod_IsAvailable() - return executable('ghc-mod') + " We need either a Vim version that can handle NULs in system() output, + " or a ghc-mod version that has the --boundary option. + let s:ghc_mod_new = executable('ghc-mod') ? s:GhcModNew() : -1 + return (s:ghc_mod_new >= 0) && (v:version >= 704 || s:ghc_mod_new) endfunction function! SyntaxCheckers_haskell_ghc_mod_GetLocList() let makeprg = syntastic#makeprg#build({ - \ 'exe': 'ghc-mod check', + \ 'exe': 'ghc-mod check' . (s:ghc_mod_new ? ' --boundary=""' : ''), \ 'filetype': 'haskell', \ 'subchecker': 'ghc_mod' }) @@ -41,6 +46,17 @@ function! SyntaxCheckers_haskell_ghc_mod_GetLocList() \ 'postprocess': ['compressWhitespace'] }) endfunction +function! s:GhcModNew() + try + let ghc_mod_version = filter(split(system('ghc-mod'), '\n'), 'v:val =~# ''\m^ghc-mod version''')[0] + let ret = syntastic#util#versionIsAtLeast(syntastic#util#parseVersion(ghc_mod_version), [2, 1, 2]) + catch /^Vim\%((\a\+)\)\=:E684/ + call syntastic#util#error("checker haskell/ghc_mod: can't parse version string (abnormal termination?)") + let ret = -1 + endtry + return ret +endfunction + call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'haskell', \ 'name': 'ghc_mod'}) From 40f2cc87723f5639dd46f7097083c1c56c44bde2 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Wed, 6 Nov 2013 11:04:11 +0200 Subject: [PATCH 0243/1271] Add a warning about using syntastic_delayed_redraws. --- doc/syntastic.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/syntastic.txt b/doc/syntastic.txt index e97dc70cd..435cb3c2f 100644 --- a/doc/syntastic.txt +++ b/doc/syntastic.txt @@ -392,7 +392,9 @@ Default: 0 On older Vims, calling redraw when a popup menu is visible can cause Vim to segfault. If your version of Vim is affected, the solution is of course to upgrade Vim. If upgrading is not immediately feasible however, setting this -variable to 1 might help, by delaying redraws until they are safe. +variable to 1 might help, by delaying redraws until they are safe. Beware that +there are functional and performance penalties involved, so only enable this +if you actually need it. *'syntastic_debug'* Default: 0 From 69e4660754f2f1f2561f6971bebaf979bcf1be4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Gaul?= Date: Wed, 6 Nov 2013 12:16:20 +0100 Subject: [PATCH 0244/1271] less: adapt lessc errorformat Closes #845. --- syntax_checkers/less/lessc.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntax_checkers/less/lessc.vim b/syntax_checkers/less/lessc.vim index 05f825276..7a11cddb3 100644 --- a/syntax_checkers/less/lessc.vim +++ b/syntax_checkers/less/lessc.vim @@ -48,7 +48,7 @@ function! SyntaxCheckers_less_lessc_GetLocList() \ 'filetype': 'less', \ 'subchecker': 'lessc' }) - let errorformat = '%m in %f:%l:%c' + let errorformat = '%m in %f on line %l\, column %c:' return SyntasticMake({ \ 'makeprg': makeprg, From 384020bfbf6d5be74f552aebd10741abab3c42f2 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Wed, 6 Nov 2013 14:57:00 +0200 Subject: [PATCH 0245/1271] Cleanup: lessc errorformat. --- syntax_checkers/less/lessc.vim | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/syntax_checkers/less/lessc.vim b/syntax_checkers/less/lessc.vim index 7a11cddb3..ed078e8b1 100644 --- a/syntax_checkers/less/lessc.vim +++ b/syntax_checkers/less/lessc.vim @@ -48,7 +48,10 @@ function! SyntaxCheckers_less_lessc_GetLocList() \ 'filetype': 'less', \ 'subchecker': 'lessc' }) - let errorformat = '%m in %f on line %l\, column %c:' + let errorformat = + \ '%m in %f on line %l\, column %c:,' . + \ '%m in %f:%l:%c,' . + \ '%-G%.%#' return SyntasticMake({ \ 'makeprg': makeprg, From 2305c37d86f9b5f97cbcd9bdd376d29ac43f8b77 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Wed, 6 Nov 2013 21:06:05 +0200 Subject: [PATCH 0246/1271] Jshint: fix column handling in errorformat. --- syntax_checkers/javascript/jshint.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntax_checkers/javascript/jshint.vim b/syntax_checkers/javascript/jshint.vim index b4c576ea5..a095044c8 100644 --- a/syntax_checkers/javascript/jshint.vim +++ b/syntax_checkers/javascript/jshint.vim @@ -36,7 +36,7 @@ function! SyntaxCheckers_javascript_jshint_GetLocList() let errorformat = jshint_new ? \ '%f: line %l\, col %c\, %m \(%t%*\d\)' : - \ '%E%f: line %l\, col %c\, %m' + \ '%E%f: line %l\, col %v\, %m' return SyntasticMake({ \ 'makeprg': makeprg, From 3689c49e3eee89a2277fec652c4b00b56255bf34 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Thu, 7 Nov 2013 10:22:56 +0200 Subject: [PATCH 0247/1271] Jshint: really fix column handling in errorformat this time. ;) --- syntax_checkers/javascript/jshint.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntax_checkers/javascript/jshint.vim b/syntax_checkers/javascript/jshint.vim index a095044c8..68c7fa556 100644 --- a/syntax_checkers/javascript/jshint.vim +++ b/syntax_checkers/javascript/jshint.vim @@ -35,7 +35,7 @@ function! SyntaxCheckers_javascript_jshint_GetLocList() \ 'subchecker': 'jshint' }) let errorformat = jshint_new ? - \ '%f: line %l\, col %c\, %m \(%t%*\d\)' : + \ '%A%f: line %l\, col %v\, %m \(%t%*\d\)' : \ '%E%f: line %l\, col %v\, %m' return SyntasticMake({ From decd1a339d6eefdf319ec82d906e3a32edf40d1e Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Thu, 7 Nov 2013 11:18:55 +0200 Subject: [PATCH 0248/1271] JS-YAML: fix errorformat. --- syntax_checkers/yaml/jsyaml.vim | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/syntax_checkers/yaml/jsyaml.vim b/syntax_checkers/yaml/jsyaml.vim index 9ffdc658e..6041d76d1 100644 --- a/syntax_checkers/yaml/jsyaml.vim +++ b/syntax_checkers/yaml/jsyaml.vim @@ -23,13 +23,20 @@ function! SyntaxCheckers_yaml_jsyaml_IsAvailable() endfunction function! SyntaxCheckers_yaml_jsyaml_GetLocList() + if !exists('s:js_yaml_new') + let s:js_yaml_new = syntastic#util#versionIsAtLeast(syntastic#util#getVersion('js-yaml --version'), [2]) + endif + let makeprg = syntastic#makeprg#build({ \ 'exe': 'js-yaml', - \ 'args': '--compact', + \ 'args': s:js_yaml_new ? '' : '--compact', \ 'filetype': 'yaml', \ 'subchecker': 'jsyaml' }) - let errorformat='Error on line %l\, col %c:%m,%-G%.%#' + let errorformat = + \ 'Error on line %l\, col %c:%m,' . + \ 'JS-YAML: %m at line %l\, column %c:,' . + \ '%-G%.%#' return SyntasticMake({ \ 'makeprg': makeprg, From b11051bdc026bdad9df67c3e3f6cadee6725bf57 Mon Sep 17 00:00:00 2001 From: Kaleb Hornsby Date: Thu, 7 Nov 2013 09:53:43 -0500 Subject: [PATCH 0249/1271] placeholder should only be on input elements --- syntax_checkers/html/tidy.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntax_checkers/html/tidy.vim b/syntax_checkers/html/tidy.vim index 14f79f7bb..2c200ec13 100644 --- a/syntax_checkers/html/tidy.vim +++ b/syntax_checkers/html/tidy.vim @@ -68,7 +68,7 @@ endfunction let s:ignore_errors = [ \ "
lacks \"summary\" attribute", \ "not approved by W3C", - \ "attribute \"placeholder\"", + \ " proprietary attribute \"placeholder\"", \ " proprietary attribute \"charset\"", \ " lacks \"content\" attribute", \ "inserting \"type\" attribute", From 4e5f78ceb7785b2259f86c4194fa04e7e07446e7 Mon Sep 17 00:00:00 2001 From: Kaleb Hornsby Date: Thu, 7 Nov 2013 09:57:29 -0500 Subject: [PATCH 0250/1271] Allow more HTML5 input types This allows the following: - search - number - range - date - etc Somebody could in theory put type="foo", but all browsers' default input type is "text" and they all ignore unknown types. --- syntax_checkers/html/tidy.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntax_checkers/html/tidy.vim b/syntax_checkers/html/tidy.vim index 14f79f7bb..2a86fc9d2 100644 --- a/syntax_checkers/html/tidy.vim +++ b/syntax_checkers/html/tidy.vim @@ -78,7 +78,7 @@ let s:ignore_errors = [ \ "inserting missing 'title' element", \ "attribute \"[+", \ "unescaped & or unknown entity", - \ " attribute \"type\" has invalid value \"search\"" + \ " attribute \"type\" has invalid value" \ ] let s:blocklevel_tags = [ From 07d42bb145d99bda8b4be1ba244875cc35bb5c95 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Thu, 7 Nov 2013 18:24:10 +0200 Subject: [PATCH 0251/1271] Cleanup related to the HighlightRegex() functions. --- plugin/syntastic/checker.vim | 20 ++++++++------------ syntax_checkers/javascript/jslint.vim | 10 +++++----- 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/plugin/syntastic/checker.vim b/plugin/syntastic/checker.vim index 3ab1d2123..c8009218c 100644 --- a/plugin/syntastic/checker.vim +++ b/plugin/syntastic/checker.vim @@ -19,7 +19,7 @@ function! g:SyntasticChecker.New(args) let newObj._isAvailableFunc = function(prefix . 'IsAvailable') if exists('*' . prefix . 'GetHighlightRegex') - let newObj._highlightRegexFunc = function(prefix. 'GetHighlightRegex') + let newObj._highlightRegexFunc = function(prefix . 'GetHighlightRegex') else let newObj._highlightRegexFunc = '' endif @@ -48,11 +48,7 @@ function! g:SyntasticChecker.getLocList() endfunction function! g:SyntasticChecker.getHighlightRegexFor(error) - if empty(self._highlightRegexFunc) - return [] - endif - - return self._highlightRegexFunc(error) + return empty(self._highlightRegexFunc) ? [] : self._highlightRegexFunc(a:error) endfunction function! g:SyntasticChecker.isAvailable() @@ -61,14 +57,14 @@ endfunction " Private methods {{{1 -function! g:SyntasticChecker._populateHighlightRegexes(list) - let list = a:list +function! g:SyntasticChecker._populateHighlightRegexes(errors) + let list = a:errors if !empty(self._highlightRegexFunc) - for i in range(0, len(list)-1) - if list[i]['valid'] - let term = self._highlightRegexFunc(list[i]) + for e in list + if e['valid'] + let term = self._highlightRegexFunc(e) if len(term) > 0 - let list[i]['hl'] = term + let e['hl'] = term endif endif endfor diff --git a/syntax_checkers/javascript/jslint.vim b/syntax_checkers/javascript/jslint.vim index 384b4b852..3b4e8d9a6 100644 --- a/syntax_checkers/javascript/jslint.vim +++ b/syntax_checkers/javascript/jslint.vim @@ -23,12 +23,12 @@ function! SyntaxCheckers_javascript_jslint_IsAvailable() return executable('jslint') endfunction -function! SyntaxCheckers_javascript_jslint_HighlightTerm(error) - let unexpected = matchstr(a:error['text'], '\mExpected.*and instead saw \'\zs.*\ze\'') - if len(unexpected) < 1i - return '' +function! SyntaxCheckers_javascript_jslint_GetHighlightRegex(item) + let term = matchstr(a:item['text'], '\mExpected .* and instead saw ''\zs.*\ze''') + if term != '' + let term = '\V' . term endif - return '\V'.split(unexpected, "'")[1] + return term endfunction function! SyntaxCheckers_javascript_jslint_GetLocList() From d7e8fbc644376fb86ced373c6f13f32a21f6da32 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Thu, 7 Nov 2013 21:14:15 +0200 Subject: [PATCH 0252/1271] Typo in html/tidy. --- syntax_checkers/html/tidy.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntax_checkers/html/tidy.vim b/syntax_checkers/html/tidy.vim index a017757d7..d8d777f57 100644 --- a/syntax_checkers/html/tidy.vim +++ b/syntax_checkers/html/tidy.vim @@ -152,7 +152,7 @@ function! SyntaxCheckers_html_tidy_GetLocList() dict \ 'returns': [0, 1, 2] }) " filter out valid HTML5 from the errors - for n in loclist + for e in loclist if e['valid'] && s:IgnoreError(e['text']) == 1 let e['valid'] = 0 endif From d0f07706a11b143e618957e9c714384c8b1d2bb0 Mon Sep 17 00:00:00 2001 From: Kaleb Hornsby Date: Thu, 7 Nov 2013 16:20:44 -0500 Subject: [PATCH 0253/1271] rm'd unkown attribute rule more info: https://github.com/scrooloose/syntastic/commit/a956a814323225f9fce873a14a3d8edc027b7aa5#commitcomment-4537304 --- syntax_checkers/html/tidy.vim | 1 - 1 file changed, 1 deletion(-) diff --git a/syntax_checkers/html/tidy.vim b/syntax_checkers/html/tidy.vim index 03ab68ef4..3bba8b628 100644 --- a/syntax_checkers/html/tidy.vim +++ b/syntax_checkers/html/tidy.vim @@ -76,7 +76,6 @@ let s:ignore_errors = [ \ "missing declaration", \ "inserting implicit ", \ "inserting missing 'title' element", - \ "attribute \"[+", \ "unescaped & or unknown entity", \ " attribute \"type\" has invalid value" \ ] From 472cf939eacff4dc12a769948c9156f88a54e673 Mon Sep 17 00:00:00 2001 From: Kaleb Hornsby Date: Thu, 7 Nov 2013 16:37:34 -0500 Subject: [PATCH 0254/1271] Added WAI-ARIA attributes Added all WAI-ARIA aria-* and role attributes. http://www.w3.org/TR/wai-aria/states_and_properties#state_prop_def These are used to create accessible web applications. --- syntax_checkers/html/tidy.vim | 39 ++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/syntax_checkers/html/tidy.vim b/syntax_checkers/html/tidy.vim index 03ab68ef4..0f4ad539b 100644 --- a/syntax_checkers/html/tidy.vim +++ b/syntax_checkers/html/tidy.vim @@ -78,7 +78,44 @@ let s:ignore_errors = [ \ "inserting missing 'title' element", \ "attribute \"[+", \ "unescaped & or unknown entity", - \ " attribute \"type\" has invalid value" + \ " attribute \"type\" has invalid value", + \ "proprietary attribute \"role\"", + \ "proprietary attribute \"aria-activedescendant\"", + \ "proprietary attribute \"aria-atomic\"", + \ "proprietary attribute \"aria-autocomplete\"", + \ "proprietary attribute \"aria-busy\"", + \ "proprietary attribute \"aria-checked\"", + \ "proprietary attribute \"aria-controls\"", + \ "proprietary attribute \"aria-describedby\"", + \ "proprietary attribute \"aria-disabled\"", + \ "proprietary attribute \"aria-dropeffect\"", + \ "proprietary attribute \"aria-expanded\"", + \ "proprietary attribute \"aria-flowto\"", + \ "proprietary attribute \"aria-grabbed\"", + \ "proprietary attribute \"aria-haspopup\"", + \ "proprietary attribute \"aria-hidden\"", + \ "proprietary attribute \"aria-invalid\"", + \ "proprietary attribute \"aria-label\"", + \ "proprietary attribute \"aria-labelledby\"", + \ "proprietary attribute \"aria-level\"", + \ "proprietary attribute \"aria-live\"", + \ "proprietary attribute \"aria-multiline\"", + \ "proprietary attribute \"aria-multiselectable\"", + \ "proprietary attribute \"aria-orientation\"", + \ "proprietary attribute \"aria-owns\"", + \ "proprietary attribute \"aria-posinset\"", + \ "proprietary attribute \"aria-pressed\"", + \ "proprietary attribute \"aria-readonly\"", + \ "proprietary attribute \"aria-relevant\"", + \ "proprietary attribute \"aria-relevant\"", + \ "proprietary attribute \"aria-required\"", + \ "proprietary attribute \"aria-selected\"", + \ "proprietary attribute \"aria-setsize\"", + \ "proprietary attribute \"aria-sort\"", + \ "proprietary attribute \"aria-valuemax\"", + \ "proprietary attribute \"aria-valuemin\"", + \ "proprietary attribute \"aria-valuenow\"", + \ "proprietary attribute \"aria-valuetext\"" \ ] let s:blocklevel_tags = [ From c73fc8cd8fe59403daa249a3a62f5eaafe0776de Mon Sep 17 00:00:00 2001 From: Kaleb Hornsby Date: Thu, 7 Nov 2013 16:39:10 -0500 Subject: [PATCH 0255/1271] Remove hgroup, it is non-conforming http://www.w3.org/html/wg/drafts/html/master/obsolete.html#hgroup --- syntax_checkers/html/tidy.vim | 1 - 1 file changed, 1 deletion(-) diff --git a/syntax_checkers/html/tidy.vim b/syntax_checkers/html/tidy.vim index 03ab68ef4..d5603cf1c 100644 --- a/syntax_checkers/html/tidy.vim +++ b/syntax_checkers/html/tidy.vim @@ -86,7 +86,6 @@ let s:blocklevel_tags = [ \ "section", \ "article", \ "aside", - \ "hgroup", \ "header", \ "footer", \ "nav", From 5b3c17068bb9aaaf8d69ea5ba39134fb2c210871 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 8 Nov 2013 10:45:15 +0200 Subject: [PATCH 0256/1271] More typos. --- syntax_checkers/css/prettycss.vim | 2 +- syntax_checkers/html/w3.vim | 2 +- syntax_checkers/python/pep257.vim | 2 +- syntax_checkers/python/pep8.vim | 2 +- syntax_checkers/python/pylama.vim | 2 +- syntax_checkers/python/pylint.vim | 2 +- syntax_checkers/rst/rst2pseudoxml.vim | 2 +- syntax_checkers/text/atdtool.vim | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/syntax_checkers/css/prettycss.vim b/syntax_checkers/css/prettycss.vim index 570d4f3b0..954414864 100644 --- a/syntax_checkers/css/prettycss.vim +++ b/syntax_checkers/css/prettycss.vim @@ -43,7 +43,7 @@ function! SyntaxCheckers_css_prettycss_GetLocList() dict \ 'defaults': {'bufnr': bufnr("")}, \ 'postprocess': ['sort'] }) - for n in loclist + for e in loclist let e["text"] .= ')' endfor diff --git a/syntax_checkers/html/w3.vim b/syntax_checkers/html/w3.vim index ee478da1b..59747b025 100644 --- a/syntax_checkers/html/w3.vim +++ b/syntax_checkers/html/w3.vim @@ -52,7 +52,7 @@ function! SyntaxCheckers_html_w3_GetLocList() dict \ 'defaults': {'bufnr': bufnr("")}, \ 'returns': [0] }) - for n in loclist + for e in loclist let e['text'] = substitute(e['text'], '\m\\\([\"]\)', '\1', 'g') endfor diff --git a/syntax_checkers/python/pep257.vim b/syntax_checkers/python/pep257.vim index c7e388bbb..8e2c56cac 100644 --- a/syntax_checkers/python/pep257.vim +++ b/syntax_checkers/python/pep257.vim @@ -31,7 +31,7 @@ function! SyntaxCheckers_python_pep257_GetLocList() dict \ 'postprocess': ['compressWhitespace'] }) " pep257 outputs byte offsets rather than column numbers - for n in loclist + for e in loclist let e['col'] = get(e, 'col', 0) + 1 endfor diff --git a/syntax_checkers/python/pep8.vim b/syntax_checkers/python/pep8.vim index 9041ffff3..2e19a162d 100644 --- a/syntax_checkers/python/pep8.vim +++ b/syntax_checkers/python/pep8.vim @@ -27,7 +27,7 @@ function! SyntaxCheckers_python_pep8_GetLocList() dict \ 'errorformat': errorformat, \ 'subtype': 'Style' }) - for n in loclist + for e in loclist let e['type'] = e['text'] =~? '^W' ? 'W' : 'E' endfor diff --git a/syntax_checkers/python/pylama.vim b/syntax_checkers/python/pylama.vim index acd5689d1..c10e34d2f 100644 --- a/syntax_checkers/python/pylama.vim +++ b/syntax_checkers/python/pylama.vim @@ -32,7 +32,7 @@ function! SyntaxCheckers_python_pylama_GetLocList() dict \ 'postprocess': ['sort'] }) " adjust for weirdness in each checker - for n in loclist + for e in loclist let e['type'] = match(['R', 'C', 'W'], e['text'][0]) >= 0 ? 'W' : 'E' if e['text'] =~# '\v\[%(mccabe|pep257|pylint)\]$' if has_key(e, 'col') diff --git a/syntax_checkers/python/pylint.vim b/syntax_checkers/python/pylint.vim index c201cbd39..808866dc0 100644 --- a/syntax_checkers/python/pylint.vim +++ b/syntax_checkers/python/pylint.vim @@ -32,7 +32,7 @@ function! SyntaxCheckers_python_pylint_GetLocList() dict \ 'errorformat': errorformat, \ 'postprocess': ['sort'] }) - for n in loclist + for e in loclist let type = e['text'][1] if type =~# '\m^[EF]' let e['type'] = 'E' diff --git a/syntax_checkers/rst/rst2pseudoxml.vim b/syntax_checkers/rst/rst2pseudoxml.vim index 4686cfd55..0aa3b8522 100644 --- a/syntax_checkers/rst/rst2pseudoxml.vim +++ b/syntax_checkers/rst/rst2pseudoxml.vim @@ -39,7 +39,7 @@ function! SyntaxCheckers_rst_rst2pseudoxml_GetLocList() dict \ 'makeprg': makeprg, \ 'errorformat': errorformat }) - for n in loclist + for e in loclist if e['type'] ==? 'S' let e['type'] = 'E' elseif e['type'] ==? 'I' diff --git a/syntax_checkers/text/atdtool.vim b/syntax_checkers/text/atdtool.vim index 63d27e0f0..c3d8ee1c4 100644 --- a/syntax_checkers/text/atdtool.vim +++ b/syntax_checkers/text/atdtool.vim @@ -37,7 +37,7 @@ function! SyntaxCheckers_text_atdtool_GetLocList() dict \ 'returns': [0], \ 'subtype': 'Style' }) - for n in loclist + for e in loclist let e['text'] = substitute(e['text'], '\m\n\s\+', ' | ', 'g') endfor From a4777e76c0083349fe37542eeecf84f76ab136ca Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 8 Nov 2013 11:11:34 +0200 Subject: [PATCH 0257/1271] New chacker cppcheck for C/C++. --- syntax_checkers/c/cppcheck.vim | 60 ++++++++++++++++++++++++++++++++ syntax_checkers/cpp/cppcheck.vim | 60 ++++++++++++++++++++++++++++++++ 2 files changed, 120 insertions(+) create mode 100644 syntax_checkers/c/cppcheck.vim create mode 100644 syntax_checkers/cpp/cppcheck.vim diff --git a/syntax_checkers/c/cppcheck.vim b/syntax_checkers/c/cppcheck.vim new file mode 100644 index 000000000..96a4f9477 --- /dev/null +++ b/syntax_checkers/c/cppcheck.vim @@ -0,0 +1,60 @@ +"============================================================================ +"File: cppcheck.vim +"Description: Syntax checking plugin for syntastic.vim using cppcheck.pl +"Maintainer: LCD 47 +"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. +"============================================================================ +" +" The setting 'g:syntastic_cppcheck_config_file' allows you to define a file +" that contains additional compiler arguments like include directories or +" CFLAGS. The file is expected to contain one option per line. If none is +" given the filename defaults to '.syntastic_cppcheck_config': +" +" let g:syntastic_cppcheck_config_file = '.config' + +if exists("g:loaded_syntastic_c_cppcheck_checker") + finish +endif +let g:loaded_syntastic_c_cppcheck_checker = 1 + +if !exists('g:syntastic_cppcheck_config_file') + let g:syntastic_cppcheck_config_file = '.syntastic_cppcheck_config' +endif + +function! SyntaxCheckers_c_cppcheck_GetLocList() dict + let makeprg = self.makeprgBuild({ + \ 'args': '-q ' . syntastic#c#ReadConfig(g:syntastic_cppcheck_config_file), + \ 'post_args': '--enable=style' }) + + let errorformat = + \ '[%f:%l]: (%trror) %m,' . + \ '[%f:%l]: (%tarning) %m,' . + \ '[%f:%l]: (%ttyle) %m,' . + \ '[%f:%l]: (%terformance) %m,' . + \ '[%f:%l]: (%tortability) %m,' . + \ '[%f:%l]: (%tnformation) %m,' . + \ '[%f:%l]: (%tnconclusive) %m,' . + \ '%-G%.%#' + + let loclist = SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'returns': [0] }) + + for e in loclist + if e['type'] =~? '\m^[SPI]' + let e['type'] = 'w' + let e['subtype'] = 'Style' + endif + endfor + + return loclist +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'c', + \ 'name': 'cppcheck'}) diff --git a/syntax_checkers/cpp/cppcheck.vim b/syntax_checkers/cpp/cppcheck.vim new file mode 100644 index 000000000..091caa89b --- /dev/null +++ b/syntax_checkers/cpp/cppcheck.vim @@ -0,0 +1,60 @@ +"============================================================================ +"File: cppcheck.vim +"Description: Syntax checking plugin for syntastic.vim using cppcheck.pl +"Maintainer: LCD 47 +"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. +"============================================================================ +" +" The setting 'g:syntastic_cppcheck_config_file' allows you to define a file +" that contains additional compiler arguments like include directories or +" CFLAGS. The file is expected to contain one option per line. If none is +" given the filename defaults to '.syntastic_cppcheck_config': +" +" let g:syntastic_cppcheck_config_file = '.config' + +if exists("g:loaded_syntastic_cpp_cppcheck_checker") + finish +endif +let g:loaded_syntastic_cpp_cppcheck_checker = 1 + +if !exists('g:syntastic_cppcheck_config_file') + let g:syntastic_cppcheck_config_file = '.syntastic_cppcheck_config' +endif + +function! SyntaxCheckers_cpp_cppcheck_GetLocList() dict + let makeprg = self.makeprgBuild({ + \ 'args': '-q ' . syntastic#c#ReadConfig(g:syntastic_cppcheck_config_file), + \ 'post_args': '--enable=style' }) + + let errorformat = + \ '[%f:%l]: (%trror) %m,' . + \ '[%f:%l]: (%tarning) %m,' . + \ '[%f:%l]: (%ttyle) %m,' . + \ '[%f:%l]: (%terformance) %m,' . + \ '[%f:%l]: (%tortability) %m,' . + \ '[%f:%l]: (%tnformation) %m,' . + \ '[%f:%l]: (%tnconclusive) %m,' . + \ '%-G%.%#' + + let loclist = SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'returns': [0] }) + + for e in loclist + if e['type'] =~? '\m^[SPI]' + let e['type'] = 'w' + let e['subtype'] = 'Style' + endif + endfor + + return loclist +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'cpp', + \ 'name': 'cppcheck'}) From 0161889071c3fde8d577071e3164b5df446bd328 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 8 Nov 2013 17:28:41 +0200 Subject: [PATCH 0258/1271] Add default checkers for all filetypes. --- plugin/syntastic/registry.vim | 88 ++++++++++++++++++++++++++++------- 1 file changed, 70 insertions(+), 18 deletions(-) diff --git a/plugin/syntastic/registry.vim b/plugin/syntastic/registry.vim index e17884772..d718ef05e 100644 --- a/plugin/syntastic/registry.vim +++ b/plugin/syntastic/registry.vim @@ -4,24 +4,76 @@ endif let g:loaded_syntastic_registry = 1 let s:defaultCheckers = { - \ 'c': ['gcc'], - \ 'coffee': ['coffee', 'coffeelint'], - \ 'cpp': ['gcc'], - \ 'css': ['csslint', 'phpcs'], - \ 'go': ['go'], - \ 'html': ['tidy'], - \ 'java': ['javac'], - \ 'javascript': ['jshint', 'jslint'], - \ 'json': ['jsonlint', 'jsonval'], - \ 'objc': ['gcc'], - \ 'objcpp': ['gcc'], - \ 'perl': ['perl', 'perlcritic'], - \ 'php': ['php', 'phpcs', 'phpmd'], - \ 'puppet': ['puppet', 'puppetlint'], - \ 'python': ['python', 'flake8', 'pylint'], - \ 'ruby': ['mri'], - \ 'sh': ['sh'], - \ 'tex': ['lacheck'] + \ 'ada': ['gcc'], + \ 'applescript': ['osacompile'], + \ 'asciidoc': ['asciidoc'], + \ 'c': ['gcc'], + \ 'chef': ['foodcritic'], + \ 'co': ['coco'], + \ 'cobol': ['cobc'], + \ 'coffee': ['coffee', 'coffeelint'], + \ 'coq': ['coqtop'], + \ 'cpp': ['gcc'], + \ 'cs': ['mcs'], + \ 'css': ['csslint', 'phpcs'], + \ 'cucumber': ['cucumber'], + \ 'cuda': ['nvcc'], + \ 'd': ['dmd'], + \ 'dart': ['dart_analyzer'], + \ 'docbk': ['xmllint'], + \ 'dustjs': ['swiffer'], + \ 'elixir': ['elixir'], + \ 'erlang': ['escript'], + \ 'eruby': ['ruby'], + \ 'fortran': ['gfortran'], + \ 'go': ['go'], + \ 'haml': ['haml'], + \ 'handlebars': ['handlebars'], + \ 'haskell': ['ghc-mod', 'hdevtools', 'hlint'], + \ 'haxe': ['haxe'], + \ 'hss': ['hss'], + \ 'html': ['tidy'], + \ 'java': ['javac'], + \ 'javascript': ['jshint', 'jslint'], + \ 'json': ['jsonlint', 'jsonval'], + \ 'less': ['lessc'], + \ 'lisp': ['clisp'], + \ 'llvm': ['llvm'], + \ 'lua': ['luac'], + \ 'matlab': ['mlint'], + \ 'nasm': ['nasm'], + \ 'nroff': ['mandoc'], + \ 'objc': ['gcc'], + \ 'objcpp': ['gcc'], + \ 'ocaml': ['camlp4o'], + \ 'perl': ['perl', 'perlcritic'], + \ 'php': ['php', 'phpcs', 'phpmd'], + \ 'pod': ['podchecker'], + \ 'puppet': ['puppet', 'puppetlint'], + \ 'python': ['python', 'flake8', 'pylint'], + \ 'rst': ['rst2pseudoxml'], + \ 'ruby': ['mri'], + \ 'rust': ['rustc'], + \ 'sass': ['sass'], + \ 'scala': ['fsc', 'scalac'], + \ 'scss': ['sass', 'scss_lint'], + \ 'sh': ['sh'], + \ 'slim': ['slimrb'], + \ 'tcl': ['nagelfar'], + \ 'tex': ['lacheck', 'chktex'], + \ 'text': ['atdtool'], + \ 'twig': ['twiglint'], + \ 'typescript': ['tsc'], + \ 'vala': ['valac'], + \ 'verilog': ['verilator'], + \ 'vhdl': ['ghdl'], + \ 'xhtml': ['tidy'], + \ 'xml': ['xmllint'], + \ 'xslt': ['xmllint'], + \ 'yaml': ['jsyaml'], + \ 'z80': ['z80syntaxchecker'], + \ 'zpt': ['zptlint'], + \ 'zsh': ['zsh'] \ } let s:defaultFiletypeMap = { From 84d19e03fdb143b95c34490d200ff6b193c1625e Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 8 Nov 2013 17:29:33 +0200 Subject: [PATCH 0259/1271] Bump version number. --- plugin/syntastic.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index e2a18811a..681eba82e 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -1,7 +1,7 @@ "============================================================================ "File: syntastic.vim "Description: Vim plugin for on the fly syntax checking. -"Version: 3.2.0-pre +"Version: 3.2.0 "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 From d1ae69e02d2bba3be50cac234fbe4f3665a07e87 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Sat, 9 Nov 2013 10:29:44 +0200 Subject: [PATCH 0260/1271] New checker eslint for JavaScript (@maksimr). --- syntax_checkers/javascript/eslint.vim | 43 +++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 syntax_checkers/javascript/eslint.vim diff --git a/syntax_checkers/javascript/eslint.vim b/syntax_checkers/javascript/eslint.vim new file mode 100644 index 000000000..2ad5ac39c --- /dev/null +++ b/syntax_checkers/javascript/eslint.vim @@ -0,0 +1,43 @@ +"============================================================================ +"File: eslint.vim +"Description: Javascript syntax checker - using eslint +"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. +"============================================================================ + +if exists('g:loaded_syntastic_javascript_eslint_checker') + finish +endif +let g:loaded_syntastic_javascript_eslint_checker=1 + +if !exists('g:syntastic_javascript_eslint_conf') + let g:syntastic_javascript_eslint_conf = '' +endif + +function! SyntaxCheckers_javascript_eslint_GetLocList() dict + let makeprg = self.makeprgBuild({ + \ 'args': !empty(g:syntastic_javascript_eslint_conf) ? ' --config ' . g:syntastic_javascript_eslint_conf : '' }) + + let errorformat = + \ '%E%f: line %l\, col %c\, Error - %m' + + let loclist = SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'postprocess': ['sort'] }) + + for e in loclist + let e['col'] += 1 + endfor + + return loclist +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'javascript', + \ 'name': 'eslint'}) + From 137a7e964a89ce23d20542d510c3ff24c032fbb5 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Mon, 11 Nov 2013 10:54:35 +0200 Subject: [PATCH 0261/1271] Update docs to describe the new checker infrastructure. --- doc/syntastic.txt | 87 ++++++++++++++++++++++++----------------------- 1 file changed, 44 insertions(+), 43 deletions(-) diff --git a/doc/syntastic.txt b/doc/syntastic.txt index 435cb3c2f..6cba842cc 100644 --- a/doc/syntastic.txt +++ b/doc/syntastic.txt @@ -54,9 +54,9 @@ syntax checker plugins are defined on a per-filetype basis where each one wraps up an external syntax checking program. The core script delegates off to these plugins and uses their output to provide the syntastic functionality. -Take a look in the syntax_checkers directory for a list of supported filetypes -and checkers. +Take a look at the wiki for a list of supported filetypes and checkers: + https://github.com/scrooloose/syntastic/wiki/Syntax-Checkers ============================================================================== 2. Functionality provided *syntastic-functionality* @@ -85,9 +85,9 @@ To use the statusline flag, this must appear in your |'statusline'| setting > %{SyntasticStatuslineFlag()} < Something like this could be more useful: > - set statusline+=%#warningmsg# - set statusline+=%{SyntasticStatuslineFlag()} - set statusline+=%* + set statusline += %#warningmsg# + set statusline += %{SyntasticStatuslineFlag()} + set statusline += %* < When syntax errors are detected a flag will be shown. The content of the flag is derived from the |syntastic_stl_format| option @@ -170,7 +170,7 @@ Resets the list of errors and turns off all error notifiers. Default: 0 If enabled, syntastic will do syntax checks when buffers are first loaded as well as on saving > - let g:syntastic_check_on_open=1 + let g:syntastic_check_on_open = 1 < *'syntastic_check_on_wq'* @@ -178,7 +178,7 @@ Default: 1 Normally syntastic runs syntax checks whenever buffers are written to disk. If you want to skip these checks when you issue |:wq|, |:x|, and |:ZZ|, set this variable to 0. > - let g:syntastic_check_on_wq=0 + let g:syntastic_check_on_wq = 0 < *'syntastic_aggregate_errors'* @@ -187,7 +187,7 @@ When enabled, |:SyntasticCheck| runs all checkers that apply, then aggregates errors found by all checkers and displays them. When disabled, |:SyntasticCheck| runs each checker in turn, and stops to display the results the first time a checker finds any errors. > - let g:syntastic_aggregate_errors=1 + let g:syntastic_aggregate_errors = 1 < *'syntastic_id_checkers'* @@ -197,21 +197,21 @@ When results from multiple checkers are aggregated in a single error list a file with a composite filetype), it might not be immediately obvious which checker has produced a given error message. This variable instructs syntastic to label error messages with the names of the checkers that created them. > - let g:syntastic_id_checkers=0 + let g:syntastic_id_checkers = 0 < *'syntastic_echo_current_error'* Default: 1 If enabled, syntastic will echo the error associated with the current line to the command window. If multiple errors are found, the first will be used. > - let g:syntastic_echo_current_error=1 + let g:syntastic_echo_current_error = 1 < *'syntastic_enable_signs'* Default: 1 Use this option to tell syntastic whether to use the |:sign| interface to mark syntax errors: > - let g:syntastic_enable_signs=1 + let g:syntastic_enable_signs = 1 < *'syntastic_error_symbol'* *'syntastic_style_error_symbol'* @@ -224,8 +224,8 @@ error symobls can be customized: syntastic_style_warning_symbol - For style warnings, defaults to 'S>' Example: > - let g:syntastic_error_symbol='✗' - let g:syntastic_warning_symbol='⚠' + let g:syntastic_error_symbol = '✗' + let g:syntastic_warning_symbol = '⚠' < *'syntastic_enable_balloons'* @@ -247,13 +247,13 @@ errors (where possible). Highlighting can be turned off with the following > Default: 0 Enable this option to tell syntastic to always stick any detected errors into the loclist: > - let g:syntastic_always_populate_loc_list=1 + let g:syntastic_always_populate_loc_list = 1 < *'syntastic_auto_jump'* Default: 0 Enable this option if you want the cursor to jump to the first detected error when saving or opening a file: > - let g:syntastic_auto_jump=1 + let g:syntastic_auto_jump = 1 < *'syntastic_auto_loc_list'* @@ -262,23 +262,23 @@ Use this option to tell syntastic to automatically open and/or close the |location-list| (see |syntastic-error-window|). When set to 0 the error window will not be opened or closed automatically. > - let g:syntastic_auto_loc_list=0 + let g:syntastic_auto_loc_list = 0 < When set to 1 the error window will be automatically opened when errors are detected, and closed when none are detected. > - let g:syntastic_auto_loc_list=1 + let g:syntastic_auto_loc_list = 1 < When set to 2 the error window will be automatically closed when no errors are detected, but not opened automatically. > - let g:syntastic_auto_loc_list=2 + let g:syntastic_auto_loc_list = 2 < *'syntastic_loc_list_height'* Default: 10 Use this option to specify the height of the location lists that syntastic opens. > - let g:syntastic_loc_list_height=5 + let g:syntastic_loc_list_height = 5 < *'syntastic_ignore_files'* @@ -288,7 +288,7 @@ include in error lists. It has to be a list of |regular-expression| patterns. The full paths of files (see |::p|) are matched against these patterns, and the matches are case sensitive. Use |\c| if you need case insensitive patterns. > - let g:syntastic_ignore_files=['^/usr/include/', '\c\.h$'] + let g:syntastic_ignore_files = ['^/usr/include/', '\c\.h$'] < *'syntastic_filetype_map'* @@ -347,7 +347,7 @@ this option has the following effects: there's at least one error, whereupon both errors and warnings are displayed > - let g:syntastic_quiet_warnings=1 + let g:syntastic_quiet_warnings = 1 < *'syntastic_stl_format'* @@ -433,7 +433,7 @@ native python checker. Some filetypes, like PHP, have style checkers as well as syntax checkers. These can be chained together like this: > - let g:syntastic_php_checkers=['php', 'phpcs', 'phpmd']` + let g:syntastic_php_checkers = ['php', 'phpcs', 'phpmd'] < This is telling syntastic to run the 'php' checker first, and if no errors are found, run 'phpcs', and then 'phpmd'. @@ -441,41 +441,42 @@ found, run 'phpcs', and then 'phpmd'. ------------------------------------------------------------------------------ 5.2 Configuring specific checkers *syntastic-config-makeprg* -Most checkers use the 'syntastic#makeprg#build()' function and provide many -options by default - in fact you can customise every part of the command -that gets called. +Most checkers use the 'makeprgBuild()' function and provide many options by +default - in fact you can customise every part of the command that gets called. -Checkers that use 'syntastic#makeprg#build()' look like this: > - let makeprg = syntastic#makeprg#build({ - \ 'exe': 'ruby', +Checkers that use 'makeprgBuild()' construct a 'makeprg' like this: > + let makeprg = self.makeprgBuild({ + \ 'exe': self.getExec(), \ 'args': '-a -b -c', \ 'post_args': '--more --args', - \ 'tail': '> /tmp/output', - \ 'checker': self }) + \ 'tail': '> /tmp/output' }) < -The 'checker' argument is mandatory. All other arguments above are optional, -and can be overriden by setting global variables - even parameters not -specified in the call to syntastic#makeprg#build(). If 'exe' is the same as -the name of the checker, it may be omitted. +The result is a 'makeprg' of the form: > + +< + +All arguments above are optional, and can be overriden by setting global +variables - even parameters not specified in the call to makeprgBuild(). If +'exe' is the same as the checker 'exec' attribute, it may be omitted. E.g. To override the checker exe above, you could do this: > - let g:syntastic_ruby_mri_exe="another_ruby_checker_exe.rb" + let g:syntastic_ruby_mri_exe = "another_ruby_checker_exe.rb" < To override the args and the tail: > - let g:syntastic_ruby_mri_args="--my --args --here" - let g:syntastic_ruby_mri_tail="> /tmp/my-output-file-biatch" + let g:syntastic_ruby_mri_args = "--my --args --here" + let g:syntastic_ruby_mri_tail = "> /tmp/my-output-file-biatch" < The general form of the override options is: > - syntastic_[filetype]_[subchecker]_[option-name] + syntastic___ < -For checkers that do not use the 'syntastic#makeprg#build()' function you -will have to look at the source code of the checker in question. If there are -specific options that can be set, these are usually documented in the wiki: +For checkers that do not use the 'makeprgBuild()' function you will have to +look at the source code of the checker in question. If there are specific +options that can be set, these are usually documented in the wiki: - https://github.com/scrooloose/syntastic/wiki/Syntaxcheckers + https://github.com/scrooloose/syntastic/wiki/Syntax-Checkers ============================================================================== 6. Notes *syntastic-notes* @@ -523,7 +524,7 @@ The core maintainers of syntastic are: Gregor Uhlenheuer (github: kongo2002) LCD 047 (github: lcd047) -Find the latest version of syntastic here: +Find the latest version of syntastic at: http://github.com/scrooloose/syntastic From f6935e13be9e5899b04b4963f1cc0c55034e6f69 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Mon, 11 Nov 2013 10:55:12 +0200 Subject: [PATCH 0262/1271] Bump version number. --- plugin/syntastic.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 681eba82e..415552b78 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -1,7 +1,7 @@ "============================================================================ "File: syntastic.vim "Description: Vim plugin for on the fly syntax checking. -"Version: 3.2.0 +"Version: 3.3.0-pre "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 From f3d99319faf1afac78790ad2d8ce464621b7c905 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Mon, 11 Nov 2013 18:24:36 +0200 Subject: [PATCH 0263/1271] Fix luac highlighting. --- plugin/syntastic/highlighting.vim | 2 +- syntax_checkers/lua/luac.vim | 23 +++++++++++++---------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/plugin/syntastic/highlighting.vim b/plugin/syntastic/highlighting.vim index e04e6cc55..72671ba86 100644 --- a/plugin/syntastic/highlighting.vim +++ b/plugin/syntastic/highlighting.vim @@ -32,7 +32,7 @@ function! g:SyntasticHighlightingNotifier.refresh(loclist) let buf = bufnr('') let issues = filter(a:loclist.filteredRaw(), 'v:val["bufnr"] == buf') for item in issues - let group = item['type'] == 'E' ? 'SyntasticError' : 'SyntasticWarning' + let group = item['type'] ==? 'E' ? 'SyntasticError' : 'SyntasticWarning' " The function `Syntastic_{filetype}_{checker}_GetHighlightRegex` is " used to override default highlighting. diff --git a/syntax_checkers/lua/luac.vim b/syntax_checkers/lua/luac.vim index 10c4d1b78..429b6e4e0 100644 --- a/syntax_checkers/lua/luac.vim +++ b/syntax_checkers/lua/luac.vim @@ -16,24 +16,27 @@ endif let g:loaded_syntastic_lua_luac_checker=1 function! SyntaxCheckers_lua_luac_GetHighlightRegex(pos) - let near = matchstr(a:pos['text'], "\\mnear '[^']\\+'") let result = '' + let near = matchstr(a:pos['text'], '\mnear ''\zs[^'']\+\ze''') if len(near) > 0 - let near = split(near, "'")[1] if near == '' let p = getpos('$') let a:pos['lnum'] = p[1] let a:pos['col'] = p[2] - let result = '\%'.p[2].'c' + let result = '\%' . p[2] . 'c' else - let result = '\V'.near - endif - let open = matchstr(a:pos['text'], "\\m(to close '[^']\\+' at line [0-9]\\+)") - if len(open) > 0 - let oline = split(open, "'")[1:2] - let line = 0+strpart(oline[1], 9) - call matchadd('SpellCap', '\%'.line.'l\V'.oline[0]) + let result = '\V' . near endif + + " XXX the following piece of code is evil, and is likely to break + " in future versions of syntastic; enable it at your own risk :) + + "let open = matchstr(a:pos['text'], '\m(to close ''\zs[^'']\+\ze'' at line [0-9]\+)') + "if len(open) > 0 + " let line = str2nr(matchstr(a:pos['text'], '\m(to close ''[^'']\+'' at line \zs[0-9]\+\ze)')) + " let group = a:pos['type'] ==? 'E' ? 'SyntasticError' : 'SyntasticWarning' + " call matchadd(group, '\%' . line . 'l\V' . open) + "endif endif return result endfunction From 0ba3bc4568bfeac1a5acc730a3a95683fc807497 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Mon, 11 Nov 2013 19:02:09 +0200 Subject: [PATCH 0264/1271] Update errorformat for fsc and scalac. --- syntax_checkers/scala/fsc.vim | 5 ++++- syntax_checkers/scala/scalac.vim | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/syntax_checkers/scala/fsc.vim b/syntax_checkers/scala/fsc.vim index d00e9c21e..e5f44c319 100644 --- a/syntax_checkers/scala/fsc.vim +++ b/syntax_checkers/scala/fsc.vim @@ -27,7 +27,10 @@ function! SyntaxCheckers_scala_fsc_GetLocList() dict \ 'args': '-Ystop-after:parser ' . g:syntastic_scala_options, \ 'fname': syntastic#util#shexpand('%:p') }) - let errorformat = '%f:%l: %trror: %m' + let errorformat = + \ '%E%f:%l: %trror: %m,' . + \ '%Z%p^,' . + \ '%-G%.%#' return SyntasticMake({ \ 'makeprg': makeprg, diff --git a/syntax_checkers/scala/scalac.vim b/syntax_checkers/scala/scalac.vim index 67a4073ea..eaf4e719c 100644 --- a/syntax_checkers/scala/scalac.vim +++ b/syntax_checkers/scala/scalac.vim @@ -23,7 +23,10 @@ function! SyntaxCheckers_scala_scalac_GetLocList() dict let makeprg = self.makeprgBuild({ \ 'args': '-Ystop-after:parser ' . g:syntastic_scala_options }) - let errorformat = '%f:%l: %trror: %m' + let errorformat = + \ '%E%f:%l: %trror: %m,' . + \ '%Z%p^,' . + \ '%-G%.%#' return SyntasticMake({ \ 'makeprg': makeprg, From 011cb096983785b2aced45815c2ab33708482552 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Mon, 11 Nov 2013 22:14:05 +0200 Subject: [PATCH 0265/1271] Minor cleanup. --- autoload/syntastic/c.vim | 4 ++-- plugin/syntastic/makeprg_builder.vim | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/autoload/syntastic/c.vim b/autoload/syntastic/c.vim index bab36862f..1914b0f9f 100644 --- a/autoload/syntastic/c.vim +++ b/autoload/syntastic/c.vim @@ -56,7 +56,7 @@ function! syntastic#c#ReadConfig(file) endif endfor - return join(map(parameters, 'syntastic#util#shescape(fnameescape(v:val))'), ' ') + return join(map(parameters, 'syntastic#util#shescape(fnameescape(v:val))')) endfunction " GetLocList() for C-like compilers @@ -178,7 +178,7 @@ function! s:GetIncludeDirs(filetype) call extend(include_dirs, g:syntastic_{a:filetype}_include_dirs) endif - return join(map(syntastic#util#unique(include_dirs), 'syntastic#util#shescape(fnameescape("-I" . v:val))'), ' ') + return join(map(syntastic#util#unique(include_dirs), 'syntastic#util#shescape(fnameescape("-I" . v:val))')) endfunction " search the first 100 lines for include statements that are diff --git a/plugin/syntastic/makeprg_builder.vim b/plugin/syntastic/makeprg_builder.vim index 2b11037b7..d38bd59b8 100644 --- a/plugin/syntastic/makeprg_builder.vim +++ b/plugin/syntastic/makeprg_builder.vim @@ -27,7 +27,7 @@ function! g:SyntasticMakeprgBuilder.New(checker, exe, args, fname, post_args, ta endfunction function! g:SyntasticMakeprgBuilder.makeprg() - return join([self.exe(), self.args(), self.fname(), self.post_args(), self.tail()]) + return join(filter([self.exe(), self.args(), self.fname(), self.post_args(), self.tail()], '!empty(v:val)')) endfunction function! g:SyntasticMakeprgBuilder.exe() From 50ca7d90828559a806577b34f1a14a7dfb04e643 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Tue, 12 Nov 2013 20:44:32 +0200 Subject: [PATCH 0266/1271] Javac: fix path munging under Cygwin. --- syntax_checkers/java/javac.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntax_checkers/java/javac.vim b/syntax_checkers/java/javac.vim index 5fdae9ddb..9a579df4d 100644 --- a/syntax_checkers/java/javac.vim +++ b/syntax_checkers/java/javac.vim @@ -41,7 +41,7 @@ if !exists("g:syntastic_java_javac_delete_output") endif function! s:CygwinPath(path) - return substitute(system("cygpath -m ".a:path), '\m\%x00', '', 'g') + return substitute(system("cygpath -m " . a:path), '\n', '', 'g') endfunction if !exists("g:syntastic_java_javac_temp_dir") From ab137be05a265b6553f6a82a728f8555aa5209db Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Wed, 13 Nov 2013 09:05:06 +0200 Subject: [PATCH 0267/1271] Update: shallcheck no longer has a jsoncheck. --- syntax_checkers/sh/shellcheck.vim | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/syntax_checkers/sh/shellcheck.vim b/syntax_checkers/sh/shellcheck.vim index c05d426d0..bb19c842d 100644 --- a/syntax_checkers/sh/shellcheck.vim +++ b/syntax_checkers/sh/shellcheck.vim @@ -18,7 +18,7 @@ function! SyntaxCheckers_sh_shellcheck_Preprocess(json) endfunction function! SyntaxCheckers_sh_shellcheck_GetLocList() dict - let makeprg = self.getExec() . ' < ' . syntastic#util#shexpand('%') + let makeprg = self.makeprgBuild({ 'args': '-f json' }) let errorformat = '%t:%l:%v:%m' @@ -27,7 +27,7 @@ function! SyntaxCheckers_sh_shellcheck_GetLocList() dict \ 'errorformat': errorformat, \ 'preprocess': 'SyntaxCheckers_sh_shellcheck_Preprocess', \ 'defaults': {'bufnr': bufnr("")}, - \ 'returns': [0] }) + \ 'returns': [0, 1] }) for e in loclist if e['type'] ==? 's' @@ -41,5 +41,4 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'sh', - \ 'name': 'shellcheck', - \ 'exec': 'jsoncheck' }) + \ 'name': 'shellcheck' }) From c63967823d1022164612c80594b982549bac0eac Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Wed, 13 Nov 2013 10:58:33 +0200 Subject: [PATCH 0268/1271] Detailed debugging. New variables: g:syntastic_debug_file, the name of a file where to write debugging messages, in addition to adding them to the message history. The old g:syntastic_debug is now a sum of flags: * 1 - trace checker calls * 2 - dump loclists * 4 - trace notifiers * 8 - trace autocommands * 16 - dump syntastic variables (not implemented yet) --- autoload/syntastic/util.vim | 57 +++++++++++++++++++++-- doc/syntastic.txt | 18 +++++++- plugin/syntastic.vim | 75 ++++++++++++++++++++++++------- plugin/syntastic/autoloclist.vim | 2 + plugin/syntastic/balloons.vim | 2 + plugin/syntastic/checker.vim | 3 +- plugin/syntastic/cursor.vim | 2 + plugin/syntastic/highlighting.vim | 2 + plugin/syntastic/loclist.vim | 2 + plugin/syntastic/notifiers.vim | 2 + plugin/syntastic/signs.vim | 1 + 11 files changed, 145 insertions(+), 21 deletions(-) diff --git a/autoload/syntastic/util.vim b/autoload/syntastic/util.vim index 10c01303c..d49d8d6e3 100644 --- a/autoload/syntastic/util.vim +++ b/autoload/syntastic/util.vim @@ -225,9 +225,60 @@ function! syntastic#util#redrawHandler() endif endfunction -function! syntastic#util#debug(msg) - if g:syntastic_debug - echomsg "syntastic: debug: " . a:msg +function! syntastic#util#debug(level, msg, ...) + " poor man's bit test for bit N, assuming a:level == 2**N + if (g:syntastic_debug / a:level) % 2 + if has('reltime') + let leader = 'syntastic: ' . split(reltimestr(reltime(g:syntastic_start)))[0] . ': ' + else + let leader = 'syntastic: debug: ' + endif + if exists("g:syntastic_debug_file") + try + execute 'redir >> ' . fnameescape(expand(g:syntastic_debug_file)) + catch /^Vim\%((\a\+)\)\=:/ + unlet g:syntastic_debug_file + silent! redir END + endtry + endif + + if a:0 > 0 + " filter out dictionary functions + echomsg leader . a:msg . + \ strtrans(string(type(a:1) == type({}) || type(a:1) == type([]) ? + \ filter(copy(a:1), 'type(v:val) != type(function("tr"))') : a:1)) + else + echomsg leader . a:msg + endif + + if exists("g:syntastic_debug_file") + silent! redir END + endif + endif +endfunction + +function! syntastic#util#showVariables(level, names) + let vlist = type(a:names) == type("") ? [a:names] : a:names + for name in vlist + let vals = [] + if exists('g:' . name) + call add(vals, 'g:' . name . ' = ' . strtrans(string(g:{name}))) + endif + if exists('b:' . name) + call add(vals, 'b:' . name . ' = ' . strtrans(string(b:{name}))) + endif + + if !empty(vals) + call syntastic#util#debug(a:level, join(vals, ', ')) + endif + endfor +endfunction + +function! syntastic#util#showOptions(level, names) + let vlist = type(a:names) == type("") ? [a:names] : a:names + if !empty(vlist) + call map(vlist, "'&' . v:val . ' = ' . strtrans(string(eval('&' . v:val)))") + call syntastic#util#debug(a:level, join(vlist, ', ')) endif endfunction diff --git a/doc/syntastic.txt b/doc/syntastic.txt index 6cba842cc..7fd2dcf7c 100644 --- a/doc/syntastic.txt +++ b/doc/syntastic.txt @@ -398,12 +398,26 @@ if you actually need it. *'syntastic_debug'* Default: 0 -Set this to 1 to enable debugging: > +Set this to the sum of one or more of the following flags to enable +debugging: + + 1 - trace checker calls + 2 - dump loclists + 4 - trace notifiers + 8 - trace autocommands + +Example: > let g:syntastic_debug = 1 < -Checkers will then add debugging messages to Vim's |message-history|. You can +Syntastic will then add debugging messages to Vim's |message-history|. You can examine these messages with |:mes|. + *'syntastic_debug_file'* +Default: unset +When set, debugging messages are written to the file named by its value, in +addition to being added to Vim's |message-history|: > + let g:syntastic_debug_file = '~/syntastic.log' +< ============================================================================== 5. Checker Options *syntastic-checker-options* diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 415552b78..38c683173 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -15,6 +15,10 @@ if exists("g:loaded_syntastic_plugin") endif let g:loaded_syntastic_plugin = 1 +if has('reltime') + let g:syntastic_start = reltime() +endif + runtime! plugin/syntastic/*.vim let s:running_windows = has("win16") || has("win32") @@ -89,6 +93,13 @@ if !exists("g:syntastic_reuse_loc_lists") let g:syntastic_reuse_loc_lists = (v:version >= 704) endif +" debug constants +let g:SyntasticDebugTrace = 1 +let g:SyntasticDebugLoclist = 2 +let g:SyntasticDebugNotifications = 4 +let g:SyntasticDebugAutocommands = 8 +let g:SyntasticDebugVariables = 16 + let s:registry = g:SyntasticRegistry.Instance() let s:notifiers = g:SyntasticNotifiers.Instance() let s:modemap = g:SyntasticModeMap.Instance() @@ -119,12 +130,12 @@ highlight link SyntasticError SpellBad highlight link SyntasticWarning SpellCap augroup syntastic - autocmd BufReadPost * if g:syntastic_check_on_open | call s:UpdateErrors(1) | endif - autocmd BufWritePost * call s:UpdateErrors(1) + autocmd BufReadPost * call s:BufReadPostHook() + autocmd BufWritePost * call s:BufWritePostHook() autocmd BufWinEnter * call s:BufWinEnterHook() - " TODO: the next autocmd should be "autocmd BufWinLeave * if empty(&bt) | lclose | endif" + " TODO: the next autocmd should be "autocmd BufWinLeave * if empty(&buftype) | lclose | endif" " but in recent versions of Vim lclose can no longer be called from BufWinLeave autocmd BufEnter * call s:BufEnterHook() augroup END @@ -137,23 +148,45 @@ if v:version > 703 || (v:version == 703 && has('patch544')) endif +function! s:BufReadPostHook() + if g:syntastic_check_on_open + call syntastic#util#debug(g:SyntasticDebugAutocommands, + \ 'autocmd: BufReadPost, buffer ' . bufnr("") . ' = ' . string(bufname(str2nr(bufnr(""))))) + call s:UpdateErrors(1) + endif +endfunction + +function! s:BufWritePostHook() + call syntastic#util#debug(g:SyntasticDebugAutocommands, + \ 'autocmd: BufWritePost, buffer ' . bufnr("") . ' = ' . string(bufname(str2nr(bufnr(""))))) + call s:UpdateErrors(1) +endfunction + function! s:BufWinEnterHook() - if empty(&bt) + call syntastic#util#debug(g:SyntasticDebugAutocommands, + \ 'autocmd: BufWinEnter, buffer ' . bufnr("") . ' = ' . string(bufname(str2nr(bufnr("")))) . + \ ', &buftype = ' . string(&buftype)) + if empty(&buftype) let loclist = g:SyntasticLoclist.current() call s:notifiers.refresh(loclist) endif endfunction function! s:BufEnterHook() + call syntastic#util#debug(g:SyntasticDebugAutocommands, + \ 'autocmd: BufEnter, buffer ' . bufnr("") . ' = ' . string(bufname(str2nr(bufnr("")))) . + \ ', &buftype = ' . string(&buftype)) " TODO: at this point there is no b:syntastic_loclist let loclist = filter(getloclist(0), 'v:val["valid"] == 1') let buffers = syntastic#util#unique(map( loclist, 'v:val["bufnr"]' )) - if &bt=='quickfix' && !empty(loclist) && empty(filter( buffers, 'syntastic#util#bufIsActive(v:val)' )) + if &buftype == 'quickfix' && !empty(loclist) && empty(filter( buffers, 'syntastic#util#bufIsActive(v:val)' )) call g:SyntasticLoclistHide() endif endfunction function! s:QuitPreHook() + call syntastic#util#debug(g:SyntasticDebugAutocommands, + \ 'autocmd: QuitPre, buffer ' . bufnr("") . ' = ' . string(bufname(str2nr(bufnr(""))))) let b:syntastic_skip_checks = !g:syntastic_check_on_wq call g:SyntasticLoclistHide() endfunction @@ -207,10 +240,9 @@ function! s:CacheErrors(...) let active_checkers = 0 let names = [] - call syntastic#util#debug("CacheErrors: g:syntastic_aggregate_errors = " . g:syntastic_aggregate_errors) - if exists('b:syntastic_aggregate_errors') - call syntastic#util#debug("CacheErrors: b:syntastic_aggregate_errors = " . b:syntastic_aggregate_errors) - endif + call syntastic#util#showOptions(g:SyntasticDebugTrace, + \ ['shell', 'shellcmdflag', 'shellxquote', 'shellredir', 'shellslash']) + call syntastic#util#showVariables(g:SyntasticDebugTrace, 'syntastic_aggregate_errors') let aggregate_errors = \ exists('b:syntastic_aggregate_errors') ? b:syntastic_aggregate_errors : g:syntastic_aggregate_errors @@ -227,7 +259,7 @@ function! s:CacheErrors(...) for checker in checkers let active_checkers += 1 - call syntastic#util#debug("CacheErrors: Invoking checker: " . checker.getName()) + call syntastic#util#debug(g:SyntasticDebugTrace, "CacheErrors: Invoking checker: " . checker.getName()) let loclist = checker.getLocList() @@ -262,9 +294,11 @@ function! s:CacheErrors(...) if a:0 call syntastic#util#warn('checker ' . a:1 . ' is not active for filetype ' . &filetype) else - call syntastic#util#debug('no active checkers for filetype ' . &filetype) + call syntastic#util#debug(g:SyntasticDebugTrace, 'CacheErrors: no active checkers for filetype ' . &filetype) endif endif + + call syntastic#util#debug(g:SyntasticDebugLoclist, "aggregated:", newLoclist) endif let b:syntastic_loclist = newLoclist @@ -382,7 +416,7 @@ endfunction " 'cwd' - change directory to the given path before running the checker " 'returns' - a list of valid exit codes for the checker function! SyntasticMake(options) - call syntastic#util#debug('SyntasticMake: called with options: '. string(a:options)) + call syntastic#util#debug(g:SyntasticDebugTrace, 'SyntasticMake: called with options:', a:options) let old_shell = &shell let old_shellredir = &shellredir @@ -413,8 +447,11 @@ function! SyntasticMake(options) let $LC_ALL = old_lc_all let $LC_MESSAGES = old_lc_messages + call syntastic#util#debug(g:SyntasticDebugLoclist, "checker output:", err_lines) + if has_key(a:options, 'preprocess') let err_lines = call(a:options['preprocess'], [err_lines]) + call syntastic#util#debug(g:SyntasticDebugLoclist, "preprocess:", err_lines) endif lgetexpr err_lines @@ -434,6 +471,8 @@ function! SyntasticMake(options) call syntastic#util#redraw(g:syntastic_full_redraws) endif + call syntastic#util#debug(g:SyntasticDebugLoclist, "raw loclist:", errors) + if has_key(a:options, 'returns') && index(a:options['returns'], v:shell_error) == -1 throw 'Syntastic: checker error' endif @@ -443,11 +482,16 @@ function! SyntasticMake(options) endif " Apply ignore patterns - let ignore = {} + let ignored = {} + let do_ignore = 0 for buf in syntastic#util#unique(map(copy(errors), 'v:val["bufnr"]')) - let ignore[buf] = s:IgnoreFile(bufname(str2nr(buf))) + let ignored[buf] = s:IgnoreFile(bufname(str2nr(buf))) + let do_ignore = do_ignore || ignored[buf] endfor - call filter(errors, '!ignore[v:val["bufnr"]]') + if do_ignore + call filter(errors, '!ignored[v:val["bufnr"]]') + call syntastic#util#debug(g:SyntasticDebugLoclist, "filtered loclist:", errors) + endif " Add subtype info if present. if has_key(a:options, 'subtype') @@ -458,6 +502,7 @@ function! SyntasticMake(options) for rule in a:options['postprocess'] let errors = call('syntastic#postprocess#' . rule, [errors]) endfor + call syntastic#util#debug(g:SyntasticDebugLoclist, "postprocess:", errors) endif return errors diff --git a/plugin/syntastic/autoloclist.vim b/plugin/syntastic/autoloclist.vim index 9a1a018fe..583fb464d 100644 --- a/plugin/syntastic/autoloclist.vim +++ b/plugin/syntastic/autoloclist.vim @@ -17,10 +17,12 @@ function! g:SyntasticAutoloclistNotifier.New() endfunction function! g:SyntasticAutoloclistNotifier.refresh(loclist) + call syntastic#util#debug(g:SyntasticDebugNotifications, 'autoloclist: refresh') call g:SyntasticAutoloclistNotifier.AutoToggle(a:loclist) endfunction function! g:SyntasticAutoloclistNotifier.AutoToggle(loclist) + call syntastic#util#debug(g:SyntasticDebugNotifications, 'autoloclist: toggle') if a:loclist.hasErrorsOrWarningsToDisplay() if g:syntastic_auto_loc_list == 1 call a:loclist.show() diff --git a/plugin/syntastic/balloons.vim b/plugin/syntastic/balloons.vim index f6e60418b..9d888e3a6 100644 --- a/plugin/syntastic/balloons.vim +++ b/plugin/syntastic/balloons.vim @@ -30,6 +30,7 @@ endfunction function! g:SyntasticBalloonsNotifier.refresh(loclist) let b:syntastic_balloons = {} if self.enabled() && a:loclist.hasErrorsOrWarningsToDisplay() + call syntastic#util#debug(g:SyntasticDebugNotifications, 'balloons: refresh') let buf = bufnr('') let issues = filter(a:loclist.filteredRaw(), 'v:val["bufnr"] == buf') if !empty(issues) @@ -48,6 +49,7 @@ endfunction " Reset the error balloons function! g:SyntasticBalloonsNotifier.reset(loclist) if has('balloon_eval') + call syntastic#util#debug(g:SyntasticDebugNotifications, 'balloons: reset') set nobeval endif endfunction diff --git a/plugin/syntastic/checker.vim b/plugin/syntastic/checker.vim index 7014f1dea..dbb836c78 100644 --- a/plugin/syntastic/checker.vim +++ b/plugin/syntastic/checker.vim @@ -58,7 +58,8 @@ endfunction function! g:SyntasticChecker.getLocList() try let list = self._locListFunc() - call syntastic#util#debug('getLocList: checker ' . self._filetype . '/' . self._name . ' returned ' . v:shell_error) + call syntastic#util#debug(g:SyntasticDebugTrace, + \ 'getLocList: checker ' . self._filetype . '/' . self._name . ' returned ' . v:shell_error) catch /\m\C^Syntastic: checker error$/ let list = [] call syntastic#util#error('checker ' . self._filetype . '/' . self._name . ' returned abnormal status ' . v:shell_error) diff --git a/plugin/syntastic/cursor.vim b/plugin/syntastic/cursor.vim index 77f97dc5d..3ceffa555 100644 --- a/plugin/syntastic/cursor.vim +++ b/plugin/syntastic/cursor.vim @@ -22,6 +22,7 @@ endfunction function! g:SyntasticCursorNotifier.refresh(loclist) if self.enabled() && a:loclist.hasErrorsOrWarningsToDisplay() + call syntastic#util#debug(g:SyntasticDebugNotifications, 'cursor: refresh') let b:syntastic_messages = copy(a:loclist.messages(bufnr(''))) let b:oldLine = -1 autocmd! syntastic CursorMoved @@ -30,6 +31,7 @@ function! g:SyntasticCursorNotifier.refresh(loclist) endfunction function! g:SyntasticCursorNotifier.reset(loclist) + call syntastic#util#debug(g:SyntasticDebugNotifications, 'cursor: reset') autocmd! syntastic CursorMoved unlet! b:syntastic_messages let b:oldLine = -1 diff --git a/plugin/syntastic/highlighting.vim b/plugin/syntastic/highlighting.vim index 72671ba86..9d86253fc 100644 --- a/plugin/syntastic/highlighting.vim +++ b/plugin/syntastic/highlighting.vim @@ -29,6 +29,7 @@ endfunction function! g:SyntasticHighlightingNotifier.refresh(loclist) if self.enabled() call self.reset(a:loclist) + call syntastic#util#debug(g:SyntasticDebugNotifications, 'highlighting: refresh') let buf = bufnr('') let issues = filter(a:loclist.filteredRaw(), 'v:val["bufnr"] == buf') for item in issues @@ -55,6 +56,7 @@ endfunction " Remove all error highlights from the window function! g:SyntasticHighlightingNotifier.reset(loclist) if s:has_highlighting + call syntastic#util#debug(g:SyntasticDebugNotifications, 'highlighting: reset') for match in getmatches() if stridx(match['group'], 'Syntastic') == 0 call matchdelete(match['id']) diff --git a/plugin/syntastic/loclist.vim b/plugin/syntastic/loclist.vim index f03a9b200..20515b6fb 100644 --- a/plugin/syntastic/loclist.vim +++ b/plugin/syntastic/loclist.vim @@ -149,6 +149,7 @@ endfunction "display the cached errors for this buf in the location list function! g:SyntasticLoclist.show() + call syntastic#util#debug(g:SyntasticDebugNotifications, 'loclist: show') if !exists('w:syntastic_loclist_set') let w:syntastic_loclist_set = 0 endif @@ -184,6 +185,7 @@ endfunction " Non-method functions {{{1 function! g:SyntasticLoclistHide() + call syntastic#util#debug(g:SyntasticDebugNotifications, 'loclist: hide') silent! lclose endfunction diff --git a/plugin/syntastic/notifiers.vim b/plugin/syntastic/notifiers.vim index 645aa6690..e1e91a779 100644 --- a/plugin/syntastic/notifiers.vim +++ b/plugin/syntastic/notifiers.vim @@ -19,6 +19,7 @@ function! g:SyntasticNotifiers.Instance() endfunction function! g:SyntasticNotifiers.refresh(loclist) + call syntastic#util#debug(g:SyntasticDebugNotifications, 'notifiers: refresh') for type in self._enabled_types let class = substitute(type, '\m.*', 'Syntastic\u&Notifier', '') if !has_key(g:{class}, 'enabled') || self._notifier[type].enabled() @@ -28,6 +29,7 @@ function! g:SyntasticNotifiers.refresh(loclist) endfunction function! g:SyntasticNotifiers.reset(loclist) + call syntastic#util#debug(g:SyntasticDebugNotifications, 'notifiers: reset') for type in self._enabled_types let class = substitute(type, '\m.*', 'Syntastic\u&Notifier', '') diff --git a/plugin/syntastic/signs.vim b/plugin/syntastic/signs.vim index db9a612d6..7e16fe467 100644 --- a/plugin/syntastic/signs.vim +++ b/plugin/syntastic/signs.vim @@ -54,6 +54,7 @@ function! g:SyntasticSignsNotifier.enabled() endfunction function! g:SyntasticSignsNotifier.refresh(loclist) + call syntastic#util#debug(g:SyntasticDebugNotifications, 'signs: refresh') let old_signs = copy(self._bufSignIds()) if self.enabled() call self._signErrors(a:loclist) From b5635aece388e56bde949dc5b27bd669f88a28ac Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Thu, 14 Nov 2013 10:13:05 +0200 Subject: [PATCH 0269/1271] More detailed debugging. Moved logging functions to autoload/syntastic/log.vim. Cleanup debug functions. Add a function to dump option variables. --- autoload/syntastic/log.vim | 170 ++++++++++++++++++++++++++ autoload/syntastic/util.vim | 98 ++------------- doc/syntastic.txt | 9 +- plugin/syntastic.vim | 39 +++--- plugin/syntastic/autoloclist.vim | 4 +- plugin/syntastic/balloons.vim | 4 +- plugin/syntastic/checker.vim | 4 +- plugin/syntastic/cursor.vim | 4 +- plugin/syntastic/highlighting.vim | 4 +- plugin/syntastic/loclist.vim | 4 +- plugin/syntastic/notifiers.vim | 4 +- plugin/syntastic/registry.vim | 2 +- plugin/syntastic/signs.vim | 2 +- syntax_checkers/haskell/ghc-mod.vim | 2 +- syntax_checkers/perl/perl.vim | 2 +- syntax_checkers/puppet/puppetlint.vim | 2 +- syntax_checkers/python/pylint.vim | 2 +- 17 files changed, 222 insertions(+), 134 deletions(-) create mode 100644 autoload/syntastic/log.vim diff --git a/autoload/syntastic/log.vim b/autoload/syntastic/log.vim new file mode 100644 index 000000000..6fcc12206 --- /dev/null +++ b/autoload/syntastic/log.vim @@ -0,0 +1,170 @@ +if exists("g:loaded_syntastic_log_autoload") + finish +endif +let g:loaded_syntastic_log_autoload = 1 + +let s:save_cpo = &cpo +set cpo&vim + +if !exists("g:syntastic_debug") + let g:syntastic_debug = 0 +endif + +let s:deprecation_notices_issued = [] + +" Public functions {{{1 + +function! syntastic#log#info(msg) + echomsg "syntastic: info: " . a:msg +endfunction + +function! syntastic#log#warn(msg) + echohl WarningMsg + echomsg "syntastic: warning: " . a:msg + echohl None +endfunction + +function! syntastic#log#error(msg) + execute "normal \" + echohl ErrorMsg + echomsg "syntastic: error: " . a:msg + echohl None +endfunction + +function! syntastic#log#deprecationWarn(msg) + if index(s:deprecation_notices_issued, a:msg) >= 0 + return + endif + + call add(s:deprecation_notices_issued, a:msg) + call syntastic#log#warn(a:msg) +endfunction + +function! syntastic#log#debug(level, msg, ...) + if !s:isDebugEnabled(a:level) + return + endif + + let leader = s:logTimestamp() + call s:logRedirect(1) + + if a:0 > 0 + " filter out dictionary functions + echomsg leader . a:msg . ' ' . + \ strtrans(string(type(a:1) == type({}) || type(a:1) == type([]) ? + \ filter(copy(a:1), 'type(v:val) != type(function("tr"))') : a:1)) + else + echomsg leader . a:msg + endif + + call s:logRedirect(0) +endfunction + +function! syntastic#log#debugShowOptions(level, names) + if !s:isDebugEnabled(a:level) + return + endif + + let leader = s:logTimestamp() + call s:logRedirect(1) + + let vlist = type(a:names) == type("") ? [a:names] : a:names + if !empty(vlist) + call map(vlist, "'&' . v:val . ' = ' . strtrans(string(eval('&' . v:val)))") + echomsg leader . join(vlist, ', ') + endif + call s:logRedirect(0) +endfunction + +function! syntastic#log#debugShowVariables(level, names) + if !s:isDebugEnabled(a:level) + return + endif + + let leader = s:logTimestamp() + call s:logRedirect(1) + + let vlist = type(a:names) == type("") ? [a:names] : a:names + for name in vlist + echomsg leader . s:formatVariable(name) + endfor + + call s:logRedirect(0) +endfunction + +function! syntastic#log#debugDump(level) + if !s:isDebugEnabled(a:level) + return + endif + + let vars = [ + \ 'syntastic_aggregate_errors', + \ 'syntastic_always_populate_loc_list', + \ 'syntastic_auto_jump', + \ 'syntastic_auto_loc_list', + \ 'syntastic_check_on_open', + \ 'syntastic_check_on_wq', + \ 'syntastic_debug', + \ 'syntastic_delayed_redraws', + \ 'syntastic_echo_current_error', + \ 'syntastic_enable_balloons', + \ 'syntastic_enable_highlighting', + \ 'syntastic_enable_signs', + \ 'syntastic_error_symbol', + \ 'syntastic_filetype_map', + \ 'syntastic_full_redraws', + \ 'syntastic_id_checkers', + \ 'syntastic_ignore_files', + \ 'syntastic_loc_list_height', + \ 'syntastic_mode_map', + \ 'syntastic_quiet_warnings', + \ 'syntastic_reuse_loc_lists', + \ 'syntastic_stl_format', + \ 'syntastic_style_error_symbol', + \ 'syntastic_style_warning_symbol', + \ 'syntastic_warning_symbol' ] + + call syntastic#log#debugShowVariables(a:level, vars) +endfunction + +" Private functions {{{1 + +function! s:isDebugEnabled(level) + " poor man's bit test for bit N, assuming a:level == 2**N + return (g:syntastic_debug / a:level) % 2 +endfunction + +function! s:logRedirect(on) + if exists("g:syntastic_debug_file") + if a:on + try + execute 'redir >> ' . fnameescape(expand(g:syntastic_debug_file)) + catch /^Vim\%((\a\+)\)\=:/ + silent! redir END + unlet g:syntastic_debug_file + endtry + else + silent! redir END + endif + endif +endfunction + +function! s:logTimestamp() + return 'syntastic: ' . ( has('reltime') ? split(reltimestr(reltime(g:syntastic_start)))[0] : 'debug' ) . ': ' +endfunction + +function! s:formatVariable(name) + let vals = [] + if exists('g:' . a:name) + call add(vals, 'g:' . a:name . ' = ' . strtrans(string(g:{a:name}))) + endif + if exists('b:' . a:name) + call add(vals, 'b:' . a:name . ' = ' . strtrans(string(b:{a:name}))) + endif + + return join(vals, ', ') +endfunction + +let &cpo = s:save_cpo +unlet s:save_cpo +" vim: set et sts=4 sw=4 fdm=marker: diff --git a/autoload/syntastic/util.vim b/autoload/syntastic/util.vim index d49d8d6e3..2c9440202 100644 --- a/autoload/syntastic/util.vim +++ b/autoload/syntastic/util.vim @@ -6,15 +6,10 @@ let g:loaded_syntastic_util_autoload = 1 let s:save_cpo = &cpo set cpo&vim -if !exists("g:syntastic_debug") - let g:syntastic_debug = 0 -endif - if !exists("g:syntastic_delayed_redraws") let g:syntastic_delayed_redraws = 0 endif -let s:deprecationNoticesIssued = [] let s:redraw_delayed = 0 let s:redraw_full = 0 @@ -31,6 +26,8 @@ if g:syntastic_delayed_redraws augroup END endif +" Public functions {{{1 + function! syntastic#util#DevNull() if has('win32') return 'NUL' @@ -208,7 +205,7 @@ endfunction " Vim segfault, so move redraws to a CursorHold / CursorHoldI handler. function! syntastic#util#redraw(full) if !g:syntastic_delayed_redraws || !pumvisible() - call s:Redraw(a:full) + call s:doRedraw(a:full) let s:redraw_delayed = 0 let s:redraw_full = 0 else @@ -219,94 +216,13 @@ endfunction function! syntastic#util#redrawHandler() if s:redraw_delayed && !pumvisible() - call s:Redraw(s:redraw_full) + call s:doRedraw(s:redraw_full) let s:redraw_delayed = 0 let s:redraw_full = 0 endif endfunction -function! syntastic#util#debug(level, msg, ...) - " poor man's bit test for bit N, assuming a:level == 2**N - if (g:syntastic_debug / a:level) % 2 - if has('reltime') - let leader = 'syntastic: ' . split(reltimestr(reltime(g:syntastic_start)))[0] . ': ' - else - let leader = 'syntastic: debug: ' - endif - if exists("g:syntastic_debug_file") - try - execute 'redir >> ' . fnameescape(expand(g:syntastic_debug_file)) - catch /^Vim\%((\a\+)\)\=:/ - unlet g:syntastic_debug_file - silent! redir END - endtry - endif - - if a:0 > 0 - " filter out dictionary functions - echomsg leader . a:msg . - \ strtrans(string(type(a:1) == type({}) || type(a:1) == type([]) ? - \ filter(copy(a:1), 'type(v:val) != type(function("tr"))') : a:1)) - else - echomsg leader . a:msg - endif - - if exists("g:syntastic_debug_file") - silent! redir END - endif - endif -endfunction - -function! syntastic#util#showVariables(level, names) - let vlist = type(a:names) == type("") ? [a:names] : a:names - for name in vlist - let vals = [] - if exists('g:' . name) - call add(vals, 'g:' . name . ' = ' . strtrans(string(g:{name}))) - endif - if exists('b:' . name) - call add(vals, 'b:' . name . ' = ' . strtrans(string(b:{name}))) - endif - - if !empty(vals) - call syntastic#util#debug(a:level, join(vals, ', ')) - endif - endfor -endfunction - -function! syntastic#util#showOptions(level, names) - let vlist = type(a:names) == type("") ? [a:names] : a:names - if !empty(vlist) - call map(vlist, "'&' . v:val . ' = ' . strtrans(string(eval('&' . v:val)))") - call syntastic#util#debug(a:level, join(vlist, ', ')) - endif -endfunction - -function! syntastic#util#info(msg) - echomsg "syntastic: info: " . a:msg -endfunction - -function! syntastic#util#warn(msg) - echohl WarningMsg - echomsg "syntastic: warning: " . a:msg - echohl None -endfunction - -function! syntastic#util#error(msg) - execute "normal \" - echohl ErrorMsg - echomsg "syntastic: error: " . a:msg - echohl None -endfunction - -function! syntastic#util#deprecationWarn(msg) - if index(s:deprecationNoticesIssued, a:msg) >= 0 - return - endif - - call add(s:deprecationNoticesIssued, a:msg) - call syntastic#util#warn(a:msg) -endfunction +" Private functions {{{1 "Redraw in a way that doesnt make the screen flicker or leave anomalies behind. " @@ -315,7 +231,7 @@ endfunction " "However, on some versions of gvim using `redraw!` causes the screen to "flicker - so use redraw. -function! s:Redraw(full) +function! s:doRedraw(full) if a:full redraw! else @@ -325,4 +241,4 @@ endfunction let &cpo = s:save_cpo unlet s:save_cpo -" vim: set et sts=4 sw=4: +" vim: set et sts=4 sw=4 fdm=marker: diff --git a/doc/syntastic.txt b/doc/syntastic.txt index 7fd2dcf7c..94a5dc1d2 100644 --- a/doc/syntastic.txt +++ b/doc/syntastic.txt @@ -401,10 +401,11 @@ Default: 0 Set this to the sum of one or more of the following flags to enable debugging: - 1 - trace checker calls - 2 - dump loclists - 4 - trace notifiers - 8 - trace autocommands + 1 - trace checker calls + 2 - dump loclists + 4 - trace notifiers + 8 - trace autocommands + 16 - dump variables Example: > let g:syntastic_debug = 1 diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 38c683173..84933b1cf 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -25,7 +25,7 @@ let s:running_windows = has("win16") || has("win32") for feature in ['autocmd', 'eval', 'modify_fname', 'quickfix', 'user_commands'] if !has(feature) - call syntastic#util#error("need Vim compiled with feature " . feature) + call syntastic#log#error("need Vim compiled with feature " . feature) finish endif endfor @@ -34,7 +34,7 @@ if !s:running_windows && executable('uname') try let s:uname = system('uname') catch /^Vim\%((\a\+)\)\=:E484/ - call syntastic#util#error("your shell " . &shell . " doesn't use traditional UNIX syntax for redirections") + call syntastic#log#error("your shell " . &shell . " doesn't use traditional UNIX syntax for redirections") finish endtry endif @@ -150,20 +150,20 @@ endif function! s:BufReadPostHook() if g:syntastic_check_on_open - call syntastic#util#debug(g:SyntasticDebugAutocommands, + call syntastic#log#debug(g:SyntasticDebugAutocommands, \ 'autocmd: BufReadPost, buffer ' . bufnr("") . ' = ' . string(bufname(str2nr(bufnr(""))))) call s:UpdateErrors(1) endif endfunction function! s:BufWritePostHook() - call syntastic#util#debug(g:SyntasticDebugAutocommands, + call syntastic#log#debug(g:SyntasticDebugAutocommands, \ 'autocmd: BufWritePost, buffer ' . bufnr("") . ' = ' . string(bufname(str2nr(bufnr(""))))) call s:UpdateErrors(1) endfunction function! s:BufWinEnterHook() - call syntastic#util#debug(g:SyntasticDebugAutocommands, + call syntastic#log#debug(g:SyntasticDebugAutocommands, \ 'autocmd: BufWinEnter, buffer ' . bufnr("") . ' = ' . string(bufname(str2nr(bufnr("")))) . \ ', &buftype = ' . string(&buftype)) if empty(&buftype) @@ -173,7 +173,7 @@ function! s:BufWinEnterHook() endfunction function! s:BufEnterHook() - call syntastic#util#debug(g:SyntasticDebugAutocommands, + call syntastic#log#debug(g:SyntasticDebugAutocommands, \ 'autocmd: BufEnter, buffer ' . bufnr("") . ' = ' . string(bufname(str2nr(bufnr("")))) . \ ', &buftype = ' . string(&buftype)) " TODO: at this point there is no b:syntastic_loclist @@ -185,7 +185,7 @@ function! s:BufEnterHook() endfunction function! s:QuitPreHook() - call syntastic#util#debug(g:SyntasticDebugAutocommands, + call syntastic#log#debug(g:SyntasticDebugAutocommands, \ 'autocmd: QuitPre, buffer ' . bufnr("") . ' = ' . string(bufname(str2nr(bufnr(""))))) let b:syntastic_skip_checks = !g:syntastic_check_on_wq call g:SyntasticLoclistHide() @@ -240,9 +240,10 @@ function! s:CacheErrors(...) let active_checkers = 0 let names = [] - call syntastic#util#showOptions(g:SyntasticDebugTrace, + call syntastic#log#debugShowOptions(g:SyntasticDebugTrace, \ ['shell', 'shellcmdflag', 'shellxquote', 'shellredir', 'shellslash']) - call syntastic#util#showVariables(g:SyntasticDebugTrace, 'syntastic_aggregate_errors') + call syntastic#log#debugDump(g:SyntasticDebugVariables) + call syntastic#log#debugShowVariables(g:SyntasticDebugTrace, 'syntastic_aggregate_errors') let aggregate_errors = \ exists('b:syntastic_aggregate_errors') ? b:syntastic_aggregate_errors : g:syntastic_aggregate_errors @@ -259,7 +260,7 @@ function! s:CacheErrors(...) for checker in checkers let active_checkers += 1 - call syntastic#util#debug(g:SyntasticDebugTrace, "CacheErrors: Invoking checker: " . checker.getName()) + call syntastic#log#debug(g:SyntasticDebugTrace, "CacheErrors: Invoking checker: " . checker.getName()) let loclist = checker.getLocList() @@ -292,13 +293,13 @@ function! s:CacheErrors(...) if !active_checkers if a:0 - call syntastic#util#warn('checker ' . a:1 . ' is not active for filetype ' . &filetype) + call syntastic#log#warn('checker ' . a:1 . ' is not active for filetype ' . &filetype) else - call syntastic#util#debug(g:SyntasticDebugTrace, 'CacheErrors: no active checkers for filetype ' . &filetype) + call syntastic#log#debug(g:SyntasticDebugTrace, 'CacheErrors: no active checkers for filetype ' . &filetype) endif endif - call syntastic#util#debug(g:SyntasticDebugLoclist, "aggregated:", newLoclist) + call syntastic#log#debug(g:SyntasticDebugLoclist, "aggregated:", newLoclist) endif let b:syntastic_loclist = newLoclist @@ -416,7 +417,7 @@ endfunction " 'cwd' - change directory to the given path before running the checker " 'returns' - a list of valid exit codes for the checker function! SyntasticMake(options) - call syntastic#util#debug(g:SyntasticDebugTrace, 'SyntasticMake: called with options:', a:options) + call syntastic#log#debug(g:SyntasticDebugTrace, 'SyntasticMake: called with options:', a:options) let old_shell = &shell let old_shellredir = &shellredir @@ -447,11 +448,11 @@ function! SyntasticMake(options) let $LC_ALL = old_lc_all let $LC_MESSAGES = old_lc_messages - call syntastic#util#debug(g:SyntasticDebugLoclist, "checker output:", err_lines) + call syntastic#log#debug(g:SyntasticDebugLoclist, "checker output:", err_lines) if has_key(a:options, 'preprocess') let err_lines = call(a:options['preprocess'], [err_lines]) - call syntastic#util#debug(g:SyntasticDebugLoclist, "preprocess:", err_lines) + call syntastic#log#debug(g:SyntasticDebugLoclist, "preprocess:", err_lines) endif lgetexpr err_lines @@ -471,7 +472,7 @@ function! SyntasticMake(options) call syntastic#util#redraw(g:syntastic_full_redraws) endif - call syntastic#util#debug(g:SyntasticDebugLoclist, "raw loclist:", errors) + call syntastic#log#debug(g:SyntasticDebugLoclist, "raw loclist:", errors) if has_key(a:options, 'returns') && index(a:options['returns'], v:shell_error) == -1 throw 'Syntastic: checker error' @@ -490,7 +491,7 @@ function! SyntasticMake(options) endfor if do_ignore call filter(errors, '!ignored[v:val["bufnr"]]') - call syntastic#util#debug(g:SyntasticDebugLoclist, "filtered loclist:", errors) + call syntastic#log#debug(g:SyntasticDebugLoclist, "filtered loclist:", errors) endif " Add subtype info if present. @@ -502,7 +503,7 @@ function! SyntasticMake(options) for rule in a:options['postprocess'] let errors = call('syntastic#postprocess#' . rule, [errors]) endfor - call syntastic#util#debug(g:SyntasticDebugLoclist, "postprocess:", errors) + call syntastic#log#debug(g:SyntasticDebugLoclist, "postprocess:", errors) endif return errors diff --git a/plugin/syntastic/autoloclist.vim b/plugin/syntastic/autoloclist.vim index 583fb464d..92e430bbd 100644 --- a/plugin/syntastic/autoloclist.vim +++ b/plugin/syntastic/autoloclist.vim @@ -17,12 +17,12 @@ function! g:SyntasticAutoloclistNotifier.New() endfunction function! g:SyntasticAutoloclistNotifier.refresh(loclist) - call syntastic#util#debug(g:SyntasticDebugNotifications, 'autoloclist: refresh') + call syntastic#log#debug(g:SyntasticDebugNotifications, 'autoloclist: refresh') call g:SyntasticAutoloclistNotifier.AutoToggle(a:loclist) endfunction function! g:SyntasticAutoloclistNotifier.AutoToggle(loclist) - call syntastic#util#debug(g:SyntasticDebugNotifications, 'autoloclist: toggle') + call syntastic#log#debug(g:SyntasticDebugNotifications, 'autoloclist: toggle') if a:loclist.hasErrorsOrWarningsToDisplay() if g:syntastic_auto_loc_list == 1 call a:loclist.show() diff --git a/plugin/syntastic/balloons.vim b/plugin/syntastic/balloons.vim index 9d888e3a6..18d31c2dd 100644 --- a/plugin/syntastic/balloons.vim +++ b/plugin/syntastic/balloons.vim @@ -30,7 +30,7 @@ endfunction function! g:SyntasticBalloonsNotifier.refresh(loclist) let b:syntastic_balloons = {} if self.enabled() && a:loclist.hasErrorsOrWarningsToDisplay() - call syntastic#util#debug(g:SyntasticDebugNotifications, 'balloons: refresh') + call syntastic#log#debug(g:SyntasticDebugNotifications, 'balloons: refresh') let buf = bufnr('') let issues = filter(a:loclist.filteredRaw(), 'v:val["bufnr"] == buf') if !empty(issues) @@ -49,7 +49,7 @@ endfunction " Reset the error balloons function! g:SyntasticBalloonsNotifier.reset(loclist) if has('balloon_eval') - call syntastic#util#debug(g:SyntasticDebugNotifications, 'balloons: reset') + call syntastic#log#debug(g:SyntasticDebugNotifications, 'balloons: reset') set nobeval endif endfunction diff --git a/plugin/syntastic/checker.vim b/plugin/syntastic/checker.vim index dbb836c78..994b9af41 100644 --- a/plugin/syntastic/checker.vim +++ b/plugin/syntastic/checker.vim @@ -58,11 +58,11 @@ endfunction function! g:SyntasticChecker.getLocList() try let list = self._locListFunc() - call syntastic#util#debug(g:SyntasticDebugTrace, + call syntastic#log#debug(g:SyntasticDebugTrace, \ 'getLocList: checker ' . self._filetype . '/' . self._name . ' returned ' . v:shell_error) catch /\m\C^Syntastic: checker error$/ let list = [] - call syntastic#util#error('checker ' . self._filetype . '/' . self._name . ' returned abnormal status ' . v:shell_error) + call syntastic#log#error('checker ' . self._filetype . '/' . self._name . ' returned abnormal status ' . v:shell_error) endtry call self._populateHighlightRegexes(list) return g:SyntasticLoclist.New(list) diff --git a/plugin/syntastic/cursor.vim b/plugin/syntastic/cursor.vim index 3ceffa555..b330b33a2 100644 --- a/plugin/syntastic/cursor.vim +++ b/plugin/syntastic/cursor.vim @@ -22,7 +22,7 @@ endfunction function! g:SyntasticCursorNotifier.refresh(loclist) if self.enabled() && a:loclist.hasErrorsOrWarningsToDisplay() - call syntastic#util#debug(g:SyntasticDebugNotifications, 'cursor: refresh') + call syntastic#log#debug(g:SyntasticDebugNotifications, 'cursor: refresh') let b:syntastic_messages = copy(a:loclist.messages(bufnr(''))) let b:oldLine = -1 autocmd! syntastic CursorMoved @@ -31,7 +31,7 @@ function! g:SyntasticCursorNotifier.refresh(loclist) endfunction function! g:SyntasticCursorNotifier.reset(loclist) - call syntastic#util#debug(g:SyntasticDebugNotifications, 'cursor: reset') + call syntastic#log#debug(g:SyntasticDebugNotifications, 'cursor: reset') autocmd! syntastic CursorMoved unlet! b:syntastic_messages let b:oldLine = -1 diff --git a/plugin/syntastic/highlighting.vim b/plugin/syntastic/highlighting.vim index 9d86253fc..0e22d7290 100644 --- a/plugin/syntastic/highlighting.vim +++ b/plugin/syntastic/highlighting.vim @@ -29,7 +29,7 @@ endfunction function! g:SyntasticHighlightingNotifier.refresh(loclist) if self.enabled() call self.reset(a:loclist) - call syntastic#util#debug(g:SyntasticDebugNotifications, 'highlighting: refresh') + call syntastic#log#debug(g:SyntasticDebugNotifications, 'highlighting: refresh') let buf = bufnr('') let issues = filter(a:loclist.filteredRaw(), 'v:val["bufnr"] == buf') for item in issues @@ -56,7 +56,7 @@ endfunction " Remove all error highlights from the window function! g:SyntasticHighlightingNotifier.reset(loclist) if s:has_highlighting - call syntastic#util#debug(g:SyntasticDebugNotifications, 'highlighting: reset') + call syntastic#log#debug(g:SyntasticDebugNotifications, 'highlighting: reset') for match in getmatches() if stridx(match['group'], 'Syntastic') == 0 call matchdelete(match['id']) diff --git a/plugin/syntastic/loclist.vim b/plugin/syntastic/loclist.vim index 20515b6fb..217c19ce6 100644 --- a/plugin/syntastic/loclist.vim +++ b/plugin/syntastic/loclist.vim @@ -149,7 +149,7 @@ endfunction "display the cached errors for this buf in the location list function! g:SyntasticLoclist.show() - call syntastic#util#debug(g:SyntasticDebugNotifications, 'loclist: show') + call syntastic#log#debug(g:SyntasticDebugNotifications, 'loclist: show') if !exists('w:syntastic_loclist_set') let w:syntastic_loclist_set = 0 endif @@ -185,7 +185,7 @@ endfunction " Non-method functions {{{1 function! g:SyntasticLoclistHide() - call syntastic#util#debug(g:SyntasticDebugNotifications, 'loclist: hide') + call syntastic#log#debug(g:SyntasticDebugNotifications, 'loclist: hide') silent! lclose endfunction diff --git a/plugin/syntastic/notifiers.vim b/plugin/syntastic/notifiers.vim index e1e91a779..58f3448a9 100644 --- a/plugin/syntastic/notifiers.vim +++ b/plugin/syntastic/notifiers.vim @@ -19,7 +19,7 @@ function! g:SyntasticNotifiers.Instance() endfunction function! g:SyntasticNotifiers.refresh(loclist) - call syntastic#util#debug(g:SyntasticDebugNotifications, 'notifiers: refresh') + call syntastic#log#debug(g:SyntasticDebugNotifications, 'notifiers: refresh') for type in self._enabled_types let class = substitute(type, '\m.*', 'Syntastic\u&Notifier', '') if !has_key(g:{class}, 'enabled') || self._notifier[type].enabled() @@ -29,7 +29,7 @@ function! g:SyntasticNotifiers.refresh(loclist) endfunction function! g:SyntasticNotifiers.reset(loclist) - call syntastic#util#debug(g:SyntasticDebugNotifications, 'notifiers: reset') + call syntastic#log#debug(g:SyntasticDebugNotifications, 'notifiers: reset') for type in self._enabled_types let class = substitute(type, '\m.*', 'Syntastic\u&Notifier', '') diff --git a/plugin/syntastic/registry.vim b/plugin/syntastic/registry.vim index d718ef05e..029d59244 100644 --- a/plugin/syntastic/registry.vim +++ b/plugin/syntastic/registry.vim @@ -239,7 +239,7 @@ endfunction function! g:SyntasticRegistry._userHasFiletypeSettings(filetype) if exists("g:syntastic_" . a:filetype . "_checker") && !exists("g:syntastic_" . a:filetype . "_checkers") let g:syntastic_{a:filetype}_checkers = [g:syntastic_{a:filetype}_checker] - call syntastic#util#deprecationWarn("variable g:syntastic_" . a:filetype . "_checker is deprecated") + call syntastic#log#deprecationWarn("variable g:syntastic_" . a:filetype . "_checker is deprecated") endif return exists("b:syntastic_checkers") || exists("g:syntastic_" . a:filetype . "_checkers") endfunction diff --git a/plugin/syntastic/signs.vim b/plugin/syntastic/signs.vim index 7e16fe467..b264e0ac8 100644 --- a/plugin/syntastic/signs.vim +++ b/plugin/syntastic/signs.vim @@ -54,7 +54,7 @@ function! g:SyntasticSignsNotifier.enabled() endfunction function! g:SyntasticSignsNotifier.refresh(loclist) - call syntastic#util#debug(g:SyntasticDebugNotifications, 'signs: refresh') + call syntastic#log#debug(g:SyntasticDebugNotifications, 'signs: refresh') let old_signs = copy(self._bufSignIds()) if self.enabled() call self._signErrors(a:loclist) diff --git a/syntax_checkers/haskell/ghc-mod.vim b/syntax_checkers/haskell/ghc-mod.vim index bbd08bf76..d591e90b3 100644 --- a/syntax_checkers/haskell/ghc-mod.vim +++ b/syntax_checkers/haskell/ghc-mod.vim @@ -49,7 +49,7 @@ function! s:GhcModNew(exe) let ghc_mod_version = filter(split(system(a:exe), '\n'), 'v:val =~# ''\m^ghc-mod version''')[0] let ret = syntastic#util#versionIsAtLeast(syntastic#util#parseVersion(ghc_mod_version), [2, 1, 2]) catch /^Vim\%((\a\+)\)\=:E684/ - call syntastic#util#error("checker haskell/ghc_mod: can't parse version string (abnormal termination?)") + call syntastic#log#error("checker haskell/ghc_mod: can't parse version string (abnormal termination?)") let ret = -1 endtry return ret diff --git a/syntax_checkers/perl/perl.vim b/syntax_checkers/perl/perl.vim index 53980d070..b95252596 100644 --- a/syntax_checkers/perl/perl.vim +++ b/syntax_checkers/perl/perl.vim @@ -54,7 +54,7 @@ endfunction function! SyntaxCheckers_perl_perl_GetLocList() dict let exe = expand(g:syntastic_perl_interpreter) if type(g:syntastic_perl_lib_path) == type('') - call syntastic#util#deprecationWarn('variable g:syntastic_perl_lib_path should be a list') + call syntastic#log#deprecationWarn('variable g:syntastic_perl_lib_path should be a list') let includes = split(g:syntastic_perl_lib_path, ',') else let includes = copy(exists('b:syntastic_perl_lib_path') ? b:syntastic_perl_lib_path : g:syntastic_perl_lib_path) diff --git a/syntax_checkers/puppet/puppetlint.vim b/syntax_checkers/puppet/puppetlint.vim index b68e9b50d..d8153cdcf 100644 --- a/syntax_checkers/puppet/puppetlint.vim +++ b/syntax_checkers/puppet/puppetlint.vim @@ -17,7 +17,7 @@ let g:loaded_syntastic_puppet_puppetlint_checker=1 if exists("g:syntastic_puppet_lint_arguments") let g:syntastic_puppet_puppetlint_args = g:syntastic_puppet_lint_arguments - call syntastic#util#deprecationWarn("variable g:syntastic_puppet_lint_arguments is deprecated, please use g:syntastic_puppet_puppetlint_args instead") + call syntastic#log#deprecationWarn("variable g:syntastic_puppet_lint_arguments is deprecated, please use g:syntastic_puppet_puppetlint_args instead") endif function! SyntaxCheckers_puppet_puppetlint_IsAvailable() dict diff --git a/syntax_checkers/python/pylint.vim b/syntax_checkers/python/pylint.vim index 808866dc0..8408ef180 100644 --- a/syntax_checkers/python/pylint.vim +++ b/syntax_checkers/python/pylint.vim @@ -55,7 +55,7 @@ function! s:PylintNew(exe) let pylint_version = substitute(pylint_version, '\v^\S+\s+', '', '') let ret = syntastic#util#versionIsAtLeast(syntastic#util#parseVersion(pylint_version), [1]) catch /^Vim\%((\a\+)\)\=:E684/ - call syntastic#util#error("checker python/pylint: can't parse version string (abnormal termination?)") + call syntastic#log#error("checker python/pylint: can't parse version string (abnormal termination?)") let ret = -1 endtry return ret From 6cf028666da66bfaaa3b93453ede437f9198c4fa Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Thu, 14 Nov 2013 10:25:37 +0200 Subject: [PATCH 0270/1271] Update: shellcheck now has a gcc-style output mode. --- syntax_checkers/sh/shellcheck.vim | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/syntax_checkers/sh/shellcheck.vim b/syntax_checkers/sh/shellcheck.vim index bb19c842d..b697a510d 100644 --- a/syntax_checkers/sh/shellcheck.vim +++ b/syntax_checkers/sh/shellcheck.vim @@ -8,29 +8,21 @@ if exists("g:loaded_syntastic_sh_shellcheck_checker") endif let g:loaded_syntastic_sh_shellcheck_checker = 1 -function! SyntaxCheckers_sh_shellcheck_Preprocess(json) - " A hat tip to Mark Weber for this trick - " http://stackoverflow.com/a/19105763 - let errors = eval(join(a:json, '')) - - call filter(errors, 'v:val["level"] =~? ''\v^(error|warning|style)$''') - return map(errors, 'v:val["level"][0] . ":" . v:val["line"] . ":" . v:val["column"] . ":" . v:val["message"]') -endfunction - function! SyntaxCheckers_sh_shellcheck_GetLocList() dict - let makeprg = self.makeprgBuild({ 'args': '-f json' }) + let makeprg = self.makeprgBuild({ 'args': '-f gcc' }) - let errorformat = '%t:%l:%v:%m' + let errorformat = + \ '%f:%l:%v: %trror: %m,' . + \ '%f:%l:%v: %tarning: %m,' . + \ '%f:%l:%v: %tote: %m' let loclist = SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, - \ 'preprocess': 'SyntaxCheckers_sh_shellcheck_Preprocess', - \ 'defaults': {'bufnr': bufnr("")}, \ 'returns': [0, 1] }) for e in loclist - if e['type'] ==? 's' + if e['type'] ==? 'n' let e['type'] = 'w' let e['subtype'] = 'Style' endif From 152a77d68f53e408aa11da0d16befaa66910152a Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 15 Nov 2013 09:13:33 +0200 Subject: [PATCH 0271/1271] Shellcheck now outputs byte counts. --- syntax_checkers/sh/shellcheck.vim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/syntax_checkers/sh/shellcheck.vim b/syntax_checkers/sh/shellcheck.vim index b697a510d..2c983eef5 100644 --- a/syntax_checkers/sh/shellcheck.vim +++ b/syntax_checkers/sh/shellcheck.vim @@ -12,9 +12,9 @@ function! SyntaxCheckers_sh_shellcheck_GetLocList() dict let makeprg = self.makeprgBuild({ 'args': '-f gcc' }) let errorformat = - \ '%f:%l:%v: %trror: %m,' . - \ '%f:%l:%v: %tarning: %m,' . - \ '%f:%l:%v: %tote: %m' + \ '%f:%l:%c: %trror: %m,' . + \ '%f:%l:%c: %tarning: %m,' . + \ '%f:%l:%c: %tote: %m' let loclist = SyntasticMake({ \ 'makeprg': makeprg, From a02c8dc0570de17101afa624779fbe7dfb60c130 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 15 Nov 2013 23:02:06 +0200 Subject: [PATCH 0272/1271] Remove a few forgotten references to syntastic#makeprg#build(). --- README.markdown | 4 ++-- syntax_checkers/scss/scss_lint.vim | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.markdown b/README.markdown index c88cdfd97..8e3f23673 100644 --- a/README.markdown +++ b/README.markdown @@ -105,7 +105,7 @@ Another reason it could fail is that either the command line options or the erro __Q. Recently some of my syntax checker options have stopped working...__ -A. The options are still there, they have just been renamed. Recently, almost all syntax checkers were refactored to use the new `syntastic#makeprg#build()` function. This made a lot of the old explicit options redundant - as they are now implied. The new implied options usually have slightly different names to the old options. +A. The options are still there, they have just been renamed. Recently, almost all syntax checkers were refactored to use the new `makeprgBuild()` function. This made a lot of the old explicit options redundant - as they are now implied. The new implied options usually have slightly different names to the old options. e.g. Previously there was `g:syntastic_phpcs_conf`, now you must use `g:syntastic_php_phpcs_args`. This completely overrides the arguments of the checker, including any defaults, so you may need to look up the default arguments of the checker and add these in. @@ -120,7 +120,7 @@ let g:syntastic_always_populate_loc_list=1 __Q. How can I pass additional arguments to a checker?__ -A. Almost all syntax checkers use the `syntastic#makeprg#build()` function. Those checkers that do can be configured using global variables. The general form of the global args variables are: +A. Almost all syntax checkers use the `makeprgBuild()` function. Those checkers that do can be configured using global variables. The general form of the global args variables are: ```vim syntastic___args ``` diff --git a/syntax_checkers/scss/scss_lint.vim b/syntax_checkers/scss/scss_lint.vim index 49e1a72f9..8f97324f8 100644 --- a/syntax_checkers/scss/scss_lint.vim +++ b/syntax_checkers/scss/scss_lint.vim @@ -15,7 +15,7 @@ endif let g:loaded_syntastic_scss_scss_lint_checker=1 function! SyntaxCheckers_scss_scss_lint_GetLocList() - let makeprg = syntastic#makeprg#build({}) + let makeprg = self.makeprgBuild({}) let errorformat = '%f:%l [%t] %m' return SyntasticMake({ \ 'makeprg': makeprg, From 9c59da4fddab3fc82148c2705d1b27978d7f59ac Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Sat, 16 Nov 2013 12:49:43 +0200 Subject: [PATCH 0273/1271] New command :SyntasticSetLoclist. --- doc/syntastic.txt | 5 +++++ plugin/syntastic.vim | 3 +++ plugin/syntastic/loclist.vim | 14 ++++++++++---- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/doc/syntastic.txt b/doc/syntastic.txt index 94a5dc1d2..8d69d6b4d 100644 --- a/doc/syntastic.txt +++ b/doc/syntastic.txt @@ -161,6 +161,11 @@ filetype. Resets the list of errors and turns off all error notifiers. +:SyntasticSetLoclist *:SyntasticSetLoclist* + +Updates Vim's current loclist with the list of detected errors. This is only +needed if |'syntastic_always_populate_loc_list'| is not set. + ============================================================================== 4. Global Options *syntastic-global-options* diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 84933b1cf..9d2aa6e85 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -125,6 +125,7 @@ command! SyntasticInfo command! SyntasticReset \ call s:ClearCache() | \ call s:notifiers.refresh(g:SyntasticLoclist.New([])) +command! SyntasticSetLoclist call g:SyntasticLoclist.current().setloclist() highlight link SyntasticError SpellBad highlight link SyntasticWarning SpellCap @@ -211,9 +212,11 @@ function! s:UpdateErrors(auto_invoked, ...) let w:syntastic_loclist_set = 0 if g:syntastic_always_populate_loc_list || g:syntastic_auto_jump + call syntastic#log#debug(g:SyntasticDebugNotifications, 'loclist: setloclist (new)') call setloclist(0, loclist.filteredRaw()) let w:syntastic_loclist_set = 1 if run_checks && g:syntastic_auto_jump && loclist.hasErrorsOrWarningsToDisplay() + call syntastic#log#debug(g:SyntasticDebugNotifications, 'loclist: jump') silent! lrewind endif endif diff --git a/plugin/syntastic/loclist.vim b/plugin/syntastic/loclist.vim index 217c19ce6..42b67a75e 100644 --- a/plugin/syntastic/loclist.vim +++ b/plugin/syntastic/loclist.vim @@ -147,14 +147,20 @@ function! g:SyntasticLoclist.filter(filters) return rv endfunction -"display the cached errors for this buf in the location list -function! g:SyntasticLoclist.show() - call syntastic#log#debug(g:SyntasticDebugNotifications, 'loclist: show') +function! g:SyntasticLoclist.setloclist() if !exists('w:syntastic_loclist_set') let w:syntastic_loclist_set = 0 endif - call setloclist(0, self.filteredRaw(), g:syntastic_reuse_loc_lists && w:syntastic_loclist_set ? 'r' : ' ') + let replace = g:syntastic_reuse_loc_lists && w:syntastic_loclist_set + call syntastic#log#debug(g:SyntasticDebugNotifications, 'loclist: setloclist ' . (replace ? '(replace)' : '(new)')) + call setloclist(0, self.filteredRaw(), replace ? 'r' : ' ') let w:syntastic_loclist_set = 1 +endfunction + +"display the cached errors for this buf in the location list +function! g:SyntasticLoclist.show() + call syntastic#log#debug(g:SyntasticDebugNotifications, 'loclist: show') + call self.setloclist() if self.hasErrorsOrWarningsToDisplay() let num = winnr() From 04ee71b72a2aa527f633ad5692bcd0d0fa8ccf39 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Tue, 19 Nov 2013 09:35:16 +0200 Subject: [PATCH 0274/1271] Minor cleanup. --- autoload/syntastic/log.vim | 56 ++++++++++++++++++------------------ plugin/syntastic/loclist.vim | 6 ++-- 2 files changed, 30 insertions(+), 32 deletions(-) diff --git a/autoload/syntastic/log.vim b/autoload/syntastic/log.vim index 6fcc12206..aba881976 100644 --- a/autoload/syntastic/log.vim +++ b/autoload/syntastic/log.vim @@ -10,6 +10,33 @@ if !exists("g:syntastic_debug") let g:syntastic_debug = 0 endif +let s:global_options = [ + \ 'syntastic_aggregate_errors', + \ 'syntastic_always_populate_loc_list', + \ 'syntastic_auto_jump', + \ 'syntastic_auto_loc_list', + \ 'syntastic_check_on_open', + \ 'syntastic_check_on_wq', + \ 'syntastic_debug', + \ 'syntastic_delayed_redraws', + \ 'syntastic_echo_current_error', + \ 'syntastic_enable_balloons', + \ 'syntastic_enable_highlighting', + \ 'syntastic_enable_signs', + \ 'syntastic_error_symbol', + \ 'syntastic_filetype_map', + \ 'syntastic_full_redraws', + \ 'syntastic_id_checkers', + \ 'syntastic_ignore_files', + \ 'syntastic_loc_list_height', + \ 'syntastic_mode_map', + \ 'syntastic_quiet_warnings', + \ 'syntastic_reuse_loc_lists', + \ 'syntastic_stl_format', + \ 'syntastic_style_error_symbol', + \ 'syntastic_style_warning_symbol', + \ 'syntastic_warning_symbol' ] + let s:deprecation_notices_issued = [] " Public functions {{{1 @@ -97,34 +124,7 @@ function! syntastic#log#debugDump(level) return endif - let vars = [ - \ 'syntastic_aggregate_errors', - \ 'syntastic_always_populate_loc_list', - \ 'syntastic_auto_jump', - \ 'syntastic_auto_loc_list', - \ 'syntastic_check_on_open', - \ 'syntastic_check_on_wq', - \ 'syntastic_debug', - \ 'syntastic_delayed_redraws', - \ 'syntastic_echo_current_error', - \ 'syntastic_enable_balloons', - \ 'syntastic_enable_highlighting', - \ 'syntastic_enable_signs', - \ 'syntastic_error_symbol', - \ 'syntastic_filetype_map', - \ 'syntastic_full_redraws', - \ 'syntastic_id_checkers', - \ 'syntastic_ignore_files', - \ 'syntastic_loc_list_height', - \ 'syntastic_mode_map', - \ 'syntastic_quiet_warnings', - \ 'syntastic_reuse_loc_lists', - \ 'syntastic_stl_format', - \ 'syntastic_style_error_symbol', - \ 'syntastic_style_warning_symbol', - \ 'syntastic_warning_symbol' ] - - call syntastic#log#debugShowVariables(a:level, vars) + call syntastic#log#debugShowVariables(a:level, s:global_options) endfunction " Private functions {{{1 diff --git a/plugin/syntastic/loclist.vim b/plugin/syntastic/loclist.vim index 42b67a75e..5e425789c 100644 --- a/plugin/syntastic/loclist.vim +++ b/plugin/syntastic/loclist.vim @@ -11,8 +11,7 @@ function! g:SyntasticLoclist.New(rawLoclist) let newObj = copy(self) let newObj._quietWarnings = g:syntastic_quiet_warnings - let llist = copy(a:rawLoclist) - let llist = filter(llist, 'v:val["valid"] == 1') + let llist = filter(copy(a:rawLoclist), 'v:val["valid"] == 1') for e in llist if empty(e['type']) @@ -131,10 +130,9 @@ function! g:SyntasticLoclist.filter(filters) let rv = [] for error in self._rawLoclist - let passes_filters = 1 for key in keys(a:filters) - if error[key] !=? a:filters[key] + if get(error, key, '') !=? a:filters[key] let passes_filters = 0 break endif From d19f5d4f2ba15d9c84071afeaccc236197c086ff Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Wed, 20 Nov 2013 16:55:05 +0200 Subject: [PATCH 0275/1271] New checker yamlxs for YAML. --- syntax_checkers/yaml/yamlxs.vim | 71 +++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 syntax_checkers/yaml/yamlxs.vim diff --git a/syntax_checkers/yaml/yamlxs.vim b/syntax_checkers/yaml/yamlxs.vim new file mode 100644 index 000000000..7cb839767 --- /dev/null +++ b/syntax_checkers/yaml/yamlxs.vim @@ -0,0 +1,71 @@ +"============================================================================ +"File: yamlxs.vim +"Description: Syntax checking plugin for syntastic.vim +"Maintainer: LCD 47 +"License: This program is free software. It comes without any warranty, +" to the extent permitted by applicable law. You can redistribute +" it and/or modify it under the terms of the Do What The Fuck You +" Want To Public License, Version 2, as published by Sam Hocevar. +" See http://sam.zoy.org/wtfpl/COPYING for more details. +" +"============================================================================ + +if exists("g:loaded_syntastic_yaml_yamlxs_checker") + finish +endif +let g:loaded_syntastic_yaml_yamlxs_checker=1 + +if !exists('g:syntastic_perl_interpreter') + let g:syntastic_perl_interpreter = 'perl' +endif + +if !exists('g:syntastic_perl_lib_path') + let g:syntastic_perl_lib_path = [] +endif + +function! SyntaxCheckers_yaml_yamlxs_IsAvailable() dict + let exe = s:Exe() + if !executable(exe) + return 0 + endif + + call system(exe . ' ' . s:Modules() . ' -e ' . syntastic#util#shescape('exit(0)')) + return v:shell_error == 0 +endfunction + +function! SyntaxCheckers_yaml_yamlxs_GetLocList() dict + let makeprg = self.makeprgBuild({ + \ 'exe': s:Exe(), + \ 'args': s:Modules() . ' -e ' . syntastic#util#shescape('YAML::XS::LoadFile($ARGV[0])') }) + + let errorformat = + \ '%EYAML::XS::Load Error: The problem:,' . + \ '%-C,' . + \ '%C %m,' . + \ '%Cwas found at document: %\d%\+\, line: %l\, column: %c,' . + \ '%-G%.%#' + + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'postprocess': ['compressWhitespace'], + \ 'defaults': {'bufnr': bufnr("")} }) +endfunction + +function! s:Exe() + return expand(g:syntastic_perl_interpreter) +endfunction + +function s:Modules() + if type(g:syntastic_perl_lib_path) == type('') + call syntastic#log#deprecationWarn('variable g:syntastic_perl_lib_path should be a list') + let includes = split(g:syntastic_perl_lib_path, ',') + else + let includes = copy(exists('b:syntastic_perl_lib_path') ? b:syntastic_perl_lib_path : g:syntastic_perl_lib_path) + endif + return join(map(includes, '"-I" . v:val') + ['-MYAML::XS']) +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'yaml', + \ 'name': 'yamlxs' }) From 1599cf84f3b2d12062412dfd8e3e45b34b81d54c Mon Sep 17 00:00:00 2001 From: darkiri Date: Wed, 20 Nov 2013 22:18:04 +0100 Subject: [PATCH 0276/1271] oclint does not have -text option any more --- syntax_checkers/c/oclint.vim | 1 - 1 file changed, 1 deletion(-) diff --git a/syntax_checkers/c/oclint.vim b/syntax_checkers/c/oclint.vim index 83a4747af..9e9e098c6 100644 --- a/syntax_checkers/c/oclint.vim +++ b/syntax_checkers/c/oclint.vim @@ -27,7 +27,6 @@ endif function! SyntaxCheckers_c_oclint_GetLocList() dict let makeprg = self.makeprgBuild({ - \ 'args': '-text', \ 'post_args': '-- -c ' . syntastic#c#ReadConfig(g:syntastic_oclint_config_file) }) let errorformat = From a14297d7001ebc2c53ea3880c75cd65d7f2a7dfa Mon Sep 17 00:00:00 2001 From: Colin Keith Date: Wed, 20 Nov 2013 22:59:49 -0500 Subject: [PATCH 0277/1271] removed executable() check so as to support different perl versions using perlbrew (I.e. local version different to system version) via "let g:syntastic_perl_interpreter=/usr/bin/env perl" --- syntax_checkers/yaml/yamlxs.vim | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/syntax_checkers/yaml/yamlxs.vim b/syntax_checkers/yaml/yamlxs.vim index 7cb839767..301c2be2e 100644 --- a/syntax_checkers/yaml/yamlxs.vim +++ b/syntax_checkers/yaml/yamlxs.vim @@ -7,6 +7,7 @@ " 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. +"Installation: cpanm YAML::XS " "============================================================================ @@ -25,9 +26,6 @@ endif function! SyntaxCheckers_yaml_yamlxs_IsAvailable() dict let exe = s:Exe() - if !executable(exe) - return 0 - endif call system(exe . ' ' . s:Modules() . ' -e ' . syntastic#util#shescape('exit(0)')) return v:shell_error == 0 From 72ae30a7af2edd7863b502afd9cd2567447de391 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Thu, 21 Nov 2013 08:47:11 +0200 Subject: [PATCH 0278/1271] Better support for perlbrew. --- syntax_checkers/perl/perl.vim | 5 ++++- syntax_checkers/yaml/yamlxs.vim | 6 +++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/syntax_checkers/perl/perl.vim b/syntax_checkers/perl/perl.vim index b95252596..abe4fe1bd 100644 --- a/syntax_checkers/perl/perl.vim +++ b/syntax_checkers/perl/perl.vim @@ -35,7 +35,10 @@ if !exists('g:syntastic_perl_lib_path') endif function! SyntaxCheckers_perl_perl_IsAvailable() dict - return executable(expand(g:syntastic_perl_interpreter)) + " don't call executable() here, to allow things like + " let g:syntastic_perl_interpreter='/usr/bin/env perl' + silent! call system(expand(g:syntastic_perl_interpreter) . ' -e ' . syntastic#util#shescape('exit(0)')) + return v:shell_error == 0 endfunction function! SyntaxCheckers_perl_perl_Preprocess(errors) diff --git a/syntax_checkers/yaml/yamlxs.vim b/syntax_checkers/yaml/yamlxs.vim index 301c2be2e..4ccf5e78e 100644 --- a/syntax_checkers/yaml/yamlxs.vim +++ b/syntax_checkers/yaml/yamlxs.vim @@ -25,9 +25,9 @@ if !exists('g:syntastic_perl_lib_path') endif function! SyntaxCheckers_yaml_yamlxs_IsAvailable() dict - let exe = s:Exe() - - call system(exe . ' ' . s:Modules() . ' -e ' . syntastic#util#shescape('exit(0)')) + " don't call executable() here, to allow things like + " let g:syntastic_perl_interpreter='/usr/bin/env perl' + silent! call system(s:Exe() . ' ' . s:Modules() . ' -e ' . syntastic#util#shescape('exit(0)')) return v:shell_error == 0 endfunction From d33f566f5741de09e6c61e59704a537076a574c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Crist=C3=B3v=C3=A3o?= Date: Thu, 21 Nov 2013 09:48:29 +0000 Subject: [PATCH 0279/1271] Name specified in ghc-mod.vim is ghc_mod, not ghc-mod. --- plugin/syntastic/registry.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/syntastic/registry.vim b/plugin/syntastic/registry.vim index 029d59244..663ccc1c6 100644 --- a/plugin/syntastic/registry.vim +++ b/plugin/syntastic/registry.vim @@ -29,7 +29,7 @@ let s:defaultCheckers = { \ 'go': ['go'], \ 'haml': ['haml'], \ 'handlebars': ['handlebars'], - \ 'haskell': ['ghc-mod', 'hdevtools', 'hlint'], + \ 'haskell': ['ghc_mod', 'hdevtools', 'hlint'], \ 'haxe': ['haxe'], \ 'hss': ['hss'], \ 'html': ['tidy'], From fa5ad2a82e9ce60f52eb4d0a52988cb6414f9643 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Thu, 21 Nov 2013 18:27:52 +0200 Subject: [PATCH 0280/1271] Minor cleanup. Cleanup highlighting initialization. Document the syntax highlight groups involved. --- doc/syntastic.txt | 16 +++++++++++++++- plugin/syntastic.vim | 3 --- plugin/syntastic/highlighting.vim | 23 +++++++++++++++++++++++ 3 files changed, 38 insertions(+), 4 deletions(-) diff --git a/doc/syntastic.txt b/doc/syntastic.txt index 8d69d6b4d..c91af81a1 100644 --- a/doc/syntastic.txt +++ b/doc/syntastic.txt @@ -24,6 +24,7 @@ CONTENTS *syntastic-contents* 2.1.The statusline flag....................|syntastic-statusline-flag| 2.2.Error signs............................|syntastic-error-signs| 2.3.Error window...........................|syntastic-error-window| + 2.4.Error highlighting.....................|syntastic-highlighting| 3.Commands.....................................|syntastic-commands| 4.Global Options...............................|syntastic-global-options| 5.Checker Options..............................|syntastic-checker-options| @@ -91,6 +92,7 @@ Something like this could be more useful: > < When syntax errors are detected a flag will be shown. The content of the flag is derived from the |syntastic_stl_format| option + ------------------------------------------------------------------------------ 2.2. Error signs *syntastic-error-signs* @@ -121,7 +123,6 @@ following highlight groups: Example: > highlight SyntasticErrorLine guibg=#2f0000 < - ------------------------------------------------------------------------------ 2.3. The error window *:Errors* *syntastic-error-window* @@ -131,6 +132,19 @@ in the |location-list|. Note that when you use :Errors, the current location list is overwritten with Syntastic's own location list. +------------------------------------------------------------------------------ +2.4. Error highlighting *syntastic-highlighting* + +Some checkers provide enough information for syntastic to be able to highlight +errors. By default the SpellBad syntax highlight group is used to color errors, +and the SpellCap group is used for warnings. If you wish to customize the +colors for highlighting you can use the following groups: + SyntasticError - Links to 'SpellBad' by default + SyntasticWarning - Links to 'SpellCap' by default + +Example: > + highlight SyntasticError guibg=#2f0000 +< ============================================================================== 3. Commands *syntastic-commands* diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 9d2aa6e85..ac9bd1e98 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -127,9 +127,6 @@ command! SyntasticReset \ call s:notifiers.refresh(g:SyntasticLoclist.New([])) command! SyntasticSetLoclist call g:SyntasticLoclist.current().setloclist() -highlight link SyntasticError SpellBad -highlight link SyntasticWarning SpellCap - augroup syntastic autocmd BufReadPost * call s:BufReadPostHook() autocmd BufWritePost * call s:BufWritePostHook() diff --git a/plugin/syntastic/highlighting.vim b/plugin/syntastic/highlighting.vim index 0e22d7290..b928ce6fe 100644 --- a/plugin/syntastic/highlighting.vim +++ b/plugin/syntastic/highlighting.vim @@ -12,10 +12,18 @@ endif let g:SyntasticHighlightingNotifier = {} +let s:setup_done = 0 + " Public methods {{{1 function! g:SyntasticHighlightingNotifier.New() let newObj = copy(self) + + if !s:setup_done + call self._setup() + let s:setup_done = 1 + endif + return newObj endfunction @@ -65,4 +73,19 @@ function! g:SyntasticHighlightingNotifier.reset(loclist) endif endfunction +" Private methods {{{1 + +" One time setup: define our own highlighting +function! g:SyntasticHighlightingNotifier._setup() + if s:has_highlighting + if !hlexists('SyntasticError') + highlight link SyntasticError SpellBad + + endif + if !hlexists('SyntasticWarning') + highlight link SyntasticWarning SpellCap + endif + endif +endfunction + " vim: set sw=4 sts=4 et fdm=marker: From 32f426868f22016b5948bcabc71686237bb4e72c Mon Sep 17 00:00:00 2001 From: syucream Date: Sat, 23 Nov 2013 03:49:45 +0900 Subject: [PATCH 0281/1271] Add syntax checking plugin for po files of gettext --- plugin/syntastic/registry.vim | 1 + syntax_checkers/po/msgfmt.vim | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 syntax_checkers/po/msgfmt.vim diff --git a/plugin/syntastic/registry.vim b/plugin/syntastic/registry.vim index 663ccc1c6..0805a7c36 100644 --- a/plugin/syntastic/registry.vim +++ b/plugin/syntastic/registry.vim @@ -48,6 +48,7 @@ let s:defaultCheckers = { \ 'ocaml': ['camlp4o'], \ 'perl': ['perl', 'perlcritic'], \ 'php': ['php', 'phpcs', 'phpmd'], + \ 'po': ['msgfmt'], \ 'pod': ['podchecker'], \ 'puppet': ['puppet', 'puppetlint'], \ 'python': ['python', 'flake8', 'pylint'], diff --git a/syntax_checkers/po/msgfmt.vim b/syntax_checkers/po/msgfmt.vim new file mode 100644 index 000000000..b5491d94c --- /dev/null +++ b/syntax_checkers/po/msgfmt.vim @@ -0,0 +1,33 @@ +"============================================================================ +"File: msgfmt.vim +"Description: Syntax checking plugin for po files of gettext +"Maintainer: Ryo Okubo +"License: This program is free software. It comes without any warranty, +" to the extent permitted by applicable law. You can redistribute +" it and/or modify it under the terms of the Do What The Fuck You +" Want To Public License, Version 2, as published by Sam Hocevar. +" See http://sam.zoy.org/wtfpl/COPYING for more details. +" +"============================================================================ + +if exists("g:loaded_syntastic_po_msgfmt_checker") + finish +endif +let g:loaded_syntastic_po_msgfmt_checker=1 + +function! SyntaxCheckers_po_msgfmt_GetLocList() dict + let makeprg = self.makeprgBuild({ 'args': '-c' }) + + let errorformat = + \ '%W%f:%l: warning: %m,' . + \ '%E%f:%l:%n: %m,' . + \ '%E%f:%l: %m,' . + \ '%Z%p^,' . + \ '%-G%.%#' + + return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'po', + \ 'name': 'msgfmt'}) From c3ba45685b4bdd1b42ca2798b537c1a2f62d9db1 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Sat, 23 Nov 2013 17:38:27 +0200 Subject: [PATCH 0282/1271] Cleanup for msgfmt. Fix errorformat. Add whitespace processing. Add custom highlighting for 'keyword "..." unknown'. --- syntax_checkers/po/msgfmt.vim | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/syntax_checkers/po/msgfmt.vim b/syntax_checkers/po/msgfmt.vim index b5491d94c..08e4991cc 100644 --- a/syntax_checkers/po/msgfmt.vim +++ b/syntax_checkers/po/msgfmt.vim @@ -15,17 +15,27 @@ if exists("g:loaded_syntastic_po_msgfmt_checker") endif let g:loaded_syntastic_po_msgfmt_checker=1 + +function! SyntaxCheckers_po_msgfmt_GetHighlightRegex(item) + let term = matchstr(a:item['text'], 'keyword "\zs[^"]\+\ze" unknown') + return !empty(term) ? '\V' . term : '' +endfunction + function! SyntaxCheckers_po_msgfmt_GetLocList() dict - let makeprg = self.makeprgBuild({ 'args': '-c' }) + let makeprg = self.makeprgBuild({ 'args': '-c ' . syntastic#c#NullOutput() }) - let errorformat = + let errorformat = \ '%W%f:%l: warning: %m,' . - \ '%E%f:%l:%n: %m,' . + \ '%E%f:%l:%v: %m,' . \ '%E%f:%l: %m,' . + \ '%+C %.%#,' . \ '%Z%p^,' . \ '%-G%.%#' - return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'postprocess': ['compressWhitespace'] }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ From 11604484b48e8e13f397fab2b5824bd805efb091 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Sat, 23 Nov 2013 17:45:42 +0200 Subject: [PATCH 0283/1271] Add PO to the list of supported filetypes. --- README.markdown | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.markdown b/README.markdown index 8e3f23673..55d345a25 100644 --- a/README.markdown +++ b/README.markdown @@ -30,10 +30,10 @@ AppleScript, AsciiDoc, Bourne shell, C, C++, C#, Chef, CoffeeScript, Coco, Coq, CSS, Cucumber, CUDA, D, Dart, DocBook, Dust, Elixir, Erlang, eRuby, Fortran, Gentoo metadata, Go, Haml, Haskell, Haxe, Handlebars, HSS, HTML, Java, JavaScript, JSON, LESS, LISP, LLVM intermediate language, Lua, MATLAB, -NASM, Objective-C, Objective-C++, OCaml, Perl, Perl POD, PHP, Puppet, Python, -reStructuredText, Ruby, Rust, SASS/SCSS, Scala, Slim, Tcl, TeX, Twig, -TypeScript, Vala, Verilog, VHDL, xHtml, XML, XSLT, YAML, z80, Zope page -templates, zsh. +NASM, Objective-C, Objective-C++, OCaml, Perl, Perl POD, PHP, gettext Portable +Object, Puppet, Python, reStructuredText, Ruby, Rust, SASS/SCSS, Scala, Slim, +Tcl, TeX, Twig, TypeScript, Vala, Verilog, VHDL, xHtml, XML, XSLT, YAML, z80, +Zope page templates, zsh. ## Screenshot From 9a982cb715a2a664f2e1cea9edc3e98659584cfc Mon Sep 17 00:00:00 2001 From: Alex Efros Date: Mon, 25 Nov 2013 16:48:18 +0200 Subject: [PATCH 0284/1271] add syntax_checkers/limbo/limbo.vim --- syntax_checkers/limbo/limbo.vim | 48 +++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 syntax_checkers/limbo/limbo.vim diff --git a/syntax_checkers/limbo/limbo.vim b/syntax_checkers/limbo/limbo.vim new file mode 100644 index 000000000..619d9f29f --- /dev/null +++ b/syntax_checkers/limbo/limbo.vim @@ -0,0 +1,48 @@ +"============================================================================ +"File: limbo.vim +"Description: Syntax checking plugin for syntastic.vim +"Maintainer: Alex Efros +"License: This program is free software. It comes without any warranty, +" to the extent permitted by applicable law. You can redistribute +" it and/or modify it under the terms of the Do What The Fuck You +" Want To Public License, Version 2, as published by Sam Hocevar. +" See http://sam.zoy.org/wtfpl/COPYING for more details. +" +"============================================================================ + +if exists("g:loaded_syntastic_limbo_limbo_checker") + finish +endif +let g:loaded_syntastic_limbo_limbo_checker = 1 + +function! SyntaxCheckers_limbo_limbo_IsAvailable() dict + return executable('limbo') +endfunction + +function! SyntaxCheckers_limbo_limbo_GetLocList() dict + if filereadable('mkfile') + " don't generate .dis in current dir while checking syntax, + " .dis should be generated by `mk` and possibly in some other dir + let output = ' -o /dev/null' + else + let output = '' + endif + + let makeprg = self.makeprgBuild({ + \ 'exe': 'limbo', + \ 'args': '-I$INFERNO_HOME -w' . output }) + + let errorformat = '%f:%l:%m' + + if match(expand('%'), '\.m$') != -1 + let errorformat = '%-G%f:%l: near ` EOF ` : no implementation module,' . errorformat + endif + + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat }) +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'limbo', + \ 'name': 'limbo' }) From 67afe58cbfceeaaaa54b98a9f03c4900a628e18c Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Mon, 25 Nov 2013 19:48:25 +0200 Subject: [PATCH 0285/1271] Minor cleanup: qualify regexp in msgfmt. --- syntax_checkers/po/msgfmt.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntax_checkers/po/msgfmt.vim b/syntax_checkers/po/msgfmt.vim index 08e4991cc..bd719915d 100644 --- a/syntax_checkers/po/msgfmt.vim +++ b/syntax_checkers/po/msgfmt.vim @@ -17,7 +17,7 @@ let g:loaded_syntastic_po_msgfmt_checker=1 function! SyntaxCheckers_po_msgfmt_GetHighlightRegex(item) - let term = matchstr(a:item['text'], 'keyword "\zs[^"]\+\ze" unknown') + let term = matchstr(a:item['text'], '\mkeyword "\zs[^"]\+\ze" unknown') return !empty(term) ? '\V' . term : '' endfunction From 666b0591f6a71911966f892635d8680e8099223d Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Mon, 25 Nov 2013 20:01:21 +0200 Subject: [PATCH 0286/1271] Cleanup the limbo checker. --- plugin/syntastic/registry.vim | 1 + syntax_checkers/limbo/limbo.vim | 30 ++++++++++-------------------- 2 files changed, 11 insertions(+), 20 deletions(-) diff --git a/plugin/syntastic/registry.vim b/plugin/syntastic/registry.vim index 0805a7c36..7740ced52 100644 --- a/plugin/syntastic/registry.vim +++ b/plugin/syntastic/registry.vim @@ -37,6 +37,7 @@ let s:defaultCheckers = { \ 'javascript': ['jshint', 'jslint'], \ 'json': ['jsonlint', 'jsonval'], \ 'less': ['lessc'], + \ 'limbo': ['limbo'], \ 'lisp': ['clisp'], \ 'llvm': ['llvm'], \ 'lua': ['luac'], diff --git a/syntax_checkers/limbo/limbo.vim b/syntax_checkers/limbo/limbo.vim index 619d9f29f..6f49c2b31 100644 --- a/syntax_checkers/limbo/limbo.vim +++ b/syntax_checkers/limbo/limbo.vim @@ -15,32 +15,22 @@ if exists("g:loaded_syntastic_limbo_limbo_checker") endif let g:loaded_syntastic_limbo_limbo_checker = 1 -function! SyntaxCheckers_limbo_limbo_IsAvailable() dict - return executable('limbo') -endfunction - function! SyntaxCheckers_limbo_limbo_GetLocList() dict - if filereadable('mkfile') - " don't generate .dis in current dir while checking syntax, - " .dis should be generated by `mk` and possibly in some other dir - let output = ' -o /dev/null' - else - let output = '' - endif - - let makeprg = self.makeprgBuild({ - \ 'exe': 'limbo', - \ 'args': '-I$INFERNO_HOME -w' . output }) + let include = !empty($INFERNO_HOME) ? '-I$INFERNO_HOME ' : '' + " don't generate .dis in current dir while checking syntax, + " .dis should be generated by `mk` + let output = filereadable('mkfile') ? ' -o /dev/null' : '' - let errorformat = '%f:%l:%m' + let makeprg = self.makeprgBuild({ 'args': include . '-w' . output }) - if match(expand('%'), '\.m$') != -1 - let errorformat = '%-G%f:%l: near ` EOF ` : no implementation module,' . errorformat + let errorformat = '%E%f:%l:%m' + if expand('%') =~# '\m\.m$' + let errorformat = '%-G%f:%l: near ` EOF ` : no implementation module,' . errorformat endif return SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat }) + \ 'makeprg': makeprg, + \ 'errorformat': errorformat }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ From 5f1e17d44c8bcaaf0a193a628a47c9d3a55619d8 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Mon, 25 Nov 2013 20:03:18 +0200 Subject: [PATCH 0287/1271] Add Limbo to the list of supported languages. --- README.markdown | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.markdown b/README.markdown index 55d345a25..2e2d6439b 100644 --- a/README.markdown +++ b/README.markdown @@ -28,8 +28,8 @@ execute their script to find them. At the time of this writing, syntax checking plugins exist for Ada, AppleScript, AsciiDoc, Bourne shell, C, C++, C#, Chef, CoffeeScript, Coco, Coq, CSS, Cucumber, CUDA, D, Dart, DocBook, Dust, Elixir, Erlang, eRuby, -Fortran, Gentoo metadata, Go, Haml, Haskell, Haxe, Handlebars, HSS, HTML, -Java, JavaScript, JSON, LESS, LISP, LLVM intermediate language, Lua, MATLAB, +Fortran, Gentoo metadata, Go, Haml, Haskell, Haxe, Handlebars, HSS, HTML, Java, +JavaScript, JSON, LESS, Limbo, LISP, LLVM intermediate language, Lua, MATLAB, NASM, Objective-C, Objective-C++, OCaml, Perl, Perl POD, PHP, gettext Portable Object, Puppet, Python, reStructuredText, Ruby, Rust, SASS/SCSS, Scala, Slim, Tcl, TeX, Twig, TypeScript, Vala, Verilog, VHDL, xHtml, XML, XSLT, YAML, z80, From 48d58533fc41e850ef8efb5ae860ba51a136802f Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Tue, 26 Nov 2013 23:19:01 +0200 Subject: [PATCH 0288/1271] Minor cleanup: replace match() by stridx() when appropriate. --- syntax_checkers/go/go.vim | 2 +- syntax_checkers/java/javac.vim | 6 +++--- syntax_checkers/ocaml/camlp4o.vim | 4 ++-- syntax_checkers/python/pyflakes.vim | 18 +++++++++--------- syntax_checkers/ruby/mri.vim | 2 +- syntax_checkers/sh/sh.vim | 6 +++--- 6 files changed, 19 insertions(+), 19 deletions(-) diff --git a/syntax_checkers/go/go.vim b/syntax_checkers/go/go.vim index 4875d1c43..27e126077 100644 --- a/syntax_checkers/go/go.vim +++ b/syntax_checkers/go/go.vim @@ -44,7 +44,7 @@ function! SyntaxCheckers_go_go_GetLocList() dict " Test files, i.e. files with a name ending in `_test.go`, are not " compiled by `go build`, therefore `go test` must be called for those. - if match(expand('%'), '_test.go$') == -1 + if match(expand('%'), '\m_test\.go$') == -1 let makeprg = 'go build ' . syntastic#c#NullOutput() else let makeprg = 'go test -c ' . syntastic#c#NullOutput() diff --git a/syntax_checkers/java/javac.vim b/syntax_checkers/java/javac.vim index 9a579df4d..d6492a296 100644 --- a/syntax_checkers/java/javac.vim +++ b/syntax_checkers/java/javac.vim @@ -206,7 +206,7 @@ function! s:GetMavenClasspath() let mvn_classpath = s:RemoveCarriageReturn(line) break endif - if match(line,'Dependencies classpath:') >= 0 + if stridx(line,'Dependencies classpath:') >= 0 let class_path_next = 1 endif endfor @@ -246,13 +246,13 @@ function! s:MavenOutputDirectory() if has_key(mvn_properties, 'project.properties.build.dir') let output_dir = mvn_properties['project.properties.build.dir'] endif - if match(expand( '%:p:h' ), "src.main.java") >= 0 + if stridx(expand( '%:p:h' ), "src.main.java") >= 0 let output_dir .= '/target/classes' if has_key(mvn_properties, 'project.build.outputDirectory') let output_dir = mvn_properties['project.build.outputDirectory'] endif endif - if match(expand( '%:p:h' ), "src.test.java") >= 0 + if stridx(expand( '%:p:h' ), "src.test.java") >= 0 let output_dir .= '/target/test-classes' if has_key(mvn_properties, 'project.build.testOutputDirectory') let output_dir = mvn_properties['project.build.testOutputDirectory'] diff --git a/syntax_checkers/ocaml/camlp4o.vim b/syntax_checkers/ocaml/camlp4o.vim index d437b3b38..e50acb781 100644 --- a/syntax_checkers/ocaml/camlp4o.vim +++ b/syntax_checkers/ocaml/camlp4o.vim @@ -131,10 +131,10 @@ function! s:GetOtherMakeprg() let extension = expand('%:e') let makeprg = "" - if match(extension, 'mly') >= 0 && executable("menhir") + if stridx(extension, 'mly') >= 0 && executable("menhir") " ocamlyacc output can't be redirected, so use menhir let makeprg = "menhir --only-preprocess " . syntastic#util#shexpand('%') . " >" . syntastic#util#DevNull() - elseif match(extension,'mll') >= 0 && executable("ocamllex") + elseif stridx(extension,'mll') >= 0 && executable("ocamllex") let makeprg = "ocamllex -q " . syntastic#c#NullOutput() . " " . syntastic#util#shexpand('%') else let makeprg = "camlp4o " . syntastic#c#NullOutput() . " " . syntastic#util#shexpand('%') diff --git a/syntax_checkers/python/pyflakes.vim b/syntax_checkers/python/pyflakes.vim index e2c9680c7..b66346f20 100644 --- a/syntax_checkers/python/pyflakes.vim +++ b/syntax_checkers/python/pyflakes.vim @@ -9,17 +9,17 @@ if exists("g:loaded_syntastic_python_pyflakes_checker") finish endif -let g:loaded_syntastic_python_pyflakes_checker=1 +let g:loaded_syntastic_python_pyflakes_checker = 1 function! SyntaxCheckers_python_pyflakes_GetHighlightRegex(i) - if match(a:i['text'], 'is assigned to but never used') > -1 - \ || match(a:i['text'], 'imported but unused') > -1 - \ || match(a:i['text'], 'undefined name') > -1 - \ || match(a:i['text'], 'redefinition of') > -1 - \ || match(a:i['text'], 'referenced before assignment') > -1 - \ || match(a:i['text'], 'duplicate argument') > -1 - \ || match(a:i['text'], 'after other statements') > -1 - \ || match(a:i['text'], 'shadowed by loop variable') > -1 + if stridx(a:i['text'], 'is assigned to but never used') >= 0 + \ || stridx(a:i['text'], 'imported but unused') >= 0 + \ || stridx(a:i['text'], 'undefined name') >= 0 + \ || stridx(a:i['text'], 'redefinition of') >= 0 + \ || stridx(a:i['text'], 'referenced before assignment') >= 0 + \ || stridx(a:i['text'], 'duplicate argument') >= 0 + \ || stridx(a:i['text'], 'after other statements') >= 0 + \ || stridx(a:i['text'], 'shadowed by loop variable') >= 0 " fun with Python's %r: try "..." first, then '...' let terms = split(a:i['text'], '"', 1) diff --git a/syntax_checkers/ruby/mri.vim b/syntax_checkers/ruby/mri.vim index d7bd6730f..1007b84e9 100644 --- a/syntax_checkers/ruby/mri.vim +++ b/syntax_checkers/ruby/mri.vim @@ -20,7 +20,7 @@ if !exists("g:syntastic_ruby_exec") endif function! SyntaxCheckers_ruby_mri_GetHighlightRegex(i) - if match(a:i['text'], 'assigned but unused variable') > -1 + if stridx(a:i['text'], 'assigned but unused variable') >= 0 let term = split(a:i['text'], ' - ')[1] return '\V\<'.term.'\>' endif diff --git a/syntax_checkers/sh/sh.vim b/syntax_checkers/sh/sh.vim index 1ba8fe0e3..0b21e31bc 100644 --- a/syntax_checkers/sh/sh.vim +++ b/syntax_checkers/sh/sh.vim @@ -20,11 +20,11 @@ function! s:GetShell() let b:shell = '' let shebang = getbufline(bufnr('%'), 1)[0] if len(shebang) > 0 - if match(shebang, 'bash') >= 0 + if stridx(shebang, 'bash') >= 0 let b:shell = 'bash' - elseif match(shebang, 'zsh') >= 0 + elseif stridx(shebang, 'zsh') >= 0 let b:shell = 'zsh' - elseif match(shebang, 'sh') >= 0 + elseif stridx(shebang, 'sh') >= 0 let b:shell = 'sh' endif endif From 205094af9cc2792f2fae28c41ba9f443b51910e3 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 29 Nov 2013 10:18:53 +0200 Subject: [PATCH 0289/1271] Minor cleanup for pylama. --- syntax_checkers/python/pylama.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntax_checkers/python/pylama.vim b/syntax_checkers/python/pylama.vim index c10e34d2f..9bbdd45c3 100644 --- a/syntax_checkers/python/pylama.vim +++ b/syntax_checkers/python/pylama.vim @@ -33,7 +33,7 @@ function! SyntaxCheckers_python_pylama_GetLocList() dict " adjust for weirdness in each checker for e in loclist - let e['type'] = match(['R', 'C', 'W'], e['text'][0]) >= 0 ? 'W' : 'E' + let e['type'] = e['text'] =~? '\m^[RCW]' ? 'W' : 'E' if e['text'] =~# '\v\[%(mccabe|pep257|pylint)\]$' if has_key(e, 'col') let e['col'] += 1 From 45b148d3ca91519a38698b858bb4aec639082b8b Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 29 Nov 2013 10:35:21 +0200 Subject: [PATCH 0290/1271] Minor cleanup: qualify case sensitivity. --- plugin/syntastic/modemap.vim | 4 ++-- plugin/syntastic/registry.vim | 4 ++-- syntax_checkers/lua/luac.vim | 2 +- syntax_checkers/ruby/rubocop.vim | 4 ++-- syntax_checkers/sh/sh.vim | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/plugin/syntastic/modemap.vim b/plugin/syntastic/modemap.vim index 0c772c775..9b04235ca 100644 --- a/plugin/syntastic/modemap.vim +++ b/plugin/syntastic/modemap.vim @@ -39,13 +39,13 @@ function! g:SyntasticModeMap.allowsAutoChecking(filetype) endfunction function! g:SyntasticModeMap.isPassive() - return self._mode == 'passive' + return self._mode ==# 'passive' endfunction function! g:SyntasticModeMap.toggleMode() call self.synch() - if self._mode == 'active' + if self._mode ==# 'active' let self._mode = 'passive' else let self._mode = 'active' diff --git a/plugin/syntastic/registry.vim b/plugin/syntastic/registry.vim index 7740ced52..0d35d4f83 100644 --- a/plugin/syntastic/registry.vim +++ b/plugin/syntastic/registry.vim @@ -146,7 +146,7 @@ endfunction function! g:SyntasticRegistry.getChecker(ftalias, name) for checker in self.availableCheckersFor(a:ftalias) - if checker.getName() == a:name + if checker.getName() ==# a:name return checker endif endfor @@ -248,7 +248,7 @@ endfunction function! g:SyntasticRegistry._validateUniqueName(checker) abort for checker in self._allCheckersFor(a:checker.getFiletype()) - if checker.getName() == a:checker.getName() + if checker.getName() ==# a:checker.getName() throw "Syntastic: Duplicate syntax checker name for: " . a:checker.getName() endif endfor diff --git a/syntax_checkers/lua/luac.vim b/syntax_checkers/lua/luac.vim index 429b6e4e0..d8984d3a2 100644 --- a/syntax_checkers/lua/luac.vim +++ b/syntax_checkers/lua/luac.vim @@ -19,7 +19,7 @@ function! SyntaxCheckers_lua_luac_GetHighlightRegex(pos) let result = '' let near = matchstr(a:pos['text'], '\mnear ''\zs[^'']\+\ze''') if len(near) > 0 - if near == '' + if near ==# '' let p = getpos('$') let a:pos['lnum'] = p[1] let a:pos['col'] = p[2] diff --git a/syntax_checkers/ruby/rubocop.vim b/syntax_checkers/ruby/rubocop.vim index 03e16a9af..60200cf2a 100644 --- a/syntax_checkers/ruby/rubocop.vim +++ b/syntax_checkers/ruby/rubocop.vim @@ -37,9 +37,9 @@ function! SyntaxCheckers_ruby_rubocop_GetLocList() dict " convert rubocop severities to error types recognized by syntastic for e in loclist - if e['type'] == 'F' + if e['type'] ==# 'F' let e['type'] = 'E' - elseif e['type'] != 'W' && e['type'] != 'E' + elseif e['type'] !=# 'W' && e['type'] !=# 'E' let e['type'] = 'W' endif endfor diff --git a/syntax_checkers/sh/sh.vim b/syntax_checkers/sh/sh.vim index 0b21e31bc..22047d0e8 100644 --- a/syntax_checkers/sh/sh.vim +++ b/syntax_checkers/sh/sh.vim @@ -56,7 +56,7 @@ function! SyntaxCheckers_sh_sh_IsAvailable() dict endfunction function! SyntaxCheckers_sh_sh_GetLocList() dict - if s:GetShell() == 'zsh' + if s:GetShell() ==# 'zsh' return s:ForwardToZshChecker() endif From f01df3cd5958b7f276993689f94694f83e571384 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Sat, 30 Nov 2013 00:56:10 +0200 Subject: [PATCH 0291/1271] SyntasticCheck accepts multiple arguments. Cache available checkers. --- plugin/syntastic.vim | 27 +++++++---------- plugin/syntastic/registry.vim | 55 +++++++++++++++-------------------- syntax_checkers/sh/sh.vim | 2 +- 3 files changed, 36 insertions(+), 48 deletions(-) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index ac9bd1e98..d9ccf9257 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -115,7 +115,7 @@ function! s:CompleteCheckerName(argLead, cmdLine, cursorPos) endfunction command! SyntasticToggleMode call s:ToggleMode() -command! -nargs=? -complete=custom,s:CompleteCheckerName SyntasticCheck +command! -nargs=* -complete=custom,s:CompleteCheckerName SyntasticCheck \ call s:UpdateErrors(0, ) \ call syntastic#util#redraw(g:syntastic_full_redraws) command! Errors call s:ShowLocList() @@ -198,11 +198,7 @@ function! s:UpdateErrors(auto_invoked, ...) call s:modemap.synch() let run_checks = !a:auto_invoked || s:modemap.allowsAutoChecking(&filetype) if run_checks - if a:0 >= 1 - call s:CacheErrors(a:1) - else - call s:CacheErrors() - endif + call s:CacheErrors(a:000) endif let loclist = g:SyntasticLoclist.current() @@ -232,7 +228,7 @@ function! s:CurrentFiletypes() endfunction "detect and cache all syntax errors in this buffer -function! s:CacheErrors(...) +function! s:CacheErrors(checkers) call s:ClearCache() let newLoclist = g:SyntasticLoclist.New([]) @@ -251,14 +247,9 @@ function! s:CacheErrors(...) \ (exists('b:syntastic_id_checkers') ? b:syntastic_id_checkers : g:syntastic_id_checkers) for ft in s:CurrentFiletypes() - if a:0 - let checker = s:registry.getChecker(ft, a:1) - let checkers = !empty(checker) ? [checker] : [] - else - let checkers = s:registry.getActiveCheckers(ft) - endif + let clist = empty(a:checkers) ? s:registry.getActiveCheckers(ft) : s:registry.getCheckers(ft, a:checkers) - for checker in checkers + for checker in clist let active_checkers += 1 call syntastic#log#debug(g:SyntasticDebugTrace, "CacheErrors: Invoking checker: " . checker.getName()) @@ -292,8 +283,12 @@ function! s:CacheErrors(...) endif if !active_checkers - if a:0 - call syntastic#log#warn('checker ' . a:1 . ' is not active for filetype ' . &filetype) + if !empty(a:checkers) + if len(a:checkers) == 1 + call syntastic#log#warn('checker ' . a:checkers[0] . ' is not active for filetype ' . &filetype) + else + call syntastic#log#warn('checkers ' . join(a:checkers, ', ') . ' are not active for filetype ' . &filetype) + endif else call syntastic#log#debug(g:SyntasticDebugTrace, 'CacheErrors: no active checkers for filetype ' . &filetype) endif diff --git a/plugin/syntastic/registry.vim b/plugin/syntastic/registry.vim index 0d35d4f83..e3e8f4e59 100644 --- a/plugin/syntastic/registry.vim +++ b/plugin/syntastic/registry.vim @@ -96,6 +96,7 @@ function! g:SyntasticRegistry.Instance() if !exists('s:SyntasticRegistryInstance') let s:SyntasticRegistryInstance = copy(self) let s:SyntasticRegistryInstance._checkerMap = {} + let s:SyntasticRegistryInstance._cachedCheckersFor = {} endif return s:SyntasticRegistryInstance @@ -104,19 +105,7 @@ endfunction function! g:SyntasticRegistry.CreateAndRegisterChecker(args) let checker = g:SyntasticChecker.New(a:args) let registry = g:SyntasticRegistry.Instance() - call registry.registerChecker(checker) -endfunction - -function! g:SyntasticRegistry.registerChecker(checker) abort - let ft = a:checker.getFiletype() - - if !has_key(self._checkerMap, ft) - let self._checkerMap[ft] = [] - endif - - call self._validateUniqueName(a:checker) - - call add(self._checkerMap[ft], a:checker) + call registry._registerChecker(checker) endfunction function! g:SyntasticRegistry.checkable(ftalias) @@ -135,29 +124,21 @@ function! g:SyntasticRegistry.getActiveCheckers(ftalias) return self._filterCheckersByDefaultSettings(checkers, filetype) endif - let checkers = self.availableCheckersFor(filetype) - - if !empty(checkers) - return [checkers[0]] - endif - - return [] + return checkers[0:0] endfunction -function! g:SyntasticRegistry.getChecker(ftalias, name) - for checker in self.availableCheckersFor(a:ftalias) - if checker.getName() ==# a:name - return checker - endif - endfor - - return {} +function! g:SyntasticRegistry.getCheckers(ftalias, list) + return self._filterCheckersByName(self.availableCheckersFor(a:ftalias), a:list) endfunction function! g:SyntasticRegistry.availableCheckersFor(ftalias) - let filetype = s:SyntasticRegistryNormaliseFiletype(a:ftalias) - let checkers = copy(self._allCheckersFor(filetype)) - return self._filterCheckersByAvailability(checkers) + if !has_key(self._cachedCheckersFor, a:ftalias) + let filetype = s:SyntasticRegistryNormaliseFiletype(a:ftalias) + let checkers = self._allCheckersFor(filetype) + let self._cachedCheckersFor[a:ftalias] = self._filterCheckersByAvailability(checkers) + endif + + return self._cachedCheckersFor[a:ftalias] endfunction function! g:SyntasticRegistry.echoInfoFor(ftalias_list) @@ -176,6 +157,18 @@ endfunction " Private methods {{{1 +function! g:SyntasticRegistry._registerChecker(checker) abort + let ft = a:checker.getFiletype() + + if !has_key(self._checkerMap, ft) + let self._checkerMap[ft] = [] + endif + + call self._validateUniqueName(a:checker) + + call add(self._checkerMap[ft], a:checker) +endfunction + function! g:SyntasticRegistry._allCheckersFor(filetype) call self._loadCheckers(a:filetype) if empty(self._checkerMap[a:filetype]) diff --git a/syntax_checkers/sh/sh.vim b/syntax_checkers/sh/sh.vim index 22047d0e8..6e1960555 100644 --- a/syntax_checkers/sh/sh.vim +++ b/syntax_checkers/sh/sh.vim @@ -39,7 +39,7 @@ endfunction function! s:ForwardToZshChecker() let registry = g:SyntasticRegistry.Instance() if registry.checkable('zsh') - return registry.getChecker('zsh', 'zsh').getLocListRaw() + return registry.getCheckers('zsh', ['zsh'])[0].getLocListRaw() else return [] endif From 008e7abbb0cb36b6a4309ad707303b633ecc1c80 Mon Sep 17 00:00:00 2001 From: Steve Bragg Date: Fri, 29 Nov 2013 20:56:01 -0500 Subject: [PATCH 0292/1271] added a syntax checker for racket files --- syntax_checkers/racket/racket.vim | 47 +++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 syntax_checkers/racket/racket.vim diff --git a/syntax_checkers/racket/racket.vim b/syntax_checkers/racket/racket.vim new file mode 100644 index 000000000..9629e3148 --- /dev/null +++ b/syntax_checkers/racket/racket.vim @@ -0,0 +1,47 @@ +"============================================================================ +"File: racket.vim +"Description: Syntax checking plugin for syntastic.vim +"Author: Steve Bragg +" +"License: This program is free software. It comes without any warranty, +" to the extent permitted by applicable law. You can redistribute +" it and/or modify it under the terms of the Do What The Fuck You +" Want To Public License, Version 2, as published by Sam Hocevar. +" See http://sam.zoy.org/wtfpl/COPYING for more details. +" +"============================================================================ + +if exists("g:loaded_syntastic_racket_racket_checker") + finish +endif +let g:loaded_syntastic_racket_racket_checker=1 + +let s:save_cpo = &cpo +set cpo&vim + +function! SyntaxCheckers_racket_racket_IsAvailable() dict + return executable(self.getExec()) +endfunction + +" at some point put in the GetHightlightRegex(item) callback + +function! SyntaxCheckers_racket_racket_GetLocList() dict + let makeprg = self.makeprgBuild({'args': ''}) + + " example of error message + "eval-apply.rkt:460:30: the-empty-environment: unbound identifier in module + " in: the-empty-environment + let errorformat = '%f:%l:%c: %m' + + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat }) +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'racket', + \ 'exec': 'racket', + \ 'name': 'racket'}) + +let &cpo = s:save_cpo +unlet s:save_cpo From 7430f3463f0456f3108baa415f781ee4690b4149 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Sun, 1 Dec 2013 19:05:07 +0200 Subject: [PATCH 0293/1271] Cleanup fo the racket checker. --- README.markdown | 6 +++--- plugin/syntastic/registry.vim | 1 + syntax_checkers/racket/racket.vim | 27 +++++++++++++++------------ 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/README.markdown b/README.markdown index 2e2d6439b..b74073ef4 100644 --- a/README.markdown +++ b/README.markdown @@ -31,9 +31,9 @@ Coq, CSS, Cucumber, CUDA, D, Dart, DocBook, Dust, Elixir, Erlang, eRuby, Fortran, Gentoo metadata, Go, Haml, Haskell, Haxe, Handlebars, HSS, HTML, Java, JavaScript, JSON, LESS, Limbo, LISP, LLVM intermediate language, Lua, MATLAB, NASM, Objective-C, Objective-C++, OCaml, Perl, Perl POD, PHP, gettext Portable -Object, Puppet, Python, reStructuredText, Ruby, Rust, SASS/SCSS, Scala, Slim, -Tcl, TeX, Twig, TypeScript, Vala, Verilog, VHDL, xHtml, XML, XSLT, YAML, z80, -Zope page templates, zsh. +Object, Puppet, Python, Racket, reStructuredText, Ruby, Rust, SASS/SCSS, Scala, +Slim, Tcl, TeX, Twig, TypeScript, Vala, Verilog, VHDL, xHtml, XML, XSLT, YAML, +z80, Zope page templates, zsh. ## Screenshot diff --git a/plugin/syntastic/registry.vim b/plugin/syntastic/registry.vim index e3e8f4e59..742e2e327 100644 --- a/plugin/syntastic/registry.vim +++ b/plugin/syntastic/registry.vim @@ -53,6 +53,7 @@ let s:defaultCheckers = { \ 'pod': ['podchecker'], \ 'puppet': ['puppet', 'puppetlint'], \ 'python': ['python', 'flake8', 'pylint'], + \ 'racket': ['racket'], \ 'rst': ['rst2pseudoxml'], \ 'ruby': ['mri'], \ 'rust': ['rustc'], diff --git a/syntax_checkers/racket/racket.vim b/syntax_checkers/racket/racket.vim index 9629e3148..870b5790e 100644 --- a/syntax_checkers/racket/racket.vim +++ b/syntax_checkers/racket/racket.vim @@ -19,29 +19,32 @@ let g:loaded_syntastic_racket_racket_checker=1 let s:save_cpo = &cpo set cpo&vim -function! SyntaxCheckers_racket_racket_IsAvailable() dict - return executable(self.getExec()) -endfunction - " at some point put in the GetHightlightRegex(item) callback function! SyntaxCheckers_racket_racket_GetLocList() dict - let makeprg = self.makeprgBuild({'args': ''}) + let makeprg = self.makeprgBuild({}) " example of error message "eval-apply.rkt:460:30: the-empty-environment: unbound identifier in module " in: the-empty-environment - let errorformat = '%f:%l:%c: %m' + let errorformat = '%f:%l:%v: %m' + + let loclist = SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat }) + + for e in loclist + if has_key(e, 'col') + let e['col'] += 1 + endif + endfor - return SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat }) + return loclist endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'racket', - \ 'exec': 'racket', - \ 'name': 'racket'}) + \ 'filetype': 'racket', + \ 'name': 'racket'}) let &cpo = s:save_cpo unlet s:save_cpo From b71c3cc43bc255e84701aab86582929195d91867 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Mon, 2 Dec 2013 13:11:32 +0200 Subject: [PATCH 0294/1271] New checker for lex: flex. --- README.markdown | 12 ++++----- plugin/syntastic/registry.vim | 1 + syntax_checkers/lex/flex.vim | 48 +++++++++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+), 6 deletions(-) create mode 100644 syntax_checkers/lex/flex.vim diff --git a/README.markdown b/README.markdown index b74073ef4..f59b5cd2c 100644 --- a/README.markdown +++ b/README.markdown @@ -28,12 +28,12 @@ execute their script to find them. At the time of this writing, syntax checking plugins exist for Ada, AppleScript, AsciiDoc, Bourne shell, C, C++, C#, Chef, CoffeeScript, Coco, Coq, CSS, Cucumber, CUDA, D, Dart, DocBook, Dust, Elixir, Erlang, eRuby, -Fortran, Gentoo metadata, Go, Haml, Haskell, Haxe, Handlebars, HSS, HTML, Java, -JavaScript, JSON, LESS, Limbo, LISP, LLVM intermediate language, Lua, MATLAB, -NASM, Objective-C, Objective-C++, OCaml, Perl, Perl POD, PHP, gettext Portable -Object, Puppet, Python, Racket, reStructuredText, Ruby, Rust, SASS/SCSS, Scala, -Slim, Tcl, TeX, Twig, TypeScript, Vala, Verilog, VHDL, xHtml, XML, XSLT, YAML, -z80, Zope page templates, zsh. +Fortran, Gentoo metadata, Go, Haml, Haskell, Haxe, Handlebars, HSS, HTML, +Java, JavaScript, JSON, LESS, Lex, Limbo, LISP, LLVM intermediate language, +Lua, MATLAB, NASM, Objective-C, Objective-C++, OCaml, Perl, Perl POD, PHP, +gettext Portable Object, Puppet, Python, Racket, reStructuredText, Ruby, Rust, +SASS/SCSS, Scala, Slim, Tcl, TeX, Twig, TypeScript, Vala, Verilog, VHDL, xHtml, +XML, XSLT, YAML, z80, Zope page templates, zsh. ## Screenshot diff --git a/plugin/syntastic/registry.vim b/plugin/syntastic/registry.vim index 742e2e327..550a0df23 100644 --- a/plugin/syntastic/registry.vim +++ b/plugin/syntastic/registry.vim @@ -37,6 +37,7 @@ let s:defaultCheckers = { \ 'javascript': ['jshint', 'jslint'], \ 'json': ['jsonlint', 'jsonval'], \ 'less': ['lessc'], + \ 'lex': ['flex'], \ 'limbo': ['limbo'], \ 'lisp': ['clisp'], \ 'llvm': ['llvm'], diff --git a/syntax_checkers/lex/flex.vim b/syntax_checkers/lex/flex.vim new file mode 100644 index 000000000..87a3120ba --- /dev/null +++ b/syntax_checkers/lex/flex.vim @@ -0,0 +1,48 @@ +"============================================================================ +"File: lex.vim +"Description: Syntax checking plugin for syntastic.vim +"Maintainer: LCD 47 +"License: This program is free software. It comes without any warranty, +" to the extent permitted by applicable law. You can redistribute +" it and/or modify it under the terms of the Do What The Fuck You +" Want To Public License, Version 2, as published by Sam Hocevar. +" See http://sam.zoy.org/wtfpl/COPYING for more details. +" +"============================================================================ + +if exists("g:loaded_syntastic_lex_flex_checker") + finish +endif +let g:loaded_syntastic_lex_flex_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim + +function! SyntaxCheckers_lex_flex_GetHighlightRegex(item) + let term = matchstr(a:item['text'], + \ '\m^\(unrecognized %option\|bad \|bad character\( class expression\)\=\): \zs.*') + if term == '' + let term = matchstr(a:item['text'], + \ '\m^\(Definition value for\|undefined definition\) {\zs[^}]\+\ze}') + endif + + return term != '' ? '\V' . term : '' +endfunction + +function! SyntaxCheckers_lex_flex_GetLocList() dict + let makeprg = self.makeprgBuild({ + \ 'exe': self.getExec() . ' ' . syntastic#c#NullOutput() }) + + let errorformat = '%f:%l: %m' + + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat }) +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'lex', + \ 'name': 'flex'}) + +let &cpo = s:save_cpo +unlet s:save_cpo From 39aebc0860abbfa7d671e6bdc5ea0fa81b7b418f Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Mon, 2 Dec 2013 13:12:29 +0200 Subject: [PATCH 0295/1271] Fix the scss_lint checker. --- syntax_checkers/scss/scss_lint.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntax_checkers/scss/scss_lint.vim b/syntax_checkers/scss/scss_lint.vim index 8f97324f8..dd1f927f0 100644 --- a/syntax_checkers/scss/scss_lint.vim +++ b/syntax_checkers/scss/scss_lint.vim @@ -14,7 +14,7 @@ if exists("g:loaded_syntastic_scss_scss_lint_checker") endif let g:loaded_syntastic_scss_scss_lint_checker=1 -function! SyntaxCheckers_scss_scss_lint_GetLocList() +function! SyntaxCheckers_scss_scss_lint_GetLocList() dict let makeprg = self.makeprgBuild({}) let errorformat = '%f:%l [%t] %m' return SyntasticMake({ From 1b47691bd56ed8709520309d135b881b5615911a Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Mon, 2 Dec 2013 16:13:46 +0200 Subject: [PATCH 0296/1271] Minor fix: highlighting for flex. --- syntax_checkers/lex/flex.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntax_checkers/lex/flex.vim b/syntax_checkers/lex/flex.vim index 87a3120ba..971068f8c 100644 --- a/syntax_checkers/lex/flex.vim +++ b/syntax_checkers/lex/flex.vim @@ -23,7 +23,7 @@ function! SyntaxCheckers_lex_flex_GetHighlightRegex(item) \ '\m^\(unrecognized %option\|bad \|bad character\( class expression\)\=\): \zs.*') if term == '' let term = matchstr(a:item['text'], - \ '\m^\(Definition value for\|undefined definition\) {\zs[^}]\+\ze}') + \ '\m^\(Definition value for\|undefined definition\) \zs{[^}]\+}\ze') endif return term != '' ? '\V' . term : '' From 8db3484f76ff0844570a575904a8b6513417b7b5 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Mon, 2 Dec 2013 16:31:45 +0200 Subject: [PATCH 0297/1271] New checker for yacc: bison. --- README.markdown | 2 +- plugin/syntastic/registry.vim | 1 + syntax_checkers/yacc/bison.vim | 53 ++++++++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 syntax_checkers/yacc/bison.vim diff --git a/README.markdown b/README.markdown index f59b5cd2c..3a49c22c7 100644 --- a/README.markdown +++ b/README.markdown @@ -33,7 +33,7 @@ Java, JavaScript, JSON, LESS, Lex, Limbo, LISP, LLVM intermediate language, Lua, MATLAB, NASM, Objective-C, Objective-C++, OCaml, Perl, Perl POD, PHP, gettext Portable Object, Puppet, Python, Racket, reStructuredText, Ruby, Rust, SASS/SCSS, Scala, Slim, Tcl, TeX, Twig, TypeScript, Vala, Verilog, VHDL, xHtml, -XML, XSLT, YAML, z80, Zope page templates, zsh. +XML, XSLT, YACC, YAML, z80, Zope page templates, zsh. ## Screenshot diff --git a/plugin/syntastic/registry.vim b/plugin/syntastic/registry.vim index 550a0df23..ba00d9156 100644 --- a/plugin/syntastic/registry.vim +++ b/plugin/syntastic/registry.vim @@ -74,6 +74,7 @@ let s:defaultCheckers = { \ 'xhtml': ['tidy'], \ 'xml': ['xmllint'], \ 'xslt': ['xmllint'], + \ 'yacc': ['bison'], \ 'yaml': ['jsyaml'], \ 'z80': ['z80syntaxchecker'], \ 'zpt': ['zptlint'], diff --git a/syntax_checkers/yacc/bison.vim b/syntax_checkers/yacc/bison.vim new file mode 100644 index 000000000..a836472d0 --- /dev/null +++ b/syntax_checkers/yacc/bison.vim @@ -0,0 +1,53 @@ +"============================================================================ +"File: yacc.vim +"Description: Syntax checking plugin for syntastic.vim +"Maintainer: LCD 47 +"License: This program is free software. It comes without any warranty, +" to the extent permitted by applicable law. You can redistribute +" it and/or modify it under the terms of the Do What The Fuck You +" Want To Public License, Version 2, as published by Sam Hocevar. +" See http://sam.zoy.org/wtfpl/COPYING for more details. +" +"============================================================================ + +if exists("g:loaded_syntastic_yacc_bison_checker") + finish +endif +let g:loaded_syntastic_yacc_bison_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim + +function! SyntaxCheckers_yacc_bison_GetLocList() dict + let makeprg = self.makeprgBuild({ + \ 'exe': self.getExec() . ' ' . syntastic#c#NullOutput() }) + + let errorformat = + \ '%E%f:%l%.%v-%.%\+: %trror: %m,' . + \ '%E%f:%l%.%v: %trror: %m,' . + \ '%W%f:%l%.%v-%.%\+: %tarning: %m,' . + \ '%W%f:%l%.%v: %tarning: %m,' . + \ '%I%f:%l%.%v-%.%\+: %\s%\+%m,' . + \ '%I%f:%l%.%v: %\s%\+%m' + + let loclist = SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat }) + + let last_type = 'E' + for e in loclist + if e['type'] ==? 'I' + let e['type'] = last_type + endif + let last_type = e['type'] + endfor + + return loclist +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'yacc', + \ 'name': 'bison'}) + +let &cpo = s:save_cpo +unlet s:save_cpo From 845c1049b010862ad7e6522ac1bba25e955ae863 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Mon, 2 Dec 2013 18:30:41 +0200 Subject: [PATCH 0298/1271] Minor fix: errorformat for bison. --- syntax_checkers/yacc/bison.vim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/syntax_checkers/yacc/bison.vim b/syntax_checkers/yacc/bison.vim index a836472d0..79921a422 100644 --- a/syntax_checkers/yacc/bison.vim +++ b/syntax_checkers/yacc/bison.vim @@ -23,11 +23,11 @@ function! SyntaxCheckers_yacc_bison_GetLocList() dict \ 'exe': self.getExec() . ' ' . syntastic#c#NullOutput() }) let errorformat = - \ '%E%f:%l%.%v-%.%\+: %trror: %m,' . + \ '%E%f:%l%.%v-%.%\{-}: %trror: %m,' . \ '%E%f:%l%.%v: %trror: %m,' . - \ '%W%f:%l%.%v-%.%\+: %tarning: %m,' . + \ '%W%f:%l%.%v-%.%\{-}: %tarning: %m,' . \ '%W%f:%l%.%v: %tarning: %m,' . - \ '%I%f:%l%.%v-%.%\+: %\s%\+%m,' . + \ '%I%f:%l%.%v-%.%\{-}: %\s%\+%m,' . \ '%I%f:%l%.%v: %\s%\+%m' let loclist = SyntasticMake({ From 2115f09633773e09005ae69c3582141ff7b6a0b7 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Wed, 4 Dec 2013 16:50:35 +0200 Subject: [PATCH 0299/1271] Fix an infinite loop in syntastic#util#findInParent(). As a side effect, also fix some of the "has('win32')" mess. --- autoload/syntastic/c.vim | 2 +- autoload/syntastic/util.vim | 16 ++++++++++++++-- plugin/syntastic.vim | 2 +- syntax_checkers/eruby/ruby.vim | 2 +- syntax_checkers/ruby/jruby.vim | 20 +++++++++----------- syntax_checkers/ruby/mri.vim | 2 +- 6 files changed, 27 insertions(+), 17 deletions(-) diff --git a/autoload/syntastic/c.vim b/autoload/syntastic/c.vim index 1914b0f9f..90f94797a 100644 --- a/autoload/syntastic/c.vim +++ b/autoload/syntastic/c.vim @@ -11,7 +11,7 @@ set cpo&vim " convenience function to determine the 'null device' parameter " based on the current operating system function! syntastic#c#NullOutput() - let known_os = has('win32') || has('unix') || has('mac') + let known_os = has('unix') || has('mac') || syntastic#util#isRunningWindows() return known_os ? '-o ' . syntastic#util#DevNull() : '' endfunction diff --git a/autoload/syntastic/util.vim b/autoload/syntastic/util.vim index 2c9440202..b94846d51 100644 --- a/autoload/syntastic/util.vim +++ b/autoload/syntastic/util.vim @@ -28,8 +28,12 @@ endif " Public functions {{{1 +function! syntastic#util#isRunningWindows() + return has('win16') || has('win32') || has('win64') +endfunction + function! syntastic#util#DevNull() - if has('win32') + if syntastic#util#isRunningWindows() return 'NUL' endif return '/dev/null' @@ -150,12 +154,20 @@ endfunction function! syntastic#util#findInParent(what, where) let here = fnamemodify(a:where, ':p') + let root = syntastic#util#Slash() + if syntastic#util#isRunningWindows() && here[1] == ':' + " The drive letter is an ever-green source of fun. That's because + " we don't care about running syntastic on Amiga these days. ;) + let root = fnamemodify(root, ':p') + let root = here[0] . root[1:] + endif + while !empty(here) let p = split(globpath(here, a:what), '\n') if !empty(p) return fnamemodify(p[0], ':p') - elseif here == '/' + elseif here ==? root break endif diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index d9ccf9257..34bf8a3c4 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -21,7 +21,7 @@ endif runtime! plugin/syntastic/*.vim -let s:running_windows = has("win16") || has("win32") +let s:running_windows = syntastic#util#isRunningWindows() for feature in ['autocmd', 'eval', 'modify_fname', 'quickfix', 'user_commands'] if !has(feature) diff --git a/syntax_checkers/eruby/ruby.vim b/syntax_checkers/eruby/ruby.vim index b7a7baeda..f777f447d 100644 --- a/syntax_checkers/eruby/ruby.vim +++ b/syntax_checkers/eruby/ruby.vim @@ -25,7 +25,7 @@ endfunction function! SyntaxCheckers_eruby_ruby_GetLocList() dict let exe = expand(g:syntastic_ruby_exec) - if !has('win32') + if !syntastic#util#isRunningWindows() let exe = 'RUBYOPT= ' . exe endif diff --git a/syntax_checkers/ruby/jruby.vim b/syntax_checkers/ruby/jruby.vim index 9ef9c9fde..34f3014d2 100644 --- a/syntax_checkers/ruby/jruby.vim +++ b/syntax_checkers/ruby/jruby.vim @@ -15,9 +15,15 @@ endif let g:loaded_syntastic_ruby_jruby_checker=1 function! SyntaxCheckers_ruby_jruby_GetLocList() dict - let makeprg = self.makeprgBuild({ - \ 'exe': s:exe(), - \ 'args': s:args() }) + if syntastic#util#isRunningWindows() + let exe = self.getExec() + let args = '-W1 -T1 -c' + else + let exe = 'RUBYOPT= ' . self.getExec() + let args = '-W1 -c' + endif + + let makeprg = self.makeprgBuild({ 'exe': exe, 'args': args }) let errorformat = \ '%-GSyntax OK for %f,'. @@ -33,14 +39,6 @@ function! SyntaxCheckers_ruby_jruby_GetLocList() dict \ 'errorformat': errorformat }) endfunction -function! s:args() - return has('win32') ? '-W1 -T1 -c' : '-W1 -c' -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/mri.vim b/syntax_checkers/ruby/mri.vim index 1007b84e9..ce11b4bab 100644 --- a/syntax_checkers/ruby/mri.vim +++ b/syntax_checkers/ruby/mri.vim @@ -30,7 +30,7 @@ endfunction function! SyntaxCheckers_ruby_mri_GetLocList() dict let exe = expand(g:syntastic_ruby_exec) - if !has('win32') + if !syntastic#util#isRunningWindows() let exe = 'RUBYOPT= ' . exe endif From 7190f3804a627fefc7d51ed459514c257869ed86 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Wed, 4 Dec 2013 19:39:30 +0200 Subject: [PATCH 0300/1271] Workaround for autocmd brain damage. Vim doesn't call autocmd commands in a predictible order, which can lead to missing filetype when jumping to a new file with `lrewind`. --- plugin/syntastic.vim | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 34bf8a3c4..22bb5e1a4 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -211,6 +211,14 @@ function! s:UpdateErrors(auto_invoked, ...) if run_checks && g:syntastic_auto_jump && loclist.hasErrorsOrWarningsToDisplay() call syntastic#log#debug(g:SyntasticDebugNotifications, 'loclist: jump') silent! lrewind + + " XXX: Vim doesn't call autocmd commands in a predictible + " order, which can lead to missing filetype when jumping + " to a new file; the following is a workaround for the + " resulting brain damage + if &filetype == '' + silent! filetype detect + endif endif endif From 1869a31b297463d271b57a8974799463e267db84 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Wed, 4 Dec 2013 23:58:57 +0200 Subject: [PATCH 0301/1271] Check return code of ghc-mod. --- syntax_checkers/haskell/ghc-mod.vim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/syntax_checkers/haskell/ghc-mod.vim b/syntax_checkers/haskell/ghc-mod.vim index d591e90b3..d6e81365f 100644 --- a/syntax_checkers/haskell/ghc-mod.vim +++ b/syntax_checkers/haskell/ghc-mod.vim @@ -41,7 +41,8 @@ function! SyntaxCheckers_haskell_ghc_mod_GetLocList() dict return SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, - \ 'postprocess': ['compressWhitespace'] }) + \ 'postprocess': ['compressWhitespace'], + \ 'returns': [0] }) endfunction function! s:GhcModNew(exe) From 36dd673953cb4275bfed2431bbaac648c8dc7c26 Mon Sep 17 00:00:00 2001 From: Aru Sahni Date: Fri, 6 Dec 2013 09:27:53 -0500 Subject: [PATCH 0302/1271] Fixing small type in help docs Incorrectly said "symobls" instead of "symbols." --- doc/syntastic.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/syntastic.txt b/doc/syntastic.txt index c91af81a1..d0c4a37df 100644 --- a/doc/syntastic.txt +++ b/doc/syntastic.txt @@ -236,7 +236,7 @@ syntax errors: > *'syntastic_error_symbol'* *'syntastic_style_error_symbol'* *'syntastic_warning_symbol'* *'syntastic_style_warning_symbol'* Use this option to control what the syntastic |:sign| text contains. Several -error symobls can be customized: +error symbols can be customized: syntastic_error_symbol - For syntax errors, defaults to '>>' syntastic_style_error_symbol - For style errors, defaults to 'S>' syntastic_warning_symbol - For syntax warnings, defaults to '>>' From b1f6ee363fca206e2b97f7f38160504e2ad2dc13 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 6 Dec 2013 16:50:17 +0200 Subject: [PATCH 0303/1271] Another type in the help. --- doc/syntastic.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/syntastic.txt b/doc/syntastic.txt index d0c4a37df..6804bc414 100644 --- a/doc/syntastic.txt +++ b/doc/syntastic.txt @@ -490,7 +490,7 @@ The result is a 'makeprg' of the form: > < -All arguments above are optional, and can be overriden by setting global +All arguments above are optional, and can be overridden by setting global variables - even parameters not specified in the call to makeprgBuild(). If 'exe' is the same as the checker 'exec' attribute, it may be omitted. From 6258bc8be50da70ee7d731ab68a7c5a196860edb Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Wed, 11 Dec 2013 10:43:10 +0200 Subject: [PATCH 0304/1271] Pylint: add exit code check. --- syntax_checkers/python/pylint.vim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/syntax_checkers/python/pylint.vim b/syntax_checkers/python/pylint.vim index 8408ef180..fcd40328c 100644 --- a/syntax_checkers/python/pylint.vim +++ b/syntax_checkers/python/pylint.vim @@ -30,7 +30,8 @@ function! SyntaxCheckers_python_pylint_GetLocList() dict let loclist=SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, - \ 'postprocess': ['sort'] }) + \ 'postprocess': ['sort'], + \ 'returns': range(32) }) for e in loclist let type = e['text'][1] From c77d02d80a6339097d09ca4ce1a72cdd075cc297 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Thu, 12 Dec 2013 22:03:56 +0200 Subject: [PATCH 0305/1271] Makeprg clarification in the docs. --- doc/syntastic.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/doc/syntastic.txt b/doc/syntastic.txt index 6804bc414..96e51c558 100644 --- a/doc/syntastic.txt +++ b/doc/syntastic.txt @@ -491,8 +491,10 @@ The result is a 'makeprg' of the form: > < All arguments above are optional, and can be overridden by setting global -variables - even parameters not specified in the call to makeprgBuild(). If -'exe' is the same as the checker 'exec' attribute, it may be omitted. +variables 'g:syntastic___' - even +parameters not specified in the call to makeprgBuild(). + +If 'exe' is the same as the checker 'exec' attribute, it may be omitted. E.g. To override the checker exe above, you could do this: > let g:syntastic_ruby_mri_exe = "another_ruby_checker_exe.rb" From 4ceb0bccc46846061b2f7ad286f90c2ef75c7e47 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 13 Dec 2013 13:51:55 +0200 Subject: [PATCH 0306/1271] Update: dart_analyzer has been replaced by dartanalyzer. --- plugin/syntastic/registry.vim | 2 +- syntax_checkers/dart/dart_analyzer.vim | 58 ---------------------- syntax_checkers/dart/dartanalyzer.vim | 67 ++++++++++++++++++++++++++ 3 files changed, 68 insertions(+), 59 deletions(-) delete mode 100644 syntax_checkers/dart/dart_analyzer.vim create mode 100644 syntax_checkers/dart/dartanalyzer.vim diff --git a/plugin/syntastic/registry.vim b/plugin/syntastic/registry.vim index ba00d9156..dad920885 100644 --- a/plugin/syntastic/registry.vim +++ b/plugin/syntastic/registry.vim @@ -19,7 +19,7 @@ let s:defaultCheckers = { \ 'cucumber': ['cucumber'], \ 'cuda': ['nvcc'], \ 'd': ['dmd'], - \ 'dart': ['dart_analyzer'], + \ 'dart': ['dartanalyzer'], \ 'docbk': ['xmllint'], \ 'dustjs': ['swiffer'], \ 'elixir': ['elixir'], diff --git a/syntax_checkers/dart/dart_analyzer.vim b/syntax_checkers/dart/dart_analyzer.vim deleted file mode 100644 index c12f35754..000000000 --- a/syntax_checkers/dart/dart_analyzer.vim +++ /dev/null @@ -1,58 +0,0 @@ -"============================================================================ -"File: dart_analyzer.vim -"Description: Dart syntax checker - using dart_analyzer -"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. -"============================================================================ -if exists("g:loaded_syntastic_dart_dart_analyzer_checker") - finish -endif -let g:loaded_syntastic_dart_dart_analyzer_checker=1 - -if !exists("g:syntastic_dart_analyzer_conf") - let g:syntastic_dart_analyzer_conf = '' -endif - -function! SyntaxCheckers_dart_dart_analyzer_GetHighlightRegex(error) - let lcol = a:error['col'] - 1 - let rcol = a:error['nr'] + lcol + 1 - - return '\%>'.lcol.'c\%<'.rcol.'c' -endfunction - -function! SyntaxCheckers_dart_dart_analyzer_GetLocList() dict - let makeprg = self.makeprgBuild({ - \ 'args': '--error_format machine', - \ 'post_args': g:syntastic_dart_analyzer_conf }) - - " Machine readable format looks like: - " SEVERITY|TYPE|ERROR_CODE|file:FILENAME|LINE_NUMBER|COLUMN|LENGTH|MESSAGE - " SEVERITY: (WARNING|ERROR) - " TYPE: (RESOLVER|STATIC_TYPE|...) - " ERROR_CODE: (NO_SUCH_TYPE|...) - " FILENAME: String - " LINE_NUMBER: int - " COLUMN: int - " LENGHT: int - " MESSAGE: String - - " We use %n to grab the error length to be able to access it in the matcher. - let commonformat = '|%.%#|%.%#|file:%f|%l|%c|%n|%m' - - " TODO(amouravski): simply take everything after ERROR|WARNING as a message - " and then parse it by hand later. - let errorformat = '%EERROR'.l:commonformat.','. - \'%WWARNING'.l:commonformat - - return SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat }) -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'dart', - \ 'name': 'dart_analyzer'}) diff --git a/syntax_checkers/dart/dartanalyzer.vim b/syntax_checkers/dart/dartanalyzer.vim new file mode 100644 index 000000000..eb8c42e9d --- /dev/null +++ b/syntax_checkers/dart/dartanalyzer.vim @@ -0,0 +1,67 @@ +"============================================================================ +"File: dartanalyzer.vim +"Description: Dart syntax checker - using dartanalyzer +"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. +"============================================================================ +if exists("g:loaded_syntastic_dart_dartanalyzer_checker") + finish +endif +let g:loaded_syntastic_dart_dartanalyzer_checker = 1 + +function! SyntaxCheckers_dart_dartanalyzer_GetHighlightRegex(error) + if a:error['len'] + let lcol = a:error['col'] - 1 + let rcol = a:error['col'] + a:error['len'] + let ret = '\%>' . lcol . 'c\%<' . rcol . 'c' + else + let ret = '' + endif + + return ret +endfunction + +function! SyntaxCheckers_dart_dartanalyzer_GetLocList() dict + let makeprg = self.makeprgBuild({ 'post_args': '--machine' }) + + " Machine readable format looks like: + " SEVERITY|TYPE|ERROR_CODE|FILENAME|LINE_NUMBER|COLUMN|LENGTH|MESSAGE + " SEVERITY: (WARNING|ERROR) + " TYPE: (RESOLVER|STATIC_TYPE|...) + " ERROR_CODE: (NO_SUCH_TYPE|...) + " FILENAME: String + " LINE_NUMBER: int + " COLUMN: int + " LENGTH: int + " MESSAGE: String + + " We use %n to grab the error length, for the syntax highlighter + let commonformat = '|%.%#|%.%#|%f|%l|%c|%n|%m' + + let errorformat = + \ '%EERROR' . commonformat . ',' . + \ '%WWARNING' . commonformat + + let loclist = SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'returns': [0, 1, 2] }) + + for e in loclist + let e['text'] = substitute(e['text'], '\m\\\([\\|]\)', '\1', 'g') + + " Undo the %n hack + let e['len'] = e['nr'] + call remove(e, 'nr') + endfor + + return loclist +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'dart', + \ 'name': 'dartanalyzer' }) From c3270d1dc3502a06024f0c7a280f4047d3fc938f Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Mon, 16 Dec 2013 18:06:30 +0200 Subject: [PATCH 0307/1271] :SyntasticInfo now takes an optional argument. Added several clarifications to the manual. --- doc/syntastic.txt | 182 +++++++++++++++++++++------------- plugin/syntastic.vim | 15 ++- plugin/syntastic/registry.vim | 9 ++ 3 files changed, 132 insertions(+), 74 deletions(-) diff --git a/doc/syntastic.txt b/doc/syntastic.txt index 96e51c558..c596569b0 100644 --- a/doc/syntastic.txt +++ b/doc/syntastic.txt @@ -20,14 +20,19 @@ CONTENTS *syntastic-contents* 1.Intro........................................|syntastic-intro| + 1.1.Quick start............................|syntastic-quickstart| 2.Functionality provided.......................|syntastic-functionality| 2.1.The statusline flag....................|syntastic-statusline-flag| 2.2.Error signs............................|syntastic-error-signs| 2.3.Error window...........................|syntastic-error-window| 2.4.Error highlighting.....................|syntastic-highlighting| + 2.5.Aggregating errors.....................|syntastic-aggregating-errors| + 2.6.Filtering errors.......................|syntastic-filtering-errors| 3.Commands.....................................|syntastic-commands| 4.Global Options...............................|syntastic-global-options| 5.Checker Options..............................|syntastic-checker-options| + 5.1.Choosing which checkers to use.........|syntastic-filetype-checkers| + 5.2.Configuring specific checkers..........|syntastic-config-makeprg| 6.Notes........................................|syntastic-notes| 6.1.Handling of composite filetypes........|syntastic-composite| 6.2.Interaction with python-mode...........|syntastic-pymode| @@ -39,11 +44,6 @@ CONTENTS *syntastic-contents* ============================================================================== 1. Intro *syntastic-intro* -Note: This doc only deals with using syntastic. To learn how to write syntax -checker integrations, see the guide on the github wiki: - - https://github.com/scrooloose/syntastic/wiki/Syntax-Checker-Guide - Syntastic is a syntax checking plugin that runs files through external syntax checkers. This can be done on demand, or automatically as files are saved and opened. If syntax errors are detected, the user is notified and is happy @@ -59,11 +59,34 @@ Take a look at the wiki for a list of supported filetypes and checkers: https://github.com/scrooloose/syntastic/wiki/Syntax-Checkers +Note: This doc only deals with using syntastic. To learn how to write syntax +checker integrations, see the guide on the github wiki: + + https://github.com/scrooloose/syntastic/wiki/Syntax-Checker-Guide + +------------------------------------------------------------------------------ +1.1. Quick start *syntastic-quickstart* + +Syntastic comes preconfigured with a default list of enabled checkers per +filetype. This list is kept reasonably short to prevent slowing down Vim or +trying to use conflicting checkers. + +You can see the list checkers available for the current filetype with the +|:SyntasticInfo| command. + +If you want to override the configured list of checkers for a filetype then +see |syntastic-checker-options| for details. You can also change the arguments +passed to a specific checker as well. + +Use |:SyntasticCheck| to manually check right now. Use |:SyntasticToggleMode| +to switch between active (checking on writting the buffer) and passive (manual) +checking. + ============================================================================== 2. Functionality provided *syntastic-functionality* Syntax checking can be done automatically or on demand (see -|'syntastic_mode_map'| for configuring this). +|'syntastic_mode_map'| and |:SyntasticToggleMode| for configuring this). When syntax checking is done, the features below can be used to notify the user of errors. See |syntastic-options| for how to configure and @@ -72,12 +95,13 @@ activate/deactivate these features. * A statusline flag * Signs beside lines with errors * The |location-list| can be populated with the errors for the associated - buffer. + buffer * Erroneous parts of lines can be highlighted (this functionality is only - provided by some syntax checkers). - * Balloons (if compiled in) can be used to display error messages for - erroneous lines when hovering the mouse over them. - + provided by some syntax checkers) + * Balloons (if the |+balloon_eval| feature is compiled in) can be used to + display error messages for erroneous lines when hovering the mouse over + them + * Error messages from multiple checkers can be aggregated in a single list ------------------------------------------------------------------------------ 2.1. The statusline flag *syntastic-statusline-flag* @@ -86,12 +110,12 @@ To use the statusline flag, this must appear in your |'statusline'| setting > %{SyntasticStatuslineFlag()} < Something like this could be more useful: > - set statusline += %#warningmsg# - set statusline += %{SyntasticStatuslineFlag()} - set statusline += %* + set statusline+=%#warningmsg# + set statusline+=%{SyntasticStatuslineFlag()} + set statusline+=%* < When syntax errors are detected a flag will be shown. The content of the flag -is derived from the |syntastic_stl_format| option +is derived from the |syntastic_stl_format| option. ------------------------------------------------------------------------------ 2.2. Error signs *syntastic-error-signs* @@ -124,7 +148,7 @@ Example: > highlight SyntasticErrorLine guibg=#2f0000 < ------------------------------------------------------------------------------ -2.3. The error window *:Errors* *syntastic-error-window* +2.3. The error window *:Errors* *syntastic-error-window* You can use the :Errors command to display the errors for the current buffer in the |location-list|. @@ -145,6 +169,29 @@ colors for highlighting you can use the following groups: Example: > highlight SyntasticError guibg=#2f0000 < +------------------------------------------------------------------------------ +2.5. Aggregating errors *syntastic-aggregating-errors* + +By default (namely if |'syntastic_aggregate_errors'| is unset), syntastic runs +in turn the checkers corresponding to the filetype of the current file, and +stops as soon as a checker reports any errors. It then notifies you of the +errors using the notification mechanisms above. In this mode error lists are +always produced by a single checker, and, if you open the error window, the +name of the checker that generated the errors is shown on the statusline of the +error window. + +If |'syntastic_aggregate_errors'| is set, syntastic runs all checkers that +apply, then aggregates errors found by all checkers in a single list, and +notifies you. In this mode each error message is labeled with the name of +the checker that generated it, but you can disable these labels by unsetting +'|syntastic_id_checkers|'. + +------------------------------------------------------------------------------ +2.6 Filtering errors *syntastic-filtering-errors* + +You can selectively disable some of the errors found by checkers either by +turning on |'syntastic_quiet_warnings'|, or by specifying a list of patterns +in |'syntastic_ignore_files'|. ============================================================================== 3. Commands *syntastic-commands* @@ -154,22 +201,33 @@ Example: > When errors have been detected, use this command to pop up the |location-list| and display the error messages. - :SyntasticToggleMode *:SyntasticToggleMode* Toggles syntastic between active and passive mode. See |'syntastic_mode_map'| for more info. - :SyntasticCheck *:SyntasticCheck* -Manually cause a syntax check to be done. Useful in passive mode, or if the -current filetype is set to passive. See |'syntastic_mode_map'| for more info. +Manually cause a syntax check to be done. By default the checkers in the +|'g:syntastic__checkers'| or |'b:syntastic_checkers'| lists are run, +cf. |syntastic-filetype-checkers|. If |syntastic_aggregate_errors| is unset +(which is the default), checking stops the first time a checker reports any +errors; if |syntastic_aggregate_errors| is set, all checkers that apply are run +in turn, and all errors found are aggregated in a single list. +The command may be followed by a (space separated) list of checkers. In this +case |'g:syntastic__checkers'| and |'b:syntastic_checkers'| are +ignored, and the checkers named by the command's arguments are run instead, in +the order specified. The rules of |syntastic_aggregate_errors| still apply. + +Example: > + :SyntasticCheck flake8 pylint +< :SyntasticInfo *:SyntasticInfo* -Output info about what checkers are available and in use for the current -filetype. +The command takes an optional argument, and outputs information about the +checkers available for the filetype named by said argument, or for the current +filetype if no argument was provided. :SyntasticReset *:SyntasticReset* @@ -177,9 +235,11 @@ Resets the list of errors and turns off all error notifiers. :SyntasticSetLoclist *:SyntasticSetLoclist* -Updates Vim's current loclist with the list of detected errors. This is only -needed if |'syntastic_always_populate_loc_list'| is not set. - +If |'syntastic_always_populate_loc_list'| is not set, the |location-list| is +not filled in automatically with the list of errors detected by the checkers. +This is useful if you run syntastic along with other plugins that use location +lists. The |:SyntasticSetLoclist| command allows you to stick the errors into +the location list explicitly. ============================================================================== 4. Global Options *syntastic-global-options* @@ -191,7 +251,6 @@ If enabled, syntastic will do syntax checks when buffers are first loaded as well as on saving > let g:syntastic_check_on_open = 1 < - *'syntastic_check_on_wq'* Default: 1 Normally syntastic runs syntax checks whenever buffers are written to disk. @@ -199,16 +258,14 @@ If you want to skip these checks when you issue |:wq|, |:x|, and |:ZZ|, set this variable to 0. > let g:syntastic_check_on_wq = 0 < - *'syntastic_aggregate_errors'* Default: 0 -When enabled, |:SyntasticCheck| runs all checkers that apply, then aggregates -errors found by all checkers and displays them. When disabled, -|:SyntasticCheck| runs each checker in turn, and stops to display the results -the first time a checker finds any errors. > +When enabled, syntastic runs all checkers that apply to the current filetype, +then aggregates errors found by all checkers and displays them. When disabled, +syntastic runs each checker in turn, and stops to display the results the first +time a checker finds any errors. > let g:syntastic_aggregate_errors = 1 < - *'syntastic_id_checkers'* Default: 1 When results from multiple checkers are aggregated in a single error list @@ -218,21 +275,18 @@ checker has produced a given error message. This variable instructs syntastic to label error messages with the names of the checkers that created them. > let g:syntastic_id_checkers = 0 < - *'syntastic_echo_current_error'* Default: 1 If enabled, syntastic will echo the error associated with the current line to the command window. If multiple errors are found, the first will be used. > let g:syntastic_echo_current_error = 1 < - *'syntastic_enable_signs'* Default: 1 Use this option to tell syntastic whether to use the |:sign| interface to mark syntax errors: > let g:syntastic_enable_signs = 1 < - *'syntastic_error_symbol'* *'syntastic_style_error_symbol'* *'syntastic_warning_symbol'* *'syntastic_style_warning_symbol'* Use this option to control what the syntastic |:sign| text contains. Several @@ -246,14 +300,13 @@ Example: > let g:syntastic_error_symbol = '✗' let g:syntastic_warning_symbol = '⚠' < - *'syntastic_enable_balloons'* Default: 1 Use this option to tell syntastic whether to display error messages in balloons when the mouse is hovered over erroneous lines: > let g:syntastic_enable_balloons = 1 < -Note that vim must be compiled with |+balloon_eval|. +Note that Vim must be compiled with |+balloon_eval|. *'syntastic_enable_highlighting'* Default: 1 @@ -261,11 +314,10 @@ Use this option to tell syntastic whether to use syntax highlighting to mark errors (where possible). Highlighting can be turned off with the following > let g:syntastic_enable_highlighting = 0 < - *'syntastic_always_populate_loc_list'* Default: 0 Enable this option to tell syntastic to always stick any detected errors into -the loclist: > +the |location-list|: > let g:syntastic_always_populate_loc_list = 1 < *'syntastic_auto_jump'* @@ -274,7 +326,6 @@ Enable this option if you want the cursor to jump to the first detected error when saving or opening a file: > let g:syntastic_auto_jump = 1 < - *'syntastic_auto_loc_list'* Default: 2 Use this option to tell syntastic to automatically open and/or close the @@ -283,7 +334,6 @@ Use this option to tell syntastic to automatically open and/or close the When set to 0 the error window will not be opened or closed automatically. > let g:syntastic_auto_loc_list = 0 < - When set to 1 the error window will be automatically opened when errors are detected, and closed when none are detected. > let g:syntastic_auto_loc_list = 1 @@ -292,14 +342,12 @@ When set to 2 the error window will be automatically closed when no errors are detected, but not opened automatically. > let g:syntastic_auto_loc_list = 2 < - *'syntastic_loc_list_height'* Default: 10 Use this option to specify the height of the location lists that syntastic opens. > let g:syntastic_loc_list_height = 5 < - *'syntastic_ignore_files'* Default: [] Use this option to specify files that syntastic should neither check, nor @@ -309,7 +357,6 @@ the matches are case sensitive. Use |\c| if you need case insensitive patterns. > let g:syntastic_ignore_files = ['^/usr/include/', '\c\.h$'] < - *'syntastic_filetype_map'* Default: {} Use this option to map non-standard filetypes to standard ones. Corresponding @@ -318,12 +365,10 @@ non-standard filetypes: > let g:syntastic_filetype_map = { 'latex': 'tex', \ 'gentoo-metadata': 'xml' } < - Composite filetypes can also be mapped to simple types, which disables the default behaviour of running both checkers against the input file: > let g:syntastic_filetype_map = { 'handlebars.html': 'handlebars' } < - *'syntastic_mode_map'* Default: { "mode": "active", "active_filetypes": [], @@ -338,7 +383,6 @@ The option should be set to something like: > \ 'active_filetypes': ['ruby', 'php'], \ 'passive_filetypes': ['puppet'] } < - "mode" can be mapped to one of two values - "active" or "passive". When set to active, syntastic does automatic checking whenever a buffer is saved or initially opened. When set to "passive" syntastic only checks when the user @@ -357,7 +401,7 @@ If any of "mode", "active_filetypes", or "passive_filetypes" are not specified then they will default to their default value as above. *'syntastic_quiet_warnings'* - +Default: 0 Use this option if you only care about syntax errors, not warnings. When set, this option has the following effects: * no |signs| appear unless there is at least one error, whereupon both @@ -368,9 +412,7 @@ this option has the following effects: > let g:syntastic_quiet_warnings = 1 < - *'syntastic_stl_format'* - Default: [Syntax: line:%F (%t)] Use this option to control what the syntastic statusline text contains. Several magic flags are available to insert information: @@ -421,10 +463,10 @@ Set this to the sum of one or more of the following flags to enable debugging: 1 - trace checker calls - 2 - dump loclists + 2 - dump location lists 4 - trace notifiers 8 - trace autocommands - 16 - dump variables + 16 - dump options Example: > let g:syntastic_debug = 1 @@ -443,34 +485,32 @@ addition to being added to Vim's |message-history|: > 5. Checker Options *syntastic-checker-options* ------------------------------------------------------------------------------ -5.1 Telling syntastic which checker to use. +5.1 Choosing which checkers to use *syntastic-filetype-checkers* -Stick a line like this in your vimrc: > - let g:syntastic__checkers = [''] -< -e.g. > - let g:syntastic_python_checkers = ['flake8'] + *'g:syntastic__checkers'* +You can tell syntastic which checkers to run for a given filetype by setting a +variable 'g:syntastic__checkers' to a list of checkers, e.g. > + let g:syntastic_python_checkers = ['php', 'phpcs', 'phpmd'] < -There's also a per-buffer version of this setting, b:syntastic_checkers. Use -this in an autocmd to configure specific checkers for particular paths: > + *'b:syntastic_checkers'* +There is also a per-buffer version of this setting, 'b:syntastic_checkers'. +When set, it takes precedence over |'g:syntastic__checkers'|. You can +use this in an autocmd to configure specific checkers for particular paths: > autocmd FileType python if stridx(expand('%:p'), '/some/path/') == 0 | \ let b:syntastic_checkers = ['pylint'] | endif < -To see the list of available checkers for your filetype, look in -`syntax_checkers//`. The names of the files here correspond to -'' above. +If neither |'g:syntastic__checkers'| nor |'b:syntastic_checkers'| +is set, a default list of checker is used. Beware however that this list +deliberately kept minimal, for performance reasons. -e.g. Python has the following checkers: flake8, pyflakes, pylint and a -native python checker. +Take a look at the wiki to find out what checkers and filetypes are supported +by syntastic: -Some filetypes, like PHP, have style checkers as well as syntax checkers. These -can be chained together like this: > - let g:syntastic_php_checkers = ['php', 'phpcs', 'phpmd'] -< -This is telling syntastic to run the 'php' checker first, and if no errors are -found, run 'phpcs', and then 'phpmd'. + https://github.com/scrooloose/syntastic/wiki/Syntax-Checkers + +Use |:SyntasticInfo| to see which checkers are available for a given filetype. ------------------------------------------------------------------------------ 5.2 Configuring specific checkers *syntastic-config-makeprg* diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 22bb5e1a4..e13e375fb 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -114,14 +114,18 @@ function! s:CompleteCheckerName(argLead, cmdLine, cursorPos) return join(checker_names, "\n") endfunction +function! s:CompleteFiletypes(argLead, cmdLine, cursorPos) + return join(s:registry.knownFiletypes(), "\n") +endfunction + command! SyntasticToggleMode call s:ToggleMode() command! -nargs=* -complete=custom,s:CompleteCheckerName SyntasticCheck \ call s:UpdateErrors(0, ) \ call syntastic#util#redraw(g:syntastic_full_redraws) command! Errors call s:ShowLocList() -command! SyntasticInfo +command! -nargs=? -complete=custom,s:CompleteFiletypes SyntasticInfo \ call s:modemap.echoMode() | - \ call s:registry.echoInfoFor(s:CurrentFiletypes()) + \ call s:registry.echoInfoFor(s:ResolveFiletypes()) command! SyntasticReset \ call s:ClearCache() | \ call s:notifiers.refresh(g:SyntasticLoclist.New([])) @@ -231,8 +235,13 @@ function! s:ClearCache() unlet! b:syntastic_loclist endfunction +function! s:ResolveFiletypes(...) + let type = a:0 ? a:1 : &filetype + return split( get(g:syntastic_filetype_map, type, type), '\m\.' ) +endfunction + function! s:CurrentFiletypes() - return split( get(g:syntastic_filetype_map, &filetype, &filetype), '\m\.' ) + return s:ResolveFiletypes(&filetype) endfunction "detect and cache all syntax errors in this buffer diff --git a/plugin/syntastic/registry.vim b/plugin/syntastic/registry.vim index dad920885..141cbeb76 100644 --- a/plugin/syntastic/registry.vim +++ b/plugin/syntastic/registry.vim @@ -144,6 +144,15 @@ function! g:SyntasticRegistry.availableCheckersFor(ftalias) return self._cachedCheckersFor[a:ftalias] endfunction +function! g:SyntasticRegistry.knownFiletypes() + let types = keys(s:defaultCheckers) + call extend(types, keys(s:defaultFiletypeMap)) + if exists('g:syntastic_filetype_map') + call extend(types, keys(g:syntastic_filetype_map)) + endif + return syntastic#util#unique(types) +endfunction + function! g:SyntasticRegistry.echoInfoFor(ftalias_list) echomsg "Syntastic info for filetype: " . join(a:ftalias_list, '.') From 0d268a994c0505afa76c796ff3d4e3a1c1cea756 Mon Sep 17 00:00:00 2001 From: Joshua Rahm Date: Fri, 20 Dec 2013 16:10:18 -0700 Subject: [PATCH 0308/1271] added --vapidir support for vala --- syntax_checkers/vala/valac.vim | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/syntax_checkers/vala/valac.vim b/syntax_checkers/vala/valac.vim index 5d33dab49..d39645474 100644 --- a/syntax_checkers/vala/valac.vim +++ b/syntax_checkers/vala/valac.vim @@ -6,7 +6,12 @@ " "// modules: " and containing space delimited list of vala " modules, used by the file, so this script can build correct " --pkg arguments. -" Alternatively you can set g:syntastic_vala_modules array +" Add another special camment line into your vala file starting +" with "// vapidirs: " followed by a space delimited list of +" the vapi directories so this script can build with the correct +" --vapidir arguments +" Alternatively you can set the g:syntastic_vala_modules array +" and/or the g:syntastic_vala_vapidirs array " in your .vimrc or .lvimrc with localvimrc plugin " (http://www.vim.org/scripts/script.php?script_id=441). " Valac compiler is not the fastest thing in the world, so you @@ -48,9 +53,26 @@ function! s:GetValaModules() return split(strpart(modules_str, 12), '\s\+') endfunction +function! s:GetValaVapiDirs() + if exists('g:syntastic_vala_vapi_dirs') + if type(g:syntastic_vala_vapi_dirs) == type('') + return split(g:syntastic_vala_vapi_dirs, '\s\+') + elseif type(g:syntastic_vala_vapi_dirs) == type([]) + return copy(g:syntastic_vala_vapi_dirs) + else + echoerr 'g:syntastic_vala_vapi_dirs must be either list or string: fallback to in file modules string' + endif + endif + + let vapi_line = search('^//\s*vapidirs:\s*','n') + let vapi_str = getline(vapi_line) + return split( substitute( vapi_str, '^//\s*vapidirs:\s*', '', 'g' ), '\s\+' ) +endfunction + function! SyntaxCheckers_vala_valac_GetLocList() dict let vala_pkg_args = join(map(s:GetValaModules(), '"--pkg ".v:val'), ' ') - let makeprg = self.makeprgBuild({ 'args': '-C ' . vala_pkg_args }) + let vala_vapi_args = join(map(s:GetValaVapiDirs(), '"--vapidir ".v:val'), ' ') + let makeprg = self.makeprgBuild({ 'args': '-C ' . vala_pkg_args . " " . vala_vapi_args }) let errorformat = \ '%A%f:%l.%c-%\d%\+.%\d%\+: %t%[a-z]%\+: %m,'. From 92378afe4bde6303b5a7892f9024013f3fdc0d46 Mon Sep 17 00:00:00 2001 From: Joshua Rahm Date: Fri, 20 Dec 2013 16:15:13 -0700 Subject: [PATCH 0309/1271] fixed typo --- syntax_checkers/vala/valac.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntax_checkers/vala/valac.vim b/syntax_checkers/vala/valac.vim index d39645474..e33dd03ad 100644 --- a/syntax_checkers/vala/valac.vim +++ b/syntax_checkers/vala/valac.vim @@ -6,7 +6,7 @@ " "// modules: " and containing space delimited list of vala " modules, used by the file, so this script can build correct " --pkg arguments. -" Add another special camment line into your vala file starting +" Add another special comment line into your vala file starting " with "// vapidirs: " followed by a space delimited list of " the vapi directories so this script can build with the correct " --vapidir arguments From 0a09d899b707d60874b3de66308b4f7ca57e568d Mon Sep 17 00:00:00 2001 From: Andy Earnshaw Date: Fri, 20 Dec 2013 19:19:31 +0000 Subject: [PATCH 0310/1271] New syntax checker actionscript/mxmlc --- plugin/syntastic/registry.vim | 1 + syntax_checkers/actionscript/mxmlc.vim | 67 ++++++++++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 syntax_checkers/actionscript/mxmlc.vim diff --git a/plugin/syntastic/registry.vim b/plugin/syntastic/registry.vim index 141cbeb76..891dc1164 100644 --- a/plugin/syntastic/registry.vim +++ b/plugin/syntastic/registry.vim @@ -4,6 +4,7 @@ endif let g:loaded_syntastic_registry = 1 let s:defaultCheckers = { + \ 'actionscript':['mxmlc'], \ 'ada': ['gcc'], \ 'applescript': ['osacompile'], \ 'asciidoc': ['asciidoc'], diff --git a/syntax_checkers/actionscript/mxmlc.vim b/syntax_checkers/actionscript/mxmlc.vim new file mode 100644 index 000000000..2c654de99 --- /dev/null +++ b/syntax_checkers/actionscript/mxmlc.vim @@ -0,0 +1,67 @@ +"============================================================================ +"File: mxmlc.vim +"Description: ActionScript syntax checker - using mxmlc +"Maintainer: Andy Earnshaw +"License: This program is free software. It comes without any warranty, +" to the extent permitted by applicable law. You can redistribute +" it and/or modify it under the terms of the Do What The Fuck You +" Want To Public License, Version 2, as published by Sam Hocevar. +" See http://sam.zoy.org/wtfpl/COPYING for more details. +"============================================================================ + +if exists('g:loaded_syntastic_actionscript_mxmlc_checker') + finish +endif +let g:loaded_syntastic_actionscript_mxmlc_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim + +if !exists('g:syntastic_actionscript_mxmlc_conf') + let g:syntastic_actionscript_mxmlc_conf = '' +endif + +function! SyntaxCheckers_actionscript_mxmlc_GetHighlightRegex(item) + let term = '' + + if match(a:item['text'], "variable '") > -1 + let term = split(a:item['text'], "'")[1] + + elseif match(a:item['text'], 'expected a definition keyword') > -1 + let term = matchlist(a:item['text'], 'not \([^\.]\+\)\.')[1] + + elseif match(a:item['text'], 'undefined \%(property\|method\)') > -1 + let term = matchlist(a:item['text'], 'undefined \%(property\|method\) \([^\. ]\+\)')[1] + + elseif match(a:item['text'], 'could not be found') > -1 + let term = matchlist(a:item['text'], ' \([^ ]\+\) could not be found')[1] + + elseif match(a:item['text'], 'Type was not found') > -1 + let term = matchlist(a:item['text'], ': \([^\.]\+\)\.')[1] + + endif + + return strlen(term) ? '\V\<'.term.'\>' : '' +endfunction + +function! SyntaxCheckers_actionscript_mxmlc_GetLocList() dict + let output = has("win32") ? 'NUL' : '/dev/null' + let makeprg = self.makeprgBuild({ 'args': '-output=' . output . s:Args() }) + + let errorformat = + \ '%f(%l): col: %c %trror: %m,' . + \ '%f(%l): col: %c %tarning: %m,' + + return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) +endfunction + +function s:Args() + return !empty(g:syntastic_actionscript_mxmlc_conf) ? ' -load-config+=' . g:syntastic_actionscript_mxmlc_conf : '' +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'actionscript', + \ 'name': 'mxmlc'}) + +let &cpo = s:save_cpo +unlet s:save_cpo From 65943f4a8bf7d9f89eb2de2b28cf1203004b68d8 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Sat, 21 Dec 2013 09:59:20 +0200 Subject: [PATCH 0311/1271] Cleanup mxmlc checker. --- syntax_checkers/actionscript/mxmlc.vim | 33 +++++++++++++------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/syntax_checkers/actionscript/mxmlc.vim b/syntax_checkers/actionscript/mxmlc.vim index 2c654de99..c836d0b07 100644 --- a/syntax_checkers/actionscript/mxmlc.vim +++ b/syntax_checkers/actionscript/mxmlc.vim @@ -24,39 +24,40 @@ endif function! SyntaxCheckers_actionscript_mxmlc_GetHighlightRegex(item) let term = '' - if match(a:item['text'], "variable '") > -1 - let term = split(a:item['text'], "'")[1] + if match(a:item['text'], '\mvariable ''') > -1 + let term = matchstr(a:item['text'], '\m''\zs[^'']\+\ze''') elseif match(a:item['text'], 'expected a definition keyword') > -1 - let term = matchlist(a:item['text'], 'not \([^\.]\+\)\.')[1] + let term = matchstr(a:item['text'], '\mnot \zs[^.]\+\ze\.') - elseif match(a:item['text'], 'undefined \%(property\|method\)') > -1 - let term = matchlist(a:item['text'], 'undefined \%(property\|method\) \([^\. ]\+\)')[1] + elseif match(a:item['text'], '\mundefined \%(property\|method\)') > -1 + let term = matchstr(a:item['text'], '\mundefined \%(property\|method\) \zs[^. ]\+\ze') elseif match(a:item['text'], 'could not be found') > -1 - let term = matchlist(a:item['text'], ' \([^ ]\+\) could not be found')[1] + let term = matchstr(a:item['text'], '\m \zs\S\+\ze could not be found') elseif match(a:item['text'], 'Type was not found') > -1 - let term = matchlist(a:item['text'], ': \([^\.]\+\)\.')[1] + let term = matchstr(a:item['text'], '\m: \zs[^.]\+\zs\.') endif - return strlen(term) ? '\V\<'.term.'\>' : '' + return strlen(term) ? '\V\<' . term . '\>' : '' endfunction function! SyntaxCheckers_actionscript_mxmlc_GetLocList() dict - let output = has("win32") ? 'NUL' : '/dev/null' - let makeprg = self.makeprgBuild({ 'args': '-output=' . output . s:Args() }) + let makeprg = self.makeprgBuild({ + \ 'args': '-output=' . syntastic#util#DevNull() . + \ !empty(g:syntastic_actionscript_mxmlc_conf) ? + \ ' -load-config+=' . g:syntastic_actionscript_mxmlc_conf : '' }) let errorformat = \ '%f(%l): col: %c %trror: %m,' . - \ '%f(%l): col: %c %tarning: %m,' + \ '%f(%l): col: %c %tarning: %m,' . + \ '%-G%.%#' - return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) -endfunction - -function s:Args() - return !empty(g:syntastic_actionscript_mxmlc_conf) ? ' -load-config+=' . g:syntastic_actionscript_mxmlc_conf : '' + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ From cf56179a246215ae93a9d2f7c4f2f65d275793ee Mon Sep 17 00:00:00 2001 From: Joshua Rahm Date: Fri, 27 Dec 2013 01:07:08 -0700 Subject: [PATCH 0312/1271] added glsl checker --- plugin/syntastic/registry.vim | 1 + syntax_checkers/glsl/cgc.vim | 78 +++++++++++++++++++++++++++++++++++ 2 files changed, 79 insertions(+) create mode 100644 syntax_checkers/glsl/cgc.vim diff --git a/plugin/syntastic/registry.vim b/plugin/syntastic/registry.vim index 891dc1164..1d31fd92a 100644 --- a/plugin/syntastic/registry.vim +++ b/plugin/syntastic/registry.vim @@ -27,6 +27,7 @@ let s:defaultCheckers = { \ 'erlang': ['escript'], \ 'eruby': ['ruby'], \ 'fortran': ['gfortran'], + \ 'glsl': ['cgc'], \ 'go': ['go'], \ 'haml': ['haml'], \ 'handlebars': ['handlebars'], diff --git a/syntax_checkers/glsl/cgc.vim b/syntax_checkers/glsl/cgc.vim new file mode 100644 index 000000000..295982d8e --- /dev/null +++ b/syntax_checkers/glsl/cgc.vim @@ -0,0 +1,78 @@ +"============================================================================ +"File: glsl.vim +"Description: Syntax checker for OpenGL Shading Language +"Maintainer: Joshua Rahm +"Notes: Add the special comment line "// profile: " somewhere in the file +" Followed by what profile to use for the cgc compiler when +" checking the file. The defalt behavior is to pick the profile +" based on the entries of dictionary g:syntastic_glsl_extensions +" or a default dictionary if that variable does not exist +"License: This program is free software. It comes without any warranty, +" to the extent permitted by applicable law. You can redistribute +" it and/or modify it under the terms of the Do What The Fuck You +" Want To Public License, Version 2, as published by Sam Hocevar. +" See http://sam.zoy.org/wtfpl/COPYING for more details. +" +"============================================================================ + + +if exists("g:loaded_syntastic_glsl_cgc_checker") + finish +endif + +let g:loaded_syntastic_glsl_cgc_checker=1 + +function! SyntaxCheckers_glsl_cgc_checker_IsAvailable() dict + return executable(self.getExec()); +endfunction + +function! SyntaxCheckers_glsl_cgc_checker_GetProfile() + let magic = '^// profile: ' + let line = search( magic, 'n' ) + + if line + let profile = substitute( getline(line), magic, '', '' ) + return profile + endif + + if exists('g:syntastic_glsl_extensions') + let profiles = g:syntastic_glsl_cgc_profiles + else + let profiles = { + \ 'glslf': 'gpu_fp', + \ 'glslv': 'gpu_vp', + \ 'frag': 'gpu_fp', + \ 'vert': 'gpu_vp', + \ 'fp': 'gpu_fp', + \ 'vp': 'gpu_vp' } + endif + + + let ext = expand('%:e') + + if has_key(profiles, ext) + return profiles[ext] + else + return 'gpu_vert' + endif +endfunction! + +function! SyntaxCheckers_glsl_cgc_GetLocList() dict + let profile = SyntaxCheckers_glsl_cgc_checker_GetProfile() + + let args = printf("-oglsl -profile %s", profile) + let makeprg = self.makeprgBuild({ + \'args': args }) + + let errorformat = + \ "%E%f(%l) : error %m," . + \ "%W%f(%l) : warning %m" + + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat }) +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \'filetype': 'glsl', + \'name': 'cgc'}) From 99b57c111d7a08d322cdce7249ff93ba6d44aaff Mon Sep 17 00:00:00 2001 From: Joshua Rahm Date: Fri, 27 Dec 2013 01:28:25 -0700 Subject: [PATCH 0313/1271] added ability to add extra arguments --- syntax_checkers/glsl/cgc.vim | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/syntax_checkers/glsl/cgc.vim b/syntax_checkers/glsl/cgc.vim index 295982d8e..0f43864b1 100644 --- a/syntax_checkers/glsl/cgc.vim +++ b/syntax_checkers/glsl/cgc.vim @@ -7,6 +7,8 @@ " checking the file. The defalt behavior is to pick the profile " based on the entries of dictionary g:syntastic_glsl_extensions " or a default dictionary if that variable does not exist +" Use the variable g:syntastic_glsl_extra_args to specify extra +" arguments to pass to the cgc compiler "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 @@ -57,13 +59,22 @@ function! SyntaxCheckers_glsl_cgc_checker_GetProfile() endif endfunction! +function! SyntaxCheckers_glsl_cgc_GetExtraArgs() + if exists('g:syntastic_glsl_extra_args') + return g:syntastic_glsl_extra_args + else + return '' + endif +endfunction + function! SyntaxCheckers_glsl_cgc_GetLocList() dict let profile = SyntaxCheckers_glsl_cgc_checker_GetProfile() - let args = printf("-oglsl -profile %s", profile) + let args = printf("-oglsl -profile %s %s", profile,SyntaxCheckers_glsl_cgc_GetExtraArgs()) let makeprg = self.makeprgBuild({ \'args': args }) + echo makeprg let errorformat = \ "%E%f(%l) : error %m," . \ "%W%f(%l) : warning %m" From 990b50fd028861d0b7bbbd5f222b216f820f0942 Mon Sep 17 00:00:00 2001 From: Joshua Rahm Date: Fri, 27 Dec 2013 01:29:07 -0700 Subject: [PATCH 0314/1271] removed echo --- syntax_checkers/glsl/cgc.vim | 1 - 1 file changed, 1 deletion(-) diff --git a/syntax_checkers/glsl/cgc.vim b/syntax_checkers/glsl/cgc.vim index 0f43864b1..5c83c730e 100644 --- a/syntax_checkers/glsl/cgc.vim +++ b/syntax_checkers/glsl/cgc.vim @@ -74,7 +74,6 @@ function! SyntaxCheckers_glsl_cgc_GetLocList() dict let makeprg = self.makeprgBuild({ \'args': args }) - echo makeprg let errorformat = \ "%E%f(%l) : error %m," . \ "%W%f(%l) : warning %m" From 02b850d0dcf2c7ce43daade0f95e85916ebf254f Mon Sep 17 00:00:00 2001 From: Andy Earnshaw Date: Mon, 30 Dec 2013 16:55:02 +0000 Subject: [PATCH 0315/1271] Fix args in actionscript/mxmlc checker --- syntax_checkers/actionscript/mxmlc.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/syntax_checkers/actionscript/mxmlc.vim b/syntax_checkers/actionscript/mxmlc.vim index c836d0b07..98788e68d 100644 --- a/syntax_checkers/actionscript/mxmlc.vim +++ b/syntax_checkers/actionscript/mxmlc.vim @@ -47,8 +47,8 @@ endfunction function! SyntaxCheckers_actionscript_mxmlc_GetLocList() dict let makeprg = self.makeprgBuild({ \ 'args': '-output=' . syntastic#util#DevNull() . - \ !empty(g:syntastic_actionscript_mxmlc_conf) ? - \ ' -load-config+=' . g:syntastic_actionscript_mxmlc_conf : '' }) + \ (!empty(g:syntastic_actionscript_mxmlc_conf) ? + \ ' -load-config+=' . g:syntastic_actionscript_mxmlc_conf : '') }) let errorformat = \ '%f(%l): col: %c %trror: %m,' . From be1243ba1365882984672890d9720fe30947945f Mon Sep 17 00:00:00 2001 From: lucy Date: Mon, 30 Dec 2013 00:53:05 +0100 Subject: [PATCH 0316/1271] New checker for Go: gotype. --- syntax_checkers/go/gotype.vim | 37 +++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 syntax_checkers/go/gotype.vim diff --git a/syntax_checkers/go/gotype.vim b/syntax_checkers/go/gotype.vim new file mode 100644 index 000000000..d1c6baae3 --- /dev/null +++ b/syntax_checkers/go/gotype.vim @@ -0,0 +1,37 @@ +"============================================================================ +"File: gotype.vim +"Description: Perform syntactic and semantic checking of Go code using 'gotype' +"Maintainer: luz +"License: This program is free software. It comes without any warranty, +" to the extent permitted by applicable law. You can redistribute +" it and/or modify it under the terms of the Do What The Fuck You +" Want To Public License, Version 2, as published by Sam Hocevar. +" See http://sam.zoy.org/wtfpl/COPYING for more details. +" +"============================================================================ +if exists("g:loaded_syntastic_go_gotype_checker") + finish +endif +let g:loaded_syntastic_go_gotype_checker=1 + +function! SyntaxCheckers_go_gotype_GetLocList() dict + let makeprg = self.getExec() . ' .' + + let errorformat = '%f:%l:%c: %m,%-G%.%#' + + " gotype needs the full go package to test types properly. Just cwd to + " the package for the same reasons specified in go.vim ("figuring out + " the import path is fickle"). + + let errors = SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'cwd': expand('%:p:h'), + \ 'defaults': {'type': 'e'} }) + + return errors +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'go', + \ 'name': 'gotype'}) From 886cdb21ec89a35ec47d6811d477382cd6c42a10 Mon Sep 17 00:00:00 2001 From: Steven Myint Date: Fri, 27 Dec 2013 07:32:54 -0800 Subject: [PATCH 0317/1271] Add rstcheck It checks reStructuredText like "rst2pseudoxml.vim" does, but additionally rstcheck checks syntax of code blocks within RST files. https://github.com/myint/rstcheck --- syntax_checkers/rst/rstcheck.vim | 46 ++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 syntax_checkers/rst/rstcheck.vim diff --git a/syntax_checkers/rst/rstcheck.vim b/syntax_checkers/rst/rstcheck.vim new file mode 100644 index 000000000..f98b97c3b --- /dev/null +++ b/syntax_checkers/rst/rstcheck.vim @@ -0,0 +1,46 @@ +"============================================================================ +"File: rstcheck.vim +"Description: Syntax checking for reStructuredText and embedded code blocks +"Authors: Steven Myint +" +"============================================================================ + +" https://github.com/myint/rstcheck +" +" To install rstcheck: +" $ pip install --upgrade rstcheck + +if exists("g:loaded_syntastic_rst_rstcheck_checker") + finish +endif +let g:loaded_syntastic_rst_rstcheck_checker=1 + +function! SyntaxCheckers_rst_rstcheck_GetLocList() dict + let makeprg = self.makeprgBuild({}) + + let errorformat = + \ '%f:%l: (%tNFO/1) %m,'. + \ '%f:%l: (%tARNING/2) %m,'. + \ '%f:%l: (%tRROR/3) %m,'. + \ '%f:%l: (%tEVERE/4) %m,'. + \ '%-G%.%#' + + let loclist = SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat }) + + for e in loclist + if e['type'] ==? 'S' + let e['type'] = 'E' + elseif e['type'] ==? 'I' + let e['type'] = 'W' + let e['subtype'] = 'Style' + endif + endfor + + return loclist +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'rst', + \ 'name': 'rstcheck'}) From 6e1777f70cd2cbfa560182681a98e874bb7684b5 Mon Sep 17 00:00:00 2001 From: Shane da Silva Date: Tue, 31 Dec 2013 22:14:44 -0500 Subject: [PATCH 0318/1271] Add haml-lint syntax/style checker Add a checker `haml-lint` (https://github.com/causes/haml-lint). --- syntax_checkers/haml/haml_lint.vim | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 syntax_checkers/haml/haml_lint.vim diff --git a/syntax_checkers/haml/haml_lint.vim b/syntax_checkers/haml/haml_lint.vim new file mode 100644 index 000000000..43ebd16c0 --- /dev/null +++ b/syntax_checkers/haml/haml_lint.vim @@ -0,0 +1,29 @@ +"============================================================================ +"File: haml_lint.vim +"Description: HAML style and syntax checker plugin for Syntastic +"Maintainer: Shane da Silva +"License: This program is free software. It comes without any warranty, +" to the extent permitted by applicable law. You can redistribute +" it and/or modify it under the terms of the Do What The Fuck You +" Want To Public License, Version 2, as published by Sam Hocevar. +" See http://sam.zoy.org/wtfpl/COPYING for more details. +"============================================================================ + +if exists("g:loaded_syntastic_haml_haml_lint_checker") + finish +endif +let g:loaded_syntastic_haml_haml_lint_checker=1 + +function! SyntaxCheckers_haml_haml_lint_GetLocList() dict + let makeprg = self.makeprgBuild({}) + let errorformat = '%f:%l [%t] %m' + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'subtype': 'Style'}) +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'haml', + \ 'name': 'haml_lint', + \ 'exec': 'haml-lint' }) From 504951f979722411ea2807543379d37717891ca9 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 3 Jan 2014 08:25:24 +0200 Subject: [PATCH 0319/1271] Add ActionScript to the list of supported languages. --- README.markdown | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.markdown b/README.markdown index 3a49c22c7..624818b45 100644 --- a/README.markdown +++ b/README.markdown @@ -25,9 +25,9 @@ demand, or automatically as files are saved. If syntax errors are detected, the user is notified and is happy because they didn't have to compile their code or execute their script to find them. -At the time of this writing, syntax checking plugins exist for Ada, -AppleScript, AsciiDoc, Bourne shell, C, C++, C#, Chef, CoffeeScript, Coco, -Coq, CSS, Cucumber, CUDA, D, Dart, DocBook, Dust, Elixir, Erlang, eRuby, +At the time of this writing, syntax checking plugins exist for ActionScript, +Ada, AppleScript, AsciiDoc, Bourne shell, C, C++, C#, Chef, CoffeeScript, +Coco, Coq, CSS, Cucumber, CUDA, D, Dart, DocBook, Dust, Elixir, Erlang, eRuby, Fortran, Gentoo metadata, Go, Haml, Haskell, Haxe, Handlebars, HSS, HTML, Java, JavaScript, JSON, LESS, Lex, Limbo, LISP, LLVM intermediate language, Lua, MATLAB, NASM, Objective-C, Objective-C++, OCaml, Perl, Perl POD, PHP, From 8856e80c47b41a3b641ef6dfe2fe196a6c26b6ad Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 3 Jan 2014 08:27:26 +0200 Subject: [PATCH 0320/1271] Bit rot: jslint no longer accepts "--undef". Minor cleanup. --- syntax_checkers/javascript/jslint.vim | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/syntax_checkers/javascript/jslint.vim b/syntax_checkers/javascript/jslint.vim index 0f5ce2f61..238761922 100644 --- a/syntax_checkers/javascript/jslint.vim +++ b/syntax_checkers/javascript/jslint.vim @@ -15,10 +15,6 @@ if exists("g:loaded_syntastic_javascript_jslint_checker") endif let g:loaded_syntastic_javascript_jslint_checker=1 -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_jslint_GetHighlightRegex(item) let term = matchstr(a:item['text'], '\mExpected .* and instead saw ''\zs.*\ze''') if term != '' @@ -28,10 +24,10 @@ function! SyntaxCheckers_javascript_jslint_GetHighlightRegex(item) endfunction function! SyntaxCheckers_javascript_jslint_GetLocList() dict - let makeprg = self.makeprgBuild({ 'args': g:syntastic_javascript_jslint_conf }) + let makeprg = self.makeprgBuild({ 'args': '--white --nomen --regexp --plusplus --bitwise --newcap --sloppy --vars' }) let errorformat = - \ '%E %##%n %m,'. + \ '%E %##%\d%\+ %m,'. \ '%-Z%.%#Line %l\, Pos %c,'. \ '%-G%.%#' From 1dbb124b556ff513e88d477490d469fbfff4418f Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 3 Jan 2014 08:56:02 +0200 Subject: [PATCH 0321/1271] Set clang as the default C/C++/Obj-C/Obj-C++ compiler if gcc is not found. --- syntax_checkers/c/gcc.vim | 2 +- syntax_checkers/cpp/gcc.vim | 2 +- syntax_checkers/objc/gcc.vim | 2 +- syntax_checkers/objcpp/gcc.vim | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/syntax_checkers/c/gcc.vim b/syntax_checkers/c/gcc.vim index 0c15142b2..1adca2ee6 100644 --- a/syntax_checkers/c/gcc.vim +++ b/syntax_checkers/c/gcc.vim @@ -17,7 +17,7 @@ endif let g:loaded_syntastic_c_gcc_checker = 1 if !exists('g:syntastic_c_compiler') - let g:syntastic_c_compiler = 'gcc' + let g:syntastic_c_compiler = executable('gcc') ? 'gcc' : 'clang' endif function! SyntaxCheckers_c_gcc_IsAvailable() dict diff --git a/syntax_checkers/cpp/gcc.vim b/syntax_checkers/cpp/gcc.vim index 7b6e085bd..586d022bc 100644 --- a/syntax_checkers/cpp/gcc.vim +++ b/syntax_checkers/cpp/gcc.vim @@ -16,7 +16,7 @@ endif let g:loaded_syntastic_cpp_gcc_checker = 1 if !exists('g:syntastic_cpp_compiler') - let g:syntastic_cpp_compiler = 'g++' + let g:syntastic_cpp_compiler = executable('g++') ? 'g++' : 'clang' endif function! SyntaxCheckers_cpp_gcc_IsAvailable() dict diff --git a/syntax_checkers/objc/gcc.vim b/syntax_checkers/objc/gcc.vim index d9f9e8057..3438e94fa 100644 --- a/syntax_checkers/objc/gcc.vim +++ b/syntax_checkers/objc/gcc.vim @@ -16,7 +16,7 @@ endif let g:loaded_syntastic_objc_gcc_checker = 1 if !exists('g:syntastic_objc_compiler') - let g:syntastic_objc_compiler = 'gcc' + let g:syntastic_objc_compiler = executable('gcc') ? 'gcc' : 'clang' endif function! SyntaxCheckers_objc_gcc_IsAvailable() dict diff --git a/syntax_checkers/objcpp/gcc.vim b/syntax_checkers/objcpp/gcc.vim index 968db1566..5984466e9 100644 --- a/syntax_checkers/objcpp/gcc.vim +++ b/syntax_checkers/objcpp/gcc.vim @@ -16,7 +16,7 @@ endif let g:loaded_syntastic_objcpp_gcc_checker = 1 if !exists('g:syntastic_objcpp_compiler') - let g:syntastic_objcpp_compiler = 'gcc' + let g:syntastic_objcpp_compiler = executable('gcc') ? 'gcc' : 'clang' endif function! SyntaxCheckers_objcpp_gcc_IsAvailable() dict From b07bedb5cc07ee4a5993ee3984734699cc5186af Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 3 Jan 2014 09:54:10 +0200 Subject: [PATCH 0322/1271] Cleanup the glsl/cgc checker. --- README.markdown | 2 +- syntax_checkers/glsl/cgc.vim | 88 ++++++++++++++---------------------- 2 files changed, 35 insertions(+), 55 deletions(-) diff --git a/README.markdown b/README.markdown index 624818b45..c3c6d8941 100644 --- a/README.markdown +++ b/README.markdown @@ -28,7 +28,7 @@ execute their script to find them. At the time of this writing, syntax checking plugins exist for ActionScript, Ada, AppleScript, AsciiDoc, Bourne shell, C, C++, C#, Chef, CoffeeScript, Coco, Coq, CSS, Cucumber, CUDA, D, Dart, DocBook, Dust, Elixir, Erlang, eRuby, -Fortran, Gentoo metadata, Go, Haml, Haskell, Haxe, Handlebars, HSS, HTML, +Fortran, Gentoo metadata, GLSL, Go, Haml, Haskell, Haxe, Handlebars, HSS, HTML, Java, JavaScript, JSON, LESS, Lex, Limbo, LISP, LLVM intermediate language, Lua, MATLAB, NASM, Objective-C, Objective-C++, OCaml, Perl, Perl POD, PHP, gettext Portable Object, Puppet, Python, Racket, reStructuredText, Ruby, Rust, diff --git a/syntax_checkers/glsl/cgc.vim b/syntax_checkers/glsl/cgc.vim index 5c83c730e..5b52c6a87 100644 --- a/syntax_checkers/glsl/cgc.vim +++ b/syntax_checkers/glsl/cgc.vim @@ -2,13 +2,6 @@ "File: glsl.vim "Description: Syntax checker for OpenGL Shading Language "Maintainer: Joshua Rahm -"Notes: Add the special comment line "// profile: " somewhere in the file -" Followed by what profile to use for the cgc compiler when -" checking the file. The defalt behavior is to pick the profile -" based on the entries of dictionary g:syntastic_glsl_extensions -" or a default dictionary if that variable does not exist -" Use the variable g:syntastic_glsl_extra_args to specify extra -" arguments to pass to the cgc compiler "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 @@ -17,62 +10,28 @@ " "============================================================================ - if exists("g:loaded_syntastic_glsl_cgc_checker") finish endif -let g:loaded_syntastic_glsl_cgc_checker=1 - -function! SyntaxCheckers_glsl_cgc_checker_IsAvailable() dict - return executable(self.getExec()); -endfunction - -function! SyntaxCheckers_glsl_cgc_checker_GetProfile() - let magic = '^// profile: ' - let line = search( magic, 'n' ) - - if line - let profile = substitute( getline(line), magic, '', '' ) - return profile - endif - - if exists('g:syntastic_glsl_extensions') - let profiles = g:syntastic_glsl_cgc_profiles - else - let profiles = { - \ 'glslf': 'gpu_fp', - \ 'glslv': 'gpu_vp', - \ 'frag': 'gpu_fp', - \ 'vert': 'gpu_vp', - \ 'fp': 'gpu_fp', - \ 'vp': 'gpu_vp' } - endif - +let g:loaded_syntastic_glsl_cgc_checker = 1 - let ext = expand('%:e') - - if has_key(profiles, ext) - return profiles[ext] - else - return 'gpu_vert' - endif -endfunction! +let s:glsl_extensions = { + \ 'glslf': 'gpu_fp', + \ 'glslv': 'gpu_vp', + \ 'frag': 'gpu_fp', + \ 'vert': 'gpu_vp', + \ 'fp': 'gpu_fp', + \ 'vp': 'gpu_vp' + \ } -function! SyntaxCheckers_glsl_cgc_GetExtraArgs() - if exists('g:syntastic_glsl_extra_args') - return g:syntastic_glsl_extra_args - else - return '' - endif -endfunction +let s:save_cpo = &cpo +set cpo&vim function! SyntaxCheckers_glsl_cgc_GetLocList() dict - let profile = SyntaxCheckers_glsl_cgc_checker_GetProfile() - - let args = printf("-oglsl -profile %s %s", profile,SyntaxCheckers_glsl_cgc_GetExtraArgs()) let makeprg = self.makeprgBuild({ - \'args': args }) + \ 'args': '-oglsl -profile ' . s:GetProfile() . + \ (exists('g:syntastic_glsl_options') ? ' ' . g:syntastic_glsl_options : '') }) let errorformat = \ "%E%f(%l) : error %m," . @@ -83,6 +42,27 @@ function! SyntaxCheckers_glsl_cgc_GetLocList() dict \ 'errorformat': errorformat }) endfunction +function! s:GetProfile() + let save_cursor = getpos('.') + let magic = '\m\C^// profile:\s*' + let line = search(magic, 'c') + call setpos('.', save_cursor) + + if line + let profile = matchstr(getline(line), magic . '\zs.*') + else + let extensions = exists('g:syntastic_glsl_extensions') ? g:syntastic_glsl_extensions : s:glsl_extensions + let profile = get(extensions, tolower(expand('%:e')), 'gpu_vert') + endif + + return profile +endfunction! + call g:SyntasticRegistry.CreateAndRegisterChecker({ \'filetype': 'glsl', \'name': 'cgc'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: From 0df0458e441bb76323b143b33c934e340a0761ca Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 3 Jan 2014 10:13:34 +0200 Subject: [PATCH 0323/1271] Minor fix: use clang++ instead of clang for C++. --- syntax_checkers/cpp/gcc.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntax_checkers/cpp/gcc.vim b/syntax_checkers/cpp/gcc.vim index 586d022bc..c55b9c6b9 100644 --- a/syntax_checkers/cpp/gcc.vim +++ b/syntax_checkers/cpp/gcc.vim @@ -16,7 +16,7 @@ endif let g:loaded_syntastic_cpp_gcc_checker = 1 if !exists('g:syntastic_cpp_compiler') - let g:syntastic_cpp_compiler = executable('g++') ? 'g++' : 'clang' + let g:syntastic_cpp_compiler = executable('g++') ? 'g++' : 'clang++' endif function! SyntaxCheckers_cpp_gcc_IsAvailable() dict From c3be05eb68cc5b08604dcfdf06890d58d54a1a3f Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 3 Jan 2014 10:43:01 +0200 Subject: [PATCH 0324/1271] HTML validator and w3: allow user to set the path to curl. --- syntax_checkers/html/validator.vim | 9 +++------ syntax_checkers/html/w3.vim | 9 +++------ 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/syntax_checkers/html/validator.vim b/syntax_checkers/html/validator.vim index 8b0c28b79..17bdcccb7 100644 --- a/syntax_checkers/html/validator.vim +++ b/syntax_checkers/html/validator.vim @@ -45,10 +45,6 @@ if !exists('g:syntastic_html_validator_nsfilter') let g:syntastic_html_validator_nsfilter = '' endif -function! SyntaxCheckers_html_validator_IsAvailable() dict - return executable('curl') -endfunction - function! SyntaxCheckers_html_validator_Preprocess(errors) let out = [] for e in a:errors @@ -66,7 +62,7 @@ endfunction function! SyntaxCheckers_html_validator_GetLocList() dict let fname = syntastic#util#shexpand('%') - let makeprg = 'curl -s --compressed -F out=gnu -F asciiquotes=yes' . + let makeprg = self.getExec() . ' -s --compressed -F out=gnu -F asciiquotes=yes' . \ (!empty(g:syntastic_html_validator_parser) ? ' -F parser=' . g:syntastic_html_validator_parser : '') . \ (!empty(g:syntastic_html_validator_nsfilter) ? ' -F nsfilter=' . g:syntastic_html_validator_nsfilter : '') . \ ' -F doc=@' . fname . '\;type=text/html\;filename=' . fname . ' ' . g:syntastic_html_validator_api @@ -94,4 +90,5 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'html', - \ 'name': 'validator'}) + \ 'name': 'validator', + \ 'exec': 'curl' }) diff --git a/syntax_checkers/html/w3.vim b/syntax_checkers/html/w3.vim index 59747b025..293c1c89c 100644 --- a/syntax_checkers/html/w3.vim +++ b/syntax_checkers/html/w3.vim @@ -26,12 +26,8 @@ if !exists('g:syntastic_html_w3_api') let g:syntastic_html_w3_api = 'http://validator.w3.org/check' endif -function! SyntaxCheckers_html_w3_IsAvailable() dict - return executable('curl') -endfunction - function! SyntaxCheckers_html_w3_GetLocList() dict - let makeprg = 'curl -s -F output=json ' . + let makeprg = self.getExec() . ' -s -F output=json ' . \ '-F uploaded_file=@' . syntastic#util#shexpand('%:p') . '\;type=text/html ' . \ g:syntastic_html_w3_api @@ -61,5 +57,6 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'html', - \ 'name': 'w3'}) + \ 'name': 'w3', + \ 'exec': 'curl' }) From efbfb894f1edacbe3f0bcf61d982364298954a0d Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 3 Jan 2014 10:47:06 +0200 Subject: [PATCH 0325/1271] Minor cleanup for gotype. --- syntax_checkers/go/gotype.vim | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/syntax_checkers/go/gotype.vim b/syntax_checkers/go/gotype.vim index d1c6baae3..4d9c91065 100644 --- a/syntax_checkers/go/gotype.vim +++ b/syntax_checkers/go/gotype.vim @@ -12,12 +12,17 @@ if exists("g:loaded_syntastic_go_gotype_checker") finish endif -let g:loaded_syntastic_go_gotype_checker=1 +let g:loaded_syntastic_go_gotype_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim function! SyntaxCheckers_go_gotype_GetLocList() dict let makeprg = self.getExec() . ' .' - let errorformat = '%f:%l:%c: %m,%-G%.%#' + let errorformat = + \ '%f:%l:%c: %m,' . + \ '%-G%.%#' " gotype needs the full go package to test types properly. Just cwd to " the package for the same reasons specified in go.vim ("figuring out @@ -35,3 +40,8 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'go', \ 'name': 'gotype'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: From 233f1516ed4b3e73c5fd78bbc31544473305ad7e Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 3 Jan 2014 11:02:46 +0200 Subject: [PATCH 0326/1271] Minor cleanup for haml_lint. --- syntax_checkers/haml/haml_lint.vim | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/syntax_checkers/haml/haml_lint.vim b/syntax_checkers/haml/haml_lint.vim index 43ebd16c0..160d9a5a1 100644 --- a/syntax_checkers/haml/haml_lint.vim +++ b/syntax_checkers/haml/haml_lint.vim @@ -12,7 +12,10 @@ if exists("g:loaded_syntastic_haml_haml_lint_checker") finish endif -let g:loaded_syntastic_haml_haml_lint_checker=1 +let g:loaded_syntastic_haml_haml_lint_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim function! SyntaxCheckers_haml_haml_lint_GetLocList() dict let makeprg = self.makeprgBuild({}) @@ -27,3 +30,8 @@ call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'haml', \ 'name': 'haml_lint', \ 'exec': 'haml-lint' }) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: From 2d652981ce2c9c4639244a207931058e6848a23b Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 3 Jan 2014 11:29:08 +0200 Subject: [PATCH 0327/1271] Minor cleanup: &cpo guards and formatting. --- syntax_checkers/actionscript/mxmlc.vim | 8 ++++--- syntax_checkers/ada/gcc.vim | 6 ++--- syntax_checkers/applescript/osacompile.vim | 12 ++++++++-- syntax_checkers/asciidoc/asciidoc.vim | 8 +++++++ syntax_checkers/c/checkpatch.vim | 9 ++++++++ syntax_checkers/c/cppcheck.vim | 8 +++++++ syntax_checkers/c/gcc.vim | 7 +++--- syntax_checkers/c/make.vim | 2 ++ syntax_checkers/c/oclint.vim | 8 +++++++ syntax_checkers/c/sparse.vim | 8 +++++++ syntax_checkers/c/splint.vim | 8 +++++++ syntax_checkers/c/ycm.vim | 2 ++ syntax_checkers/chef/foodcritic.vim | 14 ++++++++++-- syntax_checkers/co/coco.vim | 18 ++++++++++----- syntax_checkers/cobol/cobc.vim | 6 ++--- syntax_checkers/coffee/coffee.vim | 15 +++++++++++-- syntax_checkers/coffee/coffeelint.vim | 11 +++++++++- syntax_checkers/coq/coqtop.vim | 10 ++++++++- syntax_checkers/cpp/cppcheck.vim | 8 +++++++ syntax_checkers/cpp/cpplint.vim | 8 +++++++ syntax_checkers/cpp/gcc.vim | 6 ++--- syntax_checkers/cpp/oclint.vim | 2 ++ syntax_checkers/cpp/ycm.vim | 2 ++ syntax_checkers/cs/mcs.vim | 10 ++++++++- syntax_checkers/css/csslint.vim | 10 ++++++++- syntax_checkers/css/phpcs.vim | 5 ++++- syntax_checkers/css/prettycss.vim | 10 ++++++++- syntax_checkers/cucumber/cucumber.vim | 10 ++++++++- syntax_checkers/cuda/nvcc.vim | 11 ++++++++-- syntax_checkers/d/dmd.vim | 6 ++--- syntax_checkers/dart/dartanalyzer.vim | 9 ++++++++ syntax_checkers/docbk/xmllint.vim | 4 +++- syntax_checkers/dustjs/swiffer.vim | 10 ++++++--- syntax_checkers/elixir/elixir.vim | 11 +++++++++- syntax_checkers/erlang/escript.vim | 8 +++++++ syntax_checkers/eruby/ruby.vim | 10 ++++++++- syntax_checkers/fortran/gfortran.vim | 6 ++--- syntax_checkers/glsl/cgc.vim | 1 - syntax_checkers/go/go.vim | 11 +++++++++- syntax_checkers/go/gofmt.vim | 11 +++++++++- syntax_checkers/go/golint.vim | 11 +++++++++- syntax_checkers/go/gotype.vim | 1 + syntax_checkers/go/govet.vim | 11 +++++++++- syntax_checkers/haml/haml.vim | 10 ++++++++- syntax_checkers/handlebars/handlebars.vim | 11 +++++++++- syntax_checkers/haskell/ghc-mod.vim | 10 ++++++++- syntax_checkers/haskell/hdevtools.vim | 9 +++++++- syntax_checkers/haskell/hlint.vim | 8 +++++++ syntax_checkers/haxe/haxe.vim | 10 ++++++++- syntax_checkers/hss/hss.vim | 10 ++++++++- syntax_checkers/html/tidy.vim | 7 ++++++ syntax_checkers/html/validator.vim | 8 +++++++ syntax_checkers/html/w3.vim | 7 ++++++ syntax_checkers/java/checkstyle.vim | 11 +++++++++- syntax_checkers/java/javac.vim | 7 ++++++ .../javascript/closurecompiler.vim | 14 ++++++++++-- syntax_checkers/javascript/eslint.vim | 9 +++++++- syntax_checkers/javascript/gjslint.vim | 10 ++++++++- syntax_checkers/javascript/jshint.vim | 9 +++++++- syntax_checkers/javascript/jsl.vim | 10 ++++++++- syntax_checkers/javascript/jslint.vim | 10 ++++++++- syntax_checkers/json/jsonlint.vim | 10 ++++++++- syntax_checkers/json/jsonval.vim | 10 ++++++++- syntax_checkers/less/lessc.vim | 10 ++++++++- syntax_checkers/lex/flex.vim | 2 ++ syntax_checkers/limbo/limbo.vim | 8 +++++++ syntax_checkers/lisp/clisp.vim | 11 +++++++++- syntax_checkers/llvm/llvm.vim | 10 ++++++++- syntax_checkers/lua/luac.vim | 10 ++++++++- syntax_checkers/matlab/mlint.vim | 10 ++++++++- syntax_checkers/nasm/nasm.vim | 11 +++++++++- syntax_checkers/nroff/mandoc.vim | 10 ++++++++- syntax_checkers/objc/gcc.vim | 6 ++--- syntax_checkers/objc/oclint.vim | 2 ++ syntax_checkers/objc/ycm.vim | 2 ++ syntax_checkers/objcpp/gcc.vim | 6 ++--- syntax_checkers/objcpp/oclint.vim | 2 ++ syntax_checkers/objcpp/ycm.vim | 2 ++ syntax_checkers/ocaml/camlp4o.vim | 10 ++++++++- syntax_checkers/perl/perl.vim | 8 +++++++ syntax_checkers/perl/perlcritic.vim | 10 ++++++++- syntax_checkers/perl/podchecker.vim | 4 +++- syntax_checkers/php/php.vim | 10 ++++++++- syntax_checkers/php/phpcs.vim | 12 ++++++++-- syntax_checkers/php/phpmd.vim | 10 ++++++++- syntax_checkers/po/msgfmt.vim | 9 +++++++- syntax_checkers/pod/podchecker.vim | 10 ++++++++- syntax_checkers/puppet/puppet.vim | 10 ++++++++- syntax_checkers/puppet/puppetlint.vim | 10 ++++++++- syntax_checkers/python/flake8.vim | 15 ++++++++++--- syntax_checkers/python/pep257.vim | 8 +++++++ syntax_checkers/python/pep8.vim | 10 ++++++++- syntax_checkers/python/py3kwarn.vim | 11 +++++++++- syntax_checkers/python/pyflakes.vim | 9 ++++++++ syntax_checkers/python/pylama.vim | 13 +++++++++-- syntax_checkers/python/pylint.vim | 9 ++++++++ syntax_checkers/python/python.vim | 11 +++++++++- syntax_checkers/racket/racket.vim | 4 ++-- syntax_checkers/rst/rst2pseudoxml.vim | 22 ++++++++++--------- syntax_checkers/rst/rstcheck.vim | 15 ++++++++----- syntax_checkers/ruby/jruby.vim | 11 +++++++++- syntax_checkers/ruby/macruby.vim | 11 +++++++++- syntax_checkers/ruby/mri.vim | 10 ++++++++- syntax_checkers/ruby/rubocop.vim | 10 ++++++++- syntax_checkers/ruby/rubylint.vim | 8 ++++++- syntax_checkers/rust/rustc.vim | 10 ++++++++- syntax_checkers/sass/sass.vim | 10 ++++++++- syntax_checkers/scala/fsc.vim | 8 +++++++ syntax_checkers/scala/scalac.vim | 10 ++++++++- syntax_checkers/scss/sass.vim | 4 +++- syntax_checkers/scss/scss_lint.vim | 10 ++++++++- syntax_checkers/sh/checkbashisms.vim | 11 ++++++++-- syntax_checkers/sh/sh.vim | 10 ++++++++- syntax_checkers/sh/shellcheck.vim | 8 +++++++ syntax_checkers/slim/slimrb.vim | 10 ++++++++- syntax_checkers/tcl/nagelfar.vim | 11 +++++++++- syntax_checkers/tex/chktex.vim | 8 +++++++ syntax_checkers/tex/lacheck.vim | 10 ++++++++- syntax_checkers/text/atdtool.vim | 8 +++++++ syntax_checkers/twig/twiglint.vim | 10 ++++++++- syntax_checkers/typescript/tsc.vim | 10 ++++++++- syntax_checkers/vala/valac.vim | 8 +++++++ syntax_checkers/vhdl/ghdl.vim | 9 ++++++++ syntax_checkers/xhtml/tidy.vim | 10 ++++++++- syntax_checkers/xml/xmllint.vim | 10 ++++++++- syntax_checkers/xslt/xmllint.vim | 4 +++- syntax_checkers/yacc/bison.vim | 2 ++ syntax_checkers/yaml/jsyaml.vim | 10 ++++++++- syntax_checkers/yaml/yamlxs.vim | 10 ++++++++- syntax_checkers/z80/z80syntaxchecker.vim | 10 ++++++++- syntax_checkers/zpt/zptlint.vim | 10 ++++++++- syntax_checkers/zsh/zsh.vim | 10 ++++++++- 132 files changed, 1019 insertions(+), 146 deletions(-) diff --git a/syntax_checkers/actionscript/mxmlc.vim b/syntax_checkers/actionscript/mxmlc.vim index 98788e68d..c9a1f768f 100644 --- a/syntax_checkers/actionscript/mxmlc.vim +++ b/syntax_checkers/actionscript/mxmlc.vim @@ -14,13 +14,13 @@ if exists('g:loaded_syntastic_actionscript_mxmlc_checker') endif let g:loaded_syntastic_actionscript_mxmlc_checker = 1 -let s:save_cpo = &cpo -set cpo&vim - if !exists('g:syntastic_actionscript_mxmlc_conf') let g:syntastic_actionscript_mxmlc_conf = '' endif +let s:save_cpo = &cpo +set cpo&vim + function! SyntaxCheckers_actionscript_mxmlc_GetHighlightRegex(item) let term = '' @@ -66,3 +66,5 @@ call g:SyntasticRegistry.CreateAndRegisterChecker({ let &cpo = s:save_cpo unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/ada/gcc.vim b/syntax_checkers/ada/gcc.vim index faefa90a0..f44d611ad 100644 --- a/syntax_checkers/ada/gcc.vim +++ b/syntax_checkers/ada/gcc.vim @@ -16,13 +16,13 @@ if !exists('g:syntastic_ada_compiler') let g:syntastic_ada_compiler = 'gcc' endif +let s:save_cpo = &cpo +set cpo&vim + function! SyntaxCheckers_ada_gcc_IsAvailable() dict return executable(expand(g:syntastic_ada_compiler)) endfunction -let s:save_cpo = &cpo -set cpo&vim - if !exists('g:syntastic_ada_compiler_options') let g:syntastic_ada_compiler_options = '' endif diff --git a/syntax_checkers/applescript/osacompile.vim b/syntax_checkers/applescript/osacompile.vim index bf10d7221..b57512f4a 100644 --- a/syntax_checkers/applescript/osacompile.vim +++ b/syntax_checkers/applescript/osacompile.vim @@ -28,7 +28,10 @@ if exists("g:loaded_syntastic_applescript_osacompile_checker") finish endif -let g:loaded_syntastic_applescript_osacompile_checker=1 +let g:loaded_syntastic_applescript_osacompile_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim function! SyntaxCheckers_applescript_osacompile_GetLocList() dict let makeprg = self.makeprgBuild({ 'args': '-o ' . tempname() . '.scpt' }) @@ -38,4 +41,9 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'applescript', - \ 'name': 'osacompile'}) + \ 'name': 'osacompile' }) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/asciidoc/asciidoc.vim b/syntax_checkers/asciidoc/asciidoc.vim index 41bd6c282..2b261ca3c 100644 --- a/syntax_checkers/asciidoc/asciidoc.vim +++ b/syntax_checkers/asciidoc/asciidoc.vim @@ -15,6 +15,9 @@ if exists("g:loaded_syntastic_asciidoc_asciidoc_checker") endif let g:loaded_syntastic_asciidoc_asciidoc_checker = 1 +let s:save_cpo = &cpo +set cpo&vim + function! SyntaxCheckers_asciidoc_asciidoc_GetLocList() dict let makeprg = self.makeprgBuild({ 'args': syntastic#c#NullOutput() }) @@ -37,3 +40,8 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'asciidoc', \ 'name': 'asciidoc'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/c/checkpatch.vim b/syntax_checkers/c/checkpatch.vim index f9a137ca7..746e2f553 100644 --- a/syntax_checkers/c/checkpatch.vim +++ b/syntax_checkers/c/checkpatch.vim @@ -8,6 +8,7 @@ " Want To Public License, Version 2, as published by Sam Hocevar. " See http://sam.zoy.org/wtfpl/COPYING for more details. "============================================================================ + if exists("g:loaded_syntastic_c_checkpatch_checker") finish endif @@ -20,6 +21,9 @@ elseif executable("./scripts/checkpatch.pl") let g:syntastic_c_checker_checkpatch_location = './scripts/checkpatch.pl' endif +let s:save_cpo = &cpo +set cpo&vim + function! SyntaxCheckers_c_checkpatch_IsAvailable() dict return exists("g:syntastic_c_checker_checkpatch_location") endfunction @@ -44,3 +48,8 @@ call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'c', \ 'name': 'checkpatch', \ 'exec': 'checkpatch.pl'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/c/cppcheck.vim b/syntax_checkers/c/cppcheck.vim index 96a4f9477..6e943cd01 100644 --- a/syntax_checkers/c/cppcheck.vim +++ b/syntax_checkers/c/cppcheck.vim @@ -25,6 +25,9 @@ if !exists('g:syntastic_cppcheck_config_file') let g:syntastic_cppcheck_config_file = '.syntastic_cppcheck_config' endif +let s:save_cpo = &cpo +set cpo&vim + function! SyntaxCheckers_c_cppcheck_GetLocList() dict let makeprg = self.makeprgBuild({ \ 'args': '-q ' . syntastic#c#ReadConfig(g:syntastic_cppcheck_config_file), @@ -58,3 +61,8 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'c', \ 'name': 'cppcheck'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/c/gcc.vim b/syntax_checkers/c/gcc.vim index 1adca2ee6..0832efde9 100644 --- a/syntax_checkers/c/gcc.vim +++ b/syntax_checkers/c/gcc.vim @@ -10,7 +10,6 @@ " "============================================================================ - if exists('g:loaded_syntastic_c_gcc_checker') finish endif @@ -20,13 +19,13 @@ if !exists('g:syntastic_c_compiler') let g:syntastic_c_compiler = executable('gcc') ? 'gcc' : 'clang' endif +let s:save_cpo = &cpo +set cpo&vim + function! SyntaxCheckers_c_gcc_IsAvailable() dict return executable(expand(g:syntastic_c_compiler)) endfunction -let s:save_cpo = &cpo -set cpo&vim - if !exists('g:syntastic_c_compiler_options') let g:syntastic_c_compiler_options = '-std=gnu99' endif diff --git a/syntax_checkers/c/make.vim b/syntax_checkers/c/make.vim index 56e283e4e..c019da5a4 100644 --- a/syntax_checkers/c/make.vim +++ b/syntax_checkers/c/make.vim @@ -57,3 +57,5 @@ call g:SyntasticRegistry.CreateAndRegisterChecker({ let &cpo = s:save_cpo unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/c/oclint.vim b/syntax_checkers/c/oclint.vim index 9e9e098c6..db270c2e0 100644 --- a/syntax_checkers/c/oclint.vim +++ b/syntax_checkers/c/oclint.vim @@ -25,6 +25,9 @@ if !exists('g:syntastic_oclint_config_file') let g:syntastic_oclint_config_file = '.syntastic_oclint_config' endif +let s:save_cpo = &cpo +set cpo&vim + function! SyntaxCheckers_c_oclint_GetLocList() dict let makeprg = self.makeprgBuild({ \ 'post_args': '-- -c ' . syntastic#c#ReadConfig(g:syntastic_oclint_config_file) }) @@ -48,3 +51,8 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'c', \ 'name': 'oclint'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/c/sparse.vim b/syntax_checkers/c/sparse.vim index 11d5dfbb5..aa01320fb 100644 --- a/syntax_checkers/c/sparse.vim +++ b/syntax_checkers/c/sparse.vim @@ -25,6 +25,9 @@ if !exists('g:syntastic_sparse_config_file') let g:syntastic_sparse_config_file = '.syntastic_sparse_config' endif +let s:save_cpo = &cpo +set cpo&vim + function! SyntaxCheckers_c_sparse_GetLocList() dict let makeprg = self.makeprgBuild({ \ 'args': '-ftabstop=' . &ts . ' ' . syntastic#c#ReadConfig(g:syntastic_sparse_config_file) }) @@ -42,3 +45,8 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'c', \ 'name': 'sparse'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/c/splint.vim b/syntax_checkers/c/splint.vim index 4b55e5e5e..a4413946e 100644 --- a/syntax_checkers/c/splint.vim +++ b/syntax_checkers/c/splint.vim @@ -25,6 +25,9 @@ if !exists('g:syntastic_splint_config_file') let g:syntastic_splint_config_file = '.syntastic_splint_config' endif +let s:save_cpo = &cpo +set cpo&vim + function! SyntaxCheckers_c_splint_GetLocList() dict let makeprg = self.makeprgBuild({ \ 'post_args': '-showfunc -hints +quiet ' . syntastic#c#ReadConfig(g:syntastic_splint_config_file) }) @@ -48,3 +51,8 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'c', \ 'name': 'splint'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/c/ycm.vim b/syntax_checkers/c/ycm.vim index d410aba6c..6e9f06c39 100644 --- a/syntax_checkers/c/ycm.vim +++ b/syntax_checkers/c/ycm.vim @@ -30,3 +30,5 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'c', \ 'name': 'ycm'}) + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/chef/foodcritic.vim b/syntax_checkers/chef/foodcritic.vim index 8fec3236e..e77733311 100644 --- a/syntax_checkers/chef/foodcritic.vim +++ b/syntax_checkers/chef/foodcritic.vim @@ -13,7 +13,10 @@ if exists("g:loaded_syntastic_chef_foodcritic_checker") finish endif -let g:loaded_syntastic_chef_foodcritic_checker=1 +let g:loaded_syntastic_chef_foodcritic_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim function! SyntaxCheckers_chef_foodcritic_GetLocList() dict let makeprg = self.makeprgBuild({}) @@ -21,9 +24,16 @@ function! SyntaxCheckers_chef_foodcritic_GetLocList() dict " FC023: Prefer conditional attributes: ./recipes/config.rb:49 let errorformat = 'FC%n: %m: %f:%l' - return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'chef', \ 'name': 'foodcritic'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/co/coco.vim b/syntax_checkers/co/coco.vim index 95977be14..edad1d7b7 100644 --- a/syntax_checkers/co/coco.vim +++ b/syntax_checkers/co/coco.vim @@ -9,15 +9,14 @@ " See http://sam.zoy.org/wtfpl/COPYING for more details. " "============================================================================ + if exists("g:loaded_syntastic_co_coco_checker") finish endif -let g:loaded_syntastic_co_coco_checker=1 +let g:loaded_syntastic_co_coco_checker = 1 -"bail if the user doesnt have coco installed -if !executable("coco") - finish -endif +let s:save_cpo = &cpo +set cpo&vim function! SyntaxCheckers_co_coco_GetLocList() dict let makeprg = self.makeprgBuild({ 'args': '-c -o /tmp' }) @@ -28,9 +27,16 @@ function! SyntaxCheckers_co_coco_GetLocList() dict \ '%EFailed at: %f,'. \ '%Z%trror: Parse error on line %l: %m' - return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'co', \ 'name': 'coco'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/cobol/cobc.vim b/syntax_checkers/cobol/cobc.vim index 41fa1aa42..7a791de45 100644 --- a/syntax_checkers/cobol/cobc.vim +++ b/syntax_checkers/cobol/cobc.vim @@ -20,13 +20,13 @@ if !exists('g:syntastic_cobol_compiler') let g:syntastic_cobol_compiler = 'cobc' endif +let s:save_cpo = &cpo +set cpo&vim + function! SyntaxCheckers_cobol_cobc_IsAvailable() dict return executable(expand(g:syntastic_cobol_compiler)) endfunction -let s:save_cpo = &cpo -set cpo&vim - if !exists('g:syntastic_cobol_compiler_options') let g:syntastic_cobol_compiler_options = '' endif diff --git a/syntax_checkers/coffee/coffee.vim b/syntax_checkers/coffee/coffee.vim index b1ae906ee..3fa525139 100644 --- a/syntax_checkers/coffee/coffee.vim +++ b/syntax_checkers/coffee/coffee.vim @@ -12,10 +12,14 @@ " " Note: this script requires CoffeeScript version 1.6.2 or newer. " + if exists("g:loaded_syntastic_coffee_coffee_checker") finish endif -let g:loaded_syntastic_coffee_coffee_checker=1 +let g:loaded_syntastic_coffee_coffee_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim function! SyntaxCheckers_coffee_coffee_IsAvailable() dict let exe = self.getExec() @@ -37,9 +41,16 @@ function! SyntaxCheckers_coffee_coffee_GetLocList() dict \ '%-Z%p^,' . \ '%-G%.%#' - return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'coffee', \ 'name': 'coffee'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/coffee/coffeelint.vim b/syntax_checkers/coffee/coffeelint.vim index 40eb189ec..efa95376f 100644 --- a/syntax_checkers/coffee/coffeelint.vim +++ b/syntax_checkers/coffee/coffeelint.vim @@ -9,10 +9,14 @@ " See http://sam.zoy.org/wtfpl/COPYING for more details. " "============================================================================ + if exists("g:loaded_syntastic_coffee_coffeelint_checker") finish endif -let g:loaded_syntastic_coffee_coffeelint_checker=1 +let g:loaded_syntastic_coffee_coffeelint_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim function! SyntaxCheckers_coffee_coffeelint_GetLocList() dict let makeprg = self.makeprgBuild({ 'args': '--csv' }) @@ -33,3 +37,8 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'coffee', \ 'name': 'coffeelint'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/coq/coqtop.vim b/syntax_checkers/coq/coqtop.vim index cb3597ffe..714e93b78 100644 --- a/syntax_checkers/coq/coqtop.vim +++ b/syntax_checkers/coq/coqtop.vim @@ -13,7 +13,10 @@ if exists("g:loaded_syntastic_coq_coqtop_checker") finish endif -let g:loaded_syntastic_coq_coqtop_checker=1 +let g:loaded_syntastic_coq_coqtop_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim function! SyntaxCheckers_coq_coqtop_GetLocList() dict let makeprg = self.makeprgBuild({ 'args': '-noglob -batch -load-vernac-source' }) @@ -30,3 +33,8 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'coq', \ 'name': 'coqtop'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/cpp/cppcheck.vim b/syntax_checkers/cpp/cppcheck.vim index 091caa89b..73e9b0e2f 100644 --- a/syntax_checkers/cpp/cppcheck.vim +++ b/syntax_checkers/cpp/cppcheck.vim @@ -25,6 +25,9 @@ if !exists('g:syntastic_cppcheck_config_file') let g:syntastic_cppcheck_config_file = '.syntastic_cppcheck_config' endif +let s:save_cpo = &cpo +set cpo&vim + function! SyntaxCheckers_cpp_cppcheck_GetLocList() dict let makeprg = self.makeprgBuild({ \ 'args': '-q ' . syntastic#c#ReadConfig(g:syntastic_cppcheck_config_file), @@ -58,3 +61,8 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'cpp', \ 'name': 'cppcheck'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/cpp/cpplint.vim b/syntax_checkers/cpp/cpplint.vim index 32bda206a..923301f76 100644 --- a/syntax_checkers/cpp/cpplint.vim +++ b/syntax_checkers/cpp/cpplint.vim @@ -31,6 +31,9 @@ if !exists('g:syntastic_cpp_cpplint_thres') let g:syntastic_cpp_cpplint_thres = 5 endif +let s:save_cpo = &cpo +set cpo&vim + function! SyntaxCheckers_cpp_cpplint_GetLocList() dict let makeprg = self.makeprgBuild({ 'args': '--verbose=3' }) @@ -53,3 +56,8 @@ call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'cpp', \ 'name': 'cpplint', \ 'exec': 'cpplint.py'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/cpp/gcc.vim b/syntax_checkers/cpp/gcc.vim index c55b9c6b9..0d77d4dd0 100644 --- a/syntax_checkers/cpp/gcc.vim +++ b/syntax_checkers/cpp/gcc.vim @@ -19,13 +19,13 @@ if !exists('g:syntastic_cpp_compiler') let g:syntastic_cpp_compiler = executable('g++') ? 'g++' : 'clang++' endif +let s:save_cpo = &cpo +set cpo&vim + function! SyntaxCheckers_cpp_gcc_IsAvailable() dict return executable(expand(g:syntastic_cpp_compiler)) endfunction -let s:save_cpo = &cpo -set cpo&vim - if !exists('g:syntastic_cpp_compiler_options') let g:syntastic_cpp_compiler_options = '' endif diff --git a/syntax_checkers/cpp/oclint.vim b/syntax_checkers/cpp/oclint.vim index 70d64b68c..b467cd755 100644 --- a/syntax_checkers/cpp/oclint.vim +++ b/syntax_checkers/cpp/oclint.vim @@ -27,3 +27,5 @@ call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'cpp', \ 'name': 'oclint', \ 'redirect': 'c/oclint'}) + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/cpp/ycm.vim b/syntax_checkers/cpp/ycm.vim index df39a5205..c04ac1076 100644 --- a/syntax_checkers/cpp/ycm.vim +++ b/syntax_checkers/cpp/ycm.vim @@ -25,3 +25,5 @@ call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'cpp', \ 'name': 'ycm', \ 'redirect': 'c/ycm'}) + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/cs/mcs.vim b/syntax_checkers/cs/mcs.vim index 50947c2dc..5b7c133f8 100644 --- a/syntax_checkers/cs/mcs.vim +++ b/syntax_checkers/cs/mcs.vim @@ -13,7 +13,10 @@ if exists("g:loaded_syntastic_cs_mcs_checker") finish endif -let g:loaded_syntastic_cs_mcs_checker=1 +let g:loaded_syntastic_cs_mcs_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim function! SyntaxCheckers_cs_mcs_GetLocList() dict let makeprg = self.makeprgBuild({ 'args': '--parse' }) @@ -29,3 +32,8 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'cs', \ 'name': 'mcs'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/css/csslint.vim b/syntax_checkers/css/csslint.vim index 401001e25..287108386 100644 --- a/syntax_checkers/css/csslint.vim +++ b/syntax_checkers/css/csslint.vim @@ -17,12 +17,15 @@ if exists('g:loaded_syntastic_css_csslint_checker') finish endif -let g:loaded_syntastic_css_csslint_checker=1 +let g:loaded_syntastic_css_csslint_checker = 1 if !exists('g:syntastic_csslint_options') let g:syntastic_csslint_options = '' endif +let s:save_cpo = &cpo +set cpo&vim + function! SyntaxCheckers_css_csslint_GetLocList() dict let makeprg = self.makeprgBuild({ 'args': '--format=compact ' . g:syntastic_csslint_options }) @@ -44,3 +47,8 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'css', \ 'name': 'csslint'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/css/phpcs.vim b/syntax_checkers/css/phpcs.vim index 8dc34a2c4..86aefeb67 100644 --- a/syntax_checkers/css/phpcs.vim +++ b/syntax_checkers/css/phpcs.vim @@ -13,10 +13,11 @@ " See here for details of phpcs " - phpcs (see http://pear.php.net/package/PHP_CodeSniffer) " + if exists("g:loaded_syntastic_css_phpcs_checker") finish endif -let g:loaded_syntastic_css_phpcs_checker=1 +let g:loaded_syntastic_css_phpcs_checker = 1 runtime! syntax_checkers/php/*.vim @@ -24,3 +25,5 @@ call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'css', \ 'name': 'phpcs', \ 'redirect': 'php/phpcs'}) + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/css/prettycss.vim b/syntax_checkers/css/prettycss.vim index 954414864..536568fad 100644 --- a/syntax_checkers/css/prettycss.vim +++ b/syntax_checkers/css/prettycss.vim @@ -18,7 +18,10 @@ if exists("g:loaded_syntastic_css_prettycss_checker") finish endif -let g:loaded_syntastic_css_prettycss_checker=1 +let g:loaded_syntastic_css_prettycss_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim function! SyntaxCheckers_css_prettycss_GetHighlightRegex(item) let term = matchstr(a:item["text"], '\m (\zs[^)]\+\ze)$') @@ -53,3 +56,8 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'css', \ 'name': 'prettycss'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/cucumber/cucumber.vim b/syntax_checkers/cucumber/cucumber.vim index cc40e0cfe..0edb76e02 100644 --- a/syntax_checkers/cucumber/cucumber.vim +++ b/syntax_checkers/cucumber/cucumber.vim @@ -13,7 +13,10 @@ if exists("g:loaded_syntastic_cucumber_cucumber_checker") finish endif -let g:loaded_syntastic_cucumber_cucumber_checker=1 +let g:loaded_syntastic_cucumber_cucumber_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim function! SyntaxCheckers_cucumber_cucumber_GetLocList() dict let makeprg = self.makeprgBuild({ 'args': '--dry-run --quiet --strict --format pretty' }) @@ -32,3 +35,8 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'cucumber', \ 'name': 'cucumber'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/cuda/nvcc.vim b/syntax_checkers/cuda/nvcc.vim index 08658e2fa..1494982e3 100644 --- a/syntax_checkers/cuda/nvcc.vim +++ b/syntax_checkers/cuda/nvcc.vim @@ -18,11 +18,13 @@ " " let g:syntastic_cuda_arch = "sm_20" - if exists("g:loaded_syntastic_cuda_nvcc_checker") finish endif -let g:loaded_syntastic_cuda_nvcc_checker=1 +let g:loaded_syntastic_cuda_nvcc_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim function! SyntaxCheckers_cuda_nvcc_GetLocList() dict if exists('g:syntastic_cuda_arch') @@ -68,3 +70,8 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'cuda', \ 'name': 'nvcc'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/d/dmd.vim b/syntax_checkers/d/dmd.vim index 0c1df604b..dbaa36ee1 100644 --- a/syntax_checkers/d/dmd.vim +++ b/syntax_checkers/d/dmd.vim @@ -24,13 +24,13 @@ if !exists('g:syntastic_d_compiler') let g:syntastic_d_compiler = 'dmd' endif +let s:save_cpo = &cpo +set cpo&vim + function! SyntaxCheckers_d_dmd_IsAvailable() dict return executable(expand(g:syntastic_d_compiler)) endfunction -let s:save_cpo = &cpo -set cpo&vim - if !exists('g:syntastic_d_compiler_options') let g:syntastic_d_compiler_options = '' endif diff --git a/syntax_checkers/dart/dartanalyzer.vim b/syntax_checkers/dart/dartanalyzer.vim index eb8c42e9d..9dc5fd9fa 100644 --- a/syntax_checkers/dart/dartanalyzer.vim +++ b/syntax_checkers/dart/dartanalyzer.vim @@ -8,11 +8,15 @@ " Want To Public License, Version 2, as published by Sam Hocevar. " See http://sam.zoy.org/wtfpl/COPYING for more details. "============================================================================ + if exists("g:loaded_syntastic_dart_dartanalyzer_checker") finish endif let g:loaded_syntastic_dart_dartanalyzer_checker = 1 +let s:save_cpo = &cpo +set cpo&vim + function! SyntaxCheckers_dart_dartanalyzer_GetHighlightRegex(error) if a:error['len'] let lcol = a:error['col'] - 1 @@ -65,3 +69,8 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'dart', \ 'name': 'dartanalyzer' }) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/docbk/xmllint.vim b/syntax_checkers/docbk/xmllint.vim index 78d801a71..bfb9da0a9 100644 --- a/syntax_checkers/docbk/xmllint.vim +++ b/syntax_checkers/docbk/xmllint.vim @@ -13,7 +13,7 @@ if exists("g:loaded_syntastic_docbk_xmllint_checker") finish endif -let g:loaded_syntastic_docbk_xmllint_checker=1 +let g:loaded_syntastic_docbk_xmllint_checker = 1 runtime! syntax_checkers/xml/*.vim @@ -21,3 +21,5 @@ call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'docbk', \ 'name': 'xmllint', \ 'redirect': 'xml/xmllint'}) + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/dustjs/swiffer.vim b/syntax_checkers/dustjs/swiffer.vim index 27cec0e0f..0bdf28139 100644 --- a/syntax_checkers/dustjs/swiffer.vim +++ b/syntax_checkers/dustjs/swiffer.vim @@ -15,9 +15,8 @@ endif let g:loaded_syntastic_dustjs_swiffer_checker = 1 -function! SyntaxCheckers_dustjs_swiffer_IsAvailable() dict - return executable('swiffer') -endfunction +let s:save_cpo = &cpo +set cpo&vim function! SyntaxCheckers_dustjs_swiffer_GetLocList() dict let makeprg = self.makeprgBuild({}) @@ -32,3 +31,8 @@ function! SyntaxCheckers_dustjs_swiffer_GetLocList() dict call SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'dustjs', \ 'name': 'swiffer'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/elixir/elixir.vim b/syntax_checkers/elixir/elixir.vim index f4746a648..566131d58 100644 --- a/syntax_checkers/elixir/elixir.vim +++ b/syntax_checkers/elixir/elixir.vim @@ -9,10 +9,14 @@ " See http://sam.zoy.org/wtfpl/COPYING for more details. " "============================================================================ + if exists("g:loaded_syntastic_elixir_elixir_checker") finish endif -let g:loaded_syntastic_elixir_elixir_checker=1 +let g:loaded_syntastic_elixir_elixir_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim " TODO: we should probably split this into separate checkers function! SyntaxCheckers_elixir_elixir_IsAvailable() dict @@ -40,3 +44,8 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'elixir', \ 'name': 'elixir'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/erlang/escript.vim b/syntax_checkers/erlang/escript.vim index ba6d0b169..5f7054be8 100644 --- a/syntax_checkers/erlang/escript.vim +++ b/syntax_checkers/erlang/escript.vim @@ -21,6 +21,9 @@ endif let s:check_file = expand(':p:h') . '/erlang_check_file.erl' +let s:save_cpo = &cpo +set cpo&vim + function! SyntaxCheckers_erlang_escript_GetLocList() dict if expand('%:e') ==# 'hrl' return [] @@ -51,3 +54,8 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'erlang', \ 'name': 'escript'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/eruby/ruby.vim b/syntax_checkers/eruby/ruby.vim index f777f447d..94ba42e66 100644 --- a/syntax_checkers/eruby/ruby.vim +++ b/syntax_checkers/eruby/ruby.vim @@ -13,12 +13,15 @@ if exists("g:loaded_syntastic_eruby_ruby_checker") finish endif -let g:loaded_syntastic_eruby_ruby_checker=1 +let g:loaded_syntastic_eruby_ruby_checker = 1 if !exists("g:syntastic_ruby_exec") let g:syntastic_ruby_exec = "ruby" endif +let s:save_cpo = &cpo +set cpo&vim + function! SyntaxCheckers_eruby_ruby_IsAvailable() dict return executable(expand(g:syntastic_ruby_exec)) endfunction @@ -63,3 +66,8 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'eruby', \ 'name': 'ruby'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/fortran/gfortran.vim b/syntax_checkers/fortran/gfortran.vim index 1d3f0a9f0..0cc94831f 100644 --- a/syntax_checkers/fortran/gfortran.vim +++ b/syntax_checkers/fortran/gfortran.vim @@ -19,13 +19,13 @@ if !exists('g:syntastic_fortran_compiler') let g:syntastic_fortran_compiler = 'gfortran' endif +let s:save_cpo = &cpo +set cpo&vim + function! SyntaxCheckers_fortran_gfortran_IsAvailable() dict return executable(expand(g:syntastic_fortran_compiler)) endfunction -let s:save_cpo = &cpo -set cpo&vim - if !exists('g:syntastic_fortran_compiler_options') let g:syntastic_fortran_compiler_options = '' endif diff --git a/syntax_checkers/glsl/cgc.vim b/syntax_checkers/glsl/cgc.vim index 5b52c6a87..c7bf6ee00 100644 --- a/syntax_checkers/glsl/cgc.vim +++ b/syntax_checkers/glsl/cgc.vim @@ -13,7 +13,6 @@ if exists("g:loaded_syntastic_glsl_cgc_checker") finish endif - let g:loaded_syntastic_glsl_cgc_checker = 1 let s:glsl_extensions = { diff --git a/syntax_checkers/go/go.vim b/syntax_checkers/go/go.vim index 27e126077..ac28bcddb 100644 --- a/syntax_checkers/go/go.vim +++ b/syntax_checkers/go/go.vim @@ -12,10 +12,14 @@ " Use a BufWritePre autocommand to that end: " autocmd FileType go autocmd BufWritePre Fmt "============================================================================ + if exists("g:loaded_syntastic_go_go_checker") finish endif -let g:loaded_syntastic_go_go_checker=1 +let g:loaded_syntastic_go_go_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim function! SyntaxCheckers_go_go_IsAvailable() dict return executable('go') && executable('gofmt') @@ -72,3 +76,8 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'go', \ 'name': 'go'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/go/gofmt.vim b/syntax_checkers/go/gofmt.vim index bf85e2f25..762f47ed6 100644 --- a/syntax_checkers/go/gofmt.vim +++ b/syntax_checkers/go/gofmt.vim @@ -12,10 +12,14 @@ " Use a BufWritePre autocommand to that end: " autocmd FileType go autocmd BufWritePre Fmt "============================================================================ + if exists("g:loaded_syntastic_go_gofmt_checker") finish endif -let g:loaded_syntastic_go_gofmt_checker=1 +let g:loaded_syntastic_go_gofmt_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim function! SyntaxCheckers_go_gofmt_GetLocList() dict let makeprg = self.makeprgBuild({ @@ -33,3 +37,8 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'go', \ 'name': 'gofmt'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/go/golint.vim b/syntax_checkers/go/golint.vim index 852357bc8..c41070167 100644 --- a/syntax_checkers/go/golint.vim +++ b/syntax_checkers/go/golint.vim @@ -9,10 +9,14 @@ " See http://sam.zoy.org/wtfpl/COPYING for more details. " "============================================================================ + if exists("g:loaded_syntastic_go_golint_checker") finish endif -let g:loaded_syntastic_go_golint_checker=1 +let g:loaded_syntastic_go_golint_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim function! SyntaxCheckers_go_golint_GetLocList() dict let makeprg = self.makeprgBuild({}) @@ -28,3 +32,8 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'go', \ 'name': 'golint'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/go/gotype.vim b/syntax_checkers/go/gotype.vim index 4d9c91065..ae3b6247c 100644 --- a/syntax_checkers/go/gotype.vim +++ b/syntax_checkers/go/gotype.vim @@ -9,6 +9,7 @@ " See http://sam.zoy.org/wtfpl/COPYING for more details. " "============================================================================ + if exists("g:loaded_syntastic_go_gotype_checker") finish endif diff --git a/syntax_checkers/go/govet.vim b/syntax_checkers/go/govet.vim index 3ba0aa588..080204a1d 100644 --- a/syntax_checkers/go/govet.vim +++ b/syntax_checkers/go/govet.vim @@ -9,10 +9,14 @@ " See http://sam.zoy.org/wtfpl/COPYING for more details. " "============================================================================ + if exists("g:loaded_syntastic_go_govet_checker") finish endif -let g:loaded_syntastic_go_govet_checker=1 +let g:loaded_syntastic_go_govet_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim function! SyntaxCheckers_go_govet_IsAvailable() dict return executable('go') @@ -38,3 +42,8 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'go', \ 'name': 'govet'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/haml/haml.vim b/syntax_checkers/haml/haml.vim index 750f0657d..cc4d55060 100644 --- a/syntax_checkers/haml/haml.vim +++ b/syntax_checkers/haml/haml.vim @@ -13,12 +13,15 @@ if exists('g:loaded_syntastic_haml_haml_checker') finish endif -let g:loaded_syntastic_haml_haml_checker=1 +let g:loaded_syntastic_haml_haml_checker = 1 if !exists('g:syntastic_haml_interpreter') let g:syntastic_haml_interpreter = 'haml' endif +let s:save_cpo = &cpo +set cpo&vim + function! SyntaxCheckers_haml_haml_IsAvailable() dict return executable(expand(g:syntastic_haml_interpreter)) endfunction @@ -41,3 +44,8 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'haml', \ 'name': 'haml'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/handlebars/handlebars.vim b/syntax_checkers/handlebars/handlebars.vim index d6f37307b..329a167f1 100644 --- a/syntax_checkers/handlebars/handlebars.vim +++ b/syntax_checkers/handlebars/handlebars.vim @@ -8,10 +8,14 @@ " Want To Public License, Version 2, as published by Sam Hocevar. " See http://sam.zoy.org/wtfpl/COPYING for more details. "============================================================================ + if exists("g:loaded_syntastic_handlebars_handlebars_checker") finish endif -let g:loaded_syntastic_handlebars_handlebars_checker=1 +let g:loaded_syntastic_handlebars_handlebars_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim function! SyntaxCheckers_handlebars_handlebars_GetLocList() dict let makeprg = self.makeprgBuild({ 'args': '-f ' . syntastic#util#DevNull() }) @@ -31,3 +35,8 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'handlebars', \ 'name': 'handlebars'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/haskell/ghc-mod.vim b/syntax_checkers/haskell/ghc-mod.vim index d6e81365f..517370348 100644 --- a/syntax_checkers/haskell/ghc-mod.vim +++ b/syntax_checkers/haskell/ghc-mod.vim @@ -17,6 +17,9 @@ let g:loaded_syntastic_haskell_ghc_mod_checker = 1 let s:ghc_mod_new = -1 +let s:save_cpo = &cpo +set cpo&vim + function! SyntaxCheckers_haskell_ghc_mod_IsAvailable() dict " We need either a Vim version that can handle NULs in system() output, " or a ghc-mod version that has the --boundary option. @@ -59,4 +62,9 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'haskell', \ 'name': 'ghc_mod', - \ 'exec': 'ghc-mod'}) + \ 'exec': 'ghc-mod' }) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/haskell/hdevtools.vim b/syntax_checkers/haskell/hdevtools.vim index 4987a7a2d..0175e0464 100644 --- a/syntax_checkers/haskell/hdevtools.vim +++ b/syntax_checkers/haskell/hdevtools.vim @@ -13,7 +13,10 @@ if exists("g:loaded_syntastic_haskell_hdevtools_checker") finish endif -let g:loaded_syntastic_haskell_hdevtools_checker=1 +let g:loaded_syntastic_haskell_hdevtools_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim function! SyntaxCheckers_haskell_hdevtools_GetLocList() dict let makeprg = self.makeprgBuild({ @@ -39,3 +42,7 @@ call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'haskell', \ 'name': 'hdevtools'}) +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/haskell/hlint.vim b/syntax_checkers/haskell/hlint.vim index 2fd2ef88a..e859d299b 100644 --- a/syntax_checkers/haskell/hlint.vim +++ b/syntax_checkers/haskell/hlint.vim @@ -10,6 +10,9 @@ if exists('g:loaded_syntastic_haskell_hlint_checker') endif let g:loaded_syntastic_haskell_hlint_checker = 1 +let s:save_cpo = &cpo +set cpo&vim + function! SyntaxCheckers_haskell_hlint_GetLocList() dict let makeprg = self.makeprgBuild({}) @@ -27,3 +30,8 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'haskell', \ 'name': 'hlint'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/haxe/haxe.vim b/syntax_checkers/haxe/haxe.vim index c6b9c3e6a..184e5aa03 100644 --- a/syntax_checkers/haxe/haxe.vim +++ b/syntax_checkers/haxe/haxe.vim @@ -13,7 +13,10 @@ if exists("g:loaded_syntastic_haxe_haxe_checker") finish endif -let g:loaded_syntastic_haxe_haxe_checker=1 +let g:loaded_syntastic_haxe_haxe_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim function! SyntaxCheckers_haxe_haxe_GetLocList() dict if exists('b:vaxe_hxml') @@ -43,3 +46,8 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'haxe', \ 'name': 'haxe'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/hss/hss.vim b/syntax_checkers/hss/hss.vim index 34fa332a7..1f9aa242c 100644 --- a/syntax_checkers/hss/hss.vim +++ b/syntax_checkers/hss/hss.vim @@ -13,7 +13,10 @@ if exists("g:loaded_syntastic_hss_hss_checker") finish endif -let g:loaded_syntastic_hss_hss_checker=1 +let g:loaded_syntastic_hss_hss_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim function! SyntaxCheckers_hss_hss_GetLocList() dict let makeprg = self.makeprgBuild({ 'args' : '-output ' . syntastic#util#DevNull() }) @@ -28,3 +31,8 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'hss', \ 'name': 'hss'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/html/tidy.vim b/syntax_checkers/html/tidy.vim index 9f6021839..b29033c15 100644 --- a/syntax_checkers/html/tidy.vim +++ b/syntax_checkers/html/tidy.vim @@ -42,6 +42,9 @@ if !exists('g:syntastic_html_tidy_empty_tags') let g:syntastic_html_tidy_empty_tags = [] endif +let s:save_cpo = &cpo +set cpo&vim + " TODO: join this with xhtml.vim for DRY's sake? function! s:TidyEncOptByFenc() let tidy_opts = { @@ -200,3 +203,7 @@ call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'html', \ 'name': 'tidy'}) +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/html/validator.vim b/syntax_checkers/html/validator.vim index 17bdcccb7..3874fa3c6 100644 --- a/syntax_checkers/html/validator.vim +++ b/syntax_checkers/html/validator.vim @@ -45,6 +45,9 @@ if !exists('g:syntastic_html_validator_nsfilter') let g:syntastic_html_validator_nsfilter = '' endif +let s:save_cpo = &cpo +set cpo&vim + function! SyntaxCheckers_html_validator_Preprocess(errors) let out = [] for e in a:errors @@ -92,3 +95,8 @@ call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'html', \ 'name': 'validator', \ 'exec': 'curl' }) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/html/w3.vim b/syntax_checkers/html/w3.vim index 293c1c89c..cdb8a633f 100644 --- a/syntax_checkers/html/w3.vim +++ b/syntax_checkers/html/w3.vim @@ -26,6 +26,9 @@ if !exists('g:syntastic_html_w3_api') let g:syntastic_html_w3_api = 'http://validator.w3.org/check' endif +let s:save_cpo = &cpo +set cpo&vim + function! SyntaxCheckers_html_w3_GetLocList() dict let makeprg = self.getExec() . ' -s -F output=json ' . \ '-F uploaded_file=@' . syntastic#util#shexpand('%:p') . '\;type=text/html ' . @@ -60,3 +63,7 @@ call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'name': 'w3', \ 'exec': 'curl' }) +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/java/checkstyle.vim b/syntax_checkers/java/checkstyle.vim index 541d31587..b421b4485 100644 --- a/syntax_checkers/java/checkstyle.vim +++ b/syntax_checkers/java/checkstyle.vim @@ -10,10 +10,11 @@ " " Tested with checkstyle 5.5 "============================================================================ + if exists("g:loaded_syntastic_java_checkstyle_checker") finish endif -let g:loaded_syntastic_java_checkstyle_checker=1 +let g:loaded_syntastic_java_checkstyle_checker = 1 if !exists("g:syntastic_java_checkstyle_classpath") let g:syntastic_java_checkstyle_classpath = 'checkstyle-5.5-all.jar' @@ -23,6 +24,9 @@ if !exists("g:syntastic_java_checkstyle_conf_file") let g:syntastic_java_checkstyle_conf_file = 'sun_checks.xml' endif +let s:save_cpo = &cpo +set cpo&vim + function! SyntaxCheckers_java_checkstyle_Preprocess(errors) let out = copy(a:errors) for n in range(len(out)) @@ -71,3 +75,8 @@ call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'java', \ 'name': 'checkstyle', \ 'exec': 'java'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/java/javac.vim b/syntax_checkers/java/javac.vim index d6492a296..47d2048c7 100644 --- a/syntax_checkers/java/javac.vim +++ b/syntax_checkers/java/javac.vim @@ -40,6 +40,9 @@ if !exists("g:syntastic_java_javac_delete_output") let g:syntastic_java_javac_delete_output = 1 endif +let s:save_cpo = &cpo +set cpo&vim + function! s:CygwinPath(path) return substitute(system("cygpath -m " . a:path), '\n', '', 'g') endfunction @@ -363,3 +366,7 @@ call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'java', \ 'name': 'javac'}) +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/javascript/closurecompiler.vim b/syntax_checkers/javascript/closurecompiler.vim index fcc0e620f..db3051194 100644 --- a/syntax_checkers/javascript/closurecompiler.vim +++ b/syntax_checkers/javascript/closurecompiler.vim @@ -24,14 +24,20 @@ if exists("g:loaded_syntastic_javascript_closurecompiler_checker") finish endif -let g:loaded_syntastic_javascript_closurecompiler_checker=1 +let g:loaded_syntastic_javascript_closurecompiler_checker = 1 if !exists("g:syntastic_javascript_closure_compiler_options") let g:syntastic_javascript_closure_compiler_options = "" endif +let s:save_cpo = &cpo +set cpo&vim + function! SyntaxCheckers_javascript_closurecompiler_IsAvailable() dict - return executable("java") && exists("g:syntastic_javascript_closure_compiler_path") + return + \ executable("java") && + \ exists("g:syntastic_javascript_closure_compiler_path") && + \ filereadable(g:syntastic_javascript_closure_compiler_path) endfunction function! SyntaxCheckers_javascript_closurecompiler_GetLocList() dict @@ -63,3 +69,7 @@ call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'name': 'closurecompiler', \ 'exec': 'java'}) +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/javascript/eslint.vim b/syntax_checkers/javascript/eslint.vim index 2ad5ac39c..86b4f7c13 100644 --- a/syntax_checkers/javascript/eslint.vim +++ b/syntax_checkers/javascript/eslint.vim @@ -12,12 +12,15 @@ if exists('g:loaded_syntastic_javascript_eslint_checker') finish endif -let g:loaded_syntastic_javascript_eslint_checker=1 +let g:loaded_syntastic_javascript_eslint_checker = 1 if !exists('g:syntastic_javascript_eslint_conf') let g:syntastic_javascript_eslint_conf = '' endif +let s:save_cpo = &cpo +set cpo&vim + function! SyntaxCheckers_javascript_eslint_GetLocList() dict let makeprg = self.makeprgBuild({ \ 'args': !empty(g:syntastic_javascript_eslint_conf) ? ' --config ' . g:syntastic_javascript_eslint_conf : '' }) @@ -41,3 +44,7 @@ call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'javascript', \ 'name': 'eslint'}) +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/javascript/gjslint.vim b/syntax_checkers/javascript/gjslint.vim index b1c7ee619..6d7607566 100644 --- a/syntax_checkers/javascript/gjslint.vim +++ b/syntax_checkers/javascript/gjslint.vim @@ -8,15 +8,19 @@ " Want To Public License, Version 2, as published by Sam Hocevar. " See http://sam.zoy.org/wtfpl/COPYING for more details. "============================================================================ + if exists("g:loaded_syntastic_javascript_gjslint_checker") finish endif -let g:loaded_syntastic_javascript_gjslint_checker=1 +let g:loaded_syntastic_javascript_gjslint_checker = 1 if !exists("g:syntastic_javascript_gjslint_conf") let g:syntastic_javascript_gjslint_conf = "" endif +let s:save_cpo = &cpo +set cpo&vim + function! SyntaxCheckers_javascript_gjslint_GetLocList() dict let makeprg = self.makeprgBuild({ \ 'args': g:syntastic_javascript_gjslint_conf . " --nosummary --unix_mode --nodebug_indentation --nobeep" }) @@ -37,3 +41,7 @@ call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'javascript', \ 'name': 'gjslint'}) +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/javascript/jshint.vim b/syntax_checkers/javascript/jshint.vim index 84dd06eb8..96de521b7 100644 --- a/syntax_checkers/javascript/jshint.vim +++ b/syntax_checkers/javascript/jshint.vim @@ -12,7 +12,7 @@ if exists('g:loaded_syntastic_javascript_jshint_checker') finish endif -let g:loaded_syntastic_javascript_jshint_checker=1 +let g:loaded_syntastic_javascript_jshint_checker = 1 if !exists('g:syntastic_jshint_exec') let g:syntastic_jshint_exec = 'jshint' @@ -22,6 +22,9 @@ if !exists('g:syntastic_javascript_jshint_conf') let g:syntastic_javascript_jshint_conf = '' endif +let s:save_cpo = &cpo +set cpo&vim + function! SyntaxCheckers_javascript_jshint_IsAvailable() dict return executable(expand(g:syntastic_jshint_exec)) endfunction @@ -55,3 +58,7 @@ call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'javascript', \ 'name': 'jshint'}) +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/javascript/jsl.vim b/syntax_checkers/javascript/jsl.vim index dc90ad915..b9b7d3e88 100644 --- a/syntax_checkers/javascript/jsl.vim +++ b/syntax_checkers/javascript/jsl.vim @@ -8,15 +8,19 @@ " Want To Public License, Version 2, as published by Sam Hocevar. " See http://sam.zoy.org/wtfpl/COPYING for more details. "============================================================================ + if exists("g:loaded_syntastic_javascript_jsl_checker") finish endif -let g:loaded_syntastic_javascript_jsl_checker=1 +let g:loaded_syntastic_javascript_jsl_checker = 1 if !exists("g:syntastic_javascript_jsl_conf") let g:syntastic_javascript_jsl_conf = "" endif +let s:save_cpo = &cpo +set cpo&vim + function! SyntaxCheckers_javascript_jsl_GetLocList() dict let makeprg = self.makeprgBuild({ \ 'args': (!empty(g:syntastic_javascript_jsl_conf) ? "-conf " . g:syntastic_javascript_jsl_conf : "") . @@ -40,3 +44,7 @@ call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'javascript', \ 'name': 'jsl'}) +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/javascript/jslint.vim b/syntax_checkers/javascript/jslint.vim index 238761922..c233cf34b 100644 --- a/syntax_checkers/javascript/jslint.vim +++ b/syntax_checkers/javascript/jslint.vim @@ -13,7 +13,11 @@ if exists("g:loaded_syntastic_javascript_jslint_checker") finish endif -let g:loaded_syntastic_javascript_jslint_checker=1 + +let g:loaded_syntastic_javascript_jslint_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim function! SyntaxCheckers_javascript_jslint_GetHighlightRegex(item) let term = matchstr(a:item['text'], '\mExpected .* and instead saw ''\zs.*\ze''') @@ -41,3 +45,7 @@ call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'javascript', \ 'name': 'jslint'}) +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/json/jsonlint.vim b/syntax_checkers/json/jsonlint.vim index cd0d3dfc1..c6744002f 100644 --- a/syntax_checkers/json/jsonlint.vim +++ b/syntax_checkers/json/jsonlint.vim @@ -12,7 +12,10 @@ if exists("g:loaded_syntastic_json_jsonlint_checker") finish endif -let g:loaded_syntastic_json_jsonlint_checker=1 +let g:loaded_syntastic_json_jsonlint_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim function! SyntaxCheckers_json_jsonlint_GetLocList() dict let makeprg = self.makeprgBuild({ 'post_args': '--compact' }) @@ -33,3 +36,8 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'json', \ 'name': 'jsonlint'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/json/jsonval.vim b/syntax_checkers/json/jsonval.vim index 924a363e9..16e300913 100644 --- a/syntax_checkers/json/jsonval.vim +++ b/syntax_checkers/json/jsonval.vim @@ -12,7 +12,10 @@ if exists("g:loaded_syntastic_json_jsonval_checker") finish endif -let g:loaded_syntastic_json_jsonval_checker=1 +let g:loaded_syntastic_json_jsonval_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim function! SyntaxCheckers_json_jsonval_GetLocList() dict " based on https://gist.github.com/1196345 @@ -31,3 +34,8 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'json', \ 'name': 'jsonval'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/less/lessc.vim b/syntax_checkers/less/lessc.vim index dc16d4692..20bb7f37f 100644 --- a/syntax_checkers/less/lessc.vim +++ b/syntax_checkers/less/lessc.vim @@ -20,7 +20,7 @@ if exists("g:loaded_syntastic_less_lessc_checker") finish endif -let g:loaded_syntastic_less_lessc_checker=1 +let g:loaded_syntastic_less_lessc_checker = 1 if !exists("g:syntastic_less_options") let g:syntastic_less_options = "--no-color" @@ -36,6 +36,9 @@ else let s:check_file = 'lessc' endif +let s:save_cpo = &cpo +set cpo&vim + function! SyntaxCheckers_less_lessc_IsAvailable() dict return g:syntastic_less_use_less_lint ? executable('node') : executable('lessc') endfunction @@ -60,3 +63,8 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'less', \ 'name': 'lessc'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/lex/flex.vim b/syntax_checkers/lex/flex.vim index 971068f8c..f86b90c88 100644 --- a/syntax_checkers/lex/flex.vim +++ b/syntax_checkers/lex/flex.vim @@ -46,3 +46,5 @@ call g:SyntasticRegistry.CreateAndRegisterChecker({ let &cpo = s:save_cpo unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/limbo/limbo.vim b/syntax_checkers/limbo/limbo.vim index 6f49c2b31..b021dea84 100644 --- a/syntax_checkers/limbo/limbo.vim +++ b/syntax_checkers/limbo/limbo.vim @@ -15,6 +15,9 @@ if exists("g:loaded_syntastic_limbo_limbo_checker") endif let g:loaded_syntastic_limbo_limbo_checker = 1 +let s:save_cpo = &cpo +set cpo&vim + function! SyntaxCheckers_limbo_limbo_GetLocList() dict let include = !empty($INFERNO_HOME) ? '-I$INFERNO_HOME ' : '' " don't generate .dis in current dir while checking syntax, @@ -36,3 +39,8 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'limbo', \ 'name': 'limbo' }) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/lisp/clisp.vim b/syntax_checkers/lisp/clisp.vim index 6bef1e97b..5f432b893 100644 --- a/syntax_checkers/lisp/clisp.vim +++ b/syntax_checkers/lisp/clisp.vim @@ -9,10 +9,14 @@ " See http://sam.zoy.org/wtfpl/COPYING for more details. " "============================================================================ + if exists("g:loaded_syntastic_lisp_clisp_checker") finish endif -let g:loaded_syntastic_lisp_clisp_checker=1 +let g:loaded_syntastic_lisp_clisp_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim function! SyntaxCheckers_lisp_clisp_GetLocList() dict let makeprg = self.makeprgBuild({ @@ -38,3 +42,8 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'lisp', \ 'name': 'clisp'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/llvm/llvm.vim b/syntax_checkers/llvm/llvm.vim index cd5a5b457..bc89fbc02 100644 --- a/syntax_checkers/llvm/llvm.vim +++ b/syntax_checkers/llvm/llvm.vim @@ -9,10 +9,14 @@ " See http://sam.zoy.org/wtfpl/COPYING for more details. " "============================================================================ + if exists("g:loaded_syntastic_llvm_llvm_checker") finish endif -let g:loaded_syntastic_llvm_llvm_checker=1 +let g:loaded_syntastic_llvm_llvm_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim function! SyntaxCheckers_llvm_llvm_GetLocList() dict let makeprg = self.makeprgBuild({ 'args': syntastic#c#NullOutput() }) @@ -29,3 +33,7 @@ call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'name': 'llvm', \ 'exec': 'llc'}) +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/lua/luac.vim b/syntax_checkers/lua/luac.vim index d8984d3a2..0139ced3d 100644 --- a/syntax_checkers/lua/luac.vim +++ b/syntax_checkers/lua/luac.vim @@ -13,7 +13,10 @@ if exists("g:loaded_syntastic_lua_luac_checker") finish endif -let g:loaded_syntastic_lua_luac_checker=1 +let g:loaded_syntastic_lua_luac_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim function! SyntaxCheckers_lua_luac_GetHighlightRegex(pos) let result = '' @@ -55,3 +58,8 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'lua', \ 'name': 'luac'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/matlab/mlint.vim b/syntax_checkers/matlab/mlint.vim index 5b1f4545e..1953b8712 100644 --- a/syntax_checkers/matlab/mlint.vim +++ b/syntax_checkers/matlab/mlint.vim @@ -13,7 +13,10 @@ if exists("g:loaded_syntastic_matlab_mlint_checker") finish endif -let g:loaded_syntastic_matlab_mlint_checker=1 +let g:loaded_syntastic_matlab_mlint_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim function! SyntaxCheckers_matlab_mlint_GetLocList() dict let makeprg = self.makeprgBuild({ 'args': '-id $*' }) @@ -31,3 +34,8 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'matlab', \ 'name': 'mlint'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/nasm/nasm.vim b/syntax_checkers/nasm/nasm.vim index 6ad0f1bb3..95d77cb33 100644 --- a/syntax_checkers/nasm/nasm.vim +++ b/syntax_checkers/nasm/nasm.vim @@ -9,10 +9,14 @@ " See http://sam.zoy.org/wtfpl/COPYING for more details. " "============================================================================ + if exists("g:loaded_syntastic_nasm_nasm_checker") finish endif -let g:loaded_syntastic_nasm_nasm_checker=1 +let g:loaded_syntastic_nasm_nasm_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim function! SyntaxCheckers_nasm_nasm_GetLocList() dict let wd = syntastic#util#shescape(expand("%:p:h") . "/") @@ -31,3 +35,8 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'nasm', \ 'name': 'nasm'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/nroff/mandoc.vim b/syntax_checkers/nroff/mandoc.vim index 4c8105cc4..6ffc32f7c 100644 --- a/syntax_checkers/nroff/mandoc.vim +++ b/syntax_checkers/nroff/mandoc.vim @@ -9,10 +9,14 @@ " See http://sam.zoy.org/wtfpl/COPYING for more details. " "============================================================================ + if exists("g:loaded_syntastic_nroff_mandoc_checker") finish endif -let g:loaded_syntastic_nroff_mandoc_checker=1 +let g:loaded_syntastic_nroff_mandoc_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim function! SyntaxCheckers_nroff_mandoc_GetLocList() dict let makeprg = self.makeprgBuild({ 'args': '-Tlint' }) @@ -31,3 +35,7 @@ call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'nroff', \ 'name': 'mandoc'}) +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/objc/gcc.vim b/syntax_checkers/objc/gcc.vim index 3438e94fa..e311b2911 100644 --- a/syntax_checkers/objc/gcc.vim +++ b/syntax_checkers/objc/gcc.vim @@ -19,13 +19,13 @@ if !exists('g:syntastic_objc_compiler') let g:syntastic_objc_compiler = executable('gcc') ? 'gcc' : 'clang' endif +let s:save_cpo = &cpo +set cpo&vim + function! SyntaxCheckers_objc_gcc_IsAvailable() dict return executable(expand(g:syntastic_objc_compiler)) endfunction -let s:save_cpo = &cpo -set cpo&vim - if !exists('g:syntastic_objc_compiler_options') let g:syntastic_objc_compiler_options = '-std=gnu99' endif diff --git a/syntax_checkers/objc/oclint.vim b/syntax_checkers/objc/oclint.vim index d3108eb6c..a415c41ff 100644 --- a/syntax_checkers/objc/oclint.vim +++ b/syntax_checkers/objc/oclint.vim @@ -27,3 +27,5 @@ call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'objc', \ 'name': 'oclint', \ 'redirect': 'c/oclint'}) + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/objc/ycm.vim b/syntax_checkers/objc/ycm.vim index 8157b38df..15f232b94 100644 --- a/syntax_checkers/objc/ycm.vim +++ b/syntax_checkers/objc/ycm.vim @@ -25,3 +25,5 @@ call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'objc', \ 'name': 'ycm', \ 'redirect': 'c/ycm'}) + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/objcpp/gcc.vim b/syntax_checkers/objcpp/gcc.vim index 5984466e9..3817f5d2a 100644 --- a/syntax_checkers/objcpp/gcc.vim +++ b/syntax_checkers/objcpp/gcc.vim @@ -19,13 +19,13 @@ if !exists('g:syntastic_objcpp_compiler') let g:syntastic_objcpp_compiler = executable('gcc') ? 'gcc' : 'clang' endif +let s:save_cpo = &cpo +set cpo&vim + function! SyntaxCheckers_objcpp_gcc_IsAvailable() dict return executable(expand(g:syntastic_objcpp_compiler)) endfunction -let s:save_cpo = &cpo -set cpo&vim - if !exists('g:syntastic_objcpp_compiler_options') let g:syntastic_objcpp_compiler_options = '-std=gnu99' endif diff --git a/syntax_checkers/objcpp/oclint.vim b/syntax_checkers/objcpp/oclint.vim index 59eb7cc78..84f71d297 100644 --- a/syntax_checkers/objcpp/oclint.vim +++ b/syntax_checkers/objcpp/oclint.vim @@ -27,3 +27,5 @@ call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'objcpp', \ 'name': 'oclint', \ 'redirect': 'c/oclint'}) + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/objcpp/ycm.vim b/syntax_checkers/objcpp/ycm.vim index 3bad05ebe..5770f8885 100644 --- a/syntax_checkers/objcpp/ycm.vim +++ b/syntax_checkers/objcpp/ycm.vim @@ -25,3 +25,5 @@ call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'objcpp', \ 'name': 'ycm', \ 'redirect': 'c/ycm'}) + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/ocaml/camlp4o.vim b/syntax_checkers/ocaml/camlp4o.vim index e50acb781..d9f570010 100644 --- a/syntax_checkers/ocaml/camlp4o.vim +++ b/syntax_checkers/ocaml/camlp4o.vim @@ -51,7 +51,7 @@ if exists("g:loaded_syntastic_ocaml_camlp4o_checker") finish endif -let g:loaded_syntastic_ocaml_camlp4o_checker=1 +let g:loaded_syntastic_ocaml_camlp4o_checker = 1 if exists('g:syntastic_ocaml_camlp4r') && g:syntastic_ocaml_camlp4r != 0 let s:ocamlpp="camlp4r" @@ -59,6 +59,9 @@ else let s:ocamlpp="camlp4o" endif +let s:save_cpo = &cpo +set cpo&vim + function! SyntaxCheckers_ocaml_camlp4o_IsAvailable() dict return executable(s:ocamlpp) endfunction @@ -146,3 +149,8 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'ocaml', \ 'name': 'camlp4o'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/perl/perl.vim b/syntax_checkers/perl/perl.vim index abe4fe1bd..daf47097d 100644 --- a/syntax_checkers/perl/perl.vim +++ b/syntax_checkers/perl/perl.vim @@ -34,6 +34,9 @@ if !exists('g:syntastic_perl_lib_path') let g:syntastic_perl_lib_path = [] endif +let s:save_cpo = &cpo +set cpo&vim + function! SyntaxCheckers_perl_perl_IsAvailable() dict " don't call executable() here, to allow things like " let g:syntastic_perl_interpreter='/usr/bin/env perl' @@ -95,3 +98,8 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'perl', \ 'name': 'perl'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/perl/perlcritic.vim b/syntax_checkers/perl/perlcritic.vim index dda412be4..e6d8c074d 100644 --- a/syntax_checkers/perl/perlcritic.vim +++ b/syntax_checkers/perl/perlcritic.vim @@ -27,12 +27,15 @@ if exists("g:loaded_syntastic_perl_perlcritic_checker") finish endif -let g:loaded_syntastic_perl_perlcritic_checker=1 +let g:loaded_syntastic_perl_perlcritic_checker = 1 if !exists('g:syntastic_perl_perlcritic_thres') let g:syntastic_perl_perlcritic_thres = 5 endif +let s:save_cpo = &cpo +set cpo&vim + function! SyntaxCheckers_perl_perlcritic_GetLocList() dict let makeprg = self.makeprgBuild({ \ 'post_args': '--quiet --nocolor --verbose "\%s:\%f:\%l:\%c:(\%s) \%m (\%e)\n"' }) @@ -56,3 +59,8 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'perl', \ 'name': 'perlcritic'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/perl/podchecker.vim b/syntax_checkers/perl/podchecker.vim index bf7cf8809..5ffc73657 100644 --- a/syntax_checkers/perl/podchecker.vim +++ b/syntax_checkers/perl/podchecker.vim @@ -13,7 +13,7 @@ if exists("g:loaded_syntastic_perl_podchecker_checker") finish endif -let g:loaded_syntastic_perl_podchecker_checker=1 +let g:loaded_syntastic_perl_podchecker_checker = 1 runtime! syntax_checkers/pod/*.vim @@ -21,3 +21,5 @@ call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'perl', \ 'name': 'podchecker', \ 'redirect': 'pod/podchecker'}) + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/php/php.vim b/syntax_checkers/php/php.vim index 4d0091290..42b831b60 100644 --- a/syntax_checkers/php/php.vim +++ b/syntax_checkers/php/php.vim @@ -13,7 +13,10 @@ if exists("g:loaded_syntastic_php_php_checker") finish endif -let g:loaded_syntastic_php_php_checker=1 +let g:loaded_syntastic_php_php_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim function! SyntaxCheckers_php_php_GetHighlightRegex(item) let unexpected = matchstr(a:item['text'], "\\munexpected '[^']\\+'") @@ -42,4 +45,9 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'php', + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: \ 'name': 'php'}) diff --git a/syntax_checkers/php/phpcs.vim b/syntax_checkers/php/phpcs.vim index c69f32acd..752601983 100644 --- a/syntax_checkers/php/phpcs.vim +++ b/syntax_checkers/php/phpcs.vim @@ -12,11 +12,14 @@ " " See here for details of phpcs " - phpcs (see http://pear.php.net/package/PHP_CodeSniffer) -" + if exists("g:loaded_syntastic_php_phpcs_checker") finish endif -let g:loaded_syntastic_php_phpcs_checker=1 +let g:loaded_syntastic_php_phpcs_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim function! SyntaxCheckers_php_phpcs_GetLocList() dict let makeprg = self.makeprgBuild({ 'args': '--report=csv' }) @@ -34,3 +37,8 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'php', \ 'name': 'phpcs'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/php/phpmd.vim b/syntax_checkers/php/phpmd.vim index 290e5fc66..7a04f3e24 100644 --- a/syntax_checkers/php/phpmd.vim +++ b/syntax_checkers/php/phpmd.vim @@ -16,7 +16,10 @@ if exists("g:loaded_syntastic_php_phpmd_checker") finish endif -let g:loaded_syntastic_php_phpmd_checker=1 +let g:loaded_syntastic_php_phpmd_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim function! SyntaxCheckers_php_phpmd_GetHighlightRegex(item) let term = matchstr(a:item['text'], '\m\C^The \S\+ \w\+\(()\)\= \(has\|is not\|utilizes\)') @@ -68,3 +71,8 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'php', \ 'name': 'phpmd'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/po/msgfmt.vim b/syntax_checkers/po/msgfmt.vim index bd719915d..342c94a2c 100644 --- a/syntax_checkers/po/msgfmt.vim +++ b/syntax_checkers/po/msgfmt.vim @@ -13,8 +13,10 @@ if exists("g:loaded_syntastic_po_msgfmt_checker") finish endif -let g:loaded_syntastic_po_msgfmt_checker=1 +let g:loaded_syntastic_po_msgfmt_checker = 1 +let s:save_cpo = &cpo +set cpo&vim function! SyntaxCheckers_po_msgfmt_GetHighlightRegex(item) let term = matchstr(a:item['text'], '\mkeyword "\zs[^"]\+\ze" unknown') @@ -41,3 +43,8 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'po', \ 'name': 'msgfmt'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/pod/podchecker.vim b/syntax_checkers/pod/podchecker.vim index c51533e11..34a37e550 100644 --- a/syntax_checkers/pod/podchecker.vim +++ b/syntax_checkers/pod/podchecker.vim @@ -9,10 +9,14 @@ " See http://sam.zoy.org/wtfpl/COPYING for more details. " "============================================================================ + if exists("g:loaded_syntastic_pod_podchecker_checker") finish endif -let g:loaded_syntastic_pod_podchecker_checker=1 +let g:loaded_syntastic_pod_podchecker_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim function! SyntaxCheckers_pod_podchecker_GetLocList() dict let makeprg = self.makeprgBuild({}) @@ -41,3 +45,7 @@ call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'pod', \ 'name': 'podchecker'}) +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/puppet/puppet.vim b/syntax_checkers/puppet/puppet.vim index 541a3242c..3604c3ec8 100644 --- a/syntax_checkers/puppet/puppet.vim +++ b/syntax_checkers/puppet/puppet.vim @@ -13,7 +13,10 @@ if exists("g:loaded_syntastic_puppet_puppet_checker") finish endif -let g:loaded_syntastic_puppet_puppet_checker=1 +let g:loaded_syntastic_puppet_puppet_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim function! SyntaxCheckers_puppet_puppet_GetLocList() dict let ver = syntastic#util#getVersion(self.getExec() . ' --version 2>' . syntastic#util#DevNull()) @@ -40,3 +43,8 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'puppet', \ 'name': 'puppet'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/puppet/puppetlint.vim b/syntax_checkers/puppet/puppetlint.vim index d8153cdcf..a5be2ca27 100644 --- a/syntax_checkers/puppet/puppetlint.vim +++ b/syntax_checkers/puppet/puppetlint.vim @@ -13,7 +13,10 @@ if exists("g:loaded_syntastic_puppet_puppetlint_checker") finish endif -let g:loaded_syntastic_puppet_puppetlint_checker=1 +let g:loaded_syntastic_puppet_puppetlint_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim if exists("g:syntastic_puppet_lint_arguments") let g:syntastic_puppet_puppetlint_args = g:syntastic_puppet_lint_arguments @@ -44,3 +47,8 @@ call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'puppet', \ 'name': 'puppetlint', \ 'exec': 'puppet-lint'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/python/flake8.vim b/syntax_checkers/python/flake8.vim index fa2e17801..9fe721f8e 100644 --- a/syntax_checkers/python/flake8.vim +++ b/syntax_checkers/python/flake8.vim @@ -5,13 +5,17 @@ " kstep " "============================================================================ + if exists("g:loaded_syntastic_python_flake8_checker") finish endif -let g:loaded_syntastic_python_flake8_checker=1 +let g:loaded_syntastic_python_flake8_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim -function! SyntaxCheckers_python_flake8_GetHighlightRegex(i) - return SyntaxCheckers_python_pyflakes_GetHighlightRegex(a:i) +function! SyntaxCheckers_python_flake8_GetHighlightRegex(item) + return SyntaxCheckers_python_pyflakes_GetHighlightRegex(a:item) endfunction function! SyntaxCheckers_python_flake8_GetLocList() dict @@ -35,3 +39,8 @@ runtime! syntax_checkers/python/pyflakes.vim call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'python', \ 'name': 'flake8'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/python/pep257.vim b/syntax_checkers/python/pep257.vim index 8e2c56cac..31ec1623e 100644 --- a/syntax_checkers/python/pep257.vim +++ b/syntax_checkers/python/pep257.vim @@ -10,6 +10,9 @@ if exists("g:loaded_syntastic_python_pep257_checker") endif let g:loaded_syntastic_python_pep257_checker = 1 +let s:save_cpo = &cpo +set cpo&vim + " sanity: kill empty lines here rather than munging errorformat function! SyntaxCheckers_python_pep257_Preprocess(errors) return filter(copy(a:errors), 'v:val != ""') @@ -41,3 +44,8 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'python', \ 'name': 'pep257'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/python/pep8.vim b/syntax_checkers/python/pep8.vim index 2e19a162d..310746b37 100644 --- a/syntax_checkers/python/pep8.vim +++ b/syntax_checkers/python/pep8.vim @@ -15,7 +15,10 @@ if exists("g:loaded_syntastic_python_pep8_checker") finish endif -let g:loaded_syntastic_python_pep8_checker=1 +let g:loaded_syntastic_python_pep8_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim function! SyntaxCheckers_python_pep8_GetLocList() dict let makeprg = self.makeprgBuild({}) @@ -37,3 +40,8 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'python', \ 'name': 'pep8'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/python/py3kwarn.vim b/syntax_checkers/python/py3kwarn.vim index 7a2d4ed18..5ceb51abe 100644 --- a/syntax_checkers/python/py3kwarn.vim +++ b/syntax_checkers/python/py3kwarn.vim @@ -4,10 +4,14 @@ "Authors: Liam Curry " "============================================================================ + if exists("g:loaded_syntastic_python_py3kwarn_checker") finish endif -let g:loaded_syntastic_python_py3kwarn_checker=1 +let g:loaded_syntastic_python_py3kwarn_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim function! SyntaxCheckers_python_py3kwarn_GetLocList() dict let makeprg = self.makeprgBuild({}) @@ -22,3 +26,8 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'python', \ 'name': 'py3kwarn'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/python/pyflakes.vim b/syntax_checkers/python/pyflakes.vim index b66346f20..8112bf3c1 100644 --- a/syntax_checkers/python/pyflakes.vim +++ b/syntax_checkers/python/pyflakes.vim @@ -6,11 +6,15 @@ " Parantapa Bhattacharya " "============================================================================ + if exists("g:loaded_syntastic_python_pyflakes_checker") finish endif let g:loaded_syntastic_python_pyflakes_checker = 1 +let s:save_cpo = &cpo +set cpo&vim + function! SyntaxCheckers_python_pyflakes_GetHighlightRegex(i) if stridx(a:i['text'], 'is assigned to but never used') >= 0 \ || stridx(a:i['text'], 'imported but unused') >= 0 @@ -54,3 +58,8 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'python', \ 'name': 'pyflakes'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/python/pylama.vim b/syntax_checkers/python/pylama.vim index 9bbdd45c3..b8c7663a3 100644 --- a/syntax_checkers/python/pylama.vim +++ b/syntax_checkers/python/pylama.vim @@ -9,13 +9,17 @@ " See http://sam.zoy.org/wtfpl/COPYING for more details. " "============================================================================ + if exists('g:loaded_syntastic_python_pylama_checker') finish endif let g:loaded_syntastic_python_pylama_checker = 1 -function! SyntaxCheckers_python_pylama_GetHighlightRegex(i) - return SyntaxCheckers_python_pyflakes_GetHighlightRegex(a:i) +let s:save_cpo = &cpo +set cpo&vim + +function! SyntaxCheckers_python_pylama_GetHighlightRegex(item) + return SyntaxCheckers_python_pyflakes_GetHighlightRegex(a:item) endfunction function! SyntaxCheckers_python_pylama_GetLocList() dict @@ -57,3 +61,8 @@ runtime! syntax_checkers/python/pyflakes.vim call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'python', \ 'name': 'pylama' }) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/python/pylint.vim b/syntax_checkers/python/pylint.vim index fcd40328c..4267fdf2e 100644 --- a/syntax_checkers/python/pylint.vim +++ b/syntax_checkers/python/pylint.vim @@ -4,6 +4,7 @@ "Author: Parantapa Bhattacharya " "============================================================================ + if exists("g:loaded_syntastic_python_pylint_checker") finish endif @@ -11,6 +12,9 @@ let g:loaded_syntastic_python_pylint_checker = 1 let s:pylint_new = -1 +let s:save_cpo = &cpo +set cpo&vim + function! SyntaxCheckers_python_pylint_IsAvailable() dict let exe = self.getExec() let s:pylint_new = executable(exe) ? s:PylintNew(exe) : -1 @@ -65,3 +69,8 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'python', \ 'name': 'pylint' }) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/python/python.vim b/syntax_checkers/python/python.vim index 0038b50e1..74d53c52a 100644 --- a/syntax_checkers/python/python.vim +++ b/syntax_checkers/python/python.vim @@ -7,10 +7,14 @@ " http://www.vim.org/scripts/download_script.php?src_id=1392 " "============================================================================ + if exists("g:loaded_syntastic_python_python_checker") finish endif -let g:loaded_syntastic_python_python_checker=1 +let g:loaded_syntastic_python_python_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim function! SyntaxCheckers_python_python_GetLocList() dict let fname = "'" . escape(expand('%'), "\\'") . "'" @@ -34,3 +38,8 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'python', \ 'name': 'python'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/racket/racket.vim b/syntax_checkers/racket/racket.vim index 870b5790e..716152057 100644 --- a/syntax_checkers/racket/racket.vim +++ b/syntax_checkers/racket/racket.vim @@ -19,8 +19,6 @@ let g:loaded_syntastic_racket_racket_checker=1 let s:save_cpo = &cpo set cpo&vim -" at some point put in the GetHightlightRegex(item) callback - function! SyntaxCheckers_racket_racket_GetLocList() dict let makeprg = self.makeprgBuild({}) @@ -48,3 +46,5 @@ call g:SyntasticRegistry.CreateAndRegisterChecker({ let &cpo = s:save_cpo unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/rst/rst2pseudoxml.vim b/syntax_checkers/rst/rst2pseudoxml.vim index 0aa3b8522..795fa277d 100644 --- a/syntax_checkers/rst/rst2pseudoxml.vim +++ b/syntax_checkers/rst/rst2pseudoxml.vim @@ -16,15 +16,15 @@ if exists("g:loaded_syntastic_rst_rst2pseudoxml_checker") finish endif -let g:loaded_syntastic_rst_rst2pseudoxml_checker=1 +let g:loaded_syntastic_rst_rst2pseudoxml_checker = 1 -function! SyntaxCheckers_rst_rst2pseudoxml_IsAvailable() dict - return executable(s:exe()) -endfunction +let s:rst2pseudoxml = executable('rst2pseudoxml.py') ? 'rst2pseudoxml.py' : 'rst2pseudoxml' + +let s:save_cpo = &cpo +set cpo&vim function! SyntaxCheckers_rst_rst2pseudoxml_GetLocList() dict let makeprg = self.makeprgBuild({ - \ 'exe': s:exe(), \ 'args': '--report=2 --exit-status=1', \ 'tail': syntastic#util#DevNull() }) @@ -51,10 +51,12 @@ function! SyntaxCheckers_rst_rst2pseudoxml_GetLocList() dict return loclist endfunction -function! s:exe() - return executable("rst2pseudoxml.py") ? "rst2pseudoxml.py" : "rst2pseudoxml" -endfunction - call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'rst', - \ 'name': 'rst2pseudoxml'}) + \ 'name': 'rst2pseudoxml', + \ 'exec': s:rst2pseudoxml }) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/rst/rstcheck.vim b/syntax_checkers/rst/rstcheck.vim index f98b97c3b..e55a045ed 100644 --- a/syntax_checkers/rst/rstcheck.vim +++ b/syntax_checkers/rst/rstcheck.vim @@ -5,15 +5,13 @@ " "============================================================================ -" https://github.com/myint/rstcheck -" -" To install rstcheck: -" $ pip install --upgrade rstcheck - if exists("g:loaded_syntastic_rst_rstcheck_checker") finish endif -let g:loaded_syntastic_rst_rstcheck_checker=1 +let g:loaded_syntastic_rst_rstcheck_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim function! SyntaxCheckers_rst_rstcheck_GetLocList() dict let makeprg = self.makeprgBuild({}) @@ -44,3 +42,8 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'rst', \ 'name': 'rstcheck'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/ruby/jruby.vim b/syntax_checkers/ruby/jruby.vim index 34f3014d2..587fe05f2 100644 --- a/syntax_checkers/ruby/jruby.vim +++ b/syntax_checkers/ruby/jruby.vim @@ -9,10 +9,14 @@ " See http://sam.zoy.org/wtfpl/COPYING for more details. " "============================================================================ + if exists("g:loaded_syntastic_ruby_jruby_checker") finish endif -let g:loaded_syntastic_ruby_jruby_checker=1 +let g:loaded_syntastic_ruby_jruby_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim function! SyntaxCheckers_ruby_jruby_GetLocList() dict if syntastic#util#isRunningWindows() @@ -42,3 +46,8 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'ruby', \ 'name': 'jruby'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/ruby/macruby.vim b/syntax_checkers/ruby/macruby.vim index ebfcd18f9..002b71941 100644 --- a/syntax_checkers/ruby/macruby.vim +++ b/syntax_checkers/ruby/macruby.vim @@ -8,10 +8,14 @@ " See http://sam.zoy.org/wtfpl/COPYING for more details. " "============================================================================ + if exists("g:loaded_syntastic_ruby_macruby_checker") finish endif -let g:loaded_syntastic_ruby_macruby_checker=1 +let g:loaded_syntastic_ruby_macruby_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim function! SyntaxCheckers_ruby_macruby_GetLocList() dict let makeprg = self.makeprgBuild({ @@ -35,3 +39,8 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'ruby', \ 'name': 'macruby'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/ruby/mri.vim b/syntax_checkers/ruby/mri.vim index ce11b4bab..4aac0ab52 100644 --- a/syntax_checkers/ruby/mri.vim +++ b/syntax_checkers/ruby/mri.vim @@ -13,12 +13,15 @@ if exists("g:loaded_syntastic_ruby_mri_checker") finish endif -let g:loaded_syntastic_ruby_mri_checker=1 +let g:loaded_syntastic_ruby_mri_checker = 1 if !exists("g:syntastic_ruby_exec") let g:syntastic_ruby_exec = "ruby" endif +let s:save_cpo = &cpo +set cpo&vim + function! SyntaxCheckers_ruby_mri_GetHighlightRegex(i) if stridx(a:i['text'], 'assigned but unused variable') >= 0 let term = split(a:i['text'], ' - ')[1] @@ -70,3 +73,8 @@ call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'ruby', \ 'name': 'mri', \ 'exec': 'ruby'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/ruby/rubocop.vim b/syntax_checkers/ruby/rubocop.vim index 60200cf2a..cf6bf4d7c 100644 --- a/syntax_checkers/ruby/rubocop.vim +++ b/syntax_checkers/ruby/rubocop.vim @@ -16,7 +16,10 @@ if exists("g:loaded_syntastic_ruby_rubocop_checker") finish endif -let g:loaded_syntastic_ruby_rubocop_checker=1 +let g:loaded_syntastic_ruby_rubocop_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim function! SyntaxCheckers_ruby_rubocop_IsAvailable() dict let exe = self.getExec() @@ -50,3 +53,8 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'ruby', \ 'name': 'rubocop'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/ruby/rubylint.vim b/syntax_checkers/ruby/rubylint.vim index 4cf1f865b..02ed2f2f1 100644 --- a/syntax_checkers/ruby/rubylint.vim +++ b/syntax_checkers/ruby/rubylint.vim @@ -16,6 +16,9 @@ endif let g:loaded_syntastic_ruby_rubylint_checker = 1 +let s:save_cpo = &cpo +set cpo&vim + function! SyntaxCheckers_ruby_rubylint_GetLocList() dict let makeprg = self.makeprgBuild({ 'args': 'analyze --presenter=syntastic' }) @@ -31,4 +34,7 @@ call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'name': 'rubylint', \ 'exec': 'ruby-lint'}) -" vim: set ts=4 sts=4 sw=4: +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/rust/rustc.vim b/syntax_checkers/rust/rustc.vim index de4de5379..9910ae5c2 100644 --- a/syntax_checkers/rust/rustc.vim +++ b/syntax_checkers/rust/rustc.vim @@ -13,7 +13,10 @@ if exists("g:loaded_syntastic_rust_rustc_checker") finish endif -let g:loaded_syntastic_rust_rustc_checker=1 +let g:loaded_syntastic_rust_rustc_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim function! SyntaxCheckers_rust_rustc_GetLocList() dict let makeprg = self.makeprgBuild({ 'args': '--parse-only' }) @@ -32,3 +35,8 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'rust', \ 'name': 'rustc'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/sass/sass.vim b/syntax_checkers/sass/sass.vim index 5edfebe7d..6ff168e2d 100644 --- a/syntax_checkers/sass/sass.vim +++ b/syntax_checkers/sass/sass.vim @@ -13,7 +13,7 @@ if exists("g:loaded_syntastic_sass_sass_checker") finish endif -let g:loaded_syntastic_sass_sass_checker=1 +let g:loaded_syntastic_sass_sass_checker = 1 "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,6 +30,9 @@ if executable("compass") let s:imports = "--compass" endif +let s:save_cpo = &cpo +set cpo&vim + function! SyntaxCheckers_sass_sass_GetLocList() dict if !g:syntastic_sass_check_partials && expand('%:t')[0] == '_' return [] @@ -69,3 +72,8 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'sass', \ 'name': 'sass'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/scala/fsc.vim b/syntax_checkers/scala/fsc.vim index e5f44c319..02809e9c6 100644 --- a/syntax_checkers/scala/fsc.vim +++ b/syntax_checkers/scala/fsc.vim @@ -19,6 +19,9 @@ if !exists('g:syntastic_scala_options') let g:syntastic_scala_options = '' endif +let s:save_cpo = &cpo +set cpo&vim + function! SyntaxCheckers_scala_fsc_GetLocList() dict " fsc has some serious problems with the " working directory changing after being started @@ -40,3 +43,8 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'scala', \ 'name': 'fsc'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/scala/scalac.vim b/syntax_checkers/scala/scalac.vim index eaf4e719c..3d11fa7ca 100644 --- a/syntax_checkers/scala/scalac.vim +++ b/syntax_checkers/scala/scalac.vim @@ -13,12 +13,15 @@ if exists("g:loaded_syntastic_scala_scalac_checker") finish endif -let g:loaded_syntastic_scala_scalac_checker=1 +let g:loaded_syntastic_scala_scalac_checker = 1 if !exists('g:syntastic_scala_options') let g:syntastic_scala_options = '' endif +let s:save_cpo = &cpo +set cpo&vim + function! SyntaxCheckers_scala_scalac_GetLocList() dict let makeprg = self.makeprgBuild({ \ 'args': '-Ystop-after:parser ' . g:syntastic_scala_options }) @@ -36,3 +39,8 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'scala', \ 'name': 'scalac'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/scss/sass.vim b/syntax_checkers/scss/sass.vim index 1fa54b7d7..61bd6de78 100644 --- a/syntax_checkers/scss/sass.vim +++ b/syntax_checkers/scss/sass.vim @@ -14,7 +14,7 @@ if exists("g:loaded_syntastic_scss_sass_checker") finish endif -let g:loaded_syntastic_scss_sass_checker=1 +let g:loaded_syntastic_scss_sass_checker = 1 runtime! syntax_checkers/sass/*.vim @@ -22,3 +22,5 @@ call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'scss', \ 'name': 'sass', \ 'redirect': 'sass/sass'}) + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/scss/scss_lint.vim b/syntax_checkers/scss/scss_lint.vim index dd1f927f0..5219c37bc 100644 --- a/syntax_checkers/scss/scss_lint.vim +++ b/syntax_checkers/scss/scss_lint.vim @@ -12,7 +12,10 @@ if exists("g:loaded_syntastic_scss_scss_lint_checker") finish endif -let g:loaded_syntastic_scss_scss_lint_checker=1 +let g:loaded_syntastic_scss_scss_lint_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim function! SyntaxCheckers_scss_scss_lint_GetLocList() dict let makeprg = self.makeprgBuild({}) @@ -27,3 +30,8 @@ call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'scss', \ 'name': 'scss_lint', \ 'exec': 'scss-lint' }) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/sh/checkbashisms.vim b/syntax_checkers/sh/checkbashisms.vim index 6f8b10538..42751cf91 100644 --- a/syntax_checkers/sh/checkbashisms.vim +++ b/syntax_checkers/sh/checkbashisms.vim @@ -9,7 +9,10 @@ if exists("g:loaded_syntastic_sh_checkbashisms_checker") finish endif -let g:loaded_syntastic_sh_checkbashisms_checker=1 +let g:loaded_syntastic_sh_checkbashisms_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim function! SyntaxCheckers_sh_checkbashisms_GetLocList() dict let makeprg = self.makeprgBuild({ 'args': '-fx' }) @@ -29,7 +32,11 @@ function! SyntaxCheckers_sh_checkbashisms_GetLocList() dict \ 'subtype': 'Style' }) endfunction - call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'sh', \ 'name': 'checkbashisms' }) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/sh/sh.vim b/syntax_checkers/sh/sh.vim index 6e1960555..4e4be67b1 100644 --- a/syntax_checkers/sh/sh.vim +++ b/syntax_checkers/sh/sh.vim @@ -13,7 +13,10 @@ if exists("g:loaded_syntastic_sh_sh_checker") finish endif -let g:loaded_syntastic_sh_sh_checker=1 +let g:loaded_syntastic_sh_sh_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim function! s:GetShell() if !exists('b:shell') || b:shell == '' @@ -78,3 +81,8 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'sh', \ 'name': 'sh' }) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/sh/shellcheck.vim b/syntax_checkers/sh/shellcheck.vim index 2c983eef5..af141640f 100644 --- a/syntax_checkers/sh/shellcheck.vim +++ b/syntax_checkers/sh/shellcheck.vim @@ -8,6 +8,9 @@ if exists("g:loaded_syntastic_sh_shellcheck_checker") endif let g:loaded_syntastic_sh_shellcheck_checker = 1 +let s:save_cpo = &cpo +set cpo&vim + function! SyntaxCheckers_sh_shellcheck_GetLocList() dict let makeprg = self.makeprgBuild({ 'args': '-f gcc' }) @@ -34,3 +37,8 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'sh', \ 'name': 'shellcheck' }) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/slim/slimrb.vim b/syntax_checkers/slim/slimrb.vim index 90f5b9f2e..43840a213 100644 --- a/syntax_checkers/slim/slimrb.vim +++ b/syntax_checkers/slim/slimrb.vim @@ -13,7 +13,10 @@ if exists("g:loaded_syntastic_slim_slimrb_checker") finish endif -let g:loaded_syntastic_slim_slimrb_checker=1 +let g:loaded_syntastic_slim_slimrb_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim function! s:SlimrbVersion() if !exists('s:slimrb_version') @@ -47,3 +50,8 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'slim', \ 'name': 'slimrb'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/tcl/nagelfar.vim b/syntax_checkers/tcl/nagelfar.vim index b17f8a671..2b128b44e 100644 --- a/syntax_checkers/tcl/nagelfar.vim +++ b/syntax_checkers/tcl/nagelfar.vim @@ -11,10 +11,14 @@ " See nagelfar homepage http://nagelfar.berlios.de/. " "============================================================================ + if exists("g:loaded_syntastic_tcl_nagelfar_checker") finish endif -let g:loaded_syntastic_tcl_nagelfar_checker=1 +let g:loaded_syntastic_tcl_nagelfar_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim function! SyntaxCheckers_tcl_nagelfar_GetLocList() dict let makeprg = self.makeprgBuild({ 'args': '-H' }) @@ -32,3 +36,8 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'tcl', \ 'name': 'nagelfar'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/tex/chktex.vim b/syntax_checkers/tex/chktex.vim index 5263807cf..3417692d3 100644 --- a/syntax_checkers/tex/chktex.vim +++ b/syntax_checkers/tex/chktex.vim @@ -28,6 +28,9 @@ if exists('g:loaded_syntastic_tex_chktex_checker') endif let g:loaded_syntastic_tex_chktex_checker = 1 +let s:save_cpo = &cpo +set cpo&vim + if !exists('g:syntastic_tex_chktex_showmsgs') let g:syntastic_tex_chktex_showmsgs = 1 endif @@ -52,3 +55,8 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'tex', \ 'name': 'chktex'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/tex/lacheck.vim b/syntax_checkers/tex/lacheck.vim index ec1e4bedf..0896919c4 100644 --- a/syntax_checkers/tex/lacheck.vim +++ b/syntax_checkers/tex/lacheck.vim @@ -13,7 +13,10 @@ if exists('g:loaded_syntastic_tex_lacheck_checker') finish endif -let g:loaded_syntastic_tex_lacheck_checker=1 +let g:loaded_syntastic_tex_lacheck_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim function! SyntaxCheckers_tex_lacheck_GetLocList() dict let makeprg = self.makeprgBuild({}) @@ -30,3 +33,8 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'tex', \ 'name': 'lacheck'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/text/atdtool.vim b/syntax_checkers/text/atdtool.vim index c3d8ee1c4..5a8ea0c73 100644 --- a/syntax_checkers/text/atdtool.vim +++ b/syntax_checkers/text/atdtool.vim @@ -15,6 +15,9 @@ if exists("g:loaded_syntastic_text_atdtool_checker") endif let g:loaded_syntastic_text_atdtool_checker = 1 +let s:save_cpo = &cpo +set cpo&vim + function! SyntaxCheckers_text_atdtool_GetHighlightRegex(item) let term = matchstr(a:item['text'], '\m "\zs[^"]\+\ze"\($\| | suggestions:\)') if term != '' @@ -47,3 +50,8 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'text', \ 'name': 'atdtool'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/twig/twiglint.vim b/syntax_checkers/twig/twiglint.vim index 90b76fc44..98d5141d0 100644 --- a/syntax_checkers/twig/twiglint.vim +++ b/syntax_checkers/twig/twiglint.vim @@ -13,7 +13,10 @@ if exists("g:loaded_syntastic_twig_twiglint_checker") finish endif -let g:loaded_syntastic_twig_twiglint_checker=1 +let g:loaded_syntastic_twig_twiglint_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim function! SyntaxCheckers_twig_twiglint_GetHighlightRegex(item) " Let's match the full line for now @@ -34,3 +37,8 @@ call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'twig', \ 'name': 'twiglint', \ 'exec': 'twig-lint'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/typescript/tsc.vim b/syntax_checkers/typescript/tsc.vim index 0953acb36..73408f762 100644 --- a/syntax_checkers/typescript/tsc.vim +++ b/syntax_checkers/typescript/tsc.vim @@ -7,7 +7,10 @@ if exists("g:loaded_syntastic_typescript_tsc_checker") finish endif -let g:loaded_syntastic_typescript_tsc_checker=1 +let g:loaded_syntastic_typescript_tsc_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim function! SyntaxCheckers_typescript_tsc_GetLocList() dict let makeprg = self.makeprgBuild({ @@ -30,3 +33,8 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'typescript', \ 'name': 'tsc'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/vala/valac.vim b/syntax_checkers/vala/valac.vim index e33dd03ad..dc5ae48b3 100644 --- a/syntax_checkers/vala/valac.vim +++ b/syntax_checkers/vala/valac.vim @@ -32,6 +32,9 @@ if exists("g:loaded_syntastic_vala_valac_checker") endif let g:loaded_syntastic_vala_valac_checker = 1 +let s:save_cpo = &cpo +set cpo&vim + function! SyntaxCheckers_vala_valac_GetHighlightRegex(pos) let strlength = strlen(matchstr(a:pos['text'], '\m\^\+$')) return '\%>' . (a:pos.col-1) . 'c.*\%<' . (a:pos.col+strlength+1) . 'c' @@ -87,3 +90,8 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'vala', \ 'name': 'valac'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/vhdl/ghdl.vim b/syntax_checkers/vhdl/ghdl.vim index 915d3b4f3..b6fba1f2f 100644 --- a/syntax_checkers/vhdl/ghdl.vim +++ b/syntax_checkers/vhdl/ghdl.vim @@ -9,11 +9,15 @@ " See http://sam.zoy.org/wtfpl/COPYING for more details. " "============================================================================ + if exists("g:loaded_syntastic_vhdl_ghdl_checker") finish endif let g:loaded_syntastic_vhdl_ghdl_checker = 1 +let s:save_cpo = &cpo +set cpo&vim + function! SyntaxCheckers_vhdl_ghdl_GetLocList() dict let makeprg = self.makeprgBuild({ 'args': '-s' }) @@ -27,3 +31,8 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'vhdl', \ 'name': 'ghdl'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/xhtml/tidy.vim b/syntax_checkers/xhtml/tidy.vim index c8392d901..06b255ac0 100644 --- a/syntax_checkers/xhtml/tidy.vim +++ b/syntax_checkers/xhtml/tidy.vim @@ -18,12 +18,15 @@ if exists("g:loaded_syntastic_xhtml_tidy_checker") finish endif -let g:loaded_syntastic_xhtml_tidy_checker=1 +let g:loaded_syntastic_xhtml_tidy_checker = 1 if !exists('g:syntastic_xhtml_tidy_ignore_errors') let g:syntastic_xhtml_tidy_ignore_errors = [] endif +let s:save_cpo = &cpo +set cpo&vim + " TODO: join this with html.vim DRY's sake? function! s:TidyEncOptByFenc() let tidy_opts = { @@ -79,3 +82,8 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'xhtml', \ 'name': 'tidy'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/xml/xmllint.vim b/syntax_checkers/xml/xmllint.vim index 99dbf251e..d09df879b 100644 --- a/syntax_checkers/xml/xmllint.vim +++ b/syntax_checkers/xml/xmllint.vim @@ -13,7 +13,10 @@ if exists("g:loaded_syntastic_xml_xmllint_checker") finish endif -let g:loaded_syntastic_xml_xmllint_checker=1 +let g:loaded_syntastic_xml_xmllint_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim " You can use a local installation of DTDs to significantly speed up validation " and allow you to validate XML data without network access, see xmlcatalog(1) @@ -42,3 +45,8 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'xml', \ 'name': 'xmllint'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/xslt/xmllint.vim b/syntax_checkers/xslt/xmllint.vim index 7e6afbe66..e224c2566 100644 --- a/syntax_checkers/xslt/xmllint.vim +++ b/syntax_checkers/xslt/xmllint.vim @@ -13,7 +13,7 @@ if exists("g:loaded_syntastic_xslt_xmllint_checker") finish endif -let g:loaded_syntastic_xslt_xmllint_checker=1 +let g:loaded_syntastic_xslt_xmllint_checker = 1 runtime! syntax_checkers/xml/*.vim @@ -21,3 +21,5 @@ call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'xslt', \ 'name': 'xmllint', \ 'redirect': 'xml/xmllint'}) + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/yacc/bison.vim b/syntax_checkers/yacc/bison.vim index 79921a422..b285b2fb9 100644 --- a/syntax_checkers/yacc/bison.vim +++ b/syntax_checkers/yacc/bison.vim @@ -51,3 +51,5 @@ call g:SyntasticRegistry.CreateAndRegisterChecker({ let &cpo = s:save_cpo unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/yaml/jsyaml.vim b/syntax_checkers/yaml/jsyaml.vim index ddc72bfdd..366a3a627 100644 --- a/syntax_checkers/yaml/jsyaml.vim +++ b/syntax_checkers/yaml/jsyaml.vim @@ -16,7 +16,10 @@ if exists("g:loaded_syntastic_yaml_jsyaml_checker") finish endif -let g:loaded_syntastic_yaml_jsyaml_checker=1 +let g:loaded_syntastic_yaml_jsyaml_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim function! SyntaxCheckers_yaml_jsyaml_GetLocList() dict if !exists('s:js_yaml_new') @@ -41,3 +44,8 @@ call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'yaml', \ 'name': 'jsyaml', \ 'exec': 'js-yaml'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/yaml/yamlxs.vim b/syntax_checkers/yaml/yamlxs.vim index 4ccf5e78e..b8a540f17 100644 --- a/syntax_checkers/yaml/yamlxs.vim +++ b/syntax_checkers/yaml/yamlxs.vim @@ -14,7 +14,7 @@ if exists("g:loaded_syntastic_yaml_yamlxs_checker") finish endif -let g:loaded_syntastic_yaml_yamlxs_checker=1 +let g:loaded_syntastic_yaml_yamlxs_checker = 1 if !exists('g:syntastic_perl_interpreter') let g:syntastic_perl_interpreter = 'perl' @@ -24,6 +24,9 @@ if !exists('g:syntastic_perl_lib_path') let g:syntastic_perl_lib_path = [] endif +let s:save_cpo = &cpo +set cpo&vim + function! SyntaxCheckers_yaml_yamlxs_IsAvailable() dict " don't call executable() here, to allow things like " let g:syntastic_perl_interpreter='/usr/bin/env perl' @@ -67,3 +70,8 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'yaml', \ 'name': 'yamlxs' }) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/z80/z80syntaxchecker.vim b/syntax_checkers/z80/z80syntaxchecker.vim index a0c3c6ea4..bbf3e48d5 100644 --- a/syntax_checkers/z80/z80syntaxchecker.vim +++ b/syntax_checkers/z80/z80syntaxchecker.vim @@ -19,7 +19,10 @@ if exists("g:loaded_syntastic_z80_z80syntaxchecker_checker") finish endif -let g:loaded_syntastic_z80_z80syntaxchecker_checker=1 +let g:loaded_syntastic_z80_z80syntaxchecker_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim function! SyntaxCheckers_z80_z80syntaxchecker_GetLocList() dict let makeprg = self.makeprgBuild({}) @@ -35,3 +38,8 @@ call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'z80', \ 'name': 'z80syntaxchecker', \ 'exec': 'z80_syntax_checker.py'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/zpt/zptlint.vim b/syntax_checkers/zpt/zptlint.vim index 16b85e0cc..6769b55bc 100644 --- a/syntax_checkers/zpt/zptlint.vim +++ b/syntax_checkers/zpt/zptlint.vim @@ -22,7 +22,10 @@ if exists("g:loaded_syntastic_zpt_zptlint_checker") finish endif -let g:loaded_syntastic_zpt_zptlint_checker=1 +let g:loaded_syntastic_zpt_zptlint_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim function! SyntaxCheckers_zpt_zptlint_GetLocList() dict let makeprg = self.makeprgBuild({}) @@ -41,3 +44,8 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'zpt', \ 'name': 'zptlint'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/zsh/zsh.vim b/syntax_checkers/zsh/zsh.vim index 09b5ee653..216cadaef 100644 --- a/syntax_checkers/zsh/zsh.vim +++ b/syntax_checkers/zsh/zsh.vim @@ -13,7 +13,10 @@ if exists("g:loaded_syntastic_zsh_zsh_checker") finish endif -let g:loaded_syntastic_zsh_zsh_checker=1 +let g:loaded_syntastic_zsh_zsh_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim function! SyntaxCheckers_zsh_zsh_GetLocList() dict let makeprg = self.makeprgBuild({ 'args': '-n' }) @@ -28,3 +31,8 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'zsh', \ 'name': 'zsh'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: From 1fdd07efeadabc915bff428753cd136484921d0d Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 3 Jan 2014 14:04:55 +0200 Subject: [PATCH 0328/1271] Fix for pilot error. ;) --- syntax_checkers/php/php.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntax_checkers/php/php.vim b/syntax_checkers/php/php.vim index 42b831b60..b96ea0762 100644 --- a/syntax_checkers/php/php.vim +++ b/syntax_checkers/php/php.vim @@ -45,9 +45,9 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'php', + \ 'name': 'php'}) let &cpo = s:save_cpo unlet s:save_cpo " vim: set et sts=4 sw=4: - \ 'name': 'php'}) From f83b81b00b7d90c02c7a3124ef8ef2c4356ee830 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 3 Jan 2014 14:18:37 +0200 Subject: [PATCH 0329/1271] Fix for a typing-faster-than-thinking bug in cgc. --- syntax_checkers/glsl/cgc.vim | 1 + 1 file changed, 1 insertion(+) diff --git a/syntax_checkers/glsl/cgc.vim b/syntax_checkers/glsl/cgc.vim index c7bf6ee00..efbd231fa 100644 --- a/syntax_checkers/glsl/cgc.vim +++ b/syntax_checkers/glsl/cgc.vim @@ -43,6 +43,7 @@ endfunction function! s:GetProfile() let save_cursor = getpos('.') + call cursor(1, 1) let magic = '\m\C^// profile:\s*' let line = search(magic, 'c') call setpos('.', save_cursor) From 00b0618479ed39b42ac461602c07d3fe9bfdb7a1 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 3 Jan 2014 17:06:27 +0200 Subject: [PATCH 0330/1271] JSHint can be used to check JavaScript in HTML and xHTML files. --- syntax_checkers/html/jshint.vim | 55 ++++++++++++++++++++++++++++++++ syntax_checkers/xhtml/jshint.vim | 25 +++++++++++++++ 2 files changed, 80 insertions(+) create mode 100644 syntax_checkers/html/jshint.vim create mode 100644 syntax_checkers/xhtml/jshint.vim diff --git a/syntax_checkers/html/jshint.vim b/syntax_checkers/html/jshint.vim new file mode 100644 index 000000000..20d45f9ef --- /dev/null +++ b/syntax_checkers/html/jshint.vim @@ -0,0 +1,55 @@ +"============================================================================ +"File: jshint.vim +"Description: Javascript syntax checker for HTML - using jshint +"Maintainer: LCD 47 +"License: This program is free software. It comes without any warranty, +" to the extent permitted by applicable law. You can redistribute +" it and/or modify it under the terms of the Do What The Fuck You +" Want To Public License, Version 2, as published by Sam Hocevar. +" See http://sam.zoy.org/wtfpl/COPYING for more details. +"============================================================================ + +if exists('g:loaded_syntastic_html_jshint_checker') + finish +endif +let g:loaded_syntastic_html_jshint_checker = 1 + +if !exists('g:syntastic_jshint_exec') + let g:syntastic_jshint_exec = 'jshint' +endif + +if !exists('g:syntastic_html_jshint_conf') + let g:syntastic_html_jshint_conf = '' +endif + +let s:save_cpo = &cpo +set cpo&vim + +function! SyntaxCheckers_html_jshint_IsAvailable() dict + let exe = expand(g:syntastic_jshint_exec) + return executable(exe) && + \ syntastic#util#versionIsAtLeast(syntastic#util#getVersion(exe . ' --version'), [2,4]) +endfunction + +function! SyntaxCheckers_html_jshint_GetLocList() dict + let makeprg = self.makeprgBuild({ + \ 'exe': expand(g:syntastic_jshint_exec), + \ 'post_args': '--verbose --extract always' . + \ (!empty(g:syntastic_html_jshint_conf) ? ' --config ' . g:syntastic_html_jshint_conf : '') }) + + let errorformat = '%A%f: line %l\, col %v\, %m \(%t%*\d\)' + + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'defaults': {'bufnr': bufnr('')} }) +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'html', + \ 'name': 'jshint'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/xhtml/jshint.vim b/syntax_checkers/xhtml/jshint.vim new file mode 100644 index 000000000..3312ccef8 --- /dev/null +++ b/syntax_checkers/xhtml/jshint.vim @@ -0,0 +1,25 @@ +"============================================================================ +"File: jshint.vim +"Description: Javascript syntax checker for xHTML - using jshint +"Maintainer: LCD 47 +"License: This program is free software. It comes without any warranty, +" to the extent permitted by applicable law. You can redistribute +" it and/or modify it under the terms of the Do What The Fuck You +" Want To Public License, Version 2, as published by Sam Hocevar. +" See http://sam.zoy.org/wtfpl/COPYING for more details. +" +"============================================================================ + +if exists("g:loaded_syntastic_xhtml_jshint_checker") + finish +endif +let g:loaded_syntastic_xhtml_jshint_checker = 1 + +runtime! syntax_checkers/html/*.vim + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'xhtml', + \ 'name': 'jshint', + \ 'redirect': 'html/jshint'}) + +" vim: set et sts=4 sw=4: From 0e1bd647f5a1b2efa89f5997caf5238d6bf7cebe Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 3 Jan 2014 18:58:30 +0200 Subject: [PATCH 0331/1271] Minor cleanup: remove dead code; formatting. --- syntax_checkers/html/tidy.vim | 24 ++++++++++++------------ syntax_checkers/twig/twiglint.vim | 5 ----- syntax_checkers/xhtml/tidy.vim | 24 ++++++++++++------------ 3 files changed, 24 insertions(+), 29 deletions(-) diff --git a/syntax_checkers/html/tidy.vim b/syntax_checkers/html/tidy.vim index b29033c15..9f78feee9 100644 --- a/syntax_checkers/html/tidy.vim +++ b/syntax_checkers/html/tidy.vim @@ -48,18 +48,18 @@ set cpo&vim " TODO: join this with xhtml.vim for DRY's sake? function! s:TidyEncOptByFenc() let tidy_opts = { - \'utf-8' : '-utf8', - \'ascii' : '-ascii', - \'latin1' : '-latin1', - \'iso-2022-jp' : '-iso-2022', - \'cp1252' : '-win1252', - \'macroman' : '-mac', - \'utf-16le' : '-utf16le', - \'utf-16' : '-utf16', - \'big5' : '-big5', - \'cp932' : '-shiftjis', - \'sjis' : '-shiftjis', - \'cp850' : '-ibm858', + \'utf-8': '-utf8', + \'ascii': '-ascii', + \'latin1': '-latin1', + \'iso-2022-jp': '-iso-2022', + \'cp1252': '-win1252', + \'macroman': '-mac', + \'utf-16le': '-utf16le', + \'utf-16': '-utf16', + \'big5': '-big5', + \'cp932': '-shiftjis', + \'sjis': '-shiftjis', + \'cp850': '-ibm858', \} return get(tidy_opts, &fileencoding, '-utf8') endfunction diff --git a/syntax_checkers/twig/twiglint.vim b/syntax_checkers/twig/twiglint.vim index 98d5141d0..6e29b7388 100644 --- a/syntax_checkers/twig/twiglint.vim +++ b/syntax_checkers/twig/twiglint.vim @@ -18,11 +18,6 @@ let g:loaded_syntastic_twig_twiglint_checker = 1 let s:save_cpo = &cpo set cpo&vim -function! SyntaxCheckers_twig_twiglint_GetHighlightRegex(item) - " Let's match the full line for now - return '\V' -endfunction - function! SyntaxCheckers_twig_twiglint_GetLocList() dict let makeprg = self.makeprgBuild({ 'args': 'lint --format=csv' }) diff --git a/syntax_checkers/xhtml/tidy.vim b/syntax_checkers/xhtml/tidy.vim index 06b255ac0..cb21968d5 100644 --- a/syntax_checkers/xhtml/tidy.vim +++ b/syntax_checkers/xhtml/tidy.vim @@ -30,18 +30,18 @@ set cpo&vim " TODO: join this with html.vim DRY's sake? function! s:TidyEncOptByFenc() let tidy_opts = { - \'utf-8' : '-utf8', - \'ascii' : '-ascii', - \'latin1' : '-latin1', - \'iso-2022-jp' : '-iso-2022', - \'cp1252' : '-win1252', - \'macroman' : '-mac', - \'utf-16le' : '-utf16le', - \'utf-16' : '-utf16', - \'big5' : '-big5', - \'cp932' : '-shiftjis', - \'sjis' : '-shiftjis', - \'cp850' : '-ibm858', + \'utf-8': '-utf8', + \'ascii': '-ascii', + \'latin1': '-latin1', + \'iso-2022-jp': '-iso-2022', + \'cp1252': '-win1252', + \'macroman': '-mac', + \'utf-16le': '-utf16le', + \'utf-16': '-utf16', + \'big5': '-big5', + \'cp932': '-shiftjis', + \'sjis': '-shiftjis', + \'cp850': '-ibm858', \} return get(tidy_opts, &fileencoding, '-utf8') endfunction From d38f599fa72f1dc59ef825129c0dcff2656afbfa Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Sat, 4 Jan 2014 10:01:16 +0200 Subject: [PATCH 0332/1271] Rework of message decoding for flake8. --- syntax_checkers/python/flake8.vim | 33 ++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/syntax_checkers/python/flake8.vim b/syntax_checkers/python/flake8.vim index 9fe721f8e..61d55cc93 100644 --- a/syntax_checkers/python/flake8.vim +++ b/syntax_checkers/python/flake8.vim @@ -23,15 +23,38 @@ function! SyntaxCheckers_python_flake8_GetLocList() dict let errorformat = \ '%E%f:%l: could not compile,%-Z%p^,' . - \ '%E%f:%l:%c: F%n %m,' . - \ '%W%f:%l:%c: C%n %m,' . - \ '%W%f:%l:%c: %.%n %m,' . - \ '%W%f:%l: %.%n %m,' . + \ '%A%f:%l:%c: %t%n %m,' . + \ '%A%f:%l: %t%n %m,' . \ '%-G%.%#' - return SyntasticMake({ + let loclist = SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat }) + + for e in loclist + " E*** and W*** are pep8 errors + " F*** are PyFlakes codes + " C*** are McCabe complexity messages + " N*** are naming conventions from pep8-naming + + if has_key(e, 'nr') + let e['text'] .= printf(' [%s%03d]', e['type'], e['nr']) + " E901 are syntax errors + " E902 are I/O errors + if e['type'] ==? 'E' && e['nr'] !~ '\m^9' + let e['subtype'] = 'Style' + endif + call remove(e, 'nr') + endif + + if e['type'] =~? '\m^[CNW]' + let e['subtype'] = 'Style' + endif + + let e['type'] = e['type'] =~? '\m^[EFC]' ? 'E' : 'W' + endfor + + return loclist endfunction runtime! syntax_checkers/python/pyflakes.vim From 29f1bc1c6df20bc7dbc33aaa1d6b5104ec7be571 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Thu, 12 Dec 2013 20:40:30 +0200 Subject: [PATCH 0333/1271] New feature: message filtering. New options: g:syntastic_quiet_messages, and a per-checker version of it named g:syntastic___quiet_messages. Option g:syntastic_quiet_warnings is now deprecated. Option g:syntastic_ignore_files now refers only to files that shouldn't be checked. --- autoload/syntastic/log.vim | 2 +- autoload/syntastic/util.vim | 36 ++++++++++++++++++++ doc/syntastic.txt | 64 +++++++++++++++++++++++++----------- plugin/syntastic.vim | 38 ++++++++++++--------- plugin/syntastic/checker.vim | 31 ++++++++++------- plugin/syntastic/loclist.vim | 15 ++++----- plugin/syntastic/signs.vim | 4 +-- 7 files changed, 131 insertions(+), 59 deletions(-) diff --git a/autoload/syntastic/log.vim b/autoload/syntastic/log.vim index aba881976..8b7281ea7 100644 --- a/autoload/syntastic/log.vim +++ b/autoload/syntastic/log.vim @@ -30,7 +30,7 @@ let s:global_options = [ \ 'syntastic_ignore_files', \ 'syntastic_loc_list_height', \ 'syntastic_mode_map', - \ 'syntastic_quiet_warnings', + \ 'syntastic_quiet_messages', \ 'syntastic_reuse_loc_lists', \ 'syntastic_stl_format', \ 'syntastic_style_error_symbol', diff --git a/autoload/syntastic/util.vim b/autoload/syntastic/util.vim index b94846d51..399d422fe 100644 --- a/autoload/syntastic/util.vim +++ b/autoload/syntastic/util.vim @@ -234,6 +234,17 @@ function! syntastic#util#redrawHandler() endif endfunction +function! syntastic#util#dictFilter(errors, filter) + let rules = s:translateFilter(a:filter) + " call syntastic#log#debug(g:SyntasticDebugFilters, "applying filter:", rules) + try + call filter(a:errors, rules) + catch /\m^Vim\%((\a\+)\)\=:E/ + let msg = matchstr(v:exception, '\m^Vim\%((\a\+)\)\=:\zs.*') + call syntastic#log#error('quiet_messages: ' . msg) + endtry +endfunction + " Private functions {{{1 "Redraw in a way that doesnt make the screen flicker or leave anomalies behind. @@ -251,6 +262,31 @@ function! s:doRedraw(full) endif endfunction +function! s:translateFilter(filters) + let conditions = [] + for [k, v] in items(a:filters) + if type(v) == type([]) + call extend(conditions, map(copy(v), 's:translateElement(k, v:val)')) + else + call add(conditions, s:translateElement(k, v)) + endif + endfor + return len(conditions) == 1 ? conditions[0] : join(map(conditions, '"(" . v:val . ")"'), ' && ') +endfunction + +function! s:translateElement(key, term) + if a:key ==? 'level' + let ret = 'v:val["type"] !=? ' . string(a:term[0]) + elseif a:key ==? 'type' + let ret = a:term ==? 'style' ? 'get(v:val, "subtype", "") !=? "style"' : 'has_key(v:val, "subtype")' + elseif a:key ==? 'regex' + let ret = 'v:val["text"] !~? ' . string(a:term) + elseif a:key ==? 'file' + let ret = 'bufname(str2nr(v:val["bufnr"])) !~# ' . string(a:term) + endif + return ret +endfunction + let &cpo = s:save_cpo unlet s:save_cpo " vim: set et sts=4 sw=4 fdm=marker: diff --git a/doc/syntastic.txt b/doc/syntastic.txt index c596569b0..82934cf72 100644 --- a/doc/syntastic.txt +++ b/doc/syntastic.txt @@ -189,9 +189,10 @@ the checker that generated it, but you can disable these labels by unsetting ------------------------------------------------------------------------------ 2.6 Filtering errors *syntastic-filtering-errors* -You can selectively disable some of the errors found by checkers either by -turning on |'syntastic_quiet_warnings'|, or by specifying a list of patterns -in |'syntastic_ignore_files'|. +You can selectively disable some of the errors found by checkers either +using |'syntastic_quiet_messages'|, or by specifying a list of patterns in +|'syntastic_ignore_files'|. +'syntastic___quiet_messages' ============================================================================== 3. Commands *syntastic-commands* @@ -350,12 +351,11 @@ opens. > < *'syntastic_ignore_files'* Default: [] -Use this option to specify files that syntastic should neither check, nor -include in error lists. It has to be a list of |regular-expression| patterns. -The full paths of files (see |::p|) are matched against these patterns, and -the matches are case sensitive. Use |\c| if you need case insensitive -patterns. > - let g:syntastic_ignore_files = ['^/usr/include/', '\c\.h$'] +Use this option to specify files that syntastic should never check. It's a +list of |regular-expression| patterns. The full paths of files (see |::p|) are +matched against these patterns, and the matches are case sensitive. Use |\c| +to specify case insensitive patterns. Example: > + let g:syntastic_ignore_files = ['\m^/usr/include/', '\m\c\.h$'] < *'syntastic_filetype_map'* Default: {} @@ -400,18 +400,33 @@ active and passive mode. If any of "mode", "active_filetypes", or "passive_filetypes" are not specified then they will default to their default value as above. - *'syntastic_quiet_warnings'* -Default: 0 -Use this option if you only care about syntax errors, not warnings. When set, -this option has the following effects: - * no |signs| appear unless there is at least one error, whereupon both - errors and warnings are displayed - * the |'syntastic_auto_loc_list'| option only pops up the error window if - there's at least one error, whereupon both errors and warnings are - displayed -> - let g:syntastic_quiet_warnings = 1 + *'syntastic_quiet_messages'* +Default: {} + +Use this option to filter out some of the messages produced by checkers. The +option should be set to something like: > + + let g:syntastic_quiet_messages = { "level": "warnings", + \ "type": "style", + \ "regex": '\m\[C03\d\d\]', + \ "file": ['\m^/usr/include/', '\m\c\.h$'] } < + +Each element turns off messages matching the patterns specified by the +corresponding value. Values are lists, but if a list consist of a single +element you can omit adding the brackets (e.g. you can write "style" instead of +["style"]). + + "level" - takes one of two values, "warnings" or "errors" + "type" - can be either "syntax" or "style" + "regex" - is matched against the messages' text as a case insensitive + |regular-expression| + "file" - is matched against the filename the error refers to, as a case + sensitive |regular-expression|. + +There are also checker-specific variants of this option, providing finer +control. They are named |'syntastic___quiet_messages'|. + *'syntastic_stl_format'* Default: [Syntax: line:%F (%t)] Use this option to control what the syntastic statusline text contains. Several @@ -554,6 +569,15 @@ options that can be set, these are usually documented in the wiki: https://github.com/scrooloose/syntastic/wiki/Syntax-Checkers + *'syntastic___quiet_messages'* +In the same vein, 'g:syntastic___quiet_messages' can +be used to restrict message filters to messages produced by specific checkers. +Example: > + let g:syntastic_python_pylama_quiet_messages = { "type": "style", + \ "regex": '\m\[C03\d\d\]' } +< +See |syntastic_quiet_messages| for the syntax. + ============================================================================== 6. Notes *syntastic-notes* diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index e13e375fb..a8dedf176 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -47,8 +47,8 @@ if !exists("g:syntastic_auto_jump") let g:syntastic_auto_jump = 0 endif -if !exists("g:syntastic_quiet_warnings") - let g:syntastic_quiet_warnings = 0 +if !exists("g:syntastic_quiet_messages") + let g:syntastic_quiet_messages = {} endif if !exists("g:syntastic_stl_format") @@ -93,6 +93,19 @@ if !exists("g:syntastic_reuse_loc_lists") let g:syntastic_reuse_loc_lists = (v:version >= 704) endif +if exists("g:syntastic_quiet_warnings") + call syntastic#log#deprecationWarn("variable g:syntastic_quiet_warnings is deprecated, please use let g:syntastic_quiet_messages = {'level': 'warnings'} instead") + if g:syntastic_quiet_warnings + let quiet_warnings = get(g:syntastic_quiet_messages, 'type', []) + if type(quiet_warnings) != type([]) + let quiet_warnings = [quiet_warnings] + endif + call add(quiet_warnings, 'warnings') + let g:syntastic_quiet_messages['type'] = quiet_warnings + endif +endif + + " debug constants let g:SyntasticDebugTrace = 1 let g:SyntasticDebugLoclist = 2 @@ -104,6 +117,7 @@ let s:registry = g:SyntasticRegistry.Instance() let s:notifiers = g:SyntasticNotifiers.Instance() let s:modemap = g:SyntasticModeMap.Instance() + function! s:CompleteCheckerName(argLead, cmdLine, cursorPos) let checker_names = [] for ft in s:CurrentFiletypes() @@ -276,11 +290,10 @@ function! s:CacheErrors(checkers) if decorate_errors call loclist.decorate(checker.getName(), checker.getFiletype()) endif + call add(names, [checker.getName(), checker.getFiletype()]) let newLoclist = newLoclist.extend(loclist) - call add(names, [checker.getName(), checker.getFiletype()]) - if !aggregate_errors break endif @@ -312,6 +325,11 @@ function! s:CacheErrors(checkers) endif call syntastic#log#debug(g:SyntasticDebugLoclist, "aggregated:", newLoclist) + + if type(g:syntastic_quiet_messages) == type({}) && !empty(g:syntastic_quiet_messages) + call newLoclist.quietMessages(g:syntastic_quiet_messages) + call syntastic#log#debug(g:SyntasticDebugLoclist, "filtered by g:syntastic_quiet_messages:", newLoclist) + endif endif let b:syntastic_loclist = newLoclist @@ -494,18 +512,6 @@ function! SyntasticMake(options) call SyntasticAddToErrors(errors, a:options['defaults']) endif - " Apply ignore patterns - let ignored = {} - let do_ignore = 0 - for buf in syntastic#util#unique(map(copy(errors), 'v:val["bufnr"]')) - let ignored[buf] = s:IgnoreFile(bufname(str2nr(buf))) - let do_ignore = do_ignore || ignored[buf] - endfor - if do_ignore - call filter(errors, '!ignored[v:val["bufnr"]]') - call syntastic#log#debug(g:SyntasticDebugLoclist, "filtered loclist:", errors) - endif - " Add subtype info if present. if has_key(a:options, 'subtype') call SyntasticAddToErrors(errors, {'subtype': a:options['subtype']}) diff --git a/plugin/syntastic/checker.vim b/plugin/syntastic/checker.vim index 994b9af41..8ef7ebe87 100644 --- a/plugin/syntastic/checker.vim +++ b/plugin/syntastic/checker.vim @@ -55,21 +55,23 @@ function! g:SyntasticChecker.getExec() return self._exec endfunction -function! g:SyntasticChecker.getLocList() +function! g:SyntasticChecker.getLocListRaw() + let name = self._filetype . '/' . self._name try let list = self._locListFunc() - call syntastic#log#debug(g:SyntasticDebugTrace, - \ 'getLocList: checker ' . self._filetype . '/' . self._name . ' returned ' . v:shell_error) + call syntastic#log#debug(g:SyntasticDebugTrace, 'getLocList: checker ' . name . ' returned ' . v:shell_error) catch /\m\C^Syntastic: checker error$/ let list = [] - call syntastic#log#error('checker ' . self._filetype . '/' . self._name . ' returned abnormal status ' . v:shell_error) + call syntastic#log#error('checker ' . name . ' returned abnormal status ' . v:shell_error) endtry call self._populateHighlightRegexes(list) - return g:SyntasticLoclist.New(list) + call syntastic#log#debug(g:SyntasticDebugLoclist, name . ' raw:', list) + call self._quietMessages(list) + return list endfunction -function! g:SyntasticChecker.getLocListRaw() - return self._locListFunc() +function! g:SyntasticChecker.getLocList() + return g:SyntasticLoclist.New(self.getLocListRaw()) endfunction function! g:SyntasticChecker.getHighlightRegexFor(error) @@ -86,10 +88,17 @@ endfunction " Private methods {{{1 +function! g:SyntasticChecker._quietMessages(errors) + let filter = 'g:syntastic_' . self._filetype . '_' . self._name . '_quiet_messages' + if exists(filter) && type({filter}) == type({}) && !empty({filter}) + call syntastic#util#dictFilter(a:errors, {filter}) + call syntastic#log#debug(g:SyntasticDebugLoclist, 'filtered by ' . filter . ':', a:errors) + endif +endfunction + function! g:SyntasticChecker._populateHighlightRegexes(errors) - let list = a:errors if !empty(self._highlightRegexFunc) - for e in list + for e in a:errors if e['valid'] let term = self._highlightRegexFunc(e) if len(term) > 0 @@ -98,10 +107,10 @@ function! g:SyntasticChecker._populateHighlightRegexes(errors) endif endfor endif - return list endfunction -" Non-method functions +" Non-method functions {{{1 + function! SyntasticCheckerIsAvailableDefault() dict return executable(self.getExec()) endfunction diff --git a/plugin/syntastic/loclist.vim b/plugin/syntastic/loclist.vim index 5e425789c..f4b664f06 100644 --- a/plugin/syntastic/loclist.vim +++ b/plugin/syntastic/loclist.vim @@ -9,7 +9,6 @@ let g:SyntasticLoclist = {} function! g:SyntasticLoclist.New(rawLoclist) let newObj = copy(self) - let newObj._quietWarnings = g:syntastic_quiet_warnings let llist = filter(copy(a:rawLoclist), 'v:val["valid"] == 1') @@ -45,11 +44,7 @@ function! g:SyntasticLoclist.toRaw() endfunction function! g:SyntasticLoclist.filteredRaw() - return copy(self._quietWarnings ? self.errors() : self._rawLoclist) -endfunction - -function! g:SyntasticLoclist.quietWarnings() - return self._quietWarnings + return self._rawLoclist endfunction function! g:SyntasticLoclist.isEmpty() @@ -78,10 +73,14 @@ function! g:SyntasticLoclist.hasErrorsOrWarningsToDisplay() if self._hasErrorsOrWarningsToDisplay >= 0 return self._hasErrorsOrWarningsToDisplay endif - let self._hasErrorsOrWarningsToDisplay = empty(self._rawLoclist) ? 0 : (!self._quietWarnings || len(self.errors())) + let self._hasErrorsOrWarningsToDisplay = !empty(self._rawLoclist) return self._hasErrorsOrWarningsToDisplay endfunction +function! g:SyntasticLoclist.quietMessages(filters) + call syntastic#util#dictFilter(self._rawLoclist, a:filters) +endfunction + function! g:SyntasticLoclist.errors() if !exists("self._cachedErrors") let self._cachedErrors = self.filter({'type': "E"}) @@ -100,7 +99,7 @@ endfunction function! g:SyntasticLoclist.messages(buf) if !exists("self._cachedMessages") let self._cachedMessages = {} - let errors = self.errors() + (self._quietWarnings ? [] : self.warnings()) + let errors = self.errors() + self.warnings() for e in errors let b = e['bufnr'] diff --git a/plugin/syntastic/signs.vim b/plugin/syntastic/signs.vim index b264e0ac8..68aa5dc9d 100644 --- a/plugin/syntastic/signs.vim +++ b/plugin/syntastic/signs.vim @@ -107,9 +107,7 @@ function! g:SyntasticSignsNotifier._signErrors(loclist) " errors some first, so that they are not masked by warnings let buf = bufnr('') let issues = copy(loclist.errors()) - if !loclist.quietWarnings() - call extend(issues, loclist.warnings()) - endif + call extend(issues, loclist.warnings()) call filter(issues, 'v:val["bufnr"] == buf') let seen = {} From 4b1c3ad1ff71a911b69419db5c769dcfeec190a4 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 3 Jan 2014 19:48:16 +0200 Subject: [PATCH 0334/1271] Optimise loclist.filter(). --- plugin/syntastic/loclist.vim | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/plugin/syntastic/loclist.vim b/plugin/syntastic/loclist.vim index f4b664f06..306ff97e2 100644 --- a/plugin/syntastic/loclist.vim +++ b/plugin/syntastic/loclist.vim @@ -126,22 +126,10 @@ endfunction " "Note that all comparisons are done with ==? function! g:SyntasticLoclist.filter(filters) - let rv = [] - - for error in self._rawLoclist - let passes_filters = 1 - for key in keys(a:filters) - if get(error, key, '') !=? a:filters[key] - let passes_filters = 0 - break - endif - endfor - - if passes_filters - call add(rv, error) - endif - endfor - return rv + let conditions = values(map(copy(a:filters), 's:translate(v:key, v:val)')) + let filter = len(conditions) == 1 ? + \ conditions[0] : join(map(conditions, '"(" . v:val . ")"'), ' && ') + return filter(copy(self._rawLoclist), filter) endfunction function! g:SyntasticLoclist.setloclist() @@ -192,4 +180,10 @@ function! g:SyntasticLoclistHide() silent! lclose endfunction +" Private functions {{{1 + +function! s:translate(key, val) + return 'get(v:val, ' . string(a:key) . ', "") ==? ' . string(a:val) +endfunction + " vim: set sw=4 sts=4 et fdm=marker: From 2f148b0f15b6389d56d46f980ef24e688d98a791 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 3 Jan 2014 21:43:48 +0200 Subject: [PATCH 0335/1271] Optimise postprocessing functions. --- autoload/syntastic/postprocess.vim | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/autoload/syntastic/postprocess.vim b/autoload/syntastic/postprocess.vim index 607dda905..07e19cb34 100644 --- a/autoload/syntastic/postprocess.vim +++ b/autoload/syntastic/postprocess.vim @@ -22,48 +22,38 @@ endfunction " natural sort function! syntastic#postprocess#sort(errors) - return sort(a:errors, 's:compareErrorItems') + return sort(copy(a:errors), 's:compareErrorItems') endfunction +" merge consecutive blanks function! syntastic#postprocess#compressWhitespace(errors) - let llist = [] - for e in a:errors let e['text'] = substitute(e['text'], "\001", '', 'g') let e['text'] = substitute(e['text'], '\n', ' ', 'g') let e['text'] = substitute(e['text'], '\m\s\{2,}', ' ', 'g') - call add(llist, e) endfor - return llist + return a:errors endfunction " remove spurious CR under Cygwin function! syntastic#postprocess#cygwinRemoveCR(errors) if has('win32unix') - let llist = [] - for e in a:errors let e['text'] = substitute(e['text'], '\r', '', 'g') - call add(llist, e) endfor - else - let llist = a:errors endif - return llist + return a:errors endfunction " decode XML entities function! syntastic#postprocess#decodeXMLEntities(errors) - let llist = [] - for e in a:errors let e['text'] = syntastic#util#decodeXMLEntities(e['text']) - call add(llist, e) endfor - return llist + return a:errors endfunction " filter out errors referencing other files @@ -73,4 +63,5 @@ endfunction let &cpo = s:save_cpo unlet s:save_cpo + " vim: set et sts=4 sw=4: From b004225029545972aac0f11e96f3b00da1dc96d2 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Sat, 4 Jan 2014 10:38:17 +0200 Subject: [PATCH 0336/1271] Minor doc update. --- doc/syntastic.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/syntastic.txt b/doc/syntastic.txt index 82934cf72..7a38590c8 100644 --- a/doc/syntastic.txt +++ b/doc/syntastic.txt @@ -192,7 +192,8 @@ the checker that generated it, but you can disable these labels by unsetting You can selectively disable some of the errors found by checkers either using |'syntastic_quiet_messages'|, or by specifying a list of patterns in |'syntastic_ignore_files'|. -'syntastic___quiet_messages' + +See also: |'syntastic___quiet_messages'|. ============================================================================== 3. Commands *syntastic-commands* From fe8cc21a2ae7954108bbbe6a27a0025d3dbca5cc Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Sat, 4 Jan 2014 13:14:14 +0200 Subject: [PATCH 0337/1271] Safer cursor saving / restoring for cgc. --- syntax_checkers/glsl/cgc.vim | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/syntax_checkers/glsl/cgc.vim b/syntax_checkers/glsl/cgc.vim index efbd231fa..d27a00d10 100644 --- a/syntax_checkers/glsl/cgc.vim +++ b/syntax_checkers/glsl/cgc.vim @@ -42,11 +42,20 @@ function! SyntaxCheckers_glsl_cgc_GetLocList() dict endfunction function! s:GetProfile() - let save_cursor = getpos('.') + let save_view = winsaveview() + let old_foldenable = &foldenable + let old_lazyredraw = &lazyredraw + + let &lazyredraw = 1 + let &foldenable = 0 call cursor(1, 1) + let magic = '\m\C^// profile:\s*' let line = search(magic, 'c') - call setpos('.', save_cursor) + + call winrestview(save_view) + let &foldenable = old_foldenable + let &lazyredraw = old_lazyredraw if line let profile = matchstr(getline(line), magic . '\zs.*') From d3afbfe14ff5c3dafcde7c5535c2b4789faa62d3 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Sat, 4 Jan 2014 15:06:41 +0200 Subject: [PATCH 0338/1271] Fix tab handling in status messages. --- autoload/syntastic/util.vim | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/autoload/syntastic/util.vim b/autoload/syntastic/util.vim index 399d422fe..29855330d 100644 --- a/autoload/syntastic/util.vim +++ b/autoload/syntastic/util.vim @@ -110,24 +110,23 @@ function! syntastic#util#wideMsg(msg) let old_ruler = &ruler let old_showcmd = &showcmd - "convert tabs to spaces so that the tabs count towards the window width - "as the proper amount of characters - let msg = substitute(a:msg, "\t", repeat(" ", &tabstop), "g") - let msg = strpart(msg, 0, winwidth(0)-1) + "This is here because it is possible for some error messages to + "begin with \n which will cause a "press enter" prompt. + let msg = substitute(a:msg, "\n", "", "g") - "This is here because it is possible for some error messages to begin with - "\n which will cause a "press enter" prompt. I have noticed this in the - "javascript:jshint checker and have been unable to figure out why it - "happens - let msg = substitute(msg, "\n", "", "g") + "convert tabs to spaces so that the tabs count towards the window + "width as the proper amount of characters + let chunks = split(msg, "\t", 1) + let msg = join(map(chunks[:-2], 'v:val . repeat(" ", &ts - len(v:val) % &ts)'), '') . chunks[-1] + let msg = strpart(msg, 0, winwidth(0) - 1) set noruler noshowcmd call syntastic#util#redraw(0) echo msg - let &ruler=old_ruler - let &showcmd=old_showcmd + let &ruler = old_ruler + let &showcmd = old_showcmd endfunction " Check whether a buffer is loaded, listed, and not hidden From 1baa643c6297528af73bca8c3af202834359f8af Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Sat, 4 Jan 2014 19:26:56 +0200 Subject: [PATCH 0339/1271] Fix column reporting in pyflakes. --- syntax_checkers/python/pyflakes.vim | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/syntax_checkers/python/pyflakes.vim b/syntax_checkers/python/pyflakes.vim index 8112bf3c1..e62965f4b 100644 --- a/syntax_checkers/python/pyflakes.vim +++ b/syntax_checkers/python/pyflakes.vim @@ -45,14 +45,19 @@ function! SyntaxCheckers_python_pyflakes_GetLocList() dict let errorformat = \ '%E%f:%l: could not compile,'. \ '%-Z%p^,'. - \ '%E%f:%l:%c: %m,'. \ '%E%f:%l: %m,'. \ '%-G%.%#' - return SyntasticMake({ + let loclist = SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, \ 'defaults': {'text': "Syntax error"} }) + + for e in loclist + let e['vcol'] = 0 + endfor + + return loclist endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ From 3340c08740f0bab0582cabf5fb0c5f6fad90b51e Mon Sep 17 00:00:00 2001 From: troydm Date: Sat, 4 Jan 2014 22:31:55 +0400 Subject: [PATCH 0340/1271] javac checker config file loading/editing added --- syntax_checkers/java/javac.vim | 115 ++++++++++++++++++++++++--------- 1 file changed, 86 insertions(+), 29 deletions(-) diff --git a/syntax_checkers/java/javac.vim b/syntax_checkers/java/javac.vim index 47d2048c7..74411d735 100644 --- a/syntax_checkers/java/javac.vim +++ b/syntax_checkers/java/javac.vim @@ -7,14 +7,13 @@ " 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. -" +" See http://sam.zoy.org/wtfpl/COPYING for more details. "============================================================================ if exists("g:loaded_syntastic_java_javac_checker") finish endif -let g:loaded_syntastic_java_javac_checker=1 +let g:loaded_syntastic_java_javac_checker = 1 let g:syntastic_java_javac_maven_pom_tags = ["build", "properties"] let g:syntastic_java_javac_maven_pom_properties = {} let s:has_maven = 0 @@ -108,33 +107,53 @@ function! s:AddToClasspath(classpath,path) endif endfunction -function! s:LoadClasspathFromConfigFile() - if filereadable(g:syntastic_java_javac_config_file) - let path = '' - let lines = readfile(g:syntastic_java_javac_config_file) - for l in lines - if l != '' - let path .= l . "\n" - endif - endfor - return path +function! s:SplitClasspath(classpath) + if a:classpath == '' + return [] + endif + if has('win32') || has('win32unix') || has('win64') + return split(a:classpath, ";") else - return '' + return split(a:classpath, ":") + endif +endfunction + +function! s:LoadConfigFile() + if filereadable(g:syntastic_java_javac_config_file) + exe 'source '.g:syntastic_java_javac_config_file endif endfunction function! s:SaveClasspath() + " build classpath from lines let path = '' let lines = getline(1, line('$')) + for l in lines + let path = s:AddToClasspath(path,l) + endfor " save classpath to config file if g:syntastic_java_javac_config_file_enabled + if filereadable(g:syntastic_java_javac_config_file) + " load lines from config file + let lines = readfile(g:syntastic_java_javac_config_file) + " strip g:syntastic_java_javac_classpath options from config file lines + let i = 0 + while i < len(lines) + if match(lines[i], 'g:syntastic_java_javac_classpath') != -1 + call remove(lines,i) + let i -= 1 + endif + let i += 1 + endwhile + else + let lines = [] + endif + " add new g:syntastic_java_javac_classpath option to config + call add(lines,'let g:syntastic_java_javac_classpath = "'.path.'"') + " save config file lines call writefile(lines,g:syntastic_java_javac_config_file) endif - for l in lines - if l != '' - let path .= l . "\n" - endif - endfor + " set new classpath let g:syntastic_java_javac_classpath = path let &modified = 0 endfunction @@ -143,17 +162,56 @@ function! s:EditClasspath() let command = 'syntastic javac classpath' let winnr = bufwinnr('^' . command . '$') if winnr < 0 - let pathlist = split(g:syntastic_java_javac_classpath,"\n") - execute (len(pathlist) + 5) . 'sp ' . fnameescape(command) + let path = [] + let pathlines = split(g:syntastic_java_javac_classpath,"\n") + for p in pathlines + let path += s:SplitClasspath(p) + endfor + execute (len(path) + 5) . 'sp ' . fnameescape(command) augroup syntastic autocmd BufWriteCmd call s:SaveClasspath() | bwipeout augroup END setlocal buftype=acwrite bufhidden=wipe nobuflisted noswapfile nowrap number - for p in pathlist + for p in path call append(line('$') - 1, p) endfor + let &modified = 0 + else + execute winnr . 'wincmd w' + endif +endfunction + +function! s:SaveConfig() + " get lines + let lines = getline(1, line('$')) + if g:syntastic_java_javac_config_file_enabled + " save config file lines + call writefile(lines,g:syntastic_java_javac_config_file) + endif + let &modified = 0 +endfunction + +function! s:EditConfig() + let command = 'syntastic javac config' + let winnr = bufwinnr('^' . command . '$') + if winnr < 0 + let lines = [] + if filereadable(g:syntastic_java_javac_config_file) + let lines = readfile(g:syntastic_java_javac_config_file) + endif + execute (len(lines) + 5) . 'sp ' . fnameescape(command) + + augroup syntastic + autocmd BufWriteCmd call s:SaveConfig() | bwipeout + augroup END + + setlocal ft=vim buftype=acwrite bufhidden=wipe nobuflisted noswapfile nowrap number + for l in lines + call append(line('$') - 1, l) + endfor + let &modified = 0 else execute winnr . 'wincmd w' endif @@ -195,6 +253,10 @@ endfunction command! SyntasticJavacEditClasspath call s:EditClasspath() +if g:syntastic_java_javac_config_file_enabled + command! SyntasticJavacEditConfig call s:EditConfig() +endif + function! s:GetMavenClasspath() let pom = findfile("pom.xml", ".;") if s:has_maven && filereadable(pom) @@ -281,10 +343,7 @@ function! SyntaxCheckers_java_javac_GetLocList() dict " load classpath from config file if g:syntastic_java_javac_config_file_enabled - let loaded_classpath = s:LoadClasspathFromConfigFile() - if loaded_classpath != '' - let g:syntastic_java_javac_classpath = loaded_classpath - endif + call s:LoadConfigFile() endif let javac_classpath = '' @@ -299,9 +358,7 @@ function! SyntaxCheckers_java_javac_GetLocList() dict endtry if type(ps) == type([]) for p in ps - if p != '' - let javac_classpath = s:AddToClasspath(javac_classpath,p) - endif + let javac_classpath = s:AddToClasspath(javac_classpath,p) endfor else let javac_classpath = s:AddToClasspath(javac_classpath,ps) From 1369d1057f2ccefb1f6f54420bfad6c6f1515be3 Mon Sep 17 00:00:00 2001 From: troydm Date: Sat, 4 Jan 2014 23:09:18 +0400 Subject: [PATCH 0341/1271] javac checker custom classpath command added --- syntax_checkers/java/javac.vim | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/syntax_checkers/java/javac.vim b/syntax_checkers/java/javac.vim index 74411d735..b9d8bde81 100644 --- a/syntax_checkers/java/javac.vim +++ b/syntax_checkers/java/javac.vim @@ -68,6 +68,10 @@ if !exists('g:syntastic_java_javac_config_file') let g:syntastic_java_javac_config_file = '.syntastic_javac_config' endif +if !exists('g:syntastic_java_javac_custom_classpath_command') + let g:syntastic_java_javac_custom_classpath_command = '' +endif + if !exists("g:syntastic_java_javac_maven_pom_ftime") let g:syntastic_java_javac_maven_pom_ftime = {} endif @@ -373,6 +377,17 @@ function! SyntaxCheckers_java_javac_GetLocList() dict let javac_classpath = s:AddToClasspath(javac_classpath, s:GetMavenClasspath()) endif + " load custom classpath + if g:syntastic_java_javac_custom_classpath_command != '' + let lines = system(g:syntastic_java_javac_custom_classpath_command) + if has('win32') || has('win32unix') || has('win64') + let lines = substitute(lines,"\r\n","\n") + endif + for l in split(lines, "\n") + let javac_classpath = s:AddToClasspath(javac_classpath, l) + endfor + endif + if javac_classpath != '' let javac_opts .= ' -cp "' . fnameescape(javac_classpath) . '"' endif From 5c41f7361ec07d760337171b0086cef107c1b36c Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Sun, 5 Jan 2014 08:30:25 +0200 Subject: [PATCH 0342/1271] Clarifications to the docs. --- doc/syntastic.txt | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/doc/syntastic.txt b/doc/syntastic.txt index 7a38590c8..999d084ab 100644 --- a/doc/syntastic.txt +++ b/doc/syntastic.txt @@ -32,7 +32,8 @@ CONTENTS *syntastic-contents* 4.Global Options...............................|syntastic-global-options| 5.Checker Options..............................|syntastic-checker-options| 5.1.Choosing which checkers to use.........|syntastic-filetype-checkers| - 5.2.Configuring specific checkers..........|syntastic-config-makeprg| + 5.2.Choosing the executable................|syntastic-config-exec| + 5.3.Configuring specific checkers..........|syntastic-config-makeprg| 6.Notes........................................|syntastic-notes| 6.1.Handling of composite filetypes........|syntastic-composite| 6.2.Interaction with python-mode...........|syntastic-pymode| @@ -508,7 +509,6 @@ You can tell syntastic which checkers to run for a given filetype by setting a variable 'g:syntastic__checkers' to a list of checkers, e.g. > let g:syntastic_python_checkers = ['php', 'phpcs', 'phpmd'] < - *'b:syntastic_checkers'* There is also a per-buffer version of this setting, 'b:syntastic_checkers'. When set, it takes precedence over |'g:syntastic__checkers'|. You can @@ -516,7 +516,6 @@ use this in an autocmd to configure specific checkers for particular paths: > autocmd FileType python if stridx(expand('%:p'), '/some/path/') == 0 | \ let b:syntastic_checkers = ['pylint'] | endif < - If neither |'g:syntastic__checkers'| nor |'b:syntastic_checkers'| is set, a default list of checker is used. Beware however that this list deliberately kept minimal, for performance reasons. @@ -529,11 +528,21 @@ by syntastic: Use |:SyntasticInfo| to see which checkers are available for a given filetype. ------------------------------------------------------------------------------ -5.2 Configuring specific checkers *syntastic-config-makeprg* +5.2 Choosing the executable *syntastic-config-exec* + + *'syntastic___exec'* +The executable used by a checker is normally defined automatically, when the +checkers is registered. You can however override it by setting the variable +'g:syntastic___exec': > + let g:syntastic_ruby_mri_exe = '~/bin/ruby2' +< +------------------------------------------------------------------------------ +5.3 Configuring specific checkers *syntastic-config-makeprg* Most checkers use the 'makeprgBuild()' function and provide many options by default - in fact you can customise every part of the command that gets called. + *'syntastic___
lacks \"summary\" attribute", - \ "not approved by W3C", - \ " proprietary attribute \"placeholder\"", - \ " proprietary attribute \"charset\"", - \ " lacks \"content\" attribute", - \ "inserting \"type\" attribute", - \ "proprietary attribute \"data-", - \ "missing declaration", - \ "inserting implicit ", - \ "inserting missing 'title' element", - \ "unescaped & or unknown entity", - \ " attribute \"type\" has invalid value", - \ "proprietary attribute \"role\"", - \ "proprietary attribute \"aria-activedescendant\"", - \ "proprietary attribute \"aria-atomic\"", - \ "proprietary attribute \"aria-autocomplete\"", - \ "proprietary attribute \"aria-busy\"", - \ "proprietary attribute \"aria-checked\"", - \ "proprietary attribute \"aria-controls\"", - \ "proprietary attribute \"aria-describedby\"", - \ "proprietary attribute \"aria-disabled\"", - \ "proprietary attribute \"aria-dropeffect\"", - \ "proprietary attribute \"aria-expanded\"", - \ "proprietary attribute \"aria-flowto\"", - \ "proprietary attribute \"aria-grabbed\"", - \ "proprietary attribute \"aria-haspopup\"", - \ "proprietary attribute \"aria-hidden\"", - \ "proprietary attribute \"aria-invalid\"", - \ "proprietary attribute \"aria-label\"", - \ "proprietary attribute \"aria-labelledby\"", - \ "proprietary attribute \"aria-level\"", - \ "proprietary attribute \"aria-live\"", - \ "proprietary attribute \"aria-multiline\"", - \ "proprietary attribute \"aria-multiselectable\"", - \ "proprietary attribute \"aria-orientation\"", - \ "proprietary attribute \"aria-owns\"", - \ "proprietary attribute \"aria-posinset\"", - \ "proprietary attribute \"aria-pressed\"", - \ "proprietary attribute \"aria-readonly\"", - \ "proprietary attribute \"aria-relevant\"", - \ "proprietary attribute \"aria-relevant\"", - \ "proprietary attribute \"aria-required\"", - \ "proprietary attribute \"aria-selected\"", - \ "proprietary attribute \"aria-setsize\"", - \ "proprietary attribute \"aria-sort\"", - \ "proprietary attribute \"aria-valuemax\"", - \ "proprietary attribute \"aria-valuemin\"", - \ "proprietary attribute \"aria-valuenow\"", - \ "proprietary attribute \"aria-valuetext\"" - \ ] + \ "
lacks \"summary\" attribute", + \ "not approved by W3C", + \ " proprietary attribute \"placeholder\"", + \ " proprietary attribute \"charset\"", + \ " lacks \"content\" attribute", + \ "inserting \"type\" attribute", + \ "proprietary attribute \"data-", + \ "missing declaration", + \ "inserting implicit ", + \ "inserting missing 'title' element", + \ "unescaped & or unknown entity", + \ " attribute \"type\" has invalid value", + \ "proprietary attribute \"role\"", + \ "proprietary attribute \"aria-activedescendant\"", + \ "proprietary attribute \"aria-atomic\"", + \ "proprietary attribute \"aria-autocomplete\"", + \ "proprietary attribute \"aria-busy\"", + \ "proprietary attribute \"aria-checked\"", + \ "proprietary attribute \"aria-controls\"", + \ "proprietary attribute \"aria-describedby\"", + \ "proprietary attribute \"aria-disabled\"", + \ "proprietary attribute \"aria-dropeffect\"", + \ "proprietary attribute \"aria-expanded\"", + \ "proprietary attribute \"aria-flowto\"", + \ "proprietary attribute \"aria-grabbed\"", + \ "proprietary attribute \"aria-haspopup\"", + \ "proprietary attribute \"aria-hidden\"", + \ "proprietary attribute \"aria-invalid\"", + \ "proprietary attribute \"aria-label\"", + \ "proprietary attribute \"aria-labelledby\"", + \ "proprietary attribute \"aria-level\"", + \ "proprietary attribute \"aria-live\"", + \ "proprietary attribute \"aria-multiline\"", + \ "proprietary attribute \"aria-multiselectable\"", + \ "proprietary attribute \"aria-orientation\"", + \ "proprietary attribute \"aria-owns\"", + \ "proprietary attribute \"aria-posinset\"", + \ "proprietary attribute \"aria-pressed\"", + \ "proprietary attribute \"aria-readonly\"", + \ "proprietary attribute \"aria-relevant\"", + \ "proprietary attribute \"aria-relevant\"", + \ "proprietary attribute \"aria-required\"", + \ "proprietary attribute \"aria-selected\"", + \ "proprietary attribute \"aria-setsize\"", + \ "proprietary attribute \"aria-sort\"", + \ "proprietary attribute \"aria-valuemax\"", + \ "proprietary attribute \"aria-valuemin\"", + \ "proprietary attribute \"aria-valuenow\"", + \ "proprietary attribute \"aria-valuetext\"" + \ ] let s:blocklevel_tags = [ - \ "main", - \ "section", - \ "article", - \ "aside", - \ "header", - \ "footer", - \ "nav", - \ "figure", - \ "figcaption" - \ ] + \ "main", + \ "section", + \ "article", + \ "aside", + \ "header", + \ "footer", + \ "nav", + \ "figure", + \ "figcaption" + \ ] let s:inline_tags = [ - \ "video", - \ "audio", - \ "source", - \ "embed", - \ "mark", - \ "progress", - \ "meter", - \ "time", - \ "ruby", - \ "rt", - \ "rp", - \ "canvas", - \ "command", - \ "details", - \ "datalist" - \ ] + \ "video", + \ "audio", + \ "source", + \ "embed", + \ "mark", + \ "progress", + \ "meter", + \ "time", + \ "ruby", + \ "rt", + \ "rp", + \ "canvas", + \ "command", + \ "details", + \ "datalist" + \ ] let s:empty_tags = [ - \ "wbr", - \ "keygen" - \ ] + \ "wbr", + \ "keygen" + \ ] function! s:IgnoreError(text) for i in s:ignore_errors + g:syntastic_html_tidy_ignore_errors diff --git a/syntax_checkers/xhtml/tidy.vim b/syntax_checkers/xhtml/tidy.vim index 6fa14b323..a3e2d47a4 100644 --- a/syntax_checkers/xhtml/tidy.vim +++ b/syntax_checkers/xhtml/tidy.vim @@ -30,19 +30,19 @@ set cpo&vim " TODO: join this with html.vim DRY's sake? function! s:TidyEncOptByFenc() let tidy_opts = { - \'utf-8': '-utf8', - \'ascii': '-ascii', - \'latin1': '-latin1', - \'iso-2022-jp': '-iso-2022', - \'cp1252': '-win1252', - \'macroman': '-mac', - \'utf-16le': '-utf16le', - \'utf-16': '-utf16', - \'big5': '-big5', - \'cp932': '-shiftjis', - \'sjis': '-shiftjis', - \'cp850': '-ibm858', - \} + \ 'utf-8': '-utf8', + \ 'ascii': '-ascii', + \ 'latin1': '-latin1', + \ 'iso-2022-jp': '-iso-2022', + \ 'cp1252': '-win1252', + \ 'macroman': '-mac', + \ 'utf-16le': '-utf16le', + \ 'utf-16': '-utf16', + \ 'big5': '-big5', + \ 'cp932': '-shiftjis', + \ 'sjis': '-shiftjis', + \ 'cp850': '-ibm858', + \ } return get(tidy_opts, &fileencoding, '-utf8') endfunction From 5b7150af633765ae98224979b73c9cb6eb49d6e5 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Wed, 16 Apr 2014 00:15:46 +0300 Subject: [PATCH 0503/1271] oclint: option "-text" is obsolete. --- plugin/syntastic.vim | 2 +- syntax_checkers/c/oclint.vim | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index cc0800b9f..6599cf73f 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -18,7 +18,7 @@ if has('reltime') let g:syntastic_start = reltime() endif -let g:syntastic_version = '3.4.0-30' +let g:syntastic_version = '3.4.0-31' " Sanity checks {{{1 diff --git a/syntax_checkers/c/oclint.vim b/syntax_checkers/c/oclint.vim index e3dd0ad4b..4f048d28f 100644 --- a/syntax_checkers/c/oclint.vim +++ b/syntax_checkers/c/oclint.vim @@ -30,7 +30,6 @@ set cpo&vim function! SyntaxCheckers_c_oclint_GetLocList() dict let makeprg = self.makeprgBuild({ - \ 'args_after': '-text', \ 'post_args_before': '-- -c ' . syntastic#c#ReadConfig(g:syntastic_oclint_config_file) }) let errorformat = From e1a67b1f39e9f0e272a14ad57bd05a8126f1ceb9 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Wed, 16 Apr 2014 22:16:40 +0300 Subject: [PATCH 0504/1271] Bug fix: error sorting. Error sorting can't be done as a postprocess function called from SyntasticMake(), since the final values of some relevant fields (f.i. type) might not be known yet at that point. Solution: move sorting to getLocListRaw(), after per-checker quiet_messages. New checker methods getWantSort() / setWantSort() are needed. Second problem: some checkers return screen columns mixed with byte indices. Solution: compute screen columns as needed. Sadly, everything about working with screen columns is fragile. --- autoload/syntastic/postprocess.vim | 23 ---------- autoload/syntastic/util.vim | 52 ++++++++++++++++++++++- plugin/syntastic.vim | 2 +- plugin/syntastic/checker.vim | 17 ++++++++ syntax_checkers/c/oclint.vim | 8 +++- syntax_checkers/css/prettycss.vim | 5 ++- syntax_checkers/haskell/scan.vim | 9 ++-- syntax_checkers/javascript/eslint.vim | 5 ++- syntax_checkers/javascript/jscs.vim | 9 +++- syntax_checkers/python/pylama.vim | 5 ++- syntax_checkers/python/pylint.vim | 5 ++- syntax_checkers/r/lint.vim | 3 +- syntax_checkers/racket/code-ayatollah.vim | 5 ++- syntax_checkers/tex/chktex.vim | 9 ++-- syntax_checkers/typescript/tsc.vim | 9 ++-- 15 files changed, 117 insertions(+), 49 deletions(-) diff --git a/autoload/syntastic/postprocess.vim b/autoload/syntastic/postprocess.vim index b8b3d78df..377e64a7b 100644 --- a/autoload/syntastic/postprocess.vim +++ b/autoload/syntastic/postprocess.vim @@ -8,11 +8,6 @@ set cpo&vim " Public functions {{{1 -" natural sort -function! syntastic#postprocess#sort(errors) " {{{2 - return sort(copy(a:errors), 's:compareErrorItems') -endfunction " }}}2 - " merge consecutive blanks function! syntastic#postprocess#compressWhitespace(errors) " {{{2 for e in a:errors @@ -51,24 +46,6 @@ endfunction " }}}2 " }}}1 -" Private functions {{{1 - -function! s:compareErrorItems(a, b) " {{{2 - if a:a['bufnr'] != a:b['bufnr'] - " group by files - return a:a['bufnr'] - a:b['bufnr'] - elseif a:a['lnum'] != a:b['lnum'] - return a:a['lnum'] - a:b['lnum'] - elseif a:a['type'] !=? a:b['type'] - " errors take precedence over warnings - return a:a['type'] ==? 'e' ? -1 : 1 - else - return get(a:a, 'col', 0) - get(a:b, 'col', 0) - endif -endfunction " }}}2 - -" }}}1 - let &cpo = s:save_cpo unlet s:save_cpo diff --git a/autoload/syntastic/util.vim b/autoload/syntastic/util.vim index d1dc26189..d4fa034b6 100644 --- a/autoload/syntastic/util.vim +++ b/autoload/syntastic/util.vim @@ -101,7 +101,7 @@ function! syntastic#util#wideMsg(msg) " {{{2 "convert tabs to spaces so that the tabs count towards the window "width as the proper amount of characters let chunks = split(msg, "\t", 1) - let msg = join(map(chunks[:-2], 'v:val . repeat(" ", &ts - s:width(v:val) % &ts)'), '') . chunks[-1] + let msg = join(map(chunks[:-2], 'v:val . repeat(" ", &tabstop - s:width(v:val) % &tabstop)'), '') . chunks[-1] let msg = strpart(msg, 0, &columns - 1) set noruler noshowcmd @@ -218,6 +218,13 @@ function! syntastic#util#dictFilter(errors, filter) " {{{2 endtry endfunction " }}}2 +function! syntastic#util#sortLoclist(errors) " {{{2 + for e in a:errors + call s:setScreenColumn(e) + endfor + call sort(a:errors, 's:compareErrorItems') +endfunction " }}}2 + " }}}1 " Private functions {{{1 @@ -254,6 +261,49 @@ function! s:translateElement(key, term) " {{{2 return ret endfunction " }}}2 +function! s:screenWidth(str, tabstop) " {{{2 + let chunks = split(a:str, "\t", 1) + let width = s:width(chunks[-1]) + for c in chunks[:-2] + let cwidth = s:width(c) + let width += cwidth + a:tabstop - cwidth % a:tabstop + endfor + return width +endfunction " }}}2 + +function! s:setScreenColumn(item) " {{{2 + if !has_key(a:item, 'scol') + let col = get(a:item, 'col', 0) + if col != 0 && a:item['vcol'] == 0 + let buf = str2nr(a:item['bufnr']) + try + let line = getbufline(buf, a:item['lnum'])[0] + catch /\m^Vim\%((\a\+)\)\=:E684/ + let line = '' + endtry + let a:item['scol'] = s:screenWidth(strpart(line, 0, col), getbufvar(buf, '&tabstop')) + else + let a:item['scol'] = col + endif + endif +endfunction " }}}2 + +function! s:compareErrorItems(a, b) " {{{2 + if a:a['bufnr'] != a:b['bufnr'] + " group by file + return a:a['bufnr'] - a:b['bufnr'] + elseif a:a['lnum'] != a:b['lnum'] + " sort by line + return a:a['lnum'] - a:b['lnum'] + elseif a:a['type'] !=? a:b['type'] + " errors take precedence over warnings + return a:a['type'] ==? 'E' ? -1 : 1 + else + " sort by screen column + return a:a['scol'] - a:b['scol'] + endif +endfunction " }}}2 + " }}}1 let &cpo = s:save_cpo diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 6599cf73f..c706a5437 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -18,7 +18,7 @@ if has('reltime') let g:syntastic_start = reltime() endif -let g:syntastic_version = '3.4.0-31' +let g:syntastic_version = '3.4.0-32' " Sanity checks {{{1 diff --git a/plugin/syntastic/checker.vim b/plugin/syntastic/checker.vim index 504342d40..1a571aa32 100644 --- a/plugin/syntastic/checker.vim +++ b/plugin/syntastic/checker.vim @@ -13,6 +13,7 @@ function! g:SyntasticChecker.New(args) " {{{2 let newObj._filetype = a:args['filetype'] let newObj._name = a:args['name'] let newObj._exec = get(a:args, 'exec', newObj._name) + let newObj._sort = 0 if has_key(a:args, 'redirect') let [filetype, name] = split(a:args['redirect'], '/') @@ -68,6 +69,7 @@ function! g:SyntasticChecker.getLocListRaw() " {{{2 call self._populateHighlightRegexes(list) call syntastic#log#debug(g:SyntasticDebugLoclist, name . ' raw:', list) call self._quietMessages(list) + call self._sortMessages(list) return list endfunction " }}}2 @@ -75,6 +77,14 @@ function! g:SyntasticChecker.getLocList() " {{{2 return g:SyntasticLoclist.New(self.getLocListRaw()) endfunction " }}}2 +function! g:SyntasticChecker.getWantSort() " {{{2 + return self._sort +endfunction " }}}2 + +function! g:SyntasticChecker.setWantSort(val) " {{{2 + let self._sort = a:val +endfunction " }}}2 + function! g:SyntasticChecker.makeprgBuild(opts) " {{{2 let basename = self._filetype . '_' . self._name . '_' @@ -121,6 +131,13 @@ function! g:SyntasticChecker._quietMessages(errors) " {{{2 endif endfunction " }}}2 +function! g:SyntasticChecker._sortMessages(errors) " {{{2 + if self._sort + call syntastic#util#sortLoclist(a:errors) + call syntastic#log#debug(g:SyntasticDebugLoclist, 'sorted:', a:errors) + endif +endfunction " }}}2 + function! g:SyntasticChecker._populateHighlightRegexes(errors) " {{{2 if has_key(self, '_highlightRegexFunc') for e in a:errors diff --git a/syntax_checkers/c/oclint.vim b/syntax_checkers/c/oclint.vim index 4f048d28f..ca717c486 100644 --- a/syntax_checkers/c/oclint.vim +++ b/syntax_checkers/c/oclint.vim @@ -41,12 +41,16 @@ function! SyntaxCheckers_c_oclint_GetLocList() dict \ '%W%f:%l:%c: warning: %m,' . \ '%-G%.%#' - return SyntasticMake({ + let loclist = SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, \ 'subtype': 'Style', - \ 'postprocess': ['compressWhitespace', 'sort'], + \ 'postprocess': ['compressWhitespace'], \ 'returns': [0, 3, 5] }) + + call self.setWantSort(1) + + return loclist endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/syntax_checkers/css/prettycss.vim b/syntax_checkers/css/prettycss.vim index 10d6af3df..06fd7e46f 100644 --- a/syntax_checkers/css/prettycss.vim +++ b/syntax_checkers/css/prettycss.vim @@ -43,13 +43,14 @@ function! SyntaxCheckers_css_prettycss_GetLocList() dict let loclist = SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, - \ 'defaults': {'bufnr': bufnr("")}, - \ 'postprocess': ['sort'] }) + \ 'defaults': {'bufnr': bufnr("")} }) for e in loclist let e["text"] .= ')' endfor + call self.setWantSort(1) + return loclist endfunction diff --git a/syntax_checkers/haskell/scan.vim b/syntax_checkers/haskell/scan.vim index 8b185051d..ed74a0040 100644 --- a/syntax_checkers/haskell/scan.vim +++ b/syntax_checkers/haskell/scan.vim @@ -23,11 +23,14 @@ function! SyntaxCheckers_haskell_scan_GetLocList() dict let errorformat = '%f:%l:%v: %m' - return SyntasticMake({ + let loclist = SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, - \ 'subtype': 'Style', - \ 'postprocess': ['sort'] }) + \ 'subtype': 'Style' }) + + call self.setWantSort(1) + + return loclist endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/syntax_checkers/javascript/eslint.vim b/syntax_checkers/javascript/eslint.vim index 4ca212fa8..ee744acb9 100644 --- a/syntax_checkers/javascript/eslint.vim +++ b/syntax_checkers/javascript/eslint.vim @@ -38,13 +38,14 @@ function! SyntaxCheckers_javascript_eslint_GetLocList() dict let loclist = SyntasticMake({ \ 'makeprg': makeprg, - \ 'errorformat': errorformat, - \ 'postprocess': ['sort'] }) + \ 'errorformat': errorformat }) for e in loclist let e['col'] += 1 endfor + call self.setWantSort(1) + return loclist endfunction diff --git a/syntax_checkers/javascript/jscs.vim b/syntax_checkers/javascript/jscs.vim index c9cb4e950..c50175227 100644 --- a/syntax_checkers/javascript/jscs.vim +++ b/syntax_checkers/javascript/jscs.vim @@ -19,14 +19,19 @@ set cpo&vim function! SyntaxCheckers_javascript_jscs_GetLocList() dict let makeprg = self.makeprgBuild({ 'args_after': '--no-colors --reporter checkstyle' }) + let errorformat = '%f:%t:%l:%c:%m' - return SyntasticMake({ + + let loclist = SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, \ 'subtype': 'Style', \ 'preprocess': 'checkstyle', - \ 'postprocess': ['sort'], \ 'returns': [0, 2] }) + + call self.setWantSort(1) + + return loclist endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/syntax_checkers/python/pylama.vim b/syntax_checkers/python/pylama.vim index 93aa4bad6..25219d770 100644 --- a/syntax_checkers/python/pylama.vim +++ b/syntax_checkers/python/pylama.vim @@ -32,8 +32,7 @@ function! SyntaxCheckers_python_pylama_GetLocList() dict let loclist = SyntasticMake({ \ 'makeprg': makeprg, - \ 'errorformat': errorformat, - \ 'postprocess': ['sort'] }) + \ 'errorformat': errorformat }) " adjust for weirdness in each checker for e in loclist @@ -53,6 +52,8 @@ function! SyntaxCheckers_python_pylama_GetLocList() dict endif endfor + call self.setWantSort(1) + return loclist endfunction diff --git a/syntax_checkers/python/pylint.vim b/syntax_checkers/python/pylint.vim index 181e93300..4c4b88e04 100644 --- a/syntax_checkers/python/pylint.vim +++ b/syntax_checkers/python/pylint.vim @@ -32,10 +32,9 @@ function! SyntaxCheckers_python_pylint_GetLocList() dict \ '%-Z%p^%.%#,' . \ '%-G%.%#' - let loclist=SyntasticMake({ + let loclist = SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, - \ 'postprocess': ['sort'], \ 'returns': range(32) }) for e in loclist @@ -55,6 +54,8 @@ function! SyntaxCheckers_python_pylint_GetLocList() dict let e['vcol'] = 0 endfor + call self.setWantSort(1) + return loclist endfunction diff --git a/syntax_checkers/r/lint.vim b/syntax_checkers/r/lint.vim index 912f0f0c9..b0cae68d4 100644 --- a/syntax_checkers/r/lint.vim +++ b/syntax_checkers/r/lint.vim @@ -52,7 +52,6 @@ function! SyntaxCheckers_r_lint_GetLocList() dict \ 'errorformat': errorformat, \ 'subtype': 'Style', \ 'preprocess': 'rparse', - \ 'postprocess': ['sort'], \ 'returns': [0] }) for e in loclist @@ -63,6 +62,8 @@ function! SyntaxCheckers_r_lint_GetLocList() dict endif endfor + call self.setWantSort(1) + return loclist endfunction diff --git a/syntax_checkers/racket/code-ayatollah.vim b/syntax_checkers/racket/code-ayatollah.vim index f8002a72b..ffb02f7b1 100644 --- a/syntax_checkers/racket/code-ayatollah.vim +++ b/syntax_checkers/racket/code-ayatollah.vim @@ -38,13 +38,14 @@ function! SyntaxCheckers_racket_code_ayatollah_GetLocList() dict let loclist = SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, - \ 'subtype': 'Style', - \ 'postprocess': ['sort'] }) + \ 'subtype': 'Style' }) for e in loclist let e['col'] += 1 endfor + call self.setWantSort(1) + return loclist endfunction diff --git a/syntax_checkers/tex/chktex.vim b/syntax_checkers/tex/chktex.vim index b55eaee84..23392360b 100644 --- a/syntax_checkers/tex/chktex.vim +++ b/syntax_checkers/tex/chktex.vim @@ -45,11 +45,14 @@ function! SyntaxCheckers_tex_chktex_GetLocList() dict \ '%Z%p^,' . \ '%-G%.%#' - return SyntasticMake({ + let loclist = SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, - \ 'subtype': 'Style', - \ 'postprocess': ['sort'] }) + \ 'subtype': 'Style' }) + + call self.setWantSort(1) + + return loclist endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/syntax_checkers/typescript/tsc.vim b/syntax_checkers/typescript/tsc.vim index 7f594e09f..d2e7349d9 100644 --- a/syntax_checkers/typescript/tsc.vim +++ b/syntax_checkers/typescript/tsc.vim @@ -23,11 +23,14 @@ function! SyntaxCheckers_typescript_tsc_GetLocList() dict \ '%Eerror %m,' . \ '%C%\s%\+%m' - return SyntasticMake({ + let loclist = SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, - \ 'defaults': {'bufnr': bufnr("")}, - \ 'postprocess': ['sort'] }) + \ 'defaults': {'bufnr': bufnr("")} }) + + call self.setWantSort(1) + + return loclist endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ From b9358d498613de41d9ce483d38424a23d75764a1 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Thu, 17 Apr 2014 22:09:12 +0300 Subject: [PATCH 0505/1271] New option: syntastic_sort_aggregated_errors. Aggregated error lists are now sorted by default. --- doc/syntastic.txt | 13 +++++++++++++ plugin/syntastic.vim | 8 +++++++- plugin/syntastic/checker.vim | 3 ++- plugin/syntastic/loclist.vim | 4 ++++ 4 files changed, 26 insertions(+), 2 deletions(-) diff --git a/doc/syntastic.txt b/doc/syntastic.txt index 4b1bd6047..fd0fb2b94 100644 --- a/doc/syntastic.txt +++ b/doc/syntastic.txt @@ -190,6 +190,11 @@ by all checkers in a single list, and notifies you. In this mode each error message is labeled with the name of the checker that generated it, but you can disable generation of these labels by turning off '|syntastic_id_checkers|'. +If |'syntastic_sort_aggregated_errors'| is set (which is the default), messages +in the aggregated list are grouped by file, then sorted by line number, then +type, then column number. Otherwise messages produced by the same checker are +grouped together. + ------------------------------------------------------------------------------ 2.6 Filtering errors *syntastic-filtering-errors* @@ -280,6 +285,14 @@ a file with a composite filetype), it might not be immediately obvious which checker has produced a given error message. This variable instructs syntastic to label error messages with the names of the checkers that created them. > let g:syntastic_id_checkers = 0 +< + *'syntastic_sort_aggregated_errors'* +Default: 1 +By default, when |syntastic_aggregate_errors| is enabled, errors are grouped +by file, then sorted by line number, then grouped by type (namely, errors take +precedence over warnings), then they are sorted by column number. If you want +to leave messages grouped by checker output, set this variable to 0. > + let g:syntastic_sort_aggregated_errors = 0 < *'syntastic_echo_current_error'* Default: 1 diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index c706a5437..385a619c8 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -18,7 +18,7 @@ if has('reltime') let g:syntastic_start = reltime() endif -let g:syntastic_version = '3.4.0-32' +let g:syntastic_version = '3.4.0-33' " Sanity checks {{{1 @@ -64,6 +64,7 @@ let g:syntastic_defaults = { \ 'loc_list_height': 10, \ 'quiet_messages': {}, \ 'reuse_loc_lists': (v:version >= 704), + \ 'sort_aggregated_errors': 1, \ 'stl_format': '[Syntax: line:%F (%t)]', \ 'style_error_symbol': 'S>', \ 'style_warning_symbol': 'S>', @@ -297,6 +298,7 @@ function! s:CacheErrors(checker_names) " {{{2 let filetypes = s:resolveFiletypes() let aggregate_errors = syntastic#util#var('aggregate_errors') let decorate_errors = (aggregate_errors || len(filetypes) > 1) && syntastic#util#var('id_checkers') + let sort_aggregated_errors = aggregate_errors && syntastic#util#var('sort_aggregated_errors') let clist = [] for type in filetypes @@ -352,6 +354,10 @@ function! s:CacheErrors(checker_names) " {{{2 " }}}3 call syntastic#log#debug(g:SyntasticDebugLoclist, 'aggregated:', newLoclist) + if sort_aggregated_errors + call newLoclist.sort() + call syntastic#log#debug(g:SyntasticDebugLoclist, 'sorted:', newLoclist) + endif endif let b:syntastic_loclist = newLoclist diff --git a/plugin/syntastic/checker.vim b/plugin/syntastic/checker.vim index 1a571aa32..e93291baf 100644 --- a/plugin/syntastic/checker.vim +++ b/plugin/syntastic/checker.vim @@ -132,7 +132,8 @@ function! g:SyntasticChecker._quietMessages(errors) " {{{2 endfunction " }}}2 function! g:SyntasticChecker._sortMessages(errors) " {{{2 - if self._sort + " don't sort now if we're going to sort the aggregated list later + if self._sort && !(syntastic#util#var('aggregate_errors') && syntastic#util#var('sort_aggregated_errors')) call syntastic#util#sortLoclist(a:errors) call syntastic#log#debug(g:SyntasticDebugLoclist, 'sorted:', a:errors) endif diff --git a/plugin/syntastic/loclist.vim b/plugin/syntastic/loclist.vim index 3d3a649e5..074c4fc60 100644 --- a/plugin/syntastic/loclist.vim +++ b/plugin/syntastic/loclist.vim @@ -37,6 +37,10 @@ function! g:SyntasticLoclist.extend(other) " {{{2 return g:SyntasticLoclist.New(list) endfunction " }}}2 +function! g:SyntasticLoclist.sort() " {{{2 + call syntastic#util#sortLoclist(self._rawLoclist) +endfunction " }}}2 + function! g:SyntasticLoclist.isEmpty() " {{{2 return empty(self._rawLoclist) endfunction " }}}2 From ad7fa6b0cc1f0859245522e3692dc0a0eebd8286 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Thu, 17 Apr 2014 23:08:22 +0300 Subject: [PATCH 0506/1271] HTML Tidy: add a note about HTML Tidy for HTML5. Some people seem to find it easier to look at the sources than read the wiki, so mention HTML Tidy for HTML5 here, too. :) --- plugin/syntastic.vim | 2 +- syntax_checkers/html/tidy.vim | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 385a619c8..39b228053 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -18,7 +18,7 @@ if has('reltime') let g:syntastic_start = reltime() endif -let g:syntastic_version = '3.4.0-33' +let g:syntastic_version = '3.4.0-34' " Sanity checks {{{1 diff --git a/syntax_checkers/html/tidy.vim b/syntax_checkers/html/tidy.vim index ef6276235..67dab6051 100644 --- a/syntax_checkers/html/tidy.vim +++ b/syntax_checkers/html/tidy.vim @@ -10,7 +10,15 @@ " "============================================================================ " -" Checker option: +" Note: if you need to check HTML5 sources, you might consider installing a +" fork of HTML Tidy, named "HTML Tidy for HTML5": +" +" http://w3c.github.io/tidy-html5/ +" +" HTML Tidy for HTML5 can be used without changes by this checker, just install +" it and point g:syntastic_html_tidy_exec to the executable. +" +" Checker options: " " - g:syntastic_html_tidy_ignore_errors (list; default: []) " list of errors to ignore From 4a8b77dbfa9cbe4f0da2f906ba2d776a54381bbc Mon Sep 17 00:00:00 2001 From: Colin Wetherbee Date: Thu, 17 Apr 2014 17:32:24 -0400 Subject: [PATCH 0507/1271] javac: Allow users to specify Maven options --- syntax_checkers/java/javac.vim | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/syntax_checkers/java/javac.vim b/syntax_checkers/java/javac.vim index cf15b4baf..ddb2753cc 100644 --- a/syntax_checkers/java/javac.vim +++ b/syntax_checkers/java/javac.vim @@ -27,6 +27,10 @@ if !exists("g:syntastic_java_maven_executable") let g:syntastic_java_maven_executable = 'mvn' endif +if !exists("g:syntastic_java_maven_options") + let g:syntastic_java_maven_options = '' +endif + if !exists("g:syntastic_java_javac_options") let g:syntastic_java_javac_options = '-Xlint' endif @@ -226,7 +230,7 @@ function! s:GetMavenProperties() let pom = findfile("pom.xml", ".;") if s:has_maven && filereadable(pom) if !has_key(g:syntastic_java_javac_maven_pom_properties, pom) - let mvn_cmd = syntastic#util#shexpand(g:syntastic_java_maven_executable) . ' -f ' . pom + let mvn_cmd = syntastic#util#shexpand(g:syntastic_java_maven_executable) . ' -f ' . pom . ' ' . g:syntastic_java_maven_options let mvn_is_managed_tag = 1 let mvn_settings_output = split(system(mvn_cmd . ' help:effective-pom'), "\n") let current_path = 'project' @@ -265,7 +269,7 @@ function! s:GetMavenClasspath() let pom = findfile("pom.xml", ".;") if s:has_maven && filereadable(pom) if !has_key(g:syntastic_java_javac_maven_pom_ftime, pom) || g:syntastic_java_javac_maven_pom_ftime[pom] != getftime(pom) - let mvn_cmd = syntastic#util#shexpand(g:syntastic_java_maven_executable) . ' -f ' . pom + let mvn_cmd = syntastic#util#shexpand(g:syntastic_java_maven_executable) . ' -f ' . pom . ' ' . g:syntastic_java_maven_options let mvn_classpath_output = split(system(mvn_cmd . ' dependency:build-classpath'), "\n") let mvn_classpath = '' let class_path_next = 0 From d461289260a3e16bed3b4b4a4b94decfed6e526a Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Sat, 19 Apr 2014 09:09:48 +0300 Subject: [PATCH 0508/1271] Cleanup for the new aggregate_errors. --- doc/syntastic.txt | 10 ++++++---- plugin/syntastic.vim | 10 +++++++--- plugin/syntastic/checker.vim | 9 --------- 3 files changed, 13 insertions(+), 16 deletions(-) diff --git a/doc/syntastic.txt b/doc/syntastic.txt index fd0fb2b94..14f188f09 100644 --- a/doc/syntastic.txt +++ b/doc/syntastic.txt @@ -288,10 +288,12 @@ to label error messages with the names of the checkers that created them. > < *'syntastic_sort_aggregated_errors'* Default: 1 -By default, when |syntastic_aggregate_errors| is enabled, errors are grouped -by file, then sorted by line number, then grouped by type (namely, errors take -precedence over warnings), then they are sorted by column number. If you want -to leave messages grouped by checker output, set this variable to 0. > +By default, when results from multiple checkers are aggregated in a single +error list (that is either when |syntastic_aggregate_errors| is enabled, or +when checking a file with a composite filetype), errors are grouped by file, +then sorted by line number, then grouped by type (namely errors take precedence +over warnings), then they are sorted by column number. If you want to leave +messages grouped by checker output, set this variable to 0. > let g:syntastic_sort_aggregated_errors = 0 < *'syntastic_echo_current_error'* diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 39b228053..8053d92eb 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -18,7 +18,7 @@ if has('reltime') let g:syntastic_start = reltime() endif -let g:syntastic_version = '3.4.0-34' +let g:syntastic_version = '3.4.0-35' " Sanity checks {{{1 @@ -296,8 +296,8 @@ function! s:CacheErrors(checker_names) " {{{2 " }}}3 let filetypes = s:resolveFiletypes() - let aggregate_errors = syntastic#util#var('aggregate_errors') - let decorate_errors = (aggregate_errors || len(filetypes) > 1) && syntastic#util#var('id_checkers') + let aggregate_errors = syntastic#util#var('aggregate_errors') || len(filetypes) > 1 + let decorate_errors = aggregate_errors && syntastic#util#var('id_checkers') let sort_aggregated_errors = aggregate_errors && syntastic#util#var('sort_aggregated_errors') let clist = [] @@ -317,6 +317,10 @@ function! s:CacheErrors(checker_names) " {{{2 call loclist.decorate(cname) endif call add(names, cname) + if checker.getWantSort() && !sort_aggregated_errors + call loclist.sort() + call syntastic#log#debug(g:SyntasticDebugLoclist, 'sorted:', loclist) + endif let newLoclist = newLoclist.extend(loclist) diff --git a/plugin/syntastic/checker.vim b/plugin/syntastic/checker.vim index e93291baf..33da5663d 100644 --- a/plugin/syntastic/checker.vim +++ b/plugin/syntastic/checker.vim @@ -69,7 +69,6 @@ function! g:SyntasticChecker.getLocListRaw() " {{{2 call self._populateHighlightRegexes(list) call syntastic#log#debug(g:SyntasticDebugLoclist, name . ' raw:', list) call self._quietMessages(list) - call self._sortMessages(list) return list endfunction " }}}2 @@ -131,14 +130,6 @@ function! g:SyntasticChecker._quietMessages(errors) " {{{2 endif endfunction " }}}2 -function! g:SyntasticChecker._sortMessages(errors) " {{{2 - " don't sort now if we're going to sort the aggregated list later - if self._sort && !(syntastic#util#var('aggregate_errors') && syntastic#util#var('sort_aggregated_errors')) - call syntastic#util#sortLoclist(a:errors) - call syntastic#log#debug(g:SyntasticDebugLoclist, 'sorted:', a:errors) - endif -endfunction " }}}2 - function! g:SyntasticChecker._populateHighlightRegexes(errors) " {{{2 if has_key(self, '_highlightRegexFunc') for e in a:errors From 31cb03fad7ad870fbd9bedec26cdbf204f65d17e Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Sat, 19 Apr 2014 10:03:53 +0300 Subject: [PATCH 0509/1271] Cleanup for java/javac. --- plugin/syntastic.vim | 2 +- syntax_checkers/java/javac.vim | 108 +++++++++++++-------------------- 2 files changed, 44 insertions(+), 66 deletions(-) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 8053d92eb..c3611cc84 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -18,7 +18,7 @@ if has('reltime') let g:syntastic_start = reltime() endif -let g:syntastic_version = '3.4.0-35' +let g:syntastic_version = '3.4.0-36' " Sanity checks {{{1 diff --git a/syntax_checkers/java/javac.vim b/syntax_checkers/java/javac.vim index cf15b4baf..95f145fd1 100644 --- a/syntax_checkers/java/javac.vim +++ b/syntax_checkers/java/javac.vim @@ -10,32 +10,32 @@ " See http://sam.zoy.org/wtfpl/COPYING for more details. "============================================================================ -if exists("g:loaded_syntastic_java_javac_checker") +if exists('g:loaded_syntastic_java_javac_checker') finish endif let g:loaded_syntastic_java_javac_checker = 1 -let g:syntastic_java_javac_maven_pom_tags = ["build", "properties"] +let g:syntastic_java_javac_maven_pom_tags = ['build', 'properties'] let g:syntastic_java_javac_maven_pom_properties = {} let s:has_maven = 0 " Global Options -if !exists("g:syntastic_java_javac_executable") +if !exists('g:syntastic_java_javac_executable') let g:syntastic_java_javac_executable = 'javac' endif -if !exists("g:syntastic_java_maven_executable") +if !exists('g:syntastic_java_maven_executable') let g:syntastic_java_maven_executable = 'mvn' endif -if !exists("g:syntastic_java_javac_options") +if !exists('g:syntastic_java_javac_options') let g:syntastic_java_javac_options = '-Xlint' endif -if !exists("g:syntastic_java_javac_classpath") +if !exists('g:syntastic_java_javac_classpath') let g:syntastic_java_javac_classpath = '' endif -if !exists("g:syntastic_java_javac_delete_output") +if !exists('g:syntastic_java_javac_delete_output') let g:syntastic_java_javac_delete_output = 1 endif @@ -43,20 +43,22 @@ let s:save_cpo = &cpo set cpo&vim function! s:CygwinPath(path) - return substitute(system("cygpath -m " . syntastic#util#shescape(a:path)), '\n', '', 'g') + return substitute(system('cygpath -m ' . syntastic#util#shescape(a:path)), "\n", '', 'g') endfunction -if !exists("g:syntastic_java_javac_temp_dir") +if !exists('g:syntastic_java_javac_temp_dir') if has('win32') || has('win64') - let g:syntastic_java_javac_temp_dir = $TEMP."\\vim-syntastic-javac" + let g:syntastic_java_javac_temp_dir = $TEMP . syntastic#util#Slash() . 'vim-syntastic-javac' elseif has('win32unix') let g:syntastic_java_javac_temp_dir = s:CygwinPath('/tmp/vim-syntastic-javac') + elseif $TMPDIR != '' + let g:syntastic_java_javac_temp_dir = $TMPDIR . '/vim-syntastic-javac' else let g:syntastic_java_javac_temp_dir = '/tmp/vim-syntastic-javac' endif endif -if !exists("g:syntastic_java_javac_autoload_maven_classpath") +if !exists('g:syntastic_java_javac_autoload_maven_classpath') let g:syntastic_java_javac_autoload_maven_classpath = 1 endif @@ -72,16 +74,16 @@ if !exists('g:syntastic_java_javac_custom_classpath_command') let g:syntastic_java_javac_custom_classpath_command = '' endif -if !exists("g:syntastic_java_javac_maven_pom_ftime") +if !exists('g:syntastic_java_javac_maven_pom_ftime') let g:syntastic_java_javac_maven_pom_ftime = {} endif -if !exists("g:syntastic_java_javac_maven_pom_classpath") +if !exists('g:syntastic_java_javac_maven_pom_classpath') let g:syntastic_java_javac_maven_pom_classpath = {} endif function! s:RemoveCarriageReturn(line) - return substitute(a:line, '\r', '', 'g') + return substitute(a:line, "\r", '', 'g') endfunction " recursively remove directory and all it's sub-directories @@ -90,36 +92,25 @@ function! s:RemoveDir(dir) for f in split(globpath(a:dir, '*'), "\n") call s:RemoveDir(f) endfor - silent! call system('rmdir ' . a:dir) + silent! call system('rmdir ' . syntastic#util#shescape(a:dir)) else silent! call delete(a:dir) endif endfunction +function! s:ClassSep() + return (syntastic#util#isRunningWindows() || has('win32unix')) ? ';' : ':' +endfunction + function! s:AddToClasspath(classpath, path) if a:path == '' return a:classpath endif - if a:classpath != '' && a:path != '' - if has('win32') || has('win32unix') || has('win64') - return a:classpath . ";" . a:path - else - return a:classpath . ":" . a:path - endif - else - return a:path - endif + return (a:classpath != '') ? a:classpath . s:ClassSep() . a:path : a:path endfunction function! s:SplitClasspath(classpath) - if a:classpath == '' - return [] - endif - if has('win32') || has('win32unix') || has('win64') - return split(a:classpath, ";") - else - return split(a:classpath, ":") - endif + return split(a:classpath, s:ClassSep()) endfunction function! s:LoadConfigFile() @@ -145,15 +136,15 @@ function! s:SaveClasspath() while i < len(lines) if match(lines[i], 'g:syntastic_java_javac_classpath') != -1 call remove(lines, i) - let i -= 1 + else + let i += 1 endif - let i += 1 endwhile else let lines = [] endif " add new g:syntastic_java_javac_classpath option to config - call add(lines, 'let g:syntastic_java_javac_classpath = "'.path.'"') + call add(lines, 'let g:syntastic_java_javac_classpath = ' . string(path)) " save config file lines call writefile(lines, expand(g:syntastic_java_javac_config_file)) endif @@ -169,7 +160,7 @@ function! s:EditClasspath() let path = [] let pathlines = split(g:syntastic_java_javac_classpath, "\n") for p in pathlines - let path += s:SplitClasspath(p) + call extend(path, s:SplitClasspath(p)) endfor execute (len(path) + 5) . 'sp ' . fnameescape(command) @@ -223,10 +214,10 @@ endfunction function! s:GetMavenProperties() let mvn_properties = {} - let pom = findfile("pom.xml", ".;") + let pom = findfile('pom.xml', '.;') if s:has_maven && filereadable(pom) if !has_key(g:syntastic_java_javac_maven_pom_properties, pom) - let mvn_cmd = syntastic#util#shexpand(g:syntastic_java_maven_executable) . ' -f ' . pom + let mvn_cmd = syntastic#util#shexpand(g:syntastic_java_maven_executable) . ' -f ' . syntastic#util#shescape(pom) let mvn_is_managed_tag = 1 let mvn_settings_output = split(system(mvn_cmd . ' help:effective-pom'), "\n") let current_path = 'project' @@ -239,7 +230,7 @@ function! s:GetMavenProperties() let matches = matchlist(line, '\m^\s*\s*$') if !empty(matches) let mvn_is_managed_tag = index(g:syntastic_java_javac_maven_pom_tags, matches[1]) < 0 - let current_path = substitute(current_path, '\m\.' . matches[1] . "$", '', '') + let current_path = substitute(current_path, '\m\.' . matches[1] . '$', '', '') else let matches = matchlist(line, '\m^\s*<\([a-zA-Z0-9\-\.]\+\)>\(.\+\)\s*$') if mvn_is_managed_tag && !empty(matches) @@ -262,10 +253,10 @@ if g:syntastic_java_javac_config_file_enabled endif function! s:GetMavenClasspath() - let pom = findfile("pom.xml", ".;") + let pom = findfile('pom.xml', '.;') if s:has_maven && filereadable(pom) if !has_key(g:syntastic_java_javac_maven_pom_ftime, pom) || g:syntastic_java_javac_maven_pom_ftime[pom] != getftime(pom) - let mvn_cmd = syntastic#util#shexpand(g:syntastic_java_maven_executable) . ' -f ' . pom + let mvn_cmd = syntastic#util#shexpand(g:syntastic_java_maven_executable) . ' -f ' . syntastic#util#shescape(pom) let mvn_classpath_output = split(system(mvn_cmd . ' dependency:build-classpath'), "\n") let mvn_classpath = '' let class_path_next = 0 @@ -308,20 +299,20 @@ function! SyntaxCheckers_java_javac_IsAvailable() dict endfunction function! s:MavenOutputDirectory() - let pom = findfile("pom.xml", ".;") + let pom = findfile('pom.xml', '.;') if s:has_maven && filereadable(pom) let mvn_properties = s:GetMavenProperties() let output_dir = getcwd() if has_key(mvn_properties, 'project.properties.build.dir') let output_dir = mvn_properties['project.properties.build.dir'] endif - if stridx(expand( '%:p:h' ), "src.main.java") >= 0 + if stridx(expand( '%:p:h' ), 'src.main.java') >= 0 let output_dir .= '/target/classes' if has_key(mvn_properties, 'project.build.outputDirectory') let output_dir = mvn_properties['project.build.outputDirectory'] endif endif - if stridx(expand( '%:p:h' ), "src.test.java") >= 0 + if stridx(expand( '%:p:h' ), 'src.test.java') >= 0 let output_dir .= '/target/test-classes' if has_key(mvn_properties, 'project.build.testOutputDirectory') let output_dir = mvn_properties['project.build.testOutputDirectory'] @@ -337,13 +328,12 @@ function! s:MavenOutputDirectory() endfunction function! SyntaxCheckers_java_javac_GetLocList() dict - let javac_opts = g:syntastic_java_javac_options - let output_dir = "" + let output_dir = '' if g:syntastic_java_javac_delete_output let output_dir = g:syntastic_java_javac_temp_dir - let javac_opts .= ' -d ' . output_dir + let javac_opts .= ' -d ' . syntastic#util#shescape(output_dir) endif " load classpath from config file @@ -354,12 +344,7 @@ function! SyntaxCheckers_java_javac_GetLocList() dict let javac_classpath = '' " add classpathes to javac_classpath - if has('win32') || has('win32unix') || has('win64') - let javac_classpath_split = ';' - else - let javac_classpath_split = ':' - endif - for path in split(g:syntastic_java_javac_classpath, javac_classpath_split) + for path in split(g:syntastic_java_javac_classpath, s:ClassSep()) if path != '' try let ps = glob(path, 0, 1) @@ -378,7 +363,7 @@ function! SyntaxCheckers_java_javac_GetLocList() dict if s:has_maven && g:syntastic_java_javac_autoload_maven_classpath if !g:syntastic_java_javac_delete_output - let javac_opts .= ' -d ' . s:MavenOutputDirectory() + let javac_opts .= ' -d ' . syntastic#util#shescape(s:MavenOutputDirectory()) endif let javac_classpath = s:AddToClasspath(javac_classpath, s:GetMavenClasspath()) endif @@ -386,7 +371,7 @@ function! SyntaxCheckers_java_javac_GetLocList() dict " load custom classpath if g:syntastic_java_javac_custom_classpath_command != '' let lines = system(g:syntastic_java_javac_custom_classpath_command) - if has('win32') || has('win32unix') || has('win64') + if syntastic#util#isRunningWindows() || has('win32unix') let lines = substitute(lines, "\r\n", "\n", 'g') endif for l in split(lines, "\n") @@ -395,17 +380,10 @@ function! SyntaxCheckers_java_javac_GetLocList() dict endif if javac_classpath != '' - let javac_opts .= ' -cp "' . fnameescape(javac_classpath) . '"' - endif - - " path seperator - if has('win32') || has('win32unix') || has('win64') - let sep = "\\" - else - let sep = '/' + let javac_opts .= ' -cp ' . syntastic#util#shexpand(javac_classpath) endif - let fname = fnameescape(expand ( '%:p:h' ) . sep . expand ( '%:t' )) + let fname = expand('%:p:h') . syntastic#util#Slash() . expand ('%:t') if has('win32unix') let fname = s:CygwinPath(fname) @@ -413,7 +391,7 @@ function! SyntaxCheckers_java_javac_GetLocList() dict let makeprg = self.makeprgBuild({ \ 'args': javac_opts, - \ 'fname': fname, + \ 'fname': syntastic#util#shescape(fname), \ 'tail': '2>&1' }) " unashamedly stolen from *errorformat-javac* (quickfix.txt) and modified to include error types From 2d8756b31bd915a40de37adae194ee105b46cf20 Mon Sep 17 00:00:00 2001 From: Seon-Wook Park Date: Sat, 19 Apr 2014 19:22:44 +0200 Subject: [PATCH 0510/1271] tslint: A basic checker configuration --- syntax_checkers/typescript/tslint.vim | 40 +++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 syntax_checkers/typescript/tslint.vim diff --git a/syntax_checkers/typescript/tslint.vim b/syntax_checkers/typescript/tslint.vim new file mode 100644 index 000000000..27c18e8e6 --- /dev/null +++ b/syntax_checkers/typescript/tslint.vim @@ -0,0 +1,40 @@ +"============================================================================ +"File: typescript/tslint.vim +"Description: TypeScript linter +"Maintainer: Seon-Wook Park +"============================================================================ + +if exists("g:loaded_syntastic_typescript_tslint_checker") + finish +endif +let g:loaded_syntastic_typescript_tslint_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim + +function! SyntaxCheckers_typescript_tslint_GetLocList() dict + let makeprg = self.makeprgBuild({ + \ 'args': '--format prose', + \ 'args_after': ' -f' }) + + " Eg. ts/app.ts[12, 36]: comment must start with lowercase letter + let errorformat = '%f[%l\, %c]: %m' + + let loclist = SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'defaults': {'bufnr': bufnr("")} }) + + call self.setWantSort(1) + + return loclist +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'typescript', + \ 'name': 'tslint'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: From 58647c9734b53d3cefbdea68539ee898f24e617d Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Mon, 21 Apr 2014 08:41:44 +0300 Subject: [PATCH 0511/1271] haxe and dartanalyzer: fix syntax highlighting. --- plugin/syntastic.vim | 2 +- syntax_checkers/dart/dartanalyzer.vim | 2 +- syntax_checkers/haxe/haxe.vim | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index c21cbc222..67f46c3b9 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -18,7 +18,7 @@ if has('reltime') let g:syntastic_start = reltime() endif -let g:syntastic_version = '3.4.0-37' +let g:syntastic_version = '3.4.0-39' " Sanity checks {{{1 diff --git a/syntax_checkers/dart/dartanalyzer.vim b/syntax_checkers/dart/dartanalyzer.vim index edf71df3b..9ff55a4ac 100644 --- a/syntax_checkers/dart/dartanalyzer.vim +++ b/syntax_checkers/dart/dartanalyzer.vim @@ -21,7 +21,7 @@ function! SyntaxCheckers_dart_dartanalyzer_GetHighlightRegex(error) if a:error['len'] let lcol = a:error['col'] - 1 let rcol = a:error['col'] + a:error['len'] - let ret = '\%>' . lcol . 'c\%<' . rcol . 'c' + let ret = '\%>' . lcol . 'c.*\%<' . rcol . 'c' else let ret = '' endif diff --git a/syntax_checkers/haxe/haxe.vim b/syntax_checkers/haxe/haxe.vim index 90589420e..fd2385f92 100644 --- a/syntax_checkers/haxe/haxe.vim +++ b/syntax_checkers/haxe/haxe.vim @@ -40,7 +40,7 @@ function! SyntaxCheckers_haxe_haxe_GetLocList() dict \ 'cwd': fnamemodify(hxml, ':h') }) for e in loclist - let e['hl'] = '\%>' . e['col'] . 'c\%<' . (e['nr'] + 1) . 'c' + let e['hl'] = '\%>' . e['col'] . 'c.*\%<' . (e['nr'] + 1) . 'c' let e['col'] += 1 let e['nr'] = 0 endfor From adcc4702565fc4d6453c94a7012146c0158c33f9 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Mon, 21 Apr 2014 13:07:39 +0300 Subject: [PATCH 0512/1271] tslint: cleanup. --- autoload/syntastic/preprocess.vim | 4 ++++ plugin/syntastic.vim | 2 +- syntax_checkers/typescript/tslint.vim | 14 ++++++++++---- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/autoload/syntastic/preprocess.vim b/autoload/syntastic/preprocess.vim index 4501e3ff1..221f93c04 100644 --- a/autoload/syntastic/preprocess.vim +++ b/autoload/syntastic/preprocess.vim @@ -95,6 +95,10 @@ function! syntastic#preprocess#rparse(errors) " {{{2 return out endfunction " }}}2 +function! syntastic#preprocess#tslint(errors) " {{{2 + return map(copy(a:errors), 'substitute(v:val, ''\m^\(([^)]\+)\)\s\(.\+\)$'', ''\2 \1'', "")') +endfunction " }}}2 + function! syntastic#preprocess#validator(errors) " {{{2 let out = [] for e in a:errors diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 67f46c3b9..28112fcf5 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -18,7 +18,7 @@ if has('reltime') let g:syntastic_start = reltime() endif -let g:syntastic_version = '3.4.0-39' +let g:syntastic_version = '3.4.0-42' " Sanity checks {{{1 diff --git a/syntax_checkers/typescript/tslint.vim b/syntax_checkers/typescript/tslint.vim index 27c18e8e6..80ca88178 100644 --- a/syntax_checkers/typescript/tslint.vim +++ b/syntax_checkers/typescript/tslint.vim @@ -12,18 +12,24 @@ let g:loaded_syntastic_typescript_tslint_checker = 1 let s:save_cpo = &cpo set cpo&vim +function! SyntaxCheckers_typescript_tslint_GetHighlightRegex(item) + let term = matchstr(a:item['text'], "\\m\\s'\\zs.\\{-}\\ze'\\s") + return term != '' ? '\V' . escape(term, '\') : '' +endfunction + function! SyntaxCheckers_typescript_tslint_GetLocList() dict let makeprg = self.makeprgBuild({ - \ 'args': '--format prose', - \ 'args_after': ' -f' }) + \ 'args_after': '--format verbose', + \ 'fname_before': '-f' }) - " Eg. ts/app.ts[12, 36]: comment must start with lowercase letter + " (comment-format) ts/app.ts[12, 36]: comment must start with lowercase letter let errorformat = '%f[%l\, %c]: %m' let loclist = SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, - \ 'defaults': {'bufnr': bufnr("")} }) + \ 'preprocess': 'tslint', + \ 'returns': [0, 2] }) call self.setWantSort(1) From 05b4ddddac86b779333bf95b83c39a2982a3137d Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Tue, 22 Apr 2014 21:58:32 +0300 Subject: [PATCH 0513/1271] Cleanup: fix two vimlint warnings. --- plugin/syntastic.vim | 6 +++--- plugin/syntastic/cursor.vim | 4 ++-- plugin/syntastic/loclist.vim | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 28112fcf5..d18a8ff7a 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -18,7 +18,7 @@ if has('reltime') let g:syntastic_start = reltime() endif -let g:syntastic_version = '3.4.0-42' +let g:syntastic_version = '3.4.0-43' " Sanity checks {{{1 @@ -215,7 +215,7 @@ function! s:BufEnterHook() " {{{2 let loclist = filter(getloclist(0), 'v:val["valid"] == 1') let buffers = syntastic#util#unique(map( loclist, 'v:val["bufnr"]' )) if &buftype == 'quickfix' && !empty(loclist) && empty(filter( buffers, 'syntastic#util#bufIsActive(v:val)' )) - call g:SyntasticLoclistHide() + call SyntasticLoclistHide() endif endfunction " }}}2 @@ -223,7 +223,7 @@ function! s:QuitPreHook() " {{{2 call syntastic#log#debug(g:SyntasticDebugAutocommands, \ 'autocmd: QuitPre, buffer ' . bufnr("") . ' = ' . string(bufname(str2nr(bufnr(""))))) let b:syntastic_skip_checks = !g:syntastic_check_on_wq - call g:SyntasticLoclistHide() + call SyntasticLoclistHide() endfunction " }}}2 " }}}1 diff --git a/plugin/syntastic/cursor.vim b/plugin/syntastic/cursor.vim index 714925435..ab66fd01d 100644 --- a/plugin/syntastic/cursor.vim +++ b/plugin/syntastic/cursor.vim @@ -22,7 +22,7 @@ function! g:SyntasticCursorNotifier.refresh(loclist) " {{{2 let b:syntastic_messages = copy(a:loclist.messages(bufnr(''))) let b:oldLine = -1 autocmd! syntastic CursorMoved - autocmd syntastic CursorMoved * call g:SyntasticRefreshCursor() + autocmd syntastic CursorMoved * call SyntasticRefreshCursor() endif endfunction " }}}2 @@ -40,7 +40,7 @@ endfunction " }}}2 " Private methods {{{1 " The following defensive nonsense is needed because of the nature of autocmd -function! g:SyntasticRefreshCursor() " {{{2 +function! SyntasticRefreshCursor() " {{{2 if !exists('b:syntastic_messages') || empty(b:syntastic_messages) " file not checked return diff --git a/plugin/syntastic/loclist.vim b/plugin/syntastic/loclist.vim index 074c4fc60..b677d03a7 100644 --- a/plugin/syntastic/loclist.vim +++ b/plugin/syntastic/loclist.vim @@ -226,7 +226,7 @@ endfunction " }}}2 " Non-method functions {{{1 -function! g:SyntasticLoclistHide() " {{{2 +function! SyntasticLoclistHide() " {{{2 call syntastic#log#debug(g:SyntasticDebugNotifications, 'loclist: hide') silent! lclose endfunction " }}}2 From 56a290a5bb8e70c59ccad8cb84c4428c7ed2a024 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Wed, 23 Apr 2014 14:45:21 +0300 Subject: [PATCH 0514/1271] Cleanup: lock some variables. --- autoload/syntastic/log.vim | 2 ++ autoload/syntastic/util.vim | 1 + plugin/syntastic.vim | 25 +++++++++++++++++++------ plugin/syntastic/highlighting.vim | 2 ++ plugin/syntastic/notifiers.vim | 1 + plugin/syntastic/registry.vim | 2 ++ plugin/syntastic/signs.vim | 3 ++- syntax_checkers/html/tidy.vim | 4 ++++ syntax_checkers/sass/sass.vim | 1 + 9 files changed, 34 insertions(+), 7 deletions(-) diff --git a/autoload/syntastic/log.vim b/autoload/syntastic/log.vim index 05a3d24e4..38aa28744 100644 --- a/autoload/syntastic/log.vim +++ b/autoload/syntastic/log.vim @@ -113,6 +113,7 @@ function! s:isDebugEnabled_dumb(level) " {{{2 endfunction " }}}2 let s:isDebugEnabled = function(exists('*and') ? 's:isDebugEnabled_smart' : 's:isDebugEnabled_dumb') +lockvar s:isDebugEnabled function! s:logRedirect(on) " {{{2 if exists("g:syntastic_debug_file") @@ -138,6 +139,7 @@ function! s:logTimestamp_dumb() " {{{2 endfunction " }}}2 let s:logTimestamp = function(has('reltime') ? 's:logTimestamp_smart' : 's:logTimestamp_dumb') +lockvar s:logTimestamp function! s:formatVariable(name) " {{{2 let vals = [] diff --git a/autoload/syntastic/util.vim b/autoload/syntastic/util.vim index d4fa034b6..b4b900b1a 100644 --- a/autoload/syntastic/util.vim +++ b/autoload/syntastic/util.vim @@ -88,6 +88,7 @@ endfunction " }}}2 " strwidth() was added in Vim 7.3; if it doesn't exist, we use strlen() " and hope for the best :) let s:width = function(exists('*strwidth') ? 'strwidth' : 'strlen') +lockvar s:width "print as much of a:msg as possible without "Press Enter" prompt appearing function! syntastic#util#wideMsg(msg) " {{{2 diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index d18a8ff7a..c57fa686f 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -16,9 +16,11 @@ let g:loaded_syntastic_plugin = 1 if has('reltime') let g:syntastic_start = reltime() + lockvar! g:syntastic_start endif -let g:syntastic_version = '3.4.0-43' +let g:syntastic_version = '3.4.0-44' +lockvar g:syntastic_version " Sanity checks {{{1 @@ -30,6 +32,8 @@ for s:feature in ['autocmd', 'eval', 'modify_fname', 'quickfix', 'user_commands' endfor let s:running_windows = syntastic#util#isRunningWindows() +lockvar s:running_windows + if !s:running_windows && executable('uname') try let s:uname = system('uname') @@ -37,6 +41,7 @@ if !s:running_windows && executable('uname') call syntastic#log#error("your shell " . &shell . " doesn't use traditional UNIX syntax for redirections") finish endtry + lockvar s:uname endif " }}}1 @@ -70,6 +75,7 @@ let g:syntastic_defaults = { \ 'style_warning_symbol': 'S>', \ 'warning_symbol': '>>' \ } +lockvar! g:syntastic_defaults for s:key in keys(g:syntastic_defaults) if !exists('g:syntastic_' . s:key) @@ -106,13 +112,19 @@ let s:debug_dump_options = [ if v:version > 703 || (v:version == 703 && has('patch446')) call add(s:debug_dump_options, 'shellxescape') endif +lockvar! s:debug_dump_options " debug constants -let g:SyntasticDebugTrace = 1 -let g:SyntasticDebugLoclist = 2 -let g:SyntasticDebugNotifications = 4 -let g:SyntasticDebugAutocommands = 8 -let g:SyntasticDebugVariables = 16 +let g:SyntasticDebugTrace = 1 +lockvar g:SyntasticDebugTrace +let g:SyntasticDebugLoclist = 2 +lockvar g:SyntasticDebugLoclist +let g:SyntasticDebugNotifications = 4 +lockvar g:SyntasticDebugNotifications +let g:SyntasticDebugAutocommands = 8 +lockvar g:SyntasticDebugAutocommands +let g:SyntasticDebugVariables = 16 +lockvar g:SyntasticDebugVariables " }}}1 @@ -554,6 +566,7 @@ endfunction " }}}2 function! s:uname() " {{{2 if !exists('s:uname') let s:uname = system('uname') + lockvar s:uname endif return s:uname endfunction " }}}2 diff --git a/plugin/syntastic/highlighting.vim b/plugin/syntastic/highlighting.vim index 997b2e32d..85f3d2284 100644 --- a/plugin/syntastic/highlighting.vim +++ b/plugin/syntastic/highlighting.vim @@ -5,6 +5,7 @@ let g:loaded_syntastic_notifier_highlighting = 1 " Highlighting requires getmatches introduced in 7.1.040 let s:has_highlighting = v:version > 701 || (v:version == 701 && has('patch040')) +lockvar s:has_highlighting let g:SyntasticHighlightingNotifier = {} @@ -18,6 +19,7 @@ function! g:SyntasticHighlightingNotifier.New() " {{{2 if !s:setup_done call self._setup() let s:setup_done = 1 + lockvar s:setup_done endif return newObj diff --git a/plugin/syntastic/notifiers.vim b/plugin/syntastic/notifiers.vim index c268c19b5..62821cde0 100644 --- a/plugin/syntastic/notifiers.vim +++ b/plugin/syntastic/notifiers.vim @@ -6,6 +6,7 @@ let g:loaded_syntastic_notifiers = 1 let g:SyntasticNotifiers = {} let s:notifier_types = ['signs', 'balloons', 'highlighting', 'cursor', 'autoloclist'] +lockvar! s:notifier_types " Public methods {{{1 diff --git a/plugin/syntastic/registry.vim b/plugin/syntastic/registry.vim index 72ba93ad6..7d6274262 100644 --- a/plugin/syntastic/registry.vim +++ b/plugin/syntastic/registry.vim @@ -89,12 +89,14 @@ let s:defaultCheckers = { \ 'zpt': ['zptlint'], \ 'zsh': ['zsh', 'shellcheck'] \ } +lockvar! s:defaultCheckers let s:defaultFiletypeMap = { \ 'gentoo-metadata': 'xml', \ 'lhaskell': 'haskell', \ 'litcoffee': 'coffee' \ } +lockvar! s:defaultFiletypeMap let g:SyntasticRegistry = {} diff --git a/plugin/syntastic/signs.vim b/plugin/syntastic/signs.vim index 9c860da24..7acd78242 100644 --- a/plugin/syntastic/signs.vim +++ b/plugin/syntastic/signs.vim @@ -25,6 +25,7 @@ function! g:SyntasticSignsNotifier.New() " {{{2 if !s:setup_done call self._setup() let s:setup_done = 1 + lockvar s:setup_done endif return newObj @@ -41,7 +42,7 @@ function! g:SyntasticSignsNotifier.refresh(loclist) " {{{2 call self._signErrors(a:loclist) endif call self._removeSigns(old_signs) - let s:first_sign_id = s:next_sign_id + let s:first_sign_id = exists('s:next_sign_id') ? s:next_sign_id : 5000 endfunction " }}}2 " }}}1 diff --git a/syntax_checkers/html/tidy.vim b/syntax_checkers/html/tidy.vim index 67dab6051..c13451c3a 100644 --- a/syntax_checkers/html/tidy.vim +++ b/syntax_checkers/html/tidy.vim @@ -123,6 +123,7 @@ let s:ignore_errors = [ \ "proprietary attribute \"aria-valuenow\"", \ "proprietary attribute \"aria-valuetext\"" \ ] +lockvar! s:ignore_errors let s:blocklevel_tags = [ \ "main", @@ -135,6 +136,7 @@ let s:blocklevel_tags = [ \ "figure", \ "figcaption" \ ] +lockvar! s:blocklevel_tags let s:inline_tags = [ \ "video", @@ -153,11 +155,13 @@ let s:inline_tags = [ \ "details", \ "datalist" \ ] +lockvar! s:inline_tags let s:empty_tags = [ \ "wbr", \ "keygen" \ ] +lockvar! s:empty_tags function! s:IgnoreError(text) for i in s:ignore_errors + g:syntastic_html_tidy_ignore_errors diff --git a/syntax_checkers/sass/sass.vim b/syntax_checkers/sass/sass.vim index 353c1a93c..a515fe5f2 100644 --- a/syntax_checkers/sass/sass.vim +++ b/syntax_checkers/sass/sass.vim @@ -18,6 +18,7 @@ let g:loaded_syntastic_sass_sass_checker = 1 "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 let s:sass_cache_location = tempname() +lockvar s:sass_cache_location "By default do not check partials as unknown variables are a syntax error if !exists("g:syntastic_sass_check_partials") From 7c9025a7f61c8d51d103166a348a45dbe10e410a Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Wed, 23 Apr 2014 21:16:41 +0300 Subject: [PATCH 0515/1271] Python checkers: workaround for GNU readline brain damage. On terms that support smm / rmm (f.i. xterm), initializing readline prints the smm sequence, regardless of whether stdout is a terminal or not, which in turn can make checkers' output unparseable. Workaround: set TERM to dumb before calling the checkers. --- plugin/syntastic.vim | 2 +- syntax_checkers/python/flake8.vim | 3 ++- syntax_checkers/python/frosted.vim | 4 +++- syntax_checkers/python/pep257.vim | 3 ++- syntax_checkers/python/pep8.vim | 3 ++- syntax_checkers/python/py3kwarn.vim | 3 ++- syntax_checkers/python/pyflakes.vim | 3 ++- syntax_checkers/python/pylama.vim | 4 +++- syntax_checkers/python/pylint.vim | 1 + syntax_checkers/python/python.vim | 4 +++- 10 files changed, 21 insertions(+), 9 deletions(-) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index c57fa686f..893972b51 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -19,7 +19,7 @@ if has('reltime') lockvar! g:syntastic_start endif -let g:syntastic_version = '3.4.0-44' +let g:syntastic_version = '3.4.0-45' lockvar g:syntastic_version " Sanity checks {{{1 diff --git a/syntax_checkers/python/flake8.vim b/syntax_checkers/python/flake8.vim index 61d55cc93..ebc484f28 100644 --- a/syntax_checkers/python/flake8.vim +++ b/syntax_checkers/python/flake8.vim @@ -19,7 +19,8 @@ function! SyntaxCheckers_python_flake8_GetHighlightRegex(item) endfunction function! SyntaxCheckers_python_flake8_GetLocList() dict - let makeprg = self.makeprgBuild({}) + let makeprg = self.makeprgBuild({ + \ 'exe_before': (syntastic#util#isRunningWindows() ? '' : 'TERM=dumb') }) let errorformat = \ '%E%f:%l: could not compile,%-Z%p^,' . diff --git a/syntax_checkers/python/frosted.vim b/syntax_checkers/python/frosted.vim index 5c47de5c4..e96a8cc17 100644 --- a/syntax_checkers/python/frosted.vim +++ b/syntax_checkers/python/frosted.vim @@ -19,7 +19,9 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_python_frosted_GetLocList() dict - let makeprg = self.makeprgBuild({ 'args_after': '-vb' }) + let makeprg = self.makeprgBuild({ + \ 'exe_before': (syntastic#util#isRunningWindows() ? '' : 'TERM=dumb'), + \ 'args_after': '-vb' }) let errorformat = \ '%f:%l:%c:%m,' . diff --git a/syntax_checkers/python/pep257.vim b/syntax_checkers/python/pep257.vim index 7bd2d91db..10b47e092 100644 --- a/syntax_checkers/python/pep257.vim +++ b/syntax_checkers/python/pep257.vim @@ -14,7 +14,8 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_python_pep257_GetLocList() dict - let makeprg = self.makeprgBuild({}) + let makeprg = self.makeprgBuild({ + \ 'exe_before': (syntastic#util#isRunningWindows() ? '' : 'TERM=dumb') }) let errorformat = \ '%E%f:%l:%c%\%.%\%.%\d%\+:%\d%\+: %m,' . diff --git a/syntax_checkers/python/pep8.vim b/syntax_checkers/python/pep8.vim index 310746b37..64c9e640f 100644 --- a/syntax_checkers/python/pep8.vim +++ b/syntax_checkers/python/pep8.vim @@ -21,7 +21,8 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_python_pep8_GetLocList() dict - let makeprg = self.makeprgBuild({}) + let makeprg = self.makeprgBuild({ + \ 'exe_before': (syntastic#util#isRunningWindows() ? '' : 'TERM=dumb') }) let errorformat = '%f:%l:%c: %m' diff --git a/syntax_checkers/python/py3kwarn.vim b/syntax_checkers/python/py3kwarn.vim index 5ceb51abe..1a4465e01 100644 --- a/syntax_checkers/python/py3kwarn.vim +++ b/syntax_checkers/python/py3kwarn.vim @@ -14,7 +14,8 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_python_py3kwarn_GetLocList() dict - let makeprg = self.makeprgBuild({}) + let makeprg = self.makeprgBuild({ + \ 'exe_before': (syntastic#util#isRunningWindows() ? '' : 'TERM=dumb') }) let errorformat = '%W%f:%l:%c: %m' diff --git a/syntax_checkers/python/pyflakes.vim b/syntax_checkers/python/pyflakes.vim index 5903b2efa..869aa0abd 100644 --- a/syntax_checkers/python/pyflakes.vim +++ b/syntax_checkers/python/pyflakes.vim @@ -40,7 +40,8 @@ function! SyntaxCheckers_python_pyflakes_GetHighlightRegex(i) endfunction function! SyntaxCheckers_python_pyflakes_GetLocList() dict - let makeprg = self.makeprgBuild({}) + let makeprg = self.makeprgBuild({ + \ 'exe_before': (syntastic#util#isRunningWindows() ? '' : 'TERM=dumb') }) let errorformat = \ '%E%f:%l: could not compile,'. diff --git a/syntax_checkers/python/pylama.vim b/syntax_checkers/python/pylama.vim index 25219d770..b8611814c 100644 --- a/syntax_checkers/python/pylama.vim +++ b/syntax_checkers/python/pylama.vim @@ -23,7 +23,9 @@ function! SyntaxCheckers_python_pylama_GetHighlightRegex(item) endfunction function! SyntaxCheckers_python_pylama_GetLocList() dict - let makeprg = self.makeprgBuild({ 'args_after': '-f pep8' }) + let makeprg = self.makeprgBuild({ + \ 'exe_before': (syntastic#util#isRunningWindows() ? '' : 'TERM=dumb'), + \ 'args_after': '-f pep8' }) " TODO: "WARNING:pylama:..." messages are probably a logging bug let errorformat = diff --git a/syntax_checkers/python/pylint.vim b/syntax_checkers/python/pylint.vim index 4c4b88e04..131ca4820 100644 --- a/syntax_checkers/python/pylint.vim +++ b/syntax_checkers/python/pylint.vim @@ -23,6 +23,7 @@ endfunction function! SyntaxCheckers_python_pylint_GetLocList() dict let makeprg = self.makeprgBuild({ + \ 'exe_before': (syntastic#util#isRunningWindows() ? '' : 'TERM=dumb'), \ 'args_after': (s:pylint_new ? '-f text --msg-template="{path}:{line}:{column}:{C}: [{symbol}] {msg}" -r n' : '-f parseable -r n -i y') }) let errorformat = diff --git a/syntax_checkers/python/python.vim b/syntax_checkers/python/python.vim index eced4d309..e962065dc 100644 --- a/syntax_checkers/python/python.vim +++ b/syntax_checkers/python/python.vim @@ -26,7 +26,9 @@ function! SyntaxCheckers_python_python_IsAvailable() dict endfunction function! SyntaxCheckers_python_python_GetLocList() dict - let makeprg = self.makeprgBuild({ 'exe': [self.getExec(), s:compiler] }) + let makeprg = self.makeprgBuild({ + \ 'exe_before': (syntastic#util#isRunningWindows() ? '' : 'TERM=dumb'), + \ 'exe': [self.getExec(), s:compiler] }) let errorformat = '%E%f:%l:%c: %m' From d6b585bf4990f24582a944429f44b8bc28f7760d Mon Sep 17 00:00:00 2001 From: witchard Date: Wed, 23 Apr 2014 19:37:24 +0100 Subject: [PATCH 0516/1271] Updated argument ordering for ghdl. User specified options for ghdl should sit after the '-s' mode setting. This resolves #1059. --- syntax_checkers/vhdl/ghdl.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntax_checkers/vhdl/ghdl.vim b/syntax_checkers/vhdl/ghdl.vim index f101d37f0..ff02224a2 100644 --- a/syntax_checkers/vhdl/ghdl.vim +++ b/syntax_checkers/vhdl/ghdl.vim @@ -19,7 +19,7 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_vhdl_ghdl_GetLocList() dict - let makeprg = self.makeprgBuild({ 'args_after': '-s' }) + let makeprg = self.makeprgBuild({ 'args_before': '-s' }) let errorformat = '%f:%l:%c: %m' From b0261b4f238040a42b0d7980b949065226bb7e7e Mon Sep 17 00:00:00 2001 From: Paul Harper Date: Fri, 25 Apr 2014 14:50:56 -0700 Subject: [PATCH 0517/1271] Added an errorformat for eslint's warning messages --- syntax_checkers/javascript/eslint.vim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/syntax_checkers/javascript/eslint.vim b/syntax_checkers/javascript/eslint.vim index ee744acb9..0d07b1384 100644 --- a/syntax_checkers/javascript/eslint.vim +++ b/syntax_checkers/javascript/eslint.vim @@ -34,7 +34,8 @@ function! SyntaxCheckers_javascript_eslint_GetLocList() dict \ '--config ' . syntastic#util#shexpand(g:syntastic_javascript_eslint_conf) : '') }) let errorformat = - \ '%E%f: line %l\, col %c\, Error - %m' + \ '%E%f: line %l\, col %c\, Error - %m,' . + \ '%W%f: line %l\, col %c\, Warning - %m' let loclist = SyntasticMake({ \ 'makeprg': makeprg, From 86abd954d6041e96a24bc714b831f78786b34be0 Mon Sep 17 00:00:00 2001 From: Paul Harper Date: Fri, 25 Apr 2014 14:52:54 -0700 Subject: [PATCH 0518/1271] fixup --- syntax_checkers/javascript/eslint.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/syntax_checkers/javascript/eslint.vim b/syntax_checkers/javascript/eslint.vim index 0d07b1384..e6c2c4be6 100644 --- a/syntax_checkers/javascript/eslint.vim +++ b/syntax_checkers/javascript/eslint.vim @@ -34,8 +34,8 @@ function! SyntaxCheckers_javascript_eslint_GetLocList() dict \ '--config ' . syntastic#util#shexpand(g:syntastic_javascript_eslint_conf) : '') }) let errorformat = - \ '%E%f: line %l\, col %c\, Error - %m,' . - \ '%W%f: line %l\, col %c\, Warning - %m' + \ '%E%f: line %l\, col %c\, Error - %m,' . + \ '%W%f: line %l\, col %c\, Warning - %m' let loclist = SyntasticMake({ \ 'makeprg': makeprg, From 179d4e7052ba9060f5a82f2c2bd40c20ecb9fb18 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Sat, 26 Apr 2014 08:09:03 +0300 Subject: [PATCH 0519/1271] README: minor update. The official way to install pathogen has changes slightly. Add a link to the syntax checker guide. --- README.markdown | 9 ++++++--- plugin/syntastic.vim | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/README.markdown b/README.markdown index cdb6f559f..f12d2eda1 100644 --- a/README.markdown +++ b/README.markdown @@ -77,7 +77,7 @@ install syntastic. Do this in your terminal so that you get the `pathogen.vim` file and the directories it needs: ```sh mkdir -p ~/.vim/autoload ~/.vim/bundle; \ -curl -so ~/.vim/autoload/pathogen.vim \ +curl -LSso ~/.vim/autoload/pathogen.vim \ https://raw.github.com/tpope/vim-pathogen/master/autoload/pathogen.vim ``` Next you *need* to add this to your `~/.vimrc`: @@ -272,8 +272,10 @@ cabbrev bd lclose\|bdelete ## 4\. Other resources The preferred place for posting suggestions, reporting bugs, and general -discussions related to syntastic is the [issue tracker at GitHub][4]. There -are also a [google group][5], and a [syntastic tag at StackOverflow][6]. +discussions related to syntastic is the [issue tracker at GitHub][4]. +A guide for writing syntax checkers can be found in the [wiki][11]. +There are also a dedicated [google group][5], and a +[syntastic tag at StackOverflow][6]. Syntastic aims to provide a common interface to syntax checkers for as many languages as possible. For particular languages, there are, of course, other @@ -291,3 +293,4 @@ a look at [jedi-vim][7], [python-mode][8], or [YouCompleteMe][9]. [8]: https://github.com/klen/python-mode [9]: http://valloric.github.io/YouCompleteMe/ [10]: http://perldoc.perl.org/perlrun.html#*-c* +[11]: https://github.com/scrooloose/syntastic/wiki/Syntax-Checker-Guide diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 893972b51..c67910267 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -19,7 +19,7 @@ if has('reltime') lockvar! g:syntastic_start endif -let g:syntastic_version = '3.4.0-45' +let g:syntastic_version = '3.4.0-48' lockvar g:syntastic_version " Sanity checks {{{1 From 3a04a13633f13c4ef3835b5b521c544fd12a9ede Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Sat, 26 Apr 2014 10:05:02 +0300 Subject: [PATCH 0520/1271] GitHub has changed the addresses for user content. --- README.markdown | 2 +- plugin/syntastic.vim | 2 +- syntax_checkers/z80/z80syntaxchecker.vim | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.markdown b/README.markdown index f12d2eda1..1bca60653 100644 --- a/README.markdown +++ b/README.markdown @@ -78,7 +78,7 @@ file and the directories it needs: ```sh mkdir -p ~/.vim/autoload ~/.vim/bundle; \ curl -LSso ~/.vim/autoload/pathogen.vim \ - https://raw.github.com/tpope/vim-pathogen/master/autoload/pathogen.vim + https://raw.githubusercontent.com/tpope/vim-pathogen/master/autoload/pathogen.vim ``` Next you *need* to add this to your `~/.vimrc`: ```vim diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index c67910267..3fcb42b8d 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -19,7 +19,7 @@ if has('reltime') lockvar! g:syntastic_start endif -let g:syntastic_version = '3.4.0-48' +let g:syntastic_version = '3.4.0-52' lockvar g:syntastic_version " Sanity checks {{{1 diff --git a/syntax_checkers/z80/z80syntaxchecker.vim b/syntax_checkers/z80/z80syntaxchecker.vim index bbf3e48d5..6a3998a37 100644 --- a/syntax_checkers/z80/z80syntaxchecker.vim +++ b/syntax_checkers/z80/z80syntaxchecker.vim @@ -14,7 +14,7 @@ " - 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 +" https://raw.githubusercontent.com/rgiot/pycpcdemotools/master/cpcdemotools/source_checker/z80_syntax_checker.py if exists("g:loaded_syntastic_z80_z80syntaxchecker_checker") finish From ee865f82a37e21484650831abe161e9d41c7d78f Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Sun, 27 Apr 2014 20:12:04 +0300 Subject: [PATCH 0521/1271] Manual: add a note about PowerShell. --- doc/syntastic.txt | 22 ++++++++++++++++------ plugin/syntastic.vim | 2 +- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/doc/syntastic.txt b/doc/syntastic.txt index 14f188f09..9305f8d33 100644 --- a/doc/syntastic.txt +++ b/doc/syntastic.txt @@ -38,9 +38,10 @@ CONTENTS *syntastic-contents* 6.1.Handling of composite filetypes........|syntastic-composite| 6.2.Interaction with python-mode...........|syntastic-pymode| 6.3.Interaction with the fish shell........|syntastic-fish| - 6.4.Using syntastic with the fizsh shell...|syntastic-fizsh| - 6.5.Interaction with Eclim.................|syntastic-eclim| - 6.6.Interaction with vim-virtualenv........|syntastic-vim-virtualenv| + 6.4.Interaction with PowerShell............|syntastic-powershell| + 6.5.Using syntastic with the fizsh shell...|syntastic-fizsh| + 6.6.Interaction with Eclim.................|syntastic-eclim| + 6.7.Interaction with vim-virtualenv........|syntastic-vim-virtualenv| 7.About........................................|syntastic-about| 8.License......................................|syntastic-license| @@ -668,7 +669,16 @@ traditional shell, such as 'zsh', 'bash', 'ksh', or even the original Bourne set shell=bash < ------------------------------------------------------------------------------ -6.4. Using syntastic with the fizsh shell *syntastic-fizsh* +6.4. Interaction with PowerShell *syntastic-powershell* + +At the time of this writing, syntastic is not compatible with using 'Windows +PowerShell' (http://technet.microsoft.com/en-us/library/bb978526.aspx) as Vim's +'shell'. You may still run Vim from 'PowerShell', but you do have to point +Vim's 'shell' to a more traditional program, such as 'cmd.exe': > + set shell=cmd.exe +< +------------------------------------------------------------------------------ +6.5. Using syntastic with the fizsh shell *syntastic-fizsh* Using syntastic with the 'fizsh' shell (see https://github.com/zsh-users/fizsh) is possible, but potentially problematic. In order to do it you'll need to set @@ -681,7 +691,7 @@ interactive features of 'fizsh'. Using a more traditional shell such as 'zsh', set shell=zsh < ------------------------------------------------------------------------------ -6.5. Interaction with Eclim *syntastic-eclim* +6.6. Interaction with Eclim *syntastic-eclim* As far as syntastic is concerned there shouldn't be any compatibility problems with the 'Eclim' Vim plugin (see http://eclim.org/). However, at the time of @@ -690,7 +700,7 @@ makes syntastic forget some of its configuration parameters. No solutions or workarounds are known for now. ------------------------------------------------------------------------------ -6.6. Interaction with vim-virtualenv *syntastic-vim-virtualenv* +6.7. Interaction with vim-virtualenv *syntastic-vim-virtualenv* At the time of this writing, syntastic can't run checkers installed in Python virtual environments activated by 'vim-virtualenv' (see diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 3fcb42b8d..ef8b54c62 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -19,7 +19,7 @@ if has('reltime') lockvar! g:syntastic_start endif -let g:syntastic_version = '3.4.0-52' +let g:syntastic_version = '3.4.0-53' lockvar g:syntastic_version " Sanity checks {{{1 From 71e6b47e9c24778183f52e86e2df9b6160585c15 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Tue, 29 Apr 2014 14:31:43 +0300 Subject: [PATCH 0522/1271] Attempt at making multiple buffers work properly. Propagate b:syntastic_loclist to all buffers mentioned in loclists. Try to prevent inadvertent closing of the loclist window if all errors are in included files, by saving the main buffer owner as a variable local to the quicklist buffer. --- plugin/syntastic.vim | 12 +++++++----- plugin/syntastic/loclist.vim | 28 +++++++++++++++++++++++++++- 2 files changed, 34 insertions(+), 6 deletions(-) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index ef8b54c62..fcd9db588 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -19,7 +19,7 @@ if has('reltime') lockvar! g:syntastic_start endif -let g:syntastic_version = '3.4.0-53' +let g:syntastic_version = '3.4.0-54' lockvar g:syntastic_version " Sanity checks {{{1 @@ -224,8 +224,9 @@ function! s:BufEnterHook() " {{{2 \ 'autocmd: BufEnter, buffer ' . bufnr("") . ' = ' . string(bufname(str2nr(bufnr("")))) . \ ', &buftype = ' . string(&buftype)) " TODO: at this point there is no b:syntastic_loclist - let loclist = filter(getloclist(0), 'v:val["valid"] == 1') - let buffers = syntastic#util#unique(map( loclist, 'v:val["bufnr"]' )) + let loclist = filter(copy(getloclist(0)), 'v:val["valid"] == 1') + let owner = str2nr(getbufvar(bufnr(""), 'syntastic_owner_buffer')) + let buffers = syntastic#util#unique(map(loclist, 'v:val["bufnr"]') + (owner ? [owner] : [])) if &buftype == 'quickfix' && !empty(loclist) && empty(filter( buffers, 'syntastic#util#bufIsActive(v:val)' )) call SyntasticLoclistHide() endif @@ -290,7 +291,7 @@ endfunction " }}}2 "clear the loc list for the buffer function! s:ClearCache() " {{{2 call s:notifiers.reset(g:SyntasticLoclist.current()) - unlet! b:syntastic_loclist + call b:syntastic_loclist.destroy() endfunction " }}}2 "detect and cache all syntax errors in this buffer @@ -376,7 +377,8 @@ function! s:CacheErrors(checker_names) " {{{2 endif endif - let b:syntastic_loclist = newLoclist + call newLoclist.setOwner(bufnr('')) + call newLoclist.deploy() endfunction " }}}2 function! s:ToggleMode() " {{{2 diff --git a/plugin/syntastic/loclist.vim b/plugin/syntastic/loclist.vim index b677d03a7..b4471dad9 100644 --- a/plugin/syntastic/loclist.vim +++ b/plugin/syntastic/loclist.vim @@ -20,12 +20,13 @@ function! g:SyntasticLoclist.New(rawLoclist) " {{{2 let newObj._rawLoclist = llist let newObj._name = '' + let newObj._owner = bufnr('') return newObj endfunction " }}}2 function! g:SyntasticLoclist.current() " {{{2 - if !exists("b:syntastic_loclist") + if !exists("b:syntastic_loclist") || empty(b:syntastic_loclist) let b:syntastic_loclist = g:SyntasticLoclist.New([]) endif return b:syntastic_loclist @@ -53,6 +54,10 @@ function! g:SyntasticLoclist.getRaw() " {{{2 return self._rawLoclist endfunction " }}}2 +function! g:SyntasticLoclist.getBuffers() " {{{2 + return syntastic#util#unique(map(copy(self._rawLoclist), 'str2nr(v:val["bufnr"])') + [self._owner]) +endfunction " }}}2 + function! g:SyntasticLoclist.getStatuslineFlag() " {{{2 if !exists("self._stl_format") let self._stl_format = '' @@ -118,6 +123,26 @@ function! g:SyntasticLoclist.setName(name) " {{{2 let self._name = a:name endfunction " }}}2 +function! g:SyntasticLoclist.getOwner() " {{{2 + return self._owner +endfunction " }}}2 + +function! g:SyntasticLoclist.setOwner(buffer) " {{{2 + let self._owner = type(a:buffer) == type(0) ? a:buffer : str2nr(a:buffer) +endfunction " }}}2 + +function! g:SyntasticLoclist.deploy() " {{{2 + for buf in self.getBuffers() + call setbufvar(buf, 'syntastic_loclist', self) + endfor +endfunction " }}}2 + +function! g:SyntasticLoclist.destroy() " {{{2 + for buf in self.getBuffers() + call setbufvar(buf, 'syntastic_loclist', {}) + endfor +endfunction " }}}2 + function! g:SyntasticLoclist.decorate(tag) " {{{2 for e in self._rawLoclist let e['text'] .= ' [' . a:tag . ']' @@ -216,6 +241,7 @@ function! g:SyntasticLoclist.show() " {{{2 if strpart(title, 0, 16) ==# ':SyntasticCheck ' || \ ( (title == '' || title ==# ':setloclist()') && errors == getloclist(0) ) call setwinvar(win, 'quickfix_title', ':SyntasticCheck ' . self._name) + call setbufvar(buf, 'syntastic_owner_buffer', self._owner) endif endif endfor From c02a8553e5656621d70d48ad83a199d8595497f2 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Wed, 30 Apr 2014 10:27:01 +0300 Subject: [PATCH 0523/1271] New checker for less and css: recess (@pixelastic). --- plugin/syntastic.vim | 2 +- syntax_checkers/css/recess.vim | 26 +++++++++++++++++++ syntax_checkers/less/recess.vim | 44 +++++++++++++++++++++++++++++++++ 3 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 syntax_checkers/css/recess.vim create mode 100644 syntax_checkers/less/recess.vim diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index ef8b54c62..b49b3572c 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -19,7 +19,7 @@ if has('reltime') lockvar! g:syntastic_start endif -let g:syntastic_version = '3.4.0-53' +let g:syntastic_version = '3.4.0-54' lockvar g:syntastic_version " Sanity checks {{{1 diff --git a/syntax_checkers/css/recess.vim b/syntax_checkers/css/recess.vim new file mode 100644 index 000000000..6d043e44f --- /dev/null +++ b/syntax_checkers/css/recess.vim @@ -0,0 +1,26 @@ +"============================================================================ +"File: recess.vim +"Description: Syntax checking plugin for syntastic.vim using `recess` +" (http://twitter.github.io/recess/). +"Maintainer: Tim Carry +"License: This program is free software. It comes without any warranty, +" to the extent permitted by applicable law. You can redistribute +" it and/or modify it under the terms of the Do What The Fuck You +" Want To Public License, Version 2, as published by Sam Hocevar. +" See http://sam.zoy.org/wtfpl/COPYING for more details. +" +"============================================================================ + +if exists("g:loaded_syntastic_css_recess_checker") + finish +endif +let g:loaded_syntastic_css_recess_checker = 1 + +runtime! syntax_checkers/less/*.vim + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'css', + \ 'name': 'recess', + \ 'redirect': 'less/recess'}) + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/less/recess.vim b/syntax_checkers/less/recess.vim new file mode 100644 index 000000000..929441890 --- /dev/null +++ b/syntax_checkers/less/recess.vim @@ -0,0 +1,44 @@ +"============================================================================ +"File: recess.vim +"Description: Syntax checking plugin for syntastic.vim using `recess` +" (http://twitter.github.io/recess/). +"Maintainer: Tim Carry +"License: This program is free software. It comes without any warranty, +" to the extent permitted by applicable law. You can redistribute +" it and/or modify it under the terms of the Do What The Fuck You +" Want To Public License, Version 2, as published by Sam Hocevar. +" See http://sam.zoy.org/wtfpl/COPYING for more details. +" +"============================================================================ + +if exists('g:loaded_syntastic_less_recess_checker') + finish +endif +let g:loaded_syntastic_less_recess_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim + +function! SyntaxCheckers_less_recess_GetLocList() dict + let makeprg = self.makeprgBuild({ + \ 'post_args_after': '--format=compact --stripColors' }) + + let errorformat = + \ '%E%m in %f,' . + \ '%Z %#%l.%.%#,' . + \ '%f:%l:%m,' . + \ '%-G%.%#' + + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat }) +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'less', + \ 'name': 'recess'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: From 9e9d378d14d34c1f6523b9ad9395d813520fc39e Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 2 May 2014 21:04:09 +0300 Subject: [PATCH 0524/1271] clisp: fix argument order. --- plugin/syntastic.vim | 2 +- syntax_checkers/lisp/clisp.vim | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index b49b3572c..594877e35 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -19,7 +19,7 @@ if has('reltime') lockvar! g:syntastic_start endif -let g:syntastic_version = '3.4.0-54' +let g:syntastic_version = '3.4.0-55' lockvar g:syntastic_version " Sanity checks {{{1 diff --git a/syntax_checkers/lisp/clisp.vim b/syntax_checkers/lisp/clisp.vim index 2c3876daf..0f1cf761f 100644 --- a/syntax_checkers/lisp/clisp.vim +++ b/syntax_checkers/lisp/clisp.vim @@ -20,7 +20,9 @@ set cpo&vim function! SyntaxCheckers_lisp_clisp_GetLocList() dict let makeprg = self.makeprgBuild({ - \ 'args_after': '-q -c ' . syntastic#c#NullOutput() }) + \ 'args_after': '-q', + \ 'fname_before': '-c', + \ 'fname_after': syntastic#c#NullOutput() }) let errorformat = \ '%-G;%.%#,' . From 7a5bc3c6a612ad66250a70dc23533af0bc5a0bd3 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Sat, 3 May 2014 11:45:02 +0300 Subject: [PATCH 0525/1271] More clisp fixes. Give up trying to persuade clisp not leave behind junk files. Fix errorformat. --- plugin/syntastic.vim | 2 +- syntax_checkers/lisp/clisp.vim | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 594877e35..2dfd2089a 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -19,7 +19,7 @@ if has('reltime') lockvar! g:syntastic_start endif -let g:syntastic_version = '3.4.0-55' +let g:syntastic_version = '3.4.0-56' lockvar g:syntastic_version " Sanity checks {{{1 diff --git a/syntax_checkers/lisp/clisp.vim b/syntax_checkers/lisp/clisp.vim index 0f1cf761f..5e726a921 100644 --- a/syntax_checkers/lisp/clisp.vim +++ b/syntax_checkers/lisp/clisp.vim @@ -21,14 +21,13 @@ set cpo&vim function! SyntaxCheckers_lisp_clisp_GetLocList() dict let makeprg = self.makeprgBuild({ \ 'args_after': '-q', - \ 'fname_before': '-c', - \ 'fname_after': syntastic#c#NullOutput() }) + \ 'fname_before': '-c' }) let errorformat = \ '%-G;%.%#,' . - \ '%W%>WARNING:%.%#line %l : %m,' . + \ '%W%>WARNING:%.%# line %l : %m,' . \ '%Z %#%m,' . - \ '%W%>WARNING:%.%#lines %l..%\d\# : %m,' . + \ '%W%>WARNING:%.%# lines %l%\%.%\%.%\d%\+ : %m,' . \ '%Z %#%m,' . \ '%E%>The following functions were %m,' . \ '%Z %m,' . From 5a0518a43fd8508f73db620dc30721a63e9b09da Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Sun, 4 May 2014 13:58:25 +0300 Subject: [PATCH 0526/1271] Update the contributing guide. Make `:SyntasticInfo` print version. --- CONTRIBUTING.md | 102 +++++++++++++++++++++++----------- plugin/syntastic.vim | 2 +- plugin/syntastic/registry.vim | 3 +- 3 files changed, 74 insertions(+), 33 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2eac83251..2b1d5f025 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,49 +1,89 @@ -# Bug reports / Github issues +# Bug reports / GitHub issues -When reporting a bug make sure you search the existing github issues for the -same/similar issues. If you find one, feel free to add a `+1` comment with any -additional information that may help us solve the issue. +Please note that the preferred channel for posting bug reports is the +[issue tracker at GitHub][0]. Reports posted elsewhere are less likely +to be seen by the core team. + +When reporting a bug make sure you search the existing GitHub issues +for the same/similar issues. If you find one, feel free to add a `+1` +comment with any additional information that may help us solve the +issue. When creating a new issue be sure to state the following: -* Steps to reproduce the bug. -* The version of vim you are using. -* The version of syntastic you are using. +* steps to reproduce the bug; +* the version of Vim you are using (run `:ver` to find out); +* the version of syntastic you are using (see `:SyntasticInfo`). + +For syntax checker bugs also state the version of the checker executable +that you are using. Additional debugging information is typically +useful too: -For syntax checker bugs also state the version of the checker executable that you are using. +* open a file handled by your checker; +* set `g:syntastic_debug` to 1 or 3; +* run the checker; +* look at the output of `:mes`. # Submitting a patch -* Fork the repo on github -* Make a [topic branch](https://github.com/dchelimsky/rspec/wiki/Topic-Branches#using-topic-branches-when-contributing-patches) and start hacking -* Submit a pull request based off your topic branch +Before you consider adding features to syntastic, _please_ spend a few +minutes (re-)reading the latest version of the [manual][1]. Syntastic +is changing rapidly at times, and it's quite possible that some of the +features you want to add exist already. + +To submit a patch: + +* fork the [repo][2] on GitHub; +* make a [topic branch][3] and start hacking; +* submit a pull request based off your topic branch. -Small focused patches are preferred. +Small, focused patches are preferred. -Large changes to the code should be discussed with the core team first. Create an issue and explain your plan and see what we say. +Large changes to the code should be discussed with the core team first. +Create an issue and explain your plan and see what we say. + +Also make sure to update the manual whenever applicable. Nobody can use +features that aren't documented. # General style notes -Following the coding conventions/styles used in the syntastic core: +Follow the coding conventions/styles used in the syntastic core: + +* use 4 space indents; +* don't use abbreviated keywords - e.g. use `endfunction`, not `endfun` +(there's always room for more fun!); +* don't use `l:` prefixes for variables unless actually required (i.e. +almost never); +* code for maintainability; we would rather a function be a couple of +lines longer and have (for example) some [explaining variables][4] to +aid readability. -* Use 4 space indents. -* Don't use abbreviated keywords - e.g. use `endfunction`, not `endfun` (there's always room for more fun!). -* Don't use `l:` prefixes for variables unless actually required (i.e. almost never). -* Code for maintainability. We would rather a function be a couple of lines longer and have (for example) some [explaining variables](http://www.refactoring.com/catalog/extractVariable.html) to aid readability. +# Syntax checker notes -# Syntax checker style notes +Make sure to read the [guide][5] if you plan to add new syntax checkers. -The preferred style for error format strings is one "clause" per line. E.g. -(from the coffeelint checker): +Use the existing checkers as templates, rather than writing everything +from scratch. -```viml -let errorformat = '%E%f:%l:%c: %trror: %m,' . - \ 'Syntax%trror: In %f\, %m on line %l,' . - \ '%EError: In %f\, Parse error on line %l: %m,' . - \ '%EError: In %f\, %m on line %l,' . - \ '%W%f(%l): lint warning: %m,' . - \ '%W%f(%l): warning: %m,' . - \ '%E%f(%l): SyntaxError: %m,' . - \ '%-Z%p^,' . - \ '%-G%.%#' +The preferred style for error format strings is one "clause" per line. +E.g. (from the `coffee` checker): + +```vim +let errorformat = + \ '%E%f:%l:%c: %trror: %m,' . + \ 'Syntax%trror: In %f\, %m on line %l,' . + \ '%EError: In %f\, Parse error on line %l: %m,' . + \ '%EError: In %f\, %m on line %l,' . + \ '%W%f(%l): lint warning: %m,' . + \ '%W%f(%l): warning: %m,' . + \ '%E%f(%l): SyntaxError: %m,' . + \ '%-Z%p^,' . + \ '%-G%.%#' ``` + +[0]: https://github.com/scrooloose/syntastic/issues +[1]: https://github.com/scrooloose/syntastic/blob/master/doc/syntastic.txt +[2]: https://github.com/scrooloose/syntastic +[3]: https://github.com/dchelimsky/rspec/wiki/Topic-Branches#using-topic-branches-when-contributing-patches +[4]: http://www.refactoring.com/catalog/extractVariable.html +[5]: https://github.com/scrooloose/syntastic/wiki/Syntax-Checker-Guide diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 2dfd2089a..cc913b251 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -19,7 +19,7 @@ if has('reltime') lockvar! g:syntastic_start endif -let g:syntastic_version = '3.4.0-56' +let g:syntastic_version = '3.4.0-57' lockvar g:syntastic_version " Sanity checks {{{1 diff --git a/plugin/syntastic/registry.vim b/plugin/syntastic/registry.vim index 7d6274262..db38027be 100644 --- a/plugin/syntastic/registry.vim +++ b/plugin/syntastic/registry.vim @@ -172,7 +172,8 @@ function! g:SyntasticRegistry.getKnownFiletypes() " {{{2 endfunction " }}}2 function! g:SyntasticRegistry.echoInfoFor(ftalias_list) " {{{2 - echomsg "Syntastic info for filetype: " . join(a:ftalias_list, '.') + echomsg "Syntastic version: " . g:syntastic_version + echomsg "Info for filetype: " . join(a:ftalias_list, '.') let ft_list = syntastic#util#unique(map( copy(a:ftalias_list), 's:normaliseFiletype(v:val)' )) if len(ft_list) != 1 From d3f23b3c17540e8ade46b2af78e190a91d4baf89 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Sun, 4 May 2014 14:09:47 +0300 Subject: [PATCH 0527/1271] Contributing guide: add TOC; formatting. --- CONTRIBUTING.md | 30 +++++++++++++++++++++++------- plugin/syntastic.vim | 2 +- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2b1d5f025..378b53b3b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,4 +1,14 @@ -# Bug reports / GitHub issues +# CONTRIBUTING +- - - +1\. [Bug reports / GitHub issues](#bugreps) +2\. [Submitting a patch](#patches) +3\. [General style notes](#generalstyle) +4\. [Syntax checker notes](#checkerstyle) +- - - + + + +## 1. Bug reports / GitHub issues Please note that the preferred channel for posting bug reports is the [issue tracker at GitHub][0]. Reports posted elsewhere are less likely @@ -16,15 +26,17 @@ When creating a new issue be sure to state the following: * the version of syntastic you are using (see `:SyntasticInfo`). For syntax checker bugs also state the version of the checker executable -that you are using. Additional debugging information is typically -useful too: +that you are using. Adding debugging information is typically useful +too: * open a file handled by your checker; * set `g:syntastic_debug` to 1 or 3; * run the checker; -* look at the output of `:mes`. +* copy the output of `:mes`. + + -# Submitting a patch +## 2. Submitting a patch Before you consider adding features to syntastic, _please_ spend a few minutes (re-)reading the latest version of the [manual][1]. Syntastic @@ -45,7 +57,9 @@ Create an issue and explain your plan and see what we say. Also make sure to update the manual whenever applicable. Nobody can use features that aren't documented. -# General style notes + + +## 3. General style notes Follow the coding conventions/styles used in the syntastic core: @@ -58,7 +72,9 @@ almost never); lines longer and have (for example) some [explaining variables][4] to aid readability. -# Syntax checker notes + + +## 4. Syntax checker notes Make sure to read the [guide][5] if you plan to add new syntax checkers. diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index cc913b251..f84747130 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -19,7 +19,7 @@ if has('reltime') lockvar! g:syntastic_start endif -let g:syntastic_version = '3.4.0-57' +let g:syntastic_version = '3.4.0-58' lockvar g:syntastic_version " Sanity checks {{{1 From d02ab2a0557b0f17a0b42b9eb2bfb6c9b21034f7 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Wed, 7 May 2014 20:53:02 +0300 Subject: [PATCH 0528/1271] Some versions of phcs produce an extra column: fix errorformat. --- plugin/syntastic.vim | 2 +- syntax_checkers/php/phpcs.vim | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 1549ac228..1281f00b8 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -19,7 +19,7 @@ if has('reltime') lockvar! g:syntastic_start endif -let g:syntastic_version = '3.4.0-59' +let g:syntastic_version = '3.4.0-61' lockvar g:syntastic_version " Sanity checks {{{1 diff --git a/syntax_checkers/php/phpcs.vim b/syntax_checkers/php/phpcs.vim index 23d539df3..e6600ac6a 100644 --- a/syntax_checkers/php/phpcs.vim +++ b/syntax_checkers/php/phpcs.vim @@ -27,8 +27,8 @@ function! SyntaxCheckers_php_phpcs_GetLocList() dict \ 'args_after': '--report=csv' }) let errorformat = - \ '%-GFile\,Line\,Column\,Type\,Message\,Source\,Severity,'. - \ '"%f"\,%l\,%v\,%t%*[a-zA-Z]\,"%m"\,%*[a-zA-Z0-9_.-]\,%*[0-9]' + \ '%-GFile\,Line\,Column\,Type\,Message\,Source\,Severity%.%#,'. + \ '"%f"\,%l\,%v\,%t%*[a-zA-Z]\,"%m"\,%*[a-zA-Z0-9_.-]\,%*[0-9]%.%#' return SyntasticMake({ \ 'makeprg': makeprg, From 29d4f8a133a0a63d829ffbd7fa129b9138b91db7 Mon Sep 17 00:00:00 2001 From: Lucas Hoffmann Date: Thu, 8 May 2014 09:19:24 +0200 Subject: [PATCH 0529/1271] Fix broken tag in docs. When originally introduced that tag pointed to section 4. --- doc/syntastic.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/syntastic.txt b/doc/syntastic.txt index 9305f8d33..ee0324f8e 100644 --- a/doc/syntastic.txt +++ b/doc/syntastic.txt @@ -94,7 +94,7 @@ Syntax checking can be done automatically or on demand (see |'syntastic_mode_map'| and |:SyntasticToggleMode| for configuring this). When syntax checking is done, the features below can be used to notify the -user of errors. See |syntastic-options| for how to configure and +user of errors. See |syntastic-global-options| for how to configure and activate/deactivate these features. * A statusline flag From 227e40e81503fb3f545a186bbb670c6400b70b49 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 9 May 2014 11:52:14 +0300 Subject: [PATCH 0530/1271] Cleanup for bro. --- README.markdown | 6 +++--- plugin/syntastic.vim | 2 +- syntax_checkers/bro/bro.vim | 14 ++++++++------ 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/README.markdown b/README.markdown index 1bca60653..7fcea14e4 100644 --- a/README.markdown +++ b/README.markdown @@ -35,9 +35,9 @@ the user is notified and is happy because they didn't have to compile their code or execute their script to find them. At the time of this writing, syntax checking plugins exist for ActionScript, -Ada, AppleScript, AsciiDoc, ASM, BEMHTML, Bourne shell, C, C++, C#, Chef, -CoffeeScript, Coco, Coq, CSS, Cucumber, CUDA, D, Dart, DocBook, Dust, Elixir, -Erlang, eRuby, Fortran, Gentoo metadata, GLSL, Go, Haml, Haskell, Haxe, +Ada, AppleScript, AsciiDoc, ASM, BEMHTML, Bro, Bourne shell, C, C++, C#, +Chef, CoffeeScript, Coco, Coq, CSS, Cucumber, CUDA, D, Dart, DocBook, Dust, +Elixir, Erlang, eRuby, Fortran, Gentoo metadata, GLSL, Go, Haml, Haskell, Haxe, Handlebars, HSS, HTML, Java, JavaScript, JSON, JSX, LESS, Lex, Limbo, LISP, LLVM intermediate language, Lua, MATLAB, NASM, Objective-C, Objective-C++, OCaml, Perl, Perl POD, PHP, gettext Portable Object, OS X and iOS property diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 1281f00b8..b0b938f4a 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -19,7 +19,7 @@ if has('reltime') lockvar! g:syntastic_start endif -let g:syntastic_version = '3.4.0-61' +let g:syntastic_version = '3.4.0-67' lockvar g:syntastic_version " Sanity checks {{{1 diff --git a/syntax_checkers/bro/bro.vim b/syntax_checkers/bro/bro.vim index 1f0e4b4a1..5d75c8ad0 100644 --- a/syntax_checkers/bro/bro.vim +++ b/syntax_checkers/bro/bro.vim @@ -19,18 +19,20 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_bro_bro_IsAvailable() dict - return system('bro --help') =~ '--parse-only' + return system(self.getExecEscaped() . ' --help') =~# '--parse-only' endfunction function! SyntaxCheckers_bro_bro_GetLocList() dict - let makeprg = self.makeprgBuild({ 'exe': 'bro', 'args_before': '--parse-only' }) + let makeprg = self.makeprgBuild({ 'args_before': '--parse-only' }) "example: error in ./foo.bro, line 3: unknown identifier banana, at or "near "banana" - let errorformat = '%Eerror in %f\, line %l: %m,' . - \ '%Wwarning in %f\, line %l: %m' + let errorformat = + \ '%trror in %f\, line %l: %m,' . + \ '%tarning in %f\, line %l: %m' - - return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ From 933e865247ce0333bdc14d37199b05e153d78e66 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Sat, 10 May 2014 18:47:50 +0300 Subject: [PATCH 0531/1271] Output of pep257 has changed. Fix errorformat. Make compressWhitespace() postprocess function remove leading and trailing spaces. Typo in the manual. --- autoload/syntastic/postprocess.vim | 2 ++ doc/syntastic.txt | 2 +- syntax_checkers/python/pep257.vim | 31 +++++++++++++++++++++--------- 3 files changed, 25 insertions(+), 10 deletions(-) diff --git a/autoload/syntastic/postprocess.vim b/autoload/syntastic/postprocess.vim index 377e64a7b..65570d982 100644 --- a/autoload/syntastic/postprocess.vim +++ b/autoload/syntastic/postprocess.vim @@ -14,6 +14,8 @@ function! syntastic#postprocess#compressWhitespace(errors) " {{{2 let e['text'] = substitute(e['text'], "\001", '', 'g') let e['text'] = substitute(e['text'], '\n', ' ', 'g') let e['text'] = substitute(e['text'], '\m\s\{2,}', ' ', 'g') + let e['text'] = substitute(e['text'], '\m^\s\+', '', '') + let e['text'] = substitute(e['text'], '\m\s\+$', '', '') endfor return a:errors diff --git a/doc/syntastic.txt b/doc/syntastic.txt index ee0324f8e..7d91187cc 100644 --- a/doc/syntastic.txt +++ b/doc/syntastic.txt @@ -84,7 +84,7 @@ see |syntastic-checker-options| for details. You can also change the arguments passed to a specific checker as well. Use |:SyntasticCheck| to manually check right now. Use |:SyntasticToggleMode| -to switch between active (checking on writting the buffer) and passive (manual) +to switch between active (checking on writing the buffer) and passive (manual) checking. ============================================================================== diff --git a/syntax_checkers/python/pep257.vim b/syntax_checkers/python/pep257.vim index 10b47e092..60cf916ea 100644 --- a/syntax_checkers/python/pep257.vim +++ b/syntax_checkers/python/pep257.vim @@ -5,7 +5,7 @@ " " For details about pep257 see: https://github.com/GreenSteam/pep257 -if exists("g:loaded_syntastic_python_pep257_checker") +if exists('g:loaded_syntastic_python_pep257_checker') finish endif let g:loaded_syntastic_python_pep257_checker = 1 @@ -14,13 +14,24 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_python_pep257_GetLocList() dict + if !exists('s:pep257_new') + let s:pep257_new = syntastic#util#versionIsAtLeast(syntastic#util#getVersion( + \ self.getExecEscaped() . ' --version'), [0, 3]) + endif + let makeprg = self.makeprgBuild({ \ 'exe_before': (syntastic#util#isRunningWindows() ? '' : 'TERM=dumb') }) - let errorformat = - \ '%E%f:%l:%c%\%.%\%.%\d%\+:%\d%\+: %m,' . - \ '%E%f:%l:%c: %m,' . - \ '%+C %m' + if s:pep257_new + let errorformat = + \ '%E%f:%l %.%#:,' . + \ '%+C %m' + else + let errorformat = + \ '%E%f:%l:%c%\%.%\%.%\d%\+:%\d%\+: %m,' . + \ '%E%f:%l:%c: %m,' . + \ '%+C %m' + endif let loclist = SyntasticMake({ \ 'makeprg': makeprg, @@ -29,10 +40,12 @@ function! SyntaxCheckers_python_pep257_GetLocList() dict \ 'preprocess': 'killEmpty', \ 'postprocess': ['compressWhitespace'] }) - " pep257 outputs byte offsets rather than column numbers - for e in loclist - let e['col'] = get(e, 'col', 0) + 1 - endfor + if s:pep257_new == 0 + " byte offsets rather than column numbers + for e in loclist + let e['col'] = get(e, 'col', 0) + 1 + endfor + endif return loclist endfunction From 77f0ab8b5181e91bd75f404679e2328d62c86ffe Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Sat, 10 May 2014 22:29:15 +0300 Subject: [PATCH 0532/1271] eslint: honour the exec parameter. --- plugin/syntastic.vim | 2 +- syntax_checkers/javascript/eslint.vim | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index b0b938f4a..71405d59c 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -19,7 +19,7 @@ if has('reltime') lockvar! g:syntastic_start endif -let g:syntastic_version = '3.4.0-67' +let g:syntastic_version = '3.4.0-68' lockvar g:syntastic_version " Sanity checks {{{1 diff --git a/syntax_checkers/javascript/eslint.vim b/syntax_checkers/javascript/eslint.vim index e6c2c4be6..d416a4dd9 100644 --- a/syntax_checkers/javascript/eslint.vim +++ b/syntax_checkers/javascript/eslint.vim @@ -23,8 +23,8 @@ set cpo&vim function! SyntaxCheckers_javascript_eslint_IsAvailable() dict return - \ executable('eslint') && - \ syntastic#util#versionIsAtLeast(syntastic#util#getVersion('eslint --version'), [0, 1]) + \ executable(self.getExec()) && + \ syntastic#util#versionIsAtLeast(syntastic#util#getVersion(self.getExecEscaped() . ' --version'), [0, 1]) endfunction function! SyntaxCheckers_javascript_eslint_GetLocList() dict From 004b8a912cab854d667aabfe26ed4fc4b04fa2d6 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Sun, 11 May 2014 20:34:32 +0300 Subject: [PATCH 0533/1271] Add separate highlighting groups for style messages (@kovidgoyal). --- doc/syntastic.txt | 2 ++ plugin/syntastic.vim | 2 +- plugin/syntastic/highlighting.vim | 9 +++++++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/doc/syntastic.txt b/doc/syntastic.txt index 7d91187cc..2071be554 100644 --- a/doc/syntastic.txt +++ b/doc/syntastic.txt @@ -170,6 +170,8 @@ and the SpellCap group is used for warnings. If you wish to customize the colors for highlighting you can use the following groups: SyntasticError - Links to 'SpellBad' by default SyntasticWarning - Links to 'SpellCap' by default + SyntasticStyleError - Links to SyntasticError by default + SyntasticStyleWarning - Links to SyntasticWarning by default Example: > highlight SyntasticError guibg=#2f0000 diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 71405d59c..7bfaba53d 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -19,7 +19,7 @@ if has('reltime') lockvar! g:syntastic_start endif -let g:syntastic_version = '3.4.0-68' +let g:syntastic_version = '3.4.0-69' lockvar g:syntastic_version " Sanity checks {{{1 diff --git a/plugin/syntastic/highlighting.vim b/plugin/syntastic/highlighting.vim index 85f3d2284..e3451d824 100644 --- a/plugin/syntastic/highlighting.vim +++ b/plugin/syntastic/highlighting.vim @@ -37,7 +37,7 @@ function! g:SyntasticHighlightingNotifier.refresh(loclist) " {{{2 let buf = bufnr('') let issues = filter(a:loclist.copyRaw(), 'v:val["bufnr"] == buf') for item in issues - let group = item['type'] ==? 'E' ? 'SyntasticError' : 'SyntasticWarning' + let group = 'Syntastic' . get(item, 'subtype', '') . ( item['type'] ==? 'E' ? 'Error' : 'Warning' ) " The function `Syntastic_{filetype}_{checker}_GetHighlightRegex` is " used to override default highlighting. @@ -82,11 +82,16 @@ function! g:SyntasticHighlightingNotifier._setup() " {{{2 if s:has_highlighting if !hlexists('SyntasticError') highlight link SyntasticError SpellBad - endif if !hlexists('SyntasticWarning') highlight link SyntasticWarning SpellCap endif + if !hlexists('SyntasticStyleError') + highlight link SyntasticStyleError SyntasticError + endif + if !hlexists('SyntasticStyleWarning') + highlight link SyntasticStyleWarning SyntasticWarning + endif endif endfunction " }}}2 From 5cec609023dbfac579bbac50f3a69ed95aa252af Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Tue, 27 May 2014 11:40:15 +0300 Subject: [PATCH 0534/1271] Update installation instructions. Update pathogen's address. Change ; to && to stop early in case of error (@koalaman). --- README.markdown | 7 +++---- plugin/syntastic.vim | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/README.markdown b/README.markdown index 7fcea14e4..1c5b574e0 100644 --- a/README.markdown +++ b/README.markdown @@ -76,9 +76,8 @@ First I'll show you how to install Tim Pope's [pathogen][1] so that it's easy to install syntastic. Do this in your terminal so that you get the `pathogen.vim` file and the directories it needs: ```sh -mkdir -p ~/.vim/autoload ~/.vim/bundle; \ -curl -LSso ~/.vim/autoload/pathogen.vim \ - https://raw.githubusercontent.com/tpope/vim-pathogen/master/autoload/pathogen.vim +mkdir -p ~/.vim/autoload ~/.vim/bundle && \ +curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim ``` Next you *need* to add this to your `~/.vimrc`: ```vim @@ -92,7 +91,7 @@ execute pathogen#infect() You now have pathogen installed and can put syntastic into `~/.vim/bundle` like this: ```sh -cd ~/.vim/bundle +cd ~/.vim/bundle && \ git clone https://github.com/scrooloose/syntastic.git ``` Quit vim and start it back up to reload it, then type: diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 7bfaba53d..75922d5ad 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -19,7 +19,7 @@ if has('reltime') lockvar! g:syntastic_start endif -let g:syntastic_version = '3.4.0-69' +let g:syntastic_version = '3.4.0-70' lockvar g:syntastic_version " Sanity checks {{{1 From 7a0d8f4a8e8ef1c2c6a7ba5ce77d4785b6a05449 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Wed, 28 May 2014 10:08:48 +0300 Subject: [PATCH 0535/1271] Vim no longer allows setting signs on line 0. --- plugin/syntastic.vim | 2 +- plugin/syntastic/signs.vim | 22 ++++++++++++---------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 75922d5ad..54912a707 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -19,7 +19,7 @@ if has('reltime') lockvar! g:syntastic_start endif -let g:syntastic_version = '3.4.0-70' +let g:syntastic_version = '3.4.0-71' lockvar g:syntastic_version " Sanity checks {{{1 diff --git a/plugin/syntastic/signs.vim b/plugin/syntastic/signs.vim index 7acd78242..7f713c69b 100644 --- a/plugin/syntastic/signs.vim +++ b/plugin/syntastic/signs.vim @@ -99,13 +99,15 @@ function! g:SyntasticSignsNotifier._signErrors(loclist) " {{{2 if !has_key(seen, i['lnum']) let seen[i['lnum']] = 1 - let sign_severity = i['type'] ==? 'W' ? 'Warning' : 'Error' - let sign_subtype = get(i, 'subtype', '') - let sign_type = 'Syntastic' . sign_subtype . sign_severity - - execute "sign place " . s:next_sign_id . " line=" . i['lnum'] . " name=" . sign_type . " buffer=" . i['bufnr'] - call add(self._bufSignIds(), s:next_sign_id) - let s:next_sign_id += 1 + if i['lnum'] > 0 + let sign_severity = i['type'] ==? 'W' ? 'Warning' : 'Error' + let sign_subtype = get(i, 'subtype', '') + let sign_type = 'Syntastic' . sign_subtype . sign_severity + + execute "sign place " . s:next_sign_id . " line=" . i['lnum'] . " name=" . sign_type . " buffer=" . i['bufnr'] + call add(self._bufSignIds(), s:next_sign_id) + let s:next_sign_id += 1 + endif endif endfor endif @@ -114,9 +116,9 @@ endfunction " }}}2 " Remove the signs with the given ids from this buffer function! g:SyntasticSignsNotifier._removeSigns(ids) " {{{2 if has('signs') - for i in a:ids - execute "sign unplace " . i - call remove(self._bufSignIds(), index(self._bufSignIds(), i)) + for s in reverse(copy(a:ids)) + execute "sign unplace " . s + call remove(self._bufSignIds(), index(self._bufSignIds(), s)) endfor endif endfunction " }}}2 From 5da4dc4774c039ab5fa53bdeb814a42e14a38e6e Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Thu, 29 May 2014 12:09:17 +0300 Subject: [PATCH 0536/1271] coffeelint: option `--csv` is deprecated (@greenify). --- plugin/syntastic.vim | 2 +- syntax_checkers/coffee/coffeelint.vim | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 54912a707..3827a195d 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -19,7 +19,7 @@ if has('reltime') lockvar! g:syntastic_start endif -let g:syntastic_version = '3.4.0-71' +let g:syntastic_version = '3.4.0-72' lockvar g:syntastic_version " Sanity checks {{{1 diff --git a/syntax_checkers/coffee/coffeelint.vim b/syntax_checkers/coffee/coffeelint.vim index ccc6349a3..99f2fad83 100644 --- a/syntax_checkers/coffee/coffeelint.vim +++ b/syntax_checkers/coffee/coffeelint.vim @@ -19,7 +19,11 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_coffee_coffeelint_GetLocList() dict - let makeprg = self.makeprgBuild({ 'args_after': '--csv' }) + if !exists('s:coffeelint_new') + let s:coffeelint_new = syntastic#util#versionIsAtLeast(syntastic#util#getVersion( + \ self.getExecEscaped() . ' --version'), [1, 4]) + endif + let makeprg = self.makeprgBuild({ 'args_after': (s:coffeelint_new ? '--reporter csv' : '--csv') }) let errorformat = \ '%f\,%l\,%\d%#\,%trror\,%m,' . From fe6f213a6a341e6bd9f8e33f0347c394f415d296 Mon Sep 17 00:00:00 2001 From: "Ian D. Bollinger" Date: Sat, 31 May 2014 01:23:50 -0400 Subject: [PATCH 0537/1271] Add syntax checker for Haskell .cabal files The syntax checker uses the `cabal check` command to check Haskell Cabal package descriptions for syntax errors and other potential problems. Currently, the `cabal check` command does not take a file argument, so the current working directory must be changed to that of the package description's before `cabal` can be executed. Additionally, `cabal check` only issues line numbers for parse errors, so warnings are arbitrarily assigned to line 1. --- syntax_checkers/cabal/check.vim | 52 +++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 syntax_checkers/cabal/check.vim diff --git a/syntax_checkers/cabal/check.vim b/syntax_checkers/cabal/check.vim new file mode 100644 index 000000000..6f7fa5e56 --- /dev/null +++ b/syntax_checkers/cabal/check.vim @@ -0,0 +1,52 @@ +"============================================================================ +"File: check.vim +"Description: Haskell package description (.cabal file) linting and syntax +" validation via 'cabal check' +"Maintainer: Ian D. Bollinger +"License: This program is free software. It comes without any warranty, +" to the extent permitted by applicable law. You can redistribute +" it and/or modify it under the terms of the Do What The Fuck You +" Want To Public License, Version 2, as published by Sam Hocevar. +" See http://sam.zoy.org/wtfpl/COPYING for more details. +"============================================================================ + +if exists('g:loaded_syntastic_cabal_check_checker') + finish +endif +let g:loaded_syntastic_cabal_check_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim + +function! SyntaxCheckers_cabal_check_GetHighlightRegex(item) + let field = matchstr(a:item['text'], "\\vParse of field '\\zs[^']+") + if field != '' + return '\v\c^\s*' . field . '\s*:\s*\zs.*$' + endif + return '' +endfunction + +function! SyntaxCheckers_cabal_check_GetLocList() dict + let makeprg = self.makeprgBuild({'exe_after': 'check', 'fname': ''}) + let errorformat = + \ '%Ecabal: %f:%l: %m,' . + \ '%W* %m,' + let old_pwd = getcwd() + execute 'cd ' . syntastic#util#shexpand('%:h') + let loclist = SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'defaults': {'bufnr': bufnr('%'), 'lnum': 1}}) + execute 'cd ' . old_pwd + return loclist +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'cabal', + \ 'name': 'check', + \ 'exec': 'cabal'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: From 3ab1f53c7d00fa2ffe2acdac8f4be5fd3ba71daf Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Sat, 31 May 2014 11:19:33 +0300 Subject: [PATCH 0538/1271] Rename cabal/check --> cabal/cabal. --- plugin/syntastic.vim | 2 +- syntax_checkers/cabal/{check.vim => cabal.vim} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename syntax_checkers/cabal/{check.vim => cabal.vim} (100%) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 3827a195d..69b7034c2 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -19,7 +19,7 @@ if has('reltime') lockvar! g:syntastic_start endif -let g:syntastic_version = '3.4.0-72' +let g:syntastic_version = '3.4.0-74' lockvar g:syntastic_version " Sanity checks {{{1 diff --git a/syntax_checkers/cabal/check.vim b/syntax_checkers/cabal/cabal.vim similarity index 100% rename from syntax_checkers/cabal/check.vim rename to syntax_checkers/cabal/cabal.vim From f04c677d417bd0f681e1767480cb6b3d288e7c57 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Sat, 31 May 2014 11:52:52 +0300 Subject: [PATCH 0539/1271] Cabal checker: cleanup. --- README.markdown | 2 +- autoload/syntastic/preprocess.vim | 20 +++++++++++++++++++ plugin/syntastic.vim | 2 +- plugin/syntastic/registry.vim | 1 + syntax_checkers/cabal/cabal.vim | 33 +++++++++++++++++-------------- 5 files changed, 41 insertions(+), 17 deletions(-) diff --git a/README.markdown b/README.markdown index 1c5b574e0..14e4f8d95 100644 --- a/README.markdown +++ b/README.markdown @@ -35,7 +35,7 @@ the user is notified and is happy because they didn't have to compile their code or execute their script to find them. At the time of this writing, syntax checking plugins exist for ActionScript, -Ada, AppleScript, AsciiDoc, ASM, BEMHTML, Bro, Bourne shell, C, C++, C#, +Ada, AppleScript, AsciiDoc, ASM, BEMHTML, Bro, Bourne shell, C, C++, C#, Cabal, Chef, CoffeeScript, Coco, Coq, CSS, Cucumber, CUDA, D, Dart, DocBook, Dust, Elixir, Erlang, eRuby, Fortran, Gentoo metadata, GLSL, Go, Haml, Haskell, Haxe, Handlebars, HSS, HTML, Java, JavaScript, JSON, JSX, LESS, Lex, Limbo, LISP, diff --git a/autoload/syntastic/preprocess.vim b/autoload/syntastic/preprocess.vim index 221f93c04..56998d26d 100644 --- a/autoload/syntastic/preprocess.vim +++ b/autoload/syntastic/preprocess.vim @@ -8,6 +8,26 @@ set cpo&vim " Public functions {{{1 +function! syntastic#preprocess#cabal(errors) " {{{2 + let out = [] + let star = 0 + for err in a:errors + if star + if err == '' + let star = 0 + else + let out[-1] .= ' ' . err + endif + else + call add(out, err) + if err =~ '\m^*\s' + let star = 1 + endif + endif + endfor + return out +endfunction " }}}2 + function! syntastic#preprocess#checkstyle(errors) " {{{2 let out = [] let fname = expand('%') diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 69b7034c2..c3ad2c885 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -19,7 +19,7 @@ if has('reltime') lockvar! g:syntastic_start endif -let g:syntastic_version = '3.4.0-74' +let g:syntastic_version = '3.4.0-75' lockvar g:syntastic_version " Sanity checks {{{1 diff --git a/plugin/syntastic/registry.vim b/plugin/syntastic/registry.vim index 3ae04da4d..57f671cc4 100644 --- a/plugin/syntastic/registry.vim +++ b/plugin/syntastic/registry.vim @@ -14,6 +14,7 @@ let s:defaultCheckers = { \ 'bro': ['bro'], \ 'bemhtml': ['bemhtmllint'], \ 'c': ['gcc'], + \ 'cabal': ['cabal'], \ 'chef': ['foodcritic'], \ 'co': ['coco'], \ 'cobol': ['cobc'], diff --git a/syntax_checkers/cabal/cabal.vim b/syntax_checkers/cabal/cabal.vim index 6f7fa5e56..191969be8 100644 --- a/syntax_checkers/cabal/cabal.vim +++ b/syntax_checkers/cabal/cabal.vim @@ -1,5 +1,5 @@ "============================================================================ -"File: check.vim +"File: cabal.vim "Description: Haskell package description (.cabal file) linting and syntax " validation via 'cabal check' "Maintainer: Ian D. Bollinger @@ -10,41 +10,44 @@ " See http://sam.zoy.org/wtfpl/COPYING for more details. "============================================================================ -if exists('g:loaded_syntastic_cabal_check_checker') +if exists('g:loaded_syntastic_cabal_cabal_checker') finish endif -let g:loaded_syntastic_cabal_check_checker = 1 +let g:loaded_syntastic_cabal_cabal_checker = 1 let s:save_cpo = &cpo set cpo&vim -function! SyntaxCheckers_cabal_check_GetHighlightRegex(item) +function! SyntaxCheckers_cabal_cabal_GetHighlightRegex(item) let field = matchstr(a:item['text'], "\\vParse of field '\\zs[^']+") if field != '' return '\v\c^\s*' . field . '\s*:\s*\zs.*$' endif + let field = matchstr(a:item['text'], "\\v(^|\\s)'\\zs[^']+\\ze'") + if field != '' + return '\V\c\<' . escape(field, '\') . '\>' + endif return '' endfunction -function! SyntaxCheckers_cabal_check_GetLocList() dict - let makeprg = self.makeprgBuild({'exe_after': 'check', 'fname': ''}) +function! SyntaxCheckers_cabal_cabal_GetLocList() dict + let makeprg = self.getExecEscaped() . ' check' + let errorformat = \ '%Ecabal: %f:%l: %m,' . - \ '%W* %m,' - let old_pwd = getcwd() - execute 'cd ' . syntastic#util#shexpand('%:h') - let loclist = SyntasticMake({ + \ '%W* %m' + + return SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, - \ 'defaults': {'bufnr': bufnr('%'), 'lnum': 1}}) - execute 'cd ' . old_pwd - return loclist + \ 'cwd': expand('%:p:h'), + \ 'preprocess': 'cabal', + \ 'defaults': {'bufnr': bufnr('')} }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'cabal', - \ 'name': 'check', - \ 'exec': 'cabal'}) + \ 'name': 'cabal'}) let &cpo = s:save_cpo unlet s:save_cpo From 263c10d558904eedec143d897ec1875707d99ff8 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Mon, 2 Jun 2014 21:25:49 +0300 Subject: [PATCH 0540/1271] Registry optimisation: lazy IsAvailable() calls. --- plugin/syntastic.vim | 13 ++++-- plugin/syntastic/checker.vim | 5 ++- plugin/syntastic/registry.vim | 74 ++++++++++++++++------------------- syntax_checkers/sh/sh.vim | 5 ++- 4 files changed, 50 insertions(+), 47 deletions(-) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index c3ad2c885..32117c398 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -19,7 +19,7 @@ if has('reltime') lockvar! g:syntastic_start endif -let g:syntastic_version = '3.4.0-75' +let g:syntastic_version = '3.4.0-76' lockvar g:syntastic_version " Sanity checks {{{1 @@ -142,7 +142,7 @@ let s:modemap = g:SyntasticModeMap.Instance() function! s:CompleteCheckerName(argLead, cmdLine, cursorPos) " {{{2 let checker_names = [] for ft in s:resolveFiletypes() - call extend(checker_names, keys(s:registry.getCheckersMap(ft))) + call extend(checker_names, s:registry.getNamesOfAvailableCheckers(ft)) endfor return join(checker_names, "\n") endfunction " }}}2 @@ -319,8 +319,15 @@ function! s:CacheErrors(checker_names) " {{{2 endfor let names = [] + let unavailable_checkers = 0 for checker in clist let cname = checker.getFiletype() . '/' . checker.getName() + if !checker.isAvailable() + call syntastic#log#debug(g:SyntasticDebugTrace, 'CacheErrors: Checker ' . cname . ' is not available') + let unavailable_checkers += 1 + continue + endif + call syntastic#log#debug(g:SyntasticDebugTrace, 'CacheErrors: Invoking checker: ' . cname) let loclist = checker.getLocList() @@ -357,7 +364,7 @@ function! s:CacheErrors(checker_names) " {{{2 " }}}3 " issue warning about no active checkers {{{3 - if empty(clist) + if len(clist) == unavailable_checkers if !empty(a:checker_names) if len(a:checker_names) == 1 call syntastic#log#warn('checker ' . a:checker_names[0] . ' is not available') diff --git a/plugin/syntastic/checker.vim b/plugin/syntastic/checker.vim index 33da5663d..c3655f7fc 100644 --- a/plugin/syntastic/checker.vim +++ b/plugin/syntastic/checker.vim @@ -98,7 +98,10 @@ function! g:SyntasticChecker.makeprgBuild(opts) " {{{2 endfunction " }}}2 function! g:SyntasticChecker.isAvailable() " {{{2 - return self._isAvailableFunc() + if !has_key(self, '_available') + let self._available = self._isAvailableFunc() + endif + return self._available endfunction " }}}2 " }}}1 diff --git a/plugin/syntastic/registry.vim b/plugin/syntastic/registry.vim index 57f671cc4..fd16429e3 100644 --- a/plugin/syntastic/registry.vim +++ b/plugin/syntastic/registry.vim @@ -106,14 +106,13 @@ let g:SyntasticRegistry = {} " Public methods {{{1 -" TODO: Handling of filetype aliases: all public methods take aliases as +" Note: Handling of filetype aliases: all public methods take aliases as " parameters, all private methods take normalized filetypes. Public methods " are thus supposed to normalize filetypes before calling private methods. function! g:SyntasticRegistry.Instance() " {{{2 if !exists('s:SyntasticRegistryInstance') let s:SyntasticRegistryInstance = copy(self) - let s:SyntasticRegistryInstance._checkerRaw = {} let s:SyntasticRegistryInstance._checkerMap = {} endif @@ -126,29 +125,23 @@ function! g:SyntasticRegistry.CreateAndRegisterChecker(args) " {{{2 call registry._registerChecker(checker) endfunction " }}}2 -function! g:SyntasticRegistry.isCheckable(ftalias) " {{{2 +" Given a list of checker names hints_list, return a map name --> checker. +" If hints_list is empty, user settings are are used instead. Checkers are +" not checked for availability (that is, the corresponding IsAvailable() are +" not run). +function! g:SyntasticRegistry.getCheckers(ftalias, hints_list) " {{{2 let ft = s:normaliseFiletype(a:ftalias) - call self._loadCheckers(ft) - return !empty(self._checkerMap[ft]) -endfunction " }}}2 - -function! g:SyntasticRegistry.getCheckersMap(ftalias) " {{{2 - let ft = s:normaliseFiletype(a:ftalias) - call self._loadCheckers(ft) - return self._checkerMap[ft] -endfunction " }}}2 + call self._loadCheckersFor(ft) -function! g:SyntasticRegistry.getCheckers(ftalias, list) " {{{2 - let checkers_map = self.getCheckersMap(a:ftalias) + let checkers_map = self._checkerMap[ft] if empty(checkers_map) return [] endif - let ft = s:normaliseFiletype(a:ftalias) call self._checkDeprecation(ft) let names = - \ !empty(a:list) ? a:list : + \ !empty(a:hints_list) ? syntastic#util#unique(a:hints_list) : \ exists('b:syntastic_checkers') ? b:syntastic_checkers : \ exists('g:syntastic_' . ft . '_checkers') ? g:syntastic_{ft}_checkers : \ get(s:defaultCheckers, ft, 0) @@ -157,6 +150,12 @@ function! g:SyntasticRegistry.getCheckers(ftalias, list) " {{{2 \ self._filterCheckersByName(checkers_map, names) : [checkers_map[keys(checkers_map)[0]]] endfunction " }}}2 +" Same as getCheckers(), but keep only the checkers available. This runs the +" corresponding IsAvailable() functions for all checkers. +function! g:SyntasticRegistry.getCheckersAvailable(ftalias, hints_list) " {{{2 + return filter(self.getCheckers(a:ftalias, a:hints_list), 'v:val.isAvailable()') +endfunction " }}}2 + function! g:SyntasticRegistry.getKnownFiletypes() " {{{2 let types = keys(s:defaultCheckers) @@ -173,6 +172,12 @@ function! g:SyntasticRegistry.getKnownFiletypes() " {{{2 return syntastic#util#unique(types) endfunction " }}}2 +function! g:SyntasticRegistry.getNamesOfAvailableCheckers(ftalias) " {{{2 + let ft = s:normaliseFiletype(a:ftalias) + call self._loadCheckersFor(ft) + return keys(filter( copy(self._checkerMap[ft]), 'v:val.isAvailable()' )) +endfunction " }}}2 + function! g:SyntasticRegistry.echoInfoFor(ftalias_list) " {{{2 echomsg "Syntastic version: " . g:syntastic_version echomsg "Info for filetype: " . join(a:ftalias_list, '.') @@ -183,13 +188,13 @@ function! g:SyntasticRegistry.echoInfoFor(ftalias_list) " {{{2 let active = [] for ft in ft_list - call extend(available, map( keys(self.getCheckersMap(ft)), 'ft . "/" . v:val' )) - call extend(active, map( self.getCheckers(ft, []), 'ft . "/" . v:val.getName()' )) + call extend(available, map( self.getNamesOfAvailableCheckers(ft), 'ft . "/" . v:val' )) + call extend(active, map( self.getCheckersAvailable(ft, []), 'ft . "/" . v:val.getName()' )) endfor else let ft = ft_list[0] - let available = keys(self.getCheckersMap(ft)) - let active = map(self.getCheckers(ft, []), 'v:val.getName()') + let available = self.getNamesOfAvailableCheckers(ft) + let active = map(self.getCheckersAvailable(ft, []), 'v:val.getName()') endif echomsg "Available checker(s): " . join(sort(available)) @@ -202,47 +207,34 @@ endfunction " }}}2 function! g:SyntasticRegistry._registerChecker(checker) abort " {{{2 let ft = a:checker.getFiletype() - - if !has_key(self._checkerRaw, ft) - let self._checkerRaw[ft] = [] + if !has_key(self._checkerMap, ft) let self._checkerMap[ft] = {} endif - call self._validateUniqueName(a:checker) - let name = a:checker.getName() - call add(self._checkerRaw[ft], name) - - if a:checker.isAvailable() - let self._checkerMap[ft][name] = a:checker + if has_key(self._checkerMap[ft], name) + throw 'Syntastic: Duplicate syntax checker name: ' . ft . '/' . name endif + + let self._checkerMap[ft][name] = a:checker endfunction " }}}2 function! g:SyntasticRegistry._filterCheckersByName(checkers_map, list) " {{{2 return filter( map(copy(a:list), 'get(a:checkers_map, v:val, {})'), '!empty(v:val)' ) endfunction " }}}2 -function! g:SyntasticRegistry._loadCheckers(filetype) " {{{2 - if has_key(self._checkerRaw, a:filetype) +function! g:SyntasticRegistry._loadCheckersFor(filetype) " {{{2 + if has_key(self._checkerMap, a:filetype) return endif execute "runtime! syntax_checkers/" . a:filetype . "/*.vim" - if !has_key(self._checkerRaw, a:filetype) - let self._checkerRaw[a:filetype] = [] + if !has_key(self._checkerMap, a:filetype) let self._checkerMap[a:filetype] = {} endif endfunction " }}}2 -function! g:SyntasticRegistry._validateUniqueName(checker) abort " {{{2 - let ft = a:checker.getFiletype() - let name = a:checker.getName() - if index(self._checkerRaw[ft], name) > -1 - throw 'Syntastic: Duplicate syntax checker name: ' . ft . '/' . name - endif -endfunction " }}}2 - " Check for obsolete variable g:syntastic__checker function! g:SyntasticRegistry._checkDeprecation(filetype) " {{{2 if exists('g:syntastic_' . a:filetype . '_checker') && !exists('g:syntastic_' . a:filetype . '_checkers') diff --git a/syntax_checkers/sh/sh.vim b/syntax_checkers/sh/sh.vim index 0cae24290..5c3a4f848 100644 --- a/syntax_checkers/sh/sh.vim +++ b/syntax_checkers/sh/sh.vim @@ -41,8 +41,9 @@ endfunction function! s:ForwardToZshChecker() let registry = g:SyntasticRegistry.Instance() - if registry.isCheckable('zsh') - return registry.getCheckers('zsh', ['zsh'])[0].getLocListRaw() + let zsh_checkers = registry.getCheckersAvailable('zsh', ['zsh']) + if !empty(zsh_checkers) + return zsh_checkers[0].getLocListRaw() else return [] endif From 1cd7e7f4f2ed92744d666274984909427acf196c Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Thu, 5 Jun 2014 00:23:01 +0300 Subject: [PATCH 0541/1271] New checker for sass and scss: sassc. --- plugin/syntastic.vim | 2 +- syntax_checkers/sass/sassc.vim | 38 ++++++++++++++++++++++++++++++++++ syntax_checkers/scss/sass.vim | 1 - syntax_checkers/scss/sassc.vim | 25 ++++++++++++++++++++++ 4 files changed, 64 insertions(+), 2 deletions(-) create mode 100644 syntax_checkers/sass/sassc.vim create mode 100644 syntax_checkers/scss/sassc.vim diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 32117c398..433d46bf6 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -19,7 +19,7 @@ if has('reltime') lockvar! g:syntastic_start endif -let g:syntastic_version = '3.4.0-76' +let g:syntastic_version = '3.4.0-77' lockvar g:syntastic_version " Sanity checks {{{1 diff --git a/syntax_checkers/sass/sassc.vim b/syntax_checkers/sass/sassc.vim new file mode 100644 index 000000000..731d17895 --- /dev/null +++ b/syntax_checkers/sass/sassc.vim @@ -0,0 +1,38 @@ +"============================================================================ +"File: sassc.vim +"Description: Syntax checking plugin for syntastic +"Maintainer: LCD 47 +"License: This program is free software. It comes without any warranty, +" to the extent permitted by applicable law. You can redistribute +" it and/or modify it under the terms of the Do What The Fuck You +" Want To Public License, Version 2, as published by Sam Hocevar. +" See http://sam.zoy.org/wtfpl/COPYING for more details. +" +"============================================================================ + +if exists("g:loaded_syntastic_sass_sassc_checker") + finish +endif +let g:loaded_syntastic_sass_sassc_checker = 1 + +let s:save_cpo = &cpo +set cpo&vim + +function! SyntaxCheckers_sass_sassc_GetLocList() dict + let makeprg = self.makeprgBuild({ 'fname_after': syntastic#util#DevNull() }) + + let errorformat = '%f:%l: %trror: %m' + + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat }) +endfunction + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'sass', + \ 'name': 'sassc'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/scss/sass.vim b/syntax_checkers/scss/sass.vim index 61bd6de78..0f837ca59 100644 --- a/syntax_checkers/scss/sass.vim +++ b/syntax_checkers/scss/sass.vim @@ -1,4 +1,3 @@ - "============================================================================ "File: scss.vim "Description: scss syntax checking plugin for syntastic diff --git a/syntax_checkers/scss/sassc.vim b/syntax_checkers/scss/sassc.vim new file mode 100644 index 000000000..75fdc2aa7 --- /dev/null +++ b/syntax_checkers/scss/sassc.vim @@ -0,0 +1,25 @@ +"============================================================================ +"File: sassc.vim +"Description: Syntax checking plugin for syntastic +"Maintainer: LCD 47 +"License: This program is free software. It comes without any warranty, +" to the extent permitted by applicable law. You can redistribute +" it and/or modify it under the terms of the Do What The Fuck You +" Want To Public License, Version 2, as published by Sam Hocevar. +" See http://sam.zoy.org/wtfpl/COPYING for more details. +" +"============================================================================ + +if exists("g:loaded_syntastic_scss_sassc_checker") + finish +endif +let g:loaded_syntastic_scss_sassc_checker = 1 + +runtime! syntax_checkers/sass/*.vim + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'scss', + \ 'name': 'sassc', + \ 'redirect': 'sass/sassc'}) + +" vim: set et sts=4 sw=4: From f1ba9fad0672c5137eaa2b5b38069e5e0fd4f974 Mon Sep 17 00:00:00 2001 From: Yorick Peterse Date: Fri, 6 Jun 2014 17:11:04 +0200 Subject: [PATCH 0542/1271] ruby-lint: removed analyze sub-command Starting with ruby-lint 2.0 the "analyze" sub command no longer exists. --- syntax_checkers/ruby/rubylint.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntax_checkers/ruby/rubylint.vim b/syntax_checkers/ruby/rubylint.vim index 02ed2f2f1..7b209e686 100644 --- a/syntax_checkers/ruby/rubylint.vim +++ b/syntax_checkers/ruby/rubylint.vim @@ -20,7 +20,7 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_ruby_rubylint_GetLocList() dict - let makeprg = self.makeprgBuild({ 'args': 'analyze --presenter=syntastic' }) + let makeprg = self.makeprgBuild({ 'args': '--presenter=syntastic' }) let errorformat = '%f:%t:%l:%c: %m' From c59fdce431d307ecc4c4eca6c4ce15bc4b6c0195 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 6 Jun 2014 18:55:41 +0300 Subject: [PATCH 0543/1271] ruby-lint: add version check for "analyze". --- plugin/syntastic.vim | 2 +- syntax_checkers/ruby/rubylint.vim | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 433d46bf6..df15f4a20 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -19,7 +19,7 @@ if has('reltime') lockvar! g:syntastic_start endif -let g:syntastic_version = '3.4.0-77' +let g:syntastic_version = '3.4.0-79' lockvar g:syntastic_version " Sanity checks {{{1 diff --git a/syntax_checkers/ruby/rubylint.vim b/syntax_checkers/ruby/rubylint.vim index 7b209e686..182abf715 100644 --- a/syntax_checkers/ruby/rubylint.vim +++ b/syntax_checkers/ruby/rubylint.vim @@ -20,7 +20,11 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_ruby_rubylint_GetLocList() dict - let makeprg = self.makeprgBuild({ 'args': '--presenter=syntastic' }) + if !exists(s:rubylint_new) + let s:rubylint_new = syntastic#util#versionIsAtLeast(syntastic#util#getVersion( + \ self.getExecEscaped() . ' --version'), [2]) + endif + let makeprg = self.makeprgBuild({ 'args': (s:rubylint_new ? '' : 'analyze ') . '--presenter=syntastic' }) let errorformat = '%f:%t:%l:%c: %m' From e9b0ee8069c73a23c43f113eb45365751147c9cb Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 6 Jun 2014 21:20:31 +0300 Subject: [PATCH 0544/1271] ruby-lint: typo. --- plugin/syntastic.vim | 2 +- syntax_checkers/ruby/rubylint.vim | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index df15f4a20..f7db8950e 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -19,7 +19,7 @@ if has('reltime') lockvar! g:syntastic_start endif -let g:syntastic_version = '3.4.0-79' +let g:syntastic_version = '3.4.0-80' lockvar g:syntastic_version " Sanity checks {{{1 diff --git a/syntax_checkers/ruby/rubylint.vim b/syntax_checkers/ruby/rubylint.vim index 182abf715..07f0d4f04 100644 --- a/syntax_checkers/ruby/rubylint.vim +++ b/syntax_checkers/ruby/rubylint.vim @@ -20,7 +20,7 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_ruby_rubylint_GetLocList() dict - if !exists(s:rubylint_new) + if !exists('s:rubylint_new') let s:rubylint_new = syntastic#util#versionIsAtLeast(syntastic#util#getVersion( \ self.getExecEscaped() . ' --version'), [2]) endif From 920f9677918043207a3299f2db6e7182b0e2dc1c Mon Sep 17 00:00:00 2001 From: Andrew Gallant Date: Thu, 12 Jun 2014 14:54:17 -0400 Subject: [PATCH 0545/1271] filename -> fname The rationale for this change is that `makeprgBuild` uses `fname` as the parameter name to retrieve the file path. Therefore, the documentation has been changed to match the code. --- doc/syntastic.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/syntastic.txt b/doc/syntastic.txt index 2071be554..bb2220947 100644 --- a/doc/syntastic.txt +++ b/doc/syntastic.txt @@ -598,7 +598,7 @@ Checkers that use 'makeprgBuild()' construct a 'makeprg' like this: > \ 'tail': '> /tmp/output' }) < The result is a 'makeprg' of the form: > - + < *'syntastic___exe'* All arguments above are optional, and can be overridden by setting global From 4e690459750dc756c9ced8559bfe43f487fa22d5 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Thu, 12 Jun 2014 22:36:05 +0300 Subject: [PATCH 0546/1271] rustc: make arguments configurable. --- plugin/syntastic.vim | 2 +- syntax_checkers/rust/rustc.vim | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index f7db8950e..be5767d36 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -19,7 +19,7 @@ if has('reltime') lockvar! g:syntastic_start endif -let g:syntastic_version = '3.4.0-80' +let g:syntastic_version = '3.4.0-83' lockvar g:syntastic_version " Sanity checks {{{1 diff --git a/syntax_checkers/rust/rustc.vim b/syntax_checkers/rust/rustc.vim index 97ef66a04..ae378cb19 100644 --- a/syntax_checkers/rust/rustc.vim +++ b/syntax_checkers/rust/rustc.vim @@ -19,7 +19,7 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_rust_rustc_GetLocList() dict - let makeprg = self.makeprgBuild({ 'args_after': '--no-trans' }) + let makeprg = self.makeprgBuild({ 'args': '--no-trans' }) let errorformat = \ '%E%f:%l:%c: %\d%#:%\d%# %.%\{-}error:%.%\{-} %m,' . From c1354ba3505c2462889e903045f5c19af7dcf494 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Thu, 12 Jun 2014 23:42:54 +0300 Subject: [PATCH 0547/1271] Remove the rustc checket for Rust. Between #947, #1114, and #1112, this checker is too controversial to maintain in syntastic. Please consider using it as an external checker if you need it: https://github.com/scrooloose/syntastic/wiki/Syntax-Checker-Guide#external --- README.markdown | 8 +++---- plugin/syntastic.vim | 2 +- plugin/syntastic/registry.vim | 1 - syntax_checkers/rust/rustc.vim | 42 ---------------------------------- 4 files changed, 5 insertions(+), 48 deletions(-) delete mode 100644 syntax_checkers/rust/rustc.vim diff --git a/README.markdown b/README.markdown index 14e4f8d95..878e6cd56 100644 --- a/README.markdown +++ b/README.markdown @@ -41,10 +41,10 @@ Elixir, Erlang, eRuby, Fortran, Gentoo metadata, GLSL, Go, Haml, Haskell, Haxe, Handlebars, HSS, HTML, Java, JavaScript, JSON, JSX, LESS, Lex, Limbo, LISP, LLVM intermediate language, Lua, MATLAB, NASM, Objective-C, Objective-C++, OCaml, Perl, Perl POD, PHP, gettext Portable Object, OS X and iOS property -lists, Puppet, Python, Racket, R, reStructuredText, Ruby, Rust, SASS/SCSS, -Scala, Slim, Tcl, TeX, Texinfo, Twig, TypeScript, Vala, Verilog, VHDL, VimL, -xHtml, XML, XSLT, YACC, YAML, z80, Zope page templates, and zsh. See the -[wiki][3] for details about the corresponding supported checkers. +lists, Puppet, Python, Racket, R, reStructuredText, Ruby, SASS/SCSS, Scala, +Slim, Tcl, TeX, Texinfo, Twig, TypeScript, Vala, Verilog, VHDL, VimL, xHtml, +XML, XSLT, YACC, YAML, z80, Zope page templates, and zsh. See the [wiki][3] +for details about the corresponding supported checkers. Below is a screenshot showing the methods that Syntastic uses to display syntax errors. Note that, in practise, you will only have a subset of these methods diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index be5767d36..46366bad0 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -19,7 +19,7 @@ if has('reltime') lockvar! g:syntastic_start endif -let g:syntastic_version = '3.4.0-83' +let g:syntastic_version = '3.4.0-84' lockvar g:syntastic_version " Sanity checks {{{1 diff --git a/plugin/syntastic/registry.vim b/plugin/syntastic/registry.vim index fd16429e3..6e125424e 100644 --- a/plugin/syntastic/registry.vim +++ b/plugin/syntastic/registry.vim @@ -66,7 +66,6 @@ let s:defaultCheckers = { \ 'racket': ['racket'], \ 'rst': ['rst2pseudoxml'], \ 'ruby': ['mri'], - \ 'rust': ['rustc'], \ 'sass': ['sass'], \ 'scala': ['fsc', 'scalac'], \ 'scss': ['sass', 'scss_lint'], diff --git a/syntax_checkers/rust/rustc.vim b/syntax_checkers/rust/rustc.vim deleted file mode 100644 index ae378cb19..000000000 --- a/syntax_checkers/rust/rustc.vim +++ /dev/null @@ -1,42 +0,0 @@ -"============================================================================ -"File: rust.vim -"Description: Syntax checking plugin for syntastic.vim -"Maintainer: Chad Jablonski -"License: This program is free software. It comes without any warranty, -" to the extent permitted by applicable law. You can redistribute -" it and/or modify it under the terms of the Do What The Fuck You -" Want To Public License, Version 2, as published by Sam Hocevar. -" See http://sam.zoy.org/wtfpl/COPYING for more details. -" -"============================================================================ - -if exists("g:loaded_syntastic_rust_rustc_checker") - finish -endif -let g:loaded_syntastic_rust_rustc_checker = 1 - -let s:save_cpo = &cpo -set cpo&vim - -function! SyntaxCheckers_rust_rustc_GetLocList() dict - let makeprg = self.makeprgBuild({ 'args': '--no-trans' }) - - let errorformat = - \ '%E%f:%l:%c: %\d%#:%\d%# %.%\{-}error:%.%\{-} %m,' . - \ '%W%f:%l:%c: %\d%#:%\d%# %.%\{-}warning:%.%\{-} %m,' . - \ '%C%f:%l %m,' . - \ '%-Z%.%#' - - return SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat }) -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'rust', - \ 'name': 'rustc'}) - -let &cpo = s:save_cpo -unlet s:save_cpo - -" vim: set et sts=4 sw=4: From 9fb13c8b80a20958abe7a1fbd16223f3812a6ca2 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 13 Jun 2014 00:23:10 +0300 Subject: [PATCH 0548/1271] Add a note about the removal of the rustc checker. --- README.markdown | 12 ++++++++++++ plugin/syntastic.vim | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/README.markdown b/README.markdown index 878e6cd56..514b05ece 100644 --- a/README.markdown +++ b/README.markdown @@ -142,6 +142,18 @@ still producing useful results, the checker is now disabled by default. To let g:syntastic_enable_perl_checker = 1 ``` + + +__Q. What happened to the `rustc` checker?__ + +A. Sadly, it had to be [removed](https://github.com/scrooloose/syntastic/commit/1383c0f), +since maintaining it in syntastic generated too much +[controversy](https://github.com/scrooloose/syntastic/pull/1114#issuecomment-45945696). +If you'd like to take over its maintenance as an external checker please read the +[relevant section](https://github.com/scrooloose/syntastic/wiki/Syntax-Checker-Guide#external) +in the wiki, and feel free to contact syntastic maintainers if you need +further help. + __Q. I run a checker and the location list is not updated...__ diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 46366bad0..04fe56552 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -19,7 +19,7 @@ if has('reltime') lockvar! g:syntastic_start endif -let g:syntastic_version = '3.4.0-84' +let g:syntastic_version = '3.4.0-85' lockvar g:syntastic_version " Sanity checks {{{1 From ff80f1c67c3fca868c29460b5948663d4d03e10d Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Sat, 14 Jun 2014 06:53:50 +0300 Subject: [PATCH 0549/1271] R lint and svtools: fix CWD for Windows. On Windows R is run with CWD set to the directory used at install time, rather than the current directory. The official workaround for this is to add links to R from the home directories of each of your projects. We can't do that in Vim, but we can call `setwd()` to Vim's idea of current directory. This mimics the behaviour of R on UNIX. --- plugin/syntastic.vim | 2 +- syntax_checkers/r/lint.vim | 5 ++++- syntax_checkers/r/svtools.vim | 3 ++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 04fe56552..dbcf53262 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -19,7 +19,7 @@ if has('reltime') lockvar! g:syntastic_start endif -let g:syntastic_version = '3.4.0-85' +let g:syntastic_version = '3.4.0-86' lockvar g:syntastic_version " Sanity checks {{{1 diff --git a/syntax_checkers/r/lint.vim b/syntax_checkers/r/lint.vim index b0cae68d4..9112905b8 100644 --- a/syntax_checkers/r/lint.vim +++ b/syntax_checkers/r/lint.vim @@ -39,8 +39,11 @@ function! SyntaxCheckers_r_lint_IsAvailable() dict endfunction function! SyntaxCheckers_r_lint_GetLocList() dict + let setwd = syntastic#util#isRunningWindows() ? 'setwd("' . escape(getcwd(), '"\') . '"); ' : '' + let setwd = 'setwd("' . escape(getcwd(), '"\') . '"); ' let makeprg = self.getExecEscaped() . ' --slave --restore --no-save' . - \ ' -e ' . syntastic#util#shescape('library(lint); try(lint(commandArgs(TRUE), ' . g:syntastic_r_lint_styles . '))') . + \ ' -e ' . syntastic#util#shescape(setwd . 'library(lint); ' . + \ 'try(lint(commandArgs(TRUE), ' . g:syntastic_r_lint_styles . '))') . \ ' --args ' . syntastic#util#shexpand('%') let errorformat = diff --git a/syntax_checkers/r/svtools.vim b/syntax_checkers/r/svtools.vim index 1b15c693d..ec924c381 100644 --- a/syntax_checkers/r/svtools.vim +++ b/syntax_checkers/r/svtools.vim @@ -51,8 +51,9 @@ function! SyntaxCheckers_r_svtools_GetLocList() dict return [] endif + let setwd = syntastic#util#isRunningWindows() ? 'setwd("' . escape(getcwd(), '"\') . '"); ' : '' let makeprg = self.getExecEscaped() . ' --slave --restore --no-save' . - \ ' -e ' . syntastic#util#shescape('library(svTools); ' . + \ ' -e ' . syntastic#util#shescape(setwd . 'library(svTools); ' . \ 'try(lint(commandArgs(TRUE), filename = commandArgs(TRUE), type = "flat", sep = ":"))') . \ ' --args ' . syntastic#util#shexpand('%') From d15f7eb4f4dd2458bab256afbd523cd24c297797 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Tue, 17 Jun 2014 08:35:29 +0300 Subject: [PATCH 0550/1271] Add a note about rustc's new home. --- README.markdown | 11 ++++------- plugin/syntastic.vim | 2 +- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/README.markdown b/README.markdown index 514b05ece..950f7273a 100644 --- a/README.markdown +++ b/README.markdown @@ -146,13 +146,9 @@ let g:syntastic_enable_perl_checker = 1 __Q. What happened to the `rustc` checker?__ -A. Sadly, it had to be [removed](https://github.com/scrooloose/syntastic/commit/1383c0f), -since maintaining it in syntastic generated too much -[controversy](https://github.com/scrooloose/syntastic/pull/1114#issuecomment-45945696). -If you'd like to take over its maintenance as an external checker please read the -[relevant section](https://github.com/scrooloose/syntastic/wiki/Syntax-Checker-Guide#external) -in the wiki, and feel free to contact syntastic maintainers if you need -further help. +A. It has been included in the [Rust compiler package][12]. If you have +a recent version of the Rust compiler, the checker should be picked up +automatically by syntastic. @@ -305,3 +301,4 @@ a look at [jedi-vim][7], [python-mode][8], or [YouCompleteMe][9]. [9]: http://valloric.github.io/YouCompleteMe/ [10]: http://perldoc.perl.org/perlrun.html#*-c* [11]: https://github.com/scrooloose/syntastic/wiki/Syntax-Checker-Guide +[12]: https://github.com/rust-lang/rust/ diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index dbcf53262..b9ac65ba1 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -19,7 +19,7 @@ if has('reltime') lockvar! g:syntastic_start endif -let g:syntastic_version = '3.4.0-86' +let g:syntastic_version = '3.4.0-87' lockvar g:syntastic_version " Sanity checks {{{1 From 58c3822b9a043e5438e9bc8815e4580848c11118 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Tue, 24 Jun 2014 19:02:42 +0300 Subject: [PATCH 0551/1271] Cleanup. Deprecate a number of checker variables. New / refactored deprecation logging functions: syntastic#log#oneTimeWarn() and syntastic#log#deprecationWarn(). --- autoload/syntastic/c.vim | 2 +- autoload/syntastic/log.vim | 30 +++++++-- plugin/syntastic.vim | 4 +- plugin/syntastic/registry.vim | 2 +- syntax_checkers/actionscript/mxmlc.vim | 12 ++-- syntax_checkers/bemhtml/bemhtmllint.vim | 5 +- syntax_checkers/c/checkpatch.vim | 25 +++---- syntax_checkers/c/make.vim | 2 +- syntax_checkers/co/coco.vim | 3 +- syntax_checkers/css/csslint.vim | 10 +-- syntax_checkers/d/dmd.vim | 6 ++ syntax_checkers/eruby/ruby.vim | 27 ++++---- syntax_checkers/haml/haml.vim | 10 +-- syntax_checkers/haskell/hdevtools.vim | 4 +- syntax_checkers/html/jshint.vim | 23 ++----- .../javascript/closurecompiler.vim | 32 +++------ syntax_checkers/javascript/eslint.vim | 12 ++-- syntax_checkers/javascript/gjslint.vim | 7 +- syntax_checkers/javascript/jshint.vim | 21 ++---- syntax_checkers/javascript/jsl.vim | 9 +-- syntax_checkers/perl/perl.vim | 20 +++--- syntax_checkers/puppet/puppetlint.vim | 7 +- syntax_checkers/ruby/jruby.vim | 12 +--- syntax_checkers/ruby/macruby.vim | 2 +- syntax_checkers/ruby/mri.vim | 18 +++-- syntax_checkers/scala/fsc.vim | 7 +- syntax_checkers/scala/scalac.vim | 10 +-- syntax_checkers/sh/sh.vim | 66 +++++++++---------- syntax_checkers/vim/vimlint.vim | 3 +- syntax_checkers/yaml/yamlxs.vim | 13 ++-- 30 files changed, 183 insertions(+), 221 deletions(-) diff --git a/autoload/syntastic/c.vim b/autoload/syntastic/c.vim index 4bd794728..22fb0ede2 100644 --- a/autoload/syntastic/c.vim +++ b/autoload/syntastic/c.vim @@ -180,7 +180,7 @@ endfunction " }}}2 function! s:getIncludeDirs(filetype) " {{{2 let include_dirs = [] - if a:filetype =~# '\v^%(c|cpp|d|objc|objcpp)$' && + if a:filetype =~# '\v^%(c|cpp|objc|objcpp)$' && \ (!exists('g:syntastic_'.a:filetype.'_no_default_include_dirs') || \ !g:syntastic_{a:filetype}_no_default_include_dirs) let include_dirs = copy(s:default_includes) diff --git a/autoload/syntastic/log.vim b/autoload/syntastic/log.vim index 38aa28744..f206dfeb2 100644 --- a/autoload/syntastic/log.vim +++ b/autoload/syntastic/log.vim @@ -6,7 +6,7 @@ let g:loaded_syntastic_log_autoload = 1 let s:save_cpo = &cpo set cpo&vim -let s:deprecation_notices_issued = [] +let s:one_time_notices_issued = [] " Public functions {{{1 @@ -27,15 +27,37 @@ function! syntastic#log#error(msg) " {{{2 echohl None endfunction " }}}2 -function! syntastic#log#deprecationWarn(msg) " {{{2 - if index(s:deprecation_notices_issued, a:msg) >= 0 +function! syntastic#log#oneTimeWarn(msg) " {{{2 + if index(s:one_time_notices_issued, a:msg) >= 0 return endif - call add(s:deprecation_notices_issued, a:msg) + call add(s:one_time_notices_issued, a:msg) call syntastic#log#warn(a:msg) endfunction " }}}2 +function! syntastic#log#deprecationWarn(old, new, ...) " {{{2 + if exists('g:syntastic_' . a:old) && !exists('g:syntastic_' . a:new) + let msg = 'variable g:syntastic_' . a:old . ' is deprecated, please use ' + + if a:0 + let OLD_VAR = g:syntastic_{a:old} + try + let NEW_VAR = eval(a:1) + let msg .= 'in its stead: let g:syntastic_' . a:new . ' = ' . string(NEW_VAR) + let g:syntastic_{a:new} = NEW_VAR + catch + let msg .= 'g:syntastic_' . a:new . ' instead' + endtry + else + let msg .= 'g:syntastic_' . a:new . ' instead' + let g:syntastic_{a:new} = g:syntastic_{a:old} + endif + + call syntastic#log#oneTimeWarn(msg) + endif +endfunction " }}}2 + function! syntastic#log#debug(level, msg, ...) " {{{2 if !s:isDebugEnabled(a:level) return diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index b9ac65ba1..e39cd09fd 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -19,7 +19,7 @@ if has('reltime') lockvar! g:syntastic_start endif -let g:syntastic_version = '3.4.0-87' +let g:syntastic_version = '3.4.0-88' lockvar g:syntastic_version " Sanity checks {{{1 @@ -84,7 +84,7 @@ for s:key in keys(g:syntastic_defaults) endfor if exists("g:syntastic_quiet_warnings") - call syntastic#log#deprecationWarn("variable g:syntastic_quiet_warnings is deprecated, please use let g:syntastic_quiet_messages = {'level': 'warnings'} instead") + call syntastic#log#oneTimeWarn("variable g:syntastic_quiet_warnings is deprecated, please use let g:syntastic_quiet_messages = {'level': 'warnings'} instead") if g:syntastic_quiet_warnings let s:quiet_warnings = get(g:syntastic_quiet_messages, 'type', []) if type(s:quiet_warnings) != type([]) diff --git a/plugin/syntastic/registry.vim b/plugin/syntastic/registry.vim index 6e125424e..3ab771e17 100644 --- a/plugin/syntastic/registry.vim +++ b/plugin/syntastic/registry.vim @@ -238,7 +238,7 @@ endfunction " }}}2 function! g:SyntasticRegistry._checkDeprecation(filetype) " {{{2 if exists('g:syntastic_' . a:filetype . '_checker') && !exists('g:syntastic_' . a:filetype . '_checkers') let g:syntastic_{a:filetype}_checkers = [g:syntastic_{a:filetype}_checker] - call syntastic#log#deprecationWarn('variable g:syntastic_' . a:filetype . '_checker is deprecated') + call syntastic#log#oneTimeWarn('variable g:syntastic_' . a:filetype . '_checker is deprecated') endif endfunction " }}}2 diff --git a/syntax_checkers/actionscript/mxmlc.vim b/syntax_checkers/actionscript/mxmlc.vim index 0c4d09dbc..dd47287d8 100644 --- a/syntax_checkers/actionscript/mxmlc.vim +++ b/syntax_checkers/actionscript/mxmlc.vim @@ -14,10 +14,6 @@ if exists('g:loaded_syntastic_actionscript_mxmlc_checker') endif let g:loaded_syntastic_actionscript_mxmlc_checker = 1 -if !exists('g:syntastic_actionscript_mxmlc_conf') - let g:syntastic_actionscript_mxmlc_conf = '' -endif - let s:save_cpo = &cpo set cpo&vim @@ -45,10 +41,10 @@ function! SyntaxCheckers_actionscript_mxmlc_GetHighlightRegex(item) endfunction function! SyntaxCheckers_actionscript_mxmlc_GetLocList() dict - let makeprg = self.makeprgBuild({ - \ 'args_before': (g:syntastic_actionscript_mxmlc_conf != '' ? - \ ' -load-config+=' . syntastic#util#shexpand(g:syntastic_actionscript_mxmlc_conf) : ''), - \ 'args_after': '-output=' . syntastic#util#DevNull() }) + call syntastic#log#deprecationWarn('actionscript_mxmlc_conf', 'actionscript_mxmlc_args', + \ "'-load-config+=' . syntastic#util#shexpand(OLD_VAR)") + + let makeprg = self.makeprgBuild({ 'args_after': '-output=' . syntastic#util#DevNull() }) let errorformat = \ '%f(%l): col: %c %trror: %m,' . diff --git a/syntax_checkers/bemhtml/bemhtmllint.vim b/syntax_checkers/bemhtml/bemhtmllint.vim index e6582163f..7f52ed3b1 100644 --- a/syntax_checkers/bemhtml/bemhtmllint.vim +++ b/syntax_checkers/bemhtml/bemhtmllint.vim @@ -8,7 +8,7 @@ " Want To Public License, Version 2, as published by Sam Hocevar. " See http://sam.zoy.org/wtfpl/COPYING for more details. "============================================================================ -" + if exists("g:loaded_syntastic_bemhtml_bemhtmllint_checker") finish endif @@ -29,6 +29,7 @@ call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'name': 'bemhtmllint', \ 'exec': 'bemhtml-lint' }) - let &cpo = s:save_cpo unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/c/checkpatch.vim b/syntax_checkers/c/checkpatch.vim index f8601d807..957af2de4 100644 --- a/syntax_checkers/c/checkpatch.vim +++ b/syntax_checkers/c/checkpatch.vim @@ -14,24 +14,27 @@ if exists("g:loaded_syntastic_c_checkpatch_checker") endif let g:loaded_syntastic_c_checkpatch_checker = 1 -" Bail if the user doesn't have `checkpatch.pl` or ./scripts/checkpatch.pl installed. -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' -endif - let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_c_checkpatch_IsAvailable() dict - return exists("g:syntastic_c_checker_checkpatch_location") + call syntastic#log#deprecationWarn('c_checker_checkpatch_location', 'c_checkpatch_exe') + + if !exists('g:syntastic_c_checkpatch_exe') && !executable(self.getExec()) + if executable('checkpatch') + let g:syntastic_c_checkpatch_exe = 'checkpatch' + elseif executable('./scripts/checkpatch.pl') + let g:syntastic_c_checkpatch_exe = fnamemodify('./scripts/checkpatch.pl', ':p') + elseif executable('./scripts/checkpatch') + let g:syntastic_c_checkpatch_exe = fnamemodify('./scripts/checkpatch', ':p') + endif + endif + + return executable(self.getExec()) endfunction function! SyntaxCheckers_c_checkpatch_GetLocList() dict - let makeprg = self.makeprgBuild({ - \ 'exe': g:syntastic_c_checker_checkpatch_location, - \ 'args_after': '--no-summary --no-tree --terse --file' }) + let makeprg = self.makeprgBuild({ 'args_after': '--no-summary --no-tree --terse --file' }) let errorformat = \ '%f:%l: %tARNING: %m,' . diff --git a/syntax_checkers/c/make.vim b/syntax_checkers/c/make.vim index fa27273a7..8b84173f7 100644 --- a/syntax_checkers/c/make.vim +++ b/syntax_checkers/c/make.vim @@ -19,7 +19,7 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_c_make_GetLocList() dict - let makeprg = self.getExecEscaped() . ' -sk' + let makeprg = self.makeprgBuild({ 'args': '-sk', 'fname': '' }) let errorformat = \ '%-G%f:%s:,' . diff --git a/syntax_checkers/co/coco.vim b/syntax_checkers/co/coco.vim index 3ef5d967a..1a58c4518 100644 --- a/syntax_checkers/co/coco.vim +++ b/syntax_checkers/co/coco.vim @@ -19,7 +19,8 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_co_coco_GetLocList() dict - let makeprg = self.makeprgBuild({ 'args_after': '-c -o /tmp' }) + let tmpdir = $TMPDIR != '' ? $TMPDIR : $TMP != '' ? $TMP : '/tmp' + let makeprg = self.makeprgBuild({ 'args_after': '-c -o ' . tmpdir }) let errorformat = \ '%EFailed at: %f,' . diff --git a/syntax_checkers/css/csslint.vim b/syntax_checkers/css/csslint.vim index fe84aaa12..0fc06269e 100644 --- a/syntax_checkers/css/csslint.vim +++ b/syntax_checkers/css/csslint.vim @@ -19,17 +19,13 @@ if exists('g:loaded_syntastic_css_csslint_checker') endif let g:loaded_syntastic_css_csslint_checker = 1 -if !exists('g:syntastic_csslint_options') - let g:syntastic_csslint_options = '' -endif - let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_css_csslint_GetLocList() dict - let makeprg = self.makeprgBuild({ - \ 'args': g:syntastic_csslint_options, - \ 'args_after': '--format=compact' }) + call syntastic#log#deprecationWarn('csslint_options', 'css_csslint_args') + + let makeprg = self.makeprgBuild({ 'args_after': '--format=compact' }) " Print CSS Lint's error/warning messages from compact format. Ignores blank lines. let errorformat = diff --git a/syntax_checkers/d/dmd.vim b/syntax_checkers/d/dmd.vim index 4f70979b4..05e7b6a14 100644 --- a/syntax_checkers/d/dmd.vim +++ b/syntax_checkers/d/dmd.vim @@ -35,6 +35,12 @@ function! SyntaxCheckers_d_dmd_IsAvailable() dict endfunction function! SyntaxCheckers_d_dmd_GetLocList() dict + if !exists('g:syntastic_d_include_dirs') + let g:syntastic_d_include_dirs = filter(glob($HOME . '/.dub/packages/*', 1, 1), 'isdirectory(v:val)') + call map(g:syntastic_d_include_dirs, 'isdirectory(v:val . "/source") ? v:val . "/source" : v:val') + call add(g:syntastic_d_include_dirs, './source') + endif + return syntastic#c#GetLocList('d', 'dmd', { \ 'errorformat': \ '%-G%f:%s:,%f(%l): %m,' . diff --git a/syntax_checkers/eruby/ruby.vim b/syntax_checkers/eruby/ruby.vim index 34dc9bdc8..47378e0fe 100644 --- a/syntax_checkers/eruby/ruby.vim +++ b/syntax_checkers/eruby/ruby.vim @@ -19,22 +19,27 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_eruby_ruby_IsAvailable() dict - if !exists("g:syntastic_ruby_exec") - let g:syntastic_ruby_exec = self.getExec() + if !exists('g:syntastic_eruby_ruby_exec') && exists('g:syntastic_ruby_exec') + let g:syntastic_eruby_ruby_exec = g:syntastic_ruby_exec endif - return executable(expand(g:syntastic_ruby_exec)) -endfunction + let s:exe = self.getExec() -function! SyntaxCheckers_eruby_ruby_GetLocList() dict - let exe = syntastic#util#shexpand(g:syntastic_ruby_exec) - if !syntastic#util#isRunningWindows() - let exe = 'RUBYOPT= ' . exe + if executable(s:exe) + let s:exe = syntastic#util#shescape(s:exe) + if !syntastic#util#isRunningWindows() + let s:exe = 'RUBYOPT= ' . s:exe + endif + return 1 endif + return 0 +endfunction + +function! SyntaxCheckers_eruby_ruby_GetLocList() dict let fname = "'" . escape(expand('%'), "\\'") . "'" " TODO: encodings became useful in ruby 1.9 :) - if syntastic#util#versionIsAtLeast(syntastic#util#getVersion(exe . ' --version'), [1, 9]) + if syntastic#util#versionIsAtLeast(syntastic#util#getVersion(s:exe . ' --version'), [1, 9]) let enc = &fileencoding != '' ? &fileencoding : &encoding let encoding_spec = ', :encoding => "' . (enc ==? 'utf-8' ? 'UTF-8' : 'BINARY') . '"' else @@ -43,11 +48,11 @@ function! SyntaxCheckers_eruby_ruby_GetLocList() dict "gsub fixes issue #7, rails has it's own eruby syntax let makeprg = - \ exe . ' -rerb -e ' . + \ s:exe . ' -rerb -e ' . \ syntastic#util#shescape('puts ERB.new(File.read(' . \ fname . encoding_spec . \ ').gsub(''<%='',''<%''), nil, ''-'').src') . - \ ' | ' . exe . ' -c' + \ ' | ' . s:exe . ' -c' let errorformat = \ '%-GSyntax OK,'. diff --git a/syntax_checkers/haml/haml.vim b/syntax_checkers/haml/haml.vim index b01143e9c..a26fa6ccc 100644 --- a/syntax_checkers/haml/haml.vim +++ b/syntax_checkers/haml/haml.vim @@ -19,16 +19,12 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_haml_haml_IsAvailable() dict - if !exists('g:syntastic_haml_interpreter') - let g:syntastic_haml_interpreter = self.getExec() - endif - return executable(expand(g:syntastic_haml_interpreter)) + call syntastic#log#deprecationWarn('haml_interpreter', 'haml_haml_exec') + return executable(self.getExec()) endfunction function! SyntaxCheckers_haml_haml_GetLocList() dict - let makeprg = self.makeprgBuild({ - \ 'exe': syntastic#util#shexpand(g:syntastic_haml_interpreter), - \ 'args_after': '-c' }) + let makeprg = self.makeprgBuild({ 'args_after': '-c' }) let errorformat = \ 'Haml error on line %l: %m,' . diff --git a/syntax_checkers/haskell/hdevtools.vim b/syntax_checkers/haskell/hdevtools.vim index 819549168..978abd208 100644 --- a/syntax_checkers/haskell/hdevtools.vim +++ b/syntax_checkers/haskell/hdevtools.vim @@ -19,7 +19,9 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_haskell_hdevtools_GetLocList() dict - if exists('g:hdevtools_options') + if !exists('g:syntastic_haskell_hdevtools_args') && exists('g:hdevtools_options') + call syntastic#log#oneTimeWarn('variable g:hdevtools_options is deprecated, ' . + \ 'please use g:syntastic_haskell_hdevtools_args instead') let g:syntastic_haskell_hdevtools_args = g:hdevtools_options endif diff --git a/syntax_checkers/html/jshint.vim b/syntax_checkers/html/jshint.vim index 2c64fb621..a7274c1b5 100644 --- a/syntax_checkers/html/jshint.vim +++ b/syntax_checkers/html/jshint.vim @@ -14,29 +14,20 @@ if exists('g:loaded_syntastic_html_jshint_checker') endif let g:loaded_syntastic_html_jshint_checker = 1 -if !exists('g:syntastic_jshint_exec') - let g:syntastic_jshint_exec = 'jshint' -endif - -if !exists('g:syntastic_html_jshint_conf') - let g:syntastic_html_jshint_conf = '' -endif - let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_html_jshint_IsAvailable() dict - let exe = expand(g:syntastic_jshint_exec) - return executable(exe) && - \ syntastic#util#versionIsAtLeast(syntastic#util#getVersion(exe . ' --version'), [2,4]) + call syntastic#log#deprecationWarn('jshint_exec', 'html_jshint_exec') + return executable(self.getExec()) && + \ syntastic#util#versionIsAtLeast(syntastic#util#getVersion(self.getExecEscaped() . ' --version'), [2,4]) endfunction function! SyntaxCheckers_html_jshint_GetLocList() dict - let makeprg = self.makeprgBuild({ - \ 'exe': expand(g:syntastic_jshint_exec), - \ 'args': (g:syntastic_html_jshint_conf != '' ? - \ '--config ' . syntastic#util#shexpand(g:syntastic_html_jshint_conf) : ''), - \ 'args_after': '--verbose --extract always' }) + call syntastic#log#deprecationWarn('html_jshint_conf', 'html_jshint_args', + \ "'--config ' . syntastic#util#shexpand(OLD_VAR)") + + let makeprg = self.makeprgBuild({ 'args_after': '--verbose --extract always' }) let errorformat = '%A%f: line %l\, col %v\, %m \(%t%*\d\)' diff --git a/syntax_checkers/javascript/closurecompiler.vim b/syntax_checkers/javascript/closurecompiler.vim index d23fad056..5dac3abe6 100644 --- a/syntax_checkers/javascript/closurecompiler.vim +++ b/syntax_checkers/javascript/closurecompiler.vim @@ -8,48 +8,36 @@ " Want To Public License, Version 2, as published by Sam Hocevar. " See http://sam.zoy.org/wtfpl/COPYING for more details. "============================================================================ -" -" To enable this plugin, edit the .vimrc like this: -" -" let g:syntastic_javascript_checker = "closurecompiler" -" -" and set the path to the Google Closure Compiler: -" -" let g:syntastic_javascript_closure_compiler_path = '/path/to/google-closure-compiler.jar' -" -" It takes additional options for Google Closure Compiler with the variable -" g:syntastic_javascript_closure_compiler_options. -" if exists("g:loaded_syntastic_javascript_closurecompiler_checker") finish endif let g:loaded_syntastic_javascript_closurecompiler_checker = 1 -if !exists("g:syntastic_javascript_closure_compiler_options") - let g:syntastic_javascript_closure_compiler_options = "" -endif - let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_javascript_closurecompiler_IsAvailable() dict + call syntastic#log#deprecationWarn('javascript_closure_compiler_path', 'javascript_closurecompiler_path') + return \ executable("java") && - \ exists("g:syntastic_javascript_closure_compiler_path") && - \ filereadable(g:syntastic_javascript_closure_compiler_path) + \ exists("g:syntastic_javascript_closurecompiler_path") && + \ filereadable(g:syntastic_javascript_closurecompiler_path) endfunction function! SyntaxCheckers_javascript_closurecompiler_GetLocList() dict - if exists("g:syntastic_javascript_closure_compiler_file_list") - let file_list = join(readfile(g:syntastic_javascript_closure_compiler_file_list)) + call syntastic#log#deprecationWarn('javascript_closure_compiler_options', 'javascript_closurecompiler_args') + call syntastic#log#deprecationWarn('javascript_closure_compiler_file_list', 'javascript_closurecompiler_file_list') + + if exists("g:syntastic_javascript_closurecompiler_file_list") + let file_list = join(readfile(g:syntastic_javascript_closurecompiler_file_list)) else let file_list = syntastic#util#shexpand('%') endif let makeprg = self.makeprgBuild({ - \ 'exe': 'java -jar ' . g:syntastic_javascript_closure_compiler_path, - \ 'args': g:syntastic_javascript_closure_compiler_options, + \ 'exe_after': '-jar ' . g:syntastic_javascript_closurecompiler_path, \ 'args_after': '--js' , \ 'fname': file_list }) diff --git a/syntax_checkers/javascript/eslint.vim b/syntax_checkers/javascript/eslint.vim index d416a4dd9..96919c8fd 100644 --- a/syntax_checkers/javascript/eslint.vim +++ b/syntax_checkers/javascript/eslint.vim @@ -14,10 +14,6 @@ if exists('g:loaded_syntastic_javascript_eslint_checker') endif let g:loaded_syntastic_javascript_eslint_checker = 1 -if !exists('g:syntastic_javascript_eslint_conf') - let g:syntastic_javascript_eslint_conf = '' -endif - let s:save_cpo = &cpo set cpo&vim @@ -28,10 +24,10 @@ function! SyntaxCheckers_javascript_eslint_IsAvailable() dict endfunction function! SyntaxCheckers_javascript_eslint_GetLocList() dict - let makeprg = self.makeprgBuild({ - \ 'args_before': '-f compact', - \ 'args': (g:syntastic_javascript_eslint_conf != '' ? - \ '--config ' . syntastic#util#shexpand(g:syntastic_javascript_eslint_conf) : '') }) + call syntastic#log#deprecationWarn('javascript_eslint_conf', 'javascript_eslint_args', + \ "'--config ' . syntastic#util#shexpand(OLD_VAR)") + + let makeprg = self.makeprgBuild({ 'args_before': '-f compact' }) let errorformat = \ '%E%f: line %l\, col %c\, Error - %m,' . diff --git a/syntax_checkers/javascript/gjslint.vim b/syntax_checkers/javascript/gjslint.vim index 1b171c9cb..1704ac275 100644 --- a/syntax_checkers/javascript/gjslint.vim +++ b/syntax_checkers/javascript/gjslint.vim @@ -14,16 +14,13 @@ if exists("g:loaded_syntastic_javascript_gjslint_checker") endif let g:loaded_syntastic_javascript_gjslint_checker = 1 -if !exists("g:syntastic_javascript_gjslint_conf") - let g:syntastic_javascript_gjslint_conf = "" -endif - let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_javascript_gjslint_GetLocList() dict + call syntastic#log#deprecationWarn('javascript_gjslint_conf', 'javascript_gjslint_args') + let makeprg = self.makeprgBuild({ - \ 'args': g:syntastic_javascript_gjslint_conf, \ 'args_after': '--nosummary --unix_mode --nodebug_indentation --nobeep' }) let errorformat = diff --git a/syntax_checkers/javascript/jshint.vim b/syntax_checkers/javascript/jshint.vim index 712fe16ee..997871fec 100644 --- a/syntax_checkers/javascript/jshint.vim +++ b/syntax_checkers/javascript/jshint.vim @@ -14,34 +14,27 @@ if exists('g:loaded_syntastic_javascript_jshint_checker') endif let g:loaded_syntastic_javascript_jshint_checker = 1 -if !exists('g:syntastic_javascript_jshint_conf') - let g:syntastic_javascript_jshint_conf = '' -endif - let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_javascript_jshint_IsAvailable() dict - if !exists('g:syntastic_jshint_exec') - let g:syntastic_jshint_exec = self.getExec() - endif - if !executable(expand(g:syntastic_jshint_exec)) + call syntastic#log#deprecationWarn('jshint_exec', 'javascript_jshint_exec') + if !executable(self.getExec()) return 0 endif - let s:jshint_version = syntastic#util#getVersion(syntastic#util#shexpand(g:syntastic_jshint_exec) . ' --version') + let s:jshint_version = syntastic#util#getVersion(self.getExecEscaped() . ' --version') return syntastic#util#versionIsAtLeast(s:jshint_version, [1]) endfunction function! SyntaxCheckers_javascript_jshint_GetLocList() dict + call syntastic#log#deprecationWarn('javascript_jshint_conf', 'javascript_jshint_args', + \ "'--config ' . syntastic#util#shexpand(OLD_VAR)") + if !exists('s:jshint_new') let s:jshint_new = syntastic#util#versionIsAtLeast(s:jshint_version, [1, 1]) endif - let makeprg = self.makeprgBuild({ - \ 'exe': syntastic#util#shexpand(g:syntastic_jshint_exec), - \ 'args': (g:syntastic_javascript_jshint_conf != '' ? - \ '--config ' . syntastic#util#shexpand(g:syntastic_javascript_jshint_conf) : ''), - \ 'args_after': (s:jshint_new ? '--verbose ' : '') }) + let makeprg = self.makeprgBuild({ 'args_after': (s:jshint_new ? '--verbose ' : '') }) let errorformat = s:jshint_new ? \ '%A%f: line %l\, col %v\, %m \(%t%*\d\)' : diff --git a/syntax_checkers/javascript/jsl.vim b/syntax_checkers/javascript/jsl.vim index 13328c206..8f4148d68 100644 --- a/syntax_checkers/javascript/jsl.vim +++ b/syntax_checkers/javascript/jsl.vim @@ -14,17 +14,14 @@ if exists("g:loaded_syntastic_javascript_jsl_checker") endif let g:loaded_syntastic_javascript_jsl_checker = 1 -if !exists("g:syntastic_javascript_jsl_conf") - let g:syntastic_javascript_jsl_conf = "" -endif - let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_javascript_jsl_GetLocList() dict + call syntastic#log#deprecationWarn('javascript_jsl_conf', 'javascript_jsl_args', + \ "'-conf ' . syntastic#util#shexpand(OLD_VAR)") + let makeprg = self.makeprgBuild({ - \ 'args': (g:syntastic_javascript_jsl_conf != '' ? - \ '-conf ' . syntastic#util#shexpand(g:syntastic_javascript_jsl_conf) : ''), \ 'args_after': '-nologo -nofilelisting -nosummary -nocontext -process' }) let errorformat = diff --git a/syntax_checkers/perl/perl.vim b/syntax_checkers/perl/perl.vim index 2ac6ec981..553c55a5a 100644 --- a/syntax_checkers/perl/perl.vim +++ b/syntax_checkers/perl/perl.vim @@ -50,25 +50,25 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_perl_perl_IsAvailable() dict - if !exists('g:syntastic_perl_interpreter') - let g:syntastic_perl_interpreter = self.getExec() + if !exists('g:syntastic_perl_perl_exec') && exists('g:syntastic_perl_interpreter') + let g:syntastic_perl_perl_exec = g:syntastic_perl_interpreter endif " don't call executable() here, to allow things like " let g:syntastic_perl_interpreter='/usr/bin/env perl' - silent! call system(syntastic#util#shexpand(g:syntastic_perl_interpreter) . ' -e ' . syntastic#util#shescape('exit(0)')) + silent! call system(self.getExecEscaped() . ' -e ' . syntastic#util#shescape('exit(0)')) return v:shell_error == 0 endfunction function! SyntaxCheckers_perl_perl_GetLocList() dict if !exists('g:syntastic_enable_perl_checker') || !g:syntastic_enable_perl_checker - call syntastic#log#error('checker perl/perl: checks disabled for security reasons; set g:syntastic_enable_perl_checker to 1 to override') + call syntastic#log#error('checker perl/perl: checks disabled for security reasons; ' . + \ 'set g:syntastic_enable_perl_checker to 1 to override') return [] endif - let exe = expand(g:syntastic_perl_interpreter) if type(g:syntastic_perl_lib_path) == type('') - call syntastic#log#deprecationWarn('variable g:syntastic_perl_lib_path should be a list') + call syntastic#log#oneTimeWarn('variable g:syntastic_perl_lib_path should be a list') let includes = split(g:syntastic_perl_lib_path, ',') else let includes = copy(syntastic#util#var('perl_lib_path')) @@ -79,9 +79,7 @@ function! SyntaxCheckers_perl_perl_GetLocList() dict \ (index(shebang['args'], '-t') >= 0 ? ' -t' : '') let errorformat = '%f:%l:%m' - let makeprg = self.makeprgBuild({ - \ 'exe': exe, - \ 'args_before': '-c -X ' . extra }) + let makeprg = self.makeprgBuild({ 'args_before': '-c -X ' . extra }) let errors = SyntasticMake({ \ 'makeprg': makeprg, @@ -92,9 +90,7 @@ function! SyntaxCheckers_perl_perl_GetLocList() dict return errors endif - let makeprg = self.makeprgBuild({ - \ 'exe': exe, - \ 'args_before': '-c -Mwarnings ' . extra }) + let makeprg = self.makeprgBuild({ 'args_before': '-c -Mwarnings ' . extra }) return SyntasticMake({ \ 'makeprg': makeprg, diff --git a/syntax_checkers/puppet/puppetlint.vim b/syntax_checkers/puppet/puppetlint.vim index 2a32a8fae..ff4ba0712 100644 --- a/syntax_checkers/puppet/puppetlint.vim +++ b/syntax_checkers/puppet/puppetlint.vim @@ -18,11 +18,6 @@ let g:loaded_syntastic_puppet_puppetlint_checker = 1 let s:save_cpo = &cpo set cpo&vim -if exists("g:syntastic_puppet_lint_arguments") - let g:syntastic_puppet_puppetlint_args = g:syntastic_puppet_lint_arguments - call syntastic#log#deprecationWarn("variable g:syntastic_puppet_lint_arguments is deprecated, please use g:syntastic_puppet_puppetlint_args instead") -endif - function! SyntaxCheckers_puppet_puppetlint_IsAvailable() dict return \ executable("puppet") && @@ -32,6 +27,8 @@ function! SyntaxCheckers_puppet_puppetlint_IsAvailable() dict endfunction function! SyntaxCheckers_puppet_puppetlint_GetLocList() dict + call syntastic#log#deprecationWarn('puppet_lint_arguments', 'puppet_puppetlint_args') + let makeprg = self.makeprgBuild({ \ 'args_after': '--log-format "%{KIND} [%{check}] %{message} at %{fullpath}:%{linenumber}"' }) diff --git a/syntax_checkers/ruby/jruby.vim b/syntax_checkers/ruby/jruby.vim index fc7ea63e7..9dba591a3 100644 --- a/syntax_checkers/ruby/jruby.vim +++ b/syntax_checkers/ruby/jruby.vim @@ -19,17 +19,9 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_ruby_jruby_GetLocList() dict - if syntastic#util#isRunningWindows() - let exe = self.getExecEscaped() - let args = '-T1' - else - let exe = 'RUBYOPT= ' . self.getExecEscaped() - let args = '' - endif - let makeprg = self.makeprgBuild({ - \ 'exe': exe, - \ 'args': args, + \ 'exe_before': (syntastic#util#isRunningWindows() ? '' : 'RUBYOPT='), + \ 'args': (syntastic#util#isRunningWindows() ? '-T1' : ''), \ 'args_after': '-W1 -c' }) let errorformat = diff --git a/syntax_checkers/ruby/macruby.vim b/syntax_checkers/ruby/macruby.vim index d66595ca1..a5fc1c40e 100644 --- a/syntax_checkers/ruby/macruby.vim +++ b/syntax_checkers/ruby/macruby.vim @@ -19,7 +19,7 @@ set cpo&vim function! SyntaxCheckers_ruby_macruby_GetLocList() dict let makeprg = self.makeprgBuild({ - \ 'exe': 'RUBYOPT= ' . self.getExecEscaped(), + \ 'exe_before': 'RUBYOPT=', \ 'args_after': '-W1 -c' }) let errorformat = diff --git a/syntax_checkers/ruby/mri.vim b/syntax_checkers/ruby/mri.vim index aa7de2679..08af1b45b 100644 --- a/syntax_checkers/ruby/mri.vim +++ b/syntax_checkers/ruby/mri.vim @@ -18,6 +18,13 @@ let g:loaded_syntastic_ruby_mri_checker = 1 let s:save_cpo = &cpo set cpo&vim +function! SyntaxCheckers_ruby_mri_IsAvailable() dict + if !exists('g:syntastic_ruby_mri_exec') && exists('g:syntastic_ruby_exec') + let g:syntastic_ruby_mri_exec = g:syntastic_ruby_exec + endif + return executable(self.getExec()) +endfunction + function! SyntaxCheckers_ruby_mri_GetHighlightRegex(i) if stridx(a:i['text'], 'assigned but unused variable') >= 0 let term = split(a:i['text'], ' - ')[1] @@ -28,17 +35,8 @@ function! SyntaxCheckers_ruby_mri_GetHighlightRegex(i) endfunction function! SyntaxCheckers_ruby_mri_GetLocList() dict - if !exists('g:syntastic_ruby_exec') - let g:syntastic_ruby_exec = self.getExec() - endif - - let exe = syntastic#util#shexpand(g:syntastic_ruby_exec) - if !syntastic#util#isRunningWindows() - let exe = 'RUBYOPT= ' . exe - endif - let makeprg = self.makeprgBuild({ - \ 'exe': exe, + \ 'exe_before': (syntastic#util#isRunningWindows() ? '' : 'RUBYOPT='), \ 'args_after': '-w -T1 -c' }) "this is a hack to filter out a repeated useless warning in rspec files diff --git a/syntax_checkers/scala/fsc.vim b/syntax_checkers/scala/fsc.vim index 929124230..6f1fcf6d3 100644 --- a/syntax_checkers/scala/fsc.vim +++ b/syntax_checkers/scala/fsc.vim @@ -15,19 +15,16 @@ if exists('g:loaded_syntastic_scala_fsc_checker') endif let g:loaded_syntastic_scala_fsc_checker = 1 -if !exists('g:syntastic_scala_options') - let g:syntastic_scala_options = '' -endif - let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_scala_fsc_GetLocList() dict + call syntastic#log#deprecationWarn('scala_options', 'scala_fsc_args') + " fsc has some serious problems with the " working directory changing after being started " that's why we better pass an absolute path let makeprg = self.makeprgBuild({ - \ 'args': g:syntastic_scala_options, \ 'args_after': '-Ystop-after:parser', \ 'fname': syntastic#util#shexpand('%:p') }) diff --git a/syntax_checkers/scala/scalac.vim b/syntax_checkers/scala/scalac.vim index ea465f080..0d0c15aa5 100644 --- a/syntax_checkers/scala/scalac.vim +++ b/syntax_checkers/scala/scalac.vim @@ -15,17 +15,13 @@ if exists("g:loaded_syntastic_scala_scalac_checker") endif let g:loaded_syntastic_scala_scalac_checker = 1 -if !exists('g:syntastic_scala_options') - let g:syntastic_scala_options = '' -endif - let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_scala_scalac_GetLocList() dict - let makeprg = self.makeprgBuild({ - \ 'args': g:syntastic_scala_options, - \ 'args_after': '-Ystop-after:parser' }) + call syntastic#log#deprecationWarn('scala_options', 'scala_scalac_args') + + let makeprg = self.makeprgBuild({ 'args_after': '-Ystop-after:parser' }) let errorformat = \ '%E%f:%l: %trror: %m,' . diff --git a/syntax_checkers/sh/sh.vim b/syntax_checkers/sh/sh.vim index 5c3a4f848..d736f2968 100644 --- a/syntax_checkers/sh/sh.vim +++ b/syntax_checkers/sh/sh.vim @@ -18,16 +18,40 @@ let g:loaded_syntastic_sh_sh_checker = 1 let s:save_cpo = &cpo set cpo&vim +function! SyntaxCheckers_sh_sh_IsAvailable() dict + return s:IsShellValid() +endfunction + +function! SyntaxCheckers_sh_sh_GetLocList() dict + if s:GetShell() ==# 'zsh' + return s:ForwardToZshChecker() + endif + + if !s:IsShellValid() + return [] + endif + + let makeprg = self.makeprgBuild({ + \ 'exe': s:GetShell(), + \ 'args_after': '-n' }) + + let errorformat = '%f: line %l: %m' + + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat }) +endfunction + function! s:GetShell() if !exists('b:shell') || b:shell == '' let b:shell = '' - let shebang = getbufline(bufnr('%'), 1)[0] + let shebang = syntastic#util#parseShebang()['exe'] if shebang != '' - if stridx(shebang, 'bash') >= 0 + if shebang[-strlen('bash'):-1] ==# 'bash' let b:shell = 'bash' - elseif stridx(shebang, 'zsh') >= 0 + elseif shebang[-strlen('zsh'):-1] ==# 'zsh' let b:shell = 'zsh' - elseif stridx(shebang, 'sh') >= 0 + elseif shebang[-strlen('sh'):-1] ==# 'sh' let b:shell = 'sh' endif endif @@ -39,6 +63,11 @@ function! s:GetShell() return b:shell endfunction +function! s:IsShellValid() + let shell = s:GetShell() + return shell != '' && executable(shell) +endfunction + function! s:ForwardToZshChecker() let registry = g:SyntasticRegistry.Instance() let zsh_checkers = registry.getCheckersAvailable('zsh', ['zsh']) @@ -49,35 +78,6 @@ function! s:ForwardToZshChecker() endif endfunction -function! s:IsShellValid() - return len(s:GetShell()) > 0 && executable(s:GetShell()) -endfunction - - -function! SyntaxCheckers_sh_sh_IsAvailable() dict - return s:IsShellValid() -endfunction - -function! SyntaxCheckers_sh_sh_GetLocList() dict - if s:GetShell() ==# 'zsh' - return s:ForwardToZshChecker() - endif - - if !s:IsShellValid() - return [] - endif - - let makeprg = self.makeprgBuild({ - \ 'exe': s:GetShell(), - \ 'args_after': '-n' }) - - 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/vim/vimlint.vim b/syntax_checkers/vim/vimlint.vim index 49a6ecd32..f7f76a16e 100644 --- a/syntax_checkers/vim/vimlint.vim +++ b/syntax_checkers/vim/vimlint.vim @@ -81,7 +81,8 @@ endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'vim', - \ 'name': 'vimlint'}) + \ 'name': 'vimlint', + \ 'exec': 'vim' }) let &cpo = s:save_cpo unlet s:save_cpo diff --git a/syntax_checkers/yaml/yamlxs.vim b/syntax_checkers/yaml/yamlxs.vim index e9d337718..6c12a6273 100644 --- a/syntax_checkers/yaml/yamlxs.vim +++ b/syntax_checkers/yaml/yamlxs.vim @@ -24,19 +24,18 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_yaml_yamlxs_IsAvailable() dict - if !exists('g:syntastic_perl_interpreter') - let g:syntastic_perl_interpreter = self.getExec() + if !exists('g:syntastic_yaml_yamlxs_exec') && exists('g:syntastic_perl_interpreter') + let g:syntastic_yaml_yamlxs_exec = g:syntastic_perl_interpreter endif " don't call executable() here, to allow things like " let g:syntastic_perl_interpreter='/usr/bin/env perl' - silent! call system(s:Exe() . ' ' . s:Modules() . ' -e ' . syntastic#util#shescape('exit(0)')) + silent! call system(self.getExecEscaped() . ' ' . s:Modules() . ' -e ' . syntastic#util#shescape('exit(0)')) return v:shell_error == 0 endfunction function! SyntaxCheckers_yaml_yamlxs_GetLocList() dict let makeprg = self.makeprgBuild({ - \ 'exe': s:Exe(), \ 'args_before': s:Modules() . ' -e ' . syntastic#util#shescape('YAML::XS::LoadFile($ARGV[0])') }) let errorformat = @@ -53,13 +52,9 @@ function! SyntaxCheckers_yaml_yamlxs_GetLocList() dict \ 'defaults': {'bufnr': bufnr("")} }) endfunction -function! s:Exe() - return syntastic#util#shexpand(g:syntastic_perl_interpreter) -endfunction - function s:Modules() if type(g:syntastic_perl_lib_path) == type('') - call syntastic#log#deprecationWarn('variable g:syntastic_perl_lib_path should be a list') + call syntastic#log#oneTimeWarn('variable g:syntastic_perl_lib_path should be a list') let includes = split(g:syntastic_perl_lib_path, ',') else let includes = copy(syntastic#util#var('perl_lib_path')) From 2aaeca69052a649fe78735d54af1d4ec1fb14804 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 27 Jun 2014 22:34:44 +0300 Subject: [PATCH 0552/1271] Bug fix: refresh notifiers in BufEnter, rather than BufWinEnter. --- plugin/syntastic.vim | 34 +++++++++++++--------------------- 1 file changed, 13 insertions(+), 21 deletions(-) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index e39cd09fd..268096e67 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -19,7 +19,7 @@ if has('reltime') lockvar! g:syntastic_start endif -let g:syntastic_version = '3.4.0-88' +let g:syntastic_version = '3.4.0-89' lockvar g:syntastic_version " Sanity checks {{{1 @@ -181,11 +181,6 @@ command! SyntasticSetLoclist call g:SyntasticLoclist.current().setloclist() augroup syntastic autocmd BufReadPost * call s:BufReadPostHook() autocmd BufWritePost * call s:BufWritePostHook() - - autocmd BufWinEnter * call s:BufWinEnterHook() - - " TODO: the next autocmd should be "autocmd BufWinLeave * if &buftype == '' | lclose | endif" - " but in recent versions of Vim lclose can no longer be called from BufWinLeave autocmd BufEnter * call s:BufEnterHook() augroup END @@ -210,25 +205,22 @@ function! s:BufWritePostHook() " {{{2 call s:UpdateErrors(1) endfunction " }}}2 -function! s:BufWinEnterHook() " {{{2 - call syntastic#log#debug(g:SyntasticDebugAutocommands, - \ 'autocmd: BufWinEnter, buffer ' . bufnr("") . ' = ' . string(bufname(str2nr(bufnr("")))) . - \ ', &buftype = ' . string(&buftype)) - if &buftype == '' - call s:notifiers.refresh(g:SyntasticLoclist.current()) - endif -endfunction " }}}2 - function! s:BufEnterHook() " {{{2 call syntastic#log#debug(g:SyntasticDebugAutocommands, \ 'autocmd: BufEnter, buffer ' . bufnr("") . ' = ' . string(bufname(str2nr(bufnr("")))) . \ ', &buftype = ' . string(&buftype)) - " TODO: at this point there is no b:syntastic_loclist - let loclist = filter(copy(getloclist(0)), 'v:val["valid"] == 1') - let owner = str2nr(getbufvar(bufnr(""), 'syntastic_owner_buffer')) - let buffers = syntastic#util#unique(map(loclist, 'v:val["bufnr"]') + (owner ? [owner] : [])) - if &buftype == 'quickfix' && !empty(loclist) && empty(filter( buffers, 'syntastic#util#bufIsActive(v:val)' )) - call SyntasticLoclistHide() + if &buftype == '' + call s:notifiers.refresh(g:SyntasticLoclist.current()) + elseif &buftype == 'quickfix' + " TODO: this is needed because in recent versions of Vim lclose + " can no longer be called from BufWinLeave + " TODO: at this point there is no b:syntastic_loclist + let loclist = filter(copy(getloclist(0)), 'v:val["valid"] == 1') + let owner = str2nr(getbufvar(bufnr(""), 'syntastic_owner_buffer')) + let buffers = syntastic#util#unique(map(loclist, 'v:val["bufnr"]') + (owner ? [owner] : [])) + if !empty(loclist) && empty(filter( buffers, 'syntastic#util#bufIsActive(v:val)' )) + call SyntasticLoclistHide() + endif endif endfunction " }}}2 From 0fe070414ff812f6c55a80e48a74eca7995a2c89 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Mon, 30 Jun 2014 14:45:30 +0300 Subject: [PATCH 0553/1271] Error highlighting cleanup. --- autoload/syntastic/log.vim | 2 ++ plugin/syntastic.vim | 2 +- plugin/syntastic/checker.vim | 2 +- syntax_checkers/dart/dartanalyzer.vim | 2 +- syntax_checkers/haxe/haxe.vim | 2 +- syntax_checkers/javascript/jslint.vim | 2 +- syntax_checkers/python/pyflakes.vim | 12 ++++++------ syntax_checkers/vala/valac.vim | 2 +- syntax_checkers/vim/vimlint.vim | 2 +- 9 files changed, 15 insertions(+), 13 deletions(-) diff --git a/autoload/syntastic/log.vim b/autoload/syntastic/log.vim index f206dfeb2..e227f53ea 100644 --- a/autoload/syntastic/log.vim +++ b/autoload/syntastic/log.vim @@ -36,6 +36,7 @@ function! syntastic#log#oneTimeWarn(msg) " {{{2 call syntastic#log#warn(a:msg) endfunction " }}}2 +" @vimlint(EVL102, 1, l:OLD_VAR) function! syntastic#log#deprecationWarn(old, new, ...) " {{{2 if exists('g:syntastic_' . a:old) && !exists('g:syntastic_' . a:new) let msg = 'variable g:syntastic_' . a:old . ' is deprecated, please use ' @@ -57,6 +58,7 @@ function! syntastic#log#deprecationWarn(old, new, ...) " {{{2 call syntastic#log#oneTimeWarn(msg) endif endfunction " }}}2 +" @vimlint(EVL102, 0, l:OLD_VAR) function! syntastic#log#debug(level, msg, ...) " {{{2 if !s:isDebugEnabled(a:level) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 268096e67..f3724d9fe 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -19,7 +19,7 @@ if has('reltime') lockvar! g:syntastic_start endif -let g:syntastic_version = '3.4.0-89' +let g:syntastic_version = '3.4.0-90' lockvar g:syntastic_version " Sanity checks {{{1 diff --git a/plugin/syntastic/checker.vim b/plugin/syntastic/checker.vim index c3655f7fc..273f05210 100644 --- a/plugin/syntastic/checker.vim +++ b/plugin/syntastic/checker.vim @@ -138,7 +138,7 @@ function! g:SyntasticChecker._populateHighlightRegexes(errors) " {{{2 for e in a:errors if e['valid'] let term = self._highlightRegexFunc(e) - if len(term) > 0 + if term != '' let e['hl'] = term endif endif diff --git a/syntax_checkers/dart/dartanalyzer.vim b/syntax_checkers/dart/dartanalyzer.vim index 9ff55a4ac..edf71df3b 100644 --- a/syntax_checkers/dart/dartanalyzer.vim +++ b/syntax_checkers/dart/dartanalyzer.vim @@ -21,7 +21,7 @@ function! SyntaxCheckers_dart_dartanalyzer_GetHighlightRegex(error) if a:error['len'] let lcol = a:error['col'] - 1 let rcol = a:error['col'] + a:error['len'] - let ret = '\%>' . lcol . 'c.*\%<' . rcol . 'c' + let ret = '\%>' . lcol . 'c\%<' . rcol . 'c' else let ret = '' endif diff --git a/syntax_checkers/haxe/haxe.vim b/syntax_checkers/haxe/haxe.vim index fd2385f92..90589420e 100644 --- a/syntax_checkers/haxe/haxe.vim +++ b/syntax_checkers/haxe/haxe.vim @@ -40,7 +40,7 @@ function! SyntaxCheckers_haxe_haxe_GetLocList() dict \ 'cwd': fnamemodify(hxml, ':h') }) for e in loclist - let e['hl'] = '\%>' . e['col'] . 'c.*\%<' . (e['nr'] + 1) . 'c' + let e['hl'] = '\%>' . e['col'] . 'c\%<' . (e['nr'] + 1) . 'c' let e['col'] += 1 let e['nr'] = 0 endfor diff --git a/syntax_checkers/javascript/jslint.vim b/syntax_checkers/javascript/jslint.vim index 89d3a8029..63bb41010 100644 --- a/syntax_checkers/javascript/jslint.vim +++ b/syntax_checkers/javascript/jslint.vim @@ -22,7 +22,7 @@ set cpo&vim function! SyntaxCheckers_javascript_jslint_GetHighlightRegex(item) let term = matchstr(a:item['text'], '\mExpected .* and instead saw ''\zs.*\ze''') if term != '' - let term = '\V' . escape(term, '\') + let term = '\V\<' . escape(term, '\') . '\>' endif return term endfunction diff --git a/syntax_checkers/python/pyflakes.vim b/syntax_checkers/python/pyflakes.vim index 869aa0abd..351eb2061 100644 --- a/syntax_checkers/python/pyflakes.vim +++ b/syntax_checkers/python/pyflakes.vim @@ -26,14 +26,14 @@ function! SyntaxCheckers_python_pyflakes_GetHighlightRegex(i) \ || stridx(a:i['text'], 'shadowed by loop variable') >= 0 " fun with Python's %r: try "..." first, then '...' - let terms = split(a:i['text'], '"', 1) - if len(terms) > 2 - return terms[1] + let term = matchstr(a:i['text'], '\m^.\{-}"\zs.\{-1,}\ze"') + if term != '' + return '\V\<' . escape(term, '\') . '\>' endif - let terms = split(a:i['text'], "'", 1) - if len(terms) > 2 - return terms[1] + let term = matchstr(a:i['text'], '\m^.\{-}''\zs.\{-1,}\ze''') + if term != '' + return '\V\<' . escape(term, '\') . '\>' endif endif return '' diff --git a/syntax_checkers/vala/valac.vim b/syntax_checkers/vala/valac.vim index e6c1b88db..912e298d4 100644 --- a/syntax_checkers/vala/valac.vim +++ b/syntax_checkers/vala/valac.vim @@ -37,7 +37,7 @@ set cpo&vim function! SyntaxCheckers_vala_valac_GetHighlightRegex(pos) let length = strlen(matchstr(a:pos['text'], '\m\^\+$')) - return '\%>' . (a:pos['col'] - 1) . 'c.*\%<' . (a:pos['col'] + length + 1) . 'c' + return '\%>' . (a:pos['col'] - 1) . 'c\%<' . (a:pos['col'] + length) . 'c' endfunction function! s:GetValaModules() diff --git a/syntax_checkers/vim/vimlint.vim b/syntax_checkers/vim/vimlint.vim index f7f76a16e..309e5878d 100644 --- a/syntax_checkers/vim/vimlint.vim +++ b/syntax_checkers/vim/vimlint.vim @@ -29,7 +29,7 @@ function! SyntaxCheckers_vim_vimlint_GetHighlightRegex(item) endif endif - return '\V' . (col ? '\%' . col . 'c' : '') . escape(term, '\') + return col ? '\%>' . (col - 1) . 'c\%<' . (col + strlen(term)) . 'c' : '\V' . escape(term, '\') endif return '' From c56a98610dfd030f690b28b0fb9f1d7e41c03962 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 4 Jul 2014 23:12:12 +0300 Subject: [PATCH 0554/1271] Manual: add a note about netrw. --- doc/syntastic.txt | 33 +++++++++++++++++++++------------ plugin/syntastic.vim | 2 +- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/doc/syntastic.txt b/doc/syntastic.txt index bb2220947..fbcedf50f 100644 --- a/doc/syntastic.txt +++ b/doc/syntastic.txt @@ -36,12 +36,13 @@ CONTENTS *syntastic-contents* 5.3.Configuring specific checkers..........|syntastic-config-makeprg| 6.Notes........................................|syntastic-notes| 6.1.Handling of composite filetypes........|syntastic-composite| - 6.2.Interaction with python-mode...........|syntastic-pymode| - 6.3.Interaction with the fish shell........|syntastic-fish| - 6.4.Interaction with PowerShell............|syntastic-powershell| - 6.5.Using syntastic with the fizsh shell...|syntastic-fizsh| - 6.6.Interaction with Eclim.................|syntastic-eclim| - 6.7.Interaction with vim-virtualenv........|syntastic-vim-virtualenv| + 6.2.Editing files over network.............|syntastic-netrw| + 6.3.Interaction with python-mode...........|syntastic-pymode| + 6.4.Interaction with the fish shell........|syntastic-fish| + 6.5.Interaction with PowerShell............|syntastic-powershell| + 6.6.Using syntastic with the fizsh shell...|syntastic-fizsh| + 6.7.Interaction with Eclim.................|syntastic-eclim| + 6.8.Interaction with vim-virtualenv........|syntastic-vim-virtualenv| 7.About........................................|syntastic-about| 8.License......................................|syntastic-license| @@ -649,7 +650,15 @@ composite filetypes to a simple ones using |syntastic_filetype_map|, e.g.: > let g:syntastic_filetype_map = { 'handlebars.html': 'handlebars' } < ------------------------------------------------------------------------------ -6.2 Interaction with python-mode *syntastic-pymode* +6.2 Editing files over network *syntastic-netrw* + +The standard plugin |netrw| allows Vim to transparently edit files over +network and inside archives. Currently syntastic doesn't support this mode +of operation. It can only check files that can be accessed directly by local +checkers, without any translation or conversion. + +------------------------------------------------------------------------------ +6.3 Interaction with python-mode *syntastic-pymode* Syntastic can be used along with the 'python-mode' Vim plugin (see https://github.com/klen/python-mode). However, they both run syntax checks by @@ -660,7 +669,7 @@ python-mode, by setting |pymode_lint_write| to 0. E.g.: > let g:pymode_lint_write = 0 < ------------------------------------------------------------------------------ -6.3 Interaction with the fish shell *syntastic-fish* +6.4 Interaction with the fish shell *syntastic-fish* At the time of this writing the 'fish' shell (see http://fishshell.com/) doesn't support the standard UNIX syntax for file redirections, and thus it @@ -671,7 +680,7 @@ traditional shell, such as 'zsh', 'bash', 'ksh', or even the original Bourne set shell=bash < ------------------------------------------------------------------------------ -6.4. Interaction with PowerShell *syntastic-powershell* +6.5. Interaction with PowerShell *syntastic-powershell* At the time of this writing, syntastic is not compatible with using 'Windows PowerShell' (http://technet.microsoft.com/en-us/library/bb978526.aspx) as Vim's @@ -680,7 +689,7 @@ Vim's 'shell' to a more traditional program, such as 'cmd.exe': > set shell=cmd.exe < ------------------------------------------------------------------------------ -6.5. Using syntastic with the fizsh shell *syntastic-fizsh* +6.6. Using syntastic with the fizsh shell *syntastic-fizsh* Using syntastic with the 'fizsh' shell (see https://github.com/zsh-users/fizsh) is possible, but potentially problematic. In order to do it you'll need to set @@ -693,7 +702,7 @@ interactive features of 'fizsh'. Using a more traditional shell such as 'zsh', set shell=zsh < ------------------------------------------------------------------------------ -6.6. Interaction with Eclim *syntastic-eclim* +6.7. Interaction with Eclim *syntastic-eclim* As far as syntastic is concerned there shouldn't be any compatibility problems with the 'Eclim' Vim plugin (see http://eclim.org/). However, at the time of @@ -702,7 +711,7 @@ makes syntastic forget some of its configuration parameters. No solutions or workarounds are known for now. ------------------------------------------------------------------------------ -6.7. Interaction with vim-virtualenv *syntastic-vim-virtualenv* +6.8. Interaction with vim-virtualenv *syntastic-vim-virtualenv* At the time of this writing, syntastic can't run checkers installed in Python virtual environments activated by 'vim-virtualenv' (see diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index f3724d9fe..3b42ee64b 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -19,7 +19,7 @@ if has('reltime') lockvar! g:syntastic_start endif -let g:syntastic_version = '3.4.0-90' +let g:syntastic_version = '3.4.0-91' lockvar g:syntastic_version " Sanity checks {{{1 From 95fa882175cf682b313e9607bd4e6b11b27bbb27 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Sun, 6 Jul 2014 18:18:43 +0300 Subject: [PATCH 0555/1271] Make syntastic#util#parseShebang() aware of /usr/bin/env. --- autoload/syntastic/util.vim | 8 ++++---- plugin/syntastic.vim | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/autoload/syntastic/util.vim b/autoload/syntastic/util.vim index b4b900b1a..982366c4d 100644 --- a/autoload/syntastic/util.vim +++ b/autoload/syntastic/util.vim @@ -35,12 +35,12 @@ endfunction " }}}2 " "{'exe': '/usr/bin/perl', 'args': ['-f', '-bar']} function! syntastic#util#parseShebang() " {{{2 - for lnum in range(1,5) + for lnum in range(1, 5) let line = getline(lnum) - if line =~ '^#!' - let exe = matchstr(line, '\m^#!\s*\zs[^ \t]*') - let args = split(matchstr(line, '\m^#!\s*[^ \t]*\zs.*')) + let line = substitute(line, '\v^#!\s*(\S+/env(\s+-\S+)*\s+)?', '', '') + let exe = matchstr(line, '\m^\S*\ze') + let args = split(matchstr(line, '\m^\S*\zs.*')) return { 'exe': exe, 'args': args } endif endfor diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 3b42ee64b..5e84bd9e1 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -19,7 +19,7 @@ if has('reltime') lockvar! g:syntastic_start endif -let g:syntastic_version = '3.4.0-91' +let g:syntastic_version = '3.4.0-92' lockvar g:syntastic_version " Sanity checks {{{1 From 03454c83f9c7bdd0e42ffcf8f0f60479af55af77 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Mon, 7 Jul 2014 19:04:22 +0300 Subject: [PATCH 0556/1271] New option for SyntasticMake(): env. Setting environment variables by prefixing commands with 'VARIABLE=value' doesn't work under csh. Solution: let Vim set the environment variables. --- plugin/syntastic.vim | 25 ++++++++++++++++++++++++- syntax_checkers/eruby/ruby.vim | 21 +++++++-------------- syntax_checkers/html/tidy.vim | 4 +--- syntax_checkers/java/javac.vim | 3 +-- syntax_checkers/python/flake8.vim | 8 +++++--- syntax_checkers/python/frosted.vim | 7 ++++--- syntax_checkers/python/pep257.vim | 6 ++++-- syntax_checkers/python/pep8.vim | 6 ++++-- syntax_checkers/python/py3kwarn.vim | 8 +++++--- syntax_checkers/python/pyflakes.vim | 6 ++++-- syntax_checkers/python/pylama.vim | 9 +++++---- syntax_checkers/python/pylint.vim | 4 +++- syntax_checkers/python/python.vim | 7 ++++--- syntax_checkers/ruby/jruby.vim | 6 ++++-- syntax_checkers/ruby/macruby.vim | 9 +++++---- syntax_checkers/ruby/mri.vim | 9 +++++---- 16 files changed, 85 insertions(+), 53 deletions(-) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 5e84bd9e1..176f50bd2 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -19,7 +19,7 @@ if has('reltime') lockvar! g:syntastic_start endif -let g:syntastic_version = '3.4.0-92' +let g:syntastic_version = '3.4.0-93' lockvar g:syntastic_version " Sanity checks {{{1 @@ -408,7 +408,9 @@ endfunction " }}}2 " 'preprocess' - a function to be applied to the error file before parsing errors " 'postprocess' - a list of functions to be applied to the error list " 'cwd' - change directory to the given path before running the checker +" 'env' - environment variables to set before running the checker " 'returns' - a list of valid exit codes for the checker +" @vimlint(EVL102, 1, l:env_save) function! SyntasticMake(options) " {{{2 call syntastic#log#debug(g:SyntasticDebugTrace, 'SyntasticMake: called with options:', a:options) @@ -432,11 +434,31 @@ function! SyntasticMake(options) " {{{2 execute 'lcd ' . fnameescape(a:options['cwd']) endif + " set environment variables {{{3 + let env_save = {} + if has_key(a:options, 'env') && len(a:options['env']) + for key in keys(a:options['env']) + if key =~? '\m^[a-z_]\+$' + exec 'let env_save[' . string(key) . '] = $' . key + exec 'let $' . key . ' = ' . string(a:options['env'][key]) + endif + endfor + endif let $LC_MESSAGES = 'C' let $LC_ALL = '' + " }}}3 + let err_lines = split(system(a:options['makeprg']), "\n", 1) + + " restore environment variables {{{3 let $LC_ALL = old_lc_all let $LC_MESSAGES = old_lc_messages + if len(env_save) + for key in keys(env_save) + exec 'let $' . key . ' = ' . string(env_save[key]) + endfor + endif + " }}}3 call syntastic#log#debug(g:SyntasticDebugLoclist, 'checker output:', err_lines) @@ -497,6 +519,7 @@ function! SyntasticMake(options) " {{{2 return errors endfunction " }}}2 +" @vimlint(EVL102, 0, l:env_save) "return a string representing the state of buffer according to "g:syntastic_stl_format diff --git a/syntax_checkers/eruby/ruby.vim b/syntax_checkers/eruby/ruby.vim index 47378e0fe..ea6b2f05d 100644 --- a/syntax_checkers/eruby/ruby.vim +++ b/syntax_checkers/eruby/ruby.vim @@ -22,24 +22,14 @@ function! SyntaxCheckers_eruby_ruby_IsAvailable() dict if !exists('g:syntastic_eruby_ruby_exec') && exists('g:syntastic_ruby_exec') let g:syntastic_eruby_ruby_exec = g:syntastic_ruby_exec endif - let s:exe = self.getExec() - - if executable(s:exe) - let s:exe = syntastic#util#shescape(s:exe) - if !syntastic#util#isRunningWindows() - let s:exe = 'RUBYOPT= ' . s:exe - endif - return 1 - endif - - return 0 + return executable(self.getExec()) endfunction function! SyntaxCheckers_eruby_ruby_GetLocList() dict let fname = "'" . escape(expand('%'), "\\'") . "'" " TODO: encodings became useful in ruby 1.9 :) - if syntastic#util#versionIsAtLeast(syntastic#util#getVersion(s:exe . ' --version'), [1, 9]) + if syntastic#util#versionIsAtLeast(syntastic#util#getVersion(self.getExecEscaped(). ' --version'), [1, 9]) let enc = &fileencoding != '' ? &fileencoding : &encoding let encoding_spec = ', :encoding => "' . (enc ==? 'utf-8' ? 'UTF-8' : 'BINARY') . '"' else @@ -48,11 +38,11 @@ function! SyntaxCheckers_eruby_ruby_GetLocList() dict "gsub fixes issue #7, rails has it's own eruby syntax let makeprg = - \ s:exe . ' -rerb -e ' . + \ self.getExecEscaped() . ' -rerb -e ' . \ syntastic#util#shescape('puts ERB.new(File.read(' . \ fname . encoding_spec . \ ').gsub(''<%='',''<%''), nil, ''-'').src') . - \ ' | ' . s:exe . ' -c' + \ ' | ' . self.getExecEscaped() . ' -c' let errorformat = \ '%-GSyntax OK,'. @@ -61,9 +51,12 @@ function! SyntaxCheckers_eruby_ruby_GetLocList() dict \ '%Z%p^,'. \ '%-C%.%#' + let env = syntastic#util#isRunningWindows() ? {} : { 'RUBYOPT': '' } + return SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, + \ 'env': env, \ 'defaults': { 'bufnr': bufnr(""), 'vcol': 1 } }) endfunction diff --git a/syntax_checkers/html/tidy.vim b/syntax_checkers/html/tidy.vim index c13451c3a..7dcf52234 100644 --- a/syntax_checkers/html/tidy.vim +++ b/syntax_checkers/html/tidy.vim @@ -186,9 +186,7 @@ function! s:Args() endfunction function! SyntaxCheckers_html_tidy_GetLocList() dict - let makeprg = self.makeprgBuild({ - \ 'args_after': s:Args(), - \ 'tail': '2>&1' }) + let makeprg = self.makeprgBuild({ 'args_after': s:Args() }) let errorformat = \ '%Wline %l column %v - Warning: %m,' . diff --git a/syntax_checkers/java/javac.vim b/syntax_checkers/java/javac.vim index ecf54725b..2e138bea6 100644 --- a/syntax_checkers/java/javac.vim +++ b/syntax_checkers/java/javac.vim @@ -399,8 +399,7 @@ function! SyntaxCheckers_java_javac_GetLocList() dict let makeprg = self.makeprgBuild({ \ 'args': javac_opts, - \ 'fname': syntastic#util#shescape(fname), - \ 'tail': '2>&1' }) + \ 'fname': syntastic#util#shescape(fname) }) " unashamedly stolen from *errorformat-javac* (quickfix.txt) and modified to include error types let errorformat = diff --git a/syntax_checkers/python/flake8.vim b/syntax_checkers/python/flake8.vim index ebc484f28..1e4f1c9b3 100644 --- a/syntax_checkers/python/flake8.vim +++ b/syntax_checkers/python/flake8.vim @@ -19,8 +19,7 @@ function! SyntaxCheckers_python_flake8_GetHighlightRegex(item) endfunction function! SyntaxCheckers_python_flake8_GetLocList() dict - let makeprg = self.makeprgBuild({ - \ 'exe_before': (syntastic#util#isRunningWindows() ? '' : 'TERM=dumb') }) + let makeprg = self.makeprgBuild({}) let errorformat = \ '%E%f:%l: could not compile,%-Z%p^,' . @@ -28,9 +27,12 @@ function! SyntaxCheckers_python_flake8_GetLocList() dict \ '%A%f:%l: %t%n %m,' . \ '%-G%.%#' + let env = syntastic#util#isRunningWindows() ? {} : { 'TERM': 'dumb' } + let loclist = SyntasticMake({ \ 'makeprg': makeprg, - \ 'errorformat': errorformat }) + \ 'errorformat': errorformat, + \ 'env': env }) for e in loclist " E*** and W*** are pep8 errors diff --git a/syntax_checkers/python/frosted.vim b/syntax_checkers/python/frosted.vim index e96a8cc17..e1284e444 100644 --- a/syntax_checkers/python/frosted.vim +++ b/syntax_checkers/python/frosted.vim @@ -19,9 +19,7 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_python_frosted_GetLocList() dict - let makeprg = self.makeprgBuild({ - \ 'exe_before': (syntastic#util#isRunningWindows() ? '' : 'TERM=dumb'), - \ 'args_after': '-vb' }) + let makeprg = self.makeprgBuild({ 'args_after': '-vb' }) let errorformat = \ '%f:%l:%c:%m,' . @@ -29,9 +27,12 @@ function! SyntaxCheckers_python_frosted_GetLocList() dict \ '%-Z%p^,' . \ '%-G%.%#' + let env = syntastic#util#isRunningWindows() ? {} : { 'TERM': 'dumb' } + let loclist = SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, + \ 'env': env, \ 'returns': [0, 1] }) for e in loclist diff --git a/syntax_checkers/python/pep257.vim b/syntax_checkers/python/pep257.vim index 60cf916ea..d4b165750 100644 --- a/syntax_checkers/python/pep257.vim +++ b/syntax_checkers/python/pep257.vim @@ -19,8 +19,7 @@ function! SyntaxCheckers_python_pep257_GetLocList() dict \ self.getExecEscaped() . ' --version'), [0, 3]) endif - let makeprg = self.makeprgBuild({ - \ 'exe_before': (syntastic#util#isRunningWindows() ? '' : 'TERM=dumb') }) + let makeprg = self.makeprgBuild({}) if s:pep257_new let errorformat = @@ -33,9 +32,12 @@ function! SyntaxCheckers_python_pep257_GetLocList() dict \ '%+C %m' endif + let env = syntastic#util#isRunningWindows() ? {} : { 'TERM': 'dumb' } + let loclist = SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, + \ 'env': env, \ 'subtype': 'Style', \ 'preprocess': 'killEmpty', \ 'postprocess': ['compressWhitespace'] }) diff --git a/syntax_checkers/python/pep8.vim b/syntax_checkers/python/pep8.vim index 64c9e640f..0f35c2767 100644 --- a/syntax_checkers/python/pep8.vim +++ b/syntax_checkers/python/pep8.vim @@ -21,14 +21,16 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_python_pep8_GetLocList() dict - let makeprg = self.makeprgBuild({ - \ 'exe_before': (syntastic#util#isRunningWindows() ? '' : 'TERM=dumb') }) + let makeprg = self.makeprgBuild({}) let errorformat = '%f:%l:%c: %m' + let env = syntastic#util#isRunningWindows() ? {} : { 'TERM': 'dumb' } + let loclist = SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, + \ 'env': env, \ 'subtype': 'Style' }) for e in loclist diff --git a/syntax_checkers/python/py3kwarn.vim b/syntax_checkers/python/py3kwarn.vim index 1a4465e01..69a3060fc 100644 --- a/syntax_checkers/python/py3kwarn.vim +++ b/syntax_checkers/python/py3kwarn.vim @@ -14,14 +14,16 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_python_py3kwarn_GetLocList() dict - let makeprg = self.makeprgBuild({ - \ 'exe_before': (syntastic#util#isRunningWindows() ? '' : 'TERM=dumb') }) + let makeprg = self.makeprgBuild({}) let errorformat = '%W%f:%l:%c: %m' + let env = syntastic#util#isRunningWindows() ? {} : { 'TERM': 'dumb' } + return SyntasticMake({ \ 'makeprg': makeprg, - \ 'errorformat': errorformat }) + \ 'errorformat': errorformat, + \ 'env': env }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/syntax_checkers/python/pyflakes.vim b/syntax_checkers/python/pyflakes.vim index 351eb2061..530a275c5 100644 --- a/syntax_checkers/python/pyflakes.vim +++ b/syntax_checkers/python/pyflakes.vim @@ -40,8 +40,7 @@ function! SyntaxCheckers_python_pyflakes_GetHighlightRegex(i) endfunction function! SyntaxCheckers_python_pyflakes_GetLocList() dict - let makeprg = self.makeprgBuild({ - \ 'exe_before': (syntastic#util#isRunningWindows() ? '' : 'TERM=dumb') }) + let makeprg = self.makeprgBuild({}) let errorformat = \ '%E%f:%l: could not compile,'. @@ -50,9 +49,12 @@ function! SyntaxCheckers_python_pyflakes_GetLocList() dict \ '%E%f:%l: %m,'. \ '%-G%.%#' + let env = syntastic#util#isRunningWindows() ? {} : { 'TERM': 'dumb' } + let loclist = SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, + \ 'env': env, \ 'defaults': {'text': "Syntax error"} }) for e in loclist diff --git a/syntax_checkers/python/pylama.vim b/syntax_checkers/python/pylama.vim index b8611814c..01c0ab627 100644 --- a/syntax_checkers/python/pylama.vim +++ b/syntax_checkers/python/pylama.vim @@ -23,18 +23,19 @@ function! SyntaxCheckers_python_pylama_GetHighlightRegex(item) endfunction function! SyntaxCheckers_python_pylama_GetLocList() dict - let makeprg = self.makeprgBuild({ - \ 'exe_before': (syntastic#util#isRunningWindows() ? '' : 'TERM=dumb'), - \ 'args_after': '-f pep8' }) + let makeprg = self.makeprgBuild({ 'args_after': '-f pep8' }) " TODO: "WARNING:pylama:..." messages are probably a logging bug let errorformat = \ '%-GWARNING:pylama:%.%#,' . \ '%A%f:%l:%c: %m' + let env = syntastic#util#isRunningWindows() ? {} : { 'TERM': 'dumb' } + let loclist = SyntasticMake({ \ 'makeprg': makeprg, - \ 'errorformat': errorformat }) + \ 'errorformat': errorformat, + \ 'env': env }) " adjust for weirdness in each checker for e in loclist diff --git a/syntax_checkers/python/pylint.vim b/syntax_checkers/python/pylint.vim index 131ca4820..88dff4229 100644 --- a/syntax_checkers/python/pylint.vim +++ b/syntax_checkers/python/pylint.vim @@ -23,7 +23,6 @@ endfunction function! SyntaxCheckers_python_pylint_GetLocList() dict let makeprg = self.makeprgBuild({ - \ 'exe_before': (syntastic#util#isRunningWindows() ? '' : 'TERM=dumb'), \ 'args_after': (s:pylint_new ? '-f text --msg-template="{path}:{line}:{column}:{C}: [{symbol}] {msg}" -r n' : '-f parseable -r n -i y') }) let errorformat = @@ -33,9 +32,12 @@ function! SyntaxCheckers_python_pylint_GetLocList() dict \ '%-Z%p^%.%#,' . \ '%-G%.%#' + let env = syntastic#util#isRunningWindows() ? {} : { 'TERM': 'dumb' } + let loclist = SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, + \ 'env': env, \ 'returns': range(32) }) for e in loclist diff --git a/syntax_checkers/python/python.vim b/syntax_checkers/python/python.vim index e962065dc..5023ee6cb 100644 --- a/syntax_checkers/python/python.vim +++ b/syntax_checkers/python/python.vim @@ -26,15 +26,16 @@ function! SyntaxCheckers_python_python_IsAvailable() dict endfunction function! SyntaxCheckers_python_python_GetLocList() dict - let makeprg = self.makeprgBuild({ - \ 'exe_before': (syntastic#util#isRunningWindows() ? '' : 'TERM=dumb'), - \ 'exe': [self.getExec(), s:compiler] }) + let makeprg = self.makeprgBuild({ 'exe': [self.getExec(), s:compiler] }) let errorformat = '%E%f:%l:%c: %m' + let env = syntastic#util#isRunningWindows() ? {} : { 'TERM': 'dumb' } + return SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, + \ 'env': env, \ 'returns': [0] }) endfunction diff --git a/syntax_checkers/ruby/jruby.vim b/syntax_checkers/ruby/jruby.vim index 9dba591a3..bf57b091f 100644 --- a/syntax_checkers/ruby/jruby.vim +++ b/syntax_checkers/ruby/jruby.vim @@ -20,7 +20,6 @@ set cpo&vim function! SyntaxCheckers_ruby_jruby_GetLocList() dict let makeprg = self.makeprgBuild({ - \ 'exe_before': (syntastic#util#isRunningWindows() ? '' : 'RUBYOPT='), \ 'args': (syntastic#util#isRunningWindows() ? '-T1' : ''), \ 'args_after': '-W1 -c' }) @@ -33,9 +32,12 @@ function! SyntaxCheckers_ruby_jruby_GetLocList() dict \ '%W%f:%l: %m,'. \ '%-C%.%#' + let env = syntastic#util#isRunningWindows() ? {} : { 'RUBYOPT': '' } + return SyntasticMake({ \ 'makeprg': makeprg, - \ 'errorformat': errorformat }) + \ 'errorformat': errorformat, + \ 'env': env }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/syntax_checkers/ruby/macruby.vim b/syntax_checkers/ruby/macruby.vim index a5fc1c40e..54c8365f6 100644 --- a/syntax_checkers/ruby/macruby.vim +++ b/syntax_checkers/ruby/macruby.vim @@ -18,9 +18,7 @@ let s:save_cpo = &cpo set cpo&vim function! SyntaxCheckers_ruby_macruby_GetLocList() dict - let makeprg = self.makeprgBuild({ - \ 'exe_before': 'RUBYOPT=', - \ 'args_after': '-W1 -c' }) + let makeprg = self.makeprgBuild({ 'args_after': '-W1 -c' }) let errorformat = \ '%-GSyntax OK,'. @@ -31,9 +29,12 @@ function! SyntaxCheckers_ruby_macruby_GetLocList() dict \ '%W%f:%l: %m,'. \ '%-C%.%#' + let env = { 'RUBYOPT': '' } + return SyntasticMake({ \ 'makeprg': makeprg, - \ 'errorformat': errorformat }) + \ 'errorformat': errorformat, + \ 'env': env }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ diff --git a/syntax_checkers/ruby/mri.vim b/syntax_checkers/ruby/mri.vim index 08af1b45b..e55c493d2 100644 --- a/syntax_checkers/ruby/mri.vim +++ b/syntax_checkers/ruby/mri.vim @@ -35,9 +35,7 @@ function! SyntaxCheckers_ruby_mri_GetHighlightRegex(i) endfunction function! SyntaxCheckers_ruby_mri_GetLocList() dict - let makeprg = self.makeprgBuild({ - \ 'exe_before': (syntastic#util#isRunningWindows() ? '' : 'RUBYOPT='), - \ 'args_after': '-w -T1 -c' }) + let makeprg = self.makeprgBuild({ 'args_after': '-w -T1 -c' }) "this is a hack to filter out a repeated useless warning in rspec files "containing lines like @@ -62,9 +60,12 @@ function! SyntaxCheckers_ruby_mri_GetLocList() dict \ '%W%f:%l: %m,'. \ '%-C%.%#' + let env = syntastic#util#isRunningWindows() ? {} : { 'RUBYOPT': '' } + return SyntasticMake({ \ 'makeprg': makeprg, - \ 'errorformat': errorformat }) + \ 'errorformat': errorformat, + \ 'env': env }) endfunction call g:SyntasticRegistry.CreateAndRegisterChecker({ From 0f061bef51b4af107cd1742ebcc7073766bc8116 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 11 Jul 2014 15:48:37 +0300 Subject: [PATCH 0557/1271] Vimlint: add g:syntastic_vimlint_options. --- plugin/syntastic.vim | 2 +- syntax_checkers/vim/vimlint.vim | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 176f50bd2..0a0c6b2ab 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -19,7 +19,7 @@ if has('reltime') lockvar! g:syntastic_start endif -let g:syntastic_version = '3.4.0-93' +let g:syntastic_version = '3.4.0-94' lockvar g:syntastic_version " Sanity checks {{{1 diff --git a/syntax_checkers/vim/vimlint.vim b/syntax_checkers/vim/vimlint.vim index 309e5878d..7122de1f4 100644 --- a/syntax_checkers/vim/vimlint.vim +++ b/syntax_checkers/vim/vimlint.vim @@ -53,7 +53,7 @@ function! SyntaxCheckers_vim_vimlint_GetLocList() dict " value 3: the message is a warning " " References: :help vimlint-errorcode and :help vimlint-variables - return vimlint#vimlint(expand('%'), { + let param = { \ 'output': function('s:vimlintOutput'), \ 'quiet': 1, \ 'EVL102': 3, @@ -63,7 +63,16 @@ function! SyntaxCheckers_vim_vimlint_GetLocList() dict \ 'EVL106': 3, \ 'EVL201': 3, \ 'EVL204': 3, - \ 'EVL205': 3 }) + \ 'EVL205': 3 } + + if exists('g:syntastic_vimlint_options') + if type(g:syntastic_vimlint_options) == type({}) + let options = filter(copy(g:syntastic_vimlint_options), 'v:key =~# "\\m^EVL"') + call extend(param, options, 'force') + endif + endif + + return vimlint#vimlint(expand('%'), param) endfunction " @vimlint(EVL103, 1, a:filename) From 1ae720fdf0a84c633eb6c28fa9384431308fc07d Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Fri, 11 Jul 2014 18:23:00 +0300 Subject: [PATCH 0558/1271] README: nit pick about re-enabling the perl checker. --- README.markdown | 3 ++- plugin/syntastic.vim | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/README.markdown b/README.markdown index 950f7273a..7a7f2e087 100644 --- a/README.markdown +++ b/README.markdown @@ -137,7 +137,8 @@ statements in your file (cf. [perlrun][10]). This is probably fine if you wrote the file yourself, but it's a security problem if you're checking third party files. Since there is currently no way to disable this behaviour while still producing useful results, the checker is now disabled by default. To -(re-)enable it, set `g:syntastic_enable_perl_checker` to 1 in your vimrc: +(re-)enable it, make sure the `g:syntastic_perl_checkers` list includes `perl`, +and set `g:syntastic_enable_perl_checker` to 1 in your vimrc: ```vim let g:syntastic_enable_perl_checker = 1 ``` diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 0a0c6b2ab..9dbc2488a 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -19,7 +19,7 @@ if has('reltime') lockvar! g:syntastic_start endif -let g:syntastic_version = '3.4.0-94' +let g:syntastic_version = '3.4.0-95' lockvar g:syntastic_version " Sanity checks {{{1 From 7051016b33baa94e05a6e00f688caae565df5b48 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Sun, 13 Jul 2014 21:10:46 +0300 Subject: [PATCH 0559/1271] Refresh optimisations. --- autoload/syntastic/log.vim | 9 +-------- autoload/syntastic/util.vim | 6 ++++++ plugin/syntastic.vim | 5 ++--- plugin/syntastic/balloons.vim | 1 + plugin/syntastic/highlighting.vim | 16 ++++++++++------ plugin/syntastic/loclist.vim | 9 +++++++++ plugin/syntastic/notifiers.vim | 26 +++++++++++++++++++++++++- 7 files changed, 54 insertions(+), 18 deletions(-) diff --git a/autoload/syntastic/log.vim b/autoload/syntastic/log.vim index e227f53ea..bddc7100b 100644 --- a/autoload/syntastic/log.vim +++ b/autoload/syntastic/log.vim @@ -154,17 +154,10 @@ function! s:logRedirect(on) " {{{2 endif endfunction " }}}2 -function! s:logTimestamp_smart() " {{{2 +function! s:logTimestamp() " {{{2 return 'syntastic: ' . split(reltimestr(reltime(g:syntastic_start)))[0] . ': ' endfunction " }}}2 -function! s:logTimestamp_dumb() " {{{2 - return 'syntastic: debug: ' -endfunction " }}}2 - -let s:logTimestamp = function(has('reltime') ? 's:logTimestamp_smart' : 's:logTimestamp_dumb') -lockvar s:logTimestamp - function! s:formatVariable(name) " {{{2 let vals = [] if exists('g:syntastic_' . a:name) diff --git a/autoload/syntastic/util.vim b/autoload/syntastic/util.vim index 982366c4d..a7b2333ce 100644 --- a/autoload/syntastic/util.vim +++ b/autoload/syntastic/util.vim @@ -226,6 +226,12 @@ function! syntastic#util#sortLoclist(errors) " {{{2 call sort(a:errors, 's:compareErrorItems') endfunction " }}}2 +" Return a floating point number, representing the time +" (hopefully high resolution) since program start +function! syntastic#util#timestamp() " {{{2 + return str2float(reltimestr(reltime(g:syntastic_start))) +endfunction " }}}2 + " }}}1 " Private functions {{{1 diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 9dbc2488a..4ddf783ca 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -19,12 +19,12 @@ if has('reltime') lockvar! g:syntastic_start endif -let g:syntastic_version = '3.4.0-95' +let g:syntastic_version = '3.4.0-96' lockvar g:syntastic_version " Sanity checks {{{1 -for s:feature in ['autocmd', 'eval', 'modify_fname', 'quickfix', 'user_commands'] +for s:feature in ['autocmd', 'eval', 'modify_fname', 'quickfix', 'reltime', 'user_commands'] if !has(s:feature) call syntastic#log#error("need Vim compiled with feature " . s:feature) finish @@ -376,7 +376,6 @@ function! s:CacheErrors(checker_names) " {{{2 endif endif - call newLoclist.setOwner(bufnr('')) call newLoclist.deploy() endfunction " }}}2 diff --git a/plugin/syntastic/balloons.vim b/plugin/syntastic/balloons.vim index c97f7faea..6bf6edb96 100644 --- a/plugin/syntastic/balloons.vim +++ b/plugin/syntastic/balloons.vim @@ -43,6 +43,7 @@ endfunction " }}}2 " Reset the error balloons " @vimlint(EVL103, 1, a:loclist) function! g:SyntasticBalloonsNotifier.reset(loclist) " {{{2 + let b:syntastic_balloons = {} if has('balloon_eval') call syntastic#log#debug(g:SyntasticDebugNotifications, 'balloons: reset') set nobeval diff --git a/plugin/syntastic/highlighting.vim b/plugin/syntastic/highlighting.vim index e3451d824..afb6614ac 100644 --- a/plugin/syntastic/highlighting.vim +++ b/plugin/syntastic/highlighting.vim @@ -32,8 +32,8 @@ endfunction " }}}2 " Sets error highlights in the cuirrent window function! g:SyntasticHighlightingNotifier.refresh(loclist) " {{{2 if self.enabled() - call self.reset(a:loclist) call syntastic#log#debug(g:SyntasticDebugNotifications, 'highlighting: refresh') + call self._reset() let buf = bufnr('') let issues = filter(a:loclist.copyRaw(), 'v:val["bufnr"] == buf') for item in issues @@ -64,11 +64,7 @@ endfunction " }}}2 function! g:SyntasticHighlightingNotifier.reset(loclist) " {{{2 if s:has_highlighting call syntastic#log#debug(g:SyntasticDebugNotifications, 'highlighting: reset') - for match in getmatches() - if stridx(match['group'], 'Syntastic') == 0 - call matchdelete(match['id']) - endif - endfor + call self._reset() endif endfunction " }}}2 " @vimlint(EVL103, 0, a:loclist) @@ -95,6 +91,14 @@ function! g:SyntasticHighlightingNotifier._setup() " {{{2 endif endfunction " }}}2 +function! g:SyntasticHighlightingNotifier._reset() " {{{2 + for match in getmatches() + if stridx(match['group'], 'Syntastic') == 0 + call matchdelete(match['id']) + endif + endfor +endfunction " }}}2 + " }}}1 " vim: set sw=4 sts=4 et fdm=marker: diff --git a/plugin/syntastic/loclist.vim b/plugin/syntastic/loclist.vim index b4471dad9..4d2b789ee 100644 --- a/plugin/syntastic/loclist.vim +++ b/plugin/syntastic/loclist.vim @@ -46,6 +46,13 @@ function! g:SyntasticLoclist.isEmpty() " {{{2 return empty(self._rawLoclist) endfunction " }}}2 +function! g:SyntasticLoclist.isNewer(stamp) " {{{2 + if !exists("self._stamp") + let self._stamp = -1.0 + endif + return self._stamp > a:stamp +endfunction " }}}2 + function! g:SyntasticLoclist.copyRaw() " {{{2 return copy(self._rawLoclist) endfunction " }}}2 @@ -132,6 +139,8 @@ function! g:SyntasticLoclist.setOwner(buffer) " {{{2 endfunction " }}}2 function! g:SyntasticLoclist.deploy() " {{{2 + call self.setOwner(bufnr('')) + let self._stamp = syntastic#util#timestamp() for buf in self.getBuffers() call setbufvar(buf, 'syntastic_loclist', self) endfor diff --git a/plugin/syntastic/notifiers.vim b/plugin/syntastic/notifiers.vim index 62821cde0..6cb1c702d 100644 --- a/plugin/syntastic/notifiers.vim +++ b/plugin/syntastic/notifiers.vim @@ -8,6 +8,9 @@ let g:SyntasticNotifiers = {} let s:notifier_types = ['signs', 'balloons', 'highlighting', 'cursor', 'autoloclist'] lockvar! s:notifier_types +let s:persistent_notifiers = ['signs', 'balloons'] +lockvar! s:persistent_notifiers + " Public methods {{{1 function! g:SyntasticNotifiers.Instance() " {{{2 @@ -20,11 +23,27 @@ function! g:SyntasticNotifiers.Instance() " {{{2 endfunction " }}}2 function! g:SyntasticNotifiers.refresh(loclist) " {{{2 + if !a:loclist.isEmpty() && !a:loclist.isNewer(0.0) + " loclist not fully constructed yet + return + endif + call syntastic#log#debug(g:SyntasticDebugNotifications, 'notifiers: refresh') for type in self._enabled_types let class = substitute(type, '\m.*', 'Syntastic\u&Notifier', '') if !has_key(g:{class}, 'enabled') || self._notifier[type].enabled() - call self._notifier[type].refresh(a:loclist) + if index(s:persistent_notifiers, type) > -1 + " refresh only if loclist has changed since last call + if !exists('b:syntastic_' . type . '_timestamp') + let b:syntastic_{type}_timestamp = -1.0 + endif + if a:loclist.isNewer(b:syntastic_{type}_timestamp) + call self._notifier[type].refresh(a:loclist) + let b:syntastic_{type}_timestamp = syntastic#util#timestamp() + endif + else + call self._notifier[type].refresh(a:loclist) + endif endif endfor endfunction " }}}2 @@ -40,6 +59,11 @@ function! g:SyntasticNotifiers.reset(loclist) " {{{2 if has_key(g:{class}, 'reset') call self._notifier[type].reset(a:loclist) endif + + " also reset timestamps + if index(s:persistent_notifiers, type) > -1 + let b:syntastic_{type}_timestamp = -1.0 + endif endfor endfunction " }}}2 From 05567a292e66db7dafc9b8424db09f29b6330609 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Sun, 13 Jul 2014 22:43:57 +0300 Subject: [PATCH 0560/1271] Don't check compressed files. --- plugin/syntastic.vim | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 4ddf783ca..816345af0 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -19,7 +19,7 @@ if has('reltime') lockvar! g:syntastic_start endif -let g:syntastic_version = '3.4.0-96' +let g:syntastic_version = '3.4.0-97' lockvar g:syntastic_version " Sanity checks {{{1 @@ -65,6 +65,7 @@ let g:syntastic_defaults = { \ 'filetype_map': {}, \ 'full_redraws': !(has('gui_running') || has('gui_macvim')), \ 'id_checkers': 1, + \ 'ignore_extensions': '\c\v^([gx]?z|lzma|bz2)$', \ 'ignore_files': [], \ 'loc_list_height': 10, \ 'quiet_messages': {}, @@ -551,7 +552,8 @@ endfunction " }}}2 function! s:skipFile() " {{{2 let force_skip = exists('b:syntastic_skip_checks') ? b:syntastic_skip_checks : 0 let fname = expand('%') - return force_skip || (&buftype != '') || !filereadable(fname) || getwinvar(0, '&diff') || s:ignoreFile(fname) + return force_skip || (&buftype != '') || !filereadable(fname) || getwinvar(0, '&diff') || + \ s:ignoreFile(fname) || fnamemodify(fname, ':e') =~? g:syntastic_ignore_extensions endfunction " }}}2 " Take a list of errors and add default values to them from a:options From 67e14bc79dbf62c45db9ea1e701079b3c9c8f98d Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Tue, 15 Jul 2014 08:57:37 +0300 Subject: [PATCH 0561/1271] New redirect checker for arduino: avrgcc. --- README.markdown | 20 ++++++++++---------- plugin/syntastic.vim | 2 +- plugin/syntastic/registry.vim | 1 + syntax_checkers/arduino/avrgcc.vim | 26 ++++++++++++++++++++++++++ syntax_checkers/c/avrgcc.vim | 2 ++ syntax_checkers/erlang/syntaxerl.vim | 2 ++ 6 files changed, 42 insertions(+), 11 deletions(-) create mode 100644 syntax_checkers/arduino/avrgcc.vim diff --git a/README.markdown b/README.markdown index 7a7f2e087..d0eb41f24 100644 --- a/README.markdown +++ b/README.markdown @@ -35,16 +35,16 @@ the user is notified and is happy because they didn't have to compile their code or execute their script to find them. At the time of this writing, syntax checking plugins exist for ActionScript, -Ada, AppleScript, AsciiDoc, ASM, BEMHTML, Bro, Bourne shell, C, C++, C#, Cabal, -Chef, CoffeeScript, Coco, Coq, CSS, Cucumber, CUDA, D, Dart, DocBook, Dust, -Elixir, Erlang, eRuby, Fortran, Gentoo metadata, GLSL, Go, Haml, Haskell, Haxe, -Handlebars, HSS, HTML, Java, JavaScript, JSON, JSX, LESS, Lex, Limbo, LISP, -LLVM intermediate language, Lua, MATLAB, NASM, Objective-C, Objective-C++, -OCaml, Perl, Perl POD, PHP, gettext Portable Object, OS X and iOS property -lists, Puppet, Python, Racket, R, reStructuredText, Ruby, SASS/SCSS, Scala, -Slim, Tcl, TeX, Texinfo, Twig, TypeScript, Vala, Verilog, VHDL, VimL, xHtml, -XML, XSLT, YACC, YAML, z80, Zope page templates, and zsh. See the [wiki][3] -for details about the corresponding supported checkers. +Ada, AppleScript, Arduino, AsciiDoc, ASM, BEMHTML, Bro, Bourne shell, C, +C++, C#, Cabal, Chef, CoffeeScript, Coco, Coq, CSS, Cucumber, CUDA, D, Dart, +DocBook, Dust, Elixir, Erlang, eRuby, Fortran, Gentoo metadata, GLSL, Go, +Haml, Haskell, Haxe, Handlebars, HSS, HTML, Java, JavaScript, JSON, JSX, LESS, +Lex, Limbo, LISP, LLVM intermediate language, Lua, MATLAB, NASM, Objective-C, +Objective-C++, OCaml, Perl, Perl POD, PHP, gettext Portable Object, OS X +and iOS property lists, Puppet, Python, Racket, R, reStructuredText, Ruby, +SASS/SCSS, Scala, Slim, Tcl, TeX, Texinfo, Twig, TypeScript, Vala, Verilog, +VHDL, VimL, xHtml, XML, XSLT, YACC, YAML, z80, Zope page templates, and zsh. +See the [wiki][3] for details about the corresponding supported checkers. Below is a screenshot showing the methods that Syntastic uses to display syntax errors. Note that, in practise, you will only have a subset of these methods diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 816345af0..30c7790cc 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -19,7 +19,7 @@ if has('reltime') lockvar! g:syntastic_start endif -let g:syntastic_version = '3.4.0-97' +let g:syntastic_version = '3.4.0-99' lockvar g:syntastic_version " Sanity checks {{{1 diff --git a/plugin/syntastic/registry.vim b/plugin/syntastic/registry.vim index 3ab771e17..0da9d3331 100644 --- a/plugin/syntastic/registry.vim +++ b/plugin/syntastic/registry.vim @@ -9,6 +9,7 @@ let s:defaultCheckers = { \ 'actionscript':['mxmlc'], \ 'ada': ['gcc'], \ 'applescript': ['osacompile'], + \ 'arduino': ['avrgcc'], \ 'asciidoc': ['asciidoc'], \ 'asm': ['gcc'], \ 'bro': ['bro'], diff --git a/syntax_checkers/arduino/avrgcc.vim b/syntax_checkers/arduino/avrgcc.vim new file mode 100644 index 000000000..600041aad --- /dev/null +++ b/syntax_checkers/arduino/avrgcc.vim @@ -0,0 +1,26 @@ +"============================================================================ +"File: avrgcc.vim +"Description: Syntax checking plugin for syntastic.vim +"Maintainer: Karel +"License: This program is free software. It comes without any warranty, +" to the extent permitted by applicable law. You can redistribute +" it and/or modify it under the terms of the Do What The Fuck You +" Want To Public License, Version 2, as published by Sam Hocevar. +" See http://sam.zoy.org/wtfpl/COPYING for more details. +" +"============================================================================ + +if exists('g:loaded_syntastic_arduino_avrgcc_checker') + finish +endif +let g:loaded_syntastic_arduino_avrgcc_checker = 1 + +runtime! syntax_checkers/c/*.vim + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'c', + \ 'name': 'avrgcc', + \ 'exec': 'avr-gcc' + \ 'redirect': 'c/avrgcc'}) + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/c/avrgcc.vim b/syntax_checkers/c/avrgcc.vim index 0efe47228..5563d61dc 100644 --- a/syntax_checkers/c/avrgcc.vim +++ b/syntax_checkers/c/avrgcc.vim @@ -53,3 +53,5 @@ call g:SyntasticRegistry.CreateAndRegisterChecker({ let &cpo = s:save_cpo unlet s:save_cpo + +" vim: set et sts=4 sw=4: diff --git a/syntax_checkers/erlang/syntaxerl.vim b/syntax_checkers/erlang/syntaxerl.vim index 903793c31..91629c436 100644 --- a/syntax_checkers/erlang/syntaxerl.vim +++ b/syntax_checkers/erlang/syntaxerl.vim @@ -38,3 +38,5 @@ call g:SyntasticRegistry.CreateAndRegisterChecker({ let &cpo = s:save_cpo unlet s:save_cpo + +" vim: set et sts=4 sw=4: From 946484ce711ff238f8ab8f94f903ca597b27c2f6 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Tue, 15 Jul 2014 10:36:20 +0300 Subject: [PATCH 0562/1271] Manual: add a note about YouCompleteMe. --- doc/syntastic.txt | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/doc/syntastic.txt b/doc/syntastic.txt index fbcedf50f..03c7d0476 100644 --- a/doc/syntastic.txt +++ b/doc/syntastic.txt @@ -38,11 +38,12 @@ CONTENTS *syntastic-contents* 6.1.Handling of composite filetypes........|syntastic-composite| 6.2.Editing files over network.............|syntastic-netrw| 6.3.Interaction with python-mode...........|syntastic-pymode| - 6.4.Interaction with the fish shell........|syntastic-fish| - 6.5.Interaction with PowerShell............|syntastic-powershell| - 6.6.Using syntastic with the fizsh shell...|syntastic-fizsh| - 6.7.Interaction with Eclim.................|syntastic-eclim| - 6.8.Interaction with vim-virtualenv........|syntastic-vim-virtualenv| + 6.4.Interaction with YouCompleteMe.........|syntastic-ycm| + 6.5.Interaction with the fish shell........|syntastic-fish| + 6.6.Interaction with PowerShell............|syntastic-powershell| + 6.7.Using syntastic with the fizsh shell...|syntastic-fizsh| + 6.8.Interaction with Eclim.................|syntastic-eclim| + 6.9.Interaction with vim-virtualenv........|syntastic-vim-virtualenv| 7.About........................................|syntastic-about| 8.License......................................|syntastic-license| @@ -665,11 +666,22 @@ https://github.com/klen/python-mode). However, they both run syntax checks by default when you save buffers to disk, and this is probably not what you want. To avoid both plugins opening error windows, you can either set passive mode for python in syntastic (see |syntastic_mode_map|), or disable lint checks in -python-mode, by setting |pymode_lint_write| to 0. E.g.: > +'python-mode', by setting |pymode_lint_write| to 0. E.g.: > let g:pymode_lint_write = 0 < ------------------------------------------------------------------------------ -6.4 Interaction with the fish shell *syntastic-fish* +6.4 Interaction with YouCompleteMe *syntastic-ycm* + +Syntastic can be used together with the 'YouCompleteMe' Vim plugin (see +http://valloric.github.io/YouCompleteMe/). However, by default 'YouCompleteMe' +disables syntastic's checkers for the 'c', 'cpp', 'objc', and 'objcpp' +filetypes, in order to allow its own checkers to run. If you want to use YCM's +identifier completer but still run syntastic's checkers for those filetypes you +have to set |ycm_show_diagnostics_ui| to 0. E.g.: > + let g:ycm_show_diagnostics_ui = 0 +< +------------------------------------------------------------------------------ +6.5 Interaction with the fish shell *syntastic-fish* At the time of this writing the 'fish' shell (see http://fishshell.com/) doesn't support the standard UNIX syntax for file redirections, and thus it @@ -680,7 +692,7 @@ traditional shell, such as 'zsh', 'bash', 'ksh', or even the original Bourne set shell=bash < ------------------------------------------------------------------------------ -6.5. Interaction with PowerShell *syntastic-powershell* +6.6. Interaction with PowerShell *syntastic-powershell* At the time of this writing, syntastic is not compatible with using 'Windows PowerShell' (http://technet.microsoft.com/en-us/library/bb978526.aspx) as Vim's @@ -689,7 +701,7 @@ Vim's 'shell' to a more traditional program, such as 'cmd.exe': > set shell=cmd.exe < ------------------------------------------------------------------------------ -6.6. Using syntastic with the fizsh shell *syntastic-fizsh* +6.7. Using syntastic with the fizsh shell *syntastic-fizsh* Using syntastic with the 'fizsh' shell (see https://github.com/zsh-users/fizsh) is possible, but potentially problematic. In order to do it you'll need to set @@ -702,7 +714,7 @@ interactive features of 'fizsh'. Using a more traditional shell such as 'zsh', set shell=zsh < ------------------------------------------------------------------------------ -6.7. Interaction with Eclim *syntastic-eclim* +6.8. Interaction with Eclim *syntastic-eclim* As far as syntastic is concerned there shouldn't be any compatibility problems with the 'Eclim' Vim plugin (see http://eclim.org/). However, at the time of @@ -711,7 +723,7 @@ makes syntastic forget some of its configuration parameters. No solutions or workarounds are known for now. ------------------------------------------------------------------------------ -6.8. Interaction with vim-virtualenv *syntastic-vim-virtualenv* +6.9. Interaction with vim-virtualenv *syntastic-vim-virtualenv* At the time of this writing, syntastic can't run checkers installed in Python virtual environments activated by 'vim-virtualenv' (see From 473b494ef2c0af1babbf3edb2175e20b436b3f64 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Tue, 15 Jul 2014 12:43:53 +0300 Subject: [PATCH 0563/1271] SyntasticInfo: more details about modes. Minor cleanup. --- plugin/syntastic.vim | 4 ++-- plugin/syntastic/modemap.vim | 21 +++++++++++++++++++++ plugin/syntastic/registry.vim | 14 +++++++++----- 3 files changed, 32 insertions(+), 7 deletions(-) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 30c7790cc..62f648933 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -19,7 +19,7 @@ if has('reltime') lockvar! g:syntastic_start endif -let g:syntastic_version = '3.4.0-99' +let g:syntastic_version = '3.4.0-100' lockvar g:syntastic_version " Sanity checks {{{1 @@ -168,7 +168,7 @@ command! -nargs=* -complete=custom,s:CompleteCheckerName SyntasticCheck \ call syntastic#util#redraw(g:syntastic_full_redraws) command! Errors call s:ShowLocList() command! -nargs=? -complete=custom,s:CompleteFiletypes SyntasticInfo - \ call s:modemap.echoMode() | + \ call s:modemap.modeInfo() | \ call s:registry.echoInfoFor(s:resolveFiletypes()) command! SyntasticReset \ call s:ClearCache() | diff --git a/plugin/syntastic/modemap.vim b/plugin/syntastic/modemap.vim index 8f7d3a4e2..11e21c665 100644 --- a/plugin/syntastic/modemap.vim +++ b/plugin/syntastic/modemap.vim @@ -62,6 +62,27 @@ function! g:SyntasticModeMap.echoMode() " {{{2 echo "Syntastic: " . self._mode . " mode enabled" endfunction " }}}2 +function! g:SyntasticModeMap.modeInfo(...) " {{{2 + echomsg 'Syntastic version: ' . g:syntastic_version + let type = a:0 ? a:1 : &filetype + echomsg 'Info for filetype: ' . type + + call self.synch() + echomsg 'Mode: ' . self._mode + if self._mode ==# 'active' + if len(self._passiveFiletypes) + let plural = len(self._passiveFiletypes) != 1 ? 's' : '' + echomsg 'Passive filetype' . plural . ': ' . join(sort(copy(self._passiveFiletypes))) + endif + else + if len(self._activeFiletypes) + let plural = len(self._activeFiletypes) != 1 ? 's' : '' + echomsg 'Active filetype' . plural . ': ' . join(sort(copy(self._activeFiletypes))) + endif + endif + echomsg 'Current filetype is ' . (self.allowsAutoChecking(type) ? 'active' : 'passive') +endfunction " }}}2 + " }}}1 " Private methods {{{1 diff --git a/plugin/syntastic/registry.vim b/plugin/syntastic/registry.vim index 0da9d3331..fb5515281 100644 --- a/plugin/syntastic/registry.vim +++ b/plugin/syntastic/registry.vim @@ -179,9 +179,6 @@ function! g:SyntasticRegistry.getNamesOfAvailableCheckers(ftalias) " {{{2 endfunction " }}}2 function! g:SyntasticRegistry.echoInfoFor(ftalias_list) " {{{2 - echomsg "Syntastic version: " . g:syntastic_version - echomsg "Info for filetype: " . join(a:ftalias_list, '.') - let ft_list = syntastic#util#unique(map( copy(a:ftalias_list), 's:normaliseFiletype(v:val)' )) if len(ft_list) != 1 let available = [] @@ -197,8 +194,15 @@ function! g:SyntasticRegistry.echoInfoFor(ftalias_list) " {{{2 let active = map(self.getCheckersAvailable(ft, []), 'v:val.getName()') endif - echomsg "Available checker(s): " . join(sort(available)) - echomsg "Currently enabled checker(s): " . join(active) + let cnt = len(available) + let plural = cnt != 1 ? 's' : '' + let cklist = cnt ? join(sort(available)) : '-' + echomsg 'Available checker' . plural . ': ' . cklist + + let cnt = len(active) + let plural = cnt != 1 ? 's' : '' + let cklist = cnt ? join(active) : '-' + echomsg 'Currently enabled checker' . plural . ': ' . cklist endfunction " }}}2 " }}}1 From 518d349d152f2fcd4aab28addd11d7566c1f7375 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Tue, 15 Jul 2014 15:09:02 +0300 Subject: [PATCH 0564/1271] SyntasticInfo: minor bug fix. --- plugin/syntastic.vim | 2 +- plugin/syntastic/modemap.vim | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 62f648933..fddeab9a4 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -19,7 +19,7 @@ if has('reltime') lockvar! g:syntastic_start endif -let g:syntastic_version = '3.4.0-100' +let g:syntastic_version = '3.4.0-101' lockvar g:syntastic_version " Sanity checks {{{1 diff --git a/plugin/syntastic/modemap.vim b/plugin/syntastic/modemap.vim index 11e21c665..c780bbadf 100644 --- a/plugin/syntastic/modemap.vim +++ b/plugin/syntastic/modemap.vim @@ -80,7 +80,7 @@ function! g:SyntasticModeMap.modeInfo(...) " {{{2 echomsg 'Active filetype' . plural . ': ' . join(sort(copy(self._activeFiletypes))) endif endif - echomsg 'Current filetype is ' . (self.allowsAutoChecking(type) ? 'active' : 'passive') + echomsg 'Filetype ' . type . ' is ' . (self.allowsAutoChecking(type) ? 'active' : 'passive') endfunction " }}}2 " }}}1 From 2a3583e43b2a9436e51fa557f870cd4a2915238e Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Tue, 15 Jul 2014 16:55:33 +0300 Subject: [PATCH 0565/1271] Check for +float. --- plugin/syntastic.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index fddeab9a4..4bf087556 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -19,12 +19,12 @@ if has('reltime') lockvar! g:syntastic_start endif -let g:syntastic_version = '3.4.0-101' +let g:syntastic_version = '3.4.0-102' lockvar g:syntastic_version " Sanity checks {{{1 -for s:feature in ['autocmd', 'eval', 'modify_fname', 'quickfix', 'reltime', 'user_commands'] +for s:feature in ['autocmd', 'eval', 'float', 'modify_fname', 'quickfix', 'reltime', 'user_commands'] if !has(s:feature) call syntastic#log#error("need Vim compiled with feature " . s:feature) finish From 0b6be40e203b51d42e93446755ea550bff17ccd0 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Tue, 15 Jul 2014 17:30:45 +0300 Subject: [PATCH 0566/1271] Typo. --- plugin/syntastic.vim | 2 +- syntax_checkers/arduino/avrgcc.vim | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 4bf087556..71ea4da4d 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -19,7 +19,7 @@ if has('reltime') lockvar! g:syntastic_start endif -let g:syntastic_version = '3.4.0-102' +let g:syntastic_version = '3.4.0-103' lockvar g:syntastic_version " Sanity checks {{{1 diff --git a/syntax_checkers/arduino/avrgcc.vim b/syntax_checkers/arduino/avrgcc.vim index 600041aad..2a1b867cb 100644 --- a/syntax_checkers/arduino/avrgcc.vim +++ b/syntax_checkers/arduino/avrgcc.vim @@ -20,7 +20,7 @@ runtime! syntax_checkers/c/*.vim call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'c', \ 'name': 'avrgcc', - \ 'exec': 'avr-gcc' + \ 'exec': 'avr-gcc', \ 'redirect': 'c/avrgcc'}) " vim: set et sts=4 sw=4: From 8330997aedf6312e569fb408fd72cc6cd5dc2934 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Tue, 15 Jul 2014 18:13:59 +0300 Subject: [PATCH 0567/1271] Refresh optimisations: avoid floats. The price for this is the assumption reltime() returns a list of integers [high, low]. --- autoload/syntastic/util.vim | 25 ++++++++++++++++--------- plugin/syntastic.vim | 4 ++-- plugin/syntastic/loclist.vim | 8 ++++---- plugin/syntastic/notifiers.vim | 14 +++++++------- 4 files changed, 29 insertions(+), 22 deletions(-) diff --git a/autoload/syntastic/util.vim b/autoload/syntastic/util.vim index a7b2333ce..a317546f1 100644 --- a/autoload/syntastic/util.vim +++ b/autoload/syntastic/util.vim @@ -74,15 +74,21 @@ endfunction " }}}2 " " See http://semver.org for info about version numbers. function! syntastic#util#versionIsAtLeast(installed, required) " {{{2 - for idx in range(max([len(a:installed), len(a:required)])) - let installed_element = get(a:installed, idx, 0) - let required_element = get(a:required, idx, 0) - if installed_element != required_element - return installed_element > required_element + return syntastic#util#compareLexi(a:installed, a:required) >= 0 +endfunction " }}}2 + +" Almost lexicographic comparison of two lists of integers. :) If lists +" have different lengths, the "missing" elements are assumed to be 0. +function! syntastic#util#compareLexi(a, b) " {{{2 + for idx in range(max([len(a:a), len(a:b)])) + let a_element = get(a:a, idx, 0) + let b_element = get(a:b, idx, 0) + if a_element != b_element + return a_element > b_element ? 1 : -1 endif endfor " Everything matched, so it is at least the required version. - return 1 + return 0 endfunction " }}}2 " strwidth() was added in Vim 7.3; if it doesn't exist, we use strlen() @@ -226,10 +232,11 @@ function! syntastic#util#sortLoclist(errors) " {{{2 call sort(a:errors, 's:compareErrorItems') endfunction " }}}2 -" Return a floating point number, representing the time +" Return a [high, low] list of integers, representing the time " (hopefully high resolution) since program start -function! syntastic#util#timestamp() " {{{2 - return str2float(reltimestr(reltime(g:syntastic_start))) +" TODO: This assumes reltime() returns a list of integers. +function! syntastic#util#stamp() " {{{2 + return reltime(g:syntastic_start) endfunction " }}}2 " }}}1 diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 71ea4da4d..68519af2c 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -19,12 +19,12 @@ if has('reltime') lockvar! g:syntastic_start endif -let g:syntastic_version = '3.4.0-103' +let g:syntastic_version = '3.4.0-104' lockvar g:syntastic_version " Sanity checks {{{1 -for s:feature in ['autocmd', 'eval', 'float', 'modify_fname', 'quickfix', 'reltime', 'user_commands'] +for s:feature in ['autocmd', 'eval', 'modify_fname', 'quickfix', 'reltime', 'user_commands'] if !has(s:feature) call syntastic#log#error("need Vim compiled with feature " . s:feature) finish diff --git a/plugin/syntastic/loclist.vim b/plugin/syntastic/loclist.vim index 4d2b789ee..6ab2132e5 100644 --- a/plugin/syntastic/loclist.vim +++ b/plugin/syntastic/loclist.vim @@ -46,11 +46,11 @@ function! g:SyntasticLoclist.isEmpty() " {{{2 return empty(self._rawLoclist) endfunction " }}}2 -function! g:SyntasticLoclist.isNewer(stamp) " {{{2 +function! g:SyntasticLoclist.isNewerThan(stamp) " {{{2 if !exists("self._stamp") - let self._stamp = -1.0 + let self._stamp = [] endif - return self._stamp > a:stamp + return syntastic#util#compareLexi(self._stamp, a:stamp) > 0 endfunction " }}}2 function! g:SyntasticLoclist.copyRaw() " {{{2 @@ -140,7 +140,7 @@ endfunction " }}}2 function! g:SyntasticLoclist.deploy() " {{{2 call self.setOwner(bufnr('')) - let self._stamp = syntastic#util#timestamp() + let self._stamp = syntastic#util#stamp() for buf in self.getBuffers() call setbufvar(buf, 'syntastic_loclist', self) endfor diff --git a/plugin/syntastic/notifiers.vim b/plugin/syntastic/notifiers.vim index 6cb1c702d..4da350dbb 100644 --- a/plugin/syntastic/notifiers.vim +++ b/plugin/syntastic/notifiers.vim @@ -23,7 +23,7 @@ function! g:SyntasticNotifiers.Instance() " {{{2 endfunction " }}}2 function! g:SyntasticNotifiers.refresh(loclist) " {{{2 - if !a:loclist.isEmpty() && !a:loclist.isNewer(0.0) + if !a:loclist.isEmpty() && !a:loclist.isNewerThan([]) " loclist not fully constructed yet return endif @@ -34,12 +34,12 @@ function! g:SyntasticNotifiers.refresh(loclist) " {{{2 if !has_key(g:{class}, 'enabled') || self._notifier[type].enabled() if index(s:persistent_notifiers, type) > -1 " refresh only if loclist has changed since last call - if !exists('b:syntastic_' . type . '_timestamp') - let b:syntastic_{type}_timestamp = -1.0 + if !exists('b:syntastic_' . type . '_stamp') + let b:syntastic_{type}_stamp = [] endif - if a:loclist.isNewer(b:syntastic_{type}_timestamp) + if a:loclist.isNewerThan(b:syntastic_{type}_stamp) call self._notifier[type].refresh(a:loclist) - let b:syntastic_{type}_timestamp = syntastic#util#timestamp() + let b:syntastic_{type}_stamp = syntastic#util#stamp() endif else call self._notifier[type].refresh(a:loclist) @@ -60,9 +60,9 @@ function! g:SyntasticNotifiers.reset(loclist) " {{{2 call self._notifier[type].reset(a:loclist) endif - " also reset timestamps + " also reset stamps if index(s:persistent_notifiers, type) > -1 - let b:syntastic_{type}_timestamp = -1.0 + let b:syntastic_{type}_stamp = [] endif endfor endfunction " }}}2 From 8a5d15d0d62f16c1f1a4272974a2e06ea4021ef4 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Tue, 15 Jul 2014 18:53:22 +0300 Subject: [PATCH 0568/1271] JSHint checker: sort results. --- plugin/syntastic.vim | 2 +- syntax_checkers/html/jshint.vim | 2 ++ syntax_checkers/javascript/jshint.vim | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 68519af2c..5c92c07e4 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -19,7 +19,7 @@ if has('reltime') lockvar! g:syntastic_start endif -let g:syntastic_version = '3.4.0-104' +let g:syntastic_version = '3.4.0-105' lockvar g:syntastic_version " Sanity checks {{{1 diff --git a/syntax_checkers/html/jshint.vim b/syntax_checkers/html/jshint.vim index a7274c1b5..8bb0a5304 100644 --- a/syntax_checkers/html/jshint.vim +++ b/syntax_checkers/html/jshint.vim @@ -31,6 +31,8 @@ function! SyntaxCheckers_html_jshint_GetLocList() dict let errorformat = '%A%f: line %l\, col %v\, %m \(%t%*\d\)' + call self.setWantSort(1) + return SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, diff --git a/syntax_checkers/javascript/jshint.vim b/syntax_checkers/javascript/jshint.vim index 997871fec..69706c0ac 100644 --- a/syntax_checkers/javascript/jshint.vim +++ b/syntax_checkers/javascript/jshint.vim @@ -40,6 +40,8 @@ function! SyntaxCheckers_javascript_jshint_GetLocList() dict \ '%A%f: line %l\, col %v\, %m \(%t%*\d\)' : \ '%E%f: line %l\, col %v\, %m' + call self.setWantSort(1) + return SyntasticMake({ \ 'makeprg': makeprg, \ 'errorformat': errorformat, From a82dc4793a006d0be3dafe445e78802ad2831713 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Wed, 16 Jul 2014 09:34:27 +0300 Subject: [PATCH 0569/1271] Defensive coding against stepping over other plugins' signs. --- plugin/syntastic.vim | 2 +- plugin/syntastic/signs.vim | 30 +++++++++++++++++++----------- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 5c92c07e4..ae3ed8a33 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -19,7 +19,7 @@ if has('reltime') lockvar! g:syntastic_start endif -let g:syntastic_version = '3.4.0-105' +let g:syntastic_version = '3.4.0-106' lockvar g:syntastic_version " Sanity checks {{{1 diff --git a/plugin/syntastic/signs.vim b/plugin/syntastic/signs.vim index 7f713c69b..f1edb7c7d 100644 --- a/plugin/syntastic/signs.vim +++ b/plugin/syntastic/signs.vim @@ -42,7 +42,6 @@ function! g:SyntasticSignsNotifier.refresh(loclist) " {{{2 call self._signErrors(a:loclist) endif call self._removeSigns(old_signs) - let s:first_sign_id = exists('s:next_sign_id') ? s:next_sign_id : 5000 endfunction " }}}2 " }}}1 @@ -96,18 +95,27 @@ function! g:SyntasticSignsNotifier._signErrors(loclist) " {{{2 let seen = {} for i in issues - if !has_key(seen, i['lnum']) + if i['lnum'] > 0 && !has_key(seen, i['lnum']) let seen[i['lnum']] = 1 - if i['lnum'] > 0 - let sign_severity = i['type'] ==? 'W' ? 'Warning' : 'Error' - let sign_subtype = get(i, 'subtype', '') - let sign_type = 'Syntastic' . sign_subtype . sign_severity - - execute "sign place " . s:next_sign_id . " line=" . i['lnum'] . " name=" . sign_type . " buffer=" . i['bufnr'] - call add(self._bufSignIds(), s:next_sign_id) - let s:next_sign_id += 1 - endif + let sign_severity = i['type'] ==? 'W' ? 'Warning' : 'Error' + let sign_subtype = get(i, 'subtype', '') + let sign_type = 'Syntastic' . sign_subtype . sign_severity + let where = " line=" . i['lnum'] . " name=" . sign_type . " buffer=" . i['bufnr'] + + " try to find a free ID + " XXX: this can turn into an infinite loop + let done = 0 + while !done + try + execute "sign place " . s:next_sign_id . where + call add(self._bufSignIds(), s:next_sign_id) + let s:next_sign_id += 1 + let done = 1 + catch /\m^Vim\%((\a\+)\)\=:E885/ + let s:next_sign_id += 500 + endtry + endwhile endif endfor endif From d02fb4e9295467125d09af28f8ae4753d127d8b4 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Wed, 16 Jul 2014 18:39:52 +0300 Subject: [PATCH 0570/1271] Security: disable the elixir checker by default. This executes the code your files. This is probably fine if you wrote the files yourself, but it can be a problem if you're trying to check third party files. If you are 100% willing to let Vim run the code in your files, set g:syntastic_enable_elixir_checker to 1 in your vimrc. References: https://groups.google.com/d/msg/elixir-lang-talk/B29noPHvQ-8/9JvSGPop7n0J --- plugin/syntastic.vim | 2 +- plugin/syntastic/loclist.vim | 1 + plugin/syntastic/registry.vim | 2 +- syntax_checkers/elixir/elixir.vim | 5 +++++ 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index ae3ed8a33..c91a21e12 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -19,7 +19,7 @@ if has('reltime') lockvar! g:syntastic_start endif -let g:syntastic_version = '3.4.0-106' +let g:syntastic_version = '3.4.0-107' lockvar g:syntastic_version " Sanity checks {{{1 diff --git a/plugin/syntastic/loclist.vim b/plugin/syntastic/loclist.vim index 6ab2132e5..e7c05bf70 100644 --- a/plugin/syntastic/loclist.vim +++ b/plugin/syntastic/loclist.vim @@ -49,6 +49,7 @@ endfunction " }}}2 function! g:SyntasticLoclist.isNewerThan(stamp) " {{{2 if !exists("self._stamp") let self._stamp = [] + return 0 endif return syntastic#util#compareLexi(self._stamp, a:stamp) > 0 endfunction " }}}2 diff --git a/plugin/syntastic/registry.vim b/plugin/syntastic/registry.vim index fb5515281..47d83106c 100644 --- a/plugin/syntastic/registry.vim +++ b/plugin/syntastic/registry.vim @@ -30,7 +30,7 @@ let s:defaultCheckers = { \ 'dart': ['dartanalyzer'], \ 'docbk': ['xmllint'], \ 'dustjs': ['swiffer'], - \ 'elixir': ['elixir'], + \ 'elixir': [], \ 'erlang': ['escript'], \ 'eruby': ['ruby'], \ 'fortran': ['gfortran'], diff --git a/syntax_checkers/elixir/elixir.vim b/syntax_checkers/elixir/elixir.vim index 566131d58..3914fa9b3 100644 --- a/syntax_checkers/elixir/elixir.vim +++ b/syntax_checkers/elixir/elixir.vim @@ -24,6 +24,11 @@ function! SyntaxCheckers_elixir_elixir_IsAvailable() dict endfunction function! SyntaxCheckers_elixir_elixir_GetLocList() dict + if !exists('g:syntastic_enable_elixir_checker') || !g:syntastic_enable_elixir_checker + call syntastic#log#error('checker elixir/elixir: checks disabled for security reasons; ' . + \ 'set g:syntastic_enable_elixir_checker to 1 to override') + return [] + endif let make_options = {} let compile_command = 'elixir' From 8f0c3b6628eee0d23ed0bfdfcd0aba1392af5a8c Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Thu, 17 Jul 2014 07:26:03 +0300 Subject: [PATCH 0571/1271] Manual: add a note about canceling default arguments. --- doc/syntastic.txt | 10 ++++++++-- plugin/syntastic.vim | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/doc/syntastic.txt b/doc/syntastic.txt index 03c7d0476..21bef0cce 100644 --- a/doc/syntastic.txt +++ b/doc/syntastic.txt @@ -597,18 +597,24 @@ Checkers that use 'makeprgBuild()' construct a 'makeprg' like this: > \ 'exe': self.getExec(), \ 'args': '-a -b -c', \ 'post_args': '--more --args', - \ 'tail': '> /tmp/output' }) + \ 'tail': '2>/dev/null' }) < The result is a 'makeprg' of the form: > < - *'syntastic___exe'* All arguments above are optional, and can be overridden by setting global variables 'g:syntastic___' - even parameters not specified in the call to makeprgBuild(). These variables also have local versions 'b:syntastic___', which take precedence over the global ones in the corresponding buffers. +If one of these variables has a non-empty default and you want it to be empty, +you can set it to a space, e.g.: > + let g:syntastic_javascript_jslint_args = ' ' +< +(setting it to an empty string doesn't work, for implementation reasons). + + *'syntastic___exe'* The 'exe' is normally the same as the 'exec' attribute described above, in which case it may be omitted. However, you can use it to add environment variables or additional parameters, e.g. to tell the mri checker to use KANJI diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index c91a21e12..e7109e53d 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -19,7 +19,7 @@ if has('reltime') lockvar! g:syntastic_start endif -let g:syntastic_version = '3.4.0-107' +let g:syntastic_version = '3.4.0-108' lockvar g:syntastic_version " Sanity checks {{{1 From e29d7b0b527af8024bc8fb404a8bccdce59493d0 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Thu, 17 Jul 2014 16:59:22 +0300 Subject: [PATCH 0572/1271] Revert 1e3e0a8. The problem was placing signs on unloaded buffers. --- plugin/syntastic.vim | 2 +- plugin/syntastic/signs.vim | 26 ++++++++++---------------- 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index e7109e53d..b2c06c8bb 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -19,7 +19,7 @@ if has('reltime') lockvar! g:syntastic_start endif -let g:syntastic_version = '3.4.0-108' +let g:syntastic_version = '3.4.0-109' lockvar g:syntastic_version " Sanity checks {{{1 diff --git a/plugin/syntastic/signs.vim b/plugin/syntastic/signs.vim index f1edb7c7d..e2f4b5de3 100644 --- a/plugin/syntastic/signs.vim +++ b/plugin/syntastic/signs.vim @@ -87,8 +87,13 @@ function! g:SyntasticSignsNotifier._signErrors(loclist) " {{{2 let loclist = a:loclist if !loclist.isEmpty() - " errors some first, so that they are not masked by warnings let buf = bufnr('') + if !bufloaded(buf) + " signs can be placed only in loaded buffers + return + endif + + " errors come first, so that they are not masked by warnings let issues = copy(loclist.errors()) call extend(issues, loclist.warnings()) call filter(issues, 'v:val["bufnr"] == buf') @@ -101,21 +106,10 @@ function! g:SyntasticSignsNotifier._signErrors(loclist) " {{{2 let sign_severity = i['type'] ==? 'W' ? 'Warning' : 'Error' let sign_subtype = get(i, 'subtype', '') let sign_type = 'Syntastic' . sign_subtype . sign_severity - let where = " line=" . i['lnum'] . " name=" . sign_type . " buffer=" . i['bufnr'] - - " try to find a free ID - " XXX: this can turn into an infinite loop - let done = 0 - while !done - try - execute "sign place " . s:next_sign_id . where - call add(self._bufSignIds(), s:next_sign_id) - let s:next_sign_id += 1 - let done = 1 - catch /\m^Vim\%((\a\+)\)\=:E885/ - let s:next_sign_id += 500 - endtry - endwhile + + execute "sign place " . s:next_sign_id . " line=" . i['lnum'] . " name=" . sign_type . " buffer=" . i['bufnr'] + call add(self._bufSignIds(), s:next_sign_id) + let s:next_sign_id += 1 endif endfor endif From b6decd1b8341da5d1a6ad4a671f57a91ee535477 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Sun, 20 Jul 2014 21:23:01 +0300 Subject: [PATCH 0573/1271] Make sure version lists are formed of numbers. --- autoload/syntastic/util.vim | 6 +++--- plugin/syntastic.vim | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/autoload/syntastic/util.vim b/autoload/syntastic/util.vim index a317546f1..837a280f1 100644 --- a/autoload/syntastic/util.vim +++ b/autoload/syntastic/util.vim @@ -58,7 +58,7 @@ endfunction " }}}2 " Parse a version string. Return an array of version components. function! syntastic#util#parseVersion(version) " {{{2 - return split(matchstr( a:version, '\v^\D*\zs\d+(\.\d+)+\ze' ), '\m\.') + return map(split(matchstr( a:version, '\v^\D*\zs\d+(\.\d+)+\ze' ), '\m\.'), 'str2nr(v:val)') endfunction " }}}2 " Run 'command' in a shell and parse output as a version string. @@ -81,8 +81,8 @@ endfunction " }}}2 " have different lengths, the "missing" elements are assumed to be 0. function! syntastic#util#compareLexi(a, b) " {{{2 for idx in range(max([len(a:a), len(a:b)])) - let a_element = get(a:a, idx, 0) - let b_element = get(a:b, idx, 0) + let a_element = str2nr(get(a:a, idx, 0)) + let b_element = str2nr(get(a:b, idx, 0)) if a_element != b_element return a_element > b_element ? 1 : -1 endif diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index b2c06c8bb..028c32030 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -19,7 +19,7 @@ if has('reltime') lockvar! g:syntastic_start endif -let g:syntastic_version = '3.4.0-109' +let g:syntastic_version = '3.4.0-110' lockvar g:syntastic_version " Sanity checks {{{1 From 9c6344f70b239813cb5a3460ba43ff64ae91bd42 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Sun, 20 Jul 2014 21:32:29 +0300 Subject: [PATCH 0574/1271] Set default reuse_loc_lists to 0. Recent Vim versions have a bug related to setloclist(0, list, 'r'): https://groups.google.com/forum/#!topic/vim_dev/t4ei24iwkiY Avoid replacing loclists until the problem is solved. --- plugin/syntastic.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 028c32030..1bca0af64 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -19,7 +19,7 @@ if has('reltime') lockvar! g:syntastic_start endif -let g:syntastic_version = '3.4.0-110' +let g:syntastic_version = '3.4.0-111' lockvar g:syntastic_version " Sanity checks {{{1 @@ -69,7 +69,7 @@ let g:syntastic_defaults = { \ 'ignore_files': [], \ 'loc_list_height': 10, \ 'quiet_messages': {}, - \ 'reuse_loc_lists': (v:version >= 704), + \ 'reuse_loc_lists': 0, \ 'sort_aggregated_errors': 1, \ 'stl_format': '[Syntax: line:%F (%t)]', \ 'style_error_symbol': 'S>', From 5c693a4c4cc6c48c181bd3c931f7160cf7538260 Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Tue, 22 Jul 2014 07:55:04 +0300 Subject: [PATCH 0575/1271] More detailed logging. --- plugin/syntastic.vim | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 1bca0af64..c2f835682 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -19,7 +19,7 @@ if has('reltime') lockvar! g:syntastic_start endif -let g:syntastic_version = '3.4.0-111' +let g:syntastic_version = '3.4.0-112' lockvar g:syntastic_version " Sanity checks {{{1 @@ -238,6 +238,11 @@ endfunction " }}}2 "refresh and redraw all the error info for this buf when saving or reading function! s:UpdateErrors(auto_invoked, ...) " {{{2 + call syntastic#log#debugShowVariables(g:SyntasticDebugTrace, 'version') + call syntastic#log#debugShowOptions(g:SyntasticDebugTrace, s:debug_dump_options) + call syntastic#log#debugDump(g:SyntasticDebugVariables) + call syntastic#log#debug(g:SyntasticDebugTrace, 'UpdateErrors' . (a:auto_invoked ? ' (auto)' : '') . + \ ': ' . (a:0 ? join(a:000) : 'default checkers')) if s:skipFile() return endif @@ -289,14 +294,13 @@ endfunction " }}}2 "detect and cache all syntax errors in this buffer function! s:CacheErrors(checker_names) " {{{2 + call syntastic#log#debug(g:SyntasticDebugTrace, 'CacheErrors: ' . + \ (len(a:checker_names) ? join(a:checker_names) : 'default checkers')) call s:ClearCache() let newLoclist = g:SyntasticLoclist.New([]) if !s:skipFile() " debug logging {{{3 - call syntastic#log#debugShowVariables(g:SyntasticDebugTrace, 'version') - call syntastic#log#debugShowOptions(g:SyntasticDebugTrace, s:debug_dump_options) - call syntastic#log#debugDump(g:SyntasticDebugVariables) call syntastic#log#debugShowVariables(g:SyntasticDebugTrace, 'aggregate_errors') call syntastic#log#debug(g:SyntasticDebugTrace, 'getcwd() = ' . getcwd()) " }}}3 @@ -550,10 +554,13 @@ endfunction " }}}2 " Skip running in special buffers function! s:skipFile() " {{{2 - let force_skip = exists('b:syntastic_skip_checks') ? b:syntastic_skip_checks : 0 let fname = expand('%') - return force_skip || (&buftype != '') || !filereadable(fname) || getwinvar(0, '&diff') || + let skip = (exists('b:syntastic_skip_checks') ? b:syntastic_skip_checks : 0) || + \ (&buftype != '') || !filereadable(fname) || getwinvar(0, '&diff') || \ s:ignoreFile(fname) || fnamemodify(fname, ':e') =~? g:syntastic_ignore_extensions + if skip + call syntastic#log#debug(g:SyntasticDebugTrace, 'skipFile: skipping') + endif endfunction " }}}2 " Take a list of errors and add default values to them from a:options From e7f82846235f2354de2c04e46ab16799c8c0f98a Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Tue, 22 Jul 2014 13:15:49 +0300 Subject: [PATCH 0576/1271] Manual: clarification about g:syntastic_mode_map. Minor cleanup. --- doc/syntastic.txt | 72 ++++++++++++++++++++++---------------------- plugin/syntastic.vim | 2 +- 2 files changed, 37 insertions(+), 37 deletions(-) diff --git a/doc/syntastic.txt b/doc/syntastic.txt index 21bef0cce..daefafdd3 100644 --- a/doc/syntastic.txt +++ b/doc/syntastic.txt @@ -323,8 +323,8 @@ error symbols can be customized: syntastic_style_warning_symbol - For style warnings, defaults to 'S>' Example: > - let g:syntastic_error_symbol = '✗' - let g:syntastic_warning_symbol = '⚠' + let g:syntastic_error_symbol = "✗" + let g:syntastic_warning_symbol = "⚠" < *'syntastic_enable_balloons'* Default: 1 @@ -396,12 +396,12 @@ Default: {} Use this option to map non-standard filetypes to standard ones. Corresponding checkers are mapped accordingly, which allows syntastic to check files with non-standard filetypes: > - let g:syntastic_filetype_map = { 'latex': 'tex', - \ 'gentoo-metadata': 'xml' } + let g:syntastic_filetype_map = { "latex": "tex", + \ "gentoo-metadata": "xml" } < Composite filetypes can also be mapped to simple types, which disables the default behaviour of running both checkers against the input file: > - let g:syntastic_filetype_map = { 'handlebars.html': 'handlebars' } + let g:syntastic_filetype_map = { "handlebars.html": "handlebars" } < *'syntastic_mode_map'* Default: { "mode": "active", @@ -413,26 +413,26 @@ done). The option should be set to something like: > - let g:syntastic_mode_map = { 'mode': 'active', - \ 'active_filetypes': ['ruby', 'php'], - \ 'passive_filetypes': ['puppet'] } + let g:syntastic_mode_map = { "mode": "active", + \ "active_filetypes": ["ruby", "php"], + \ "passive_filetypes": ["puppet"] } < -"mode" can be mapped to one of two values - "active" or "passive". When set to -active, syntastic does automatic checking whenever a buffer is saved or +"mode" can be mapped to one of two values - "active" or "passive". When set +to "active", syntastic does automatic checking whenever a buffer is saved or initially opened. When set to "passive" syntastic only checks when the user calls |:SyntasticCheck|. The exceptions to these rules are defined with "active_filetypes" and -"passive_filetypes". In passive mode, automatic checks are still done -for all filetypes in the "active_filetypes" array. In active mode, -automatic checks are not done for any filetypes in the -"passive_filetypes" array. +"passive_filetypes". In passive mode, automatic checks are still done for +filetypes in the "active_filetypes" array (and "passive_filetypes" is +ignored). In active mode, automatic checks are not done for any filetypes in +the "passive_filetypes" array ("active_filetypes" is ignored). -At runtime, the |:SyntasticToggleMode| command can be used to switch between -active and passive mode. +If any of "mode", "active_filetypes", or "passive_filetypes" are left +unspecified, they default to values above. -If any of "mode", "active_filetypes", or "passive_filetypes" are not specified -then they will default to their default value as above. +At runtime, the |:SyntasticToggleMode| command can be used to switch between +active and passive modes. *'syntastic_quiet_messages'* Default: {} @@ -473,7 +473,7 @@ Since filter elements with values [] or '' are ignored, you can disable global filters for particular checkers, by setting the values of the corresponding elements in |'syntastic___quiet_messages'| to [] or ''. For example, the following setting will silence all warnings, except for the -ones produced by 'pylint': > +ones produced by "pylint": > let g:syntastic_quiet_messages = { "level": "warnings" } let g:syntastic_python_pylint_quiet_messages = { "level" : [] } < @@ -542,7 +542,7 @@ List of filetypes handled by checkers external to syntastic. If you have a Vim plugin that adds a checker for syntastic, and if the said checker deals with a filetype that is unknown to syntastic, you might consider adding that filetype to this list: > - let g:syntastic_extra_filetypes = [ 'make', 'gitcommit' ] + let g:syntastic_extra_filetypes = [ "make", "gitcommit" ] < This will allow |:SyntasticInfo| to do proper tab completion for the new filetypes. @@ -556,14 +556,14 @@ filetypes. *'g:syntastic__checkers'* You can tell syntastic which checkers to run for a given filetype by setting a variable 'g:syntastic__checkers' to a list of checkers, e.g. > - let g:syntastic_php_checkers = ['php', 'phpcs', 'phpmd'] + let g:syntastic_php_checkers = ["php", "phpcs", "phpmd"] < *'b:syntastic_checkers'* There is also a per-buffer version of this setting, 'b:syntastic_checkers'. When set, it takes precedence over |'g:syntastic__checkers'|. You can use this in an autocmd to configure specific checkers for particular paths: > - autocmd FileType python if stridx(expand('%:p'), '/some/path/') == 0 | - \ let b:syntastic_checkers = ['pylint'] | endif + autocmd FileType python if stridx(expand("%:p"), "/some/path/") == 0 | + \ let b:syntastic_checkers = ["pylint"] | endif < If neither |'g:syntastic__checkers'| nor |'b:syntastic_checkers'| is set, a default list of checker is used. Beware however that this list @@ -594,10 +594,10 @@ default - in fact you can customise every part of the command that gets called. *'syntastic___