1
0
Fork 1
Dotfiles_nvim/lua/editor/debugging.lua

118 lines
3.5 KiB
Lua
Raw Normal View History

2024-11-23 16:55:23 +00:00
local K = require('core.keymap')
2024-07-02 21:52:43 +00:00
return {
'mfussenegger/nvim-dap',
dependencies = {
'rcarriga/nvim-dap-ui',
'nvim-neotest/nvim-nio',
},
config = function()
-- Setup Debugging --
local dap = require('dap')
-- Open UI on Debugging --
local dapui = require('dapui')
dapui.setup({
layouts = {
{
elements = {
{ id = 'scopes', size = 0.65 },
{ id = 'breakpoints', size = 0.35 },
},
position = 'left',
size = 40,
},
{
elements = {
{ id = 'repl', size = 0.5 },
{ id = 'console', size = 0.5 },
},
position = 'bottom',
size = 10,
},
},
})
dap.listeners.before.attach.dapui_config = function() dapui.open() end
dap.listeners.before.launch.dapui_config = function() dapui.open() end
-- Keybinding --
vim.keymap.set(
2024-11-23 16:55:23 +00:00
K.DEBUGGING.TOGGLE_UI.mode,
K.DEBUGGING.TOGGLE_UI.shortcut,
2024-07-02 21:52:43 +00:00
dapui.toggle,
2024-11-23 16:55:23 +00:00
{ desc = K.DEBUGGING.TOGGLE_UI.dedescriptionn }
2024-07-02 21:52:43 +00:00
)
vim.keymap.set(
2024-11-23 16:55:23 +00:00
K.DEBUGGING.TOGGLE_BREAKPOINT.mode,
K.DEBUGGING.TOGGLE_BREAKPOINT.shortcut,
2024-07-02 21:52:43 +00:00
dap.toggle_breakpoint,
2024-11-23 16:55:23 +00:00
{ desc = K.DEBUGGING.TOGGLE_BREAKPOINT.dedescriptionn }
2024-07-02 21:52:43 +00:00
)
vim.keymap.set(
2024-11-23 16:55:23 +00:00
K.DEBUGGING.CONTINUE.mode,
K.DEBUGGING.CONTINUE.shortcut,
2024-07-02 21:52:43 +00:00
dap.continue,
2024-11-23 16:55:23 +00:00
{ desc = K.DEBUGGING.CONTINUE.dedescriptionn }
2024-07-02 21:52:43 +00:00
)
vim.keymap.set(
2024-11-23 16:55:23 +00:00
K.DEBUGGING.TERMINATE.mode,
K.DEBUGGING.TERMINATE.shortcut,
2024-07-02 21:52:43 +00:00
dap.terminate,
2024-11-23 16:55:23 +00:00
{ desc = K.DEBUGGING.TERMINATE.dedescriptionn }
2024-07-02 21:52:43 +00:00
)
vim.keymap.set(
2024-11-23 16:55:23 +00:00
K.DEBUGGING.STEP_OVER.mode,
K.DEBUGGING.STEP_OVER.shortcut,
2024-07-02 21:52:43 +00:00
dap.step_over,
2024-11-23 16:55:23 +00:00
{ desc = K.DEBUGGING.STEP_OVER.dedescriptionn }
2024-07-02 21:52:43 +00:00
)
-- Breakpoints --
vim.api.nvim_set_hl(
0,
'DapBreakpoint',
{ ctermbg = 0, fg = '#993939', bg = '#31353f' }
)
vim.api.nvim_set_hl(
0,
'DapLogPoint',
{ ctermbg = 0, fg = '#61afef', bg = '#31353f' }
)
vim.api.nvim_set_hl(
0,
'DapStopped',
{ ctermbg = 0, fg = '#98c379', bg = '#31353f' }
)
vim.fn.sign_define('DapBreakpoint', {
text = '',
texthl = 'DapBreakpoint',
linehl = 'DapBreakpoint',
numhl = 'DapBreakpoint',
})
vim.fn.sign_define('DapBreakpointCondition', {
text = '󰣏',
texthl = 'DapBreakpoint',
linehl = 'DapBreakpoint',
numhl = 'DapBreakpoint',
})
vim.fn.sign_define('DapBreakpointRejected', {
text = '',
texthl = 'DapBreakpoint',
linehl = 'DapBreakpoint',
numhl = 'DapBreakpoint',
})
vim.fn.sign_define('DapLogPoint', {
text = '',
texthl = 'DapLogPoint',
linehl = 'DapLogPoint',
numhl = 'DapLogPoint',
})
vim.fn.sign_define('DapStopped', {
text = '',
texthl = 'DapStopped',
linehl = 'DapStopped',
numhl = 'DapStopped',
})
end,
}