preservim / tagbar

Vim plugin that displays tags in a window, ordered by scope
https://preservim.github.io/tagbar
Other
6.11k stars 486 forks source link

Scoped kinds #696

Closed raven42 closed 3 years ago

raven42 commented 3 years ago

Closes #508, #516

Add --fields=e (end) to the ctags field types to look for the end of the scope. Update the s:GetNearbyTag() routine to use this scope to look for the correct tag.

raven42 commented 3 years ago

So I've noticed some performance issues with this. When moving the cursor around in a larger file in an 'unscoped' area, the cursor movement is slower now because instead of finding a tag near to the cursor, it ends up looping through all tags and doesn't find one. I'm wondering if anybody knows of a better way to try to find a match instead of looping through all tags above the current cursor location looking for a matched scope? This issue could arise even when we are inside of a scope for something like a class that has a large number of functions defined in its declaration. Then when moving the cursor around in the 'class' scope toward the bottom, but outside of any member functions it would result in this same behavior.

raven42 commented 3 years ago

For now until any performance issues can be sorted out, I've changed the functionality so it has to be explicitly enabled by using the 'scoped-stl' argument as a search-method for the tagbar#currenttag() and tagbar#GetTagNearLine() routines. These routines will default to the 'nearest-stl' search method which is what they do today, but the user can optionally use the new search method to make it more intelligent at the cost of some performance.