Merge pull request #216 from kstep/vala-modules

vala: g:syntastic_vala_modules variable to set modules list via vim script
This commit is contained in:
Martin Grenfell 2012-03-26 08:16:35 -07:00
commit 39881cdd82

View File

@ -6,6 +6,9 @@
" "// modules: " and containing space delimited list of vala " "// modules: " and containing space delimited list of vala
" modules, used by the file, so this script can build correct " modules, used by the file, so this script can build correct
" --pkg arguments. " --pkg arguments.
" Alternatively you can set g:syntastic_vala_modules array
" in your .vimrc or .lvimrc with localvimrc plugin
" (http://www.vim.org/scripts/script.php?script_id=441).
" Valac compiler is not the fastest thing in the world, so you " Valac compiler is not the fastest thing in the world, so you
" may want to disable this plugin with " may want to disable this plugin with
" let g:syntastic_vala_check_disabled = 1 command in your .vimrc or " let g:syntastic_vala_check_disabled = 1 command in your .vimrc or
@ -38,10 +41,19 @@ function! SyntaxCheckers_vala_GetHighlightRegex(pos)
endfunction endfunction
function! s:GetValaModules() function! s:GetValaModules()
if exists('g:syntastic_vala_modules')
if type(g:syntastic_vala_modules) == type('')
return split(g:syntastic_vala_modules, '\s\+')
elseif type(g:syntastic_vala_modules) == type([])
return g:syntastic_vala_modules
else
echoerr 'g:syntastic_vala_modules must be either list or string: fallback to in file modules string'
endif
endif
let modules_line = search('^// modules: ', 'n') let modules_line = search('^// modules: ', 'n')
let modules_str = getline(modules_line) let modules_str = getline(modules_line)
let modules = split(strpart(modules_str, 12), '\s\+') return split(strpart(modules_str, 12), '\s\+')
return modules
endfunction endfunction
function! SyntaxCheckers_vala_GetLocList() function! SyntaxCheckers_vala_GetLocList()