aboutsummaryrefslogtreecommitdiff
path: root/vim/bundle/syntastic/syntax_checkers/less
diff options
context:
space:
mode:
Diffstat (limited to 'vim/bundle/syntastic/syntax_checkers/less')
-rw-r--r--vim/bundle/syntastic/syntax_checkers/less/less-lint.coffee41
-rw-r--r--vim/bundle/syntastic/syntax_checkers/less/less-lint.js57
-rw-r--r--vim/bundle/syntastic/syntax_checkers/less/lessc.vim59
-rw-r--r--vim/bundle/syntastic/syntax_checkers/less/recess.vim44
4 files changed, 201 insertions, 0 deletions
diff --git a/vim/bundle/syntastic/syntax_checkers/less/less-lint.coffee b/vim/bundle/syntastic/syntax_checkers/less/less-lint.coffee
new file mode 100644
index 0000000..0b05e4a
--- /dev/null
+++ b/vim/bundle/syntastic/syntax_checkers/less/less-lint.coffee
@@ -0,0 +1,41 @@
+#!/usr/bin/env node
+
+fs = require 'fs'
+less = require 'less'
+args = process.argv.slice(1)
+options = {}
+
+args = args.filter (arg) ->
+ match = arg.match(/^-I(.+)$/)
+ if match
+ options.paths.push(match[1]);
+ return false
+
+ match = arg.match(/^--?([a-z][\-0-9a-z]*)(?:=([^\s]+))?$/i)
+ if match
+ arg = match[1]
+ else
+ return arg
+
+ switch arg
+ when 'strict-imports' then options.strictImports = true
+ when 'include-path'
+ options.paths = match[2].split(if os.type().match(/Windows/) then ';' else ':')
+ .map (p) ->
+ if p
+ return path.resolve(process.cwd(), p)
+ when 'O0' then options.optimization = 0
+ when 'O1' then options.optimization = 1
+ when 'O2' then options.optimization = 2
+
+options.filename = args[1]
+
+parser = new(less.Parser) options
+
+fs.readFile(options.filename, 'utf-8', (err,data) ->
+ parser.parse(data, (err, tree) ->
+ if err
+ less.writeError err
+ process.exit(1)
+ )
+)
diff --git a/vim/bundle/syntastic/syntax_checkers/less/less-lint.js b/vim/bundle/syntastic/syntax_checkers/less/less-lint.js
new file mode 100644
index 0000000..5abc653
--- /dev/null
+++ b/vim/bundle/syntastic/syntax_checkers/less/less-lint.js
@@ -0,0 +1,57 @@
+// Generated by CoffeeScript 1.3.3
+(function() {
+ var args, fs, less, options, parser;
+
+ fs = require('fs');
+
+ less = require('less');
+
+ args = process.argv.slice(1);
+
+ options = {};
+
+ args = args.filter(function(arg) {
+ var match;
+ match = arg.match(/^-I(.+)$/);
+ if (match) {
+ options.paths.push(match[1]);
+ return false;
+ }
+ match = arg.match(/^--?([a-z][\-0-9a-z]*)(?:=([^\s]+))?$/i);
+ if (match) {
+ arg = match[1];
+ } else {
+ return arg;
+ }
+ switch (arg) {
+ case 'strict-imports':
+ return options.strictImports = true;
+ case 'include-path':
+ return options.paths = match[2].split(os.type().match(/Windows/) ? ';' : ':').map(function(p) {
+ if (p) {
+ return path.resolve(process.cwd(), p);
+ }
+ });
+ case 'O0':
+ return options.optimization = 0;
+ case 'O1':
+ return options.optimization = 1;
+ case 'O2':
+ return options.optimization = 2;
+ }
+ });
+
+ options.filename = args[1];
+
+ parser = new less.Parser(options);
+
+ fs.readFile(options.filename, 'utf-8', function(err, data) {
+ return parser.parse(data, function(err, tree) {
+ if (err) {
+ less.writeError(err);
+ return process.exit(1);
+ }
+ });
+ });
+
+}).call(this);
diff --git a/vim/bundle/syntastic/syntax_checkers/less/lessc.vim b/vim/bundle/syntastic/syntax_checkers/less/lessc.vim
new file mode 100644
index 0000000..ad4035e
--- /dev/null
+++ b/vim/bundle/syntastic/syntax_checkers/less/lessc.vim
@@ -0,0 +1,59 @@
+"============================================================================
+"File: less.vim
+"Description: Syntax checking plugin for syntastic.vim
+"Maintainer: Julien Blanchard <julien at sideburns dot eu>
+"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_lessc_checker')
+ finish
+endif
+let g:loaded_syntastic_less_lessc_checker = 1
+
+if !exists('g:syntastic_less_use_less_lint')
+ let g:syntastic_less_use_less_lint = 0
+endif
+
+let s:save_cpo = &cpo
+set cpo&vim
+
+let s:node_file = 'node ' . syntastic#util#shescape(expand('<sfile>:p:h', 1) . syntastic#util#Slash() . 'less-lint.js')
+
+function! SyntaxCheckers_less_lessc_IsAvailable() dict
+ call self.log('g:syntastic_less_use_less_lint =', g:syntastic_less_use_less_lint)
+ return g:syntastic_less_use_less_lint ? executable('node') : executable(self.getExec())
+endfunction
+
+function! SyntaxCheckers_less_lessc_GetLocList() dict
+ call syntastic#log#deprecationWarn('less_options', 'less_lessc_args')
+
+ let makeprg = self.makeprgBuild({
+ \ 'exe': (g:syntastic_less_use_less_lint ? s:node_file : self.getExecEscaped()),
+ \ 'args_after': '--no-color',
+ \ 'tail': '> ' . syntastic#util#DevNull() })
+
+ let errorformat =
+ \ '%m in %f on line %l\, column %c:,' .
+ \ '%m in %f:%l:%c,' .
+ \ '%-G%.%#'
+
+ return SyntasticMake({
+ \ 'makeprg': makeprg,
+ \ 'errorformat': errorformat,
+ \ 'postprocess': ['guards'],
+ \ 'defaults': {'bufnr': bufnr(''), 'text': 'Syntax error'} })
+endfunction
+
+call g:SyntasticRegistry.CreateAndRegisterChecker({
+ \ 'filetype': 'less',
+ \ 'name': 'lessc'})
+
+let &cpo = s:save_cpo
+unlet s:save_cpo
+
+" vim: set sw=4 sts=4 et fdm=marker:
diff --git a/vim/bundle/syntastic/syntax_checkers/less/recess.vim b/vim/bundle/syntastic/syntax_checkers/less/recess.vim
new file mode 100644
index 0000000..1a8d876
--- /dev/null
+++ b/vim/bundle/syntastic/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 <tim at pixelastic 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_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 sw=4 sts=4 et fdm=marker: