From c472f3ea46a5dd5f62bb12b5857e779ae0d74dc5 Mon Sep 17 00:00:00 2001 From: William Boman Date: Sat, 16 Apr 2022 01:43:09 +0200 Subject: fix(async): slightly better support for nested coroutine contexts (#600) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(async): only dispatch first failure in a.wait_all * add InstallContext:run_concurrently This is needed due to how multiple coroutine contexts are used in a hierchical structure, and the async coroutine dispatcher loses this hierchical context inside callback functions invoked via FFI (I… assume?). --- lua/nvim-lsp-installer/core/installer/init.lua | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lua/nvim-lsp-installer/core/installer/init.lua') diff --git a/lua/nvim-lsp-installer/core/installer/init.lua b/lua/nvim-lsp-installer/core/installer/init.lua index dc9143a2..888415f2 100644 --- a/lua/nvim-lsp-installer/core/installer/init.lua +++ b/lua/nvim-lsp-installer/core/installer/init.lua @@ -34,6 +34,7 @@ end function M.run_installer(context, installer) local thread = coroutine.create(installer) local step + local ret_val step = function(...) local ok, result = coroutine.resume(thread, ...) if not ok then @@ -43,9 +44,12 @@ function M.run_installer(context, installer) elseif coroutine.status(thread) == "suspended" then -- yield to parent coroutine step(coroutine.yield(result)) + else + ret_val = result end end step(context) + return ret_val end ---@async -- cgit v1.2.3-70-g09d2