summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lua/ache/lazy.lua5
-rw-r--r--lua/ache/plugins/dap/dap.lua144
-rw-r--r--lua/ache/plugins/dap/gdb.lua13
-rw-r--r--lua/ache/plugins/dap/nvim-nio.lua7
4 files changed, 167 insertions, 2 deletions
diff --git a/lua/ache/lazy.lua b/lua/ache/lazy.lua
index 1800f12..15fc610 100644
--- a/lua/ache/lazy.lua
+++ b/lua/ache/lazy.lua
@@ -22,8 +22,9 @@ vim.opt.rtp:prepend(lazypath)
require("lazy").setup({
{ import = "ache.plugins.themes" },
{ import = "ache.plugins" },
- { import = "ache.plugins.lsp" },
- { import = "ache.plugins.llm" },
+ { import = "ache.plugins.lsp" }, -- Load Language Server Protocol plugins for code completion, diagnostics and context aware actions.
+ { import = "ache.plugins.llm" }, -- Load Large Language Models related plugins (Mostly code completion)
+ { import = "ache.plugins.dap" }, -- Load debugging tools, Debug Adapter Protocol
}, {
checker = {
enabled = true,
diff --git a/lua/ache/plugins/dap/dap.lua b/lua/ache/plugins/dap/dap.lua
new file mode 100644
index 0000000..e466921
--- /dev/null
+++ b/lua/ache/plugins/dap/dap.lua
@@ -0,0 +1,144 @@
+--[
+--This plugin add support for Debug Adapter Protocol to connect to various debugger
+--
+-- C\C++ => gdb => via ...
+-- GoLang => delve => via nvim-dap-go
+-- Python => XXXXX => via XXXX
+--]
+
+return {
+ "https://codeberg.org/mfussenegger/nvim-dap.git",
+
+ dependencies = {
+ "rcarriga/nvim-dap-ui",
+ "leoluz/nvim-dap-go",
+ },
+ config = function()
+ local dap = require("dap")
+ local dapui = require("dapui")
+
+ dapui.setup()
+ require("dap-go").setup()
+
+ dap.listeners.before.attach.dapui_config = function()
+ dapui.open()
+ end
+ dap.listeners.before.launch.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
+
+ if vim.fn.executable("codelldb") == 1 then
+ dap.adapters.codelldb = {
+ type = "server",
+ port = "${port}",
+ executable = {
+ command = "codelldb", -- or if not in $PATH: "/absolute/path/to/codelldb"
+ args = { "--port", "${port}" },
+
+ -- On windows you may have to uncomment this:
+ -- detached = false,
+ },
+ }
+ end
+
+ if vim.fn.executable("gdb") == 1 then
+ dap.adapters.gdb = {
+ id = "gdb",
+ type = "executable",
+ command = "gdb",
+ args = { "--quiet", "--interpreter=dap" },
+ }
+ end
+
+ dap.configurations.cpp = {
+ {
+ name = "Launch file",
+ type = "codelldb",
+ request = "launch",
+ program = function()
+ return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
+ end,
+ cwd = "${workspaceFolder}",
+ stopOnEntry = false,
+ },
+ }
+
+ dap.configurations.c = dap.configurations.cpp
+ -- dap.configurations.rust = dap.configurations.cpp
+
+ -- dap.configurations.c = {
+ -- {
+ -- name = "Run executable (GDB)",
+ -- type = "gdb",
+ -- request = "launch",
+ -- -- This requires special handling of 'run_last', see
+ -- -- https://github.com/mfussenegger/nvim-dap/issues/1025#issuecomment-1695852355
+ -- program = function()
+ -- local path = vim.fn.input({
+ -- prompt = "Path to executable: ",
+ -- default = vim.fn.getcwd() .. "/",
+ -- completion = "file",
+ -- })
+ --
+ -- return (path and path ~= "") and path or dap.ABORT
+ -- end,
+ -- },
+ -- {
+ -- name = "Run executable with arguments (GDB)",
+ -- type = "gdb",
+ -- request = "launch",
+ -- -- This requires special handling of 'run_last', see
+ -- -- https://github.com/mfussenegger/nvim-dap/issues/1025#issuecomment-1695852355
+ -- program = function()
+ -- local path = vim.fn.input({
+ -- prompt = "Path to executable: ",
+ -- default = vim.fn.getcwd() .. "/",
+ -- completion = "file",
+ -- })
+ --
+ -- return (path and path ~= "") and path or dap.ABORT
+ -- end,
+ -- args = function()
+ -- local args_str = vim.fn.input({
+ -- prompt = "Arguments: ",
+ -- })
+ -- return vim.split(args_str, " +")
+ -- end,
+ -- },
+ -- {
+ -- name = "Attach to process (GDB)",
+ -- type = "gdb",
+ -- request = "attach",
+ -- processId = require("dap.utils").pick_process,
+ -- },
+ -- }
+
+ -- Adds keymaps
+ vim.keymap.set("n", "<Leader>Dt", dap.toggle_breakpoint, { desc = "Debugger toggle breakpoint" })
+ vim.keymap.set("n", "<Leader>Dc", dap.continue, { desc = "Debugger continue" })
+ end,
+}
+
+-- return {
+-- "https://codeberg.org/mfussenegger/nvim-dap.git",
+-- enabled = true,
+-- config = function()
+-- if vim.fn.executable("gdb") == 1 then
+-- local dap = require("dap").setup()
+-- dap.adapters.gdb = {
+-- id = "gdb",
+-- type = "executable",
+-- command = "gdb",
+-- args = { "--quiet", "--interpreter=dap" },
+-- }
+
+-- end
+-- end,
+-- }
+--
diff --git a/lua/ache/plugins/dap/gdb.lua b/lua/ache/plugins/dap/gdb.lua
new file mode 100644
index 0000000..177313d
--- /dev/null
+++ b/lua/ache/plugins/dap/gdb.lua
@@ -0,0 +1,13 @@
+--[
+-- Add basic gdb integration.
+--
+-- NOTE: Should disable since dap is the best integration method
+--]
+
+return {
+ "sakhnik/nvim-gdb",
+ enabled = false,
+ config = function()
+ require("nvimgdb").setup = function() end
+ end,
+}
diff --git a/lua/ache/plugins/dap/nvim-nio.lua b/lua/ache/plugins/dap/nvim-nio.lua
new file mode 100644
index 0000000..6fdff87
--- /dev/null
+++ b/lua/ache/plugins/dap/nvim-nio.lua
@@ -0,0 +1,7 @@
+--[
+-- This plugin add feature about asynchronous operations
+--
+-- required by nvim-dap, soon to be integrated to neovim
+--]
+
+return { "nvim-neotest/nvim-nio" }