neovim / pynvim

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

Check the command regist #437

Closed yanganto closed 4 years ago

yanganto commented 4 years ago

Hi, I run to a strange environment, and I want to debug to know the command registered from a plugin. How can I do this? Thanks.

The more detail that I run into is that in this nvim-translate, the Translate(before TranslateByte) and TranslateAll(after TranslateByte) are correct working, but TranslateByte is a non-exist command. https://github.com/yanganto/nvim-translate/blob/develop/rplugin/python/translate.py#L44 If you are willing to point out the exact problem, I will very much appreciate.

Shougo commented 4 years ago

https://github.com/yanganto/nvim-translate/blob/develop/rplugin/python/translate.py#L126

It is syntax error.

It must be:

h = s.split('u')[0]
if h:
Shougo commented 4 years ago

I can see the syntax error by :UpdateRemotePlugins output.

bfredl commented 4 years ago

@Shougo That is valid syntax in python 3.8, probably unrelated to the actual issue here.

Shougo commented 4 years ago

No. Because the plugin is for Python2. Please see the rplugin path.

bfredl commented 4 years ago

They probably intended it to be for python3, so the file should to be moved to rplugin/python3 then.

yanganto commented 4 years ago

Yep, I use python 3.8.2 on Archlinux, in which default python is Python 3.8.2 now. @bfredl, @Shougo I am sorry not to provide this information at first because I can not use rplugin/python3 but it can be work in rplugin/python. Besides, I try to put the code in the TranslateByte function into Translate function the code with the python3.8 operator := still work fine. So I think the issue is not the python3 syntax.

yanganto commented 4 years ago

I find the command register in ~/.local/share/nvim/rplugin.vim, and everything works well after I use :UpdateRemotePlugins, to update the command register. Thanks for your time. I appreciate.