c0r73x / neotags.nvim

Tag highlight in neovim

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error started in latest commits

carlitux opened this issue · comments

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)

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.

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

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

I will try to fix it.

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.

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