[Python] global gtags can't create tags and global can't find the tags for python code

Discussão em 'Python' iniciado por Stack, Agosto 19, 2025.

  1. Stack

    Stack Membro Participativo

    I use ubuntu 22.04 and I saw there is already configure file /etc/gtags/gtags.conf from ubuntu package "global". In the configuration file, there is already the configurations of pygments-parser. Something like bellow

    #
    # Plug-in parser to use Pygments.
    #
    pygments-parser|Pygments plug-in parser:\
    :tc=common:\
    :ctagscom=/usr/bin/ctags-exuberant:\
    :pygmentslib=$libdir/gtags/pygments-parser.la:\
    :langmap=ABAP\:.abap:\
    :langmap=ANTLR\:.G.g:\
    :langmap=ActionScript3\:.as:\
    :langmap=Ada\:.adb.ads.ada:\
    :langmap=Python\:.py.pyw.sc.tac.sage:\



    I did a simple test by bellow steps:

    /tmp/tmp$ cat test.py
    #!/usr/bin//python

    def message():
    print("Hello World")


    if __name__ == "__main__":
    message()

    /tmp/tmp$ gtags --gtagslabel pygments-parser -v .
    [Tue Aug 19 17:57:33 CST 2025] Gtags started.
    Using configuration file '/etc/gtags/gtags.conf'.
    Using configuration label 'pygments-parser'.
    Using plug-in parser.
    [Tue Aug 19 17:57:33 CST 2025] Creating 'GTAGS' and 'GRTAGS'.
    [1] extracting tags of test.py
    [Tue Aug 19 17:57:33 CST 2025] Creating indexes for idutils.
    mkid: nothing to do
    [Tue Aug 19 17:57:33 CST 2025] Done.

    tmp/tmp$ global -v -x message test.py
    object not found (using '/tmp/tmp/GTAGS').
    /tmp/tmp$

    /tmp/tmp$ which ctags
    /usr/bin/ctags




    It seems it doesn't work.

    Any idea about it?

    Continue reading...

Compartilhe esta Página