jay-babu / mason-nvim-dap.nvim

GNU Affero General Public License v3.0
526 stars 37 forks source link

feat: add dynamic configuration for rust using codelldb #107

Closed pedrobarco closed 1 year ago

pedrobarco commented 1 year ago

Hi, I'm using this plugin for managing my dap debuggers and I was trying to use the default configuration for codelldb.

My understanding is that you've provided an agnostic config to work with C/C++/Rust by always asking for the user to input the executable path.

I've started working on a way to improve our developer experience in rust by:

dap.configurations.rust = {
    {
        name = "LLDB: Launch",
        type = "codelldb",
        request = "launch",
        program = function()
            local output = vim.fn.systemlist("cargo build -q --message-format=json 2>1")
            for _, l in ipairs(output) do
                local json = vim.json.decode(l)
                if json == nil then
                    error("error parsing json")
                end
                if json.success == false then
                    return error("error building package")
                end
                if json.executable ~= nil then
                    return json.executable
                end
            end
        end,
        cwd = "${workspaceFolder}",
        stopOnEntry = false,
        args = {},
    },
}

I'm not quite sure if this follows any best practices but I just wanted to share how I did it and hopefully get some feedback as to which kind of features you want to support in mason-nvim-dap. Would you be interested in having such features? Does it make sense to create something like this for other languages + debuggers? Let me know what you think.

jay-babu commented 1 year ago

I am not against having this builtin. I would just want to make this solution is generic and applies to all users of rust. anyway to confirm that?

pedrobarco commented 1 year ago

I'm fairly new to rust but using cargo is for sure the idiomatic way of building apps in rust (see here).

From what I've seen so far, we'll need to:

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!

github-actions[bot] commented 1 year ago

This issue has been closed due to inactivity, and will not be monitored. If this is a bug and you can reproduce this issue on a supported version of Electron please open a new issue and include instructions for reproducing the issue.