Merge branch 'master' into gcc_refactor

This commit is contained in:
LCD 47 2013-07-01 18:18:35 +03:00
commit 582a717ff8
2 changed files with 32 additions and 26 deletions

View File

@ -25,7 +25,7 @@ if !exists("g:syntastic_always_populate_loc_list")
endif endif
if !exists("g:syntastic_auto_jump") if !exists("g:syntastic_auto_jump")
let syntastic_auto_jump=0 let g:syntastic_auto_jump = 0
endif endif
if !exists("g:syntastic_quiet_warnings") if !exists("g:syntastic_quiet_warnings")

View File

@ -19,36 +19,42 @@ function! SyntaxCheckers_haxe_haxe_IsAvailable()
return executable('haxe') return executable('haxe')
endfunction endfunction
" s:FindInParent " start in directory a:where and walk up the parent folders until it
" find the file argument and returns the path to it. " finds a file matching a:what; return path to that file
" Starting with the current working dir, it walks up the parent folders function! s:FindInParent(what, where)
" until it finds the file, or it hits the stop dir. let here = fnamemodify(a:where, ':p')
" If it doesn't find it, it returns "Nothing"
function! s:FindInParent(fln,flsrt,flstp) while !empty(here)
let here = a:flsrt let p = split(globpath(here, a:what), '\n')
while ( strlen( here) > 0 )
let p = split(globpath(here, a:fln), '\n') if !empty(p)
if len(p) > 0 return fnamemodify(p[0], ':p')
return ['ok', here, fnamemodify(p[0], ':p:t')] elseif here == '/'
endif
let fr = match(here, '/[^/]*$')
if fr == -1
break
endif
let here = strpart(here, 0, fr)
if here == a:flstp
break break
endif endif
" we use ':h:h' rather than ':h' since ':p' adds a trailing '/'
" if 'here' is a directory
let here = fnamemodify(here, ':p:h:h')
endwhile endwhile
return ['fail', '', '']
return ''
endfunction endfunction
function! SyntaxCheckers_haxe_haxe_GetLocList() function! SyntaxCheckers_haxe_haxe_GetLocList()
let [success, hxmldir, hxmlname] = s:FindInParent('*.hxml', expand('%:p:h'), '/') if exists('b:vaxe_hxml')
if success == 'ok' let hxml = b:vaxe_hxml
elseif exists('g:vaxe_hxml')
let hxml = g:vaxe_hxml
else
let hxml = s:FindInParent('*.hxml', expand('%:p:h'))
endif
let hxml = fnamemodify(hxml, ':p')
if !empty(hxml)
let makeprg = syntastic#makeprg#build({ let makeprg = syntastic#makeprg#build({
\ 'exe': 'haxe', \ 'exe': 'haxe',
\ 'fname': shellescape(fnameescape(hxmlname)), \ 'fname': shellescape(fnameescape(fnamemodify(hxml, ':t'))),
\ 'filetype': 'haxe', \ 'filetype': 'haxe',
\ 'subchecker': 'haxe' }) \ 'subchecker': 'haxe' })
@ -57,10 +63,10 @@ function! SyntaxCheckers_haxe_haxe_GetLocList()
return SyntasticMake({ return SyntasticMake({
\ 'makeprg': makeprg, \ 'makeprg': makeprg,
\ 'errorformat': errorformat, \ 'errorformat': errorformat,
\ 'cwd': hxmldir }) \ 'cwd': fnamemodify(hxml, ':h') })
else
return []
endif endif
return []
endfunction endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({ call g:SyntasticRegistry.CreateAndRegisterChecker({