jay-babu / mason-nvim-dap.nvim

GNU Affero General Public License v3.0
551 stars 39 forks source link

how to change codelldb configuration? #104

Closed joelpeapen closed 1 year ago

joelpeapen commented 1 year ago

the default codelldb configuration is

M.codelldb = {
    {
        name = 'LLDB: Launch',
        type = 'codelldb',
        request = 'launch',
        program = function()
            return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file')
        end,
        cwd = '${workspaceFolder}',
        stopOnEntry = false,
        args = {},
    },
}

how do i change both the adapter and the configuration for a language using the advanced customization to get something like this:

dap.adapters.codelldb = {
    type = "server",
    port = "${port}",
    executable = {
        command = os.getenv("XDG_DATA_HOME") .. "/nvim/mason/bin/codelldb",
        args = { "--port", "${port}" },
    },
}

dap.configurations.c = {
    {
        name = "launch file",
        type = "codelldb",
        request = "launch",
        program = "${fileDirname}/" .. "${fileBasenameNoExtension}",
        cwd = "${fileDirname}",
        stopOnEntry = false,
        args = {}
    }
}
jay-babu commented 1 year ago

hello, can you read this? https://github.com/jay-babu/mason-nvim-dap.nvim#advanced-customization. is anything unclear?

joelpeapen commented 1 year ago

yes i read it.

require('mason-nvim-dap').setup({
    automatic_setup = true,
    ensure_installed = { "codelldb" },
    automatic_installation = false,
    handlers = {
        function(config)
            require('mason-nvim-dap').default_setup(config)
        end,
    },
    c = function(config)
        config.adapters = {
            type = "server",
            port = "${port}",
            executable = {
                command = os.getenv("XDG_DATA_HOME") .. "/nvim/mason/bin/codelldb",
                args = { "--port", "${port}" },
            },
        }
        config.configurations = {
            name = "launch file",
            type = "codelldb",
            request = "launch",
            program = "${fileDirname}/" .. "${fileBasenameNoExtension}",
            cwd = "${fileDirname}",
            stopOnEntry = false,
            args = {}
        }
        require('mason-nvim-dap').default_setup(config) -- don't forget this!
    end,
})

config.configurations hasn't changed, it still asks for path to executable. Also, for some reason vim.fn.exepath("codelldb") from default adapter config throws ENOENT even though :lua vim.fn.exepath("codelldb") detects the binary.

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.