Merge branch 'master' into gcc_refactor
This commit is contained in:
commit
ff2b615093
@ -143,13 +143,21 @@ function! syntastic#util#debug(msg)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! syntastic#util#info(msg)
|
||||
echomsg "syntastic: info: " . a:msg
|
||||
endfunction
|
||||
|
||||
function! syntastic#util#warn(msg)
|
||||
echomsg "syntastic: warning: " . a:msg
|
||||
endfunction
|
||||
|
||||
function! syntastic#util#deprecationWarn(msg)
|
||||
if index(s:deprecationNoticesIssued, a:msg) >= 0
|
||||
return
|
||||
endif
|
||||
|
||||
call add(s:deprecationNoticesIssued, a:msg)
|
||||
echomsg "syntastic: warning: " . a:msg
|
||||
call syntastic#util#warn(a:msg)
|
||||
endfunction
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
|
@ -162,17 +162,17 @@ function! s:CacheErrors(...)
|
||||
let newLoclist = g:SyntasticLoclist.New([])
|
||||
|
||||
if !s:SkipFile()
|
||||
let active_checkers = 0
|
||||
for ft in s:CurrentFiletypes()
|
||||
if a:0
|
||||
let checker = s:registry.getChecker(ft, a:1)
|
||||
if !empty(checker)
|
||||
let checkers = [checker]
|
||||
endif
|
||||
let checkers = !empty(checker) ? [checker] : []
|
||||
else
|
||||
let checkers = s:registry.getActiveCheckers(ft)
|
||||
endif
|
||||
|
||||
for checker in checkers
|
||||
let active_checkers += 1
|
||||
call syntastic#util#debug("CacheErrors: Invoking checker: " . checker.getName())
|
||||
|
||||
let loclist = checker.getLocList()
|
||||
@ -186,6 +186,14 @@ function! s:CacheErrors(...)
|
||||
endif
|
||||
endfor
|
||||
endfor
|
||||
|
||||
if !active_checkers
|
||||
if a:0
|
||||
call syntastic#util#warn('checker ' . a:1 . ' is not active for filetype ' . &filetype)
|
||||
else
|
||||
call syntastic#util#debug('no active checkers for filetype ' . &filetype)
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
let b:syntastic_loclist = newLoclist
|
||||
@ -315,6 +323,7 @@ endfunction
|
||||
" 'defaults' - a dict containing default values for the returned errors
|
||||
" 'subtype' - all errors will be assigned the given subtype
|
||||
" 'postprocess' - a list of functions to be applied to the error list
|
||||
" 'cwd' - change directory to the given path before running the checker
|
||||
function! SyntasticMake(options)
|
||||
call syntastic#util#debug('SyntasticMake: called with options: '. string(a:options))
|
||||
|
||||
@ -323,6 +332,7 @@ function! SyntasticMake(options)
|
||||
let old_shellpipe = &shellpipe
|
||||
let old_shell = &shell
|
||||
let old_errorformat = &l:errorformat
|
||||
let old_cwd = getcwd()
|
||||
let old_lc_all = $LC_ALL
|
||||
|
||||
if s:OSSupportsShellpipeHack()
|
||||
@ -340,12 +350,20 @@ function! SyntasticMake(options)
|
||||
let &l:errorformat = a:options['errorformat']
|
||||
endif
|
||||
|
||||
if has_key(a:options, 'cwd')
|
||||
exec 'lcd ' . fnameescape(a:options['cwd'])
|
||||
endif
|
||||
|
||||
let $LC_ALL = 'C'
|
||||
silent lmake!
|
||||
let $LC_ALL = old_lc_all
|
||||
|
||||
let errors = getloclist(0)
|
||||
|
||||
if has_key(a:options, 'cwd')
|
||||
exec 'lcd ' . fnameescape(old_cwd)
|
||||
endif
|
||||
|
||||
call setloclist(0, old_loclist)
|
||||
let &l:makeprg = old_makeprg
|
||||
let &l:errorformat = old_errorformat
|
||||
|
@ -37,6 +37,7 @@ endfunction
|
||||
|
||||
function! g:SyntasticChecker.getLocList()
|
||||
let list = self._locListFunc()
|
||||
call syntastic#util#debug('getLocList: checker ' . self._filetype . '/' . self._name . ' returned ' . v:shell_error)
|
||||
call self._populateHighlightRegexes(list)
|
||||
return g:SyntasticLoclist.New(list)
|
||||
endfunction
|
||||
|
@ -31,10 +31,13 @@ function! SyntaxCheckers_eruby_ruby_GetLocList()
|
||||
|
||||
let fname = fnameescape(expand('%'))
|
||||
|
||||
let enc = &fileencoding != '' ? &fileencoding : &encoding
|
||||
let encoding_string = enc ==# 'utf-8' ? ', :encoding => "UTF-8"' : ''
|
||||
|
||||
"gsub fixes issue #7, rails has it's own eruby syntax
|
||||
let makeprg =
|
||||
\ exe . ' -rerb -e ' .
|
||||
\ shellescape('puts ERB.new(File.read("' . fname . '").gsub(''<\%='',''<\%''), nil, ''-'').src') .
|
||||
\ shellescape('puts ERB.new(File.read("' . fname . '"' . encoding_string . ').gsub(''<\%='',''<\%''), nil, ''-'').src') .
|
||||
\ ' \| ' . exe . ' -c'
|
||||
|
||||
let errorformat =
|
||||
|
@ -59,21 +59,14 @@ function! SyntaxCheckers_go_go_GetLocList()
|
||||
|
||||
" The go compiler needs to either be run with an import path as an
|
||||
" argument or directly from the package directory. Since figuring out
|
||||
" the poper import path is fickle, just pushd/popd to the package.
|
||||
let popd = getcwd()
|
||||
let pushd = expand('%:p:h')
|
||||
|
||||
" pushd
|
||||
exec 'lcd ' . fnameescape(pushd)
|
||||
" the proper import path is fickle, just cwd to the package.
|
||||
|
||||
let errors = SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'cwd': expand('%:p:h'),
|
||||
\ 'defaults': {'type': 'e'} })
|
||||
|
||||
" popd
|
||||
exec 'lcd ' . fnameescape(popd)
|
||||
|
||||
return errors
|
||||
endfunction
|
||||
|
||||
|
@ -22,19 +22,15 @@ function! SyntaxCheckers_go_govet_GetLocList()
|
||||
let makeprg = 'go vet'
|
||||
let errorformat = '%Evet: %.%\+: %f:%l:%c: %m,%W%f:%l: %m,%-G%.%#'
|
||||
|
||||
" The go tool needs to either be run with an import path as an
|
||||
" The go compiler needs to either be run with an import path as an
|
||||
" argument or directly from the package directory. Since figuring out
|
||||
" the poper import path is fickle, just pushd/popd to the package.
|
||||
let popd = getcwd()
|
||||
let pushd = expand('%:p:h')
|
||||
"
|
||||
" pushd
|
||||
exec 'lcd ' . fnameescape(pushd)
|
||||
" the proper import path is fickle, just cwd to the package.
|
||||
|
||||
let errors = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat, 'defaults': {'type': 'w'} })
|
||||
|
||||
" popd
|
||||
exec 'lcd ' . fnameescape(popd)
|
||||
let errors = SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'cwd': expand('%:p:h'),
|
||||
\ 'defaults': {'type': 'w'} })
|
||||
|
||||
return errors
|
||||
endfunction
|
||||
|
@ -46,11 +46,20 @@ endfunction
|
||||
function! SyntaxCheckers_haxe_haxe_GetLocList()
|
||||
let [success, hxmldir, hxmlname] = s:FindInParent('*.hxml', expand('%:p:h'), '/')
|
||||
if success == 'ok'
|
||||
let makeprg = 'cd ' . hxmldir . '; haxe ' . hxmlname
|
||||
let makeprg = syntastic#makeprg#build({
|
||||
\ 'exe': 'haxe',
|
||||
\ 'fname': shellescape(fnameescape(hxmlname)),
|
||||
\ 'filetype': 'haxe',
|
||||
\ 'subchecker': 'haxe' })
|
||||
|
||||
let errorformat = '%E%f:%l: characters %c-%*[0-9] : %m'
|
||||
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
|
||||
|
||||
return SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'cwd': hxmldir })
|
||||
else
|
||||
return SyntasticMake({})
|
||||
return []
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user