c0r73x / neotags.nvim

Tag highlight in neovim

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error when python venv in same directory

benbarbour opened this issue · comments

I get this when loading a python file, ever since I ran: 'python -m venv .venv

error caught while executing async callback:
NvimError(b'Vim(syntax):E339: Pattern too long',)
Traceback (most recent call last):
File "/home/ben/.bbenv/config/nvim/plugged/neotags.nvim/rplugin/python3/neotags/neotags.py", line 52, in init
self.highlight()
File "/home/ben/.bbenv/config/nvim/plugged/neotags.nvim/rplugin/python3/neotags/neotags.py", line 158, in highlight
[self.__vim.command(cmd) for cmd in cmds]
File "/home/ben/.bbenv/config/nvim/plugged/neotags.nvim/rplugin/python3/neotags/neotags.py", line 158, in
[self.__vim.command(cmd) for cmd in cmds]
File "/home/ben/.local/lib/python3.5/site-packages/neovim/api/nvim.py", line 218, in command
return self.request('nvim_command', string, **kwargs)
File "/home/ben/.local/lib/python3.5/site-packages/neovim/api/nvim.py", line 131, in request
res = self._session.request(name, *args, **kwargs)
File "/home/ben/.local/lib/python3.5/site-packages/neovim/msgpack_rpc/session.py", line 98, in request
raise self.error_wrapper(err)
neovim.api.nvim.NvimError: b'Vim(syntax):E339: Pattern too long'

the call was requested at
File "/home/ben/.local/lib/python3.5/site-packages/neovim/api/nvim.py", line 171, in filter_notification_cb
notification_cb(name, args)
File "/home/ben/.local/lib/python3.5/site-packages/neovim/plugin/host.py", line 108, in _on_notification
handler(*args)
File "/home/ben/.local/lib/python3.5/site-packages/neovim/plugin/host.py", line 70, in _wrap_function
return fn(*args)
File "/home/ben/.bbenv/config/nvim/plugged/neotags.nvim/rplugin/python3/neotags/init.py", line 21, in init
self.__vim.async_call(self.__neotags.init)

I noticed that the .tags file has a lot of the information found in the .venv folder. Is there a way to exclude it?

Hi, you can add an exclude to your ~/.ctags file --exclude=.venv or you can add it to your vimrc

    let g:neotags_ctags_args = [
                \ '--fields=+l',
                \ '--c-kinds=+p',
                \ '--c++-kinds=+p',
                \ '--sort=no',
                \ '--extras=+q'
                \ '--exclude=.venv'
                \ ]

Or if you use the_silver_searcher you can add it to ~/.agignore.

I think that worked for python, but now I'm getting the same error on a C++ project. Not exactly sure what is causing it there.

Oh, actually, it's not quite the same

error caught while executing async callback:
NvimError(b'Vim(syntax):E339: Pattern too long',)
Traceback (most recent call last):
  File "/home/ben/.bbenv/config/nvim/plugged/neotags.nvim/rplugin/python3/neotags/neotags.py", line 72, in update
    self.highlight()
  File "/home/ben/.bbenv/config/nvim/plugged/neotags.nvim/rplugin/python3/neotags/neotags.py", line 158, in highlight
    [self.__vim.command(cmd) for cmd in cmds]
  File "/home/ben/.bbenv/config/nvim/plugged/neotags.nvim/rplugin/python3/neotags/neotags.py", line 158, in <listcomp>
    [self.__vim.command(cmd) for cmd in cmds]
  File "/home/ben/.local/lib/python3.5/site-packages/neovim/api/nvim.py", line 218, in command
    return self.request('nvim_command', string, **kwargs)
  File "/home/ben/.local/lib/python3.5/site-packages/neovim/api/nvim.py", line 131, in request
    res = self._session.request(name, *args, **kwargs)
  File "/home/ben/.local/lib/python3.5/site-packages/neovim/msgpack_rpc/session.py", line 98, in request
    raise self.error_wrapper(err)
neovim.api.nvim.NvimError: b'Vim(syntax):E339: Pattern too long'

the call was requested at
  File "/home/ben/.local/lib/python3.5/site-packages/neovim/api/nvim.py", line 171, in filter_notification_cb
    notification_cb(name, args)
  File "/home/ben/.local/lib/python3.5/site-packages/neovim/plugin/host.py", line 108, in _on_notification
    handler(*args)
  File "/home/ben/.local/lib/python3.5/site-packages/neovim/plugin/host.py", line 70, in _wrap_function
    return fn(*args)
  File "/home/ben/.bbenv/config/nvim/plugged/neotags.nvim/rplugin/python3/neotags/__init__.py", line 29, in update
    self.__vim.async_call(self.__neotags.update)

I think I know why you get that error, I will fix it.

Thanks! :)

I'm not sure if you're done yet, but I saw your latest commit and tried it out with various values for let g:neotags_patternlength = x, and it is still happening. I tried it with 4096, 9999, and 99999999.

The patternlength is the max length of the pattern in :syntax. I cant remember exactly what the max value is but 1024 should be fine, before it was 2048. However it seems thats not why you get the error.

I will have to do some tests to see if I can trigger the error.

I just double-checked it without me explicitly setting the value, and it seems to also happen with the 1024 default.

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