neovim / pynvim

Python client and plugin host for Nvim
http://pynvim.readthedocs.io/en/latest/
Apache License 2.0
1.54k stars 120 forks source link

Autocommands No Request Handler #149

Open vito-c opened 8 years ago

vito-c commented 8 years ago

There seems to be an error on adding autocommands to file buffers that have opening [ and closing ] in their name.

@neovim.autocmd('TextChangedI', pattern='\[abcd\]', eval='expand("<afile>")', sync=True)
def textchangedi_handler(self, filename):
    self.vim.command("echom 'hello'")

Error: Error detected while processing TextChangedI Auto commands for "\[abcd\]": Exception('no request handler registered for "/Users/me/.config/nvim/rplugin/python/test.py:autocmd:TextChangedI:[abcd]"',) Traceback (most recent call last): File "/Library/Python/2.7/site-packages/neovim/msgpack_rpc/session.py", line 177, in handler rv = self._request_cb(name, args) File "/Library/Python/2.7/site-packages/neovim/api/common.py", line 237, in filter_request_cb walk(self._in, args, self, name, 'request')) File "/Library/Python/2.7/site-packages/neovim/plugin/host.py", line 62, in _on_request raise Exception(msg) Exception: no request handler registered for "/Users/me/.config/nvim/rplugin/python/test.py:autocmd:TextChangedI:[abcd]"

Expected Result:

au! TextChangedI \[abcd\] :echom 'hello'

version: neovim (0.0.38)

bfredl commented 8 years ago

It was likely an error that stopped the plugin from loading. This error should be echoed now (so it can be fixed)

vito-c commented 8 years ago

It was likely an error that stopped the plugin from loading. This error should be echoed now (so it can be fixed)

Even if it's an error that stops the plugin from loading it's still an error that shouldn't exist. You should be able to add autocommands with file name patterns that have an [ or ] in their name you have to escape them via \] ... what happens or do you have a solution for this:

au! TextChangedI \[abcd\] :echom 'hello'
bfredl commented 8 years ago

Ah, sorry read the description too quickly, seems the \ is lost along the way (likely an issue with the neovim rplugin host logic and not python-client specifically)