mirror of
https://github.com/mfussenegger/nvim-dap
synced 2024-09-16 14:24:03 +02:00
Drop support for thread result from config provider
Makes the implementation a bit simpler. Given that the function is called from a coroutine it is still possible to use coroutine.running(), coroutine.resume() and coroutine.yield() within it for async operations.
This commit is contained in:
parent
ea8f6311b1
commit
f2042a4cad
1 changed files with 1 additions and 12 deletions
13
lua/dap.lua
13
lua/dap.lua
|
@ -266,7 +266,7 @@ M.adapters = {}
|
|||
M.configurations = {}
|
||||
|
||||
local providers = {
|
||||
---@type table<string, fun(bufnr: integer): thread|dap.Configuration[]>
|
||||
---@type table<string, fun(bufnr: integer): dap.Configuration[]>
|
||||
configs = {},
|
||||
|
||||
---@type table<string, fun(config: dap.Configuration):dap.Configuration>
|
||||
|
@ -474,22 +474,11 @@ local function select_config_and_run(opts)
|
|||
local filetype = vim.bo[bufnr].filetype
|
||||
lazy.async.run(function()
|
||||
local all_configs = {}
|
||||
local co = coroutine.running()
|
||||
local provider_keys = vim.tbl_keys(providers.configs)
|
||||
table.sort(provider_keys)
|
||||
for _, provider in ipairs(provider_keys) do
|
||||
local config_provider = providers.configs[provider]
|
||||
local configs = config_provider(bufnr)
|
||||
if type(configs) == "thread" then
|
||||
assert(
|
||||
coroutine.status(configs) == "suspended",
|
||||
"If configs provider returns a thread it must be suspended"
|
||||
)
|
||||
vim.schedule(function()
|
||||
coroutine.resume(configs, co)
|
||||
end)
|
||||
configs = coroutine.yield()
|
||||
end
|
||||
if islist(configs) then
|
||||
vim.list_extend(all_configs, configs)
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue