fix: Fixing the nvim-dap configuration setup to properly install the
python debugpy debugger and set it up for use.
This commit is contained in:
parent
8cd0bcbb66
commit
6c228e4b4b
@ -19,7 +19,7 @@ require('lazy').setup({
|
|||||||
require('plugins/gruvbox'),
|
require('plugins/gruvbox'),
|
||||||
require('plugins/comment'),
|
require('plugins/comment'),
|
||||||
require('plugins/dap'),
|
require('plugins/dap'),
|
||||||
require('plugins/dap-python'),
|
-- require('plugins/dap-python'),
|
||||||
require('plugins/treesitter'),
|
require('plugins/treesitter'),
|
||||||
require('plugins/gitsigns'),
|
require('plugins/gitsigns'),
|
||||||
require('plugins/luasnip'),
|
require('plugins/luasnip'),
|
||||||
|
|||||||
@ -1,6 +1,9 @@
|
|||||||
return {
|
return {
|
||||||
'mfussenegger/nvim-dap',
|
'mfussenegger/nvim-dap',
|
||||||
dependencies = {
|
dependencies = {
|
||||||
|
{
|
||||||
|
'jay-babu/mason-nvim-dap.nvim'
|
||||||
|
},
|
||||||
{
|
{
|
||||||
'nvim-neotest/nvim-nio',
|
'nvim-neotest/nvim-nio',
|
||||||
},
|
},
|
||||||
@ -48,12 +51,6 @@ return {
|
|||||||
render = {
|
render = {
|
||||||
max_type_length = nil,
|
max_type_length = nil,
|
||||||
},
|
},
|
||||||
ensure_installed = {
|
|
||||||
'codelldb',
|
|
||||||
'cpptools',
|
|
||||||
'debugpy',
|
|
||||||
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
@ -65,15 +62,32 @@ return {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
config = function()
|
config = function()
|
||||||
|
local mason_dap = require('mason-nvim-dap')
|
||||||
local dap, dapui = require('dap'), require('dapui')
|
local dap, dapui = require('dap'), require('dapui')
|
||||||
|
|
||||||
dap.listeners.after.event_initialized['dapui_config'] = function()
|
mason_dap.setup({
|
||||||
|
ensure_installed = {
|
||||||
|
'codelldb',
|
||||||
|
'debugpy',
|
||||||
|
},
|
||||||
|
automatic_installation = true,
|
||||||
|
handlers = {
|
||||||
|
function(config)
|
||||||
|
require('mason-nvim-dap').default_setup(config)
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
dap.listeners.before.attach.dapui_config = function()
|
||||||
dapui.open()
|
dapui.open()
|
||||||
end
|
end
|
||||||
dap.listeners.after.event_terminated['dapui_config'] = function()
|
dap.listeners.before.launch.dapui_config = function()
|
||||||
|
dapui.open()
|
||||||
|
end
|
||||||
|
dap.listeners.before.event_terminated.dapui_config = function()
|
||||||
dapui.close()
|
dapui.close()
|
||||||
end
|
end
|
||||||
dap.listeners.before.event_exited['dapui_config'] = function()
|
dap.listeners.before.event_exited.dapui_config = function()
|
||||||
dapui.close()
|
dapui.close()
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -99,17 +113,35 @@ return {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dap.configurations = {
|
dap.configurations = {
|
||||||
-- rust = {
|
rust = {
|
||||||
-- {
|
{
|
||||||
-- type = 'gdb',
|
type = 'gdb',
|
||||||
-- name = 'Debug',
|
name = 'Debug',
|
||||||
-- request = 'launch',
|
request = 'launch',
|
||||||
-- program = function()
|
program = function()
|
||||||
-- return vim.fn.getcwd() .. '/target/debug/faultybranches'
|
return vim.fn.getcwd() .. '/target/debug/faultybranches'
|
||||||
-- end,
|
end,
|
||||||
-- stopAtBeginningOfMainSubprogram = true,
|
stopAtBeginningOfMainSubprogram = true,
|
||||||
-- },
|
},
|
||||||
-- },
|
},
|
||||||
|
python = {
|
||||||
|
{
|
||||||
|
type = 'python',
|
||||||
|
request = 'launch',
|
||||||
|
name = 'Launch file',
|
||||||
|
program = '${file}',
|
||||||
|
pythonPath = function()
|
||||||
|
local cwd = vim.fn.getcwd()
|
||||||
|
if vim.fn.executable(cwd .. '/venv/bin/python') == 1 then
|
||||||
|
return cwd .. '/venv/bin/python'
|
||||||
|
elseif vim.fn.executable(cwd .. '/.venv/bin/python') == 1 then
|
||||||
|
return cwd .. '/.venv/bin/python'
|
||||||
|
else
|
||||||
|
return '/usr/bin/python'
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
require('dap.ext.vscode').load_launchjs('.launch.json', {})
|
require('dap.ext.vscode').load_launchjs('.launch.json', {})
|
||||||
|
|||||||
@ -121,7 +121,6 @@ return {
|
|||||||
end,
|
end,
|
||||||
dependencies = {
|
dependencies = {
|
||||||
'mason-org/mason-lspconfig.nvim',
|
'mason-org/mason-lspconfig.nvim',
|
||||||
'jay-babu/mason-nvim-dap.nvim',
|
|
||||||
},
|
},
|
||||||
lazy = false,
|
lazy = false,
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user