1
0
Fork 0
mirror of synced 2024-06-21 08:21:11 -04:00
ultimate-vim/sources_non_forked/syntastic/syntax_checkers/typescript/tslint.vim

52 lines
1.6 KiB
VimL
Raw Normal View History

2014-07-02 07:18:18 -04:00
"============================================================================
"File: typescript/tslint.vim
"Description: TypeScript linter
"Maintainer: Seon-Wook Park <seon.wook@swook.net>
"============================================================================
2015-07-13 06:22:46 -04:00
if exists('g:loaded_syntastic_typescript_tslint_checker')
2014-07-02 07:18:18 -04:00
finish
endif
let g:loaded_syntastic_typescript_tslint_checker = 1
2014-10-31 17:30:24 -04:00
if !exists('g:syntastic_typescript_tslint_sort')
let g:syntastic_typescript_tslint_sort = 1
endif
2014-07-02 07:18:18 -04:00
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_typescript_tslint_GetHighlightRegex(item)
let term = matchstr(a:item['text'], "\\m\\s'\\zs.\\{-}\\ze'\\s")
2015-07-13 06:22:46 -04:00
return term !=# '' ? '\V' . escape(term, '\') : ''
2014-07-02 07:18:18 -04:00
endfunction
function! SyntaxCheckers_typescript_tslint_GetLocList() dict
2015-12-08 08:20:04 -05:00
if !exists('s:tslint_new')
let s:tslint_new = syntastic#util#versionIsAtLeast(self.getVersion(), [2, 4])
endif
2014-07-02 07:18:18 -04:00
let makeprg = self.makeprgBuild({
\ 'args_after': '--format verbose',
2015-12-08 08:20:04 -05:00
\ 'fname_before': (s:tslint_new ? '' : '-f') })
2014-07-02 07:18:18 -04:00
" (comment-format) ts/app.ts[12, 36]: comment must start with lowercase letter
let errorformat = '%f[%l\, %c]: %m'
2014-10-31 17:30:24 -04:00
return SyntasticMake({
2014-07-02 07:18:18 -04:00
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'preprocess': 'tslint',
2015-07-13 06:22:46 -04:00
\ 'subtype': 'Style',
2014-07-02 07:18:18 -04:00
\ 'returns': [0, 2] })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'typescript',
\ 'name': 'tslint'})
let &cpo = s:save_cpo
unlet s:save_cpo
2015-01-18 07:58:28 -05:00
" vim: set sw=4 sts=4 et fdm=marker: