Open jamesTSCoop opened 3 weeks ago
Can you please share a screenshot or something? I'm not quite understanding the issue you are describing. I'm not understanding why a variable assignment line being too long would have any impact on the tags identified by universal-ctags or on tagbar. I just want to make sure I understand your request.
As for number 4, if I understand that request, I don't believe there is any option to do this currently. Tagbar only sets the fold levels for each line, but doesn't control showing/hiding the folds.
If you want to take a look at the current implementation, the function that performs the highlight is here.
There is a bit specifically about highlighting the parent instead. Is this the issue to which you are referring?
Yes, the code at 2307 looks like it should be doing what I am wanting/expecting, but for me it isn't, here are some screenshots.
The cursor is on an unfolded var, the var is highlit, makes sense:
The cursor is on a folded var, the parent scope isn't highlit, and I wish it was :(
The cursor is not on a var, the function is highlit, I'm happy for a moment :)
Ok, I see what you mean now. Ya it looks like this might be a bug based on the comments in the code. It looks like it is supposed to set the highlight identifier to the parent tag if the fold is closed, but it looks like that might now be happening correctly.
I suspect something it wrong with this logic here: https://github.com/preservim/tagbar/blob/0815b5455c792a610d28ff3e7981642c9cf05d62/autoload/tagbar.vim#L2322-L2325
It is using the same tag.name
that was returned from here:
https://github.com/preservim/tagbar/blob/0815b5455c792a610d28ff3e7981642c9cf05d62/autoload/tagbar.vim#L2260-L2264
So maybe it is something to do with the GetNearbyTag()
function?
Unfortunately I don't have time to really dig into it right now, but it is likely something in this area. I'm thinking if we do detect that the parent is folded, we may need to change the value of tag
to be the parent instead of the nearest tag. Or maybe the GetNearbyTag()
needs a different argument to ignore folded tags?
Thanks for the pointers though, I'm sure I can figure it out from here!
It bugs me a bit that if my cursor rests on a variable assignment line too long the highlighting for the method I'm in disappears because the variable within its scope is highlit but folded from view. I'd love to be able to configure tagbar so that there are four options:
I'm not completely sure 4 isn't already possible, I scanned the help, wiki, and issues pretty carefully but not perfectly. I'm also not completely sure I can't already configure the highlighting colour/style based on tag type, but that's another thing I think would be cool.
I'm a software developer and I'd be happy to do the coding if someone who knows this codebase can confirm that it's possible and point me in approximately the right direction!