wat
This commit is contained in:
parent
61072b816a
commit
7887b06f7b
14 changed files with 95 additions and 470 deletions
|
|
@ -1,301 +0,0 @@
|
|||
return {
|
||||
{
|
||||
"rcarriga/nvim-dap-ui",
|
||||
keys = {},
|
||||
opts = {},
|
||||
config = function(_, opts)
|
||||
local dap = require("dap")
|
||||
local dapui = require("dapui")
|
||||
dapui.setup(opts)
|
||||
dap.listeners.after.event_initialized["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
|
||||
end,
|
||||
},
|
||||
{
|
||||
"mfussenegger/nvim-dap",
|
||||
lazy = true,
|
||||
dependencies = {
|
||||
"rcarriga/nvim-dap-ui",
|
||||
"theHamsta/nvim-dap-virtual-text",
|
||||
{
|
||||
"jay-babu/mason-nvim-dap.nvim",
|
||||
opts = {
|
||||
ensure_installed = {
|
||||
"node2",
|
||||
"python",
|
||||
"javadbg",
|
||||
"javatest",
|
||||
"codelldb",
|
||||
"firefox",
|
||||
"bash",
|
||||
"delve",
|
||||
"coreclr",
|
||||
},
|
||||
automatic_installation = true,
|
||||
automatic_setup = true,
|
||||
},
|
||||
config = function(_, opts)
|
||||
require("mason-nvim-dap").setup(opts)
|
||||
-- require("mason-nvim-dap").setup_handlers({
|
||||
-- javadbg = function() end,
|
||||
-- })
|
||||
end,
|
||||
},
|
||||
},
|
||||
config = function()
|
||||
local dap = require("dap")
|
||||
dap.adapters.lldb = {
|
||||
type = "executable",
|
||||
command = "/usr/bin/lldb-vscode",
|
||||
name = "lldb",
|
||||
}
|
||||
dap.adapters.nlua = function(callback, config)
|
||||
callback({ type = "server", host = config.host or "127.0.0.1", port = config.port or 8086 })
|
||||
end
|
||||
dap.adapters.bashdb = {
|
||||
type = "executable",
|
||||
command = vim.fn.stdpath("data") .. "/mason/packages/bash-debug-adapter/bash-debug-adapter",
|
||||
name = "bashdb",
|
||||
}
|
||||
dap.adapters.coreclr = {
|
||||
type = "executable",
|
||||
command = "netcoredbg",
|
||||
args = { "--interpreter=vscode" },
|
||||
}
|
||||
|
||||
local rust_dap = Get_git_root().cwd
|
||||
local filename = ""
|
||||
for w in rust_dap:gmatch("([^/]+)") do
|
||||
filename = w
|
||||
end
|
||||
filename = filename:gsub("-", "_")
|
||||
filename = string.lower(filename)
|
||||
|
||||
dap.configurations.rust = {
|
||||
{
|
||||
type = "lldb",
|
||||
request = "launch",
|
||||
program = function()
|
||||
return rust_dap .. "/target/debug/" .. filename
|
||||
end,
|
||||
--program = '${fileDirname}/${fileBasenameNoExtension}',
|
||||
cwd = "${workspaceFolder}",
|
||||
terminal = "integrated",
|
||||
initCommands = function()
|
||||
-- Find out where to look for the pretty printer Python module
|
||||
local rustc_sysroot = vim.fn.trim(vim.fn.system("rustc --print sysroot"))
|
||||
|
||||
local script_import = 'command script import "' .. rustc_sysroot .. '/lib/rustlib/etc/lldb_lookup.py"'
|
||||
local commands_file = rustc_sysroot .. "/lib/rustlib/etc/lldb_commands"
|
||||
|
||||
local commands = {}
|
||||
local file = io.open(commands_file, "r")
|
||||
if file then
|
||||
for line in file:lines() do
|
||||
table.insert(commands, line)
|
||||
end
|
||||
file:close()
|
||||
end
|
||||
table.insert(commands, 1, script_import)
|
||||
|
||||
return commands
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
||||
dap.configurations.cpp = {
|
||||
{
|
||||
name = "debug cpp",
|
||||
type = "lldb",
|
||||
request = "launch",
|
||||
program = function()
|
||||
return vim.fn.input("Path to executable: ", Get_git_root().cwd .. "/build/", "file")
|
||||
end,
|
||||
cwd = "${workspaceFolder}",
|
||||
terminal = "integrated",
|
||||
},
|
||||
}
|
||||
dap.configurations.c = dap.configurations.cpp
|
||||
|
||||
dap.configurations.python = {
|
||||
{
|
||||
type = "python", -- the type here established the link to the adapter definition: `dap.adapters.python`
|
||||
request = "launch",
|
||||
name = "Launch file",
|
||||
program = "${file}", -- This configuration will launch the current file if used.
|
||||
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,
|
||||
},
|
||||
}
|
||||
dap.configurations.java = {
|
||||
{
|
||||
request = "attach",
|
||||
name = "Debug (Attach) - Remote",
|
||||
hostName = "127.0.0.1",
|
||||
port = 5005,
|
||||
},
|
||||
}
|
||||
dap.configurations.go = {
|
||||
{
|
||||
type = "delve",
|
||||
name = "Debug",
|
||||
request = "launch",
|
||||
program = "${file}",
|
||||
},
|
||||
{
|
||||
type = "delve",
|
||||
name = "Debug test", -- configuration for debugging test files
|
||||
request = "launch",
|
||||
mode = "test",
|
||||
program = "${file}",
|
||||
},
|
||||
{
|
||||
type = "delve",
|
||||
name = "Debug test (go.mod)",
|
||||
request = "launch",
|
||||
mode = "test",
|
||||
program = "./${relativeFileDirname}",
|
||||
},
|
||||
}
|
||||
dap.configurations.javascript = {
|
||||
{
|
||||
name = "Launch",
|
||||
type = "js",
|
||||
request = "launch",
|
||||
program = "${file}",
|
||||
cwd = vim.fn.getcwd(),
|
||||
sourceMaps = true,
|
||||
protocol = "inspector",
|
||||
console = "integratedTerminal",
|
||||
},
|
||||
}
|
||||
dap.configurations.typescript = {
|
||||
{
|
||||
name = "Debug with Firefox",
|
||||
type = "firefox",
|
||||
request = "launch",
|
||||
reAttach = true,
|
||||
url = "http://localhost:3000",
|
||||
webRoot = "${workspaceFolder}",
|
||||
firefoxExecutable = "/usr/bin/firefox",
|
||||
},
|
||||
}
|
||||
dap.configurations.lua = {
|
||||
{
|
||||
type = "nlua",
|
||||
request = "attach",
|
||||
name = "Attach to running Neovim instance",
|
||||
},
|
||||
}
|
||||
dap.configurations.cs = {
|
||||
{
|
||||
type = "coreclr",
|
||||
name = "launch - netcoredbg",
|
||||
request = "launch",
|
||||
program = function()
|
||||
return vim.fn.input("Path to dll: ", Get_git_root().cwd, "file")
|
||||
end,
|
||||
-- args = function()
|
||||
-- vim.fn.input("args: ", Get_git_root().cwd, "file")
|
||||
-- end,
|
||||
},
|
||||
}
|
||||
dap.configurations.sh = {
|
||||
{
|
||||
type = "bashdb",
|
||||
request = "launch",
|
||||
name = "Launch file",
|
||||
showDebugOutput = true,
|
||||
pathBashdb = vim.fn.stdpath("data") .. "/mason/packages/bash-debug-adapter/extension/bashdb_dir/bashdb",
|
||||
pathBashdbLib = vim.fn.stdpath("data") .. "/mason/packages/bash-debug-adapter/extension/bashdb_dir",
|
||||
trace = true,
|
||||
file = "${file}",
|
||||
program = "${file}",
|
||||
cwd = "${workspaceFolder}",
|
||||
pathCat = "cat",
|
||||
pathBash = "/bin/bash",
|
||||
pathMkfifo = "mkfifo",
|
||||
pathPkill = "pkill",
|
||||
args = {},
|
||||
env = {},
|
||||
terminalKind = "integrated",
|
||||
},
|
||||
}
|
||||
require("dapui").setup({
|
||||
icons = { expanded = "▾", collapsed = "▸", current_frame = "▸" },
|
||||
mappings = {
|
||||
expand = { "<CR>", "<2-LeftMouse>" },
|
||||
open = "o",
|
||||
remove = "d",
|
||||
edit = "e",
|
||||
repl = "r",
|
||||
toggle = "t",
|
||||
},
|
||||
expand_lines = vim.fn.has("nvim-0.7") == 1,
|
||||
layouts = {
|
||||
{
|
||||
elements = {
|
||||
{ id = "scopes", size = 0.25 },
|
||||
"breakpoints",
|
||||
"stacks",
|
||||
"watches",
|
||||
},
|
||||
size = 40, -- 40 columns
|
||||
position = "left",
|
||||
},
|
||||
{
|
||||
elements = {
|
||||
"repl",
|
||||
"console",
|
||||
},
|
||||
size = 0.25, -- 25% of total lines
|
||||
position = "bottom",
|
||||
},
|
||||
},
|
||||
controls = {
|
||||
enabled = true,
|
||||
element = "repl",
|
||||
icons = {
|
||||
pause = "",
|
||||
play = "",
|
||||
step_into = "",
|
||||
step_over = "",
|
||||
step_out = "",
|
||||
step_back = "",
|
||||
run_last = "↻",
|
||||
terminate = "□",
|
||||
},
|
||||
},
|
||||
floating = {
|
||||
max_height = nil, -- These can be integers or a float between 0 and 1.
|
||||
max_width = nil, -- Floats will be treated as percentage of your screen.
|
||||
border = "single", -- Border style. Can be "single", "double" or "rounded"
|
||||
mappings = {
|
||||
close = { "q", "<Esc>" },
|
||||
},
|
||||
},
|
||||
windows = { indent = 1 },
|
||||
render = {
|
||||
max_type_length = nil, -- Can be integer or nil.
|
||||
max_value_lines = 100, -- Can be integer or nil.
|
||||
},
|
||||
})
|
||||
require("nvim-dap-virtual-text").setup()
|
||||
end,
|
||||
},
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue