-
Notifications
You must be signed in to change notification settings - Fork 96
debugger shows javascript object properties with getters as undefined
#14
Comments
Indeed annoying for stuff like |
The problem is the node debugger protocol. We would fix all those issues if there was an debugger API for that. Node-inspector has exactly the same issues and node-inspector exists much longer than VS Code and has not solved them... |
If the debugger can evaluate simple expressions, wouldn't |
@mjbvz sure, that's possible. It is just a bit expensive to probe individual object properties that have a value of undefined via evaluate requests for this information. Until node 0.12.x I was relying on injecting debug protocol extensions into node. But this stopped working in later versions. |
@weinand the VS Code debug protocol has this boolean property |
@felixfbecker a 'Scope' has an optional attribute 'expensive'. It is a hint to the UI to refrain from expanding the scope voluntarily. |
Excuse me, I was mixing things up. |
Fix in branch |
Objects that have properties with getters / setters incorrectly display the value of the properties as 'undefined'. (See first attached screenshot, 'object3.myprop'). This leads to confusing debugging sessions. In contrast, the Chrome debugger makes it clear that there is a getter which would be invoked. (See second screenshot).
Suprisingly, object properties that have a numeric name will automatically invoke the getter function and display its value (First attached screenshot, 'object4.4').
Note that evaluating the property will yield the value '3' correctly in both cases.
The test code is:
And for the numeric property:
Is it possible to influence how properties with a getter are displayed in the debugger? Or to at least avoid that they are displayed as just 'undefined'.
Thanks in advance!
The text was updated successfully, but these errors were encountered: