preservim / tagbar

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

no tag found (neovim) #848

Open jfmoulin opened 1 year ago

jfmoulin commented 1 year ago

Hi,

after trying other navigation plugins I decided to come back to old trusty tagbar. Now, I seem to be punished for my infidelity... "No tag found" I ran ctags-universal per hand, it works. It is on the path. I ran tagbardebug, I can see no obvious problem (see below).

Thanks for a plugin so good that it would be the only vimscript plugin on my lua system, that is if I manage to get it back to work ;0)

`

NVIM v0.8.3 Build type: Release LuaJIT 2.1.0-beta3 Compiled by runner@fv-az183-550

Features: +acl +iconv +tui See ":help feature-compile"

system vimrc file: "$VIM/sysinit.vim" fall-back for $VIM: "/share/nvim"

Run :checkhealth for more info1970-01-01 16:32:36.341917: ToggleWindow called 1970-01-01 16:32:36.342056: OpenWindow called with flags: '' 1970-01-01 16:32:36.342177: Checking for Exuberant Ctags 1970-01-01 16:32:36.342322: EscapeCtagsCmd called 1970-01-01 16:32:36.342355: ctags_bin: /usr/local/bin/ctags 1970-01-01 16:32:36.342385: ctags_args (is a string): --version 1970-01-01 16:32:36.342496: Escaped ctags command: '/usr/local/bin/ctags' --version 1970-01-01 16:32:36.342543: Executing ctags command: '/usr/local/bin/ctags' --version 1970-01-01 16:32:36.502089: Executing command: "'/usr/local/bin/xonsh' '-c' ''/usr/local/bin/ctags' --version'" 1970-01-01 16:32:36.502150: Exit code: 0 1970-01-01 16:32:36.503765: Command output: Universal Ctags 5.9.0(3645619e), Copyright (C) 2015-2022 Universal Ctags Team Universal Ctags is derived from Exuberant Ctags. Exuberant Ctags 5.8, Copyright (C) 1996-2009 Darren Hiebert Compiled: Apr 6 2022, 22:33:28 URL: https://ctags.io/ Optional compiled features: +wildcards, +regex, +gnulib_regex, +iconv, +option-directory, +packcc, +optscript, +pcre2

1970-01-01 16:32:36.503804: Exit code: 0 1970-01-01 16:32:36.503838: Checking Exuberant Ctags version 1970-01-01 16:32:36.503859: Found Universal Ctags, assuming compatibility 1970-01-01 16:32:36.503895: Initializing types 1970-01-01 16:32:36.503914: Getting filetypes supported by Exuberant Ctags 1970-01-01 16:32:36.503936: EscapeCtagsCmd called 1970-01-01 16:32:36.503954: ctags_bin: /usr/local/bin/ctags 1970-01-01 16:32:36.503973: ctags_args (is a string): --list-languages 1970-01-01 16:32:36.504039: Escaped ctags command: '/usr/local/bin/ctags' --list-languages 1970-01-01 16:32:36.504068: Executing ctags command: '/usr/local/bin/ctags' --list-languages 1970-01-01 16:32:36.674966: Executing command: "'/usr/local/bin/xonsh' '-c' ''/usr/local/bin/ctags' --list-languages'" 1970-01-01 16:32:36.675035: Exit code: 0 1970-01-01 16:32:36.681684: Creating autocommands 1970-01-01 16:32:36.681815: AutoUpdate called [/home/jfmoulin/My_Git/Local/sandbox/_42_outputer.py] 1970-01-01 16:32:36.681862: Vim filetype: 'python', sanitized filetype: 'python' 1970-01-01 16:32:36.681885: Checking if file is valid [/home/jfmoulin/My_Git/Local/sandbox/_42_outputer.py] 1970-01-01 16:32:36.681954: New file, processing [/home/jfmoulin/My_Git/Local/sandbox/_42_outputer.py] 1970-01-01 16:32:36.681977: ProcessFile called [/home/jfmoulin/My_Git/Local/sandbox/_42_outputer.py] 1970-01-01 16:32:36.681999: Checking if file is valid [/home/jfmoulin/My_Git/Local/sandbox/_42_outputer.py] 1970-01-01 16:32:36.682334: typeinfo for file to process: {'ctagstype': 'python', 'ftype': 'python', 'kinddict': {'c': 1, 'v': 4, 'f': 2, 'i': 0, 'm': 3, '?': 5}, 'sro': '.', 'createKinddict': function('73_createKinddict'), 'getKind': function('73_getKind'), 'kind2scope': {'c': 'class', 'f': 'function', 'm': 'member', '?': 'unknown'}, 'scope2kind': {'function': 'f', 'class': 'c', 'member': 'm'}, 'kinds': [{'short': 'i', 'long': 'modules', 'fold': 1, 'stl': 0}, {'short': 'c', 'long': 'classes', 'fold': 0, 'stl': 1}, {'short': 'f', 'long': 'functions', 'fold': 0, 'stl': 1}, {'short': 'm', 'long': 'members', 'fold': 0, 'stl': 1}, {'short': 'v', 'long': 'variables', 'fold': 0, 'stl': 0}, {'short': '?', 'long': 'unknown', 'fold': 0, 'stl': 1}]} 1970-01-01 16:32:36.682448: Caching file into: /tmp/nvim.jfmoulin/UskkgL/0.py 1970-01-01 16:32:36.682506: ExecuteCtagsOnFile called [/tmp/nvim.jfmoulin/UskkgL/0.py] 1970-01-01 16:32:36.682586: EscapeCtagsCmd called 1970-01-01 16:32:36.682607: ctags_bin: /usr/local/bin/ctags 1970-01-01 16:32:36.682631: ctags_args (is a list): ['--extras=+F', '-f', '-', '--format=2', '--excmd=pattern', '--fields=nksSafet', '--sort=no', '--append=no', '-V', '--language-force=python', '--python-kinds=icfmv'] 1970-01-01 16:32:36.682715: Escaped ctags command: '/usr/local/bin/ctags' '--extras=+F' '-f' '-' '--format=2' '--excmd=pattern' '--fields=nksSafet' '--sort=no' '--append=no' '-V' '--language-force=python' '--python-kinds=icfmv' '/tmp/nvim.jfmoulin/UskkgL/0.py' 1970-01-01 16:32:36.682750: Executing ctags command: '/usr/local/bin/ctags' '--extras=+F' '-f' '-' '--format=2' '--excmd=pattern' '--fields=nksSafet' '--sort=no' '--append=no' '-V' '--language-force=python' '--python-kinds=icfmv' '/tmp/nvim.jfmoulin/UskkgL/0.py' 1970-01-01 16:32:36.939466: Executing command: "'/usr/local/bin/xonsh' '-c' ''/usr/local/bin/ctags' '--extras=+F' '-f' '-' '--format=2' '--excmd=pattern' '--fields=nksSafet' '--sort=no' '--append=no' '-V' '--language-force=python' '--python-kinds=icfmv' '/tmp/nvim.jfmoulin/UskkgL/0.py''" 1970-01-01 16:32:36.939548: Exit code: 0 1970-01-01 16:32:36.942339: Ctags executed successfully 1970-01-01 16:32:36.942523: Filetype tag kinds: ['c', 'v', 'f', 'i', 'm', '?'] 1970-01-01 16:32:36.942556: Parsing ctags output 1970-01-01 16:32:36.942658: Processing kind: i, number of tags: 0 1970-01-01 16:32:36.942712: Processing kind: v, number of tags: 0 1970-01-01 16:32:36.943160: Setting current file [/home/jfmoulin/My_Git/Local/sandbox/_42_outputer.py] 1970-01-01 16:32:36.943578: AutoUpdate finished successfully 1970-01-01 16:32:36.950190: AutoUpdate called [/home/jfmoulin/My_Git/Local/sandbox/Tagbar.1] 1970-01-01 16:32:36.950260: Still opening window, stopping processing 1970-01-01 16:32:36.951174: InitWindow called with autoclose: 0 1970-01-01 16:32:36.956045: AutoUpdate called [/home/jfmoulin/My_Git/Local/sandbox/Tagbar.1] 1970-01-01 16:32:36.956115: In Tagbar window, stopping processing 1970-01-01 16:32:36.956683: Mapping keys 1970-01-01 16:32:36.957341: InitWindow finished 1970-01-01 16:32:36.957401: AutoUpdate called [/home/jfmoulin/My_Git/Local/sandbox/_42_outputer.py] 1970-01-01 16:32:36.957468: Vim filetype: 'python', sanitized filetype: 'python' 1970-01-01 16:32:36.957505: Checking if file is valid [/home/jfmoulin/My_Git/Local/sandbox/_42_outputer.py] 1970-01-01 16:32:36.957620: File data seems up to date [/home/jfmoulin/My_Git/Local/sandbox/_42_outputer.py] 1970-01-01 16:32:36.957712: RenderContent called 1970-01-01 16:32:36.957829: Redisplaying file [/home/jfmoulin/My_Git/Local/sandbox/_42_outputer.py] 1970-01-01 16:32:36.958022: No tags found, skipping printing. 1970-01-01 16:32:36.958207: Setting current file [/home/jfmoulin/My_Git/Local/sandbox/_42_outputer.py] 1970-01-01 16:32:36.958493: AutoUpdate finished successfully 1970-01-01 16:32:36.963987: AutoUpdate called [/home/jfmoulin/My_Git/Local/sandbox/_42_outputer.py] 1970-01-01 16:32:36.964074: Vim filetype: 'python', sanitized filetype: 'python' 1970-01-01 16:32:36.964113: Checking if file is valid [/home/jfmoulin/My_Git/Local/sandbox/_42_outputer.py] 1970-01-01 16:32:36.964232: File data seems up to date [/home/jfmoulin/My_Git/Local/sandbox/_42_outputer.py] 1970-01-01 16:32:36.964359: Setting current file [/home/jfmoulin/My_Git/Local/sandbox/_42_outputer.py] 1970-01-01 16:32:36.964614: goto_win(): wincmd p, 1 1970-01-01 16:32:36.964722: goto_win(): 2wincmd w, 1 1970-01-01 16:32:36.964871: goto_win(): 2wincmd w, 1 1970-01-01 16:32:36.964936: goto_win(): 1wincmd w, 1 1970-01-01 16:32:36.964982: AutoUpdate finished successfully 1970-01-01 16:32:36.965320: OpenWindow finished 1970-01-01 16:32:36.965362: ToggleWindow finished `

raven42 commented 1 year ago

Couple questions to try to help:

jfmoulin commented 1 year ago

Hi! Sorry for delayed answer, I was afk.

    import pickle
    import subprocess
    from time import sleep
    import odict
    class Outputer:

    """
    A class to output data (dicts, see FifoReader) to a named pipe
    which can then be read by another process
    Use it to start a script into a new window and communicate with it...
    """

    def __init__(self,fifo='/home/jfmoulin/Temp/testfifo',interval=.1):

        """
        fifo is an existing named pipe
        """
        self.interval = interval
        # let us open a new gnome terminal and play our reader therein
        subprocess.Popen(['gnome-terminal',
                          '-x',
                          'python',
                          '/home/jfmoulin/My_Progs/dev/_42_reader.py'
                          ])
        self.fifo_name = fifo
    def __call__(self,data):
        self.fifo = open(self.fifo_name,'w')
        data = pickle.dumps(data)
        self.fifo.write(data)
        self.fifo.close()    
@ ctags --extras=+F -f - --format=2 --excmd=pattern --fields=nksSafet --sort=no --append=no -V --language-force=python --python-kinds=icfmv _42_outputer.py
  Option: --language-force=python
    Option: --python-kinds=icfmv
    Initialize parser: Python
    Initialize parser: IPythonCell
    Add extra[8]: doubleSharps,Include cells starting from ## in IPythonCell
    enable field "name": yes
    enable field "input": yes
    enable field "pattern": yes
    Reading command line arguments
    OPENING _42_outputer.py as Python language file [new]
    Outputer_42_outputer.py/^class Outputer:$/;"cline:5access:public
    __init___42_outputer.py/^    def __init__(self,fifo='\/home\/jfmoulin\/Temp\/testfifo',interval=.1):$/;"mline:13class:Outputeraccess:publicsignature:(self,fifo='/home/jfmoulin/Temp/testfifo',interval=.1)end:25
    __call___42_outputer.py/^    def __call__(self,data):$/;"mline:26class:Outputeraccess:publicsignature:(self,data)end:30
raven42 commented 1 year ago

Hmm... the ctags output doesn't look quite right. Was this exactly as it appeared? There doesn't appear to be any TAB characters between the fields. That is how tagbar splits the items on the tag line and decodes the tag information. If there are no TAB characters, then tagbar won't be able to decipher the sting correctly. If this is the case, do you have something in your ctags config file that is causing the delimiter to be different?

Or is this a simply a copy/paste issue when you pasted the output into the github comment?

When I execute it on this file, this is what I see:

projects$ ctags --extras=+F -f - --format=2 --excmd=pattern --fields=nksSafet --sort=no --append=no -V --language-force=python --python-kinds=icfmv test.py
  Option: --language-force=python
  Option: --python-kinds=icfmv
Initialize parser: Python
Initialize parser: IPythonCell
Add extra[8]: doubleSharps, Include cells starting from ## in IPythonCell
enable field "name": yes
enable field "input": yes
enable field "pattern": yes
Reading command line arguments
OPENING test.py as Python language file [new]
Outputer        test.py /^class Outputer:$/;"   c       line:7  access:public   end:32
__init__        test.py /^    def __init__(self, fifo='\/home\/jfmoulin\/Temp\/testfifo', interval=.1):$/;"     m       line:14 class:Outputer  access:public   signature:(self, fifo='/home/jfmoulin/Temp/testfifo', interval=.1)     end:26
__call__        test.py /^    def __call__(self, data):$/;"     m       line:28 class:Outputer  access:public   signature:(self, data)  end:32
projects$
jfmoulin commented 1 year ago

This was a cut and paste from cli output. I retried and redirected the output to file, the result is TAB separated:


Outputer    _42_outputer.py /^class Outputer:$/;"   c   line:5  access:public
__init__    _42_outputer.py /^    def __init__(self,fifo='\/home\/jfmoulin\/Temp\/testfifo',interval=.1):$/;"   m   line:13 class:Outputer  access:public   signature:(self,fifo='/home/jfmoulin/Temp/testfifo',interval=.1)    end:25
__call__    _42_outputer.py /^    def __call__(self,data):$/;"  m   line:26 class:Outputer  access:public   signature:(self,data)   end:30
raven42 commented 1 year ago

Hmm. I'm at a loss. I installed neovim on a VM to give it a shot and I am able to see the tagbar output just fine on the file contents you specified. The logs all look the same up to the 'Redisplaying file []' line in my log file, but then my log file shows that there are two 'f' kinds, and 1 'c' kind as we'd expect.

The only thing I can think of is it having to do with the temp directory location. I tried both with, and without setting the $TMPDIR in my .vimrc and in both cases neovim displayed the tags correctly.

Sorry I can't be of more help.