first running verion of dab python

This commit is contained in:
Oliver Hartmann 2022-08-06 15:26:18 +02:00
parent 69b5cace69
commit 49f8494072
2 changed files with 37 additions and 30 deletions

1
.gitignore vendored
View File

@ -5,3 +5,4 @@ vim.bundle
plugged plugged
rplugin.vim rplugin.vim
plugin/packer_compiled.lua plugin/packer_compiled.lua
venv_debugpy

View File

@ -10,35 +10,41 @@ vim.keymap.set('n', '<S-F11>', ":lua require('dap').step_out()<CR>", opts)
-- vim.keymap.set('n', '<F11>', dap.step_into(), opts) -- vim.keymap.set('n', '<F11>', dap.step_into(), opts)
-- vim.keymap.set('n', '<S-F11>', dap.step_out(), opts) -- vim.keymap.set('n', '<S-F11>', dap.step_out(), opts)
dap.adapters.python = { -- dap.adapters.python = {
type = 'executable'; -- type = 'executable';
command = 'C:/Users/oli/AppData/Local/nvim-data/mason/packages/debugpy/venv/Scripts/python.exe'; -- command = 'C:\\Users\\oli\\AppData\\Local\\nvim\\venv_debugpy\\Scripts\\python';
args = { '-m', 'debugpy.adapter' }; -- args = { '-m', 'debugpy.adapter' };
} -- options = {
dap.configurations.python = { -- detached = true;
{ -- };
-- The first three options are required by nvim-dap -- }
type = 'python'; -- the type here established the link to the adapter definition: `dap.adapters.python` -- dap.configurations.python = {
request = 'launch'; -- {
name = "Launch file"; -- -- The first three options are required by nvim-dap
-- type = 'python'; -- the type here established the link to the adapter definition: `dap.adapters.python`
-- Options below are for debugpy, see https://github.com/microsoft/debugpy/wiki/Debug-configuration-settings for supported options -- request = 'launch';
-- name = "Launch file";
program = "${file}"; -- This configuration will launch the current file if used. --
pythonPath = function() -- -- Options below are for debugpy, see https://github.com/microsoft/debugpy/wiki/Debug-configuration-settings for supported options
-- 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. -- program = "${file}"; -- This configuration will launch the current file if used.
-- You could adapt this - to for example use the `VIRTUAL_ENV` environment variable. -- pythonPath = function()
local cwd = vim.fn.getcwd() -- -- debugpy supports launching an application with a different interpreter then the one used to launch debugpy itself.
if vim.fn.executable(cwd .. '/venv/bin/python') == 1 then -- -- The code below looks for a `venv` or `.venv` folder in the current directly and uses the python within.
return cwd .. '/venv/bin/python' -- -- You could adapt this - to for example use the `VIRTUAL_ENV` environment variable.
elseif vim.fn.executable(cwd .. '/.venv/bin/python') == 1 then -- local venv = os.getenv("VIRTUAL_ENV")
return cwd .. '/.venv/bin/python' -- return string.format("%s\\bin\\python.exe",venv)
else -- -- local cwd = vim.fn.getcwd()
return '/usr/bin/python' -- -- if vim.fn.executable(cwd .. '/venv/bin/python') == 1 then
end -- -- return cwd .. '/venv/bin/python'
end; -- -- elseif vim.fn.executable(cwd .. '/.venv/bin/python') == 1 then
}, -- -- return cwd .. '/.venv/bin/python'
} -- -- else
-- -- return '/usr/bin/python'
-- -- end
-- end;
-- },
-- }
require('dap-python').setup('C:\\Users\\oli\\AppData\\Local\\nvim\\venv_debugpy\\Scripts\\python')
-- require('dap-python').setup('C:/Users/oli/AppData/Local/nvim-data/mason/packages/debugpy/venv/Scripts/python.exe') -- require('dap-python').setup('C:/Users/oli/AppData/Local/nvim-data/mason/packages/debugpy/venv/Scripts/python.exe')