syntastic git · master
syntastic vim plugin (fork)
Vim Script 99%git clone https://git.christianimmanuel.de/mirrors-forks/syntastic.gitwget https://git.christianimmanuel.de/mirrors-forks/syntastic/archive/syntastic.tar.gzPerl6 is dead, long live Raku!
README.markdown | 2 +- autoload/syntastic/preprocess.vim | 74 ++++++++++++------------ doc/syntastic-checkers.txt | 117 ++++++++++++++++++-------------------- plugin/syntastic.vim | 2 +- plugin/syntastic/registry.vim | 1 + syntax_checkers/perl6/perl6.vim | 91 ++--------------------------- syntax_checkers/raku/raku.vim | 106 ++++++++++++++++++++++++++++++++++ 7 files changed, 207 insertions(+), 186 deletions(-) diff --git a/README.markdown b/README.markdown index 903b8279..8f4c956d 100644 --- a/README.markdown +++ b/README.markdown @@ -66,7 +66,7 @@ DocBook, Dockerfile, 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, Markdown, MATLAB, Mercury, NASM, Nix, Objective-C, Objective-C++, OCaml, Perl, Perl -6, Perl POD, PHP, gettext Portable Object, OS X and iOS property lists, Pug +POD, PHP, gettext Portable Object, Raku, OS X and iOS property lists, Pug (formerly Jade), Puppet, Python, QML, R, Racket, RDF TriG, RDF Turtle, Relax NG, reStructuredText, RPM spec, Ruby, SASS/SCSS, Scala, Slim, SML, Solidity, Sphinx, SQL, Stylus, Tcl, TeX, Texinfo, Twig, TypeScript, Verilog, VHDL, Vim diff --git a/autoload/syntastic/preprocess.vim b/autoload/syntastic/preprocess.vim index e27acf10..fa42f53b 100644 --- a/autoload/syntastic/preprocess.vim +++ b/autoload/syntastic/preprocess.vim @@ -302,43 +302,6 @@ function! syntastic#preprocess#perl(errors) abort " {{{2 return syntastic#util#unique(out) endfunction " }}}2 -function! syntastic#preprocess#perl6(errors) abort " {{{2 - if a:errors[0] ==# 'Syntax OK' - return [] - endif - - let errs = s:_decode_JSON(join(a:errors, '')) - - let out = [] - if type(errs) == type({}) - try - for val in values(errs) - let line = get(val, 'line', 0) - let pos = get(val, 'pos', 0) - if pos && has('byte_offset') - let line_pos = byte2line(pos + 1) - let column = line_pos > 0 ? pos - line2byte(line_pos) + 2 : 0 - else - let column = 0 - endif - - call add(out, join([ - \ get(val, 'filename', ''), - \ line, - \ column, - \ get(val, 'message', '') ], ':')) - endfor - catch /\m^Vim\%((\a\+)\)\=:E716/ - call syntastic#log#warn('checker perl6/perl6: unrecognized error item ' . string(val)) - let out = [] - endtry - else - call syntastic#log#warn('checker perl6/perl6: unrecognized error format') - endif - - return out -endfunction " }}}2 - function! syntastic#preprocess#prospector(errors) abort " {{{2 let errs = join(a:errors, '') if errs ==# '' @@ -426,6 +389,43 @@ function! syntastic#preprocess#rparse(errors) abort " {{{2 return out endfunction " }}}2 +function! syntastic#preprocess#raku(errors) abort " {{{2 + if a:errors[0] ==# 'Syntax OK' + return [] + endif + + let errs = s:_decode_JSON(join(a:errors, '')) + + let out = [] + if type(errs) == type({}) + try + for val in values(errs) + let line = get(val, 'line', 0) + let pos = get(val, 'pos', 0) + if pos && has('byte_offset') + let line_pos = byte2line(pos + 1) + let column = line_pos > 0 ? pos - line2byte(line_pos) + 2 : 0 + else + let column = 0 + endif + + call add(out, join([ + \ get(val, 'filename', ''), + \ line, + \ column, + \ get(val, 'message', '') ], ':')) + endfor + catch /\m^Vim\%((\a\+)\)\=:E716/ + call syntastic#log#warn('checker raku/raku: unrecognized error item ' . string(val)) + let out = [] + endtry + else + call syntastic#log#warn('checker raku/raku: unrecognized error format') + endif + + return out +endfunction " }}}2 + function! syntastic#preprocess#remark_lint(errors) abort " {{{2 let out = [] let fname = expand('%', 1) diff --git a/doc/syntastic-checkers.txt b/doc/syntastic-checkers.txt index e49c1b4b..1f6fc5f7 100644 --- a/doc/syntastic-checkers.txt +++ b/doc/syntastic-checkers.txt @@ -80,7 +80,6 @@ SYNTAX CHECKERS BY LANGUAGE *syntastic-checkers-lang* OCaml....................................|syntastic-checkers-ocaml| Perl.....................................|syntastic-checkers-perl| - Perl 6...................................|syntastic-checkers-perl6| PHP......................................|syntastic-checkers-php| POD......................................|syntastic-checkers-pod| Pug (formerly Jade)......................|syntastic-checkers-pug| @@ -92,6 +91,7 @@ SYNTAX CHECKERS BY LANGUAGE *syntastic-checkers-lang* R........................................|syntastic-checkers-r| R Markdown...............................|syntastic-checkers-rmd| Racket...................................|syntastic-checkers-racket| + Raku.....................................|syntastic-checkers-raku| Relax NG.................................|syntastic-checkers-rnc| reStructuredText.........................|syntastic-checkers-rst| RPM spec.................................|syntastic-checkers-spec| @@ -4757,66 +4757,6 @@ accepts the standard options described at |syntastic-config-makeprg|. See also: |syntastic-pod-podchecker|. -============================================================================== -SYNTAX CHECKERS FOR PERL 6 *syntastic-checkers-perl6* - -The following checkers are available for Perl 6 (filetype "perl6"): - - 1. perl6....................|syntastic-perl6-perl6| - ------------------------------------------------------------------------------- -1. perl6 *syntastic-perl6-perl6* - -Name: perl6 -Maintainers: Claudio Ramirez <pub.claudio@gmail.com> - -"perl6" is a checker for Perl 6 files using the "Rakudo" compiler. See the -project's page for details: - - http://rakudo.org/ - -Syntastic requires Rakudo Star release 2018.08 or later. Syntastic can't -enforce this, since it can't reliably compare Rakudo Star versions. - -Security~ - -This checker runs "perl6 -c" against your files, which executes any "BEGIN" -and "CHECK" blocks (cf. https://docs.perl6.org/programs/00-running). 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_perl6_checker' to 1 in -your vimrc to enable this checker: > - let g:syntastic_enable_perl6_checker = 1 -< -There is also a buffer-local version of this variable, that takes precedence -over it in the buffers where it is defined. - -Please note that setting this variable doesn't automatically enable the -checker, you still need to add it to 'g:syntastic_perl6_checkers' if you plan -to use it. - -Checker options~ - -This checker is initialised using the "makeprgBuild()" function and thus it -accepts the standard options described at syntastic-config-makeprg. - -Additionally: - - *'g:syntastic_perl6_lib_path'* -Type: list of strings -Default: [] -List of include directories to be added to the perl6 command line. Example: > - let g:syntastic_perl6_lib_path = [ "./lib", "./lib/auto" ] -< -You can also set the "PERL6LIB" environment variable to a colon-separated -list of add-hoc include paths. These paths will then be added to the ones -prescribed by |'g:syntastic_perl6_lib_path'|. - -Note~ - -At the time of this writing the support for JSON error output of the "Rakudo" -compiler is still incomplete. - ============================================================================== SYNTAX CHECKERS FOR PHP *syntastic-checkers-php* @@ -5590,6 +5530,61 @@ Checker options~ This checker is initialised using the "makeprgBuild()" function and thus it accepts the standard options described at |syntastic-config-makeprg|. +============================================================================== +SYNTAX CHECKERS FOR RAKU *syntastic-checkers-raku* + +The following checkers are available for Raku (filetype "raku"): + + 1. Raku.....................|syntastic-raku-raku| + +------------------------------------------------------------------------------ +1. Raku *syntastic-raku-raku* + +Name: raku +Maintainers: Claudio Ramirez <pub.claudio@gmail.com> + +"raku" is a checker for Raku files using the "Rakudo" compiler. See the +project's page for details: + + http://rakudo.org/ + +Syntastic requires Rakudo Star release 2018.08 or later. Syntastic can't +enforce this, since it can't reliably compare Rakudo Star versions. + +Security~ + +This checker runs "raku -c" against your files, which executes any "BEGIN" and +"CHECK" blocks (cf. https://docs.raku.org/programs/03-environment-variables). +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_raku_checker' to 1 in +your vimrc to enable this checker: > + let g:syntastic_enable_raku_checker = 1 +< +There is also a buffer-local version of this variable, that takes precedence +over it in the buffers where it is defined. + +Please note that setting this variable doesn't automatically enable the +checker, you still need to add it to 'g:syntastic_raku_checkers' if you plan +to use it. + +Checker options~ + +This checker is initialised using the "makeprgBuild()" function and thus it +accepts the standard options described at syntastic-config-makeprg. + +Additionally: + + *'g:syntastic_raku_lib_path'* +Type: list of strings +Default: [] +List of include directories to be added to the raku command line. Example: > + let g:syntastic_raku_lib_path = [ "./lib", "./lib/auto" ] +< +You can also set the "RAKULIB" environment variable to a colon-separated +list of add-hoc include paths. These paths will then be added to the ones +prescribed by |'g:syntastic_raku_lib_path'|. + ============================================================================== SYNTAX CHECKERS FOR RELAX NG *syntastic-checkers-rnc* diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 3e34f9c8..21203e00 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.10.0-23' +let g:_SYNTASTIC_VERSION = '3.10.0-24' lockvar g:_SYNTASTIC_VERSION " Sanity checks {{{1 diff --git a/plugin/syntastic/registry.vim b/plugin/syntastic/registry.vim index b1bda27a..bdd74f54 100644 --- a/plugin/syntastic/registry.vim +++ b/plugin/syntastic/registry.vim @@ -78,6 +78,7 @@ let s:_DEFAULT_CHECKERS = { \ 'r': [], \ 'rmd': [], \ 'racket': ['racket'], + \ 'raku': [], \ 'rnc': ['rnv'], \ 'rst': ['rst2pseudoxml'], \ 'ruby': ['mri'], diff --git a/syntax_checkers/perl6/perl6.vim b/syntax_checkers/perl6/perl6.vim index 32d8f718..b931d165 100644 --- a/syntax_checkers/perl6/perl6.vim +++ b/syntax_checkers/perl6/perl6.vim @@ -1,7 +1,7 @@ "============================================================================ "File: perl6.vim "Description: Syntax checking plugin for syntastic -"Maintainer: Claudio Ramirez <pub.claudio at gmail dot com> +"Maintainer: LCD 47 <lcd047 at gmail dot 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 @@ -9,98 +9,17 @@ " See http://sam.zoy.org/wtfpl/COPYING for more details. " "============================================================================ -" -" Security: -" -" This checker runs 'perl6 -c' against your file, which in turn executes -" any BEGIN and CHECK blocks in your file. This is probably fine if you -" wrote the file 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 file, set g:syntastic_enable_perl6_checker to 1 in your vimrc -" to enable this -" checker: -" -" let g:syntastic_enable_perl6_checker = 1 -" -" Reference: -" -" - https://docs.perl6.org/programs/00-running + +# Perl 6 is dead, long live Raku! if exists('g:loaded_syntastic_perl6_perl6_checker') finish endif -let g:loaded_syntastic_perl6_perl6_checker = 1 - -if !exists('g:syntastic_perl6_lib_path') - let g:syntastic_perl6_lib_path = [] -endif - -if !exists('g:syntastic_perl6_perl6_sort') - let g:syntastic_perl6_perl6_sort = 1 -endif - -let s:save_cpo = &cpo -set cpo&vim - -function! SyntaxCheckers_perl6_perl6_IsAvailable() dict " {{{1 - " don't call executable() here, to allow things like - " let g:syntastic_perl6_perl6_exec = '/usr/bin/env perl6' - silent! call syntastic#util#system(self.getExecEscaped() . ' -e ' . syntastic#util#shescape('exit(0)')) - return (v:shell_error == 0) && syntastic#util#versionIsAtLeast(self.getVersion(), [2017, 1]) -endfunction " }}}1 - -function! SyntaxCheckers_perl6_perl6_GetHighlightRegex(item) " {{{1 - let term = matchstr(a:item['text'], '\m''\zs.\{-}\ze''') - if term !=# '' - return '\V' . escape(term, '\') - endif - let term = matchstr(a:item['text'], '\m^Undeclared .\+:\W\zs\S\+\ze') - if term !=# '' - return '\V' . escape(term, '\') - endif - let term = matchstr(a:item['text'], '\mCould not find \zs.\{-}\ze at') - if term !=# '' - return '\V' . escape(term, '\') - endif - let term = matchstr(a:item['text'], '\mCould not find \zs\S\+$') - return term !=# '' ? '\V' . escape(term, '\') : '' -endfunction " }}}1 - -function! SyntaxCheckers_perl6_perl6_GetLocList() dict " {{{1 - if type(g:syntastic_perl6_lib_path) == type('') - call syntastic#log#oneTimeWarn('variable g:syntastic_perl6_lib_path should be a list') - let includes = split(g:syntastic_perl6_lib_path, ',') - else - let includes = copy(syntastic#util#var('perl6_lib_path', [])) - endif - " support for PERL6LIB environment variable - if $PERL6LIB !=# '' - let includes += split($PERL6LIB, ':') - endif - call map(includes, '"-I" . v:val') - - let errorformat = - \ '%f:%l:%c:%m,' . - \ ':%l:%c:%m' - - let makeprg = self.makeprgBuild({ 'args_before': ['-c'] + includes }) - - return SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat, - \ 'env': { 'PERL6_EXCEPTIONS_HANDLER': 'JSON' }, - \ 'defaults': { 'bufnr': bufnr(''), 'type': 'E' }, - \ 'returns': [0, 1], - \ 'preprocess': 'perl6', - \ 'postprocess': ['guards', 'iconv'] }) -endfunction " }}}1 +let g:loaded_syntastic_raku_raku_checker = 1 call g:SyntasticRegistry.CreateAndRegisterChecker({ \ 'filetype': 'perl6', \ 'name': 'perl6', - \ 'enable': 'enable_perl6_checker'}) - -let &cpo = s:save_cpo -unlet s:save_cpo + \ 'redirect': 'raku/raku'}) " vim: set sw=4 sts=4 et fdm=marker: diff --git a/syntax_checkers/raku/raku.vim b/syntax_checkers/raku/raku.vim new file mode 100644 index 00000000..78fd87ef --- /dev/null +++ b/syntax_checkers/raku/raku.vim @@ -0,0 +1,106 @@ +"============================================================================ +"File: raku.vim +"Description: Syntax checking plugin for syntastic +"Maintainer: Claudio Ramirez <pub.claudio at gmail dot 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. +" +"============================================================================ +" +" Security: +" +" This checker runs 'raku -c' against your file, which in turn executes +" any BEGIN and CHECK blocks in your file. This is probably fine if you +" wrote the file 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 file, set g:syntastic_enable_raku_checker to 1 in your vimrc +" to enable this +" checker: +" +" let g:syntastic_enable_raku_checker = 1 +" +" Reference: +" +" - https://docs.raku.org/programs/03-environment-variables + +if exists('g:loaded_syntastic_raku_raku_checker') + finish +endif +let g:loaded_syntastic_raku_raku_checker = 1 + +if !exists('g:syntastic_raku_lib_path') + let g:syntastic_raku_lib_path = [] +endif + +if !exists('g:syntastic_raku_raku_sort') + let g:syntastic_raku_raku_sort = 1 +endif + +let s:save_cpo = &cpo +set cpo&vim + +function! SyntaxCheckers_raku_raku_IsAvailable() dict " {{{1 + " don't call executable() here, to allow things like + " let g:syntastic_raku_raku_exec = '/usr/bin/env raku' + silent! call syntastic#util#system(self.getExecEscaped() . ' -e ' . syntastic#util#shescape('exit(0)')) + return (v:shell_error == 0) && syntastic#util#versionIsAtLeast(self.getVersion(), [2017, 1]) +endfunction " }}}1 + +function! SyntaxCheckers_raku_raku_GetHighlightRegex(item) " {{{1 + let term = matchstr(a:item['text'], '\m''\zs.\{-}\ze''') + if term !=# '' + return '\V' . escape(term, '\') + endif + let term = matchstr(a:item['text'], '\m^Undeclared .\+:\W\zs\S\+\ze') + if term !=# '' + return '\V' . escape(term, '\') + endif + let term = matchstr(a:item['text'], '\mCould not find \zs.\{-}\ze at') + if term !=# '' + return '\V' . escape(term, '\') + endif + let term = matchstr(a:item['text'], '\mCould not find \zs\S\+$') + return term !=# '' ? '\V' . escape(term, '\') : '' +endfunction " }}}1 + +function! SyntaxCheckers_raku_raku_GetLocList() dict " {{{1 + if type(g:syntastic_raku_lib_path) == type('') + call syntastic#log#oneTimeWarn('variable g:syntastic_raku_lib_path should be a list') + let includes = split(g:syntastic_raku_lib_path, ',') + else + let includes = copy(syntastic#util#var('raku_lib_path', [])) + endif + " support for RAKULIB environment variable + if $RAKULIB !=# '' + let includes += split($RAKULIB, ':') + endif + call map(includes, '"-I" . v:val') + + let errorformat = + \ '%f:%l:%c:%m,' . + \ ':%l:%c:%m' + + let makeprg = self.makeprgBuild({ 'args_before': ['-c'] + includes }) + + return SyntasticMake({ + \ 'makeprg': makeprg, + \ 'errorformat': errorformat, + \ 'env': { 'RAKU_EXCEPTIONS_HANDLER': 'JSON' }, + \ 'defaults': { 'bufnr': bufnr(''), 'type': 'E' }, + \ 'returns': [0, 1], + \ 'preprocess': 'raku', + \ 'postprocess': ['guards', 'iconv'] }) +endfunction " }}}1 + +call g:SyntasticRegistry.CreateAndRegisterChecker({ + \ 'filetype': 'raku', + \ 'name': 'raku', + \ 'enable': 'enable_raku_checker'}) + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set sw=4 sts=4 et fdm=marker: