mirror of
https://github.com/preservim/tagbar.git
synced 2024-11-26 10:29:34 +08:00
Merge pull request #676 from raven42/unknown-kinds
Add protection for unknown kinds
This commit is contained in:
commit
c26bf78a61
|
@ -15,7 +15,8 @@ endfunction
|
|||
|
||||
" s:getKind() {{{1
|
||||
function! s:getKind(kind) abort dict
|
||||
let idx = self.kinddict[a:kind]
|
||||
"let idx = self.kinddict[a:kind]
|
||||
let idx = has_key(self.kinddict, a:kind) ? self.kinddict[a:kind] : -1
|
||||
return self.kinds[idx]
|
||||
endfunction
|
||||
|
||||
|
|
|
@ -21,6 +21,12 @@ endfunction
|
|||
function! s:compare_by_kind(tag1, tag2) abort
|
||||
let typeinfo = s:compare_typeinfo
|
||||
|
||||
if !has_key(typeinfo.kinddict, a:tag1.fields.kind)
|
||||
return -1
|
||||
endif
|
||||
if !has_key(typeinfo.kinddict, a:tag2.fields.kind)
|
||||
return 1
|
||||
endif
|
||||
if typeinfo.kinddict[a:tag1.fields.kind] <#
|
||||
\ typeinfo.kinddict[a:tag2.fields.kind]
|
||||
return -1
|
||||
|
|
Loading…
Reference in New Issue
Block a user