2009-07-11 03:09:20 -04:00
|
|
|
"============================================================================
|
|
|
|
"File: sass.vim
|
|
|
|
"Description: Syntax checking plugin for syntastic.vim
|
2009-12-16 05:02:36 -05:00
|
|
|
"Maintainer: Martin Grenfell <martin.grenfell at gmail dot com>
|
2009-07-11 03:09:20 -04:00
|
|
|
"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.
|
|
|
|
"
|
|
|
|
"============================================================================
|
|
|
|
|
2013-02-21 10:50:41 -05:00
|
|
|
if exists("g:loaded_syntastic_sass_sass_checker")
|
|
|
|
finish
|
|
|
|
endif
|
|
|
|
let g:loaded_syntastic_sass_sass_checker=1
|
|
|
|
|
2013-01-27 15:08:30 -05:00
|
|
|
function! SyntaxCheckers_sass_sass_IsAvailable()
|
|
|
|
return executable("sass")
|
|
|
|
endfunction
|
2009-07-11 03:09:20 -04:00
|
|
|
|
2012-11-19 04:55:42 -05:00
|
|
|
"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()
|
|
|
|
|
2012-09-24 09:41:30 -04:00
|
|
|
"By default do not check partials as unknown variables are a syntax error
|
|
|
|
if !exists("g:syntastic_sass_check_partials")
|
|
|
|
let g:syntastic_sass_check_partials = 0
|
|
|
|
endif
|
|
|
|
|
2012-01-11 11:22:29 -05:00
|
|
|
"use compass imports if available
|
|
|
|
let s:imports = ""
|
|
|
|
if executable("compass")
|
|
|
|
let s:imports = "--compass"
|
|
|
|
endif
|
2011-01-31 02:57:54 -05:00
|
|
|
|
2013-01-27 15:08:30 -05:00
|
|
|
function! SyntaxCheckers_sass_sass_GetLocList()
|
2012-09-24 09:41:30 -04:00
|
|
|
if !g:syntastic_sass_check_partials && expand('%:t')[0] == '_'
|
|
|
|
return []
|
2013-05-31 14:05:45 -04:00
|
|
|
endif
|
|
|
|
|
2013-01-20 06:07:05 -05:00
|
|
|
let makeprg = syntastic#makeprg#build({
|
2013-05-13 09:37:16 -04:00
|
|
|
\ 'exe': 'sass',
|
|
|
|
\ 'args': '--cache-location ' . s:sass_cache_location . ' ' . s:imports . ' --check',
|
2013-05-31 14:05:45 -04:00
|
|
|
\ 'filetype': 'sass',
|
2013-05-13 09:37:16 -04:00
|
|
|
\ 'subchecker': 'sass' })
|
2013-05-31 14:05:45 -04:00
|
|
|
|
2013-05-13 09:37:16 -04:00
|
|
|
let errorformat =
|
2013-06-07 04:50:54 -04:00
|
|
|
\ '%ESyntax %trror: %m,' .
|
|
|
|
\ '%+C %.%#,' .
|
|
|
|
\ '%C on line %l of %f\, %.%#,' .
|
2013-05-13 09:37:16 -04:00
|
|
|
\ '%C on line %l of %f,' .
|
2013-06-07 04:50:54 -04:00
|
|
|
\ '%-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:,' .
|
2013-05-13 09:37:16 -04:00
|
|
|
\ '%Z%m,' .
|
2013-06-07 04:50:54 -04:00
|
|
|
\ '%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%.%#'
|
2013-05-13 09:37:16 -04:00
|
|
|
|
2013-05-31 14:05:45 -04:00
|
|
|
return SyntasticMake({
|
|
|
|
\ 'makeprg': makeprg,
|
2013-06-07 04:50:54 -04:00
|
|
|
\ 'errorformat': errorformat,
|
|
|
|
\ 'postprocess': ['compressWhitespace'] })
|
2009-07-11 03:09:20 -04:00
|
|
|
endfunction
|
2013-01-27 15:08:30 -05:00
|
|
|
|
|
|
|
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
|
|
|
\ 'filetype': 'sass',
|
|
|
|
\ 'name': 'sass'})
|