feat(dap.lua): add configuration for dap and dap-ui plugins to enable debugging features in Neovim

feat(lsp-config.lua): configure python lsp using pylsp to provide language server capabilities for Python files
refactor(magma.lua): remove magma plugin configuration as it is no longer used
feat(mason.lua): add configuration for mason and mason-nvim-dap plugins to enable package management and debugging features in Neovim
refactor(init.lua): set maplocalleader to "\\" for easier keybindings
refactor(remap.lua): remove setting mapleader to " " as it is no longer needed, add keybinding for toggling file explorer using NvimTreeToggle command
This commit is contained in:
David Ibia
2024-01-03 01:13:50 +01:00
parent 589ab57da2
commit 68421c4615
10 changed files with 66 additions and 9 deletions

View File

@@ -0,0 +1,28 @@
local dap = require("dap")
local dapui = require("dapui")
local dap_python = require("dap-python")
dap.listeners.after.event_initialized["dapui_config"] = function()
dapui.open()
end
dap.listeners.before.event_terminated["dapui_config"] = function()
dapui.close()
end
dap.listeners.before.event_exited["dapui_config"] = function()
dapui.close()
end
local path = "~/.local/share/nvim/mason/packages/debugpy/venv/bin/python"
dap_python.setup(path)
-- Setup Mappings
local opts = { noremap = true, silent = true }
opts.desc = "Toggle breakpoint"
vim.keymap.set("n", "<leader>db", "<cmd> DapToggleBreakpoint<CR>", opts)
opts.desc = "Debug Python Run"
vim.keymap.set("n", "<leader>dpr", function()
dap_python.test_method()
end, opts)

View File

@@ -117,6 +117,13 @@ lspconfig["pyright"].setup({
on_attach = on_attach,
})
-- configure python lsp
lspconfig["pylsp"].setup({
capabilities = capabilities,
on_attach = on_attach,
})
-- configure docker server
lspconfig["dockerls"].setup({
capabilities = capabilities,

View File

@@ -14,3 +14,9 @@ require("mason-lspconfig").setup({
},
automatic_installation = true,
})
require("mason-nvim-dap").setup({
ensure_installed = {
"debugpy", -- python
},
automatic_installation = true,
})