nvim: big dap changes:
go: launch dlv manually and add a mapping to set the port (dsp) python: get rid of it for now lldb: include lldb for rust and c
This commit is contained in:
@ -1,37 +1,7 @@
|
||||
local dap = require("dap")
|
||||
|
||||
--
|
||||
-- python
|
||||
--
|
||||
|
||||
dap.adapters.python = {
|
||||
type = "executable",
|
||||
command = "python",
|
||||
args = { "-m", "debugpy.adapter" },
|
||||
}
|
||||
|
||||
dap.configurations.python = {
|
||||
{
|
||||
type = "python",
|
||||
request = "launch",
|
||||
name = "Launch file",
|
||||
|
||||
program = "${file}",
|
||||
pythonPath = function()
|
||||
local cwd = vim.fn.getcwd()
|
||||
if vim.fn.executable(cwd .. "/venv/bin/python") == 1 then
|
||||
return cwd .. "/venv/bin/python"
|
||||
elseif vim.fn.executable(cwd .. "/.venv/bin/python") == 1 then
|
||||
return cwd .. "/.venv/bin/python"
|
||||
else
|
||||
return "/usr/bin/python"
|
||||
end
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
||||
--
|
||||
-- C
|
||||
-- lldb
|
||||
--
|
||||
|
||||
dap.adapters.lldb = {
|
||||
@ -40,18 +10,66 @@ dap.adapters.lldb = {
|
||||
name = "lldb",
|
||||
}
|
||||
|
||||
dap.configurations.c = {
|
||||
local lldb = {
|
||||
{
|
||||
name = "Launch",
|
||||
type = "lldb",
|
||||
request = "launch",
|
||||
program = function()
|
||||
return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
|
||||
return vim.fn.input("path to executable: ", vim.fn.getcwd() .. "/", "file")
|
||||
end,
|
||||
cwd = "${workspaceFolder}",
|
||||
stopOnEntry = false,
|
||||
args = {},
|
||||
|
||||
runInTerminal = false,
|
||||
runInTerminal = true,
|
||||
},
|
||||
}
|
||||
|
||||
dap.configurations.c = lldb
|
||||
dap.configurations.rust = lldb
|
||||
|
||||
--
|
||||
-- go
|
||||
--
|
||||
|
||||
vim.keymap.set("n", "<leader>dsp", function()
|
||||
local port = vim.fn.input("enter port for delve: ")
|
||||
dap.adapters.go.port = port
|
||||
print("now run 'dlv dap -l 127.0.0.1:" .. port .. "'")
|
||||
end)
|
||||
|
||||
dap.adapters.go = {
|
||||
type = "server",
|
||||
host = "127.0.0.1",
|
||||
port = 38000,
|
||||
}
|
||||
|
||||
dap.configurations.go = {
|
||||
{
|
||||
type = "go",
|
||||
name = "Debug",
|
||||
request = "launch",
|
||||
program = "${file}",
|
||||
},
|
||||
{
|
||||
type = "go",
|
||||
name = "Debug Package",
|
||||
request = "launch",
|
||||
program = "${fileDirname}",
|
||||
},
|
||||
{
|
||||
type = "go",
|
||||
name = "Debug test",
|
||||
request = "launch",
|
||||
mode = "test",
|
||||
program = "${file}",
|
||||
},
|
||||
{
|
||||
type = "go",
|
||||
name = "Debug test (go.mod)",
|
||||
request = "launch",
|
||||
mode = "test",
|
||||
program = "./${relativeFileDirname}",
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user