debug and problems

This commit is contained in:
Ali Can Zeybek
2026-02-08 12:54:03 +03:00
parent 5d208f102a
commit 412040b46d
12 changed files with 619 additions and 17 deletions

113
lua/plugins/config/dap.lua Normal file
View File

@@ -0,0 +1,113 @@
local dap = require("dap")
local dapui = require("dapui")
local function resolve_codelldb()
local mason_codelldb = vim.fn.stdpath("data") .. "/mason/bin/codelldb"
if vim.fn.executable(mason_codelldb) == 1 then
return mason_codelldb
end
local system_codelldb = vim.fn.exepath("codelldb")
if system_codelldb ~= "" then
return system_codelldb
end
return "codelldb"
end
require("nvim-dap-virtual-text").setup({
commented = true,
})
dap.adapters.codelldb = {
type = "server",
port = "${port}",
executable = {
command = resolve_codelldb(),
args = { "--port", "${port}" },
},
}
dap.configurations.cpp = {
{
name = "Launch file",
type = "codelldb",
request = "launch",
program = function()
return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/build/", "file")
end,
cwd = "${workspaceFolder}",
stopOnEntry = false,
args = function()
local input = vim.fn.input("Program args: ")
if input == "" then
return {}
end
return vim.split(input, " ")
end,
runInTerminal = false,
},
}
dap.configurations.c = dap.configurations.cpp
vim.fn.sign_define("DapBreakpoint", {
text = "",
texthl = "DiagnosticError",
linehl = "",
numhl = "",
})
vim.fn.sign_define("DapBreakpointCondition", {
text = "",
texthl = "DiagnosticWarn",
linehl = "",
numhl = "",
})
vim.fn.sign_define("DapLogPoint", {
text = "",
texthl = "DiagnosticInfo",
linehl = "",
numhl = "",
})
vim.fn.sign_define("DapStopped", {
text = "",
texthl = "DiagnosticOk",
linehl = "Visual",
numhl = "DiagnosticOk",
})
dapui.setup({
layouts = {
{
elements = {
{ id = "scopes", size = 0.30 },
{ id = "breakpoints", size = 0.20 },
{ id = "stacks", size = 0.25 },
{ id = "watches", size = 0.25 },
},
size = 45,
position = "left",
},
{
elements = {
{ id = "repl", size = 0.50 },
{ id = "console", size = 0.50 },
},
size = 12,
position = "bottom",
},
},
})
dap.listeners.after.event_initialized["dapui_config"] = function()
dapui.open()
end
dap.listeners.before.event_terminated["dapui_config"] = function()
dapui.close()
end
dap.listeners.before.event_exited["dapui_config"] = function()
dapui.close()
end
pcall(function()
require("telescope").load_extension("dap")
end)