fixed access to a local function
This commit is contained in:
parent
f7536e94ae
commit
c8bbbe4057
@ -1,5 +1,29 @@
|
|||||||
dap = require('dap')
|
dap = require('dap')
|
||||||
|
|
||||||
|
local function getPythonEnv()
|
||||||
|
local venv = os.getenv("VIRTUAL_ENV")
|
||||||
|
if venv ~= nil then
|
||||||
|
return string.format("%s/%s", venv, getVenvSuffix())
|
||||||
|
end
|
||||||
|
local conda = os.getenv("CONDA_PREFIX")
|
||||||
|
if conda ~= nil then
|
||||||
|
return string.format("%s/%s", conda, 'python.exe')
|
||||||
|
end
|
||||||
|
|
||||||
|
local cwd = vim.fn.getcwd()
|
||||||
|
if vim.fn.executable(cwd .. '/venv/' .. getVenvSuffix()) == 1 then
|
||||||
|
return cwd .. '/venv/' .. getVenvSuffix()
|
||||||
|
elseif vim.fn.executable(cwd .. '/.venv/' .. getVenvSuffix()) == 1 then
|
||||||
|
return cwd .. '/.venv/' .. getVenvSuffix()
|
||||||
|
else
|
||||||
|
if vim.loop.os_uname().sysname == 'Linux' then
|
||||||
|
return '/usr/bin/python'
|
||||||
|
elseif vim.loop.os_uname().sysname == 'Windows_NT' then
|
||||||
|
return os.getenv('SCOOP') .. '/apps/python/current/python.exe'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local function loadConfigs ()
|
local function loadConfigs ()
|
||||||
require('dap.ext.vscode').load_launchjs()
|
require('dap.ext.vscode').load_launchjs()
|
||||||
-- Make sure we use the correct python env even for the configs from launch.json
|
-- Make sure we use the correct python env even for the configs from launch.json
|
||||||
@ -51,30 +75,6 @@ dap.listeners.before.event_exited["dapui_config"] = function()
|
|||||||
dapui.close()
|
dapui.close()
|
||||||
end
|
end
|
||||||
|
|
||||||
local function getPythonEnv()
|
|
||||||
local venv = os.getenv("VIRTUAL_ENV")
|
|
||||||
if venv ~= nil then
|
|
||||||
return string.format("%s/%s", venv, getVenvSuffix())
|
|
||||||
end
|
|
||||||
local conda = os.getenv("CONDA_PREFIX")
|
|
||||||
if conda ~= nil then
|
|
||||||
return string.format("%s/%s", conda, 'python.exe')
|
|
||||||
end
|
|
||||||
|
|
||||||
local cwd = vim.fn.getcwd()
|
|
||||||
if vim.fn.executable(cwd .. '/venv/' .. getVenvSuffix()) == 1 then
|
|
||||||
return cwd .. '/venv/' .. getVenvSuffix()
|
|
||||||
elseif vim.fn.executable(cwd .. '/.venv/' .. getVenvSuffix()) == 1 then
|
|
||||||
return cwd .. '/.venv/' .. getVenvSuffix()
|
|
||||||
else
|
|
||||||
if vim.loop.os_uname().sysname == 'Linux' then
|
|
||||||
return '/usr/bin/python'
|
|
||||||
elseif vim.loop.os_uname().sysname == 'Windows_NT' then
|
|
||||||
return os.getenv('SCOOP') .. '/apps/python/current/python.exe'
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
dap.configurations.python = {
|
dap.configurations.python = {
|
||||||
{
|
{
|
||||||
type = 'python';
|
type = 'python';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user