mirror of
https://github.com/preservim/tagbar.git
synced 2024-11-23 10:41:49 +08:00
Add 'abort' keyword to all functions
This commit is contained in:
parent
6a7f155874
commit
49d39cae6c
|
@ -65,7 +65,7 @@ let s:debug = 0
|
|||
let s:debug_file = ''
|
||||
|
||||
" s:Init() {{{2
|
||||
function! s:Init(silent)
|
||||
function! s:Init(silent) abort
|
||||
if s:checked_ctags == 2 && a:silent
|
||||
return 0
|
||||
elseif s:checked_ctags != 1
|
||||
|
@ -91,7 +91,7 @@ function! s:Init(silent)
|
|||
endfunction
|
||||
|
||||
" s:InitTypes() {{{2
|
||||
function! s:InitTypes()
|
||||
function! s:InitTypes() abort
|
||||
call s:LogDebugMessage('Initializing types')
|
||||
|
||||
let s:known_types = {}
|
||||
|
@ -788,7 +788,7 @@ function! s:InitTypes()
|
|||
endfunction
|
||||
|
||||
" s:LoadUserTypeDefs() {{{2
|
||||
function! s:LoadUserTypeDefs(...)
|
||||
function! s:LoadUserTypeDefs(...) abort
|
||||
if a:0 > 0
|
||||
let type = a:1
|
||||
|
||||
|
@ -855,7 +855,7 @@ function! s:LoadUserTypeDefs(...)
|
|||
endfunction
|
||||
|
||||
" s:CreateTypeKinddict() {{{2
|
||||
function! s:CreateTypeKinddict(type)
|
||||
function! s:CreateTypeKinddict(type) abort
|
||||
" Create a dictionary of the kind order for fast access in sorting
|
||||
" functions
|
||||
let i = 0
|
||||
|
@ -867,7 +867,7 @@ endfunction
|
|||
|
||||
" s:RestoreSession() {{{2
|
||||
" Properly restore Tagbar after a session got loaded
|
||||
function! s:RestoreSession()
|
||||
function! s:RestoreSession() abort
|
||||
call s:LogDebugMessage('Restoring session')
|
||||
|
||||
let curfile = fnamemodify(bufname('%'), ':p')
|
||||
|
@ -898,7 +898,7 @@ function! s:RestoreSession()
|
|||
endfunction
|
||||
|
||||
" s:MapKeys() {{{2
|
||||
function! s:MapKeys()
|
||||
function! s:MapKeys() abort
|
||||
call s:LogDebugMessage('Mapping keys')
|
||||
|
||||
nnoremap <script> <silent> <buffer> <2-LeftMouse>
|
||||
|
@ -943,7 +943,7 @@ function! s:MapKeys()
|
|||
endfunction
|
||||
|
||||
" s:CreateAutocommands() {{{2
|
||||
function! s:CreateAutocommands()
|
||||
function! s:CreateAutocommands() abort
|
||||
call s:LogDebugMessage('Creating autocommands')
|
||||
|
||||
augroup TagbarAutoCmds
|
||||
|
@ -969,7 +969,7 @@ endfunction
|
|||
" s:CheckForExCtags() {{{2
|
||||
" Test whether the ctags binary is actually Exuberant Ctags and not GNU ctags
|
||||
" (or something else)
|
||||
function! s:CheckForExCtags(silent)
|
||||
function! s:CheckForExCtags(silent) abort
|
||||
call s:LogDebugMessage('Checking for Exuberant Ctags')
|
||||
|
||||
if !exists('g:tagbar_ctags_bin')
|
||||
|
@ -1066,7 +1066,7 @@ function! s:CheckForExCtags(silent)
|
|||
endfunction
|
||||
|
||||
" s:CheckExCtagsVersion() {{{2
|
||||
function! s:CheckExCtagsVersion(output)
|
||||
function! s:CheckExCtagsVersion(output) abort
|
||||
call s:LogDebugMessage('Checking Exuberant Ctags version')
|
||||
|
||||
if a:output =~ 'Exuberant Ctags Development'
|
||||
|
@ -1081,7 +1081,7 @@ function! s:CheckExCtagsVersion(output)
|
|||
endfunction
|
||||
|
||||
" s:CheckFTCtags() {{{2
|
||||
function! s:CheckFTCtags(bin, ftype)
|
||||
function! s:CheckFTCtags(bin, ftype) abort
|
||||
if executable(a:bin)
|
||||
return a:bin
|
||||
endif
|
||||
|
@ -1099,7 +1099,7 @@ function! s:CheckFTCtags(bin, ftype)
|
|||
endfunction
|
||||
|
||||
" s:GetSupportedFiletypes() {{{2
|
||||
function! s:GetSupportedFiletypes()
|
||||
function! s:GetSupportedFiletypes() abort
|
||||
call s:LogDebugMessage('Getting filetypes sypported by Exuberant Ctags')
|
||||
|
||||
let ctags_cmd = s:EscapeCtagsCmd(g:tagbar_ctags_bin, '--list-languages')
|
||||
|
@ -1129,7 +1129,7 @@ endfunction
|
|||
let s:BaseTag = {}
|
||||
|
||||
" s:BaseTag.New() {{{3
|
||||
function! s:BaseTag.New(name) dict
|
||||
function! s:BaseTag.New(name) abort dict
|
||||
let newobj = copy(self)
|
||||
|
||||
call newobj._init(a:name)
|
||||
|
@ -1138,7 +1138,7 @@ function! s:BaseTag.New(name) dict
|
|||
endfunction
|
||||
|
||||
" s:BaseTag._init() {{{3
|
||||
function! s:BaseTag._init(name) dict
|
||||
function! s:BaseTag._init(name) abort dict
|
||||
let self.name = a:name
|
||||
let self.fields = {}
|
||||
let self.fields.line = 0
|
||||
|
@ -1153,27 +1153,27 @@ function! s:BaseTag._init(name) dict
|
|||
endfunction
|
||||
|
||||
" s:BaseTag.isNormalTag() {{{3
|
||||
function! s:BaseTag.isNormalTag() dict
|
||||
function! s:BaseTag.isNormalTag() abort dict
|
||||
return 0
|
||||
endfunction
|
||||
|
||||
" s:BaseTag.isPseudoTag() {{{3
|
||||
function! s:BaseTag.isPseudoTag() dict
|
||||
function! s:BaseTag.isPseudoTag() abort dict
|
||||
return 0
|
||||
endfunction
|
||||
|
||||
" s:BaseTag.isKindheader() {{{3
|
||||
function! s:BaseTag.isKindheader() dict
|
||||
function! s:BaseTag.isKindheader() abort dict
|
||||
return 0
|
||||
endfunction
|
||||
|
||||
" s:BaseTag.getPrototype() {{{3
|
||||
function! s:BaseTag.getPrototype() dict
|
||||
function! s:BaseTag.getPrototype() abort dict
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
" s:BaseTag._getPrefix() {{{3
|
||||
function! s:BaseTag._getPrefix() dict
|
||||
function! s:BaseTag._getPrefix() abort dict
|
||||
let fileinfo = self.fileinfo
|
||||
|
||||
if has_key(self, 'children') && !empty(self.children)
|
||||
|
@ -1195,7 +1195,7 @@ function! s:BaseTag._getPrefix() dict
|
|||
endfunction
|
||||
|
||||
" s:BaseTag.initFoldState() {{{3
|
||||
function! s:BaseTag.initFoldState() dict
|
||||
function! s:BaseTag.initFoldState() abort dict
|
||||
let fileinfo = self.fileinfo
|
||||
|
||||
if s:known_files.has(fileinfo.fpath) &&
|
||||
|
@ -1213,7 +1213,7 @@ function! s:BaseTag.initFoldState() dict
|
|||
endfunction
|
||||
|
||||
" s:BaseTag.getClosedParentTline() {{{3
|
||||
function! s:BaseTag.getClosedParentTline() dict
|
||||
function! s:BaseTag.getClosedParentTline() abort dict
|
||||
let tagline = self.tline
|
||||
let fileinfo = self.fileinfo
|
||||
|
||||
|
@ -1235,24 +1235,24 @@ function! s:BaseTag.getClosedParentTline() dict
|
|||
endfunction
|
||||
|
||||
" s:BaseTag.isFoldable() {{{3
|
||||
function! s:BaseTag.isFoldable() dict
|
||||
function! s:BaseTag.isFoldable() abort dict
|
||||
return has_key(self, 'children') && !empty(self.children)
|
||||
endfunction
|
||||
|
||||
" s:BaseTag.isFolded() {{{3
|
||||
function! s:BaseTag.isFolded() dict
|
||||
function! s:BaseTag.isFolded() abort dict
|
||||
return self.fileinfo.tagfolds[self.fields.kind][self.fullpath]
|
||||
endfunction
|
||||
|
||||
" s:BaseTag.openFold() {{{3
|
||||
function! s:BaseTag.openFold() dict
|
||||
function! s:BaseTag.openFold() abort dict
|
||||
if self.isFoldable()
|
||||
let self.fileinfo.tagfolds[self.fields.kind][self.fullpath] = 0
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" s:BaseTag.closeFold() {{{3
|
||||
function! s:BaseTag.closeFold() dict
|
||||
function! s:BaseTag.closeFold() abort dict
|
||||
let newline = line('.')
|
||||
|
||||
if !empty(self.parent) && self.parent.isKindheader()
|
||||
|
@ -1274,12 +1274,12 @@ function! s:BaseTag.closeFold() dict
|
|||
endfunction
|
||||
|
||||
" s:BaseTag.setFolded() {{{3
|
||||
function! s:BaseTag.setFolded(folded) dict
|
||||
function! s:BaseTag.setFolded(folded) abort dict
|
||||
let self.fileinfo.tagfolds[self.fields.kind][self.fullpath] = a:folded
|
||||
endfunction
|
||||
|
||||
" s:BaseTag.openParents() {{{3
|
||||
function! s:BaseTag.openParents() dict
|
||||
function! s:BaseTag.openParents() abort dict
|
||||
let parent = self.parent
|
||||
|
||||
while !empty(parent)
|
||||
|
@ -1292,12 +1292,12 @@ endfunction
|
|||
let s:NormalTag = copy(s:BaseTag)
|
||||
|
||||
" s:NormalTag.isNormalTag() {{{3
|
||||
function! s:NormalTag.isNormalTag() dict
|
||||
function! s:NormalTag.isNormalTag() abort dict
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
" s:NormalTag.strfmt() {{{3
|
||||
function! s:NormalTag.strfmt() dict
|
||||
function! s:NormalTag.strfmt() abort dict
|
||||
let fileinfo = self.fileinfo
|
||||
let typeinfo = self.typeinfo
|
||||
|
||||
|
@ -1313,7 +1313,7 @@ function! s:NormalTag.strfmt() dict
|
|||
endfunction
|
||||
|
||||
" s:NormalTag.str() {{{3
|
||||
function! s:NormalTag.str(longsig, full) dict
|
||||
function! s:NormalTag.str(longsig, full) abort dict
|
||||
if a:full && self.path != ''
|
||||
let str = self.path . self.typeinfo.sro . self.name
|
||||
else
|
||||
|
@ -1332,7 +1332,7 @@ function! s:NormalTag.str(longsig, full) dict
|
|||
endfunction
|
||||
|
||||
" s:NormalTag.getPrototype() {{{3
|
||||
function! s:NormalTag.getPrototype() dict
|
||||
function! s:NormalTag.getPrototype() abort dict
|
||||
return self.prototype
|
||||
endfunction
|
||||
|
||||
|
@ -1340,12 +1340,12 @@ endfunction
|
|||
let s:PseudoTag = copy(s:BaseTag)
|
||||
|
||||
" s:PseudoTag.isPseudoTag() {{{3
|
||||
function! s:PseudoTag.isPseudoTag() dict
|
||||
function! s:PseudoTag.isPseudoTag() abort dict
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
" s:PseudoTag.strfmt() {{{3
|
||||
function! s:PseudoTag.strfmt() dict
|
||||
function! s:PseudoTag.strfmt() abort dict
|
||||
let fileinfo = self.fileinfo
|
||||
let typeinfo = self.typeinfo
|
||||
|
||||
|
@ -1361,39 +1361,39 @@ endfunction
|
|||
let s:KindheaderTag = copy(s:BaseTag)
|
||||
|
||||
" s:KindheaderTag.isKindheader() {{{3
|
||||
function! s:KindheaderTag.isKindheader() dict
|
||||
function! s:KindheaderTag.isKindheader() abort dict
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
" s:KindheaderTag.getPrototype() {{{3
|
||||
function! s:KindheaderTag.getPrototype() dict
|
||||
function! s:KindheaderTag.getPrototype() abort dict
|
||||
return self.name . ': ' .
|
||||
\ self.numtags . ' ' . (self.numtags > 1 ? 'tags' : 'tag')
|
||||
endfunction
|
||||
|
||||
" s:KindheaderTag.isFoldable() {{{3
|
||||
function! s:KindheaderTag.isFoldable() dict
|
||||
function! s:KindheaderTag.isFoldable() abort dict
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
" s:KindheaderTag.isFolded() {{{3
|
||||
function! s:KindheaderTag.isFolded() dict
|
||||
function! s:KindheaderTag.isFolded() abort dict
|
||||
return self.fileinfo.kindfolds[self.short]
|
||||
endfunction
|
||||
|
||||
" s:KindheaderTag.openFold() {{{3
|
||||
function! s:KindheaderTag.openFold() dict
|
||||
function! s:KindheaderTag.openFold() abort dict
|
||||
let self.fileinfo.kindfolds[self.short] = 0
|
||||
endfunction
|
||||
|
||||
" s:KindheaderTag.closeFold() {{{3
|
||||
function! s:KindheaderTag.closeFold() dict
|
||||
function! s:KindheaderTag.closeFold() abort dict
|
||||
let self.fileinfo.kindfolds[self.short] = 1
|
||||
return line('.')
|
||||
endfunction
|
||||
|
||||
" s:KindheaderTag.toggleFold() {{{3
|
||||
function! s:KindheaderTag.toggleFold() dict
|
||||
function! s:KindheaderTag.toggleFold() abort dict
|
||||
let fileinfo = s:known_files.getCurrent()
|
||||
|
||||
let fileinfo.kindfolds[self.short] = !fileinfo.kindfolds[self.short]
|
||||
|
@ -1403,7 +1403,7 @@ endfunction
|
|||
let s:TypeInfo = {}
|
||||
|
||||
" s:TypeInfo.New() {{{3
|
||||
function! s:TypeInfo.New(...) dict
|
||||
function! s:TypeInfo.New(...) abort dict
|
||||
let newobj = copy(self)
|
||||
|
||||
let newobj.kinddict = {}
|
||||
|
@ -1416,7 +1416,7 @@ function! s:TypeInfo.New(...) dict
|
|||
endfunction
|
||||
|
||||
" s:TypeInfo.getKind() {{{3
|
||||
function! s:TypeInfo.getKind(kind) dict
|
||||
function! s:TypeInfo.getKind(kind) abort dict
|
||||
let idx = self.kinddict[a:kind]
|
||||
return self.kinds[idx]
|
||||
endfunction
|
||||
|
@ -1425,7 +1425,7 @@ endfunction
|
|||
let s:FileInfo = {}
|
||||
|
||||
" s:FileInfo.New() {{{3
|
||||
function! s:FileInfo.New(fname, ftype) dict
|
||||
function! s:FileInfo.New(fname, ftype) abort dict
|
||||
let newobj = copy(self)
|
||||
|
||||
" The complete file path
|
||||
|
@ -1473,7 +1473,7 @@ endfunction
|
|||
" s:FileInfo.reset() {{{3
|
||||
" Reset stuff that gets regenerated while processing a file and save the old
|
||||
" tag folds
|
||||
function! s:FileInfo.reset() dict
|
||||
function! s:FileInfo.reset() abort dict
|
||||
let self.mtime = getftime(self.fpath)
|
||||
let self.tags = []
|
||||
let self.fline = {}
|
||||
|
@ -1489,14 +1489,14 @@ function! s:FileInfo.reset() dict
|
|||
endfunction
|
||||
|
||||
" s:FileInfo.clearOldFolds() {{{3
|
||||
function! s:FileInfo.clearOldFolds() dict
|
||||
function! s:FileInfo.clearOldFolds() abort dict
|
||||
if exists('self._tagfolds_old')
|
||||
unlet self._tagfolds_old
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" s:FileInfo.sortTags() {{{3
|
||||
function! s:FileInfo.sortTags() dict
|
||||
function! s:FileInfo.sortTags() abort dict
|
||||
if has_key(s:compare_typeinfo, 'sort')
|
||||
if s:compare_typeinfo.sort
|
||||
call s:SortTags(self.tags, 's:CompareByKind')
|
||||
|
@ -1511,12 +1511,12 @@ function! s:FileInfo.sortTags() dict
|
|||
endfunction
|
||||
|
||||
" s:FileInfo.openKindFold() {{{3
|
||||
function! s:FileInfo.openKindFold(kind) dict
|
||||
function! s:FileInfo.openKindFold(kind) abort dict
|
||||
let self.kindfolds[a:kind.short] = 0
|
||||
endfunction
|
||||
|
||||
" s:FileInfo.closeKindFold() {{{3
|
||||
function! s:FileInfo.closeKindFold(kind) dict
|
||||
function! s:FileInfo.closeKindFold(kind) abort dict
|
||||
let self.kindfolds[a:kind.short] = 1
|
||||
endfunction
|
||||
|
||||
|
@ -1527,23 +1527,23 @@ let s:known_files = {
|
|||
\ }
|
||||
|
||||
" s:known_files.getCurrent() {{{3
|
||||
function! s:known_files.getCurrent() dict
|
||||
function! s:known_files.getCurrent() abort dict
|
||||
return self._current
|
||||
endfunction
|
||||
|
||||
" s:known_files.setCurrent() {{{3
|
||||
function! s:known_files.setCurrent(fileinfo) dict
|
||||
function! s:known_files.setCurrent(fileinfo) abort dict
|
||||
let self._current = a:fileinfo
|
||||
endfunction
|
||||
|
||||
" s:known_files.get() {{{3
|
||||
function! s:known_files.get(fname) dict
|
||||
function! s:known_files.get(fname) abort dict
|
||||
return get(self._files, a:fname, {})
|
||||
endfunction
|
||||
|
||||
" s:known_files.put() {{{3
|
||||
" Optional second argument is the filename
|
||||
function! s:known_files.put(fileinfo, ...) dict
|
||||
function! s:known_files.put(fileinfo, ...) abort dict
|
||||
if a:0 == 1
|
||||
let self._files[a:1] = a:fileinfo
|
||||
else
|
||||
|
@ -1553,12 +1553,12 @@ function! s:known_files.put(fileinfo, ...) dict
|
|||
endfunction
|
||||
|
||||
" s:known_files.has() {{{3
|
||||
function! s:known_files.has(fname) dict
|
||||
function! s:known_files.has(fname) abort dict
|
||||
return has_key(self._files, a:fname)
|
||||
endfunction
|
||||
|
||||
" s:known_files.rm() {{{3
|
||||
function! s:known_files.rm(fname) dict
|
||||
function! s:known_files.rm(fname) abort dict
|
||||
if s:known_files.has(a:fname)
|
||||
call remove(self._files, a:fname)
|
||||
endif
|
||||
|
@ -1566,7 +1566,7 @@ endfunction
|
|||
|
||||
" Window management {{{1
|
||||
" s:ToggleWindow() {{{2
|
||||
function! s:ToggleWindow()
|
||||
function! s:ToggleWindow() abort
|
||||
call s:LogDebugMessage('ToggleWindow called')
|
||||
|
||||
let tagbarwinnr = bufwinnr("__Tagbar__")
|
||||
|
@ -1581,7 +1581,7 @@ function! s:ToggleWindow()
|
|||
endfunction
|
||||
|
||||
" s:OpenWindow() {{{2
|
||||
function! s:OpenWindow(flags)
|
||||
function! s:OpenWindow(flags) abort
|
||||
call s:LogDebugMessage("OpenWindow called with flags: '" . a:flags . "'")
|
||||
|
||||
let autofocus = a:flags =~# 'f'
|
||||
|
@ -1640,7 +1640,7 @@ function! s:OpenWindow(flags)
|
|||
endfunction
|
||||
|
||||
" s:InitWindow() {{{2
|
||||
function! s:InitWindow(autoclose)
|
||||
function! s:InitWindow(autoclose) abort
|
||||
call s:LogDebugMessage('InitWindow called with autoclose: ' . a:autoclose)
|
||||
|
||||
setlocal filetype=tagbar
|
||||
|
@ -1707,7 +1707,7 @@ function! s:InitWindow(autoclose)
|
|||
endfunction
|
||||
|
||||
" s:CloseWindow() {{{2
|
||||
function! s:CloseWindow()
|
||||
function! s:CloseWindow() abort
|
||||
call s:LogDebugMessage('CloseWindow called')
|
||||
|
||||
let tagbarwinnr = bufwinnr('__Tagbar__')
|
||||
|
@ -1771,7 +1771,7 @@ function! s:CloseWindow()
|
|||
endfunction
|
||||
|
||||
" s:ZoomWindow() {{{2
|
||||
function! s:ZoomWindow()
|
||||
function! s:ZoomWindow() abort
|
||||
if s:is_maximized
|
||||
execute 'vert resize ' . g:tagbar_width
|
||||
let s:is_maximized = 0
|
||||
|
@ -1786,7 +1786,7 @@ endfunction
|
|||
" tagbar#autoopen is used with a FileType autocommand on startup and
|
||||
" g:tagbar_left is set. This should work around it by jumping to the window of
|
||||
" the current file after startup.
|
||||
function! s:CorrectFocusOnStartup()
|
||||
function! s:CorrectFocusOnStartup() abort
|
||||
if bufwinnr('__Tagbar__') != -1 && !g:tagbar_autofocus && !s:last_autofocus
|
||||
let curfile = s:known_files.getCurrent()
|
||||
if !empty(curfile) && curfile.fpath != fnamemodify(bufname('%'), ':p')
|
||||
|
@ -1801,7 +1801,7 @@ endfunction
|
|||
" Tag processing {{{1
|
||||
" s:ProcessFile() {{{2
|
||||
" Execute ctags and put the information into a 'FileInfo' object
|
||||
function! s:ProcessFile(fname, ftype)
|
||||
function! s:ProcessFile(fname, ftype) abort
|
||||
call s:LogDebugMessage('ProcessFile called on ' . a:fname)
|
||||
|
||||
if !s:IsValidFile(a:fname, a:ftype)
|
||||
|
@ -1912,7 +1912,7 @@ function! s:ProcessFile(fname, ftype)
|
|||
endfunction
|
||||
|
||||
" s:ExecuteCtagsOnFile() {{{2
|
||||
function! s:ExecuteCtagsOnFile(fname, ftype)
|
||||
function! s:ExecuteCtagsOnFile(fname, ftype) abort
|
||||
call s:LogDebugMessage('ExecuteCtagsOnFile called on ' . a:fname)
|
||||
|
||||
let typeinfo = s:known_types[a:ftype]
|
||||
|
@ -1983,7 +1983,7 @@ endfunction
|
|||
" tagname<TAB>filename<TAB>expattern;"fields
|
||||
" fields: <TAB>name:value
|
||||
" fields that are always present: kind, line
|
||||
function! s:ParseTagline(part1, part2, typeinfo, fileinfo)
|
||||
function! s:ParseTagline(part1, part2, typeinfo, fileinfo) abort
|
||||
let basic_info = split(a:part1, '\t')
|
||||
|
||||
let taginfo = s:NormalTag.New(basic_info[0])
|
||||
|
@ -2062,7 +2062,7 @@ endfunction
|
|||
" Tagbar. Properly parsing them is quite tricky, so try not to think about it
|
||||
" too much.
|
||||
function! s:AddScopedTags(tags, processedtags, parent, depth,
|
||||
\ typeinfo, fileinfo)
|
||||
\ typeinfo, fileinfo) abort
|
||||
if !empty(a:parent)
|
||||
let curpath = a:parent.fullpath
|
||||
let pscope = a:typeinfo.kind2scope[a:parent.fields.kind]
|
||||
|
@ -2150,7 +2150,7 @@ function! s:AddScopedTags(tags, processedtags, parent, depth,
|
|||
endfunction
|
||||
|
||||
" s:ProcessPseudoTag() {{{2
|
||||
function! s:ProcessPseudoTag(curtags, tag, parent, typeinfo, fileinfo)
|
||||
function! s:ProcessPseudoTag(curtags, tag, parent, typeinfo, fileinfo) abort
|
||||
let curpath = !empty(a:parent) ? a:parent.fullpath : ''
|
||||
|
||||
let pseudoname = substitute(a:tag.path, curpath, '', '')
|
||||
|
@ -2171,7 +2171,7 @@ function! s:ProcessPseudoTag(curtags, tag, parent, typeinfo, fileinfo)
|
|||
endfunction
|
||||
|
||||
" s:ProcessPseudoChildren() {{{2
|
||||
function! s:ProcessPseudoChildren(tags, tag, depth, typeinfo, fileinfo)
|
||||
function! s:ProcessPseudoChildren(tags, tag, depth, typeinfo, fileinfo) abort
|
||||
for childtag in a:tag.children
|
||||
let childtag.parent = a:tag
|
||||
|
||||
|
@ -2197,7 +2197,7 @@ function! s:ProcessPseudoChildren(tags, tag, depth, typeinfo, fileinfo)
|
|||
endfunction
|
||||
|
||||
" s:CreatePseudoTag() {{{2
|
||||
function! s:CreatePseudoTag(name, parent, scope, typeinfo, fileinfo)
|
||||
function! s:CreatePseudoTag(name, parent, scope, typeinfo, fileinfo) abort
|
||||
if !empty(a:parent)
|
||||
let curpath = a:parent.fullpath
|
||||
let pscope = a:typeinfo.kind2scope[a:parent.fields.kind]
|
||||
|
@ -2234,7 +2234,7 @@ endfunction
|
|||
|
||||
" Sorting {{{1
|
||||
" s:SortTags() {{{2
|
||||
function! s:SortTags(tags, comparemethod)
|
||||
function! s:SortTags(tags, comparemethod) abort
|
||||
call sort(a:tags, a:comparemethod)
|
||||
|
||||
for tag in a:tags
|
||||
|
@ -2245,7 +2245,7 @@ function! s:SortTags(tags, comparemethod)
|
|||
endfunction
|
||||
|
||||
" s:CompareByKind() {{{2
|
||||
function! s:CompareByKind(tag1, tag2)
|
||||
function! s:CompareByKind(tag1, tag2) abort
|
||||
let typeinfo = s:compare_typeinfo
|
||||
|
||||
if typeinfo.kinddict[a:tag1.fields.kind] <#
|
||||
|
@ -2277,12 +2277,12 @@ function! s:CompareByKind(tag1, tag2)
|
|||
endfunction
|
||||
|
||||
" s:CompareByLine() {{{2
|
||||
function! s:CompareByLine(tag1, tag2)
|
||||
function! s:CompareByLine(tag1, tag2) abort
|
||||
return a:tag1.fields.line - a:tag2.fields.line
|
||||
endfunction
|
||||
|
||||
" s:ToggleSort() {{{2
|
||||
function! s:ToggleSort()
|
||||
function! s:ToggleSort() abort
|
||||
let fileinfo = s:known_files.getCurrent()
|
||||
if empty(fileinfo)
|
||||
return
|
||||
|
@ -2309,7 +2309,7 @@ endfunction
|
|||
|
||||
" Display {{{1
|
||||
" s:RenderContent() {{{2
|
||||
function! s:RenderContent(...)
|
||||
function! s:RenderContent(...) abort
|
||||
call s:LogDebugMessage('RenderContent called')
|
||||
let s:new_window = 0
|
||||
|
||||
|
@ -2399,7 +2399,7 @@ function! s:RenderContent(...)
|
|||
endfunction
|
||||
|
||||
" s:PrintKinds() {{{2
|
||||
function! s:PrintKinds(typeinfo, fileinfo)
|
||||
function! s:PrintKinds(typeinfo, fileinfo) abort
|
||||
call s:LogDebugMessage('PrintKinds called')
|
||||
|
||||
let first_tag = 1
|
||||
|
@ -2506,7 +2506,7 @@ function! s:PrintKinds(typeinfo, fileinfo)
|
|||
endfunction
|
||||
|
||||
" s:PrintTag() {{{2
|
||||
function! s:PrintTag(tag, depth, fileinfo, typeinfo)
|
||||
function! s:PrintTag(tag, depth, fileinfo, typeinfo) abort
|
||||
" Print tag indented according to depth
|
||||
silent put =repeat(' ', a:depth * 2) . a:tag.strfmt()
|
||||
|
||||
|
@ -2544,7 +2544,7 @@ function! s:PrintTag(tag, depth, fileinfo, typeinfo)
|
|||
endfunction
|
||||
|
||||
" s:PrintHelp() {{{2
|
||||
function! s:PrintHelp()
|
||||
function! s:PrintHelp() abort
|
||||
if !g:tagbar_compact && s:short_help
|
||||
silent 0put ='\" Press <F1> for help'
|
||||
silent put _
|
||||
|
@ -2577,7 +2577,7 @@ endfunction
|
|||
|
||||
" s:RenderKeepView() {{{2
|
||||
" The gist of this function was taken from NERDTree by Martin Grenfell.
|
||||
function! s:RenderKeepView(...)
|
||||
function! s:RenderKeepView(...) abort
|
||||
if a:0 == 1
|
||||
let line = a:1
|
||||
else
|
||||
|
@ -2603,7 +2603,7 @@ endfunction
|
|||
|
||||
" User actions {{{1
|
||||
" s:HighlightTag() {{{2
|
||||
function! s:HighlightTag(openfolds, ...)
|
||||
function! s:HighlightTag(openfolds, ...) abort
|
||||
let tagline = 0
|
||||
|
||||
if a:0 > 0
|
||||
|
@ -2667,7 +2667,7 @@ function! s:HighlightTag(openfolds, ...)
|
|||
endfunction
|
||||
|
||||
" s:JumpToTag() {{{2
|
||||
function! s:JumpToTag(stay_in_tagbar)
|
||||
function! s:JumpToTag(stay_in_tagbar) abort
|
||||
let taginfo = s:GetTagInfo(line('.'), 1)
|
||||
|
||||
let autoclose = w:autoclose
|
||||
|
@ -2756,7 +2756,7 @@ function! s:JumpToTag(stay_in_tagbar)
|
|||
endfunction
|
||||
|
||||
" s:ShowPrototype() {{{2
|
||||
function! s:ShowPrototype()
|
||||
function! s:ShowPrototype() abort
|
||||
let taginfo = s:GetTagInfo(line('.'), 1)
|
||||
|
||||
if empty(taginfo)
|
||||
|
@ -2767,7 +2767,7 @@ function! s:ShowPrototype()
|
|||
endfunction
|
||||
|
||||
" s:ToggleHelp() {{{2
|
||||
function! s:ToggleHelp()
|
||||
function! s:ToggleHelp() abort
|
||||
let s:short_help = !s:short_help
|
||||
|
||||
" Prevent highlighting from being off after adding/removing the help text
|
||||
|
@ -2780,7 +2780,7 @@ function! s:ToggleHelp()
|
|||
endfunction
|
||||
|
||||
" s:GotoNextToplevelTag() {{{2
|
||||
function! s:GotoNextToplevelTag(direction)
|
||||
function! s:GotoNextToplevelTag(direction) abort
|
||||
let curlinenr = line('.')
|
||||
let newlinenr = line('.')
|
||||
|
||||
|
@ -2811,7 +2811,7 @@ endfunction
|
|||
|
||||
" Folding {{{1
|
||||
" s:OpenFold() {{{2
|
||||
function! s:OpenFold()
|
||||
function! s:OpenFold() abort
|
||||
let fileinfo = s:known_files.getCurrent()
|
||||
if empty(fileinfo)
|
||||
return
|
||||
|
@ -2830,7 +2830,7 @@ function! s:OpenFold()
|
|||
endfunction
|
||||
|
||||
" s:CloseFold() {{{2
|
||||
function! s:CloseFold()
|
||||
function! s:CloseFold() abort
|
||||
let fileinfo = s:known_files.getCurrent()
|
||||
if empty(fileinfo)
|
||||
return
|
||||
|
@ -2851,7 +2851,7 @@ function! s:CloseFold()
|
|||
endfunction
|
||||
|
||||
" s:ToggleFold() {{{2
|
||||
function! s:ToggleFold()
|
||||
function! s:ToggleFold() abort
|
||||
let fileinfo = s:known_files.getCurrent()
|
||||
if empty(fileinfo)
|
||||
return
|
||||
|
@ -2882,7 +2882,7 @@ function! s:ToggleFold()
|
|||
endfunction
|
||||
|
||||
" s:SetFoldLevel() {{{2
|
||||
function! s:SetFoldLevel(level, force)
|
||||
function! s:SetFoldLevel(level, force) abort
|
||||
if a:level < 0
|
||||
echoerr 'Foldlevel can''t be negative'
|
||||
return
|
||||
|
@ -2917,7 +2917,7 @@ endfunction
|
|||
|
||||
" s:SetFoldLevelRecursive() {{{2
|
||||
" Apply foldlevel to normal tags
|
||||
function! s:SetFoldLevelRecursive(fileinfo, tags, level)
|
||||
function! s:SetFoldLevelRecursive(fileinfo, tags, level) abort
|
||||
for tag in a:tags
|
||||
if tag.depth >= a:level
|
||||
call tag.setFolded(1)
|
||||
|
@ -2932,7 +2932,7 @@ function! s:SetFoldLevelRecursive(fileinfo, tags, level)
|
|||
endfunction
|
||||
|
||||
" s:OpenParents() {{{2
|
||||
function! s:OpenParents(...)
|
||||
function! s:OpenParents(...) abort
|
||||
let tagline = 0
|
||||
|
||||
if a:0 == 1
|
||||
|
@ -2948,7 +2948,7 @@ endfunction
|
|||
|
||||
" Helper functions {{{1
|
||||
" s:AutoUpdate() {{{2
|
||||
function! s:AutoUpdate(fname)
|
||||
function! s:AutoUpdate(fname) abort
|
||||
call s:LogDebugMessage('AutoUpdate called on ' . a:fname)
|
||||
|
||||
" Get the filetype of the file we're about to process
|
||||
|
@ -3017,7 +3017,7 @@ function! s:AutoUpdate(fname)
|
|||
endfunction
|
||||
|
||||
" s:CheckMouseClick() {{{2
|
||||
function! s:CheckMouseClick()
|
||||
function! s:CheckMouseClick() abort
|
||||
let line = getline('.')
|
||||
let curcol = col('.')
|
||||
|
||||
|
@ -3031,7 +3031,7 @@ function! s:CheckMouseClick()
|
|||
endfunction
|
||||
|
||||
" s:DetectFiletype() {{{2
|
||||
function! s:DetectFiletype(bufnr)
|
||||
function! s:DetectFiletype(bufnr) abort
|
||||
" Filetype has already been detected for loaded buffers, but not
|
||||
" necessarily for unloaded ones
|
||||
let ftype = getbufvar(a:bufnr, '&filetype')
|
||||
|
@ -3065,7 +3065,7 @@ endfunction
|
|||
" Assemble the ctags command line in a way that all problematic characters are
|
||||
" properly escaped and converted to the system's encoding
|
||||
" Optional third parameter is a file name to run ctags on
|
||||
function! s:EscapeCtagsCmd(ctags_bin, args, ...)
|
||||
function! s:EscapeCtagsCmd(ctags_bin, args, ...) abort
|
||||
call s:LogDebugMessage('EscapeCtagsCmd called')
|
||||
call s:LogDebugMessage('ctags_bin: ' . a:ctags_bin)
|
||||
call s:LogDebugMessage('ctags_args: ' . a:args)
|
||||
|
@ -3115,7 +3115,7 @@ endfunction
|
|||
" Execute ctags with necessary shell settings
|
||||
" Partially based on the discussion at
|
||||
" http://vim.1045645.n5.nabble.com/bad-default-shellxquote-in-Widows-td1208284.html
|
||||
function! s:ExecuteCtags(ctags_cmd)
|
||||
function! s:ExecuteCtags(ctags_cmd) abort
|
||||
if exists('+shellslash')
|
||||
let shellslash_save = &shellslash
|
||||
set noshellslash
|
||||
|
@ -3144,7 +3144,7 @@ endfunction
|
|||
|
||||
" s:GetNearbyTag() {{{2
|
||||
" Get the tag info for a file near the cursor in the current file
|
||||
function! s:GetNearbyTag(all, ...)
|
||||
function! s:GetNearbyTag(all, ...) abort
|
||||
let fileinfo = s:known_files.getCurrent()
|
||||
if empty(fileinfo)
|
||||
return {}
|
||||
|
@ -3180,7 +3180,7 @@ endfunction
|
|||
" Return the info dictionary of the tag on the specified line. If the line
|
||||
" does not contain a valid tag (for example because it is empty or only
|
||||
" contains a pseudo-tag) return an empty dictionary.
|
||||
function! s:GetTagInfo(linenr, ignorepseudo)
|
||||
function! s:GetTagInfo(linenr, ignorepseudo) abort
|
||||
let fileinfo = s:known_files.getCurrent()
|
||||
|
||||
if empty(fileinfo)
|
||||
|
@ -3209,7 +3209,7 @@ function! s:GetTagInfo(linenr, ignorepseudo)
|
|||
endfunction
|
||||
|
||||
" s:IsValidFile() {{{2
|
||||
function! s:IsValidFile(fname, ftype)
|
||||
function! s:IsValidFile(fname, ftype) abort
|
||||
call s:LogDebugMessage('Checking if file is valid: ' . a:fname)
|
||||
|
||||
if a:fname == '' || a:ftype == ''
|
||||
|
@ -3237,7 +3237,7 @@ function! s:IsValidFile(fname, ftype)
|
|||
endfunction
|
||||
|
||||
" s:QuitIfOnlyWindow() {{{2
|
||||
function! s:QuitIfOnlyWindow()
|
||||
function! s:QuitIfOnlyWindow() abort
|
||||
" Check if there is more than window
|
||||
if winbufnr(2) == -1
|
||||
" Check if there is more than one tab page
|
||||
|
@ -3253,7 +3253,7 @@ function! s:QuitIfOnlyWindow()
|
|||
endfunction
|
||||
|
||||
" s:winexec() {{{2
|
||||
function! s:winexec(cmd)
|
||||
function! s:winexec(cmd) abort
|
||||
call s:LogDebugMessage("Executing without autocommands: " . a:cmd)
|
||||
|
||||
let eventignore_save = &eventignore
|
||||
|
@ -3265,7 +3265,7 @@ function! s:winexec(cmd)
|
|||
endfunction
|
||||
|
||||
" TagbarBalloonExpr() {{{2
|
||||
function! TagbarBalloonExpr()
|
||||
function! TagbarBalloonExpr() abort
|
||||
let taginfo = s:GetTagInfo(v:beval_lnum, 1)
|
||||
|
||||
if empty(taginfo)
|
||||
|
@ -3276,7 +3276,7 @@ function! TagbarBalloonExpr()
|
|||
endfunction
|
||||
|
||||
" TagbarGenerateStatusline() {{{2
|
||||
function! TagbarGenerateStatusline()
|
||||
function! TagbarGenerateStatusline() abort
|
||||
if g:tagbar_sort
|
||||
let text = '[Name]'
|
||||
else
|
||||
|
@ -3293,7 +3293,7 @@ endfunction
|
|||
|
||||
" Debugging {{{1
|
||||
" s:StartDebug() {{{2
|
||||
function! s:StartDebug(filename)
|
||||
function! s:StartDebug(filename) abort
|
||||
if empty(a:filename)
|
||||
let s:debug_file = 'tagbardebug.log'
|
||||
else
|
||||
|
@ -3315,13 +3315,13 @@ function! s:StartDebug(filename)
|
|||
endfunction
|
||||
|
||||
" s:StopDebug() {{{2
|
||||
function! s:StopDebug()
|
||||
function! s:StopDebug() abort
|
||||
let s:debug = 0
|
||||
let s:debug_file = ''
|
||||
endfunction
|
||||
|
||||
" s:LogDebugMessage() {{{2
|
||||
function! s:LogDebugMessage(msg)
|
||||
function! s:LogDebugMessage(msg) abort
|
||||
if s:debug
|
||||
exe 'redir >> ' . s:debug_file
|
||||
silent echon strftime('%H:%M:%S') . ': ' . a:msg . "\n"
|
||||
|
@ -3332,43 +3332,43 @@ endfunction
|
|||
" Autoload functions {{{1
|
||||
|
||||
" Wrappers {{{2
|
||||
function! tagbar#ToggleWindow()
|
||||
function! tagbar#ToggleWindow() abort
|
||||
call s:ToggleWindow()
|
||||
endfunction
|
||||
|
||||
function! tagbar#OpenWindow(...)
|
||||
function! tagbar#OpenWindow(...) abort
|
||||
let flags = a:0 > 0 ? a:1 : ''
|
||||
call s:OpenWindow(flags)
|
||||
endfunction
|
||||
|
||||
function! tagbar#CloseWindow()
|
||||
function! tagbar#CloseWindow() abort
|
||||
call s:CloseWindow()
|
||||
endfunction
|
||||
|
||||
function! tagbar#SetFoldLevel(level, force)
|
||||
function! tagbar#SetFoldLevel(level, force) abort
|
||||
call s:SetFoldLevel(a:level, a:force)
|
||||
endfunction
|
||||
|
||||
function! tagbar#OpenParents()
|
||||
function! tagbar#OpenParents() abort
|
||||
call s:OpenParents()
|
||||
endfunction
|
||||
|
||||
function! tagbar#StartDebug(...)
|
||||
function! tagbar#StartDebug(...) abort
|
||||
let filename = a:0 > 0 ? a:1 : ''
|
||||
call s:StartDebug(filename)
|
||||
endfunction
|
||||
|
||||
function! tagbar#StopDebug()
|
||||
function! tagbar#StopDebug() abort
|
||||
call s:StopDebug()
|
||||
endfunction
|
||||
|
||||
function! tagbar#RestoreSession()
|
||||
function! tagbar#RestoreSession() abort
|
||||
call s:RestoreSession()
|
||||
endfunction
|
||||
" }}}2
|
||||
|
||||
" tagbar#getusertypes() {{{2
|
||||
function! tagbar#getusertypes()
|
||||
function! tagbar#getusertypes() abort
|
||||
redir => defs
|
||||
silent execute 'let g:'
|
||||
redir END
|
||||
|
@ -3389,7 +3389,7 @@ endfunction
|
|||
" tagbar#autoopen() {{{2
|
||||
" Automatically open Tagbar if one of the open buffers contains a supported
|
||||
" file
|
||||
function! tagbar#autoopen(...)
|
||||
function! tagbar#autoopen(...) abort
|
||||
call s:LogDebugMessage('tagbar#autoopen called on ' . bufname('%'))
|
||||
let always = a:0 > 0 ? a:1 : 1
|
||||
|
||||
|
@ -3412,7 +3412,7 @@ function! tagbar#autoopen(...)
|
|||
endfunction
|
||||
|
||||
" tagbar#currenttag() {{{2
|
||||
function! tagbar#currenttag(fmt, default, ...)
|
||||
function! tagbar#currenttag(fmt, default, ...) abort
|
||||
if a:0 > 0
|
||||
" also test for non-zero value for backwards compatibility
|
||||
let longsig = a:1 =~# 's' || (type(a:1) == type(0) && a:1 != 0)
|
||||
|
@ -3436,7 +3436,7 @@ function! tagbar#currenttag(fmt, default, ...)
|
|||
endfunction
|
||||
|
||||
" tagbar#gettypeconfig() {{{2
|
||||
function! tagbar#gettypeconfig(type)
|
||||
function! tagbar#gettypeconfig(type) abort
|
||||
if !s:Init(1)
|
||||
return ''
|
||||
endif
|
||||
|
|
Loading…
Reference in New Issue
Block a user