Python debugging

This commit is contained in:
Zackarias Montell
2025-05-22 07:59:56 +02:00
parent 3a964ff800
commit d4af3a551d
3 changed files with 38 additions and 2 deletions

View File

@@ -576,7 +576,17 @@ require('lazy').setup({
},
-- C# Csharp
roslyn = {},
pylsp = {},
pylsp = {
settings = {
pylsp = {
plugins = {
pycodestyle = {
ignore = { 'E501' }, -- ignore line length, let black formatter manage this, sometimes lines must be long.
},
},
},
},
},
}
-- Ensure the servers and tools above are installed

View File

@@ -23,6 +23,7 @@
"nvim-dap-go": { "branch": "main", "commit": "8763ced35b19c8dc526e04a70ab07c34e11ad064" },
"nvim-dap-python": { "branch": "master", "commit": "261ce649d05bc455a29f9636dc03f8cdaa7e0e2c" },
"nvim-dap-ui": { "branch": "master", "commit": "73a26abf4941aa27da59820fd6b028ebcdbcf932" },
"nvim-dap-virtual-text": { "branch": "master", "commit": "df66808cd78b5a97576bbaeee95ed5ca385a9750" },
"nvim-lint": { "branch": "master", "commit": "fdb04e9285edefbe25a02a31a35e8fbb10fe054d" },
"nvim-lspconfig": { "branch": "master", "commit": "ac1dfbe3b60e5e23a2cff90e3bd6a3bc88031a57" },
"nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" },

View File

@@ -22,8 +22,11 @@ return {
'jay-babu/mason-nvim-dap.nvim',
-- Add your own debuggers here
'leoluz/nvim-dap-go',
'leoluz/nvim-dap-go', -- came pre-packaged with this
-- Python debugging
'mfussenegger/nvim-dap-python',
-- adds inline variables
'theHamsta/nvim-dap-virtual-text',
},
keys = {
-- Basic debugging keymaps, feel free to change to your liking!
@@ -69,6 +72,13 @@ return {
end,
desc = 'Debug: Set Breakpoint',
},
{
'<F6>',
function()
require('dap').disconnect { terminate = true }
end,
desc = 'Debug: See last session result.',
},
-- Toggle to see last session result. Without this, you can't see session output in case of unhandled exception.
{
'<F7>',
@@ -77,6 +87,13 @@ return {
end,
desc = 'Debug: See last session result.',
},
{
'<leader>de',
function()
require('dapui').eval(vim.fn.expand '<cword>')
end,
desc = 'Evaluate expression under cursor',
},
},
config = function()
local dap = require 'dap'
@@ -146,6 +163,14 @@ return {
detached = vim.fn.has 'win32' == 0,
},
}
-- Setup python debugging
require('dap-python').setup 'python'
-- Setup inline variables
require('nvim-dap-virtual-text').setup {
virt_text_pos = 'inline',
virt_lines = true,
highlight_changed_variables = true,
all_frames = false,
}
end,
}