pynvim
pynvim copied to clipboard
plugin.function is not being loaded in neovim
I am seeing a weird issue, where a function defined using @plugin.function does not get loaded most of the time.
I have a python3 plugin called prj.py. I am defining a very simple function inside the plugin like this.
@pynvim.plugin
class Main(object):
....
@pynvim.function('PJumpDef')
def PJumpDef(self, args):
logger.info('jump')
logger.info(args)
I run the :UpdateRemotePlugins command to generate remote plugin manifest. Now, if I restart nvim and try to execute the function using :call PJumpDef(), it fails to find the function. But, If I keep restarting nvim it works once in a while (but very rarely).
This function is also not available in the output of :func command.
However,
By trial and error, I found that creating an autocmd like this in a prj.vim plugin file, I can get the function to load 100% of time.
autocmd VimEnter * call PJumpDef()
I know, this sounds very random and weird behavior, but this is bugging me for a while. Please let me know if there is some known fix for this.
I can call my functions, at the first time there is no tab auto-completion, but after called once, there is auto-completion. Also, function does not accept named params.
I am trying to resurect this thread, i am facing the same issue, if i call a python plugin method the first time it fails to return a valid value iget vim.NIL as a value if i call it second time (same args) then it returns a proper value . Note that the function itself seems to execute but the return value is not correct the first time you call it. Calling Update remote plugins does not seem to help
I just experienced the issue described by @asmodeus812 and narrowed it down to an issue which is already fixed in https://github.com/neovim/pynvim/pull/496. In my case the issue still exists because the latest release, which is distributed in Arch, doesn't include it.
Released 0.5: https://github.com/neovim/pynvim/releases/tag/0.5.0