update
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
-- plugins/dap.lua
|
||||
return {
|
||||
{
|
||||
"mfussenegger/nvim-dap",
|
||||
dependencies = {
|
||||
"rcarriga/nvim-dap-ui",
|
||||
"nvim-neotest/nvim-nio", -- wymagane przez dap-ui
|
||||
},
|
||||
config = function()
|
||||
local dap = require("dap")
|
||||
local dapui = require("dapui")
|
||||
|
||||
-- konfiguracja codelldb dla C++
|
||||
dap.adapters.codelldb = {
|
||||
type = "server",
|
||||
port = "${port}",
|
||||
executable = {
|
||||
command = vim.fn.stdpath("data") .. "/mason/bin/codelldb",
|
||||
args = { "--port", "${port}" },
|
||||
}
|
||||
}
|
||||
|
||||
dap.configurations.cpp = {
|
||||
{
|
||||
name = "Launch",
|
||||
type = "codelldb",
|
||||
request = "launch",
|
||||
program = function()
|
||||
-- pyta o ścieżkę do binarki przed debugowaniem
|
||||
return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/build/", "file")
|
||||
end,
|
||||
cwd = "${workspaceFolder}",
|
||||
stopOnEntry = true,
|
||||
stopAtEntry = true,
|
||||
}
|
||||
}
|
||||
|
||||
-- otwiera/zamyka UI automatycznie
|
||||
dap.listeners.after.event_initialized["dapui_config"] = function() dapui.open() end
|
||||
dap.listeners.before.event_terminated["dapui_config"] = function() dapui.close() end
|
||||
|
||||
-- bindy
|
||||
vim.keymap.set("n", "<F5>", dap.continue) -- start/continue
|
||||
vim.keymap.set("n", "<F10>", dap.step_over) -- następna linia
|
||||
vim.keymap.set("n", "<F11>", dap.step_into) -- wejdź w funkcję
|
||||
vim.keymap.set("n", "<F12>", dap.step_out) -- wyjdź z funkcji
|
||||
vim.keymap.set("n", "<leader>b", dap.toggle_breakpoint) -- breakpoint
|
||||
vim.keymap.set("n", "<leader>du", dapui.toggle) -- toggle UI
|
||||
|
||||
dapui.setup()
|
||||
end
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user