Skip to content

Commit

Permalink
fixup! fixup! Add config providers; always load .vscode/launch.json
Browse files Browse the repository at this point in the history
  • Loading branch information
mfussenegger committed May 30, 2024
1 parent ad4409d commit e1cd0f8
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lua/dap.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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(
Expand Down

0 comments on commit e1cd0f8

Please sign in to comment.