use debugpy from mason

This commit is contained in:
Oliver Hartmann 2022-08-13 14:04:07 +02:00
parent 652a1c2aa7
commit 41ce8f2063

View File

@ -8,11 +8,20 @@ vim.keymap.set('n', '<F11>', ":lua require('dap').step_into()<CR>", opts)
vim.keymap.set('n', '<S-F11>', ":lua require('dap').step_out()<CR>", opts)
local initDir = vim.api.nvim_list_runtime_paths()[1]
local masonpath = vim.fn.stdpath('data') .. '/mason'
-- PYTHON
local function getVenvSuffix()
if vim.loop.os_uname().sysname == 'Linux' then
return 'bin/python'
elseif vim.loop.os_uname().sysname == 'Windows_NT' then
return 'Scripts/python.exe'
end
end
dap.adapters.python = {
type = 'executable';
command = initDir .. '/venv_debugpy/Scripts/python';
command = masonpath .. '/packages/debugpy/venv/' .. getVenvSuffix();
args = { '-m', 'debugpy.adapter' };
options = {
detached = true;
@ -30,14 +39,6 @@ dap.listeners.before.event_exited["dapui_config"] = function()
dapui.close()
end
local function getVenvSuffix()
if vim.loop.os_uname().sysname == 'Linux' then
return 'bin/python'
elseif vim.loop.os_uname().sysname == 'Windows_NT' then
return 'Scripts/python.exe'
end
end
local function getPythonEnv()
local venv = os.getenv("VIRTUAL_ENV")
if venv ~= nil then