1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
-- Debuging setup for NeoVim
local dap = require('dap')
local dapui = require('dapui')
--
-- Adapters
--
dap.adapters.gdb = {
type = "executable",
command = "gdb",
args = { "-i", "dap" }
}
dap.adapters.php = {
type = "executable",
command = "node",
args = { '/usr/lib/node_modules/php-debug/out/phpDebug.js' }
}
dap.adapters.rust_gdb = {
type = "executable",
command = "rust-gdb",
args = { "-i", "dap" }
}
--
-- Configurations
--
dap.configurations.c = {
{
name = "Launch",
type = "gdb",
request = "launch",
program = function()
return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file')
end,
cwd = "${workspacefolder}",
},
}
dap.configurations.rust = {
{
name = "Launch",
type = "rust_gdb",
request = "launch",
program = function()
return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/target/debug', 'file')
end,
cwd = "${workspacefolder}",
},
}
dap.configurations.php = {
{
name = "Listen for Xdebug",
type = "php",
request = "launch",
port = 9003,
},
}
require("dap.ext.vscode").load_launchjs(vim.fn.getcwd() .. "/.vscode/launch.json", {})
-- Set up some keybindings
vim.keymap.set('n', '<Leader>db', function() dap.toggle_breakpoint() end)
vim.keymap.set('n', '<Leader>dc', function() dap.continue() end)
vim.keymap.set('n', '<Leader>dr', function() dap.repl.open() end)
vim.keymap.set('n', '<F10>', function() dap.step_over() end)
vim.keymap.set('n', '<F11>', function() dap.step_into() end)
vim.keymap.set('n', '<F12>', function() dap.step_out() end)
-- Set up the UI
dapui.setup()
dap.listeners.before.attach.dapui_config = function()
dapui.open()
end
dap.listeners.before.launch.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
|