From 13e1004eb40535965c6028fb3f1aedd3b90f61de Mon Sep 17 00:00:00 2001 From: Patrick Auernig Date: Thu, 19 Oct 2023 19:16:00 +0200 Subject: [PATCH] Add dap plugins --- lazy-lock.json | 3 ++ lua/valeth/lazy.lua | 1 + lua/valeth/plugins/dap/init.lua | 7 ++++ lua/valeth/plugins/dap/mason.lua | 18 ++++++++ lua/valeth/plugins/dap/ui.lua | 70 ++++++++++++++++++++++++++++++++ 5 files changed, 99 insertions(+) create mode 100644 lua/valeth/plugins/dap/init.lua create mode 100644 lua/valeth/plugins/dap/mason.lua create mode 100644 lua/valeth/plugins/dap/ui.lua diff --git a/lazy-lock.json b/lazy-lock.json index c8eca0e..afae64f 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -18,10 +18,13 @@ "lspkind.nvim": { "branch": "master", "commit": "57610d5ab560c073c465d6faf0c19f200cb67e6e" }, "lualine.nvim": { "branch": "master", "commit": "1a3f6bba410aff5a51bf8c84287aaa3a8ba30d0d" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "e7b64c11035aa924f87385b72145e0ccf68a7e0a" }, + "mason-nvim-dap.nvim": { "branch": "main", "commit": "f0cd12f7a8a310c58cecebddb6b219ffad1cfd0f" }, "mason.nvim": { "branch": "main", "commit": "cd7835b15f5a4204fc37e0aa739347472121a54c" }, "neogit": { "branch": "master", "commit": "eb9d6b8f0840e4f2fa775bca7ec4a5df8b42ed6d" }, "nvim-autopairs": { "branch": "master", "commit": "f6c71641f6f183427a651c0ce4ba3fb89404fa9e" }, "nvim-cmp": { "branch": "main", "commit": "5dce1b778b85c717f6614e3f4da45e9f19f54435" }, + "nvim-dap": { "branch": "master", "commit": "92dc531eea2c9a3ef504a5c8ac0decd1fa59a6a3" }, + "nvim-dap-ui": { "branch": "master", "commit": "34160a7ce6072ef332f350ae1d4a6a501daf0159" }, "nvim-lspconfig": { "branch": "master", "commit": "e49b1e90c1781ce372013de3fa93a91ea29fc34a" }, "nvim-notify": { "branch": "master", "commit": "e4a2022f4fec2d5ebc79afa612f96d8b11c627b3" }, "nvim-tree.lua": { "branch": "master", "commit": "40b9b887d090d5da89a84689b4ca0304a9649f62" }, diff --git a/lua/valeth/lazy.lua b/lua/valeth/lazy.lua index 472d233..d47ad1a 100644 --- a/lua/valeth/lazy.lua +++ b/lua/valeth/lazy.lua @@ -57,5 +57,6 @@ require("lazy").setup({ spec = { { import = "valeth.plugins" }, { import = "valeth.plugins.lsp" }, + { import = "valeth.plugins.dap" }, } }) diff --git a/lua/valeth/plugins/dap/init.lua b/lua/valeth/plugins/dap/init.lua new file mode 100644 index 0000000..68911fb --- /dev/null +++ b/lua/valeth/plugins/dap/init.lua @@ -0,0 +1,7 @@ +local spec = { + "mfussenegger/nvim-dap", + tag = "0.6.0", + lazy = true, +} + +return spec diff --git a/lua/valeth/plugins/dap/mason.lua b/lua/valeth/plugins/dap/mason.lua new file mode 100644 index 0000000..3f32457 --- /dev/null +++ b/lua/valeth/plugins/dap/mason.lua @@ -0,0 +1,18 @@ +local spec = { + "jay-babu/mason-nvim-dap.nvim", + tag = "v2.2.0", +} + +spec.opts = { + ensure_installed = { "codelldb" }, + handlers = {}, +} + +spec.dependencies = { + "williamboman/mason.nvim", + "mfussenegger/nvim-dap", +} + +spec.ft = { "rust" } + +return spec diff --git a/lua/valeth/plugins/dap/ui.lua b/lua/valeth/plugins/dap/ui.lua new file mode 100644 index 0000000..85b5d48 --- /dev/null +++ b/lua/valeth/plugins/dap/ui.lua @@ -0,0 +1,70 @@ +local spec = { + "rcarriga/nvim-dap-ui", + tag = "v3.9.1" +} + +spec.dependencies = { + "mfussenegger/nvim-dap", +} + +spec.keys = { + { "dbg", "DapContinue"}, + { "dbr", "DapToggleBreakpoint" }, + { "dso", "DapStepOver" }, + { "dq", "DapTerminate" }, +} + +spec.config = function() + local dap = require("dap") + local dap_ui = require("dapui") + + dap.listeners.after.event_initialized["dapui_config"] = function() + dap_ui.open() + end + + dap.listeners.before.event_terminated["dapui_config"] = function() + dap_ui.close() + end + + dap.listeners.before.event_exited["dapui_config"] = function() + dap_ui.close() + end + + local side = { + position = "right", + size = 40, -- columns + elements = { + { + id = "stacks", + size = 0.5, + }, + { + id = "breakpoints", + size = 0.5, + } + }, + } + + local bottom = { + position = "bottom", + size = 10, -- rows + elements = { + { + id = "scopes", + size = 0.5, + }, + { + id = "repl", + size = 0.5, + } + }, + } + + local opts = { + layouts = { side, bottom }, + } + + dap_ui.setup(opts) +end + +return spec