Skip to content

Instantly share code, notes, and snippets.

@mengwangk
Created February 19, 2022 03:39
Show Gist options
  • Save mengwangk/55d3e9fff0e5a932ef852165d49beed0 to your computer and use it in GitHub Desktop.
Save mengwangk/55d3e9fff0e5a932ef852165d49beed0 to your computer and use it in GitHub Desktop.
Neovim for Beginners - Debugging using DAP
local M = {}
local function configure()
local dap_install = require "dap-install"
dap_install.setup {
installation_path = vim.fn.stdpath "data" .. "/dapinstall/",
}
local dap_breakpoint = {
error = {
text = "🟥",
texthl = "LspDiagnosticsSignError",
linehl = "",
numhl = "",
},
rejected = {
text = "",
texthl = "LspDiagnosticsSignHint",
linehl = "",
numhl = "",
},
stopped = {
text = "⭐️",
texthl = "LspDiagnosticsSignInformation",
linehl = "DiagnosticUnderlineInfo",
numhl = "LspDiagnosticsSignInformation",
},
}
vim.fn.sign_define("DapBreakpoint", dap_breakpoint.error)
vim.fn.sign_define("DapStopped", dap_breakpoint.stopped)
vim.fn.sign_define("DapBreakpointRejected", dap_breakpoint.rejected)
end
local function configure_exts()
require("nvim-dap-virtual-text").setup {
commented = true,
}
local dap, dapui = require "dap", require "dapui"
dapui.setup {} -- use default
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
end
local function configure_debuggers()
require("config.dap.lua").setup()
require("config.dap.python").setup()
require("config.dap.rust").setup()
require("config.dap.go").setup()
end
function M.setup()
configure() -- Configuration
configure_exts() -- Extensions
configure_debuggers() -- Debugger
require("config.dap.keymaps").setup() -- Keymaps
end
configure_debuggers()
return M
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment