diff options
| author | kylo252 <[email protected]> | 2022-10-17 17:29:15 +0200 | 
|---|---|---|
| committer | kylo252 <[email protected]> | 2022-10-17 17:29:15 +0200 | 
| commit | 4ef07315003f723bb8e97d5a91b2bde3773ec1b8 (patch) | |
| tree | e9889a492f76e3f9573228343aaba647dfd48136 /lua/lvim/core/dap.lua | |
| parent | e4a5fe97abe500bbbe78fb137d57a59f558da05a (diff) | |
| parent | 6f6cbc394d2a7e64964b6067a2f42d2e6a07824e (diff) | |
Merge remote-tracking branch 'origin/rolling'
Diffstat (limited to 'lua/lvim/core/dap.lua')
| -rw-r--r-- | lua/lvim/core/dap.lua | 103 | 
1 files changed, 76 insertions, 27 deletions
| diff --git a/lua/lvim/core/dap.lua b/lua/lvim/core/dap.lua index 727e238f..cff50f64 100644 --- a/lua/lvim/core/dap.lua +++ b/lua/lvim/core/dap.lua @@ -2,31 +2,37 @@ local M = {}  M.config = function()    lvim.builtin.dap = { -    active = false, +    active = true,      on_config_done = nil,      breakpoint = { -      text = "", -      texthl = "LspDiagnosticsSignError", +      text = lvim.icons.ui.Bug, +      texthl = "DiagnosticSignError",        linehl = "",        numhl = "",      },      breakpoint_rejected = { -      text = "", -      texthl = "LspDiagnosticsSignHint", +      text = lvim.icons.ui.Bug, +      texthl = "DiagnosticSignError",        linehl = "",        numhl = "",      },      stopped = { -      text = "", -      texthl = "LspDiagnosticsSignInformation", -      linehl = "DiagnosticUnderlineInfo", -      numhl = "LspDiagnosticsSignInformation", +      text = lvim.icons.ui.BoldArrowRight, +      texthl = "DiagnosticSignWarn", +      linehl = "Visual", +      numhl = "DiagnosticSignWarn", +    }, +    ui = { +      auto_open = true,      },    }  end  M.setup = function() -  local dap = require "dap" +  local status_ok, dap = pcall(require, "dap") +  if not status_ok then +    return +  end    if lvim.use_icons then      vim.fn.sign_define("DapBreakpoint", lvim.builtin.dap.breakpoint) @@ -34,8 +40,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 +55,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 +63,65 @@ M.setup = function()    end  end --- TODO put this up there ^^^ call in ftplugin +M.setup_ui = function() +  local status_ok, dap = pcall(require, "dap") +  if not status_ok then +    return +  end +  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 | 
