New checker julia/lint for Julia.

This commit is contained in:
LCD 47 2017-04-24 16:45:44 +03:00
parent 0bfac45565
commit b9d35359be
5 changed files with 86 additions and 2 deletions

View File

@ -62,7 +62,7 @@ AppleScript, AsciiDoc, Assembly languages, BEMHTML, Bro, Bourne shell, C,
C++, C#, Cabal, Chef, CoffeeScript, Coco, Coq, CSS, Cucumber, CUDA, D, Dart, C++, C#, Cabal, Chef, CoffeeScript, Coco, Coq, CSS, Cucumber, CUDA, D, Dart,
DocBook, Dockerfile, Dust, Elixir, Erlang, eRuby, Fortran, Gentoo metadata, DocBook, Dockerfile, Dust, Elixir, Erlang, eRuby, Fortran, Gentoo metadata,
GLSL, Go, Haml, Haskell, Haxe, Handlebars, HSS, HTML, Java, JavaScript, JSON, GLSL, Go, Haml, Haskell, Haxe, Handlebars, HSS, HTML, Java, JavaScript, JSON,
JSX, LESS, Lex, Limbo, LISP, LLVM intermediate language, Lua, Markdown, JSX, Julia, LESS, Lex, Limbo, LISP, LLVM intermediate language, Lua, Markdown,
MATLAB, Mercury, NASM, Nix, Objective-C, Objective-C++, OCaml, Perl, Perl MATLAB, Mercury, NASM, Nix, Objective-C, Objective-C++, OCaml, Perl, Perl
POD, PHP, gettext Portable Object, OS X and iOS property lists, Pug (formerly POD, PHP, gettext Portable Object, OS X and iOS property lists, Pug (formerly
Jade), Puppet, Python, QML, R, Racket, RDF TriG, RDF Turtle, Relax NG, Jade), Puppet, Python, QML, R, Racket, RDF TriG, RDF Turtle, Relax NG,

View File

@ -58,6 +58,7 @@ SYNTAX CHECKERS BY LANGUAGE *syntastic-checkers-lang*
Java.....................................|syntastic-checkers-java| Java.....................................|syntastic-checkers-java|
JavaScript...............................|syntastic-checkers-javascript| JavaScript...............................|syntastic-checkers-javascript|
JSON.....................................|syntastic-checkers-json| JSON.....................................|syntastic-checkers-json|
Julia....................................|syntastic-checkers-julia|
LESS.....................................|syntastic-checkers-less| LESS.....................................|syntastic-checkers-less|
Lex......................................|syntastic-checkers-lex| Lex......................................|syntastic-checkers-lex|
@ -3591,6 +3592,37 @@ Checker options~
This checker is initialised using the "makeprgBuild()" function and thus it This checker is initialised using the "makeprgBuild()" function and thus it
accepts the standard options described at |syntastic-config-makeprg|. accepts the standard options described at |syntastic-config-makeprg|.
==============================================================================
SYNTAX CHECKERS FOR JULIA *syntastic-checkers-julia*
The following checkers are available for Julia (filetype "julia"):
1. lint.....................|syntastic-julia-lint|
------------------------------------------------------------------------------
1. lint *syntastic-julia-lint*
Name: lint
Maintainer: LCD 47 <lcd047@gmail.com>
This is a checker for Julia files (https://julialang.org/), using the Julia
package "Lint". See the package's documentation for more information:
http://lintjl.readthedocs.io/
Installation~
You need to install Julia itself, and the package "Lint". You can install
"Lint" from the Julia package manager, with the command: >
Pkg.add("Lint")
Checker Options~
This checker doesn't call the "makeprgBuild()" function, and thus it ignores
the usual 'g:syntastic_julia_lint_<option>' variables. The only exception is
'g:syntastic_julia_lint_exec', which can still be used to override the "julia"
executable.
============================================================================== ==============================================================================
SYNTAX CHECKERS FOR LESS *syntastic-checkers-less* SYNTAX CHECKERS FOR LESS *syntastic-checkers-less*

View File

@ -19,7 +19,7 @@ if has('reltime')
lockvar! g:_SYNTASTIC_START lockvar! g:_SYNTASTIC_START
endif endif
let g:_SYNTASTIC_VERSION = '3.8.0-40' let g:_SYNTASTIC_VERSION = '3.8.0-41'
lockvar g:_SYNTASTIC_VERSION lockvar g:_SYNTASTIC_VERSION
" Sanity checks {{{1 " Sanity checks {{{1

View File

@ -50,6 +50,7 @@ let s:_DEFAULT_CHECKERS = {
\ 'java': ['javac'], \ 'java': ['javac'],
\ 'javascript': ['jshint', 'jslint'], \ 'javascript': ['jshint', 'jslint'],
\ 'json': ['jsonlint', 'jsonval'], \ 'json': ['jsonlint', 'jsonval'],
\ 'julia': [],
\ 'less': ['lessc'], \ 'less': ['lessc'],
\ 'lex': ['flex'], \ 'lex': ['flex'],
\ 'limbo': ['limbo'], \ 'limbo': ['limbo'],

View File

@ -0,0 +1,51 @@
"============================================================================
"File: lint.vim
"Description: Syntax checking plugin for syntastic
"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
" 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_julia_lint_checker')
finish
endif
let g:loaded_syntastic_julia_lint_checker = 1
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_julia_lint_GetHighlightRegex(item)
let term = matchstr(a:item['text'], '\m^\S\+\ze:')
return term !=# '' ? '\V' . escape(term, '\') : ''
endfunction
function! SyntaxCheckers_julia_lint_IsAvailable() dict
return
\ executable(self.getExec()) &&
\ syntastic#util#system(self.getExecEscaped() . ' -e ' . syntastic#util#shescape('import Lint')) ==# '' &&
\ v:shell_error == 0
endfunction
function! SyntaxCheckers_julia_lint_GetLocList() dict
let buf = bufnr('')
let makeprg = self.getExecEscaped() . ' -e ' . syntastic#util#shescape('using Lint; display(filter(err -> !isinfo(err), lintfile("' . escape(bufname(buf), '\"') . '")))')
let errorformat = '%f:%l %t%n %m'
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'julia',
\ 'name': 'lint',
\ 'exec': 'julia' })
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set sw=4 sts=4 et fdm=marker: