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.
|
|
|
|
"
|
|
|
|
"============================================================================
|
|
|
|
|
2015-03-25 12:44:34 -04:00
|
|
|
if exists('g:loaded_syntastic_sass_sass_checker')
|
2013-02-21 10:50:41 -05:00
|
|
|
finish
|
|
|
|
endif
|
2014-01-03 04:29:08 -05:00
|
|
|
let g:loaded_syntastic_sass_sass_checker = 1
|
2013-02-21 10:50:41 -05:00
|
|
|
|
2017-02-15 01:48:45 -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
|
2014-10-02 03:05:24 -04:00
|
|
|
let s:sass_cache_location = syntastic#util#tmpdir()
|
2014-04-23 07:45:21 -04:00
|
|
|
lockvar s:sass_cache_location
|
2012-11-19 04:55:42 -05:00
|
|
|
|
2014-10-02 03:05:24 -04:00
|
|
|
augroup syntastic
|
2014-10-02 13:05:01 -04:00
|
|
|
autocmd VimLeave * call syntastic#util#rmrf(s:sass_cache_location)
|
2014-10-02 03:05:24 -04:00
|
|
|
augroup END
|
|
|
|
|
2017-02-15 01:48:45 -05:00
|
|
|
" By default do not check partials as unknown variables are a syntax error
|
2015-03-25 12:44:34 -04:00
|
|
|
if !exists('g:syntastic_sass_check_partials')
|
2012-09-24 09:41:30 -04:00
|
|
|
let g:syntastic_sass_check_partials = 0
|
|
|
|
endif
|
|
|
|
|
2017-02-15 01:48:45 -05:00
|
|
|
" use compass imports if available
|
2015-03-25 12:44:34 -04:00
|
|
|
let s:imports = ''
|
|
|
|
if executable('compass')
|
|
|
|
let s:imports = '--compass'
|
2012-01-11 11:22:29 -05:00
|
|
|
endif
|
2011-01-31 02:57:54 -05:00
|
|
|
|
2014-01-03 04:29:08 -05:00
|
|
|
let s:save_cpo = &cpo
|
|
|
|
set cpo&vim
|
|
|
|
|
2013-10-28 07:53:33 -04:00
|
|
|
function! SyntaxCheckers_sass_sass_GetLocList() dict
|
2017-02-15 01:48:45 -05:00
|
|
|
let buf = bufnr('')
|
|
|
|
if !syntastic#util#bufVar(buf, 'sass_check_partials') && fnamemodify(bufname(buf), ':t')[0] ==# '_'
|
2012-09-24 09:41:30 -04:00
|
|
|
return []
|
2013-05-31 14:05:45 -04:00
|
|
|
endif
|
|
|
|
|
2013-11-01 05:51:47 -04:00
|
|
|
let makeprg = self.makeprgBuild({
|
2014-01-28 14:44:44 -05:00
|
|
|
\ 'args_before': '--cache-location ' . s:sass_cache_location . ' ' . s:imports . ' --check' })
|
2013-05-31 14:05:45 -04:00
|
|
|
|
2013-05-13 09:37:16 -04:00
|
|
|
let errorformat =
|
2014-09-16 11:12:50 -04:00
|
|
|
\ '%E%\m%\%%(Syntax %\)%\?%trror: %m,' .
|
2013-06-07 04:50:54 -04:00
|
|
|
\ '%+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'})
|
2014-01-03 04:29:08 -05:00
|
|
|
|
|
|
|
let &cpo = s:save_cpo
|
|
|
|
unlet s:save_cpo
|
|
|
|
|
2015-01-04 05:46:54 -05:00
|
|
|
" vim: set sw=4 sts=4 et fdm=marker:
|