Add python dav config

This commit is contained in:
Thomas Avé 2024-11-09 02:13:41 +01:00
parent 73acd12859
commit aacdf026bd
2 changed files with 92 additions and 0 deletions

View File

@ -12,6 +12,7 @@
jre
python3
python311Packages.pip
python311Packages.debugpy
unzip
dotnet-sdk_8
cargo

View File

@ -0,0 +1,91 @@
return {
{
"mfussenegger/nvim-dap",
dependencies = {
"leoluz/nvim-dap-go",
'mfussenegger/nvim-dap-python',
"rcarriga/nvim-dap-ui",
"nvim-neotest/nvim-nio",
},
config = function()
local dap = require "dap"
require('dap.ext.vscode').load_launchjs("launch.json")
local ui = require "dapui"
require("dapui").setup({
layouts = {
{
elements = {
{
id = "breakpoints",
size = 0.5
},
{
id = "stacks",
size = 0.5
},
-- {
-- id = "watches",
-- size = 0.25
-- },
},
position = "left",
size = 25
},
{
elements = {
{
id = "scopes",
size = 1
},
},
position = "bottom",
size = 10
},
{
elements = {
{
id = "repl",
size = 1
},
},
position = "bottom",
size = 10
}
},
})
require("dap-go").setup()
-- require("dap-python").setup("/etc/profiles/per-user/user/bin/python3")
require("dap-python").setup("/home/user/Workspace/Trackbox/.devenv/state/venv/bin/python3")
vim.keymap.set("n", "<leader>b", dap.toggle_breakpoint)
vim.keymap.set("n", "<leader>gb", dap.run_to_cursor)
-- Eval var under cursor
vim.keymap.set("n", "<leader>?", function()
require("dapui").eval(nil, { enter = true })
end)
vim.keymap.set("n", "<F1>", dap.continue)
vim.keymap.set("n", "<F2>", dap.step_into)
vim.keymap.set("n", "<F3>", dap.step_over)
vim.keymap.set("n", "<F4>", dap.step_out)
vim.keymap.set("n", "<F5>", dap.step_back)
vim.keymap.set("n", "<F6>", dap.restart)
dap.listeners.before.attach.dapui_config = function()
ui.open()
end
dap.listeners.before.launch.dapui_config = function()
ui.open()
end
dap.listeners.before.event_terminated.dapui_config = function()
ui.close()
end
dap.listeners.before.event_exited.dapui_config = function()
ui.close()
end
end,
},
}