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 []
|
|
|
|
end
|
2013-01-20 06:07:05 -05:00
|
|
|
let makeprg = syntastic#makeprg#build({
|
|
|
|
\ 'exe': 'sass',
|
2013-03-27 05:17:15 -04:00
|
|
|
\ 'args': '--cache-location ' . s:sass_cache_location . ' ' . s:imports . ' --check',
|
|
|
|
\ 'subchecker': 'sass' })
|
2011-11-29 04:16:40 -05:00
|
|
|
let errorformat = '%ESyntax %trror:%m,%C on line %l of %f,%Z%.%#'
|
2011-01-31 02:57:54 -05:00
|
|
|
let errorformat .= ',%Wwarning on line %l:,%Z%m,Syntax %trror on line %l: %m'
|
2010-05-10 00:10:22 -04:00
|
|
|
let loclist = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
|
|
|
|
|
|
|
|
return loclist
|
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'})
|