dotfiles/.config/nvim/lua/plugins/debugging.lua

90 lines
2.4 KiB
Lua
Raw Normal View History

return {
{
"mfussenegger/nvim-dap",
config = function()
local dap = require("dap")
vim.keymap.set("n", "<Leader>db", dap.toggle_breakpoint, { desc = "Toggle Breakpoint" })
vim.keymap.set("n", "<Leader>dc", dap.continue, { desc = "Start/Continue" })
vim.keymap.set("n", "<Leader>do", dap.step_over, { desc = "Step Over" })
vim.keymap.set("n", "<Leader>di", dap.step_into, { desc = "Step Into" })
vim.keymap.set("n", "<Leader>dt", dap.terminate, { desc = "Terminate Session" })
end,
},
{
"rcarriga/nvim-dap-ui",
dependencies = {
"mfussenegger/nvim-dap",
"mfussenegger/nvim-dap-python",
"nvim-neotest/nvim-nio",
},
config = function()
require("dapui").setup({
layouts = {
{
elements = {
{ id = "scopes", size = 0.5 },
{ id = "breakpoints", size = 0.25 },
--{ id = "stacks", size = 0.25 },
{ id = "watches", size = 0.25 },
},
size = 0.3,
position = "left",
},
{
elements = {
{ id = "console", size = 0.6 },
{ id = "repl", size = 0.4 },
},
size = 10,
position = "bottom",
},
},
})
require("dap-python").setup("uv")
local dap = require("dap")
dap.listeners.after.event_initialized["dapui_config"] = function()
require("dapui").open()
end
dap.listeners.before.event_terminated["dapui_config"] = function()
require("dapui").close()
end
dap.listeners.before.event_exited["dapui_config"] = function()
require("dapui").close()
end
end,
},
{
"linux-cultist/venv-selector.nvim",
branch = "regexp",
lazy = false,
dependencies = {
"neovim/nvim-lspconfig",
"mfussenegger/nvim-dap",
"mfussenegger/nvim-dap-python",
{ "nvim-telescope/telescope.nvim", branch = "0.1.x", dependencies = { "nvim-lua/plenary.nvim" } },
},
keys = {
{ "<Leader>ea", "<cmd>VenvSelect<cr>", desc = "Activate Virtual Environment" },
{ "<Leader>es", "<cmd>lua print(require('venv-selector').venv())<cr>", desc = "Show Active Virtual Environment" },
},
opts = {
search = {
vscode_venvs = {
command = "fdfind -p '.*/bin/python$' ~/VSCode/.venvs",
},
code_venvs = {
command = "fdfind -p '.*/bin/python$' ~/Code/.venvs",
},
},
post_set_venv = function()
local venv_path = require("venv-selector").get_active_path()
vim.env.PYTHONPATH = venv_path .. "/lib/python3.*/site-packages"
end
},
},
}