c0r73x / neotags.nvim

Tag highlight in neovim

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Traceback at startup

MikaYuoadas opened this issue · comments

When starting neovim I get the following traceback:

error caught while executing async callback:                                                                                                                   
AttributeError("'Neotags' object has no attribute 'ft'")                                                                                                       
Traceback (most recent call last):                                                                                                                             
  File "/home/asadaoui/.config/nvim/plugged/neotags.nvim/rplugin/python3/neotags/neotags.py", line 140, in init                                                
    self.update(False)                                                                                                                                         
  File "/home/asadaoui/.config/nvim/plugged/neotags.nvim/rplugin/python3/neotags/neotags.py", line 181, in update                                              
    self.__groups[ft] = self._parseTags(ft)                                                                                                                    
  File "/home/asadaoui/.config/nvim/plugged/neotags.nvim/rplugin/python3/neotags/neotags.py", line 382, in _parseTags                                          
    return self._get_tags(files, ft)                                                                                                                           
  File "/home/asadaoui/.config/nvim/plugged/neotags.nvim/rplugin/python3/neotags/neotags.py", line 578, in _get_tags                                           
    self._parse(ft, match_list, groups, languages, ignored_tags, equivalent, order)                                                                            
  File "/home/asadaoui/.config/nvim/plugged/neotags.nvim/rplugin/python3/neotags/neotags.py", line 604, in _parse                                              
    key = "%s#%s" % (self.ft, match['kind'].decode('ascii'))                                                                                                   
AttributeError: 'Neotags' object has no attribute 'ft'                                                                                                         
                                                                                                                                                               
the call was requested at                                                                                                                                      
  File "/usr/lib/python3.7/site-packages/neovim/api/nvim.py", line 210, in filter_notification_cb                                                              
    notification_cb(name, args)                                                                                                                                
  File "/usr/lib/python3.7/site-packages/neovim/plugin/host.py", line 107, in _on_notification                                                                 
    handler(*args)                                                                                                                                             
  File "/usr/lib/python3.7/site-packages/neovim/plugin/host.py", line 69, in _wrap_function                                                                    
    return fn(*args)                                                                                                                                           
  File "/home/asadaoui/.config/nvim/plugged/neotags.nvim/rplugin/python3/neotags/__init__.py", line 20, in init                                                
    self.__vim.async_call(self.__neotags.init) 

From a quick look at the code at that line:

    def _parse(self, ft, match_list, groups, languages, ignored_tags, equivalent, order):
        dia.debug_start()
        key_lang = languages[0]

        if key_lang in ('c', 'cpp', 'java', 'go', 'rust', 'cs'):
            buf = strip_c(self.__slurp, dia)
        else:
            buf = bytes(self.__slurp, 'ascii', errors='replace')

        toks = sorted(tokenize(buf, dia))

        for match in match_list:
            if (bindex(toks, match['name']) != (-1)
                    or b'$' in match['name']
                    or b'.' in match['name']):
                key = "%s#%s" % (self.ft, match['kind'].decode('ascii'))
                groups[key].add(match['name'])

        dia.debug_end("Finished _parse, found %d items."
                      % sum(map(len, groups.values())))

It looks like the self.ft should just be ft.

Thanks for the report. I've been mostly working (on and off) on rewriting the python module which has clearly gotten a bit hairy (just look at how many parameters that function gets...) and overlooked this problem. I'm actually surprised it didn't turn up a lot sooner, this should have broken the code for everyone. Easy fix at least.