1
0
Fork 0
chezmoi/dot_config/nvim/lua/configs/packages/dap.lua
2023-03-19 15:06:29 +01:00

115 lines
3.2 KiB
Lua

local ensure = {
'php-debug-adapter',
'netcoredbg'
}
return {
{
'mfussenegger/nvim-dap',
init = function()
for _, pkg in pairs(ensure) do
local p = require('mason-registry').get_package(pkg)
if not p:is_installed() then
p:install()
end
end
end,
dependencies = {
'rcarriga/nvim-dap-ui',
'williamboman/mason.nvim',
},
keys = {
{ '<F2>', function() require('dap').step_over() end },
{ '<F3>', function() require('dap').step_into() end },
{ '<F4>', function() require('dap').step_out() end },
{ '<F5>', function() require('dap').continue({}) end },
{ '<F10>', function() require('dap').toggle_breakpoint() end },
{ '<leader>DD', function() require('dapui').toggle() end },
{ '<leader>DE', function()
vim.ui.input({ prompt = 'DAP Evalulate expression: ' },
function(input)
require('dapui').eval(input)
end)
end, },
},
opts = {
cs = { -- {{{
adapter = {
type = 'executable',
command = 'netcoredbg',
args = { '--interpreter=vscode' },
},
confs ={
{
type = "cs",
name = "launch - netcoredbg",
request = "launch",
program = function()
return vim.fn.input('Path to dll', vim.fn.getcwd() .. '/bin/Debug/', 'file')
end,
},
}
}, --}}}
php = { -- {{{
adapter = {
type = 'executable',
command = 'node',
args = { vim.env.HOME .. '/.local/share/nvim/lazy/vscode-php-debug/out/phpDebug.js' },
},
confs = {
{
type = 'php',
request = 'launch',
name = 'Listen for Xdebug',
port = 9000,
},
},
}, -- }}}
},
config = function(_plug, opts)
-- signs - move to colorsheme? {{{
vim.fn.sign_define('DapBreakpoint', {
text = '⦿',
texthl = 'DiagnosticSignError',
linehl = '',
numhl = ''
})
vim.fn.sign_define('DapBreakpointCondition', {
text = '',
texthl = 'DiagnosticSignError',
linehl = '',
numhl = ''
})
vim.fn.sign_define('DapLogPoint', { text = '󱂅', texthl = '', linehl = '', numhl = '' })
vim.fn.sign_define('DapStopped', { text = '', texthl = 'DiagnosticSignOk', linehl = '', numhl = '' })
vim.fn.sign_define('DapBreakpointRejected', { text = '🛑', texthl = '', linehl = '', numhl = '' })
--- }}}
local dap = require('dap')
for lang, opt in pairs(opts) do
dap.configurations[lang] = opt.confs
dap.adapters[lang] = opt.adapter
end
local dapui = require('dapui')
dapui.setup()
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,
},
{
'leoluz/nvim-dap-go',
ft = 'go',
config = true,
},
}