fix(dap): make sure mason-dap is loaded after initializing dap. See #3663
This commit is contained in:
@ -17,33 +17,7 @@ return {
|
|||||||
desc = "Debugging support. Requires language specific adapters to be configured. (see lang extras)",
|
desc = "Debugging support. Requires language specific adapters to be configured. (see lang extras)",
|
||||||
|
|
||||||
dependencies = {
|
dependencies = {
|
||||||
|
"rcarriga/nvim-dap-ui",
|
||||||
-- fancy UI for the debugger
|
|
||||||
{
|
|
||||||
"rcarriga/nvim-dap-ui",
|
|
||||||
dependencies = { "nvim-neotest/nvim-nio" },
|
|
||||||
-- stylua: ignore
|
|
||||||
keys = {
|
|
||||||
{ "<leader>du", function() require("dapui").toggle({ }) end, desc = "Dap UI" },
|
|
||||||
{ "<leader>de", function() require("dapui").eval() end, desc = "Eval", mode = {"n", "v"} },
|
|
||||||
},
|
|
||||||
opts = {},
|
|
||||||
config = function(_, opts)
|
|
||||||
local dap = require("dap")
|
|
||||||
local dapui = require("dapui")
|
|
||||||
dapui.setup(opts)
|
|
||||||
dap.listeners.after.event_initialized["dapui_config"] = function()
|
|
||||||
dapui.open({})
|
|
||||||
end
|
|
||||||
dap.listeners.before.event_terminated["dapui_config"] = function()
|
|
||||||
dapui.close({})
|
|
||||||
end
|
|
||||||
dap.listeners.before.event_exited["dapui_config"] = function()
|
|
||||||
dapui.close({})
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
|
|
||||||
-- virtual text for the debugger
|
-- virtual text for the debugger
|
||||||
{
|
{
|
||||||
"theHamsta/nvim-dap-virtual-text",
|
"theHamsta/nvim-dap-virtual-text",
|
||||||
@ -74,10 +48,12 @@ return {
|
|||||||
},
|
},
|
||||||
|
|
||||||
config = function()
|
config = function()
|
||||||
local Config = require("lazyvim.config")
|
-- trigger loading mason-nvim-dap
|
||||||
|
require("mason-nvim-dap")
|
||||||
|
|
||||||
vim.api.nvim_set_hl(0, "DapStoppedLine", { default = true, link = "Visual" })
|
vim.api.nvim_set_hl(0, "DapStoppedLine", { default = true, link = "Visual" })
|
||||||
|
|
||||||
for name, sign in pairs(Config.icons.dap) do
|
for name, sign in pairs(LazyVim.config.icons.dap) do
|
||||||
sign = type(sign) == "table" and sign or { sign }
|
sign = type(sign) == "table" and sign or { sign }
|
||||||
vim.fn.sign_define(
|
vim.fn.sign_define(
|
||||||
"Dap" .. name,
|
"Dap" .. name,
|
||||||
@ -94,6 +70,32 @@ return {
|
|||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
-- fancy UI for the debugger
|
||||||
|
{
|
||||||
|
"rcarriga/nvim-dap-ui",
|
||||||
|
dependencies = { "nvim-neotest/nvim-nio" },
|
||||||
|
-- stylua: ignore
|
||||||
|
keys = {
|
||||||
|
{ "<leader>du", function() require("dapui").toggle({ }) end, desc = "Dap UI" },
|
||||||
|
{ "<leader>de", function() require("dapui").eval() end, desc = "Eval", mode = {"n", "v"} },
|
||||||
|
},
|
||||||
|
opts = {},
|
||||||
|
config = function(_, opts)
|
||||||
|
local dap = require("dap")
|
||||||
|
local dapui = require("dapui")
|
||||||
|
dapui.setup(opts)
|
||||||
|
dap.listeners.after.event_initialized["dapui_config"] = function()
|
||||||
|
dapui.open({})
|
||||||
|
end
|
||||||
|
dap.listeners.before.event_terminated["dapui_config"] = function()
|
||||||
|
dapui.close({})
|
||||||
|
end
|
||||||
|
dap.listeners.before.event_exited["dapui_config"] = function()
|
||||||
|
dapui.close({})
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
-- mason.nvim integration
|
-- mason.nvim integration
|
||||||
{
|
{
|
||||||
"jay-babu/mason-nvim-dap.nvim",
|
"jay-babu/mason-nvim-dap.nvim",
|
||||||
|
@ -30,12 +30,6 @@ return {
|
|||||||
{
|
{
|
||||||
"mfussenegger/nvim-dap",
|
"mfussenegger/nvim-dap",
|
||||||
optional = true,
|
optional = true,
|
||||||
dependencies = {
|
|
||||||
"williamboman/mason.nvim",
|
|
||||||
opts = { ensure_installed = {
|
|
||||||
"php-debug-adapter",
|
|
||||||
} },
|
|
||||||
},
|
|
||||||
opts = function()
|
opts = function()
|
||||||
local dap = require("dap")
|
local dap = require("dap")
|
||||||
local path = require("mason-registry").get_package("php-debug-adapter"):get_install_path()
|
local path = require("mason-registry").get_package("php-debug-adapter"):get_install_path()
|
||||||
|
Reference in New Issue
Block a user