-
Notifications
You must be signed in to change notification settings - Fork 119
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
luaeval behavior: functions are serialized to None
#550
Comments
Also for vim.lua.require("vim.F") throws vim.exec_lua("return require(...)", "vim.F") which then calls via RPC: rpcrequest('nvim_execute_lua', "return require(...)", ["vim.F"]) This RPC request cannot convert a lua function and raises errors as expected. Note -- this |
None
None
Returning functions ("funcrefs") over RPC is not supported. neovim/neovim#1898 |
Exactly. So on the pynvim side explicit errors should be raised as in # python (using pynvim APIs)
vim.request('nvim_call_function', 'luaeval', [ "function() end" ])
vim.request('nvim_call_function', 'eval', [ "function('has')" ])
vim.funcs.eval("function('has')") returns null ( |
None
None
:python3 vim.funcs.luaeval(...)
callsvim.call("luaeval", ...)
, which then callsnvim_call_function('luaeval', [...])
via RPC, i.e.vim.request('nvim_call_function', 'luaeval', [...])
.Below tested with nvim 0.10.x nightly (as of 11/28/2023) and pynvim 0.5.0 nightly (and 0.4.3).
Primitives are OK:
Functions are not:
and hence modules:
which should instead throw an error if conversion is not possible. Ideally it may return some "proxy" callable that delegates to the target lua function via RPC.
Also, the following seems to be neovim core's bug (or a lack of feature):
The text was updated successfully, but these errors were encountered: