Cleanup.
This commit is contained in:
parent
552078320c
commit
8aa2a6f4c1
@ -165,7 +165,7 @@ augroup syntastic
|
||||
|
||||
autocmd BufWinEnter * call s:BufWinEnterHook()
|
||||
|
||||
" TODO: the next autocmd should be "autocmd BufWinLeave * if empty(&buftype) | lclose | endif"
|
||||
" TODO: the next autocmd should be "autocmd BufWinLeave * if &buftype == '' | lclose | endif"
|
||||
" but in recent versions of Vim lclose can no longer be called from BufWinLeave
|
||||
autocmd BufEnter * call s:BufEnterHook()
|
||||
augroup END
|
||||
@ -196,7 +196,7 @@ function! s:BufWinEnterHook()
|
||||
call syntastic#log#debug(g:SyntasticDebugAutocommands,
|
||||
\ 'autocmd: BufWinEnter, buffer ' . bufnr("") . ' = ' . string(bufname(str2nr(bufnr("")))) .
|
||||
\ ', &buftype = ' . string(&buftype))
|
||||
if empty(&buftype)
|
||||
if &buftype == ''
|
||||
let loclist = g:SyntasticLoclist.current()
|
||||
call s:notifiers.refresh(loclist)
|
||||
endif
|
||||
@ -386,7 +386,7 @@ endfunction
|
||||
function! s:SkipFile()
|
||||
let force_skip = exists('b:syntastic_skip_checks') ? b:syntastic_skip_checks : 0
|
||||
let fname = expand('%')
|
||||
return force_skip || !empty(&buftype) || !filereadable(fname) || getwinvar(0, '&diff') || s:IgnoreFile(fname)
|
||||
return force_skip || (&buftype != '') || !filereadable(fname) || getwinvar(0, '&diff') || s:IgnoreFile(fname)
|
||||
endfunction
|
||||
|
||||
function! s:uname()
|
||||
|
@ -31,8 +31,6 @@ function! g:SyntasticChecker.New(args)
|
||||
|
||||
if exists('*' . prefix . 'GetHighlightRegex')
|
||||
let newObj._highlightRegexFunc = function(prefix . 'GetHighlightRegex')
|
||||
else
|
||||
let newObj._highlightRegexFunc = ''
|
||||
endif
|
||||
|
||||
return newObj
|
||||
@ -73,10 +71,6 @@ function! g:SyntasticChecker.getLocList()
|
||||
return g:SyntasticLoclist.New(self.getLocListRaw())
|
||||
endfunction
|
||||
|
||||
function! g:SyntasticChecker.getHighlightRegexFor(error)
|
||||
return empty(self._highlightRegexFunc) ? [] : self._highlightRegexFunc(a:error)
|
||||
endfunction
|
||||
|
||||
function! g:SyntasticChecker.makeprgBuild(opts)
|
||||
let setting = 'g:syntastic_' . self._filetype . '_' . self._name . '_'
|
||||
|
||||
@ -86,7 +80,7 @@ function! g:SyntasticChecker.makeprgBuild(opts)
|
||||
call extend(parts, self._getOpt(a:opts, setting, 'post_args', ''))
|
||||
call extend(parts, self._getOpt(a:opts, setting, 'tail', ''))
|
||||
|
||||
return join(filter(parts, 'strlen(v:val)'))
|
||||
return join(filter(parts, 'v:val != ""'))
|
||||
endfunction
|
||||
|
||||
function! g:SyntasticChecker.isAvailable()
|
||||
@ -104,7 +98,7 @@ function! g:SyntasticChecker._quietMessages(errors)
|
||||
endfunction
|
||||
|
||||
function! g:SyntasticChecker._populateHighlightRegexes(errors)
|
||||
if !empty(self._highlightRegexFunc)
|
||||
if has_key(self, '_highlightRegexFunc')
|
||||
for e in a:errors
|
||||
if e['valid']
|
||||
let term = self._highlightRegexFunc(e)
|
||||
|
@ -13,7 +13,7 @@ function! g:SyntasticLoclist.New(rawLoclist)
|
||||
let llist = filter(copy(a:rawLoclist), 'v:val["valid"] == 1')
|
||||
|
||||
for e in llist
|
||||
if empty(e['type'])
|
||||
if get(e, 'type', '') == ''
|
||||
let e['type'] = 'E'
|
||||
endif
|
||||
endfor
|
||||
|
@ -41,12 +41,12 @@ function! SyntaxCheckers_actionscript_mxmlc_GetHighlightRegex(item)
|
||||
|
||||
endif
|
||||
|
||||
return strlen(term) ? '\V\<' . term . '\>' : ''
|
||||
return term != '' ? '\V\<' . term . '\>' : ''
|
||||
endfunction
|
||||
|
||||
function! SyntaxCheckers_actionscript_mxmlc_GetLocList() dict
|
||||
let makeprg = self.makeprgBuild({
|
||||
\ 'args_before': (strlen(g:syntastic_actionscript_mxmlc_conf) ?
|
||||
\ 'args_before': (g:syntastic_actionscript_mxmlc_conf != '' ?
|
||||
\ ' -load-config+=' . g:syntastic_actionscript_mxmlc_conf : ''),
|
||||
\ 'args_after': '-output=' . syntastic#util#DevNull() })
|
||||
|
||||
|
@ -28,7 +28,7 @@ function! SyntaxCheckers_haxe_haxe_GetLocList() dict
|
||||
endif
|
||||
let hxml = fnamemodify(hxml, ':p')
|
||||
|
||||
if !empty(hxml)
|
||||
if hxml != ''
|
||||
let makeprg = self.makeprgBuild({
|
||||
\ 'fname': syntastic#util#shescape(fnameescape(fnamemodify(hxml, ':t'))) })
|
||||
|
||||
|
@ -34,7 +34,7 @@ endfunction
|
||||
function! SyntaxCheckers_html_jshint_GetLocList() dict
|
||||
let makeprg = self.makeprgBuild({
|
||||
\ 'exe': expand(g:syntastic_jshint_exec),
|
||||
\ 'args': (!empty(g:syntastic_html_jshint_conf) ? ' --config ' . g:syntastic_html_jshint_conf : ''),
|
||||
\ 'args': (g:syntastic_html_jshint_conf != '' ? '--config ' . g:syntastic_html_jshint_conf : ''),
|
||||
\ 'args_after': '--verbose --extract always' })
|
||||
|
||||
let errorformat = '%A%f: line %l\, col %v\, %m \(%t%*\d\)'
|
||||
|
@ -66,8 +66,8 @@ endfunction
|
||||
function! SyntaxCheckers_html_validator_GetLocList() dict
|
||||
let fname = syntastic#util#shexpand('%')
|
||||
let makeprg = self.getExec() . ' -s --compressed -F out=gnu -F asciiquotes=yes' .
|
||||
\ (!empty(g:syntastic_html_validator_parser) ? ' -F parser=' . g:syntastic_html_validator_parser : '') .
|
||||
\ (!empty(g:syntastic_html_validator_nsfilter) ? ' -F nsfilter=' . g:syntastic_html_validator_nsfilter : '') .
|
||||
\ (g:syntastic_html_validator_parser != '' ? ' -F parser=' . g:syntastic_html_validator_parser : '') .
|
||||
\ (g:syntastic_html_validator_nsfilter != '' ? ' -F nsfilter=' . g:syntastic_html_validator_nsfilter : '') .
|
||||
\ ' -F doc=@' . fname . '\;type=text/html\;filename=' . fname . ' ' . g:syntastic_html_validator_api
|
||||
|
||||
let errorformat =
|
||||
|
@ -23,7 +23,7 @@ set cpo&vim
|
||||
|
||||
function! SyntaxCheckers_javascript_eslint_GetLocList() dict
|
||||
let makeprg = self.makeprgBuild({
|
||||
\ 'args': strlen(g:syntastic_javascript_eslint_conf) ? ' --config ' . g:syntastic_javascript_eslint_conf : '' })
|
||||
\ 'args': (g:syntastic_javascript_eslint_conf != '' ? '--config ' . g:syntastic_javascript_eslint_conf : '') })
|
||||
|
||||
let errorformat =
|
||||
\ '%E%f: line %l\, col %c\, Error - %m'
|
||||
|
@ -37,7 +37,7 @@ function! SyntaxCheckers_javascript_jshint_GetLocList() dict
|
||||
|
||||
let makeprg = self.makeprgBuild({
|
||||
\ 'exe': expand(g:syntastic_jshint_exec),
|
||||
\ 'args': (strlen(g:syntastic_javascript_jshint_conf) ? '--config ' . g:syntastic_javascript_jshint_conf : ''),
|
||||
\ 'args': (g:syntastic_javascript_jshint_conf != '' ? '--config ' . g:syntastic_javascript_jshint_conf : ''),
|
||||
\ 'args_after': (s:jshint_new ? '--verbose ' : '') })
|
||||
|
||||
let errorformat = s:jshint_new ?
|
||||
|
@ -23,7 +23,7 @@ set cpo&vim
|
||||
|
||||
function! SyntaxCheckers_javascript_jsl_GetLocList() dict
|
||||
let makeprg = self.makeprgBuild({
|
||||
\ 'args': (strlen(g:syntastic_javascript_jsl_conf) ? '-conf ' . g:syntastic_javascript_jsl_conf : ''),
|
||||
\ 'args': (g:syntastic_javascript_jsl_conf != '' ? '-conf ' . g:syntastic_javascript_jsl_conf : ''),
|
||||
\ 'args_after': '-nologo -nofilelisting -nosummary -nocontext -process' })
|
||||
|
||||
let errorformat =
|
||||
|
@ -19,7 +19,7 @@ let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! SyntaxCheckers_limbo_limbo_GetLocList() dict
|
||||
let include = !empty($INFERNO_HOME) ? '-I$INFERNO_HOME ' : ''
|
||||
let include = $INFERNO_HOME != '' ? '-I$INFERNO_HOME ' : ''
|
||||
" don't generate .dis in current dir while checking syntax,
|
||||
" .dis should be generated by `mk`
|
||||
let output = filereadable('mkfile') ? (' ' . syntastic#c#NullOutput()) : ''
|
||||
|
@ -21,7 +21,7 @@ set cpo&vim
|
||||
function! SyntaxCheckers_lua_luac_GetHighlightRegex(pos)
|
||||
let result = ''
|
||||
let near = matchstr(a:pos['text'], '\mnear ''\zs[^'']\+\ze''')
|
||||
if strlen(near) > 0
|
||||
if near != ''
|
||||
if near ==# '<eof>'
|
||||
let p = getpos('$')
|
||||
let a:pos['lnum'] = p[1]
|
||||
@ -35,7 +35,7 @@ function! SyntaxCheckers_lua_luac_GetHighlightRegex(pos)
|
||||
" in future versions of syntastic; enable it at your own risk :)
|
||||
|
||||
"let open = matchstr(a:pos['text'], '\m(to close ''\zs[^'']\+\ze'' at line [0-9]\+)')
|
||||
"if strlen(open) > 0
|
||||
"if open != ''
|
||||
" let line = str2nr(matchstr(a:pos['text'], '\m(to close ''[^'']\+'' at line \zs[0-9]\+\ze)'))
|
||||
" let group = a:pos['type'] ==? 'E' ? 'SyntasticError' : 'SyntasticWarning'
|
||||
" call matchadd(group, '\%' . line . 'l\V' . open)
|
||||
|
@ -20,7 +20,7 @@ set cpo&vim
|
||||
|
||||
function! SyntaxCheckers_po_msgfmt_GetHighlightRegex(item)
|
||||
let term = matchstr(a:item['text'], '\mkeyword "\zs[^"]\+\ze" unknown')
|
||||
return !empty(term) ? '\V' . term : ''
|
||||
return term != '' ? '\V' . term : ''
|
||||
endfunction
|
||||
|
||||
function! SyntaxCheckers_po_msgfmt_GetLocList() dict
|
||||
|
@ -22,7 +22,7 @@ function! s:GetShell()
|
||||
if !exists('b:shell') || b:shell == ''
|
||||
let b:shell = ''
|
||||
let shebang = getbufline(bufnr('%'), 1)[0]
|
||||
if strlen(shebang) > 0
|
||||
if shebang != ''
|
||||
if stridx(shebang, 'bash') >= 0
|
||||
let b:shell = 'bash'
|
||||
elseif stridx(shebang, 'zsh') >= 0
|
||||
|
@ -36,8 +36,8 @@ let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! SyntaxCheckers_vala_valac_GetHighlightRegex(pos)
|
||||
let strlength = strlen(matchstr(a:pos['text'], '\m\^\+$'))
|
||||
return '\%>' . (a:pos.col-1) . 'c.*\%<' . (a:pos.col+strlength+1) . 'c'
|
||||
let length = strlen(matchstr(a:pos['text'], '\m\^\+$'))
|
||||
return '\%>' . (a:pos['col'] - 1) . 'c.*\%<' . (a:pos['col'] + length + 1) . 'c'
|
||||
endfunction
|
||||
|
||||
function! s:GetValaModules()
|
||||
|
Loading…
x
Reference in New Issue
Block a user