all repos — dotfiles @ 8c93a76a4b8ab64d54d03f26e1c5f6ad22347a17

my *nix dotfiles

nvim/lua/dapx.lua (view raw)

  1local dap = require 'dap'
  2local dapui = require 'dapui'
  3
  4dap.set_log_level('INFO')
  5
  6dap.configurations.go = {
  7  {
  8    type = "go",
  9    name = "Debug",
 10    request = "launch",
 11    program = "${file}",
 12  },
 13}
 14
 15dap.adapters.go = {
 16  type = "server",
 17  port = "${port}",
 18  executable = {
 19    command = 'dlv',
 20    args = { "dap", "-l", "127.0.0.1:${port}" },
 21  },
 22}
 23
 24require 'dap-go'.setup {
 25  dap_configurations = {
 26    {
 27      type = "go",
 28      name = "Debug (main.go)",
 29      request = "launch",
 30      program = "${workspaceFolderBasename}/cmd/main.go",
 31    },
 32  },
 33}
 34
 35dapui.setup {
 36  controls = {
 37    element = "repl",
 38    enabled = true,
 39    icons = {
 40      disconnect = "",
 41      pause = "",
 42      play = "",
 43      run_last = "",
 44      step_back = "",
 45      step_into = "",
 46      step_out = "",
 47      step_over = "",
 48      terminate = ""
 49    }
 50  },
 51  expand_lines = false,
 52  icons = { expanded = "", collapsed = "" },
 53  mappings = {
 54    open = "o",
 55    remove = "d",
 56    edit = "e",
 57    repl = "r",
 58    toggle = "t",
 59  },
 60  layouts = {
 61    {
 62      elements = {
 63        "scopes",
 64        "repl",
 65      },
 66      size = 0.3,
 67      position = "bottom"
 68    },
 69    {
 70      elements = {
 71        "breakpoints"
 72      },
 73      size = 0.1,
 74      position = "left",
 75    },
 76  },
 77  floating = {
 78    max_height = nil,
 79    max_width = nil,
 80    border = "single",
 81    mappings = {
 82      close = { "q", "<Esc>" },
 83    },
 84  },
 85  windows = { indent = 1 },
 86  render = {
 87    max_type_length = nil,
 88  },
 89}
 90
 91dap.listeners.before.attach.dapui_config = function()
 92  dapui.open()
 93end
 94dap.listeners.before.launch.dapui_config = function()
 95  dapui.open()
 96end
 97--dap.listeners.before.event_terminated.dapui_config = function()
 98--  dapui.close()
 99--end
100dap.listeners.before.event_exited.dapui_config = function()
101  dapui.close()
102end
103
104vim.fn.sign_define('DapBreakpoint', {text = ''})
105
106require 'dapui.config.highlights'.setup()