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