re-organised config
This commit is contained in:
59
lua/plugins/dap/init.lua
Normal file
59
lua/plugins/dap/init.lua
Normal file
@ -0,0 +1,59 @@
|
||||
local view = require 'plugins.dap.dap-view'
|
||||
return {
|
||||
{
|
||||
'mfussenegger/nvim-dap',
|
||||
dependencies = {
|
||||
'theHamsta/nvim-dap-virtual-text',
|
||||
'leoluz/nvim-dap-go',
|
||||
view.get_config(),
|
||||
},
|
||||
ft = { 'go' },
|
||||
event = 'LspAttach',
|
||||
keys = {
|
||||
{ '<F7>', '<cmd>DapStepInto<cr>' },
|
||||
{ '<F8>', '<cmd>DapContinue<cr>' },
|
||||
{ '<F9>', '<cmd>DapStepOver<cr>' },
|
||||
{
|
||||
'<leader>dt',
|
||||
function()
|
||||
require('dap-go').debug_test()
|
||||
end,
|
||||
desc = 'Debug closest go test',
|
||||
},
|
||||
},
|
||||
config = function()
|
||||
require('dap').set_log_level 'TRACE'
|
||||
require('nvim-dap-virtual-text').setup {}
|
||||
|
||||
local dir = vim.fn.getcwd(0)
|
||||
local file = vim.fn.glob(dir .. '/launch.json')
|
||||
local prj_confs = {}
|
||||
if file ~= '' then
|
||||
local contents = vim.fn.readblob(dir .. '/launch.json')
|
||||
prj_confs = vim.json.decode(contents)
|
||||
end
|
||||
|
||||
local all_confs = prj_confs.configurations or {}
|
||||
local global_confs = require 'plugins.dap.configurations'
|
||||
for _, conf in ipairs(global_confs) do
|
||||
table.insert(all_confs, conf)
|
||||
end
|
||||
|
||||
require('dap-go').setup {
|
||||
dap_configurations = all_confs,
|
||||
}
|
||||
end,
|
||||
},
|
||||
{
|
||||
'weissle/persistent-breakpoints.nvim',
|
||||
ft = { 'go' },
|
||||
opts = {
|
||||
load_breakpoints_event = { 'BufReadPost' },
|
||||
},
|
||||
keys = {
|
||||
{ '<leader>db', '<cmd>PBToggleBreakpoint<cr>', desc = 'Toggle breakpoint' },
|
||||
{ '<leader>dB', '<cmd>PBSetConditionalBreakpoint<cr>', desc = 'Set conditional breakpoint' },
|
||||
{ '<leader>dl', '<cmd>PBSetLogPoint<cr>', desc = 'Set log point' },
|
||||
},
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user