preservim / tagbar

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

Tag does not show up with python annotation #804

Closed SylvainGuieu closed 2 years ago

SylvainGuieu commented 2 years ago
class A:
     num = 0 

Will show the num variable in A class in the Tagbar

class A:
    num: int = 0

Will not.

On neovim v0.6.1

alerque commented 2 years ago

This plugin is reliant on the output of your system's ctags. What version are you using? It's possible it isn't putting out any useful data for tagbar to show.

SylvainGuieu commented 2 years ago

Indeed, for:

class A:
    num = 0

class B:
    num: int = 0

ctags output :

A   test.py /^class A:$/;"  c
B   test.py /^class B:$/;"  c
num test.py /^    num = 0$/;"   v   class:A
test_main   test.py /^from pydevmgr_core.test import test_main $/;" i

So I have switch my ctags installation from Exuberant Ctags 5.8 to Universal Ctags 5.9.0 and it works :

A   test.py /^class A:$/;"  c
B   test.py /^class B:$/;"  c
num test.py /^    num = 0$/;"   v   class:A
num test.py /^    num: int = 0$/;"  v   class:B typeref:typename:int

However the import is not there anymore. Not sure why.

Thanks !

alerque commented 2 years ago

Exuberant tags is legacy and unsupported anyway, the universal ctags fork is the only way to go. Eventually we'll only be supporting it.

I don't know why the "import" was there in e-ctags or why it isn't in u-ctags, but that is something to take up with the uctags project if you think the output is incorrect. This plugin's job is just to parse and render the output, not create it.