fix(python): ensure debugpy installed if using nvim-dap

This commit is contained in:
roc 2023-09-13 22:04:07 +08:00
parent a72a84972d
commit d073ece621

View file

@ -46,16 +46,25 @@ return {
"mfussenegger/nvim-dap", "mfussenegger/nvim-dap",
optional = true, optional = true,
dependencies = { dependencies = {
"mfussenegger/nvim-dap-python", {
-- stylua: ignore "mason.nvim",
keys = { opts = function(_, opts)
{ "<leader>dPt", function() require('dap-python').test_method() end, desc = "Debug Method" }, opts.ensure_installed = opts.ensure_installed or {}
{ "<leader>dPc", function() require('dap-python').test_class() end, desc = "Debug Class" }, vim.list_extend(opts.ensure_installed, { "debugpy" })
end,
},
{
"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()
local path = require("mason-registry").get_package("debugpy"):get_install_path()
require("dap-python").setup(path .. "/venv/bin/python")
end,
}, },
config = function()
local path = require("mason-registry").get_package("debugpy"):get_install_path()
require("dap-python").setup(path .. "/venv/bin/python")
end,
}, },
}, },
{ {