Feat: dap support codelldb

This commit is contained in:
flea 2024-02-07 16:53:10 +08:00
parent 6bd61248a2
commit 6e9cf88b96
1 changed files with 39 additions and 1 deletions

View File

@ -32,13 +32,51 @@ return {
-- You can provide additional configuration to the handlers, -- You can provide additional configuration to the handlers,
-- see mason-nvim-dap README for more information -- see mason-nvim-dap README for more information
handlers = {}, handlers = {
function(config)
require('mason-nvim-dap').default_setup(config)
end,
codelldb = function(config)
config.adapters = {
type = 'server',
host = 'localhost',
port = '${port}',
executable = {
command = 'codelldb',
args = {
'--port',
'${port}',
}
}
}
config.configurations = {
{
type = 'codelldb',
request = 'launch',
name = 'Launch file',
program = function()
return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file')
end,
cwd = '${workspaceFolder}'
},
{
type = 'codelldb',
request = 'attach',
name = 'Attach to process',
processId = require('dap.utils').pick_process,
cwd = '${workspaceFolder}',
}
}
require('mason-nvim-dap').default_setup(config)
end
},
-- You'll need to check that you have the required things installed -- You'll need to check that you have the required things installed
-- online, please don't ask me how to install them :) -- online, please don't ask me how to install them :)
ensure_installed = { ensure_installed = {
-- Update this to ensure that you have the debuggers for the langs you want -- Update this to ensure that you have the debuggers for the langs you want
'delve', 'delve',
'codelldb',
}, },
} }