Skip to content

[feature] Added silent parameter to the dap.repl.execute function to not repeat the command after execution.#1566

Open
banana59 wants to merge 1 commit intomfussenegger:masterfrom
banana59:feature/silent_parameter_dap_repl_execute
Open

[feature] Added silent parameter to the dap.repl.execute function to not repeat the command after execution.#1566
banana59 wants to merge 1 commit intomfussenegger:masterfrom
banana59:feature/silent_parameter_dap_repl_execute

Conversation

@banana59
Copy link

@banana59 banana59 commented Oct 23, 2025

Example for Python

local repl = require('dap.repl')

repl.commands = vim.tbl_extend('force', repl.commands, {
    custom_commands = {
        ["."] = function(expr)
            if not expr or expr:match("^%s*$") then
                repl.append('Usage: . <expression>')
                return
            end

            local wrapped = 'repr(' .. expr .. ')'
            repl.execute(wrapped, {context='repl', silent=true})
        end,
    }
})

Execution in the repl:

. <variable>

to show a variable without meta information.

I have tested this in python for the nvim-dap commit 6782b09.

This is related to these issues:

repeat the command after execution. Example:
    local repl = require('dap.repl')

    repl.commands = vim.tbl_extend('force', repl.commands, {
        custom_commands = {
            ["."] = function(expr)
                if not expr or expr:match("^%s*$") then
                    repl.append('Usage: . <expression>')
                    return
                end

                local wrapped = 'repr(' .. expr .. ')'
                repl.execute(wrapped, {context='repl', silent=true})
            end,
        }
    })

Execution in the repl:

    . <variable>
@banana59 banana59 force-pushed the feature/silent_parameter_dap_repl_execute branch from e3947e2 to eb0f578 Compare October 23, 2025 13:29
@mfussenegger
Copy link
Owner

Isn't this a bit confusing if there's no separation/variable indication in the output?

@banana59
Copy link
Author

Certainly in some cases, that's why the default is still verbose. I quite liked the neatness in this usecase, that . dataFrame directly outputs the content instead of first outputting the interpreted version like repr(dataFrame).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants