Merge branch 'master' into gcc_refactor
This commit is contained in:
commit
fd01b9091d
@ -124,6 +124,28 @@ function! syntastic#util#bufIsActive(buffer)
|
|||||||
return 0
|
return 0
|
||||||
endfunction
|
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
|
" Returns unique elements in a list
|
||||||
function! syntastic#util#unique(list)
|
function! syntastic#util#unique(list)
|
||||||
let seen = {}
|
let seen = {}
|
||||||
|
@ -14,31 +14,30 @@ if exists("g:loaded_syntastic_elixir_elixir_checker")
|
|||||||
endif
|
endif
|
||||||
let g:loaded_syntastic_elixir_elixir_checker=1
|
let g:loaded_syntastic_elixir_elixir_checker=1
|
||||||
|
|
||||||
let s:syntastic_elixir_compile_command = 'elixir'
|
" TODO: we should probably split this into separate checkers
|
||||||
|
|
||||||
if filereadable('mix.exs')
|
|
||||||
let s:syntastic_elixir_compile_command = 'mix compile'
|
|
||||||
endif
|
|
||||||
|
|
||||||
function! SyntaxCheckers_elixir_elixir_IsAvailable()
|
function! SyntaxCheckers_elixir_elixir_IsAvailable()
|
||||||
if s:syntastic_elixir_compile_command == 'elixir'
|
return executable('elixir') && executable('mix')
|
||||||
return executable('elixir')
|
|
||||||
else
|
|
||||||
return executable('mix')
|
|
||||||
endif
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! SyntaxCheckers_elixir_elixir_GetLocList()
|
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',
|
\ 'filetype': 'elixir',
|
||||||
\ 'subchecker': 'elixir' })
|
\ 'subchecker': 'elixir' })
|
||||||
|
|
||||||
let errorformat = '** %*[^\ ] %f:%l: %m'
|
let make_options['errorformat'] = '** %*[^\ ] %f:%l: %m'
|
||||||
|
|
||||||
return SyntasticMake({
|
return SyntasticMake(make_options)
|
||||||
\ 'makeprg': makeprg,
|
|
||||||
\ 'errorformat': errorformat })
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||||
|
@ -19,35 +19,13 @@ function! SyntaxCheckers_haxe_haxe_IsAvailable()
|
|||||||
return executable('haxe')
|
return executable('haxe')
|
||||||
endfunction
|
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()
|
function! SyntaxCheckers_haxe_haxe_GetLocList()
|
||||||
if exists('b:vaxe_hxml')
|
if exists('b:vaxe_hxml')
|
||||||
let hxml = b:vaxe_hxml
|
let hxml = b:vaxe_hxml
|
||||||
elseif exists('g:vaxe_hxml')
|
elseif exists('g:vaxe_hxml')
|
||||||
let hxml = g:vaxe_hxml
|
let hxml = g:vaxe_hxml
|
||||||
else
|
else
|
||||||
let hxml = s:FindInParent('*.hxml', expand('%:p:h'))
|
let hxml = syntastic#util#findInParent('*.hxml', expand('%:p:h'))
|
||||||
endif
|
endif
|
||||||
let hxml = fnamemodify(hxml, ':p')
|
let hxml = fnamemodify(hxml, ':p')
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user