This commit is contained in:
LCD 47 2013-06-07 20:56:39 +03:00
parent 6e90447a31
commit fd38284b28
8 changed files with 47 additions and 29 deletions

View File

@ -19,7 +19,7 @@ let g:loaded_syntastic_coffee_coffee_checker=1
function! SyntaxCheckers_coffee_coffee_IsAvailable() function! SyntaxCheckers_coffee_coffee_IsAvailable()
return executable("coffee") && return executable("coffee") &&
\ syntastic#util#versionIsAtLeast(syntastic#util#parseVersion('coffee --version 2>/dev/null'), [1,6,2]) \ syntastic#util#versionIsAtLeast(syntastic#util#parseVersion('coffee --version 2>' . syntastic#util#DevNull()), [1,6,2])
endfunction endfunction
function! SyntaxCheckers_coffee_coffee_GetLocList() function! SyntaxCheckers_coffee_coffee_GetLocList()

View File

@ -30,11 +30,13 @@ endfunction
function! SyntaxCheckers_cuda_nvcc_GetLocList() function! SyntaxCheckers_cuda_nvcc_GetLocList()
if exists('g:syntastic_cuda_arch') if exists('g:syntastic_cuda_arch')
let arch_flag = '-arch='.g:syntastic_cuda_arch let arch_flag = '-arch=' . g:syntastic_cuda_arch
else else
let arch_flag = '' let arch_flag = ''
endif endif
let makeprg = 'nvcc '.arch_flag.' --cuda -O0 -I . -Xcompiler -fsyntax-only '.shellescape(expand('%')).' -o /dev/null' let makeprg =
\ 'nvcc ' . arch_flag . ' --cuda -O0 -I . -Xcompiler -fsyntax-only ' .
\ shellescape(expand('%')) . ' ' . syntastic#c#GetNullDevice()
let errorformat = let errorformat =
\ '%*[^"]"%f"%*\D%l: %m,'. \ '%*[^"]"%f"%*\D%l: %m,'.
\ '"%f"%*\D%l: %m,'. \ '"%f"%*\D%l: %m,'.
@ -53,7 +55,10 @@ function! SyntaxCheckers_cuda_nvcc_GetLocList()
if expand('%') =~? '\%(.h\|.hpp\|.cuh\)$' if expand('%') =~? '\%(.h\|.hpp\|.cuh\)$'
if exists('g:syntastic_cuda_check_header') if exists('g:syntastic_cuda_check_header')
let makeprg = 'echo > .syntastic_dummy.cu ; nvcc '.arch_flag.' --cuda -O0 -I . .syntastic_dummy.cu -Xcompiler -fsyntax-only -include '.shellescape(expand('%')).' -o /dev/null' let makeprg =
\ 'echo > .syntastic_dummy.cu ; ' .
\ 'nvcc ' . arch_flag . ' --cuda -O0 -I . .syntastic_dummy.cu -Xcompiler -fsyntax-only -include ' .
\ shellescape(expand('%')) . ' ' . syntastic#c#GetNullDevice()
else else
return [] return []
endif endif

View File

@ -25,10 +25,21 @@ function! SyntaxCheckers_go_go_GetLocList()
" Check with gofmt first, since `go build` and `go test` might not report " Check with gofmt first, since `go build` and `go test` might not report
" syntax errors in the current file if another file with syntax error is " syntax errors in the current file if another file with syntax error is
" compiled first. " compiled first.
let makeprg = 'gofmt -l % 1>/dev/null' let makeprg = syntastic#makeprg#build({
let errorformat = '%f:%l:%c: %m,%-G%.%#' \ 'exe': 'gofmt',
let errors = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat, 'defaults': {'type': 'e'} }) \ 'args': '-l',
\ 'tail': '1>' . syntastic#util#DevNull(),
\ 'filetype': 'go',
\ 'subchecker': 'go' })
let errorformat =
\ '%f:%l:%c: %m,' .
\ '%-G%.%#'
let errors = SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'defaults': {'type': 'e'} })
if !empty(errors) if !empty(errors)
return errors return errors
endif endif
@ -36,22 +47,29 @@ function! SyntaxCheckers_go_go_GetLocList()
" Test files, i.e. files with a name ending in `_test.go`, are not " Test files, i.e. files with a name ending in `_test.go`, are not
" compiled by `go build`, therefore `go test` must be called for those. " compiled by `go build`, therefore `go test` must be called for those.
if match(expand('%'), '_test.go$') == -1 if match(expand('%'), '_test.go$') == -1
let makeprg = 'go build -o /dev/null' let makeprg = 'go build ' . syntastic#c#GetNullDevice()
else else
let makeprg = 'go test -c -o /dev/null' let makeprg = 'go test -c ' . syntastic#c#GetNullDevice()
endif endif
let errorformat = '%f:%l:%c:%m,%f:%l%m,%-G#%.%#'
let errorformat =
\ '%f:%l:%c:%m,' .
\ '%f:%l%m,' .
\ '%-G#%.%#'
" 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 poper import path is fickle, just pushd/popd to the package.
let popd = getcwd() let popd = getcwd()
let pushd = expand('%:p:h') let pushd = expand('%:p:h')
"
" pushd " pushd
exec 'lcd ' . fnameescape(pushd) exec 'lcd ' . fnameescape(pushd)
let errors = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat }) let errors = SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'defaults': {'type': 'e'} })
" popd " popd
exec 'lcd ' . fnameescape(popd) exec 'lcd ' . fnameescape(popd)

View File

@ -19,15 +19,10 @@ function! SyntaxCheckers_nasm_nasm_IsAvailable()
endfunction endfunction
function! SyntaxCheckers_nasm_nasm_GetLocList() function! SyntaxCheckers_nasm_nasm_GetLocList()
if has("win32")
let outfile="NUL"
else
let outfile="/dev/null"
endif
let wd = shellescape(expand("%:p:h") . "/") let wd = shellescape(expand("%:p:h") . "/")
let makeprg = syntastic#makeprg#build({ let makeprg = syntastic#makeprg#build({
\ 'exe': 'nasm', \ 'exe': 'nasm',
\ 'args': '-X gnu -f elf -I ' . wd . ' -o ' . outfile, \ 'args': '-X gnu -f elf -I ' . wd . ' ' . syntastic#c#GetNullDevice()
\ 'filetype': 'nasm', \ 'filetype': 'nasm',
\ 'subchecker': 'nasm' }) \ 'subchecker': 'nasm' })

View File

@ -112,16 +112,16 @@ function s:GetOcamlcMakeprg()
if g:syntastic_ocaml_use_janestreet_core if g:syntastic_ocaml_use_janestreet_core
let build_cmd = "ocamlc -I " let build_cmd = "ocamlc -I "
let build_cmd .= expand(g:syntastic_ocaml_janestreet_core_dir) let build_cmd .= expand(g:syntastic_ocaml_janestreet_core_dir)
let build_cmd .= " -c ".expand('%') let build_cmd .= " -c " . expand('%')
return build_cmd return build_cmd
else else
return "ocamlc -c ". expand('%') return "ocamlc -c " . expand('%')
endif endif
endfunction endfunction
function s:GetOcamlBuildMakeprg() function s:GetOcamlBuildMakeprg()
return "ocamlbuild -quiet -no-log -tag annot,". s:ocamlpp. " -no-links -no-hygiene -no-sanitize ". return "ocamlbuild -quiet -no-log -tag annot," . s:ocamlpp . " -no-links -no-hygiene -no-sanitize " .
\ shellescape(expand('%:r')).".cmi" \ shellescape(expand('%:r')) . ".cmi"
endfunction endfunction
function s:GetOtherMakeprg() function s:GetOtherMakeprg()
@ -134,11 +134,11 @@ function s:GetOtherMakeprg()
if match(extension, 'mly') >= 0 && executable("menhir") if match(extension, 'mly') >= 0 && executable("menhir")
" ocamlyacc output can't be redirected, so use menhir " ocamlyacc output can't be redirected, so use menhir
let makeprg = "menhir --only-preprocess ".shellescape(expand('%')) . " >/dev/null" let makeprg = "menhir --only-preprocess " . shellescape(expand('%')) . " >" . syntastic#util#DevNull()
elseif match(extension,'mll') >= 0 && executable("ocamllex") elseif match(extension,'mll') >= 0 && executable("ocamllex")
let makeprg = "ocamllex -q -o /dev/null ".shellescape(expand('%')) let makeprg = "ocamllex -q " . syntastic#c#GetNullDevice() . " " . shellescape(expand('%'))
else else
let makeprg = "camlp4o -o /dev/null ".shellescape(expand('%')) let makeprg = "camlp4o " . syntastic#c#GetNullDevice() . " " . shellescape(expand('%'))
endif endif
return makeprg return makeprg

View File

@ -33,14 +33,14 @@ endif
function! s:PuppetVersion() function! s:PuppetVersion()
if !exists("s:puppet_version") if !exists("s:puppet_version")
let s:puppet_version = syntastic#util#parseVersion("puppet --version 2>/dev/null") let s:puppet_version = syntastic#util#parseVersion("puppet --version 2>" . syntastic#util#DevNull())
endif endif
return s:puppet_version return s:puppet_version
endfunction endfunction
function! s:PuppetLintVersion() function! s:PuppetLintVersion()
if !exists("s:puppet_lint_version") if !exists("s:puppet_lint_version")
let s:puppet_lint_version = syntastic#util#parseVersion("puppet-lint --version 2>/dev/null") let s:puppet_lint_version = syntastic#util#parseVersion("puppet-lint --version 2>" . syntastic#util#DevNull())
endif endif
return s:puppet_lint_version return s:puppet_lint_version
endfunction endfunction

View File

@ -21,7 +21,7 @@ endfunction
function! s:SlimrbVersion() function! s:SlimrbVersion()
if !exists('s:slimrb_version') if !exists('s:slimrb_version')
let s:slimrb_version = syntastic#util#parseVersion('slimrb --version 2>/dev/null') let s:slimrb_version = syntastic#util#parseVersion('slimrb --version 2>' . syntastic#util#DevNull())
end end
return s:slimrb_version return s:slimrb_version
endfunction endfunction

View File

@ -31,7 +31,7 @@ endfunction
function! SyntaxCheckers_text_atdtool_GetLocList() function! SyntaxCheckers_text_atdtool_GetLocList()
let makeprg = syntastic#makeprg#build({ let makeprg = syntastic#makeprg#build({
\ 'exe': 'atdtool', \ 'exe': 'atdtool',
\ 'tail': '2>/dev/null', \ 'tail': '2>' . syntastic#util#DevNull(),
\ 'filetype': 'text', \ 'filetype': 'text',
\ 'subchecker': 'atdtool' }) \ 'subchecker': 'atdtool' })