fix: must not be called in a lua loop (#876)

This commit is contained in:
yetone 2024-11-20 01:29:55 +08:00 committed by GitHub
parent 5dd42548d4
commit 56ebcad7a8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -347,6 +347,8 @@ end
---@param opts StreamOptions ---@param opts StreamOptions
M.stream = function(opts) M.stream = function(opts)
if opts.on_chunk ~= nil then opts.on_chunk = vim.schedule_wrap(opts.on_chunk) end
if opts.on_complete ~= nil then opts.on_complete = vim.schedule_wrap(opts.on_complete) end
local Provider = opts.provider or P[Config.provider] local Provider = opts.provider or P[Config.provider]
if Config.dual_boost.enabled then if Config.dual_boost.enabled then
M._dual_boost_stream(opts, Provider, P[Config.dual_boost.first_provider], P[Config.dual_boost.second_provider]) M._dual_boost_stream(opts, Provider, P[Config.dual_boost.first_provider], P[Config.dual_boost.second_provider])