Skip to content

Commit

Permalink
fix(python): add protection against debugpy not being installed thr…
Browse files Browse the repository at this point in the history
…ough mason
  • Loading branch information
mehalter committed Jun 7, 2024
1 parent dcc61d6 commit 51eb1c1
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions lua/astrocommunity/pack/python/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,15 @@ return {
dependencies = "mfussenegger/nvim-dap",
ft = "python", -- NOTE: ft: lazy-load on filetype
config = function(_, opts)
local path = require("mason-registry").get_package("debugpy"):get_install_path()
if vim.fn.has "win32" == 1 then
path = path .. "/venv/Scripts/python"
else
path = path .. "/venv/bin/python"
local path = vim.fn.exepath "python"
local debugpy = require("mason-registry").get_package "debugpy"
if debugpy:is_installed() then
path = debugpy:get_install_path()
if vim.fn.has "win32" == 1 then
path = path .. "/venv/Scripts/python"
else
path = path .. "/venv/bin/python"
end
end
require("dap-python").setup(path, opts)
end,
Expand Down

0 comments on commit 51eb1c1

Please sign in to comment.