return { { "mfussenegger/nvim-jdtls", config = function() end, }, { "theHamsta/nvim-dap-virtual-text", "nvim-neotest/nvim-nio", config = function() require("nvim-dap-virtual-text").setup() end, }, { "mfussenegger/nvim-dap", dependencies = { "rcarriga/nvim-dap-ui", "nvim-telescope/telescope-dap.nvim", }, -- stylua: ignore keys = { { "do", ":lua require'dapui'.open()" }, -- { "", ":lua require'dap'.continue()" }, { "dl", ":lua require'dap'.run_last()" }, { "db", ":lua require'dap'.toggle_breakpoint()" }, { "dB", ":lua require'dap'.set_breakpoint(vim.fn.input('Breakpoint condition: '))" }, { "dlp", ":lua require'dap'.set_breakpoint(nil, nil, vim.fn.input('Log point message: '))" }, { "dr", ":lua require'dap'.repl.open()" }, { "dt", ":Telescope dap configurations" }, }, config = function() local use_google = require("utils").use_google require("telescope").load_extension("dap") local dap = require("dap") vim.fn.sign_define("DapBreakpoint", { text = "", texthl = "DiagnosticSignError" }) vim.fn.sign_define("DapBreakpointCondition", { text = "", texthl = "DiagnosticSignError" }) vim.fn.sign_define("DapBreakpointRejected", { text = "", texthl = "DiagnosticSignError" }) dap.adapters.cppdbg = { id = "cppdbg", type = "executable", command = vim.fn.exepath("OpenDebugAD7"), } if use_google then dap.adapters.lldb = { type = "executable", -- sudo apt install google-lldb-vscode command = "/usr/share/code/resources/app/extensions/google-lldb-vscode/bin/lldb-dap", name = "lldb", sourceMap = { { "/proc/self/cwd", "${workspaceFolder}" }, }, cwd = "${workspaceFolder}", debuggerRoot = "${workspaceFolder}", sourcePath = "${workspaceFolder}", } end dap.adapters.godot = { type = "server", host = "127.0.0.1", port = 6006, } dap.configurations.cppdbg = { { name = "Attach to gdbserver :5555", type = "cppdbg", request = "launch", MIMode = "gdb", miDebuggerServerAddress = "localhost:5555", miDebuggerPath = vim.fn.exepath("gdb"), cwd = "${workspaceFolder}", program = function() return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file") end, }, } dap.configurations.cpp = { { -- If you get an "Operation not permitted" error using this, try disabling YAMA: -- echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope name = "Attach to process", type = "lldb", request = "attach", pid = require("dap.utils").pick_process, args = {}, }, { name = "Wait for process name", type = "lldb", request = "attach", program = function() return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file") end, waitFor = true, }, { type = "lldb", request = "attach", mode = "remote", name = "Attach Remote", attachCommands = { "gdb-remote localhost:5555" }, }, } -- dap.configurations.c = dap.configurations.cpp dap.configurations.java = { { type = "java", request = "attach", mode = "remote", name = "Attach Remote", cwd = "${workspaceFolder}", hostName = "127.0.0.1", port = 5005, }, } dap.configurations.gdscript = { { name = "Launch Project", type = "godot", request = "launch", project = "${workspaceFolder}", additional_options = "", }, { name = "Launch Current File", type = "godot", request = "launch", scene = "current", project = "${workspaceFolder}", additional_options = "", }, { name = "Godot - Attach to Godot", type = "godot", request = "attach", address = "127.0.0.1", port = 6007, }, } dap.configurations.lua = { { type = "nlua", request = "attach", name = "Attach to running Neovim instance", host = function() local value = vim.fn.input("Host [127.0.0.1]: ") if value ~= "" then return value end return "127.0.0.1" end, port = function() local val = tonumber(vim.fn.input("Port: ")) assert(val, "Please provide a port number") return val end, }, } -- vim.fn.sign_define('DapBreakpoint', { text = ' ', texthl = 'DapBreakpoint' }) -- vim.fn.sign_define('DapBreakpointCondition', { text = ' ', texthl = 'DapBreakpointCondition' }) -- vim.fn.sign_define('DapBreakpointRejected', { text = ' ', texthl = 'DapBreakpointRejected' }) vim.fn.sign_define("DapLogPoint", { text = " ", texthl = "DapLogPoint" }) vim.fn.sign_define("DapStopped", { text = " ", texthl = "DapStopped", linehl = "DapStoppedLine", }) local dapui = require("dapui") dapui.setup() dap.listeners.after.event_initialized["dapui_config"] = function() vim.cmd("set mouse=a") dapui.open() end dap.listeners.before.event_terminated["dapui_config"] = function() vim.cmd("set mouse=") dapui.close() end dap.listeners.before.event_exited["dapui_config"] = function() vim.cmd("set mouse=") dapui.close() end end, }, }