Added option 'cwd' to SyntasticMake().
This commit is contained in:
parent
6574872b55
commit
da7002516b
@ -315,6 +315,7 @@ endfunction
|
|||||||
" 'defaults' - a dict containing default values for the returned errors
|
" 'defaults' - a dict containing default values for the returned errors
|
||||||
" 'subtype' - all errors will be assigned the given subtype
|
" 'subtype' - all errors will be assigned the given subtype
|
||||||
" 'postprocess' - a list of functions to be applied to the error list
|
" '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)
|
function! SyntasticMake(options)
|
||||||
call syntastic#util#debug('SyntasticMake: called with options: '. string(a:options))
|
call syntastic#util#debug('SyntasticMake: called with options: '. string(a:options))
|
||||||
|
|
||||||
@ -323,6 +324,7 @@ function! SyntasticMake(options)
|
|||||||
let old_shellpipe = &shellpipe
|
let old_shellpipe = &shellpipe
|
||||||
let old_shell = &shell
|
let old_shell = &shell
|
||||||
let old_errorformat = &l:errorformat
|
let old_errorformat = &l:errorformat
|
||||||
|
let old_cwd = getcwd()
|
||||||
let old_lc_all = $LC_ALL
|
let old_lc_all = $LC_ALL
|
||||||
|
|
||||||
if s:OSSupportsShellpipeHack()
|
if s:OSSupportsShellpipeHack()
|
||||||
@ -340,12 +342,20 @@ function! SyntasticMake(options)
|
|||||||
let &l:errorformat = a:options['errorformat']
|
let &l:errorformat = a:options['errorformat']
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if has_key(a:options, 'cwd')
|
||||||
|
exec 'lcd ' . fnameescape(a:options['cwd'])
|
||||||
|
endif
|
||||||
|
|
||||||
let $LC_ALL = 'C'
|
let $LC_ALL = 'C'
|
||||||
silent lmake!
|
silent lmake!
|
||||||
let $LC_ALL = old_lc_all
|
let $LC_ALL = old_lc_all
|
||||||
|
|
||||||
let errors = getloclist(0)
|
let errors = getloclist(0)
|
||||||
|
|
||||||
|
if has_key(a:options, 'cwd')
|
||||||
|
exec 'lcd ' . fnameescape(old_cwd)
|
||||||
|
endif
|
||||||
|
|
||||||
call setloclist(0, old_loclist)
|
call setloclist(0, old_loclist)
|
||||||
let &l:makeprg = old_makeprg
|
let &l:makeprg = old_makeprg
|
||||||
let &l:errorformat = old_errorformat
|
let &l:errorformat = old_errorformat
|
||||||
|
@ -59,21 +59,14 @@ function! SyntaxCheckers_go_go_GetLocList()
|
|||||||
|
|
||||||
" The go compiler 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
|
" argument or directly from the package directory. Since figuring out
|
||||||
" the poper import path is fickle, just pushd/popd to the package.
|
" the proper import path is fickle, just cwd to the package.
|
||||||
let popd = getcwd()
|
|
||||||
let pushd = expand('%:p:h')
|
|
||||||
|
|
||||||
" pushd
|
|
||||||
exec 'lcd ' . fnameescape(pushd)
|
|
||||||
|
|
||||||
let errors = SyntasticMake({
|
let errors = SyntasticMake({
|
||||||
\ 'makeprg': makeprg,
|
\ 'makeprg': makeprg,
|
||||||
\ 'errorformat': errorformat,
|
\ 'errorformat': errorformat,
|
||||||
|
\ 'cwd': expand('%:p:h'),
|
||||||
\ 'defaults': {'type': 'e'} })
|
\ 'defaults': {'type': 'e'} })
|
||||||
|
|
||||||
" popd
|
|
||||||
exec 'lcd ' . fnameescape(popd)
|
|
||||||
|
|
||||||
return errors
|
return errors
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
@ -22,19 +22,15 @@ function! SyntaxCheckers_go_govet_GetLocList()
|
|||||||
let makeprg = 'go vet'
|
let makeprg = 'go vet'
|
||||||
let errorformat = '%Evet: %.%\+: %f:%l:%c: %m,%W%f:%l: %m,%-G%.%#'
|
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
|
" argument or directly from the package directory. Since figuring out
|
||||||
" the poper import path is fickle, just pushd/popd to the package.
|
" the proper import path is fickle, just cwd to the package.
|
||||||
let popd = getcwd()
|
|
||||||
let pushd = expand('%:p:h')
|
|
||||||
"
|
|
||||||
" pushd
|
|
||||||
exec 'lcd ' . fnameescape(pushd)
|
|
||||||
|
|
||||||
let errors = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat, 'defaults': {'type': 'w'} })
|
let errors = SyntasticMake({
|
||||||
|
\ 'makeprg': makeprg,
|
||||||
" popd
|
\ 'errorformat': errorformat,
|
||||||
exec 'lcd ' . fnameescape(popd)
|
\ 'cwd': expand('%:p:h'),
|
||||||
|
\ 'defaults': {'type': 'w'} })
|
||||||
|
|
||||||
return errors
|
return errors
|
||||||
endfunction
|
endfunction
|
||||||
|
@ -46,11 +46,20 @@ endfunction
|
|||||||
function! SyntaxCheckers_haxe_haxe_GetLocList()
|
function! SyntaxCheckers_haxe_haxe_GetLocList()
|
||||||
let [success, hxmldir, hxmlname] = s:FindInParent('*.hxml', expand('%:p:h'), '/')
|
let [success, hxmldir, hxmlname] = s:FindInParent('*.hxml', expand('%:p:h'), '/')
|
||||||
if success == 'ok'
|
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'
|
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
|
else
|
||||||
return SyntasticMake({})
|
return []
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user