fixed dap python config
This commit is contained in:
parent
988db59976
commit
652a1c2aa7
@ -6,18 +6,19 @@ vim.keymap.set('n', '<F9>', ":lua require('dap').toggle_breakpoint()<CR>", opts)
|
|||||||
vim.keymap.set('n', '<F10>', ":lua require('dap').step_over()<CR>", opts)
|
vim.keymap.set('n', '<F10>', ":lua require('dap').step_over()<CR>", opts)
|
||||||
vim.keymap.set('n', '<F11>', ":lua require('dap').step_into()<CR>", opts)
|
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)
|
vim.keymap.set('n', '<S-F11>', ":lua require('dap').step_out()<CR>", opts)
|
||||||
-- vim.keymap.set('n', '<F10>', dap.step_over(), opts)
|
|
||||||
-- vim.keymap.set('n', '<F11>', dap.step_into(), opts)
|
|
||||||
-- vim.keymap.set('n', '<S-F11>', dap.step_out(), opts)
|
|
||||||
|
|
||||||
-- dap.adapters.python = {
|
local initDir = vim.api.nvim_list_runtime_paths()[1]
|
||||||
-- type = 'executable';
|
|
||||||
-- command = 'C:\\Users\\oli\\AppData\\Local\\nvim\\venv_debugpy\\Scripts\\python';
|
-- PYTHON
|
||||||
-- args = { '-m', 'debugpy.adapter' };
|
dap.adapters.python = {
|
||||||
-- options = {
|
type = 'executable';
|
||||||
-- detached = true;
|
command = initDir .. '/venv_debugpy/Scripts/python';
|
||||||
-- };
|
args = { '-m', 'debugpy.adapter' };
|
||||||
-- }
|
options = {
|
||||||
|
detached = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
local dap, dapui = require("dap"), require("dapui")
|
local dap, dapui = require("dap"), require("dapui")
|
||||||
dap.listeners.after.event_initialized["dapui_config"] = function()
|
dap.listeners.after.event_initialized["dapui_config"] = function()
|
||||||
dapui.open()
|
dapui.open()
|
||||||
@ -29,7 +30,6 @@ dap.listeners.before.event_exited["dapui_config"] = function()
|
|||||||
dapui.close()
|
dapui.close()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local function getVenvSuffix()
|
local function getVenvSuffix()
|
||||||
if vim.loop.os_uname().sysname == 'Linux' then
|
if vim.loop.os_uname().sysname == 'Linux' then
|
||||||
return 'bin/python'
|
return 'bin/python'
|
||||||
@ -38,11 +38,10 @@ local function getVenvSuffix()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function getPythonEnv()
|
local function getPythonEnv()
|
||||||
|
|
||||||
local venv = os.getenv("VIRTUAL_ENV")
|
local venv = os.getenv("VIRTUAL_ENV")
|
||||||
if venv ~= nil then
|
if venv ~= nil then
|
||||||
return string.format("%s\\bin\\python.exe",venv)
|
return string.format("%s\\bin\\python.exe", venv)
|
||||||
end
|
end
|
||||||
|
|
||||||
local cwd = vim.fn.getcwd()
|
local cwd = vim.fn.getcwd()
|
||||||
@ -66,25 +65,45 @@ dap.configurations.python = {
|
|||||||
name = "Launch file with venv";
|
name = "Launch file with venv";
|
||||||
justMyCode = false;
|
justMyCode = false;
|
||||||
program = "${file}";
|
program = "${file}";
|
||||||
pythonPath = getPythonEnv();
|
pythonPath = function()
|
||||||
|
return getPythonEnv()
|
||||||
|
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\\venv_debugpy\\Scripts\\python')
|
||||||
table.insert(require('dap').configurations.python, {
|
-- table.insert(require('dap').configurations.python, {
|
||||||
-- type = 'python',
|
-- -- type = 'python',
|
||||||
-- request = 'launch',
|
-- -- request = 'launch',
|
||||||
-- name = 'My custom launch configuration',
|
-- -- name = 'My custom launch configuration',
|
||||||
-- program = '${file}',
|
-- -- program = '${file}',
|
||||||
justMyCode = false
|
-- justMyCode = false
|
||||||
-- ... more options, see https://github.com/microsoft/debugpy/wiki/Debug-configuration-settings
|
-- -- ... more options, see https://github.com/microsoft/debugpy/wiki/Debug-configuration-settings
|
||||||
})
|
-- })
|
||||||
-- 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')
|
||||||
|
|
||||||
|
-- CPP
|
||||||
|
dap.adapters.codelldb = {
|
||||||
|
type = 'server',
|
||||||
|
port = "${port}",
|
||||||
|
executable = {
|
||||||
|
-- CHANGE THIS to your path!
|
||||||
|
command = '/absolute/path/to/codelldb/extension/adapter/codelldb',
|
||||||
|
args = { '--port', '${port}' },
|
||||||
|
|
||||||
|
-- On windows you may have to uncomment this:
|
||||||
|
-- detached = false,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
-- EXTENSIONS
|
||||||
|
|
||||||
require("nvim-dap-virtual-text").setup()
|
require("nvim-dap-virtual-text").setup()
|
||||||
require('telescope').load_extension('dap')
|
require('telescope').load_extension('dap')
|
||||||
require("cmp").setup.filetype({ "dap-repl", "dapui_watches" }, {
|
-- require("cmp").setup.filetype({ "dap-repl", "dapui_watches" }, {
|
||||||
sources = {
|
-- sources = {
|
||||||
{ name = "dap" },
|
-- { name = "dap" },
|
||||||
},
|
-- },
|
||||||
})
|
-- })
|
||||||
require("dapui").setup()
|
require("dapui").setup()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user