mirror of
https://github.com/gryf/tagbar.git
synced 2025-12-17 11:30:28 +01:00
Improve tag highlighting and signature matching (#735)
1. Correctly highlight tags that contain spaces. 2. Match function signature on special case: operator()(...).
This commit is contained in:
@@ -2273,10 +2273,11 @@ function! s:HighlightTag(openfolds, ...) abort
|
||||
|
||||
" If printing the line number of the tag to the left, and the tag is
|
||||
" visible (I.E. parent isn't folded)
|
||||
let identifier = '\zs\V' . tag.name . '\m\ze'
|
||||
if g:tagbar_show_tag_linenumbers == 2 && tagline == tag.tline
|
||||
let pattern = '/^\%' . tagline . 'l\s*' . foldpat . '[-+# ]\[[0-9]\+\] \?\zs[^( ]\+\ze/'
|
||||
let pattern = '/^\%' . tagline . 'l\s*' . foldpat . '[-+# ]\[[0-9]\+\] \?' . identifier . '/'
|
||||
else
|
||||
let pattern = '/^\%' . tagline . 'l\s*' . foldpat . '[-+# ]\?\zs[^( ]\+\ze/'
|
||||
let pattern = '/^\%' . tagline . 'l\s*' . foldpat . '[-+# ]\?' . identifier . '/'
|
||||
endif
|
||||
call tagbar#debug#log("Highlight pattern: '" . pattern . "'")
|
||||
if hlexists('TagbarHighlight') " Safeguard in case syntax highlighting is disabled
|
||||
|
||||
@@ -38,7 +38,7 @@ syntax match TagbarHelpTitle '" \zs-\+ \w\+ -\+' contained
|
||||
syntax match TagbarNestedKind '^\s\+\[[^]]\+\]$'
|
||||
syntax match TagbarType ' : \zs.*' contains=TagbarTagLineN
|
||||
syntax match TagbarTagLineN '\s\+\[[0-9]\+\]\(\s\+\|$\)'
|
||||
syntax match TagbarSignature '(.*)'
|
||||
syntax match TagbarSignature '\(\<operator *( *) *\)\?\zs(.*)\ze'
|
||||
syntax match TagbarPseudoID '\*\ze :'
|
||||
|
||||
highlight default link TagbarHelp Comment
|
||||
|
||||
Reference in New Issue
Block a user