Switch back to nvim-dap-ui from dap-view, additionally, add keybind for

opening a float with the console output
This commit is contained in:
Martin Lasson 2025-04-10 21:05:41 +02:00
parent c7fa377980
commit c8d77a36de
2 changed files with 44 additions and 7 deletions

View file

@ -21,7 +21,7 @@
"nvim-dap-go": { "branch": "main", "commit": "8763ced35b19c8dc526e04a70ab07c34e11ad064" }, "nvim-dap-go": { "branch": "main", "commit": "8763ced35b19c8dc526e04a70ab07c34e11ad064" },
"nvim-dap-python": { "branch": "master", "commit": "34282820bb713b9a5fdb120ae8dd85c2b3f49b51" }, "nvim-dap-python": { "branch": "master", "commit": "34282820bb713b9a5fdb120ae8dd85c2b3f49b51" },
"nvim-dap-repl-highlights": { "branch": "master", "commit": "a7512fc0a0de0c0be8d58983939856dda6f72451" }, "nvim-dap-repl-highlights": { "branch": "master", "commit": "a7512fc0a0de0c0be8d58983939856dda6f72451" },
"nvim-dap-view": { "branch": "main", "commit": "98cad74ffb527bfbb085f35b786b7402cabd9924" }, "nvim-dap-ui": { "branch": "master", "commit": "bc81f8d3440aede116f821114547a476b082b319" },
"nvim-dap-virtual-text": { "branch": "master", "commit": "df66808cd78b5a97576bbaeee95ed5ca385a9750" }, "nvim-dap-virtual-text": { "branch": "master", "commit": "df66808cd78b5a97576bbaeee95ed5ca385a9750" },
"nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" }, "nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" },
"nvim-surround": { "branch": "main", "commit": "caf6f633d4d77a29b6e265b560c5a035d171a913" }, "nvim-surround": { "branch": "main", "commit": "caf6f633d4d77a29b6e265b560c5a035d171a913" },

View file

@ -5,7 +5,30 @@ local is_debug_mode_active = false
return { return {
"mfussenegger/nvim-dap", "mfussenegger/nvim-dap",
dependencies = { dependencies = {
{ "igorlfs/nvim-dap-view", opts = {} }, {
"rcarriga/nvim-dap-ui",
opts = {
controls = {
enabled = false,
},
layouts = {
{
elements = {
{
id = "watches",
size = 0.5
},
{
id = "stacks",
size = 0.5
}
},
position = "bottom",
size = 15
}
},
}
},
-- Special adapters -- Special adapters
{ "leoluz/nvim-dap-go", opts = {} }, { "leoluz/nvim-dap-go", opts = {} },
{ "mfussenegger/nvim-dap-python", }, { "mfussenegger/nvim-dap-python", },
@ -27,8 +50,22 @@ return {
{ "m", function() dap.step_out() end }, { "m", function() dap.step_out() end },
{ "n", function() dap.step_over() end }, { "n", function() dap.step_over() end },
{ "i", function() dap.step_into() end }, { "i", function() dap.step_into() end },
} {
"<leader>dc",
function()
local columns = vim.o.columns
local lines = vim.o.lines
require("dapui").float_element("console", {
enter = true,
border = "rounded",
position = "center",
width = math.floor(columns * 0.8),
height = math.floor(lines * 0.6),
})
end
},
}
local dap_signs = { local dap_signs = {
{ "DapBreakpoint", { text = "🛑", texthl = "", linehl = "", numhl = "" } }, { "DapBreakpoint", { text = "🛑", texthl = "", linehl = "", numhl = "" } },
{ "DapBreakpointRejected", { text = "🔵", texthl = "", linehl = "", numhl = "" } }, { "DapBreakpointRejected", { text = "🔵", texthl = "", linehl = "", numhl = "" } },
@ -48,7 +85,7 @@ return {
is_debug_mode_active = true is_debug_mode_active = true
inlay_hints_handler.disable() inlay_hints_handler.disable()
require("dap-view").open() require("dapui").open()
end end
local function exit_debug_mode() local function exit_debug_mode()
@ -62,21 +99,21 @@ return {
inlay_hints_handler.restore() inlay_hints_handler.restore()
virtual_text.clear_virtual_text() virtual_text.clear_virtual_text()
require("dap-view").close() require("dapui").close()
end end
for _, request in ipairs({ for _, request in ipairs({
{ "attach", enter_debug_mode }, { "attach", enter_debug_mode },
{ "launch", enter_debug_mode }, { "launch", enter_debug_mode },
}) do }) do
dap.listeners.before[request[1]]["dapview"] = request[2] dap.listeners.before[request[1]]["dapui_config"] = request[2]
end end
for _, event in ipairs({ for _, event in ipairs({
{ "event_terminated", exit_debug_mode }, { "event_terminated", exit_debug_mode },
{ "event_exited", exit_debug_mode }, { "event_exited", exit_debug_mode },
}) do }) do
dap.listeners.after[event[1]]["dapview"] = event[2] dap.listeners.after[event[1]]["dapui_config"] = event[2]
end end
local function dap_stop() local function dap_stop()