diff --git a/lua/dap.lua b/lua/dap.lua index 53f180fa..b05f51ca 100644 --- a/lua/dap.lua +++ b/lua/dap.lua @@ -461,7 +461,7 @@ local function select_config_and_run(opts) lazy.async.run(function() local all_configs = {} local co = coroutine.running() - for _, config_provider in pairs(M.providers.configs) do + for provider, config_provider in pairs(M.providers.configs) do local configs = config_provider(bufnr) if type(configs) == "thread" then assert( @@ -472,15 +472,21 @@ local function select_config_and_run(opts) coroutine.resume(configs, co) end) configs = coroutine.yield() - else + end + if islist(configs) then vim.list_extend(all_configs, configs) + else + local msg = "Configuration provider %s must return a list of configuration. Got: %s" + notify(msg:format(provider, vim.inspect(configs)), vim.log.levels.WARN) end end + if #all_configs == 0 then local msg = 'No configuration found for `%s`. You need to add configs to `dap.configurations.%s` (See `:h dap-configuration`)' notify(string.format(msg, filetype, filetype), vim.log.levels.INFO) return end + opts = opts or {} opts.filetype = opts.filetype or filetype lazy.ui.pick_if_many(