tagbar icon indicating copy to clipboard operation
tagbar copied to clipboard

tagbar causes random variables to be highlighted inside my code

Open jgb opened this issue 5 years ago • 5 comments

Hello,

I use the newest version of tagbar (from git, installed with vim-plug) in combination with gvim 8.1.2269. Since a while I've noticed that when I am editing python code, and tagbar is open, on random occasions a variable or function name in my code is highlighted, as if I did a hlsearch. After some digging, and learning about getmatches() and clearmatches(), I've figured out this highlighting comes from the tagbar plugin. In particular it's the group called TagbarHighlight causing the problem, which looks like this when it happens:

{'group': 'TagbarHighlight', 'pattern': '^\%3l\s*[▼▶ ][-+# ]\?\zs[^( ]\+\ze', 'priority': 10, 'id': 1}

I assume this is a bug? At least I don't want tagbar to highlight anything in my code :)

If any extra info is needed from me to help debug the issue, let me know!

Greetings,

jgb

jgb avatar Feb 04 '20 12:02 jgb

Yes this sounds like a bug.

Do you have a minimum working example of python code and a sequence from startup that I can use to replicate this?

alerque avatar Feb 04 '20 12:02 alerque

Yes this sounds like a bug.

Do you have a minimum working example of python code and a sequence from startup that I can use to replicate this?

Hello,

not sure if this is helpful, but I can't share the whole code tree, work related:

from .campaign import (
    CampaignListView,
    CampaignView,
    get_viz_data,
    CampaignUpdateView,
    CampaignCreateView,
)

from .charts import *
from .datatables import AllowedCampaignListJson
from .tree import *

This is an __init__.py file which I have open in a buffer, and several other files in other buffers. I've got tagbar open. After switching back and forth a few times between the different buffers, suddenly the word CampaignUpdateView and the comma behind it are highlighted, using TagbarHighlight formatting. I can't give you an exact way to replicate, it usually happens when I have multiple buffers open, and I've been switching back and forth a bit.

jgb avatar Feb 04 '20 13:02 jgb

After switching back and forth a few times between the different buffers, [...]

Thanks, but I can't make that bit of trigger anything. I stuck it in a python file and navigated around, opened some other buffers, etc. We don't want to work with your whole project either, what we need is an absolute minimum bit of content and exact steps to replicate.

alerque avatar Feb 04 '20 14:02 alerque

After switching back and forth a few times between the different buffers, [...]

Thanks, but I can't make that bit of trigger anything. I stuck it in a python file and navigated around, opened some other buffers, etc. We don't want to work with your whole project either, what we need is an absolute minimum bit of content and exact steps to replicate.

Sorry, I've tried several things, and I don't seem to find a way to replicate it in a reliable way. It mainly happens when I have several buffers open, each of them python code, and I spend some time editing and jumping between buffers, then suddenly I'll notice that a word is highlighted for no reason. But it's a bit unpredictable in nature, I can't yet put my finger on what exactly are the circumstances which triggers it.

jgb avatar Feb 05 '20 10:02 jgb

I suspect this is a bad interaction between plugins. It might not be strictly tagbar (or the other plugin(s)) at fault, it might be something they both try to do and clobber each other. Try disabling other plugins (especially anything python related) and see if it continues. I kind of suspect you'll find it takes two plugins in tandem to trigger this.

alerque avatar Feb 05 '20 12:02 alerque