1
0
Fork 0
mirror of synced 2024-11-18 23:05:34 -05:00
ultimate-vim/sources_non_forked/swift.vim/syntax_checkers/swift/swiftpm.vim
2017-11-27 13:43:13 +08:00

44 lines
1 KiB
VimL

if exists('g:loaded_syntastic_swift_swiftpm_checker')
finish
endif
let g:loaded_syntastic_swift_swiftpm_checker = 1
if !exists('g:syntastic_swift_swiftpm_executable')
let g:syntastic_swift_swiftpm_executable = 'swift'
endif
if !exists('g:syntastic_swift_swiftpm_arguments')
let g:syntastic_swift_swiftpm_arguments = 'build'
endif
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_swift_swiftpm_IsAvailable() dict
if !executable(self.getExec())
return 0
endif
return filereadable('Package.swift')
endfunction
function! SyntaxCheckers_swift_swiftpm_GetLocList() dict
let makeprg = self.makeprgBuild({
\ 'fname': '',
\ 'args': g:syntastic_swift_swiftpm_arguments })
let errorformat =
\ '%f:%l:%c: error: %m'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'swift',
\ 'name': 'swiftpm',
\ 'exec': g:syntastic_swift_swiftpm_executable })
let &cpo = s:save_cpo
unlet s:save_cpo