From 76f14dfea2eb6217d8105fc8e74e4263d9557bc4 Mon Sep 17 00:00:00 2001 From: Warwick Date: Fri, 20 Dec 2024 13:02:11 +0000 Subject: [PATCH 1/2] Added dap debugging in C --- lua/core/plugin_config/dap-debug.lua | 8 +++----- lua/core/plugin_config/lsp_config.lua | 4 ++-- lua/core/plugin_config/whichkey.lua | 6 +++--- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/lua/core/plugin_config/dap-debug.lua b/lua/core/plugin_config/dap-debug.lua index 28a05e4..9295326 100644 --- a/lua/core/plugin_config/dap-debug.lua +++ b/lua/core/plugin_config/dap-debug.lua @@ -1,8 +1,5 @@ -local dap = require("dap") -local dapui = require("dapui") -dap.set_log_level('TRACE') - --- open dapui on events +local dap, dapui = require("dap"), require("dapui") +dapui.setup(); dap.listeners.before.attach.dapui_config = function() dapui.open() end @@ -22,6 +19,7 @@ dap.adapters.gdb = { command = "gdb", args = { "--interpreter=dap", "--eval-command", "set print pretty on" } } + dap.configurations.c = { { name = "Launch", diff --git a/lua/core/plugin_config/lsp_config.lua b/lua/core/plugin_config/lsp_config.lua index f3d129c..12f1644 100644 --- a/lua/core/plugin_config/lsp_config.lua +++ b/lua/core/plugin_config/lsp_config.lua @@ -5,7 +5,7 @@ require("mason-lspconfig").setup({ "clangd", "cmake", "ltex", - "tsserver", + "ts_ls", "jsonls", "rust_analyzer", "zls", @@ -76,7 +76,7 @@ require("lspconfig").lua_ls.setup { require("lspconfig").clangd.setup { capabilities = capabilities } require("lspconfig").cmake.setup { capabilities = capabilities } require("lspconfig").ltex.setup { capabilities = capabilities } -require("lspconfig").tsserver.setup { capabilities = capabilities } +require("lspconfig").ts_ls.setup { capabilities = capabilities } require("lspconfig").jsonls.setup { capabilities = capabilities } require("lspconfig").rust_analyzer.setup { capabilities = capabilities } require("lspconfig").zls.setup { capabilities = capabilities } diff --git a/lua/core/plugin_config/whichkey.lua b/lua/core/plugin_config/whichkey.lua index f64dfec..720390b 100644 --- a/lua/core/plugin_config/whichkey.lua +++ b/lua/core/plugin_config/whichkey.lua @@ -7,10 +7,10 @@ local keymap = { { "Tj", "TodoLocList", desc = "List TODO:'s in buffer" }, { "Tn", function() require("todo-comments").jump_next() end, desc = "Jump to next TODO:" }, { "d", group = "DAP debug tools" }, - { "db", function() require('dap').toggle_breakpoint() end, desc = "continue/launch" }, { "dc", function() require('dap').continue() end, desc = "continue/launch" }, - { "di", function() require('dap').step_into() end, desc = "continue/launch" }, - { "do", function() require('dap').step_over() end, desc = "continue/launch" }, + { "db", function() require('dap').toggle_breakpoint() end, desc = "toggle breakpoint" }, + { "di", function() require('dap').step_into() end, desc = "step into" }, + { "do", function() require('dap').step_over() end, desc = "step over" }, { "f", group = "find (telescope)" }, { "ff", "Telescope find_files", desc = "Find" }, { "fg", "Telescope live_grep", desc = "Grep" }, From abfa485248166426309bc9cbe072d3c25aef8a02 Mon Sep 17 00:00:00 2001 From: Warwick Date: Fri, 20 Dec 2024 15:55:16 +0000 Subject: [PATCH 2/2] More dap bindings --- lua/core/plugin_config/whichkey.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/core/plugin_config/whichkey.lua b/lua/core/plugin_config/whichkey.lua index 720390b..b661747 100644 --- a/lua/core/plugin_config/whichkey.lua +++ b/lua/core/plugin_config/whichkey.lua @@ -11,6 +11,7 @@ local keymap = { { "db", function() require('dap').toggle_breakpoint() end, desc = "toggle breakpoint" }, { "di", function() require('dap').step_into() end, desc = "step into" }, { "do", function() require('dap').step_over() end, desc = "step over" }, + { "dO", function() require('dap').step_out() end, desc = "step over" }, { "f", group = "find (telescope)" }, { "ff", "Telescope find_files", desc = "Find" }, { "fg", "Telescope live_grep", desc = "Grep" },