You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
port=assert(port, "`connect.port` is required for a python `attach` configuration"),
19
+
host=host,
20
+
options= { source_filetype="python" },
21
+
})
22
+
else
23
+
callback({
24
+
type="executable",
25
+
command=debugpy,
26
+
options= { source_filetype="python" },
27
+
})
28
+
end
29
+
end
30
+
dap.configurations.python= {
31
+
{
32
+
-- The first three options are required by nvim-dap
33
+
type="python", -- the type here established the link to the adapter definition: `dap.adapters.python`
34
+
request="launch",
35
+
name="Launch file",
36
+
-- Options below are for debugpy, see https://github.com/microsoft/debugpy/wiki/Debug-configuration-settings for supported options
37
+
program="${file}", -- This configuration will launch the current file if used.
38
+
pythonPath=function()
39
+
ifnotis_empty(vim.env.CONDA_PREFIX) then
40
+
returnvim.env.CONDA_PREFIX.."/bin/python"
41
+
else
42
+
return"python3"
43
+
end
44
+
end,
45
+
},
46
+
}
47
+
48
+
-- NOTE: This setting is for people using venv
49
+
-- pythonPath = function()
50
+
-- -- debugpy supports launching an application with a different interpreter then the one used to launch debugpy itself.
51
+
-- -- The code below looks for a `venv` or `.venv` folder in the current directly and uses the python within.
52
+
-- -- You could adapt this - to for example use the `VIRTUAL_ENV` environment variable.
53
+
-- local cwd, venv = vim.fn.getcwd(), os.getenv("VIRTUAL_ENV")
54
+
-- if venv and vim.fn.executable(venv .. "/bin/python") == 1 then
55
+
-- return venv .. "/bin/python"
56
+
-- elseif vim.fn.executable(cwd .. "/venv/bin/python") == 1 then
57
+
-- return cwd .. "/venv/bin/python"
58
+
-- elseif vim.fn.executable(cwd .. "/.venv/bin/python") == 1 then
0 commit comments