LunarVim/lunarvim.org

Debugger setting for Rust is broken; alternative found

starptr opened this issue · 1 comments

Debugging section of the Rust page says to run

:DIInstall ccppr_lldb

but dap-installer does not implement installing ccppr_lldb (see pocco81/dap-buddy.nvim#50). Is this just temporarily broken or was this a temporary placeholder? If it's a placeholder, I figured out how to add debug support (with pretty-printing!):

  1. Run :DIInstall codelldb first

  2. Add the following to ftplugin/rust.lua:

Edit: actually no, see the next comment

(This code is no longer relevant) ```lua local dap_install = require "dap-install" dap_install.config("codelldb", { -- adapter code taken from https://github.com/mfussenegger/nvim-dap/wiki/C-C---Rust-(via--codelldb) adapters = function(on_adapter) local stdout = vim.loop.new_pipe(false) local stderr = vim.loop.new_pipe(false) local cmd = require("dap-install.config.settings").options["installation_path"] .. "codelldb/extension/adapter/codelldb" local handle, pid_or_err local opts = { stdio = {nil, stdout, stderr}, detached = true, } handle, pid_or_err = vim.loop.spawn(cmd, opts, function(code) stdout:close() stderr:close() handle:close() if code ~= 0 then print("codelldb exited with code", code) end end) assert(handle, "Error running codelldb: " .. tostring(pid_or_err)) stdout:read_start(function(err, chunk) assert(not err, err) if chunk then local port = chunk:match('Listening on port (%d+)') if port then vim.schedule(function() on_adapter({ type = 'server', host = '127.0.0.1', port = port }) end) else vim.schedule(function() require("dap.repl").append(chunk) end) end end end) stderr:read_start(function(err, chunk) assert(not err, err) if chunk then vim.schedule(function() require("dap.repl").append(chunk) end) end end) end, configurations = { { type = "codelldb", request = "launch", name = "Launch Rust", program = function() return vim.fn.input('Path to build (w. symbols): ', vim.fn.getcwd() .. '/target/debug/', 'file') end, cwd = "${workspaceFolder}", stopOnEntry = false, }, } }) ```

My main focus was to find a solution that has pretty-printing, and while ccppr_vsc did work, there was no pretty-printing.

Ok so this config is actually totally unnecessary LOL, it still works with pretty-printing with an empty table passed into dap_install.config. Turns out working at 3am was a bad idea, who knew!

Only one thing left now: is ccppr_lldb supposed to work?