-
Notifications
You must be signed in to change notification settings - Fork 345
Description
I just discovered customDescriptionGenerator - I love it! I just wished it would be easier to configure.
At the moment, I have to stop and start a new debug session every time I change this property. It would be very nice if I could just change that property and it would update immediately!
Also, that property is not very well suited for more complex description generators. To work around this, I set a custom description generator that just delegates to globalThis.$$customDescription and then used my debug visualizer extension to inject a custom script into the debugger that sets this property.
Generally, I think it would make sense to have a default customDescriptionGenerator that can be overriden by setting a globalThis property - then extensions override this property at runtime without having to instruct the user to adjust the launch configuration.
This is how it looks currently:

This is what I managed to get with a customDescriptionGenerator:

(maybe it makes sense to investigate if we can get this behavior by default, can we support custom description generators for property values in objects?)
I used this code:
globalThis.customDescription = (obj, def) => {
if (Object.getPrototypeOf(obj) !== Object.getPrototypeOf({})) {
return def;
}
const body = Object.entries(obj).map(([key, val]) => {
return `${key}: ${val}`
}).join(", ");
return `{${body}}`;
}And this custom description generator:
"customDescriptionGenerator": "function (def) { return globalThis.customDescription ? globalThis.customDescription(this, def) : def }"