Added python debugging configuration.

This commit is contained in:
bob-ross27 2023-10-10 11:45:28 -03:00
parent 8bb6154263
commit 621a1a728a
3 changed files with 18 additions and 36 deletions

View File

@ -6,7 +6,7 @@
"cheatsheet.nvim": { "branch": "master", "commit": "9716f9aaa94dd1fd6ce59b5aae0e5f25e2a463ef" }, "cheatsheet.nvim": { "branch": "master", "commit": "9716f9aaa94dd1fd6ce59b5aae0e5f25e2a463ef" },
"cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" }, "cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" },
"cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" }, "cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" },
"conform.nvim": { "branch": "master", "commit": "e75819642c36810a55a7235b6b5e16a5ce896ed3" }, "conform.nvim": { "branch": "master", "commit": "a94f686986631d5b97bd75b3877813c39de55c47" },
"dracula.nvim": { "branch": "main", "commit": "9fe831e685a76e1a1898a694623b33247c4d036c" }, "dracula.nvim": { "branch": "main", "commit": "9fe831e685a76e1a1898a694623b33247c4d036c" },
"fidget.nvim": { "branch": "main", "commit": "0ba1e16d07627532b6cae915cc992ecac249fb97" }, "fidget.nvim": { "branch": "main", "commit": "0ba1e16d07627532b6cae915cc992ecac249fb97" },
"friendly-snippets": { "branch": "main", "commit": "43727c2ff84240e55d4069ec3e6158d74cb534b6" }, "friendly-snippets": { "branch": "main", "commit": "43727c2ff84240e55d4069ec3e6158d74cb534b6" },
@ -22,7 +22,7 @@
"neodev.nvim": { "branch": "main", "commit": "f8592cc143a5512b98a2c3683aa43c73f98e34f7" }, "neodev.nvim": { "branch": "main", "commit": "f8592cc143a5512b98a2c3683aa43c73f98e34f7" },
"nvim-cmp": { "branch": "main", "commit": "5dce1b778b85c717f6614e3f4da45e9f19f54435" }, "nvim-cmp": { "branch": "main", "commit": "5dce1b778b85c717f6614e3f4da45e9f19f54435" },
"nvim-dap": { "branch": "master", "commit": "e79007c6d7a24db3ad19ea9196f1f0b2840e8ae7" }, "nvim-dap": { "branch": "master", "commit": "e79007c6d7a24db3ad19ea9196f1f0b2840e8ae7" },
"nvim-dap-go": { "branch": "main", "commit": "a5cc8dcad43f0732585d4793deb02a25c4afb766" }, "nvim-dap-python": { "branch": "master", "commit": "37b4cba02e337a95cb62ad1609b3d1dccb2e5d42" },
"nvim-dap-ui": { "branch": "master", "commit": "34160a7ce6072ef332f350ae1d4a6a501daf0159" }, "nvim-dap-ui": { "branch": "master", "commit": "34160a7ce6072ef332f350ae1d4a6a501daf0159" },
"nvim-lspconfig": { "branch": "master", "commit": "2b361e043810d5587d9af0787f8ce40da92ec5e9" }, "nvim-lspconfig": { "branch": "master", "commit": "2b361e043810d5587d9af0787f8ce40da92ec5e9" },
"nvim-treesitter": { "branch": "master", "commit": "a102053352bd958d84a3e1be3de0203d2af92984" }, "nvim-treesitter": { "branch": "master", "commit": "a102053352bd958d84a3e1be3de0203d2af92984" },

View File

@ -83,6 +83,7 @@ return {
ensure_installed = { ensure_installed = {
'black', 'black',
'stylua', 'stylua',
'debugpy',
}, },
}, },
}, },

View File

@ -1,10 +1,4 @@
-- debug.lua -- debug.lua
--
-- Shows how to use the DAP plugin to debug your code.
--
-- Primarily focused on configuring the debugger for Go, but can
-- be extended to other languages as well. That's why it's called
-- kickstart.nvim and not kitchen-sink.nvim ;)
return { return {
-- NOTE: Yes, you can install new plugins here! -- NOTE: Yes, you can install new plugins here!
@ -12,14 +6,23 @@ return {
-- NOTE: And you can specify dependencies as well -- NOTE: And you can specify dependencies as well
dependencies = { dependencies = {
-- Creates a beautiful debugger UI -- Creates a beautiful debugger UI
'rcarriga/nvim-dap-ui', {
'rcarriga/nvim-dap-ui',
opts = {},
},
-- Installs the debug adapters for you -- Installs the debug adapters for you
'williamboman/mason.nvim', 'williamboman/mason.nvim',
'jay-babu/mason-nvim-dap.nvim', 'jay-babu/mason-nvim-dap.nvim',
-- Add your own debuggers here -- Add your own debuggers here
'leoluz/nvim-dap-go', {
'mfussenegger/nvim-dap-python',
-- stylua: ignore
keys = {
{ "<leader>dPt", function() require('dap-python').test_method() end, desc = "Debug Method" },
{ "<leader>dPc", function() require('dap-python').test_class() end, desc = "Debug Class" },
},
},
}, },
config = function() config = function()
local dap = require 'dap' local dap = require 'dap'
@ -29,6 +32,7 @@ return {
-- Makes a best effort to setup the various debuggers with -- Makes a best effort to setup the various debuggers with
-- reasonable debug configurations -- reasonable debug configurations
automatic_setup = true, automatic_setup = true,
automatic_installation = true,
-- You can provide additional configuration to the handlers, -- You can provide additional configuration to the handlers,
-- see mason-nvim-dap README for more information -- see mason-nvim-dap README for more information
@ -38,7 +42,7 @@ return {
-- online, please don't ask me how to install them :) -- online, please don't ask me how to install them :)
ensure_installed = { ensure_installed = {
-- Update this to ensure that you have the debuggers for the langs you want -- Update this to ensure that you have the debuggers for the langs you want
'delve', 'debugpy',
}, },
} }
@ -52,28 +56,6 @@ return {
dap.set_breakpoint(vim.fn.input 'Breakpoint condition: ') dap.set_breakpoint(vim.fn.input 'Breakpoint condition: ')
end, { desc = 'Debug: Set Breakpoint' }) end, { desc = 'Debug: Set Breakpoint' })
-- Dap UI setup
-- For more information, see |:help nvim-dap-ui|
dapui.setup {
-- Set icons to characters that are more likely to work in every terminal.
-- Feel free to remove or use ones that you like more! :)
-- Don't feel like these are good choices.
icons = { expanded = '', collapsed = '', current_frame = '*' },
controls = {
icons = {
pause = '',
play = '',
step_into = '',
step_over = '',
step_out = '',
step_back = 'b',
run_last = '▶▶',
terminate = '',
disconnect = '',
},
},
}
-- Toggle to see last session result. Without this, you can't see session output in case of unhandled exception. -- Toggle to see last session result. Without this, you can't see session output in case of unhandled exception.
vim.keymap.set('n', '<F7>', dapui.toggle, { desc = 'Debug: See last session result.' }) vim.keymap.set('n', '<F7>', dapui.toggle, { desc = 'Debug: See last session result.' })
@ -81,7 +63,6 @@ return {
dap.listeners.before.event_terminated['dapui_config'] = dapui.close dap.listeners.before.event_terminated['dapui_config'] = dapui.close
dap.listeners.before.event_exited['dapui_config'] = dapui.close dap.listeners.before.event_exited['dapui_config'] = dapui.close
-- Install golang specific config require('dap-python').setup '~/.local/share/nvim/mason/packages/debugpy/venv/bin/python'
require('dap-go').setup()
end, end,
} }