130 lines
3.1 KiB
Lua
130 lines
3.1 KiB
Lua
return {
|
|
'mfussenegger/nvim-dap',
|
|
dependencies = {
|
|
-- Creates a beautiful debugger UI
|
|
'rcarriga/nvim-dap-ui',
|
|
|
|
-- Required dependency for nvim-dap-ui
|
|
'nvim-neotest/nvim-nio',
|
|
|
|
-- Installs the debug adapters for you
|
|
'mason-org/mason.nvim',
|
|
'jay-babu/mason-nvim-dap.nvim',
|
|
},
|
|
keys = {
|
|
-- Basic debugging keymaps, feel free to change to your liking!
|
|
{
|
|
'<F5>',
|
|
function()
|
|
require('dap').continue()
|
|
end,
|
|
desc = 'Debug: Start/Continue',
|
|
},
|
|
{
|
|
'<F1>',
|
|
function()
|
|
require('dap').step_into()
|
|
end,
|
|
desc = 'Debug: Step Into',
|
|
},
|
|
{
|
|
'<F2>',
|
|
function()
|
|
require('dap').step_over()
|
|
end,
|
|
desc = 'Debug: Step Over',
|
|
},
|
|
{
|
|
'<F3>',
|
|
function()
|
|
require('dap').step_out()
|
|
end,
|
|
desc = 'Debug: Step Out',
|
|
},
|
|
{
|
|
'<leader>b',
|
|
function()
|
|
require('dap').toggle_breakpoint()
|
|
end,
|
|
desc = 'Debug: Toggle Breakpoint',
|
|
},
|
|
{
|
|
'<leader>B',
|
|
function()
|
|
require('dap').set_breakpoint(vim.fn.input 'Breakpoint condition: ')
|
|
end,
|
|
desc = 'Debug: Set Breakpoint',
|
|
},
|
|
-- Toggle to see last session result. Without this, you can't see session output in case of unhandled exception.
|
|
{
|
|
'<F7>',
|
|
function()
|
|
require('dapui').toggle()
|
|
end,
|
|
desc = 'Debug: See last session result.',
|
|
},
|
|
},
|
|
config = function()
|
|
local dap = require 'dap'
|
|
local dapui = require 'dapui'
|
|
|
|
require('mason-nvim-dap').setup {
|
|
automatic_installation = true,
|
|
|
|
-- see mason-nvim-dap README for more information
|
|
handlers = {},
|
|
ensure_installed = {
|
|
'netcoredbg',
|
|
'codelldb',
|
|
},
|
|
}
|
|
|
|
-- Dap UI setup
|
|
-- For more information, see |:help nvim-dap-ui|
|
|
dapui.setup {
|
|
layouts = {
|
|
{
|
|
-- You can change the order of elements in the sidebar
|
|
elements = {
|
|
-- Provide IDs as strings or tables with "id" and "size" keys
|
|
{
|
|
id = 'scopes',
|
|
size = 0.35, -- Can be float or integer > 1
|
|
},
|
|
{ id = 'breakpoints', size = 0.25 },
|
|
{ id = 'stacks', size = 0.25 },
|
|
{ id = 'watches', size = 0.25 },
|
|
},
|
|
size = 40,
|
|
position = 'left', -- Can be "left" or "right"
|
|
},
|
|
{
|
|
elements = {
|
|
'repl',
|
|
'console',
|
|
},
|
|
size = 15,
|
|
position = 'bottom', -- Can be "bottom" or "top"
|
|
},
|
|
},
|
|
icons = { expanded = '▾', collapsed = '▸', current_frame = '*' },
|
|
controls = {
|
|
icons = {
|
|
pause = '⏸',
|
|
play = '▶',
|
|
step_into = '⏎',
|
|
step_over = '⏭',
|
|
step_out = '⏮',
|
|
step_back = 'b',
|
|
run_last = '▶▶',
|
|
terminate = '⏹',
|
|
disconnect = '⏏',
|
|
},
|
|
},
|
|
}
|
|
|
|
dap.listeners.after.event_initialized['dapui_config'] = dapui.open
|
|
dap.listeners.before.event_exited['dapui_config'] = dapui.close
|
|
end,
|
|
}
|