refactor(lua): move vim.wait into runtime Lua

Move vim.wait into runtime/lua/vim/_core/editor.lua and replace
the C entrypoint with narrow vim._core helpers for polling, UI
flushing, and interrupt checks.

Keep the existing interval semantics by retaining the dummy timer that
wakes the loop while it is otherwise idle.

Update the docs to describe the success return values correctly, and
adjust the test expectation for the new vim.validate() callback error.

AI-assisted: Codex
This commit is contained in:
Lewis Russell
2026-03-01 12:05:59 +00:00
committed by Lewis Russell
parent 4431713285
commit c822a2657c
5 changed files with 233 additions and 226 deletions

View File

@@ -2371,10 +2371,9 @@ describe('lua stdlib', function()
end)
it('callback must be a function', function()
eq(
{ false, 'vim.wait: callback must be callable' },
exec_lua [[return {pcall(function() vim.wait(1000, 13) end)}]]
)
local result = exec_lua [[return {pcall(function() vim.wait(1000, 13) end)}]]
eq(false, result[1])
matches('callback: expected callable, got number$', remove_trace(result[2]))
end)
it('waits if callback arg is nil', function()