svaante / dape

Debug Adapter Protocol for Emacs
GNU General Public License v3.0
448 stars 25 forks source link

Automatic configuration for rust projects. #131

Closed appetrosyan closed 1 week ago

appetrosyan commented 1 month ago

I came across this package as an alternative to dap-mode, and while I feel that it has some potential, it is not usable for me.

The main problem is that it is not possible to set up debugging for Rust projects without significant tinkering. For example, suppose I wanted to debug a specific function in a pure Rust project (best case scenario, most of mine are not pure Rust).

I get the prompt that asks for the project cwd, and the executable. I get a command-line that contains what I can only describe as DIY debug configuration.

image

Most of it has to be changed, because it doesn't make use of either projection-multi-dape, which may be a configuration issue, (as a consequence of poor UX, and insufficiently detailed documentation).

The mechanism on offer, to use the Emacs built-in variable system is also quite problematic, because that would either opt everyone on the team to the same variables (and annoying prompts), or require me to store the debug configuration separately and share it with people on the team that use Emacs.

So it would be nice if it were possible to not have to specify the fairly standard elements of a debug configuration for a Rust project every time I want to run dape in a new project.

kavirajk commented 1 month ago

The main problem is that it is not possible to set up debugging for Rust projects without significant tinkering

@appetrosyan curious if you manage to make it work?

I'm on the same boat. The problem is I couldn't change those config variables after M-x dape. Not enough docs or Wiki on how to make it work.

appetrosyan commented 1 month ago

I figured out 20% of the problem. It has mostly to do with the differences between LSP mode, DAP mode and eglot. Specifically, that eglot doesn't support code leneses, means that you cannot debug a test, because the LSP doesn't give you that info.

svaante commented 1 week ago

Sorry for taking such a long time responding.

First off, I am unfamiliar with projection-multi-dape so can't help you there.

The mechanism on offer, to use the Emacs built-in variable system is also quite problematic, because that would either opt everyone on the team to the same variables (and annoying prompts), or require me to store the debug configuration separately and share it with people on the team that use Emacs.

This is by design, I don't intend packaging dape with vscode integration. Writing an dape integration with launch.json would be quite trivial, but it's not something I intend to do.

dapes default configurations for rust are a bit lacking, the default :program function for codelldb-rust and lldb-dap could be improved (contributions are welcome).

But debugging an rust compiled binary with those configurations is as simple as:

M-x dape

codelldb-rust :program "path/to/binary" or with compile codelldb-rust :program "path/to/binary" compile "cargo build"

Currently there are no specialized unit test configurations for any language package with dape, for now they are delegated to the wiki (feel free to contribute) or external packages.