summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lua/lvim/core/dap.lua77
-rw-r--r--lua/lvim/plugins.lua9
2 files changed, 69 insertions, 17 deletions
diff --git a/lua/lvim/core/dap.lua b/lua/lvim/core/dap.lua
index 9e629cda..fb603c81 100644
--- a/lua/lvim/core/dap.lua
+++ b/lua/lvim/core/dap.lua
@@ -22,6 +22,9 @@ M.config = function()
linehl = "DiagnosticUnderlineInfo",
numhl = "LspDiagnosticsSignInformation",
},
+ ui = {
+ auto_open = true,
+ },
}
end
@@ -34,8 +37,6 @@ M.setup = function()
vim.fn.sign_define("DapStopped", lvim.builtin.dap.stopped)
end
- dap.defaults.fallback.terminal_win_cmd = "50vsplit new"
-
lvim.builtin.which_key.mappings["d"] = {
name = "Debug",
t = { "<cmd>lua require'dap'.toggle_breakpoint()<cr>", "Toggle Breakpoint" },
@@ -51,6 +52,7 @@ M.setup = function()
r = { "<cmd>lua require'dap'.repl.toggle()<cr>", "Toggle Repl" },
s = { "<cmd>lua require'dap'.continue()<cr>", "Start" },
q = { "<cmd>lua require'dap'.close()<cr>", "Quit" },
+ U = { "<cmd>lua require'dapui'.toggle()<cr>", "Toggle UI" },
}
if lvim.builtin.dap.on_config_done then
@@ -58,21 +60,62 @@ M.setup = function()
end
end
--- TODO put this up there ^^^ call in ftplugin
+M.setup_ui = function()
+ local dap = require "dap"
+ local dapui = require "dapui"
+ dapui.setup {
+ expand_lines = true,
+ icons = { expanded = "", collapsed = "", circular = "" },
+ mappings = {
+ -- Use a table to apply multiple mappings
+ expand = { "<CR>", "<2-LeftMouse>" },
+ open = "o",
+ remove = "d",
+ edit = "e",
+ repl = "r",
+ toggle = "t",
+ },
+ layouts = {
+ {
+ elements = {
+ { id = "scopes", size = 0.33 },
+ { id = "breakpoints", size = 0.17 },
+ { id = "stacks", size = 0.25 },
+ { id = "watches", size = 0.25 },
+ },
+ size = 0.33,
+ position = "right",
+ },
+ {
+ elements = {
+ { id = "repl", size = 0.45 },
+ { id = "console", size = 0.55 },
+ },
+ size = 0.27,
+ position = "bottom",
+ },
+ },
+ floating = {
+ max_height = 0.9,
+ max_width = 0.5, -- Floats will be treated as percentage of your screen.
+ border = vim.g.border_chars, -- Border style. Can be 'single', 'double' or 'rounded'
+ mappings = {
+ close = { "q", "<Esc>" },
+ },
+ },
+ }
--- M.dap = function()
--- if lvim.plugin.dap.active then
--- local dap_install = require "dap-install"
--- dap_install.config("python_dbg", {})
--- end
--- end
---
--- M.dap = function()
--- -- gem install readapt ruby-debug-ide
--- if lvim.plugin.dap.active then
--- local dap_install = require "dap-install"
--- dap_install.config("ruby_vsc_dbg", {})
--- end
--- end
+ if lvim.builtin.dap.ui.auto_open then
+ 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
+end
return M
diff --git a/lua/lvim/plugins.lua b/lua/lvim/plugins.lua
index 387bcee3..c315cdd9 100644
--- a/lua/lvim/plugins.lua
+++ b/lua/lvim/plugins.lua
@@ -235,6 +235,15 @@ local core_plugins = {
disable = not lvim.builtin.dap.active,
},
+ -- Debugger user interface
+ {
+ "rcarriga/nvim-dap-ui",
+ config = function()
+ require("lvim.core.dap").setup_ui()
+ end,
+ disable = not lvim.builtin.dap.active,
+ },
+
-- alpha
{
"goolord/alpha-nvim",