From c9a2ff9699f49fcbf1f1103d2c8db59605d9f4eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hatvani=20Tam=C3=A1s?= Date: Wed, 4 Mar 2026 13:12:06 +0100 Subject: [PATCH] added c/c++ debugging plugin that uses codelldb --- lua/kickstart/plugins/debug.lua | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/lua/kickstart/plugins/debug.lua b/lua/kickstart/plugins/debug.lua index 3c92243..18c6527 100644 --- a/lua/kickstart/plugins/debug.lua +++ b/lua/kickstart/plugins/debug.lua @@ -124,6 +124,38 @@ return { }, } + dap.configurations.cpp = { + { + name = 'Auto-Debug Project (codelldb)', + type = 'codelldb', + request = 'launch', + program = function() + -- 1. Get the current working directory + local cwd = vim.fn.getcwd() + + -- 2. Extract the name of the root folder (e.g., "SakuraVNE") + local project_name = vim.fn.fnamemodify(cwd, ':t') + + -- 3. Construct your specific build path + local auto_path = cwd .. '/build/bin/Debug-linux-x86_64/' .. project_name .. '/' .. project_name + + -- 4. Check if it actually exists. If it does, run it instantly! + if vim.fn.filereadable(auto_path) == 1 then + return auto_path + end + + -- 5. Fallback: If it couldn't find it, pop open an input box so you can type it manually + return vim.fn.input('Path to executable: ', cwd .. '/build/bin/Debug-linux-x86_64/', 'file') + end, + cwd = '${workspaceFolder}', + stopOnEntry = false, + args = {}, -- Add command line arguments here if your engine ever needs them + }, + } + + -- Tell C to use the exact same configuration as C++ + dap.configurations.c = dap.configurations.cpp + require('mason-nvim-dap').setup { -- Makes a best effort to setup the various debuggers with -- reasonable debug configurations @@ -138,6 +170,7 @@ return { ensure_installed = { -- Update this to ensure that you have the debuggers for the langs you want 'delve', + 'codelldb', }, }