mirror of
https://github.com/gryf/tagbar.git
synced 2025-12-18 12:00:23 +01:00
Add option for g:tagbar_highlight_method (#709)
* Add option for g:tagbar_highlight_current_tag Closes #708 Add option for g:tagbar_highlight_current_tag which will allow highlighting of tags on the current line in addition to highlighting the scoped tags. Reverts the behavior added in #638 to the default from before that commit * Rework to allow direct configuration of highlight method * Address review comments
This commit is contained in:
@@ -2186,9 +2186,9 @@ function! s:HighlightTag(openfolds, ...) abort
|
||||
let force = a:0 > 0 ? a:1 : 0
|
||||
|
||||
if a:0 > 1
|
||||
let tag = s:GetNearbyTag('nearest-stl', 0, a:2)
|
||||
let tag = s:GetNearbyTag(g:tagbar_highlight_method, 0, a:2)
|
||||
else
|
||||
let tag = s:GetNearbyTag('nearest-stl', 0)
|
||||
let tag = s:GetNearbyTag(g:tagbar_highlight_method, 0)
|
||||
endif
|
||||
if !empty(tag)
|
||||
let tagline = tag.tline
|
||||
@@ -3111,8 +3111,7 @@ function! s:GetNearbyTag(request, forcecurrent, ...) abort
|
||||
for line in range(curline, 1, -1)
|
||||
if has_key(fileinfo.fline, line)
|
||||
let curtag = fileinfo.fline[line]
|
||||
if a:request ==# 'nearest-stl'
|
||||
\ && typeinfo.getKind(curtag.fields.kind).stl || line == curline
|
||||
if a:request ==# 'nearest-stl' && typeinfo.getKind(curtag.fields.kind).stl
|
||||
let tag = curtag
|
||||
break
|
||||
elseif a:request ==# 'scoped-stl'
|
||||
@@ -3121,7 +3120,7 @@ function! s:GetNearbyTag(request, forcecurrent, ...) abort
|
||||
\ && curline <= curtag.fields.end
|
||||
let tag = curtag
|
||||
break
|
||||
elseif a:request ==# 'nearest'
|
||||
elseif a:request ==# 'nearest' || line == curline
|
||||
let tag = curtag
|
||||
break
|
||||
endif
|
||||
|
||||
Reference in New Issue
Block a user