Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debugger setting for Rust is broken; alternative found #150

Closed
starptr opened this issue Dec 12, 2021 · 1 comment · Fixed by #151
Closed

Debugger setting for Rust is broken; alternative found #150

starptr opened this issue Dec 12, 2021 · 1 comment · Fixed by #151
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@starptr
Copy link
Contributor

starptr commented Dec 12, 2021

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.

@starptr
Copy link
Contributor Author

starptr commented Dec 12, 2021

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?

@kylo252 kylo252 added enhancement New feature or request help wanted Extra attention is needed labels Dec 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants