refactor: fix type annotations for adapters

This commit is contained in:
Steven Arcangeli 2023-08-20 17:50:25 +00:00
parent ff62fc28cd
commit 866085407f
7 changed files with 30 additions and 39 deletions

View file

@ -578,12 +578,14 @@ M.render_buffer_async = function(bufnr, opts, callback)
return
end
adapter.list(bufname, config.columns, function(err, has_more)
cache.begin_update_url(bufname)
adapter.list(bufname, config.columns, function(err, fetch_more)
loading.set_loading(bufnr, false)
if err then
cache.end_update_url(bufname)
handle_error(err)
return
elseif has_more then
elseif fetch_more then
local now = vim.loop.hrtime() / 1e6
local delta = now - start_ms
-- If we've been chugging for more than 40ms, go ahead and render what we have
@ -595,7 +597,9 @@ M.render_buffer_async = function(bufnr, opts, callback)
end)
end
first = false
vim.defer_fn(fetch_more, 4)
else
cache.end_update_url(bufname)
-- done iterating
finish()
end