Skip to content

Commit

Permalink
Add dap configuration provider
Browse files Browse the repository at this point in the history
  • Loading branch information
mfussenegger committed May 30, 2024
1 parent ad5ab1c commit 7a79081
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
23 changes: 23 additions & 0 deletions lua/jdtls/dap.lua
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,29 @@ function M.setup_dap(opts)
end
end
dap.adapters.java = start_debug_adapter

if dap.providers and dap.providers.configs then
dap.providers.configs["jdtls"] = function ()
local co = coroutine.running()
local resumed = false
vim.defer_fn(function()
if not resumed then
resumed = true
coroutine.resume(co, {})
vim.schedule(function()
vim.notify("Discovering main classes to debug took too long", vim.log.levels.INFO)
end)
end
end, 2000)
M.fetch_main_configs(nil, function(configs)
if not resumed then
resumed = true
coroutine.resume(co, configs)
end
end)
return coroutine.yield()
end
end
end
---@class JdtSetupDapOpts
---@field config_overrides JdtDapConfig These will be used as default overrides for |jdtls.dap.test_class|, |jdtls.dap.test_nearest_method| and discovered main classes
Expand Down
2 changes: 1 addition & 1 deletion lua/jdtls/setup.lua
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ local function extract_data_dir(bufnr)
end


---@param client lsp.Client
---@param client vim.lsp.Client
---@param opts jdtls.start.opts
local function add_commands(client, bufnr, opts)
local function create_cmd(name, command, cmdopts)
Expand Down

0 comments on commit 7a79081

Please sign in to comment.