-
-
Notifications
You must be signed in to change notification settings - Fork 96
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
[Feature] add input dialog to dapui.eval() #139
Comments
I'd say this more of role for the REPL or watch expressions. nvim-dap-ui doesn't aim to cover as many use cases as Intellij does, instead allowing for easy extensibility. If you do want to use the hover, you could write a wrapper using function()
vim.ui.input({ prompt = "> " }, function(expr)
dapui.eval(expr)
end)
end, Of course you can extra features like remembering the last expression, defaulting to the current word on no input. if not expr then
if vim.fn.mode() == "v" then
local start = vim.fn.getpos("v")
local finish = vim.fn.getpos(".")
local lines = require("dapui.util").get_selection(start, finish)
expr = table.concat(lines, "\n")
else
expr = expr or vim.fn.expand("<cexpr>")
end
end |
I find adding input box above |
On thinking about this more, the hover edit mapping makes more sense to edit the expression text rather than setting the value of the expression. I've updated the hover element so now you can use the edit mapping to edit the expression and it will update the displayed value |
BREAKING CHANGE: Previously the edit mapping would edit the value of the expression being evaluated. In the context of a hover this makes less sense and is far less likely to be the use case than changing what is being evaluated. See #139
Hello @rcarriga,
Could you explain this a bit more? Couldn't figure out what you mean. |
The edit mapping |
I have tried it and now I could edit the expression. But, there are some enhancement needed.
tesing-video.mp4 |
You haven't updated your nvim-dap-ui, that's the old version
You'd have to press |
Sorry, my bad. Btw, I have updated to the latest version now and tried again and found there is some question, and issue:
test-video.mp4 |
Seem like this one can be added by adding |
That's just how the window works. It allows you to edit the value of properties of the value. You can just press
Calling eval again with the same expression or passing |
For example, If I have a list of number that contains value [1, 10, 3, 4, 5]. Then when I press |
Yes correct though the adapter must support it |
Thanks @rcarriga for your time and response. I've bought you a cup of coffee so hopefully you will enjoy it. |
Much appreciated, thank you 😄 |
Hello @rcarriga,
When calling
lua require("dapui").eval()
, could we have the statement at cursor or highlighted expression shown above the result windows as an input text? So, we could further testing and evaluating the expression just like in the Intellij?For example, I have highlighted
list
variable and then executinglua require("dapui").eval()
to see and understand the data. After that, I wanted to filter the item that is greater than 3 and count back the result. So, if there is an input above the result window, I could just append the expression aslist.filter(data -> data > 3).toList().size()
without the need to write it into my project file and then callingdapui.eval()
again. Doing so save a lot of time and hassle when we need to evaluate multiple expression while testing logic and debugging.intellij-eval-expression-sample.mp4
The text was updated successfully, but these errors were encountered: