-
Notifications
You must be signed in to change notification settings - Fork 120
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
Synchronous call initiated through a response of an async call drops the results of the sync call. #566
Comments
The code is only calling print() on the values. Maybe the printed message is not shown because of redraw? Try appending the GetData() results to a list, then check the contents of that list. |
Hi @justinmk, But I was able to fix the issue in a different way, but not sure if it just hides the real issue or if that is the real "usage" of the API The fix was to schedule all the work that is done in the function M.update(data)
vim.schedule(function()
print(vim.fn.GetData(data))
end)
end I think it makes sense since we first have to give up the current call state that was initiated by rpc call to process other rpc calls? |
Are you certain that
It's certainly tricky when the "call stack" is multiply-bidirectional. Thanks for providing this test case and info. This is something we should either document, detect, or actually support. |
Yes, following is the log output for the failing scenario (I have enabled some debug logs in pynvim as well)
|
I have created a sample plugin that recreates my issue below.
test_plugin/lua/test_plugin/init.lua
test_plugin/rplugin/python3/test_plugin.py
Here, when i call
lua require'test_plugin'.run()
I could see bothstart
andgetData
functions in python getting called twice but the return values of thegetData
function is never captured by the neovimAlso, if I remove one of the
vim.fn.Start
calls inrun()
function, everything works fine.Appreciate if someone can help me with this and check if I'm not using the
pynvim
apis incorrectlyThe text was updated successfully, but these errors were encountered: