mirror of
https://github.com/amix/vimrc
synced 2025-06-24 07:44:59 +08:00
Updated vim plugins
This commit is contained in:
@ -19,7 +19,7 @@ if has('reltime')
|
||||
lockvar! g:_SYNTASTIC_START
|
||||
endif
|
||||
|
||||
let g:_SYNTASTIC_VERSION = '3.6.0-16'
|
||||
let g:_SYNTASTIC_VERSION = '3.6.0-44'
|
||||
lockvar g:_SYNTASTIC_VERSION
|
||||
|
||||
" Sanity checks {{{1
|
||||
@ -42,15 +42,21 @@ endfor
|
||||
let s:_running_windows = syntastic#util#isRunningWindows()
|
||||
lockvar s:_running_windows
|
||||
|
||||
if !s:_running_windows && executable('uname')
|
||||
if s:_running_windows
|
||||
let g:_SYNTASTIC_UNAME = 'Windows'
|
||||
elseif executable('uname')
|
||||
try
|
||||
let s:_uname = system('uname')
|
||||
let g:_SYNTASTIC_UNAME = split(system('uname'), "\n")[0]
|
||||
catch /\m^Vim\%((\a\+)\)\=:E484/
|
||||
call syntastic#log#error("your shell " . &shell . " can't handle traditional UNIX syntax for redirections")
|
||||
finish
|
||||
catch /\m^Vim\%((\a\+)\)\=:E684/
|
||||
let g:_SYNTASTIC_UNAME = 'Unknown'
|
||||
endtry
|
||||
lockvar s:_uname
|
||||
else
|
||||
let g:_SYNTASTIC_UNAME = 'Unknown'
|
||||
endif
|
||||
lockvar g:_SYNTASTIC_UNAME
|
||||
|
||||
" }}}1
|
||||
|
||||
@ -152,7 +158,7 @@ let s:modemap = g:SyntasticModeMap.Instance()
|
||||
" @vimlint(EVL103, 1, a:cursorPos)
|
||||
" @vimlint(EVL103, 1, a:cmdLine)
|
||||
" @vimlint(EVL103, 1, a:argLead)
|
||||
function! s:CompleteCheckerName(argLead, cmdLine, cursorPos) " {{{2
|
||||
function! s:CompleteCheckerName(argLead, cmdLine, cursorPos) abort " {{{2
|
||||
let checker_names = []
|
||||
for ft in s:_resolve_filetypes([])
|
||||
call extend(checker_names, s:registry.getNamesOfAvailableCheckers(ft))
|
||||
@ -167,7 +173,7 @@ endfunction " }}}2
|
||||
" @vimlint(EVL103, 1, a:cursorPos)
|
||||
" @vimlint(EVL103, 1, a:cmdLine)
|
||||
" @vimlint(EVL103, 1, a:argLead)
|
||||
function! s:CompleteFiletypes(argLead, cmdLine, cursorPos) " {{{2
|
||||
function! s:CompleteFiletypes(argLead, cmdLine, cursorPos) abort " {{{2
|
||||
return join(s:registry.getKnownFiletypes(), "\n")
|
||||
endfunction " }}}2
|
||||
" @vimlint(EVL103, 0, a:cursorPos)
|
||||
@ -185,34 +191,34 @@ command! SyntasticSetLoclist call SyntasticSetLoclist()
|
||||
|
||||
" Public API {{{1
|
||||
|
||||
function! SyntasticCheck(...) " {{{2
|
||||
function! SyntasticCheck(...) abort " {{{2
|
||||
call s:UpdateErrors(0, a:000)
|
||||
call syntastic#util#redraw(g:syntastic_full_redraws)
|
||||
endfunction " }}}2
|
||||
|
||||
function! SyntasticInfo(...) " {{{2
|
||||
function! SyntasticInfo(...) abort " {{{2
|
||||
call s:modemap.modeInfo(a:000)
|
||||
call s:registry.echoInfoFor(s:_resolve_filetypes(a:000))
|
||||
call s:_explain_skip(a:000)
|
||||
endfunction " }}}2
|
||||
|
||||
function! SyntasticErrors() " {{{2
|
||||
function! SyntasticErrors() abort " {{{2
|
||||
call g:SyntasticLoclist.current().show()
|
||||
endfunction " }}}2
|
||||
|
||||
function! SyntasticReset() " {{{2
|
||||
function! SyntasticReset() abort " {{{2
|
||||
call s:ClearCache()
|
||||
call s:notifiers.refresh(g:SyntasticLoclist.New([]))
|
||||
endfunction " }}}2
|
||||
|
||||
function! SyntasticToggleMode() " {{{2
|
||||
function! SyntasticToggleMode() abort " {{{2
|
||||
call s:modemap.toggleMode()
|
||||
call s:ClearCache()
|
||||
call s:notifiers.refresh(g:SyntasticLoclist.New([]))
|
||||
call s:modemap.echoMode()
|
||||
endfunction " }}}2
|
||||
|
||||
function! SyntasticSetLoclist() " {{{2
|
||||
function! SyntasticSetLoclist() abort " {{{2
|
||||
call g:SyntasticLoclist.current().setloclist()
|
||||
endfunction " }}}2
|
||||
|
||||
@ -233,7 +239,7 @@ if v:version > 703 || (v:version == 703 && has('patch544'))
|
||||
augroup END
|
||||
endif
|
||||
|
||||
function! s:BufReadPostHook() " {{{2
|
||||
function! s:BufReadPostHook() abort " {{{2
|
||||
if g:syntastic_check_on_open
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_AUTOCOMMANDS,
|
||||
\ 'autocmd: BufReadPost, buffer ' . bufnr("") . ' = ' . string(bufname(str2nr(bufnr("")))))
|
||||
@ -241,19 +247,19 @@ function! s:BufReadPostHook() " {{{2
|
||||
endif
|
||||
endfunction " }}}2
|
||||
|
||||
function! s:BufWritePostHook() " {{{2
|
||||
function! s:BufWritePostHook() abort " {{{2
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_AUTOCOMMANDS,
|
||||
\ 'autocmd: BufWritePost, buffer ' . bufnr("") . ' = ' . string(bufname(str2nr(bufnr("")))))
|
||||
call s:UpdateErrors(1, [])
|
||||
endfunction " }}}2
|
||||
|
||||
function! s:BufEnterHook() " {{{2
|
||||
function! s:BufEnterHook() abort " {{{2
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_AUTOCOMMANDS,
|
||||
\ 'autocmd: BufEnter, buffer ' . bufnr("") . ' = ' . string(bufname(str2nr(bufnr("")))) .
|
||||
\ ', &buftype = ' . string(&buftype))
|
||||
if &buftype == ''
|
||||
call s:notifiers.refresh(g:SyntasticLoclist.current())
|
||||
elseif &buftype == 'quickfix'
|
||||
elseif &buftype ==# 'quickfix'
|
||||
" TODO: this is needed because in recent versions of Vim lclose
|
||||
" can no longer be called from BufWinLeave
|
||||
" TODO: at this point there is no b:syntastic_loclist
|
||||
@ -266,7 +272,7 @@ function! s:BufEnterHook() " {{{2
|
||||
endif
|
||||
endfunction " }}}2
|
||||
|
||||
function! s:QuitPreHook() " {{{2
|
||||
function! s:QuitPreHook() abort " {{{2
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_AUTOCOMMANDS,
|
||||
\ 'autocmd: QuitPre, buffer ' . bufnr("") . ' = ' . string(bufname(str2nr(bufnr("")))))
|
||||
let b:syntastic_skip_checks = get(b:, 'syntastic_skip_checks', 0) || !syntastic#util#var('check_on_wq')
|
||||
@ -280,7 +286,7 @@ endfunction " }}}2
|
||||
" Main {{{1
|
||||
|
||||
"refresh and redraw all the error info for this buf when saving or reading
|
||||
function! s:UpdateErrors(auto_invoked, checker_names) " {{{2
|
||||
function! s:UpdateErrors(auto_invoked, checker_names) abort " {{{2
|
||||
call syntastic#log#debugShowVariables(g:_SYNTASTIC_DEBUG_TRACE, 'version')
|
||||
call syntastic#log#debugShowOptions(g:_SYNTASTIC_DEBUG_TRACE, s:_DEBUG_DUMP_OPTIONS)
|
||||
call syntastic#log#debugDump(g:_SYNTASTIC_DEBUG_VARIABLES)
|
||||
@ -336,13 +342,13 @@ function! s:UpdateErrors(auto_invoked, checker_names) " {{{2
|
||||
endfunction " }}}2
|
||||
|
||||
"clear the loc list for the buffer
|
||||
function! s:ClearCache() " {{{2
|
||||
function! s:ClearCache() abort " {{{2
|
||||
call s:notifiers.reset(g:SyntasticLoclist.current())
|
||||
call b:syntastic_loclist.destroy()
|
||||
endfunction " }}}2
|
||||
|
||||
"detect and cache all syntax errors in this buffer
|
||||
function! s:CacheErrors(checker_names) " {{{2
|
||||
function! s:CacheErrors(checker_names) abort " {{{2
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_TRACE, 'CacheErrors: ' .
|
||||
\ (len(a:checker_names) ? join(a:checker_names) : 'default checkers'))
|
||||
call s:ClearCache()
|
||||
@ -351,7 +357,8 @@ function! s:CacheErrors(checker_names) " {{{2
|
||||
if !s:_skip_file()
|
||||
" debug logging {{{3
|
||||
call syntastic#log#debugShowVariables(g:_SYNTASTIC_DEBUG_TRACE, 'aggregate_errors')
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_TRACE, 'getcwd() = ' . getcwd())
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_CHECKERS, '$PATH = ' . string($PATH))
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_TRACE, 'getcwd() = ' . string(getcwd()))
|
||||
" }}}3
|
||||
|
||||
let filetypes = s:_resolve_filetypes([])
|
||||
@ -452,7 +459,7 @@ endfunction " }}}2
|
||||
" 'env' - environment variables to set before running the checker
|
||||
" 'returns' - a list of valid exit codes for the checker
|
||||
" @vimlint(EVL102, 1, l:env_save)
|
||||
function! SyntasticMake(options) " {{{2
|
||||
function! SyntasticMake(options) abort " {{{2
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_TRACE, 'SyntasticMake: called with options:', a:options)
|
||||
|
||||
" save options and locale env variables {{{3
|
||||
@ -479,8 +486,8 @@ function! SyntasticMake(options) " {{{2
|
||||
if has_key(a:options, 'env') && len(a:options['env'])
|
||||
for key in keys(a:options['env'])
|
||||
if key =~? '\m^[a-z_]\+$'
|
||||
exec 'let env_save[' . string(key) . '] = $' . key
|
||||
exec 'let $' . key . ' = ' . string(a:options['env'][key])
|
||||
execute 'let env_save[' . string(key) . '] = $' . key
|
||||
execute 'let $' . key . ' = ' . string(a:options['env'][key])
|
||||
endif
|
||||
endfor
|
||||
endif
|
||||
@ -495,7 +502,7 @@ function! SyntasticMake(options) " {{{2
|
||||
let $LC_MESSAGES = old_lc_messages
|
||||
if len(env_save)
|
||||
for key in keys(env_save)
|
||||
exec 'let $' . key . ' = ' . string(env_save[key])
|
||||
execute 'let $' . key . ' = ' . string(env_save[key])
|
||||
endfor
|
||||
endif
|
||||
" }}}3
|
||||
@ -543,7 +550,7 @@ function! SyntasticMake(options) " {{{2
|
||||
let &shellredir = old_shellredir
|
||||
" }}}3
|
||||
|
||||
if !s:_running_windows && (s:_os_name() =~ "FreeBSD" || s:_os_name() =~ "OpenBSD")
|
||||
if !s:_running_windows && (s:_os_name() =~? "FreeBSD" || s:_os_name() =~? "OpenBSD")
|
||||
call syntastic#util#redraw(g:syntastic_full_redraws)
|
||||
endif
|
||||
|
||||
@ -582,7 +589,7 @@ endfunction " }}}2
|
||||
"g:syntastic_stl_format
|
||||
"
|
||||
"return '' if no errors are cached for the buffer
|
||||
function! SyntasticStatuslineFlag() " {{{2
|
||||
function! SyntasticStatuslineFlag() abort " {{{2
|
||||
return g:SyntasticLoclist.current().getStatuslineFlag()
|
||||
endfunction " }}}2
|
||||
|
||||
@ -590,12 +597,12 @@ endfunction " }}}2
|
||||
|
||||
" Utilities {{{1
|
||||
|
||||
function! s:_resolve_filetypes(filetypes) " {{{2
|
||||
function! s:_resolve_filetypes(filetypes) abort " {{{2
|
||||
let type = len(a:filetypes) ? a:filetypes[0] : &filetype
|
||||
return split( get(g:syntastic_filetype_map, type, type), '\m\.' )
|
||||
endfunction " }}}2
|
||||
|
||||
function! s:_ignore_file(filename) " {{{2
|
||||
function! s:_ignore_file(filename) abort " {{{2
|
||||
let fname = fnamemodify(a:filename, ':p')
|
||||
for pattern in g:syntastic_ignore_files
|
||||
if fname =~# pattern
|
||||
@ -606,7 +613,7 @@ function! s:_ignore_file(filename) " {{{2
|
||||
endfunction " }}}2
|
||||
|
||||
" Skip running in special buffers
|
||||
function! s:_skip_file() " {{{2
|
||||
function! s:_skip_file() abort " {{{2
|
||||
let fname = expand('%', 1)
|
||||
let skip = get(b:, 'syntastic_skip_checks', 0) || (&buftype != '') ||
|
||||
\ !filereadable(fname) || getwinvar(0, '&diff') || s:_ignore_file(fname) ||
|
||||
@ -618,7 +625,7 @@ function! s:_skip_file() " {{{2
|
||||
endfunction " }}}2
|
||||
|
||||
" Explain why checks will be skipped for the current file
|
||||
function! s:_explain_skip(filetypes) " {{{2
|
||||
function! s:_explain_skip(filetypes) abort " {{{2
|
||||
if empty(a:filetypes) && s:_skip_file()
|
||||
let why = []
|
||||
let fname = expand('%', 1)
|
||||
@ -647,7 +654,7 @@ function! s:_explain_skip(filetypes) " {{{2
|
||||
endfunction " }}}2
|
||||
|
||||
" Take a list of errors and add default values to them from a:options
|
||||
function! s:_add_to_errors(errors, options) " {{{2
|
||||
function! s:_add_to_errors(errors, options) abort " {{{2
|
||||
for err in a:errors
|
||||
for key in keys(a:options)
|
||||
if !has_key(err, key) || empty(err[key])
|
||||
@ -662,7 +669,7 @@ endfunction " }}}2
|
||||
" XXX: Is this still needed?
|
||||
" The script changes &shellredir to stop the screen
|
||||
" flicking when shelling out to syntax checkers.
|
||||
function! s:_bash_hack() " {{{2
|
||||
function! s:_bash_hack() abort " {{{2
|
||||
if g:syntastic_bash_hack
|
||||
if !exists('s:shell_is_bash')
|
||||
let s:shell_is_bash =
|
||||
@ -677,12 +684,8 @@ function! s:_bash_hack() " {{{2
|
||||
endif
|
||||
endfunction " }}}2
|
||||
|
||||
function! s:_os_name() " {{{2
|
||||
if !exists('s:_uname')
|
||||
let s:_uname = system('uname')
|
||||
lockvar s:_uname
|
||||
endif
|
||||
return s:_uname
|
||||
function! s:_os_name() abort " {{{2
|
||||
return g:_SYNTASTIC_UNAME
|
||||
endfunction " }}}2
|
||||
|
||||
" }}}1
|
||||
|
@ -7,17 +7,17 @@ let g:SyntasticAutoloclistNotifier = {}
|
||||
|
||||
" Public methods {{{1
|
||||
"
|
||||
function! g:SyntasticAutoloclistNotifier.New() " {{{2
|
||||
function! g:SyntasticAutoloclistNotifier.New() abort " {{{2
|
||||
let newObj = copy(self)
|
||||
return newObj
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticAutoloclistNotifier.refresh(loclist) " {{{2
|
||||
function! g:SyntasticAutoloclistNotifier.refresh(loclist) abort " {{{2
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'autoloclist: refresh')
|
||||
call g:SyntasticAutoloclistNotifier.AutoToggle(a:loclist)
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticAutoloclistNotifier.AutoToggle(loclist) " {{{2
|
||||
function! g:SyntasticAutoloclistNotifier.AutoToggle(loclist) abort " {{{2
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'autoloclist: toggle')
|
||||
if !a:loclist.isEmpty()
|
||||
if syntastic#util#var('auto_loc_list') == 1
|
||||
|
@ -11,17 +11,17 @@ let g:SyntasticBalloonsNotifier = {}
|
||||
|
||||
" Public methods {{{1
|
||||
|
||||
function! g:SyntasticBalloonsNotifier.New() " {{{2
|
||||
function! g:SyntasticBalloonsNotifier.New() abort " {{{2
|
||||
let newObj = copy(self)
|
||||
return newObj
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticBalloonsNotifier.enabled() " {{{2
|
||||
function! g:SyntasticBalloonsNotifier.enabled() abort " {{{2
|
||||
return has('balloon_eval') && syntastic#util#var('enable_balloons')
|
||||
endfunction " }}}2
|
||||
|
||||
" Update the error balloons
|
||||
function! g:SyntasticBalloonsNotifier.refresh(loclist) " {{{2
|
||||
function! g:SyntasticBalloonsNotifier.refresh(loclist) abort " {{{2
|
||||
unlet! b:syntastic_private_balloons
|
||||
if self.enabled() && !a:loclist.isEmpty()
|
||||
let b:syntastic_private_balloons = a:loclist.balloons()
|
||||
@ -33,7 +33,7 @@ endfunction " }}}2
|
||||
|
||||
" Reset the error balloons
|
||||
" @vimlint(EVL103, 1, a:loclist)
|
||||
function! g:SyntasticBalloonsNotifier.reset(loclist) " {{{2
|
||||
function! g:SyntasticBalloonsNotifier.reset(loclist) abort " {{{2
|
||||
let b:syntastic_private_balloons = {}
|
||||
if has('balloon_eval')
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'balloons: reset')
|
||||
@ -47,7 +47,7 @@ endfunction " }}}2
|
||||
|
||||
" Private functions {{{1
|
||||
|
||||
function! SyntasticBalloonsExprNotifier() " {{{2
|
||||
function! SyntasticBalloonsExprNotifier() abort " {{{2
|
||||
if !exists('b:syntastic_private_balloons')
|
||||
return ''
|
||||
endif
|
||||
|
@ -7,7 +7,7 @@ let g:SyntasticChecker = {}
|
||||
|
||||
" Public methods {{{1
|
||||
|
||||
function! g:SyntasticChecker.New(args) " {{{2
|
||||
function! g:SyntasticChecker.New(args) abort " {{{2
|
||||
let newObj = copy(self)
|
||||
|
||||
let newObj._filetype = a:args['filetype']
|
||||
@ -40,25 +40,43 @@ function! g:SyntasticChecker.New(args) " {{{2
|
||||
return newObj
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticChecker.getFiletype() " {{{2
|
||||
function! g:SyntasticChecker.getFiletype() abort " {{{2
|
||||
return self._filetype
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticChecker.getName() " {{{2
|
||||
function! g:SyntasticChecker.getName() abort " {{{2
|
||||
return self._name
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticChecker.getExec() " {{{2
|
||||
return
|
||||
" Synchronise _exec with user's setting. Force re-validation if needed.
|
||||
"
|
||||
" XXX: This function must be called at least once before calling either
|
||||
" getExec() or getExecEscaped(). Normally isAvailable() does that for you
|
||||
" automatically, but you should keep still this in mind if you change the
|
||||
" current checker workflow.
|
||||
function! g:SyntasticChecker.syncExec() dict " {{{2
|
||||
let user_exec =
|
||||
\ expand( exists('b:syntastic_' . self._name . '_exec') ? b:syntastic_{self._name}_exec :
|
||||
\ syntastic#util#var(self._filetype . '_' . self._name . '_exec', self._exec), 1 )
|
||||
\ syntastic#util#var(self._filetype . '_' . self._name . '_exec'), 1 )
|
||||
|
||||
if user_exec != '' && user_exec !=# self._exec
|
||||
let self._exec = user_exec
|
||||
if has_key(self, '_available')
|
||||
" we have a new _exec on the block, it has to be validated
|
||||
call remove(self, '_available')
|
||||
endif
|
||||
endif
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticChecker.getExecEscaped() " {{{2
|
||||
return syntastic#util#shescape(self.getExec())
|
||||
function! g:SyntasticChecker.getExec() abort " {{{2
|
||||
return self._exec
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticChecker.getLocListRaw() " {{{2
|
||||
function! g:SyntasticChecker.getExecEscaped() abort " {{{2
|
||||
return syntastic#util#shescape(self._exec)
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticChecker.getLocListRaw() abort " {{{2
|
||||
let name = self._filetype . '/' . self._name
|
||||
try
|
||||
let list = self._locListFunc()
|
||||
@ -73,11 +91,11 @@ function! g:SyntasticChecker.getLocListRaw() " {{{2
|
||||
return list
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticChecker.getLocList() " {{{2
|
||||
function! g:SyntasticChecker.getLocList() abort " {{{2
|
||||
return g:SyntasticLoclist.New(self.getLocListRaw())
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticChecker.getVersion(...) " {{{2
|
||||
function! g:SyntasticChecker.getVersion(...) abort " {{{2
|
||||
if !exists('self._version')
|
||||
let command = a:0 ? a:1 : self.getExecEscaped() . ' --version'
|
||||
let version_output = system(command)
|
||||
@ -89,7 +107,7 @@ function! g:SyntasticChecker.getVersion(...) " {{{2
|
||||
return get(self, '_version', [])
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticChecker.setVersion(version) " {{{2
|
||||
function! g:SyntasticChecker.setVersion(version) abort " {{{2
|
||||
if len(a:version)
|
||||
let self._version = copy(a:version)
|
||||
call self.log(self.getExec() . ' version =', a:version)
|
||||
@ -98,7 +116,7 @@ function! g:SyntasticChecker.setVersion(version) " {{{2
|
||||
endif
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticChecker.log(msg, ...) " {{{2
|
||||
function! g:SyntasticChecker.log(msg, ...) abort " {{{2
|
||||
let leader = self._filetype . '/' . self._name . ': '
|
||||
if a:0 > 0
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_CHECKERS, leader . a:msg, a:1)
|
||||
@ -107,7 +125,7 @@ function! g:SyntasticChecker.log(msg, ...) " {{{2
|
||||
endif
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticChecker.makeprgBuild(opts) " {{{2
|
||||
function! g:SyntasticChecker.makeprgBuild(opts) abort " {{{2
|
||||
let basename = self._filetype . '_' . self._name . '_'
|
||||
|
||||
let parts = []
|
||||
@ -120,20 +138,21 @@ function! g:SyntasticChecker.makeprgBuild(opts) " {{{2
|
||||
return join(parts)
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticChecker.isAvailable() " {{{2
|
||||
function! g:SyntasticChecker.isAvailable() abort " {{{2
|
||||
call self.syncExec()
|
||||
if !has_key(self, '_available')
|
||||
let self._available = self._isAvailableFunc()
|
||||
endif
|
||||
return self._available
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticChecker.wantSort() " {{{2
|
||||
function! g:SyntasticChecker.wantSort() abort " {{{2
|
||||
return syntastic#util#var(self._filetype . '_' . self._name . '_sort', 0)
|
||||
endfunction " }}}2
|
||||
|
||||
" This method is no longer used by syntastic. It's here only to maintain
|
||||
" backwards compatibility with external checkers which might depend on it.
|
||||
function! g:SyntasticChecker.setWantSort(val) " {{{2
|
||||
function! g:SyntasticChecker.setWantSort(val) abort " {{{2
|
||||
if !exists('g:syntastic_' . self._filetype . '_' . self._name . '_sort')
|
||||
let g:syntastic_{self._filetype}_{self._name}_sort = a:val
|
||||
endif
|
||||
@ -143,7 +162,7 @@ endfunction " }}}2
|
||||
|
||||
" Private methods {{{1
|
||||
|
||||
function! g:SyntasticChecker._quietMessages(errors) " {{{2
|
||||
function! g:SyntasticChecker._quietMessages(errors) abort " {{{2
|
||||
" wildcard quiet_messages
|
||||
let quiet_filters = copy(syntastic#util#var('quiet_messages', {}))
|
||||
if type(quiet_filters) != type({})
|
||||
@ -168,7 +187,7 @@ function! g:SyntasticChecker._quietMessages(errors) " {{{2
|
||||
endif
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticChecker._populateHighlightRegexes(errors) " {{{2
|
||||
function! g:SyntasticChecker._populateHighlightRegexes(errors) abort " {{{2
|
||||
if has_key(self, '_highlightRegexFunc')
|
||||
for e in a:errors
|
||||
if e['valid']
|
||||
@ -181,7 +200,7 @@ function! g:SyntasticChecker._populateHighlightRegexes(errors) " {{{2
|
||||
endif
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticChecker._getOpt(opts, basename, name, default) " {{{2
|
||||
function! g:SyntasticChecker._getOpt(opts, basename, name, default) abort " {{{2
|
||||
let ret = []
|
||||
call extend( ret, syntastic#util#argsescape(get(a:opts, a:name . '_before', '')) )
|
||||
call extend( ret, syntastic#util#argsescape(syntastic#util#var( a:basename . a:name, get(a:opts, a:name, a:default) )) )
|
||||
|
@ -7,16 +7,16 @@ let g:SyntasticCursorNotifier = {}
|
||||
|
||||
" Public methods {{{1
|
||||
|
||||
function! g:SyntasticCursorNotifier.New() " {{{2
|
||||
function! g:SyntasticCursorNotifier.New() abort " {{{2
|
||||
let newObj = copy(self)
|
||||
return newObj
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticCursorNotifier.enabled() " {{{2
|
||||
function! g:SyntasticCursorNotifier.enabled() abort " {{{2
|
||||
return syntastic#util#var('echo_current_error')
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticCursorNotifier.refresh(loclist) " {{{2
|
||||
function! g:SyntasticCursorNotifier.refresh(loclist) abort " {{{2
|
||||
if self.enabled() && !a:loclist.isEmpty()
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'cursor: refresh')
|
||||
let b:syntastic_private_messages = copy(a:loclist.messages(bufnr('')))
|
||||
@ -28,7 +28,7 @@ function! g:SyntasticCursorNotifier.refresh(loclist) " {{{2
|
||||
endfunction " }}}2
|
||||
|
||||
" @vimlint(EVL103, 1, a:loclist)
|
||||
function! g:SyntasticCursorNotifier.reset(loclist) " {{{2
|
||||
function! g:SyntasticCursorNotifier.reset(loclist) abort " {{{2
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'cursor: reset')
|
||||
autocmd! syntastic CursorMoved
|
||||
unlet! b:syntastic_private_messages
|
||||
@ -40,7 +40,7 @@ endfunction " }}}2
|
||||
|
||||
" Private functions {{{1
|
||||
|
||||
function! SyntasticRefreshCursor() " {{{2
|
||||
function! SyntasticRefreshCursor() abort " {{{2
|
||||
if !exists('b:syntastic_private_messages') || empty(b:syntastic_private_messages)
|
||||
" file not checked
|
||||
return
|
||||
@ -93,7 +93,7 @@ endfunction " }}}2
|
||||
|
||||
" Utilities {{{1
|
||||
|
||||
function! s:_is_same_index(line, old_line, column, idx, messages) " {{{2
|
||||
function! s:_is_same_index(line, old_line, column, idx, messages) abort " {{{2
|
||||
if a:old_line >= 0 && a:line == a:old_line && a:idx >= 0
|
||||
if len(a:messages) <= 1
|
||||
return 1
|
||||
@ -113,7 +113,7 @@ function! s:_is_same_index(line, old_line, column, idx, messages) " {{{2
|
||||
endif
|
||||
endfunction " }}}2
|
||||
|
||||
function! s:_find_index(column, messages) " {{{2
|
||||
function! s:_find_index(column, messages) abort " {{{2
|
||||
let max = len(a:messages) - 1
|
||||
if max == 0
|
||||
return 0
|
||||
|
@ -13,7 +13,7 @@ let s:setup_done = 0
|
||||
|
||||
" Public methods {{{1
|
||||
|
||||
function! g:SyntasticHighlightingNotifier.New() " {{{2
|
||||
function! g:SyntasticHighlightingNotifier.New() abort " {{{2
|
||||
let newObj = copy(self)
|
||||
|
||||
if !s:setup_done
|
||||
@ -25,12 +25,12 @@ function! g:SyntasticHighlightingNotifier.New() " {{{2
|
||||
return newObj
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticHighlightingNotifier.enabled() " {{{2
|
||||
function! g:SyntasticHighlightingNotifier.enabled() abort " {{{2
|
||||
return s:has_highlighting && syntastic#util#var('enable_highlighting')
|
||||
endfunction " }}}2
|
||||
|
||||
" Sets error highlights in the cuirrent window
|
||||
function! g:SyntasticHighlightingNotifier.refresh(loclist) " {{{2
|
||||
function! g:SyntasticHighlightingNotifier.refresh(loclist) abort " {{{2
|
||||
if self.enabled()
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'highlighting: refresh')
|
||||
call self._reset()
|
||||
@ -61,7 +61,7 @@ endfunction " }}}2
|
||||
|
||||
" Remove all error highlights from the window
|
||||
" @vimlint(EVL103, 1, a:loclist)
|
||||
function! g:SyntasticHighlightingNotifier.reset(loclist) " {{{2
|
||||
function! g:SyntasticHighlightingNotifier.reset(loclist) abort " {{{2
|
||||
if s:has_highlighting
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'highlighting: reset')
|
||||
call self._reset()
|
||||
@ -74,7 +74,7 @@ endfunction " }}}2
|
||||
" Private methods {{{1
|
||||
|
||||
" One time setup: define our own highlighting
|
||||
function! g:SyntasticHighlightingNotifier._setup() " {{{2
|
||||
function! g:SyntasticHighlightingNotifier._setup() abort " {{{2
|
||||
if s:has_highlighting
|
||||
if !hlexists('SyntasticError')
|
||||
highlight link SyntasticError SpellBad
|
||||
@ -91,7 +91,7 @@ function! g:SyntasticHighlightingNotifier._setup() " {{{2
|
||||
endif
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticHighlightingNotifier._reset() " {{{2
|
||||
function! g:SyntasticHighlightingNotifier._reset() abort " {{{2
|
||||
for match in getmatches()
|
||||
if stridx(match['group'], 'Syntastic') == 0
|
||||
call matchdelete(match['id'])
|
||||
|
@ -7,7 +7,7 @@ let g:SyntasticLoclist = {}
|
||||
|
||||
" Public methods {{{1
|
||||
|
||||
function! g:SyntasticLoclist.New(rawLoclist) " {{{2
|
||||
function! g:SyntasticLoclist.New(rawLoclist) abort " {{{2
|
||||
let newObj = copy(self)
|
||||
|
||||
let llist = filter(copy(a:rawLoclist), 'v:val["valid"] == 1')
|
||||
@ -27,20 +27,20 @@ function! g:SyntasticLoclist.New(rawLoclist) " {{{2
|
||||
return newObj
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticLoclist.current() " {{{2
|
||||
function! g:SyntasticLoclist.current() abort " {{{2
|
||||
if !exists("b:syntastic_loclist") || empty(b:syntastic_loclist)
|
||||
let b:syntastic_loclist = g:SyntasticLoclist.New([])
|
||||
endif
|
||||
return b:syntastic_loclist
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticLoclist.extend(other) " {{{2
|
||||
function! g:SyntasticLoclist.extend(other) abort " {{{2
|
||||
let list = self.copyRaw()
|
||||
call extend(list, a:other.copyRaw())
|
||||
return g:SyntasticLoclist.New(list)
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticLoclist.sort() " {{{2
|
||||
function! g:SyntasticLoclist.sort() abort " {{{2
|
||||
if !self._sorted
|
||||
for e in self._rawLoclist
|
||||
call s:_set_screen_column(e)
|
||||
@ -52,11 +52,11 @@ function! g:SyntasticLoclist.sort() " {{{2
|
||||
endif
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticLoclist.isEmpty() " {{{2
|
||||
function! g:SyntasticLoclist.isEmpty() abort " {{{2
|
||||
return empty(self._rawLoclist)
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticLoclist.isNewerThan(stamp) " {{{2
|
||||
function! g:SyntasticLoclist.isNewerThan(stamp) abort " {{{2
|
||||
if !exists("self._stamp")
|
||||
let self._stamp = []
|
||||
return 0
|
||||
@ -64,23 +64,23 @@ function! g:SyntasticLoclist.isNewerThan(stamp) " {{{2
|
||||
return syntastic#util#compareLexi(self._stamp, a:stamp) > 0
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticLoclist.copyRaw() " {{{2
|
||||
function! g:SyntasticLoclist.copyRaw() abort " {{{2
|
||||
return copy(self._rawLoclist)
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticLoclist.getRaw() " {{{2
|
||||
function! g:SyntasticLoclist.getRaw() abort " {{{2
|
||||
return self._rawLoclist
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticLoclist.getBuffers() " {{{2
|
||||
function! g:SyntasticLoclist.getBuffers() abort " {{{2
|
||||
return syntastic#util#unique(map(copy(self._rawLoclist), 'str2nr(v:val["bufnr"])') + [self._owner])
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticLoclist.getCursorColumns() " {{{2
|
||||
function! g:SyntasticLoclist.getCursorColumns() abort " {{{2
|
||||
return self._columns
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticLoclist.getStatuslineFlag() " {{{2
|
||||
function! g:SyntasticLoclist.getStatuslineFlag() abort " {{{2
|
||||
if !exists("self._stl_format")
|
||||
let self._stl_format = ''
|
||||
endif
|
||||
@ -133,7 +133,7 @@ function! g:SyntasticLoclist.getStatuslineFlag() " {{{2
|
||||
return self._stl_flag
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticLoclist.getFirstError(...) " {{{2
|
||||
function! g:SyntasticLoclist.getFirstError(...) abort " {{{2
|
||||
let max_issues = len(self._rawLoclist)
|
||||
if a:0 && a:1 < max_issues
|
||||
let max_issues = a:1
|
||||
@ -148,23 +148,23 @@ function! g:SyntasticLoclist.getFirstError(...) " {{{2
|
||||
return 0
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticLoclist.getName() " {{{2
|
||||
function! g:SyntasticLoclist.getName() abort " {{{2
|
||||
return len(self._name)
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticLoclist.setName(name) " {{{2
|
||||
function! g:SyntasticLoclist.setName(name) abort " {{{2
|
||||
let self._name = a:name
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticLoclist.getOwner() " {{{2
|
||||
function! g:SyntasticLoclist.getOwner() abort " {{{2
|
||||
return self._owner
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticLoclist.setOwner(buffer) " {{{2
|
||||
function! g:SyntasticLoclist.setOwner(buffer) abort " {{{2
|
||||
let self._owner = type(a:buffer) == type(0) ? a:buffer : str2nr(a:buffer)
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticLoclist.deploy() " {{{2
|
||||
function! g:SyntasticLoclist.deploy() abort " {{{2
|
||||
call self.setOwner(bufnr(''))
|
||||
let self._stamp = syntastic#util#stamp()
|
||||
for buf in self.getBuffers()
|
||||
@ -172,19 +172,19 @@ function! g:SyntasticLoclist.deploy() " {{{2
|
||||
endfor
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticLoclist.destroy() " {{{2
|
||||
function! g:SyntasticLoclist.destroy() abort " {{{2
|
||||
for buf in self.getBuffers()
|
||||
call setbufvar(buf, 'syntastic_loclist', {})
|
||||
endfor
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticLoclist.decorate(tag) " {{{2
|
||||
function! g:SyntasticLoclist.decorate(tag) abort " {{{2
|
||||
for e in self._rawLoclist
|
||||
let e['text'] .= ' [' . a:tag . ']'
|
||||
endfor
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticLoclist.balloons() " {{{2
|
||||
function! g:SyntasticLoclist.balloons() abort " {{{2
|
||||
if !exists("self._cachedBalloons")
|
||||
let sep = has("balloon_multiline") ? "\n" : ' | '
|
||||
|
||||
@ -207,14 +207,14 @@ function! g:SyntasticLoclist.balloons() " {{{2
|
||||
return get(self._cachedBalloons, bufnr(''), {})
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticLoclist.errors() " {{{2
|
||||
function! g:SyntasticLoclist.errors() abort " {{{2
|
||||
if !exists("self._cachedErrors")
|
||||
let self._cachedErrors = self.filter({'type': "E"})
|
||||
endif
|
||||
return self._cachedErrors
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticLoclist.warnings() " {{{2
|
||||
function! g:SyntasticLoclist.warnings() abort " {{{2
|
||||
if !exists("self._cachedWarnings")
|
||||
let self._cachedWarnings = self.filter({'type': "W"})
|
||||
endif
|
||||
@ -223,12 +223,12 @@ endfunction " }}}2
|
||||
|
||||
" Legacy function. Syntastic no longer calls it, but we keep it
|
||||
" around because other plugins (f.i. powerline) depend on it.
|
||||
function! g:SyntasticLoclist.hasErrorsOrWarningsToDisplay() " {{{2
|
||||
function! g:SyntasticLoclist.hasErrorsOrWarningsToDisplay() abort " {{{2
|
||||
return !self.isEmpty()
|
||||
endfunction " }}}2
|
||||
|
||||
" cache used by EchoCurrentError()
|
||||
function! g:SyntasticLoclist.messages(buf) " {{{2
|
||||
function! g:SyntasticLoclist.messages(buf) abort " {{{2
|
||||
if !exists("self._cachedMessages")
|
||||
let self._cachedMessages = {}
|
||||
|
||||
@ -280,14 +280,14 @@ endfunction " }}}2
|
||||
"would return all errors for buffer 10.
|
||||
"
|
||||
"Note that all comparisons are done with ==?
|
||||
function! g:SyntasticLoclist.filter(filters) " {{{2
|
||||
function! g:SyntasticLoclist.filter(filters) abort " {{{2
|
||||
let conditions = values(map(copy(a:filters), 's:_translate(v:key, v:val)'))
|
||||
let filter = len(conditions) == 1 ?
|
||||
\ conditions[0] : join(map(conditions, '"(" . v:val . ")"'), ' && ')
|
||||
return filter(copy(self._rawLoclist), filter)
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticLoclist.setloclist() " {{{2
|
||||
function! g:SyntasticLoclist.setloclist() abort " {{{2
|
||||
if !exists('w:syntastic_loclist_set')
|
||||
let w:syntastic_loclist_set = 0
|
||||
endif
|
||||
@ -298,7 +298,7 @@ function! g:SyntasticLoclist.setloclist() " {{{2
|
||||
endfunction " }}}2
|
||||
|
||||
"display the cached errors for this buf in the location list
|
||||
function! g:SyntasticLoclist.show() " {{{2
|
||||
function! g:SyntasticLoclist.show() abort " {{{2
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'loclist: show')
|
||||
call self.setloclist()
|
||||
|
||||
@ -333,7 +333,7 @@ endfunction " }}}2
|
||||
|
||||
" Public functions {{{1
|
||||
|
||||
function! SyntasticLoclistHide() " {{{2
|
||||
function! SyntasticLoclistHide() abort " {{{2
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'loclist: hide')
|
||||
silent! lclose
|
||||
endfunction " }}}2
|
||||
@ -342,11 +342,11 @@ endfunction " }}}2
|
||||
|
||||
" Utilities {{{1
|
||||
|
||||
function! s:_translate(key, val) " {{{2
|
||||
function! s:_translate(key, val) abort " {{{2
|
||||
return 'get(v:val, ' . string(a:key) . ', "") ==? ' . string(a:val)
|
||||
endfunction " }}}2
|
||||
|
||||
function! s:_set_screen_column(item) " {{{2
|
||||
function! s:_set_screen_column(item) abort " {{{2
|
||||
if !has_key(a:item, 'scol')
|
||||
let col = get(a:item, 'col', 0)
|
||||
if col != 0 && get(a:item, 'vcol', 0) == 0
|
||||
@ -363,7 +363,7 @@ function! s:_set_screen_column(item) " {{{2
|
||||
endif
|
||||
endfunction " }}}2
|
||||
|
||||
function! s:_remove_shadowed_items(errors) " {{{2
|
||||
function! s:_remove_shadowed_items(errors) abort " {{{2
|
||||
" keep only the first message at a given column
|
||||
let i = 0
|
||||
while i < len(a:errors) - 1
|
||||
@ -395,7 +395,7 @@ function! s:_remove_shadowed_items(errors) " {{{2
|
||||
endwhile
|
||||
endfunction " }}}2
|
||||
|
||||
function! s:_compare_error_items_by_columns(a, b) " {{{2
|
||||
function! s:_compare_error_items_by_columns(a, b) abort " {{{2
|
||||
if a:a['bufnr'] != a:b['bufnr']
|
||||
" group by file
|
||||
return a:a['bufnr'] - a:b['bufnr']
|
||||
@ -413,7 +413,7 @@ function! s:_compare_error_items_by_columns(a, b) " {{{2
|
||||
endif
|
||||
endfunction " }}}2
|
||||
|
||||
function! s:_compare_error_items_by_lines(a, b) " {{{2
|
||||
function! s:_compare_error_items_by_lines(a, b) abort " {{{2
|
||||
if a:a['bufnr'] != a:b['bufnr']
|
||||
" group by file
|
||||
return a:a['bufnr'] - a:b['bufnr']
|
||||
|
@ -7,7 +7,7 @@ let g:SyntasticModeMap = {}
|
||||
|
||||
" Public methods {{{1
|
||||
|
||||
function! g:SyntasticModeMap.Instance() " {{{2
|
||||
function! g:SyntasticModeMap.Instance() abort " {{{2
|
||||
if !exists('s:SyntasticModeMapInstance')
|
||||
let s:SyntasticModeMapInstance = copy(self)
|
||||
call s:SyntasticModeMapInstance.synch()
|
||||
@ -16,7 +16,7 @@ function! g:SyntasticModeMap.Instance() " {{{2
|
||||
return s:SyntasticModeMapInstance
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticModeMap.synch() " {{{2
|
||||
function! g:SyntasticModeMap.synch() abort " {{{2
|
||||
if exists('g:syntastic_mode_map')
|
||||
let self._mode = get(g:syntastic_mode_map, 'mode', 'active')
|
||||
let self._activeFiletypes = copy(get(g:syntastic_mode_map, 'active_filetypes', []))
|
||||
@ -28,7 +28,7 @@ function! g:SyntasticModeMap.synch() " {{{2
|
||||
endif
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticModeMap.allowsAutoChecking(filetype) " {{{2
|
||||
function! g:SyntasticModeMap.allowsAutoChecking(filetype) abort " {{{2
|
||||
let fts = split(a:filetype, '\m\.')
|
||||
|
||||
if self.isPassive()
|
||||
@ -38,7 +38,7 @@ function! g:SyntasticModeMap.allowsAutoChecking(filetype) " {{{2
|
||||
endif
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticModeMap.doAutoChecking() " {{{2
|
||||
function! g:SyntasticModeMap.doAutoChecking() abort " {{{2
|
||||
let local_mode = get(b:, 'syntastic_mode', '')
|
||||
if local_mode ==# 'active' || local_mode ==# 'passive'
|
||||
return local_mode ==# 'active'
|
||||
@ -47,11 +47,11 @@ function! g:SyntasticModeMap.doAutoChecking() " {{{2
|
||||
return self.allowsAutoChecking(&filetype)
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticModeMap.isPassive() " {{{2
|
||||
function! g:SyntasticModeMap.isPassive() abort " {{{2
|
||||
return self._mode ==# 'passive'
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticModeMap.toggleMode() " {{{2
|
||||
function! g:SyntasticModeMap.toggleMode() abort " {{{2
|
||||
call self.synch()
|
||||
|
||||
if self._mode ==# 'active'
|
||||
@ -67,12 +67,12 @@ function! g:SyntasticModeMap.toggleMode() " {{{2
|
||||
let g:syntastic_mode_map['mode'] = self._mode
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticModeMap.echoMode() " {{{2
|
||||
function! g:SyntasticModeMap.echoMode() abort " {{{2
|
||||
echo "Syntastic: " . self._mode . " mode enabled"
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticModeMap.modeInfo(filetypes) " {{{2
|
||||
echomsg 'Syntastic version: ' . g:_SYNTASTIC_VERSION
|
||||
function! g:SyntasticModeMap.modeInfo(filetypes) abort " {{{2
|
||||
echomsg 'Syntastic version: ' . g:_SYNTASTIC_VERSION . ' (Vim ' . v:version . ', ' . g:_SYNTASTIC_UNAME . ')'
|
||||
let type = len(a:filetypes) ? a:filetypes[0] : &filetype
|
||||
echomsg 'Info for filetype: ' . type
|
||||
|
||||
@ -104,11 +104,11 @@ endfunction " }}}2
|
||||
|
||||
" Private methods {{{1
|
||||
|
||||
function! g:SyntasticModeMap._isOneFiletypeActive(filetypes) " {{{2
|
||||
function! g:SyntasticModeMap._isOneFiletypeActive(filetypes) abort " {{{2
|
||||
return !empty(filter(copy(a:filetypes), 'index(self._activeFiletypes, v:val) != -1'))
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticModeMap._noFiletypesArePassive(filetypes) " {{{2
|
||||
function! g:SyntasticModeMap._noFiletypesArePassive(filetypes) abort " {{{2
|
||||
return empty(filter(copy(a:filetypes), 'index(self._passiveFiletypes, v:val) != -1'))
|
||||
endfunction " }}}2
|
||||
|
||||
|
@ -13,7 +13,7 @@ lockvar! s:_PERSISTENT_NOTIFIERS
|
||||
|
||||
" Public methods {{{1
|
||||
|
||||
function! g:SyntasticNotifiers.Instance() " {{{2
|
||||
function! g:SyntasticNotifiers.Instance() abort " {{{2
|
||||
if !exists('s:SyntasticNotifiersInstance')
|
||||
let s:SyntasticNotifiersInstance = copy(self)
|
||||
call s:SyntasticNotifiersInstance._initNotifiers()
|
||||
@ -22,7 +22,7 @@ function! g:SyntasticNotifiers.Instance() " {{{2
|
||||
return s:SyntasticNotifiersInstance
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticNotifiers.refresh(loclist) " {{{2
|
||||
function! g:SyntasticNotifiers.refresh(loclist) abort " {{{2
|
||||
if !a:loclist.isEmpty() && !a:loclist.isNewerThan([])
|
||||
" loclist not fully constructed yet
|
||||
return
|
||||
@ -48,7 +48,7 @@ function! g:SyntasticNotifiers.refresh(loclist) " {{{2
|
||||
endfor
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticNotifiers.reset(loclist) " {{{2
|
||||
function! g:SyntasticNotifiers.reset(loclist) abort " {{{2
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'notifiers: reset')
|
||||
for type in self._enabled_types
|
||||
let class = substitute(type, '\m.*', 'Syntastic\u&Notifier', '')
|
||||
@ -71,7 +71,7 @@ endfunction " }}}2
|
||||
|
||||
" Private methods {{{1
|
||||
|
||||
function! g:SyntasticNotifiers._initNotifiers() " {{{2
|
||||
function! g:SyntasticNotifiers._initNotifiers() abort " {{{2
|
||||
let self._notifier = {}
|
||||
for type in s:_NOTIFIER_TYPES
|
||||
let class = substitute(type, '\m.*', 'Syntastic\u&Notifier', '')
|
||||
|
@ -73,8 +73,8 @@ let s:_DEFAULT_CHECKERS = {
|
||||
\ 'scss': ['sass', 'scss_lint'],
|
||||
\ 'sh': ['sh', 'shellcheck'],
|
||||
\ 'slim': ['slimrb'],
|
||||
\ 'sml': ['smlnj'],
|
||||
\ 'spec': ['rpmlint'],
|
||||
\ 'swift': ['xcrun'],
|
||||
\ 'tcl': ['nagelfar'],
|
||||
\ 'tex': ['lacheck', 'chktex'],
|
||||
\ 'texinfo': ['makeinfo'],
|
||||
@ -137,7 +137,7 @@ let g:SyntasticRegistry = {}
|
||||
" parameters, all private methods take normalized filetypes. Public methods
|
||||
" are thus supposed to normalize filetypes before calling private methods.
|
||||
|
||||
function! g:SyntasticRegistry.Instance() " {{{2
|
||||
function! g:SyntasticRegistry.Instance() abort " {{{2
|
||||
if !exists('s:SyntasticRegistryInstance')
|
||||
let s:SyntasticRegistryInstance = copy(self)
|
||||
let s:SyntasticRegistryInstance._checkerMap = {}
|
||||
@ -146,7 +146,7 @@ function! g:SyntasticRegistry.Instance() " {{{2
|
||||
return s:SyntasticRegistryInstance
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticRegistry.CreateAndRegisterChecker(args) " {{{2
|
||||
function! g:SyntasticRegistry.CreateAndRegisterChecker(args) abort " {{{2
|
||||
let checker = g:SyntasticChecker.New(a:args)
|
||||
let registry = g:SyntasticRegistry.Instance()
|
||||
call registry._registerChecker(checker)
|
||||
@ -156,7 +156,7 @@ endfunction " }}}2
|
||||
" If hints_list is empty, user settings are are used instead. Checkers are
|
||||
" not checked for availability (that is, the corresponding IsAvailable() are
|
||||
" not run).
|
||||
function! g:SyntasticRegistry.getCheckers(ftalias, hints_list) " {{{2
|
||||
function! g:SyntasticRegistry.getCheckers(ftalias, hints_list) abort " {{{2
|
||||
let ft = s:_normalise_filetype(a:ftalias)
|
||||
call self._loadCheckersFor(ft)
|
||||
|
||||
@ -179,11 +179,11 @@ endfunction " }}}2
|
||||
|
||||
" Same as getCheckers(), but keep only the checkers available. This runs the
|
||||
" corresponding IsAvailable() functions for all checkers.
|
||||
function! g:SyntasticRegistry.getCheckersAvailable(ftalias, hints_list) " {{{2
|
||||
function! g:SyntasticRegistry.getCheckersAvailable(ftalias, hints_list) abort " {{{2
|
||||
return filter(self.getCheckers(a:ftalias, a:hints_list), 'v:val.isAvailable()')
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticRegistry.getKnownFiletypes() " {{{2
|
||||
function! g:SyntasticRegistry.getKnownFiletypes() abort " {{{2
|
||||
let types = keys(s:_DEFAULT_CHECKERS)
|
||||
|
||||
call extend(types, keys(s:_DEFAULT_FILETYPE_MAP))
|
||||
@ -199,13 +199,13 @@ function! g:SyntasticRegistry.getKnownFiletypes() " {{{2
|
||||
return syntastic#util#unique(types)
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticRegistry.getNamesOfAvailableCheckers(ftalias) " {{{2
|
||||
function! g:SyntasticRegistry.getNamesOfAvailableCheckers(ftalias) abort " {{{2
|
||||
let ft = s:_normalise_filetype(a:ftalias)
|
||||
call self._loadCheckersFor(ft)
|
||||
return keys(filter( copy(self._checkerMap[ft]), 'v:val.isAvailable()' ))
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticRegistry.echoInfoFor(ftalias_list) " {{{2
|
||||
function! g:SyntasticRegistry.echoInfoFor(ftalias_list) abort " {{{2
|
||||
let ft_list = syntastic#util#unique(map( copy(a:ftalias_list), 's:_normalise_filetype(v:val)' ))
|
||||
if len(ft_list) != 1
|
||||
let available = []
|
||||
@ -274,11 +274,11 @@ function! g:SyntasticRegistry._registerChecker(checker) abort " {{{2
|
||||
let self._checkerMap[ft][name] = a:checker
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticRegistry._filterCheckersByName(checkers_map, list) " {{{2
|
||||
function! g:SyntasticRegistry._filterCheckersByName(checkers_map, list) abort " {{{2
|
||||
return filter( map(copy(a:list), 'get(a:checkers_map, v:val, {})'), '!empty(v:val)' )
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticRegistry._loadCheckersFor(filetype) " {{{2
|
||||
function! g:SyntasticRegistry._loadCheckersFor(filetype) abort " {{{2
|
||||
if has_key(self._checkerMap, a:filetype)
|
||||
return
|
||||
endif
|
||||
@ -291,7 +291,7 @@ function! g:SyntasticRegistry._loadCheckersFor(filetype) " {{{2
|
||||
endfunction " }}}2
|
||||
|
||||
" Check for obsolete variable g:syntastic_<filetype>_checker
|
||||
function! g:SyntasticRegistry._checkDeprecation(filetype) " {{{2
|
||||
function! g:SyntasticRegistry._checkDeprecation(filetype) abort " {{{2
|
||||
if exists('g:syntastic_' . a:filetype . '_checker') && !exists('g:syntastic_' . a:filetype . '_checkers')
|
||||
let g:syntastic_{a:filetype}_checkers = [g:syntastic_{a:filetype}_checker]
|
||||
call syntastic#log#oneTimeWarn('variable g:syntastic_' . a:filetype . '_checker is deprecated')
|
||||
@ -304,14 +304,14 @@ endfunction " }}}2
|
||||
|
||||
"resolve filetype aliases, and replace - with _ otherwise we cant name
|
||||
"syntax checker functions legally for filetypes like "gentoo-metadata"
|
||||
function! s:_normalise_filetype(ftalias) " {{{2
|
||||
function! s:_normalise_filetype(ftalias) abort " {{{2
|
||||
let ft = get(s:_DEFAULT_FILETYPE_MAP, a:ftalias, a:ftalias)
|
||||
let ft = get(g:syntastic_filetype_map, ft, ft)
|
||||
let ft = substitute(ft, '\m-', '_', 'g')
|
||||
return ft
|
||||
endfunction " }}}2
|
||||
|
||||
function! s:_disabled_by_eclim(filetype) " {{{2
|
||||
function! s:_disabled_by_eclim(filetype) abort " {{{2
|
||||
if index(s:_ECLIM_TYPES, a:filetype) >= 0
|
||||
let lang = toupper(a:filetype[0]) . a:filetype[1:]
|
||||
let ft = a:filetype !=# 'cpp' ? lang : 'C'
|
||||
@ -321,7 +321,7 @@ function! s:_disabled_by_eclim(filetype) " {{{2
|
||||
return 0
|
||||
endfunction " }}}2
|
||||
|
||||
function! s:_disabled_by_ycm(filetype) " {{{2
|
||||
function! s:_disabled_by_ycm(filetype) abort " {{{2
|
||||
return index(s:_YCM_TYPES, a:filetype) >= 0
|
||||
endfunction " }}}2
|
||||
|
||||
|
@ -19,7 +19,7 @@ let s:setup_done = 0
|
||||
|
||||
" Public methods {{{1
|
||||
|
||||
function! g:SyntasticSignsNotifier.New() " {{{2
|
||||
function! g:SyntasticSignsNotifier.New() abort " {{{2
|
||||
let newObj = copy(self)
|
||||
|
||||
if !s:setup_done
|
||||
@ -31,11 +31,11 @@ function! g:SyntasticSignsNotifier.New() " {{{2
|
||||
return newObj
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticSignsNotifier.enabled() " {{{2
|
||||
function! g:SyntasticSignsNotifier.enabled() abort " {{{2
|
||||
return has('signs') && syntastic#util#var('enable_signs')
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticSignsNotifier.refresh(loclist) " {{{2
|
||||
function! g:SyntasticSignsNotifier.refresh(loclist) abort " {{{2
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'signs: refresh')
|
||||
let old_signs = copy(self._bufSignIds())
|
||||
if self.enabled()
|
||||
@ -49,7 +49,7 @@ endfunction " }}}2
|
||||
" Private methods {{{1
|
||||
|
||||
" One time setup: define our own sign types and highlighting
|
||||
function! g:SyntasticSignsNotifier._setup() " {{{2
|
||||
function! g:SyntasticSignsNotifier._setup() abort " {{{2
|
||||
if has('signs')
|
||||
if !hlexists('SyntasticErrorSign')
|
||||
highlight link SyntasticErrorSign error
|
||||
@ -83,7 +83,7 @@ function! g:SyntasticSignsNotifier._setup() " {{{2
|
||||
endfunction " }}}2
|
||||
|
||||
" Place signs by all syntax errors in the buffer
|
||||
function! g:SyntasticSignsNotifier._signErrors(loclist) " {{{2
|
||||
function! g:SyntasticSignsNotifier._signErrors(loclist) abort " {{{2
|
||||
let loclist = a:loclist
|
||||
if !loclist.isEmpty()
|
||||
|
||||
@ -116,7 +116,7 @@ function! g:SyntasticSignsNotifier._signErrors(loclist) " {{{2
|
||||
endfunction " }}}2
|
||||
|
||||
" Remove the signs with the given ids from this buffer
|
||||
function! g:SyntasticSignsNotifier._removeSigns(ids) " {{{2
|
||||
function! g:SyntasticSignsNotifier._removeSigns(ids) abort " {{{2
|
||||
if has('signs')
|
||||
for s in reverse(copy(a:ids))
|
||||
execute "sign unplace " . s
|
||||
@ -126,7 +126,7 @@ function! g:SyntasticSignsNotifier._removeSigns(ids) " {{{2
|
||||
endfunction " }}}2
|
||||
|
||||
" Get all the ids of the SyntaxError signs in the buffer
|
||||
function! g:SyntasticSignsNotifier._bufSignIds() " {{{2
|
||||
function! g:SyntasticSignsNotifier._bufSignIds() abort " {{{2
|
||||
if !exists("b:syntastic_private_sign_ids")
|
||||
let b:syntastic_private_sign_ids = []
|
||||
endif
|
||||
|
Reference in New Issue
Block a user