Update debug.lua

This commit is contained in:
SamPosh 2023-04-10 13:46:11 +05:30 committed by GitHub
parent 9676197298
commit eec712f877
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 19 additions and 1 deletions

View File

@ -82,5 +82,23 @@ return {
-- Install golang specific config -- Install golang specific config
require('dap-go').setup() require('dap-go').setup()
end, pythonPath = function()
--The below line will work for virtualenvwrapper, as vim.env.VIRTUAL_ENV points to the active env directory if you use it
--Test the variable by running :lua print(vim.env.VIRTUAL_ENV) and find your path from there if it is defined
if vim.env.VIRTUAL_ENV then return vim.env.VIRTUAL_ENV ..'/bin/python' end
-- debugpy supports launching an application with a different interpreter then the one used to launch debugpy itself.
-- The code below looks for a `venv` or `.venv` folder in the current directly and uses the python within.
-- You could adapt this - to for example use the `VIRTUAL_ENV` environment variable (done above).
local cwd = vim.fn.getcwd()
if vim.fn.executable(cwd .. '/venv/bin/python') == 1 then
return cwd .. '/venv/bin/python'
elseif vim.fn.executable(cwd .. '/.venv/bin/python') == 1 then
return cwd .. '/.venv/bin/python'
else
return '/usr/bin/python3'
end
end;
}
}
end,
} }