Open nirvdrum opened 2 years ago
Sounds like a VSCode extension/DAP debugger feature, so moving to oracle/graal.
Although maybe Ruby needs to implement some interop message for this? There is no scope getScopeArguments() or so message in InteropLibrary/NodeLibrary as far as I can see.
We could maybe expose those as some kind of variable that would be listed in a scope's getMembers(), but not in Binding#local_variables (needed for compatibility). It would need to have some Ruby-invalid local var prefix to be able to filter them.
@entlicher Is that the expected solution? Or should there be something in interop/DAP to show all user arguments passed to a function/method/closure (basically frame.getArguments().subList(INTERNAL_ARGUMENT, frame.getArguments().length)
)?
I think you should be able to evaluate in that method p(...)
and p(*)
. Regarding *
that changed in 3.1/3.2 I think so it might not work yet, but in recent CRuby *
/**
/&
are not ignores but just unnamed arguments which can be used in the method.
They don't appear in Binding#local_variables
though (I used https://irb-wasm.vercel.app/):
irb(main):009:0> def m(*); p binding.local_variables; p(*); end
irb(main):010:0> m(1,2)
[]
1
2
=> [1, 2]
The existing Ruby debuggers are not showing anonymous arguments. I've tested: VS Code with https://marketplace.visualstudio.com/items?itemName=rebornix.Ruby
VS Code with https://marketplace.visualstudio.com/items?itemName=KoichiSasada.vscode-rdbg
RubyMine 2022.2.1
I think that users can just evaluate p(*)
to find arguments in these rare cases when they are anonymized.
When using the VS Code debugger, a called method's arguments will appear in the local variables view. However, if the parameters are unnamed (e.g.,
def m(*)
ordef m(...)
), they won't appear in the local list. It would be immensely helpful if we could display those values under a synthetic variable name or another section in the local variables view.