Cleanup.
Add the "abort" attribute to the core functions. Undefined function s:CygwinPath() in autoload/syntastic/util.vim.
This commit is contained in:
parent
fc8f8e5006
commit
0e23cb0977
@ -10,14 +10,14 @@ set cpo&vim
|
||||
|
||||
" convenience function to determine the 'null device' parameter
|
||||
" based on the current operating system
|
||||
function! syntastic#c#NullOutput() " {{{2
|
||||
function! syntastic#c#NullOutput() abort " {{{2
|
||||
let known_os = has('unix') || has('mac') || syntastic#util#isRunningWindows()
|
||||
return known_os ? '-o ' . syntastic#util#DevNull() : ''
|
||||
endfunction " }}}2
|
||||
|
||||
" read additional compiler flags from the given configuration file
|
||||
" the file format and its parsing mechanism is inspired by clang_complete
|
||||
function! syntastic#c#ReadConfig(file) " {{{2
|
||||
function! syntastic#c#ReadConfig(file) abort " {{{2
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_CHECKERS, 'ReadConfig: looking for', a:file)
|
||||
|
||||
" search upwards from the current file's directory
|
||||
@ -69,7 +69,7 @@ function! syntastic#c#ReadConfig(file) " {{{2
|
||||
endfunction " }}}2
|
||||
|
||||
" GetLocList() for C-like compilers
|
||||
function! syntastic#c#GetLocList(filetype, subchecker, options) " {{{2
|
||||
function! syntastic#c#GetLocList(filetype, subchecker, options) abort " {{{2
|
||||
try
|
||||
let flags = s:_get_cflags(a:filetype, a:subchecker, a:options)
|
||||
catch /\m\C^Syntastic: skip checks$/
|
||||
@ -96,7 +96,7 @@ endfunction " }}}2
|
||||
" Private functions {{{1
|
||||
|
||||
" initialize c/cpp syntax checker handlers
|
||||
function! s:_init() " {{{2
|
||||
function! s:_init() abort " {{{2
|
||||
let s:handlers = []
|
||||
let s:cflags = {}
|
||||
|
||||
@ -118,7 +118,7 @@ function! s:_init() " {{{2
|
||||
endfunction " }}}2
|
||||
|
||||
" register a handler dictionary object
|
||||
function! s:_registerHandler(regex, function, args) " {{{2
|
||||
function! s:_registerHandler(regex, function, args) abort " {{{2
|
||||
let handler = {}
|
||||
let handler["regex"] = a:regex
|
||||
let handler["func"] = function(a:function)
|
||||
@ -129,7 +129,7 @@ endfunction " }}}2
|
||||
" try to find library with 'pkg-config'
|
||||
" search possible libraries from first to last given
|
||||
" argument until one is found
|
||||
function! s:_checkPackage(name, ...) " {{{2
|
||||
function! s:_checkPackage(name, ...) abort " {{{2
|
||||
if executable('pkg-config')
|
||||
if !has_key(s:cflags, a:name)
|
||||
for pkg in a:000
|
||||
@ -150,7 +150,7 @@ function! s:_checkPackage(name, ...) " {{{2
|
||||
endfunction " }}}2
|
||||
|
||||
" try to find PHP includes with 'php-config'
|
||||
function! s:_checkPhp() " {{{2
|
||||
function! s:_checkPhp() abort " {{{2
|
||||
if executable('php-config')
|
||||
if !has_key(s:cflags, 'php')
|
||||
let s:cflags['php'] = system('php-config --includes')
|
||||
@ -162,7 +162,7 @@ function! s:_checkPhp() " {{{2
|
||||
endfunction " }}}2
|
||||
|
||||
" try to find the python headers with distutils
|
||||
function! s:_checkPython() " {{{2
|
||||
function! s:_checkPython() abort " {{{2
|
||||
if executable('python')
|
||||
if !has_key(s:cflags, 'python')
|
||||
let s:cflags['python'] = system('python -c ''from distutils import ' .
|
||||
@ -176,7 +176,7 @@ function! s:_checkPython() " {{{2
|
||||
endfunction " }}}2
|
||||
|
||||
" try to find the ruby headers with 'rbconfig'
|
||||
function! s:_checkRuby() " {{{2
|
||||
function! s:_checkRuby() abort " {{{2
|
||||
if executable('ruby')
|
||||
if !has_key(s:cflags, 'ruby')
|
||||
let s:cflags['ruby'] = system('ruby -r rbconfig -e ' .
|
||||
@ -194,7 +194,7 @@ endfunction " }}}2
|
||||
" Utilities {{{1
|
||||
|
||||
" resolve checker-related user variables
|
||||
function! s:_get_checker_var(scope, filetype, subchecker, name, default) " {{{2
|
||||
function! s:_get_checker_var(scope, filetype, subchecker, name, default) abort " {{{2
|
||||
let prefix = a:scope . ':' . 'syntastic_'
|
||||
if exists(prefix . a:filetype . '_' . a:subchecker . '_' . a:name)
|
||||
return {a:scope}:syntastic_{a:filetype}_{a:subchecker}_{a:name}
|
||||
@ -206,7 +206,7 @@ function! s:_get_checker_var(scope, filetype, subchecker, name, default) " {{{2
|
||||
endfunction " }}}2
|
||||
|
||||
" resolve user CFLAGS
|
||||
function! s:_get_cflags(ft, ck, opts) " {{{2
|
||||
function! s:_get_cflags(ft, ck, opts) abort " {{{2
|
||||
" determine whether to parse header files as well
|
||||
if has_key(a:opts, 'header_names') && expand('%', 1) =~? a:opts['header_names']
|
||||
if s:_get_checker_var('g', a:ft, a:ck, 'check_header', 0)
|
||||
@ -253,7 +253,7 @@ endfunction " }}}2
|
||||
|
||||
" get the gcc include directory argument depending on the default
|
||||
" includes and the optional user-defined 'g:syntastic_c_include_dirs'
|
||||
function! s:_get_include_dirs(filetype) " {{{2
|
||||
function! s:_get_include_dirs(filetype) abort " {{{2
|
||||
let include_dirs = []
|
||||
|
||||
if a:filetype =~# '\v^%(c|cpp|objc|objcpp)$' &&
|
||||
@ -271,7 +271,7 @@ endfunction " }}}2
|
||||
|
||||
" search the first 100 lines for include statements that are
|
||||
" given in the handlers dictionary
|
||||
function! s:_search_headers() " {{{2
|
||||
function! s:_search_headers() abort " {{{2
|
||||
let includes = ''
|
||||
let files = []
|
||||
let found = []
|
||||
|
@ -10,24 +10,24 @@ let s:one_time_notices_issued = []
|
||||
|
||||
" Public functions {{{1
|
||||
|
||||
function! syntastic#log#info(msg) " {{{2
|
||||
function! syntastic#log#info(msg) abort " {{{2
|
||||
echomsg "syntastic: info: " . a:msg
|
||||
endfunction " }}}2
|
||||
|
||||
function! syntastic#log#warn(msg) " {{{2
|
||||
function! syntastic#log#warn(msg) abort " {{{2
|
||||
echohl WarningMsg
|
||||
echomsg "syntastic: warning: " . a:msg
|
||||
echohl None
|
||||
endfunction " }}}2
|
||||
|
||||
function! syntastic#log#error(msg) " {{{2
|
||||
function! syntastic#log#error(msg) abort " {{{2
|
||||
execute "normal \<Esc>"
|
||||
echohl ErrorMsg
|
||||
echomsg "syntastic: error: " . a:msg
|
||||
echohl None
|
||||
endfunction " }}}2
|
||||
|
||||
function! syntastic#log#oneTimeWarn(msg) " {{{2
|
||||
function! syntastic#log#oneTimeWarn(msg) abort " {{{2
|
||||
if index(s:one_time_notices_issued, a:msg) >= 0
|
||||
return
|
||||
endif
|
||||
@ -37,7 +37,7 @@ function! syntastic#log#oneTimeWarn(msg) " {{{2
|
||||
endfunction " }}}2
|
||||
|
||||
" @vimlint(EVL102, 1, l:OLD_VAR)
|
||||
function! syntastic#log#deprecationWarn(old, new, ...) " {{{2
|
||||
function! syntastic#log#deprecationWarn(old, new, ...) abort " {{{2
|
||||
if exists('g:syntastic_' . a:old) && !exists('g:syntastic_' . a:new)
|
||||
let msg = 'variable g:syntastic_' . a:old . ' is deprecated, please use '
|
||||
|
||||
@ -60,7 +60,7 @@ function! syntastic#log#deprecationWarn(old, new, ...) " {{{2
|
||||
endfunction " }}}2
|
||||
" @vimlint(EVL102, 0, l:OLD_VAR)
|
||||
|
||||
function! syntastic#log#debug(level, msg, ...) " {{{2
|
||||
function! syntastic#log#debug(level, msg, ...) abort " {{{2
|
||||
if !s:_isDebugEnabled(a:level)
|
||||
return
|
||||
endif
|
||||
@ -80,7 +80,7 @@ function! syntastic#log#debug(level, msg, ...) " {{{2
|
||||
call s:_logRedirect(0)
|
||||
endfunction " }}}2
|
||||
|
||||
function! syntastic#log#debugShowOptions(level, names) " {{{2
|
||||
function! syntastic#log#debugShowOptions(level, names) abort " {{{2
|
||||
if !s:_isDebugEnabled(a:level)
|
||||
return
|
||||
endif
|
||||
@ -96,7 +96,7 @@ function! syntastic#log#debugShowOptions(level, names) " {{{2
|
||||
call s:_logRedirect(0)
|
||||
endfunction " }}}2
|
||||
|
||||
function! syntastic#log#debugShowVariables(level, names) " {{{2
|
||||
function! syntastic#log#debugShowVariables(level, names) abort " {{{2
|
||||
if !s:_isDebugEnabled(a:level)
|
||||
return
|
||||
endif
|
||||
@ -115,7 +115,7 @@ function! syntastic#log#debugShowVariables(level, names) " {{{2
|
||||
call s:_logRedirect(0)
|
||||
endfunction " }}}2
|
||||
|
||||
function! syntastic#log#debugDump(level) " {{{2
|
||||
function! syntastic#log#debugDump(level) abort " {{{2
|
||||
if !s:_isDebugEnabled(a:level)
|
||||
return
|
||||
endif
|
||||
@ -127,11 +127,11 @@ endfunction " }}}2
|
||||
|
||||
" Private functions {{{1
|
||||
|
||||
function! s:_isDebugEnabled_smart(level) " {{{2
|
||||
function! s:_isDebugEnabled_smart(level) abort " {{{2
|
||||
return and(g:syntastic_debug, a:level)
|
||||
endfunction " }}}2
|
||||
|
||||
function! s:_isDebugEnabled_dumb(level) " {{{2
|
||||
function! s:_isDebugEnabled_dumb(level) abort " {{{2
|
||||
" poor man's bit test for bit N, assuming a:level == 2**N
|
||||
return (g:syntastic_debug / a:level) % 2
|
||||
endfunction " }}}2
|
||||
@ -139,7 +139,7 @@ endfunction " }}}2
|
||||
let s:_isDebugEnabled = function(exists('*and') ? 's:_isDebugEnabled_smart' : 's:_isDebugEnabled_dumb')
|
||||
lockvar s:_isDebugEnabled
|
||||
|
||||
function! s:_logRedirect(on) " {{{2
|
||||
function! s:_logRedirect(on) abort " {{{2
|
||||
if exists("g:syntastic_debug_file")
|
||||
if a:on
|
||||
try
|
||||
@ -158,11 +158,11 @@ endfunction " }}}2
|
||||
|
||||
" Utilities {{{1
|
||||
|
||||
function! s:_log_timestamp() " {{{2
|
||||
function! s:_log_timestamp() abort " {{{2
|
||||
return 'syntastic: ' . split(reltimestr(reltime(g:_SYNTASTIC_START)))[0] . ': '
|
||||
endfunction " }}}2
|
||||
|
||||
function! s:_format_variable(name) " {{{2
|
||||
function! s:_format_variable(name) abort " {{{2
|
||||
let vals = []
|
||||
if exists('g:syntastic_' . a:name)
|
||||
call add(vals, 'g:syntastic_' . a:name . ' = ' . strtrans(string(g:syntastic_{a:name})))
|
||||
|
@ -9,7 +9,7 @@ set cpo&vim
|
||||
" Public functions {{{1
|
||||
|
||||
" merge consecutive blanks
|
||||
function! syntastic#postprocess#compressWhitespace(errors) " {{{2
|
||||
function! syntastic#postprocess#compressWhitespace(errors) abort " {{{2
|
||||
for e in a:errors
|
||||
let e['text'] = substitute(e['text'], "\001", '', 'g')
|
||||
let e['text'] = substitute(e['text'], '\n', ' ', 'g')
|
||||
@ -22,7 +22,7 @@ function! syntastic#postprocess#compressWhitespace(errors) " {{{2
|
||||
endfunction " }}}2
|
||||
|
||||
" remove spurious CR under Cygwin
|
||||
function! syntastic#postprocess#cygwinRemoveCR(errors) " {{{2
|
||||
function! syntastic#postprocess#cygwinRemoveCR(errors) abort " {{{2
|
||||
if has('win32unix')
|
||||
for e in a:errors
|
||||
let e['text'] = substitute(e['text'], '\r', '', 'g')
|
||||
@ -33,7 +33,7 @@ function! syntastic#postprocess#cygwinRemoveCR(errors) " {{{2
|
||||
endfunction " }}}2
|
||||
|
||||
" decode XML entities
|
||||
function! syntastic#postprocess#decodeXMLEntities(errors) " {{{2
|
||||
function! syntastic#postprocess#decodeXMLEntities(errors) abort " {{{2
|
||||
for e in a:errors
|
||||
let e['text'] = syntastic#util#decodeXMLEntities(e['text'])
|
||||
endfor
|
||||
@ -42,13 +42,13 @@ function! syntastic#postprocess#decodeXMLEntities(errors) " {{{2
|
||||
endfunction " }}}2
|
||||
|
||||
" filter out errors referencing other files
|
||||
function! syntastic#postprocess#filterForeignErrors(errors) " {{{2
|
||||
function! syntastic#postprocess#filterForeignErrors(errors) abort " {{{2
|
||||
return filter(copy(a:errors), 'get(v:val, "bufnr") == ' . bufnr(''))
|
||||
endfunction " }}}2
|
||||
|
||||
" make sure line numbers are not past end of buffers
|
||||
" XXX: this loads all referenced buffers in memory
|
||||
function! syntastic#postprocess#guards(errors) " {{{2
|
||||
function! syntastic#postprocess#guards(errors) abort " {{{2
|
||||
let buffers = syntastic#util#unique(map(filter(copy(a:errors), 'v:val["valid"]'), 'str2nr(v:val["bufnr"])'))
|
||||
|
||||
let guards = {}
|
||||
|
@ -8,7 +8,7 @@ set cpo&vim
|
||||
|
||||
" Public functions {{{1
|
||||
|
||||
function! syntastic#preprocess#cabal(errors) " {{{2
|
||||
function! syntastic#preprocess#cabal(errors) abort " {{{2
|
||||
let out = []
|
||||
let star = 0
|
||||
for err in a:errors
|
||||
@ -28,7 +28,7 @@ function! syntastic#preprocess#cabal(errors) " {{{2
|
||||
return out
|
||||
endfunction " }}}2
|
||||
|
||||
function! syntastic#preprocess#checkstyle(errors) " {{{2
|
||||
function! syntastic#preprocess#checkstyle(errors) abort " {{{2
|
||||
let out = []
|
||||
let fname = expand('%', 1)
|
||||
for err in a:errors
|
||||
@ -55,14 +55,14 @@ function! syntastic#preprocess#checkstyle(errors) " {{{2
|
||||
return out
|
||||
endfunction " }}}2
|
||||
|
||||
function! syntastic#preprocess#cppcheck(errors) " {{{2
|
||||
function! syntastic#preprocess#cppcheck(errors) abort " {{{2
|
||||
return map(copy(a:errors), 'substitute(v:val, ''\v^\[[^]]+\]\zs( -\> \[[^]]+\])+\ze:'', "", "")')
|
||||
endfunction " }}}2
|
||||
|
||||
" @vimlint(EVL102, 1, l:true)
|
||||
" @vimlint(EVL102, 1, l:false)
|
||||
" @vimlint(EVL102, 1, l:null)
|
||||
function! syntastic#preprocess#flow(errors) " {{{2
|
||||
function! syntastic#preprocess#flow(errors) abort " {{{2
|
||||
" JSON artifacts
|
||||
let true = 1
|
||||
let false = 0
|
||||
@ -123,11 +123,11 @@ endfunction " }}}2
|
||||
" @vimlint(EVL102, 0, l:false)
|
||||
" @vimlint(EVL102, 0, l:null)
|
||||
|
||||
function! syntastic#preprocess#killEmpty(errors) " {{{2
|
||||
function! syntastic#preprocess#killEmpty(errors) abort " {{{2
|
||||
return filter(copy(a:errors), 'v:val != ""')
|
||||
endfunction " }}}2
|
||||
|
||||
function! syntastic#preprocess#perl(errors) " {{{2
|
||||
function! syntastic#preprocess#perl(errors) abort " {{{2
|
||||
let out = []
|
||||
|
||||
for e in a:errors
|
||||
@ -143,7 +143,7 @@ endfunction " }}}2
|
||||
" @vimlint(EVL102, 1, l:true)
|
||||
" @vimlint(EVL102, 1, l:false)
|
||||
" @vimlint(EVL102, 1, l:null)
|
||||
function! syntastic#preprocess#prospector(errors) " {{{2
|
||||
function! syntastic#preprocess#prospector(errors) abort " {{{2
|
||||
" JSON artifacts
|
||||
let true = 1
|
||||
let false = 0
|
||||
@ -198,7 +198,7 @@ endfunction " }}}2
|
||||
" @vimlint(EVL102, 0, l:false)
|
||||
" @vimlint(EVL102, 0, l:null)
|
||||
|
||||
function! syntastic#preprocess#rparse(errors) " {{{2
|
||||
function! syntastic#preprocess#rparse(errors) abort " {{{2
|
||||
let errlist = copy(a:errors)
|
||||
|
||||
" remove uninteresting lines and handle continuations
|
||||
@ -237,11 +237,11 @@ function! syntastic#preprocess#rparse(errors) " {{{2
|
||||
return out
|
||||
endfunction " }}}2
|
||||
|
||||
function! syntastic#preprocess#tslint(errors) " {{{2
|
||||
function! syntastic#preprocess#tslint(errors) abort " {{{2
|
||||
return map(copy(a:errors), 'substitute(v:val, ''\m^\(([^)]\+)\)\s\(.\+\)$'', ''\2 \1'', "")')
|
||||
endfunction " }}}2
|
||||
|
||||
function! syntastic#preprocess#validator(errors) " {{{2
|
||||
function! syntastic#preprocess#validator(errors) abort " {{{2
|
||||
let out = []
|
||||
for e in a:errors
|
||||
let parts = matchlist(e, '\v^"([^"]+)"(.+)')
|
||||
|
@ -8,11 +8,11 @@ set cpo&vim
|
||||
|
||||
" Public functions {{{1
|
||||
|
||||
function! syntastic#util#isRunningWindows() " {{{2
|
||||
function! syntastic#util#isRunningWindows() abort " {{{2
|
||||
return has('win16') || has('win32') || has('win64')
|
||||
endfunction " }}}2
|
||||
|
||||
function! syntastic#util#DevNull() " {{{2
|
||||
function! syntastic#util#DevNull() abort " {{{2
|
||||
if syntastic#util#isRunningWindows()
|
||||
return 'NUL'
|
||||
endif
|
||||
@ -24,8 +24,12 @@ function! syntastic#util#Slash() abort " {{{2
|
||||
return (!exists("+shellslash") || &shellslash) ? '/' : '\'
|
||||
endfunction " }}}2
|
||||
|
||||
function! syntastic#util#CygwinPath(path) abort " {{{2
|
||||
return substitute(system('cygpath -m ' . syntastic#util#shescape(a:path)), "\n", '', 'g')
|
||||
endfunction " }}}2
|
||||
|
||||
" Create a temporary directory
|
||||
function! syntastic#util#tmpdir() " {{{2
|
||||
function! syntastic#util#tmpdir() abort " {{{2
|
||||
let tempdir = ''
|
||||
|
||||
if (has('unix') || has('mac')) && executable('mktemp')
|
||||
@ -41,7 +45,7 @@ function! syntastic#util#tmpdir() " {{{2
|
||||
if has('win32') || has('win64')
|
||||
let tempdir = $TEMP . syntastic#util#Slash() . 'vim-syntastic-' . getpid()
|
||||
elseif has('win32unix')
|
||||
let tempdir = s:CygwinPath('/tmp/vim-syntastic-' . getpid())
|
||||
let tempdir = syntastic#util#CygwinPath('/tmp/vim-syntastic-' . getpid())
|
||||
elseif $TMPDIR != ''
|
||||
let tempdir = $TMPDIR . '/vim-syntastic-' . getpid()
|
||||
else
|
||||
@ -60,7 +64,7 @@ function! syntastic#util#tmpdir() " {{{2
|
||||
endfunction " }}}2
|
||||
|
||||
" Recursively remove a directory
|
||||
function! syntastic#util#rmrf(what) " {{{2
|
||||
function! syntastic#util#rmrf(what) abort " {{{2
|
||||
" try to make sure we don't delete directories we didn't create
|
||||
if a:what !~? 'vim-syntastic-'
|
||||
return
|
||||
@ -94,7 +98,7 @@ endfunction " }}}2
|
||||
"returns
|
||||
"
|
||||
"{'exe': '/usr/bin/perl', 'args': ['-f', '-bar']}
|
||||
function! syntastic#util#parseShebang() " {{{2
|
||||
function! syntastic#util#parseShebang() abort " {{{2
|
||||
for lnum in range(1, 5)
|
||||
let line = getline(lnum)
|
||||
if line =~ '^#!'
|
||||
@ -109,7 +113,7 @@ function! syntastic#util#parseShebang() " {{{2
|
||||
endfunction " }}}2
|
||||
|
||||
" Get the value of a variable. Allow local variables to override global ones.
|
||||
function! syntastic#util#var(name, ...) " {{{2
|
||||
function! syntastic#util#var(name, ...) abort " {{{2
|
||||
return
|
||||
\ exists('b:syntastic_' . a:name) ? b:syntastic_{a:name} :
|
||||
\ exists('g:syntastic_' . a:name) ? g:syntastic_{a:name} :
|
||||
@ -117,7 +121,7 @@ function! syntastic#util#var(name, ...) " {{{2
|
||||
endfunction " }}}2
|
||||
|
||||
" Parse a version string. Return an array of version components.
|
||||
function! syntastic#util#parseVersion(version) " {{{2
|
||||
function! syntastic#util#parseVersion(version) abort " {{{2
|
||||
return map(split(matchstr( a:version, '\v^\D*\zs\d+(\.\d+)+\ze' ), '\m\.'), 'str2nr(v:val)')
|
||||
endfunction " }}}2
|
||||
|
||||
@ -127,13 +131,13 @@ endfunction " }}}2
|
||||
" the "missing" elements will be assumed to be 0 for the purposes of checking.
|
||||
"
|
||||
" See http://semver.org for info about version numbers.
|
||||
function! syntastic#util#versionIsAtLeast(installed, required) " {{{2
|
||||
function! syntastic#util#versionIsAtLeast(installed, required) abort " {{{2
|
||||
return syntastic#util#compareLexi(a:installed, a:required) >= 0
|
||||
endfunction " }}}2
|
||||
|
||||
" Almost lexicographic comparison of two lists of integers. :) If lists
|
||||
" have different lengths, the "missing" elements are assumed to be 0.
|
||||
function! syntastic#util#compareLexi(a, b) " {{{2
|
||||
function! syntastic#util#compareLexi(a, b) abort " {{{2
|
||||
for idx in range(max([len(a:a), len(a:b)]))
|
||||
let a_element = str2nr(get(a:a, idx, 0))
|
||||
let b_element = str2nr(get(a:b, idx, 0))
|
||||
@ -150,7 +154,7 @@ endfunction " }}}2
|
||||
let s:_width = function(exists('*strwidth') ? 'strwidth' : 'strlen')
|
||||
lockvar s:_width
|
||||
|
||||
function! syntastic#util#screenWidth(str, tabstop) " {{{2
|
||||
function! syntastic#util#screenWidth(str, tabstop) abort " {{{2
|
||||
let chunks = split(a:str, "\t", 1)
|
||||
let width = s:_width(chunks[-1])
|
||||
for c in chunks[:-2]
|
||||
@ -161,7 +165,7 @@ function! syntastic#util#screenWidth(str, tabstop) " {{{2
|
||||
endfunction " }}}2
|
||||
|
||||
"print as much of a:msg as possible without "Press Enter" prompt appearing
|
||||
function! syntastic#util#wideMsg(msg) " {{{2
|
||||
function! syntastic#util#wideMsg(msg) abort " {{{2
|
||||
let old_ruler = &ruler
|
||||
let old_showcmd = &showcmd
|
||||
|
||||
@ -185,7 +189,7 @@ function! syntastic#util#wideMsg(msg) " {{{2
|
||||
endfunction " }}}2
|
||||
|
||||
" Check whether a buffer is loaded, listed, and not hidden
|
||||
function! syntastic#util#bufIsActive(buffer) " {{{2
|
||||
function! syntastic#util#bufIsActive(buffer) abort " {{{2
|
||||
" convert to number, or hell breaks loose
|
||||
let buf = str2nr(a:buffer)
|
||||
|
||||
@ -205,7 +209,7 @@ endfunction " }}}2
|
||||
|
||||
" start in directory a:where and walk up the parent folders until it
|
||||
" finds a file matching a:what; return path to that file
|
||||
function! syntastic#util#findInParent(what, where) " {{{2
|
||||
function! syntastic#util#findInParent(what, where) abort " {{{2
|
||||
let here = fnamemodify(a:where, ':p')
|
||||
|
||||
let root = syntastic#util#Slash()
|
||||
@ -237,7 +241,7 @@ function! syntastic#util#findInParent(what, where) " {{{2
|
||||
endfunction " }}}2
|
||||
|
||||
" Returns unique elements in a list
|
||||
function! syntastic#util#unique(list) " {{{2
|
||||
function! syntastic#util#unique(list) abort " {{{2
|
||||
let seen = {}
|
||||
let uniques = []
|
||||
for e in a:list
|
||||
@ -250,17 +254,17 @@ function! syntastic#util#unique(list) " {{{2
|
||||
endfunction " }}}2
|
||||
|
||||
" A less noisy shellescape()
|
||||
function! syntastic#util#shescape(string) " {{{2
|
||||
function! syntastic#util#shescape(string) abort " {{{2
|
||||
return a:string =~ '\m^[A-Za-z0-9_/.-]\+$' ? a:string : shellescape(a:string)
|
||||
endfunction " }}}2
|
||||
|
||||
" A less noisy shellescape(expand())
|
||||
function! syntastic#util#shexpand(string, ...) " {{{2
|
||||
function! syntastic#util#shexpand(string, ...) abort " {{{2
|
||||
return syntastic#util#shescape(a:0 ? expand(a:string, a:1) : expand(a:string, 1))
|
||||
endfunction " }}}2
|
||||
|
||||
" Escape arguments
|
||||
function! syntastic#util#argsescape(opt) " {{{2
|
||||
function! syntastic#util#argsescape(opt) abort " {{{2
|
||||
if type(a:opt) == type('') && a:opt != ''
|
||||
return [a:opt]
|
||||
elseif type(a:opt) == type([])
|
||||
@ -271,7 +275,7 @@ function! syntastic#util#argsescape(opt) " {{{2
|
||||
endfunction " }}}2
|
||||
|
||||
" decode XML entities
|
||||
function! syntastic#util#decodeXMLEntities(string) " {{{2
|
||||
function! syntastic#util#decodeXMLEntities(string) abort " {{{2
|
||||
let str = a:string
|
||||
let str = substitute(str, '\m<', '<', 'g')
|
||||
let str = substitute(str, '\m>', '>', 'g')
|
||||
@ -281,7 +285,7 @@ function! syntastic#util#decodeXMLEntities(string) " {{{2
|
||||
return str
|
||||
endfunction " }}}2
|
||||
|
||||
function! syntastic#util#redraw(full) " {{{2
|
||||
function! syntastic#util#redraw(full) abort " {{{2
|
||||
if a:full
|
||||
redraw!
|
||||
else
|
||||
@ -289,7 +293,7 @@ function! syntastic#util#redraw(full) " {{{2
|
||||
endif
|
||||
endfunction " }}}2
|
||||
|
||||
function! syntastic#util#dictFilter(errors, filter) " {{{2
|
||||
function! syntastic#util#dictFilter(errors, filter) abort " {{{2
|
||||
let rules = s:_translateFilter(a:filter)
|
||||
" call syntastic#log#debug(g:_SYNTASTIC_DEBUG_TRACE, "applying filter:", rules)
|
||||
try
|
||||
@ -303,7 +307,7 @@ endfunction " }}}2
|
||||
" Return a [high, low] list of integers, representing the time
|
||||
" (hopefully high resolution) since program start
|
||||
" TODO: This assumes reltime() returns a list of integers.
|
||||
function! syntastic#util#stamp() " {{{2
|
||||
function! syntastic#util#stamp() abort " {{{2
|
||||
return reltime(g:_SYNTASTIC_START)
|
||||
endfunction " }}}2
|
||||
|
||||
@ -311,7 +315,7 @@ endfunction " }}}2
|
||||
|
||||
" Private functions {{{1
|
||||
|
||||
function! s:_translateFilter(filters) " {{{2
|
||||
function! s:_translateFilter(filters) abort " {{{2
|
||||
let conditions = []
|
||||
for k in keys(a:filters)
|
||||
if type(a:filters[k]) == type([])
|
||||
@ -327,7 +331,7 @@ function! s:_translateFilter(filters) " {{{2
|
||||
return len(conditions) == 1 ? conditions[0] : join(map(conditions, '"(" . v:val . ")"'), ' && ')
|
||||
endfunction " }}}2
|
||||
|
||||
function! s:_translateElement(key, term) " {{{2
|
||||
function! s:_translateElement(key, term) abort " {{{2
|
||||
let fkey = a:key
|
||||
if fkey[0] == '!'
|
||||
let fkey = fkey[1:]
|
||||
@ -365,7 +369,7 @@ function! s:_translateElement(key, term) " {{{2
|
||||
return ret
|
||||
endfunction " }}}2
|
||||
|
||||
function! s:_rmrf(what) " {{{2
|
||||
function! s:_rmrf(what) abort " {{{2
|
||||
if !exists('s:rmdir')
|
||||
let s:rmdir = syntastic#util#shescape(get(g:, 'netrw_localrmdir', 'rmdir'))
|
||||
endif
|
||||
|
@ -19,7 +19,7 @@ if has('reltime')
|
||||
lockvar! g:_SYNTASTIC_START
|
||||
endif
|
||||
|
||||
let g:_SYNTASTIC_VERSION = '3.6.0-41'
|
||||
let g:_SYNTASTIC_VERSION = '3.6.0-42'
|
||||
lockvar g:_SYNTASTIC_VERSION
|
||||
|
||||
" Sanity checks {{{1
|
||||
@ -158,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))
|
||||
@ -173,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)
|
||||
@ -191,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
|
||||
|
||||
@ -239,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("")))))
|
||||
@ -247,13 +247,13 @@ 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))
|
||||
@ -272,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')
|
||||
@ -286,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)
|
||||
@ -342,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()
|
||||
@ -459,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
|
||||
@ -589,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
|
||||
|
||||
@ -597,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
|
||||
@ -613,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) ||
|
||||
@ -625,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)
|
||||
@ -654,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])
|
||||
@ -669,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 =
|
||||
@ -684,7 +684,7 @@ function! s:_bash_hack() " {{{2
|
||||
endif
|
||||
endfunction " }}}2
|
||||
|
||||
function! s:_os_name() " {{{2
|
||||
function! s:_os_name() abort " {{{2
|
||||
return g:_SYNTASTIC_UNAME
|
||||
endfunction " }}}2
|
||||
|
||||
|
@ -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,11 +40,11 @@ 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
|
||||
|
||||
@ -68,15 +68,15 @@ function! g:SyntasticChecker.syncExec() dict " {{{2
|
||||
endif
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticChecker.getExec() " {{{2
|
||||
function! g:SyntasticChecker.getExec() abort " {{{2
|
||||
return self._exec
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticChecker.getExecEscaped() " {{{2
|
||||
function! g:SyntasticChecker.getExecEscaped() abort " {{{2
|
||||
return syntastic#util#shescape(self._exec)
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticChecker.getLocListRaw() " {{{2
|
||||
function! g:SyntasticChecker.getLocListRaw() abort " {{{2
|
||||
let name = self._filetype . '/' . self._name
|
||||
try
|
||||
let list = self._locListFunc()
|
||||
@ -91,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)
|
||||
@ -107,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)
|
||||
@ -116,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)
|
||||
@ -125,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 = []
|
||||
@ -138,7 +138,7 @@ 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()
|
||||
@ -146,13 +146,13 @@ function! g:SyntasticChecker.isAvailable() " {{{2
|
||||
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
|
||||
@ -162,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({})
|
||||
@ -187,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']
|
||||
@ -200,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,11 +67,11 @@ 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
|
||||
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', '')
|
||||
|
@ -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
|
||||
|
@ -146,7 +146,7 @@ function! SyntaxCheckers_java_javac_GetLocList() dict " {{{1
|
||||
let fname = expand('%:p:h', 1) . syntastic#util#Slash() . expand ('%:t', 1)
|
||||
|
||||
if has('win32unix')
|
||||
let fname = s:CygwinPath(fname)
|
||||
let fname = syntastic#util#CygwinPath(fname)
|
||||
endif
|
||||
|
||||
let makeprg = self.makeprgBuild({
|
||||
@ -179,10 +179,6 @@ endfunction " }}}1
|
||||
|
||||
" Utilities {{{1
|
||||
|
||||
function! s:CygwinPath(path) " {{{2
|
||||
return substitute(system('cygpath -m ' . syntastic#util#shescape(a:path)), "\n", '', 'g')
|
||||
endfunction " }}}2
|
||||
|
||||
function! s:RemoveCarriageReturn(line) " {{{2
|
||||
return substitute(a:line, "\r", '', 'g')
|
||||
endfunction " }}}2
|
||||
@ -405,7 +401,7 @@ function! s:MavenOutputDirectory() " {{{2
|
||||
endif
|
||||
|
||||
if has('win32unix')
|
||||
let output_dir = s:CygwinPath(output_dir)
|
||||
let output_dir = syntastic#util#CygwinPath(output_dir)
|
||||
endif
|
||||
return output_dir
|
||||
endif
|
||||
|
Loading…
Reference in New Issue
Block a user