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

Make dap.repl.evaluate_handler public #1089

Closed
wants to merge 1 commit into from

Conversation

wookayin
Copy link
Contributor

@wookayin wookayin commented Nov 12, 2023

This allows users to have a minimal configuration point for customizing
dap-repl's behavior on printing variables or expressions.

(One possible approach/workaround for #1062)

This allows users to have a minimal configuration point for customizing
dap-repl's behavior on printing variables or expressions.
@mfussenegger
Copy link
Owner

Thanks but I'd rather keep that prevent. Exposing it might get in the way latter when adding proper formatting extensions.

If you you really want to override the full handler, you could instead define a custom command:

  repl.commands.custom_commands = {
    [".p"] = function(text)
      local session = dap.session()
      if not session then
        return
      end
      session:evaluate(text, function(err, resp)
        vim.print(err or "no error")
        vim.print(resp or "no response")
      end)
    end,
  }

@wookayin
Copy link
Contributor Author

wookayin commented Nov 12, 2023

I understand that you don't want this approach. However, what I wanted to override is the evaluate_handler without any custom commands (for #737 #1062, etc.), evaluation of any arbitrary expressions in the REPL; so custom commands would not work for me.

@mfussenegger
Copy link
Owner

However, what I wanted to override is the evaluate_handler without any custom commands (for #737 #1062, etc.), evaluation of any arbitrary expressions in the REPL; so custom commands would not work for me.

The snippet I posted allows to evaluate arbitrary expressions. .p foobar would evaluate foobar.

@wookayin
Copy link
Contributor Author

I'd like to have foobar working instead of typing .p foobar.

dap> foobar
"foobar"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants