unknown error on startup with FixCursorHold.nvim and fzf.vim
antoinemadec opened this issue · 1 comments
Describe the bug
I am the maintainer of FixCursorHold.nvim, an issue explaining the problem was created here: antoinemadec/FixCursorHold.nvim#7
My plugin reimplements CursorHold
autocmd to avoid a performance bug.
Doing so seems to sometimes create a race condition on vim-ultest
's end.
Error: Error: vim-ultest encountered an unknown error on startup, check v:exception
v:exception
value:
Vim(let):Error invoking '/home/antoine/toto/plug/vim-ultest/rplugin/python3/ultest:function:_ultest_get_nearest_test' on channel 4 (python3-rplugin-host):
error caught in request handler '/home/antoine/toto/plug/vim-ultest/rplugin/python3/ultest:function:_ultest_get_nearest_test [[2, "term://~/toto//8265:'/home/antoine/toto/plug/fzf/bin/fzf' '+m' '--tiebreak=index' '--multi' '--prompt' 'BLines> ' '--ansi' '--extended' '--nth=2..' '--tabstop=1' --expect=ctrl-v,ctrl-x,ctrl-t --no-height --border=rounded > /tmp/nvimeU62jz/1;#FZF", True]]':
Traceback (most recent call last):
File "/home/antoine/toto/plug/vim-ultest/rplugin/python3/ultest/__init__.py", line 103, in _get_nearest_test
return self.handler.get_nearest_test_dict(*args)
File "/home/antoine/toto/plug/vim-ultest/rplugin/python3/ultest/handler/__init__.py", line 221, in get_nearest_test_dict
test = self.get_nearest_position(line, file_name, strict)
File "/home/antoine/toto/plug/vim-ultest/rplugin/python3/ultest/handler/__init__.py", line 212, in get_nearest_position
positions = self._tracker.file_positions(file_name)
File "/home/antoine/toto/plug/vim-ultest/rplugin/python3/ultest/handler/tracker.py", line 93, in file_positions
absolute_path = self._vim.sync_call("fnamemodify", file, ":p")
File "/home/antoine/toto/plug/vim-ultest/rplugin/python3/ultest/vim_client/__init__.py", line 121, in sync_call
return self._eval(expr, sync=True)
File "/home/antoine/toto/plug/vim-ultest/rplugin/python3/ultest/vim_client/__init__.py", line 134, in _eval
return self._vim.eval(expr, async_=not sync)
File "/usr/lib/python3.9/site-packages/pynvim/api/nvim.py", line 295, in eval
return self.request('nvim_eval', string, **kwargs)
File "/usr/lib/python3.9/site-packages/pynvim/api/nvim.py", line 182, in request
res = self._session.request(name, *args, **kwargs)
File "/usr/lib/python3.9/site-packages/pynvim/msgpack_rpc/session.py", line 102, in request
raise self.error_wrapper(err)
pynvim.api.common.NvimError: Vim:E121: Undefined variable: home
To Reproduce
See antoinemadec/FixCursorHold.nvim#7
Expected behavior
No error at startup.
Additional context
This kind of race condition seems to have already been a concern according to this comment in handler.vim
's s:Call()
definition:
" Send twice because first one isn't shown if triggered during startup
However s:update_warn_sent
value is 0 when the error is printed. Indicating that s:Call()
was not sent twice at startup.
The if condition seems wrong to me, shouldn't it be "if error happened at least twice, then display the error message" ?
Hey thanks for looking into this, sorry for the trouble! This actually has nothing to do with your plugin, I'm assuming they it was only noticed because the updatetime before was longer and so the issue was never noticed. Basically what's happening is a bad string conversion of the terminal buffer name. I've added a change to avoid the issue happening.
The if condition seems wrong to me, shouldn't it be "if error happened at least twice, then display the error message" ?
No the condition is just there to stop messages being spammed in case of large amounts of errors