Merge branch 'master' into gcc_refactor

This commit is contained in:
LCD 47 2013-07-06 09:23:46 +03:00
commit fd01b9091d
3 changed files with 39 additions and 40 deletions

View File

@ -124,6 +124,28 @@ function! syntastic#util#bufIsActive(buffer)
return 0
endfunction
" start in directory a:where and walk up the parent folders until it
" finds a file matching a:what; return path to that file
function! syntastic#util#findInParent(what, where)
let here = fnamemodify(a:where, ':p')
while !empty(here)
let p = split(globpath(here, a:what), '\n')
if !empty(p)
return fnamemodify(p[0], ':p')
elseif here == '/'
break
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
return ''
endfunction
" Returns unique elements in a list
function! syntastic#util#unique(list)
let seen = {}

View File

@ -14,31 +14,30 @@ if exists("g:loaded_syntastic_elixir_elixir_checker")
endif
let g:loaded_syntastic_elixir_elixir_checker=1
let s:syntastic_elixir_compile_command = 'elixir'
if filereadable('mix.exs')
let s:syntastic_elixir_compile_command = 'mix compile'
endif
" TODO: we should probably split this into separate checkers
function! SyntaxCheckers_elixir_elixir_IsAvailable()
if s:syntastic_elixir_compile_command == 'elixir'
return executable('elixir')
else
return executable('mix')
endif
return executable('elixir') && executable('mix')
endfunction
function! SyntaxCheckers_elixir_elixir_GetLocList()
let makeprg = syntastic#makeprg#build({
\ 'exe': s:syntastic_elixir_compile_command,
let make_options = {}
let compile_command = 'elixir'
let mix_file = syntastic#util#findInParent('mix.exs', expand('%:p:h'))
if filereadable(mix_file)
let compile_command = 'mix compile'
let make_options['cwd'] = fnamemodify(mix_file, ':p:h')
endif
let make_options['makeprg'] = syntastic#makeprg#build({
\ 'exe': compile_command,
\ 'filetype': 'elixir',
\ 'subchecker': 'elixir' })
let errorformat = '** %*[^\ ] %f:%l: %m'
let make_options['errorformat'] = '** %*[^\ ] %f:%l: %m'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat })
return SyntasticMake(make_options)
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({

View File

@ -19,35 +19,13 @@ function! SyntaxCheckers_haxe_haxe_IsAvailable()
return executable('haxe')
endfunction
" start in directory a:where and walk up the parent folders until it
" finds a file matching a:what; return path to that file
function! s:FindInParent(what, where)
let here = fnamemodify(a:where, ':p')
while !empty(here)
let p = split(globpath(here, a:what), '\n')
if !empty(p)
return fnamemodify(p[0], ':p')
elseif here == '/'
break
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
return ''
endfunction
function! SyntaxCheckers_haxe_haxe_GetLocList()
if exists('b:vaxe_hxml')
let hxml = b:vaxe_hxml
elseif exists('g:vaxe_hxml')
let hxml = g:vaxe_hxml
else
let hxml = s:FindInParent('*.hxml', expand('%:p:h'))
let hxml = syntastic#util#findInParent('*.hxml', expand('%:p:h'))
endif
let hxml = fnamemodify(hxml, ':p')