1
0
mirror of https://github.com/gryf/tagbar.git synced 2025-12-17 11:30:28 +01:00

Scoped Highlighting (#683)

* Scoped highlighting fix
Attempt to change the scoped highlighting of the tagbar window. This
will now look only for 'stl' tag types when looking for the nearby tag
when looking to highlight. It does however take into account if the
cursor is on the same line as the tag and highlights it then as well.

* Add additional documentation

* Add documentation for tagbar#printfileinfo() debug routine
This commit is contained in:
raven42
2020-10-26 10:19:14 -05:00
committed by GitHub
parent 2a9270cb24
commit bc48b8b84b
3 changed files with 79 additions and 12 deletions

View File

@@ -348,6 +348,11 @@ FUNCTIONS *tagbar-functions*
value. This also clears the internal flags to the file will be re-examined
again.
tagbar#printfileinfo()
This function is used in conjunction with |TagbarDebug| and will print all
the known tags into the tagbar debug logfile. This is useful for looking
at the internal tag information that tagbar tracks.
------------------------------------------------------------------------------
KEY MAPPINGS *tagbar-keys*
@@ -1199,7 +1204,26 @@ kinds: A list of the "language kinds" that should be listed in Tagbar,
"f:functions:1"
< would list all the function definitions in a file under the header
"functions", fold them, and implicitly show them in the statusline
if tagbar#currenttag() is used.
if tagbar#currenttag() is used. The {stl} field is also used to
determine tag that are considered for scoped highlighting in the
tagbar window. By default, whenever the cursor is on a line
containing a known tag, then that tag will be highlighted in the
tagbar window. However if the cursor is not on a line containing a
tag, then only tags of a type that has {stl} set to 1 will be
highlighted. For example, in C the "macro" type has an {stl} value
of 0. So if there is a macro defined within the scope of a
function such as this:
>
int function1(int arg) {
#define BUF_LENGTH 10
char buffer[BUF_LENGTH + 1];
snprintf(buffer, BUF_LENGTH, "some string");
}
<
Then when the cursor is on the #define line, then that macro will
be highlighted in the tagbar window. However if the cursor was on
the snprintf() line, then the tag for function1() would be
highlighted.
sro: The scope resolution operator. For example, in C++ it is "::" and
in Java it is ".". If in doubt run ctags as shown below and check
the output.