fix(lua): disallow vim.wait() in fast contexts

`vim.wait()` cannot be called in a fast callback since the main loop
cannot be run in that context as it is not reentrant

Fixes #26122
This commit is contained in:
Lewis Russell
2023-11-21 11:24:30 +00:00
committed by Lewis Russell
parent 6343d41436
commit 84bbe4b0ca
6 changed files with 29 additions and 8 deletions

View File

@@ -2769,6 +2769,19 @@ describe('lua stdlib', function()
eq({'notification', 'wait', {-2}}, next_msg(500))
end)
end)
it('should not run in fast callbacks #26122', function()
exec_lua([[
vim.uv.new_timer():start(0, 100, function()
local count = 0
vim.wait(100, function()
count = count + 1
return count == 10
end, 100)
end)
]])
assert_alive()
end)
end)
it('vim.notify_once', function()