c0r73x / neotags.nvim

Tag highlight in neovim
MIT License
122 stars 9 forks source link

Error started in latest commits #11

Closed carlitux closed 6 years ago

carlitux commented 7 years ago
error caught while executing async callback:
ValueError('cannot mmap an empty file',)
Traceback (most recent call last):
  File "/Users/carlitux/.cache/dein/.cache/init.vim/.dein/rplugin/python3/neotags/neotags.py", line 106, in highlight
    groups, kinds = self._getTags(files)
  File "/Users/carlitux/.cache/dein/.cache/init.vim/.dein/rplugin/python3/neotags/neotags.py", line 329, in _getTags
    mf = mmap.mmap(f.fileno(), 0,  access=mmap.ACCESS_READ)
ValueError: cannot mmap an empty file

the call was requested at
  File "/usr/local/lib/python3.6/site-packages/neovim/api/nvim.py", line 171, in filter_notification_cb
    notification_cb(name, args)
  File "/usr/local/lib/python3.6/site-packages/neovim/plugin/host.py", line 108, in _on_notification
    handler(*args)
  File "/usr/local/lib/python3.6/site-packages/neovim/plugin/host.py", line 70, in _wrap_function
    return fn(*args)
  File "/Users/carlitux/.cache/dein/.cache/init.vim/.dein/rplugin/python3/neotags/__init__.py", line 25, in highlight
    self.__vim.async_call(self.__neotags.highlight)
c0r73x commented 7 years ago

I made a fix that prevents neotags from processing empty files, this should hide the error. Not sure why you would get an empty tagfile though.

carlitux commented 7 years ago

Now is happening when save file. I can think that is because tags file is being generating and trying to process by neotags.

c0r73x commented 7 years ago

Humm yea, I've seen the error myself. Seems to be some sort of race.

I will try to fix it.

c0r73x commented 7 years ago

I added a check to prevent mmap from running on empty files. It's not really a fix but it hides the error.

I will try to make a better fix when I've got more time to work on it.

c0r73x commented 6 years ago

I've done some major changes to the code, do you still get the same error?