From ce8a897f985b2cfd1194f6c03fe5388f9bc6d6bf Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Tue, 25 Aug 2026 17:37:27 +0100 Subject: feat(lua): add vim.async Problem: Nvim has many Lua APIs that start callback-driven work: timers, jobs, libuv handles, and other event-loop tasks. Callers that need to sequence or cancel that work have to build their own coroutine wrappers, task bookkeeping, and cleanup rules. This makes async control flow hard to share, test, and document. Solution: Add `vim.async`, a structured-concurrency module vendored from async.nvim. It provides task handles, await/pawait helpers, sleep/timeout helpers, completion-order iteration, and semaphores on top of Nvim's event loop. The API follows the same broad model as Trio: async work has an owner, tasks are awaited explicitly, and cancellation is cooperative. Include generated vimdoc with an introductory overview and examples, a news entry, and functional tests for the new module. AI-assisted --- runtime/lua/vim/_meta.lua | 2 ++ 1 file changed, 2 insertions(+) (limited to 'runtime/lua/vim/_meta.lua') diff --git a/runtime/lua/vim/_meta.lua b/runtime/lua/vim/_meta.lua index 18dbe49c85..e285cd5a12 100644 --- a/runtime/lua/vim/_meta.lua +++ b/runtime/lua/vim/_meta.lua @@ -66,6 +66,8 @@ vim.uv = ... vim.F = require('vim.F') vim._watch = require('vim._watch') +---@diagnostic disable-next-line: no-unknown +vim.async = require('vim.async') vim.diagnostic = require('vim.diagnostic') vim.filetype = require('vim.filetype') vim.fs = require('vim.fs') -- cgit