-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathdebuggers.lua
39 lines (37 loc) · 1.08 KB
/
debuggers.lua
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
local M = {}
M.prom_py_attach = function()
local dap = require"dap"
local host = "127.0.0.1"
-- Same port as exposed in the Python example docker-compose.yml
local port = 9977
-- coroutine.create(function()
-- vim.fn.system("docker exec test-python_example_python_1 ./start_debugger.sh")
-- end)
local config = {
type = "python";
request = "attach";
connect = {
host = host;
port = port;
};
mode = "remote";
name = "Remote Attached Debugger";
cwd = vim.fn.getcwd();
pathMappings = {
{
localRoot = vim.fn.getcwd();
-- Same as WORKDIR in the Dockerfile.
-- Or wherever your sourcecode lives in the container.
remoteRoot = "/work";
};
};
}
-- The adapter has been started.
-- Connect to it.
local session = dap.attach({host = host, port = port}, config)
if session == nil then
io.write("Error connecting to adapter");
end
-- dap.repl.open()
end
return M