local dap_ok, dap = pcall(require, "dap") if not (dap_ok) then print("nvim-dap not installed!") return end require('dap').set_log_level('INFO') -- Helps when configuring DAP, see logs with :DapShowLog dap.configurations = { go = { { type = "go", -- Which adapter to use name = "Debug", -- Human readable name request = "launch", -- Whether to "launch" or "attach" to program program = "${file}", -- The buffer you are focused on when running nvim-dap }, } } dap.adapters.go = { type = "server", port = "${port}", executable = { command = vim.fn.stdpath("data") .. '/mason/bin/dlv', args = { "dap", "-l", "127.0.0.1:${port}" }, }, } local dap_ui_ok, ui = pcall(require, "dapui") if not (dap_ok and dap_ui_ok) then require("notify")("dap-ui not installed!", "warning") return end ui.setup({ icons = { expanded = "▾", collapsed = "▸" }, mappings = { open = "o", remove = "d", edit = "e", repl = "r", toggle = "t", }, expand_lines = vim.fn.has("nvim-0.7"), layouts = { { elements = { "scopes", }, size = 0.3, position = "right" }, { elements = { "repl", "breakpoints" }, size = 0.3, position = "bottom", }, }, floating = { max_height = nil, max_width = nil, border = "single", mappings = { close = { "q", "" }, }, }, windows = { indent = 1 }, render = { max_type_length = nil, }, })