Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no request handler registered for "/home/me/dummy/rplugin/python3/dummy:autocmd:BufEnter:*" #341

Open
balta2ar opened this issue Jun 19, 2018 · 12 comments
Labels

Comments

@balta2ar
Copy link

balta2ar commented Jun 19, 2018

Hello. I came from this issue: numirias/semshi#11

Summary: neovim prints this upon startup:

Error detected while processing function remote#define#request:
line    2:
no request handler registered for "/home/bz/rc.arch/bz/.vim/plugged/semshi/rplugin/python3/semshi:autocmd:BufEnter:*.py"

It only surfaced when I started using semshi. However, it does not look like it's a bug in the plugin, but rather in neovim/neovim-client. The author of the plugin could also reproduce the issue with the following configuration (see this comment numirias/semshi#11 (comment)):

call plug#begin('~/.vim/plugged')
Plug 'numirias/semshi'
Plug 'autozimu/LanguageClient-neovim'
Plug 'brooth/far.vim'
call plug#end()

The following plugin can also help reproduce the issue:

import neovim

@neovim.plugin
class Plugin:

    def __init__(self, vim):
        self._vim = vim

    @neovim.autocmd('BufEnter', pattern='*', sync=True)
    def foo(self):
        self._vim.out_write('hey\n')

neovim 0.3.0
neovim-client 0.2.6

@Shougo
Copy link
Contributor

Shougo commented Jun 19, 2018

UpdateRemotePlugins is already executed?

@numirias
Copy link

numirias commented Jun 20, 2018

@Shougo Yep. Installation of Python plugins (and registering their handlers) otherwise works fine.

You should be able to reproduce the bug with a minimal config using only these three plugins:

call plug#begin('~/.vim/plugged')
Plug 'numirias/semshi'
Plug 'autozimu/LanguageClient-neovim'
Plug 'brooth/far.vim'
call plug#end()

Note that they all are Python-powered and if you remove any single one of them the error disappears. But even if you replace one of them with the dummy plugin stub from above, the error will reappear. (While trying, obviously run :UpdateRemotePlugins each time.)

Would love to see someone else repro it.

@Shougo
Copy link
Contributor

Shougo commented Jun 21, 2018

I have tested it, but I cannot reproduce the problem.

@balta2ar
Copy link
Author

If it's a race condition, could you try with more plugins, e.g.:

call plug#begin('~/.vim/plugged')

Plug 'numirias/semshi'

Plug 'autozimu/LanguageClient-neovim'
Plug 'brooth/far.vim'
Plug 'raghur/vim-ghost', {'do': ':GhostInstall'}
Plug 'arakashic/chromatica.nvim'
Plug 'Shougo/deoplete.nvim'

call plug#end()

@lkhphuc
Copy link

lkhphuc commented Oct 28, 2018

Confirm that I can reproduce the problem with the minimal config above.
Neovim: 0.3.1, python-neovim: 0.2.6, macOS 10.14.

@numirias
Copy link

numirias commented Mar 27, 2019

Many shaky race conditions have been fixed in Neovim since, so chances are this bug might be gone.

@balta2ar @lkhphuc Can you still reproduce? Otherwise, I think this can be closed.

@balta2ar
Copy link
Author

@numirias I'm using neovim 0.3.3, pynvim 0.3.2 and I can consistently reproduce very similar error message with the following plugin:

import pynvim


@pynvim.plugin
class Main(object):
    def __init__(self, nvim):
        self.nvim = nvim

    @pynvim.autocmd('BufWritePost', pattern='*', eval='expand("<afile>:p")')
    def update_tags_for_file(self, filename):
        self.update_screen()

    @property
    def extrawidth(self):
        numberwidth = self.nvim.eval(
            '((&number||&relativenumber) ? &numberwidth : 0) + &foldcolumn')
        self.nvim.command(
            'redir =>a |exe "sil sign place buffer=".bufnr(\'\')|redir end')
        signlist = self.nvim.command_output('echo a').split('\n')
        signwidth = 2 if len(signlist) > 2 else 0
        separator = 1

        result = numberwidth + signwidth
        result += separator if numberwidth > 0 else 0
        result += separator if signwidth > 0 else 0
        return result

    def pad_message(self, message, index):
        winwidth = self.nvim.eval('winwidth("%")')
        linewidth = self.nvim.eval(
            'strdisplaywidth(getline(%s))' % (index + 1)) + self.extrawidth
        sumwidth = len(message)
        padwidth = max(0, winwidth - linewidth - sumwidth)
        padding = ' ' * padwidth
        padded_message = padding + message

        return padded_message

    def update_screen(self):
        highlight_group = 'LineNr'

        line_start = self.nvim.eval('line("w0")') - 1
        line_end = self.nvim.eval('line("w$")')
        lines = self.nvim.current.buffer[line_start:line_end]

        api = self.nvim.current.buffer.api
        api.clear_namespace(-1, 0, -1)
        for line, index in zip(lines, range(line_start, line_end)):
            text = 'Mocked'
            message = self.pad_message(text, index)
            api.set_virtual_text(0, index, [[message, highlight_group]], {})

The error I see when I do :w is this:

no notification handler registered for "/home/username/rc.arch/bz/.vim/plugged/timesheet.nvim/rplugin/python3/timesheet.py:autocmd:BufWritePost:*"

If I remove the two lines below, the error disappears:

        numberwidth = self.nvim.eval(
            '((&number||&relativenumber) ? &numberwidth : 0) + &foldcolumn')
        self.nvim.command(
            'redir =>a |exe "sil sign place buffer=".bufnr(\'\')|redir end')

Maybe it's a problem with my code, not neovim or pynvim, could you tell it from the code?

@justinmk
Copy link
Member

no notification handler registered for "/home/username/rc.arch/bz/.vim/plugged/timesheet.nvim/rplugin/python3/timesheet.py:autocmd:BufWritePost:*"

That definitely looks wrong. The "method name" "/home/username/.../timesheet.py:autocmd:BufWritePost:* is nonsense. Somewhere that's being passed as a method name. Most likely a bug in runtime/autoload/remote/define.vim .

@tjdevries
Copy link

I'm having this exact same thing happen to me while attempting to write a plugin...

weird thing is that after the first attempt failing, the rest succeed.

@fkarg
Copy link

fkarg commented Oct 13, 2019

I just had the exact same issue happening to me with only

Plug 'autozimu/LanguageClient-neovim'

though. Can't seem to figure it out though, and the magic UpdateRemotePlugins does something for me, but does not solve my problem (even after repeated execution).

@DrBluefall
Copy link

I can reproduce this as well, with this fairly minimal plugin:

"""An RPC client for Neovim."""
import pynvim
import pypresence
import asyncio
from datetime import datetime


@pynvim.plugin
class Neocord:
    """The core class for Neocord."""

    def __init__(self, nvim):
        """Initialize the plugin."""
        self.nvim = nvim
        self.client_id = self.nvim.vars.get("neocord_clientid")
        if self.client_id is None:
            self.client_id = 655548219425554464
        self.presence = pypresence.AioClient(
            self.client_id,
            loop=self.nvim.loop
        )
        self.presence.start()
        self.enter_time = datetime.now()
        self.pid = self.nvim.api.get_api_info()[0]

    @pynvim.autocmd('BufEnter', pattern='*')
    async def on_bufenter(self):
        """Run on opening a buffer."""
        current_buf = self.nvim.current.buffer
        await self.presence.set_activity(
                state=f"Editing buffer {current_buf.name}",
                start=self.enter_time.timestamp(),
                pid=self.pid
            )

    @pynvim.autocmd('VimEnter', pattern='*')
    async def on_vimenter(self):
        """Run on opening a vim session."""
        current_buf = self.nvim.current.buffer
        await self.presence.set_activity(
                state=f"Editing buffer {current_buf.name}",
                start=self.enter_time.timestamp(),
                pid=self.pid
            )

as well as this (super) minimal vimrc:

let &runtimepath.=','.escape(expand('<sfile>:p:h'), '\,')

@tejasvi
Copy link

tejasvi commented Jul 24, 2021

I had the issue with incorrect g:python3_host_prog. Try doing :checkhealth once

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

9 participants