aboutsummaryrefslogtreecommitdiffstats
path: root/lua/nvim-lsp-installer/core/async/init.lua
diff options
context:
space:
mode:
authorWilliam Boman <william@redwill.se>2022-04-11 01:04:06 +0200
committerGitHub <noreply@github.com>2022-04-11 01:04:06 +0200
commit89abfcd2fbd56c3246772726a85ed0e548d77d3b (patch)
tree5a90c3277ee853fe6c1c04be09982b94472f45ab /lua/nvim-lsp-installer/core/async/init.lua
parentsumneko_lua: support Linux arm64 (#391) (diff)
downloadmason-89abfcd2fbd56c3246772726a85ed0e548d77d3b.tar
mason-89abfcd2fbd56c3246772726a85ed0e548d77d3b.tar.gz
mason-89abfcd2fbd56c3246772726a85ed0e548d77d3b.tar.bz2
mason-89abfcd2fbd56c3246772726a85ed0e548d77d3b.tar.lz
mason-89abfcd2fbd56c3246772726a85ed0e548d77d3b.tar.xz
mason-89abfcd2fbd56c3246772726a85ed0e548d77d3b.tar.zst
mason-89abfcd2fbd56c3246772726a85ed0e548d77d3b.zip
make install context available via coroutine context (#586)
Diffstat (limited to 'lua/nvim-lsp-installer/core/async/init.lua')
-rw-r--r--lua/nvim-lsp-installer/core/async/init.lua6
1 files changed, 5 insertions, 1 deletions
diff --git a/lua/nvim-lsp-installer/core/async/init.lua b/lua/nvim-lsp-installer/core/async/init.lua
index 0c278373..d448bc30 100644
--- a/lua/nvim-lsp-installer/core/async/init.lua
+++ b/lua/nvim-lsp-installer/core/async/init.lua
@@ -72,7 +72,11 @@ local function new_execution_context(suspend_fn, callback, ...)
end
local ok, promise_or_result = co.resume(thread, ...)
if ok then
- if getmetatable(promise_or_result) == Promise then
+ if co.status(thread) == "suspended" then
+ assert(
+ getmetatable(promise_or_result) == Promise,
+ "Expected Promise to have been yielded in async coroutine."
+ )
promise_or_result(step)
else
callback(true, promise_or_result)