From f032fb9e2fadaaec6f71aaf45ed1d94128ea45cd Mon Sep 17 00:00:00 2001 From: Elvis Claros Castro Date: Thu, 3 Oct 2024 11:41:10 -0300 Subject: feat: add rust tools --- lua/pi/dap/configs/rust.old | 57 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 lua/pi/dap/configs/rust.old (limited to 'lua/pi/dap/configs/rust.old') diff --git a/lua/pi/dap/configs/rust.old b/lua/pi/dap/configs/rust.old new file mode 100644 index 0000000..9ca976f --- /dev/null +++ b/lua/pi/dap/configs/rust.old @@ -0,0 +1,57 @@ +local dap = require("dap") + +local rust_adapter = nil +local rust_adapters = { "lldb-vscode", "codelldb" } +for _, adapter in pairs(rust_adapters) do + if vim.fn.executable(adapter) then + rust_adapter = adapter + end +end + +if rust_adapter ~= nil then + dap.adapters.lldb = { + type = "executable", + command = rust_adapter, + name = "lldb", + } + + dap.configurations.rust = { + { + name = "launch", + type = "lldb", + request = "launch", + program = function() + local dir = vim.fn.getcwd() + return dir .. "/target/debug/" .. vim.fs.basename(dir) + end, + cwd = "${workspaceFolder}", + stopOnEntry = false, + args = function() + local resp = vim.fn.input "Arguments: " + if resp == "" then + return {} + end + + return vim.fn.split(resp, " ") + end, + }, + { + name = "custom", + type = "lldb", + request = "launch", + program = function() + return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file") + end, + cwd = "${workspaceFolder}", + stopOnEntry = false, + args = function() + local resp = vim.fn.input "Arguments: " + if resp == "" then + return {} + end + + return vim.fn.split(resp, " ") + end, + }, + } +end -- cgit v1.2.3